72 lines
1.7 KiB
Nix
72 lines
1.7 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
...
|
|
}: let
|
|
systems = [
|
|
"aarch64-darwin"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"x86_64-linux"
|
|
];
|
|
pkgsFor = system: nixpkgs.legacyPackages.${system};
|
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
|
forEachPkgs = lambda: forEachSystem (system: lambda (pkgsFor system));
|
|
in {
|
|
# development tooling
|
|
devShells = forEachPkgs (pkgs: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
# for version controlling this repo
|
|
git
|
|
# for formatting code in this repo
|
|
alejandra
|
|
# for viewing configuration options defined in this repo
|
|
nix-inspect
|
|
];
|
|
};
|
|
});
|
|
|
|
# library contents
|
|
nixosModules.default = self.nixosModules.syncthing;
|
|
nixosModules.syncthing = import ./lib/nixos-module.nix;
|
|
|
|
lib = {
|
|
evalConfig = import ./lib/eval-config.nix;
|
|
syncthingConfiguration = {modules, ...}:
|
|
self.lib.evalConfig (
|
|
{inherit (nixpkgs) lib;}
|
|
// {
|
|
modules =
|
|
modules
|
|
++ [
|
|
(import ./lib/base-module.nix)
|
|
];
|
|
}
|
|
);
|
|
};
|
|
|
|
# example configuration
|
|
nixosConfigurations = {
|
|
default = nixpkgs.lib.nixosSystem {
|
|
specialArgs = {inherit self;};
|
|
modules = [
|
|
self.nixosModules.syncthing
|
|
./example/nixos-configuration.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
syncthingConfiguration = self.lib.syncthingConfiguration {
|
|
modules = [
|
|
(import ./example/configuration.nix)
|
|
];
|
|
};
|
|
};
|
|
}
|