diff --git a/flake.nix b/flake.nix index 6f85fa3..ddf92ce 100644 --- a/flake.nix +++ b/flake.nix @@ -91,9 +91,15 @@ util = import ./util {inherit inputs;}; forEachPkgs = util.forEachPkgs; + mkNixosInstaller = util.mkNixosInstaller; mkNixosSystem = util.mkNixosSystem; mkDarwinSystem = util.mkDarwinSystem; mkHome = util.mkHome; + syncthingConfiguration = util.syncthingConfiguration; + + installerSystems = { + basic = mkNixosInstaller "basic" []; + }; nixosSystems = { horizon = mkNixosSystem "horizon"; @@ -164,10 +170,14 @@ }; }); + installerConfigurations = installerSystems; + nixosConfigurations = nixosSystems; darwinConfigurations = darwinSystems; homeConfigurations = homeConfigurations; + + syncthingConfiguration = syncthingConfiguration; }; } diff --git a/modules/nixos-modules/sync.nix b/modules/nixos-modules/sync.nix index 96f54d5..bf43041 100644 --- a/modules/nixos-modules/sync.nix +++ b/modules/nixos-modules/sync.nix @@ -1,7 +1,7 @@ { config, lib, - syncthingConfiguration, + outputs, ... }: let mountDir = "/mnt/sync"; @@ -27,7 +27,7 @@ in { configDir = configDir; overrideDevices = true; overrideFolders = true; - configuration = syncthingConfiguration; + configuration = outputs.syncthingConfiguration; deviceName = config.networking.hostName; }; } diff --git a/util/default.nix b/util/default.nix index 97bfa49..fb2f83d 100644 --- a/util/default.nix +++ b/util/default.nix @@ -52,12 +52,6 @@ home-manager-config ../modules/system-modules ]; - - syncthingConfiguration = nix-syncthing.lib.syncthingConfiguration { - modules = [ - (import ../configurations/syncthing) - ]; - }; in { forEachPkgs = lambda: forEachSystem (system: lambda system (pkgsFor system)); @@ -68,9 +62,19 @@ in { (lib.mkUnless condition no) ]; + mkNixosInstaller = host: userKeys: + nixpkgs.lib.nixosSystem { + modules = [ + { + # TODO: authorized keys for all users and hosts + } + ../configurations/nixos/${host} + ]; + }; + mkNixosSystem = host: nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs util syncthingConfiguration;}; + specialArgs = {inherit inputs outputs util;}; modules = system-modules ++ [ @@ -115,4 +119,10 @@ in { ../configurations/home-manager/${user} ]; }; + + syncthingConfiguration = nix-syncthing.lib.syncthingConfiguration { + modules = [ + (import ../configurations/syncthing) + ]; + }; }