diff --git a/nix/lib/default.nix b/nix/lib/default.nix index 710a658..b75aefc 100644 --- a/nix/lib/default.nix +++ b/nix/lib/default.nix @@ -1,9 +1,11 @@ -{ lib, ... }: +{ lib, config, ... }: let - inherit (lib.attrsets) concatMapAttrs; + cfg = config.flake; + inherit (lib.attrsets) mapAttrs concatMapAttrs; in { flake.lib = { flattenAttrs = attrset: concatMapAttrs (_: v: v) attrset; + forAllUsers = f: mapAttrs f cfg.manifest.users; }; } diff --git a/nix/manifest.nix b/nix/manifest.nix index 5c46f9f..f3cd69c 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -8,7 +8,6 @@ let }; nixpkgs.hostPlatform = "x86_64-linux"; boot.loader.systemd-boot.enable = true; - system.stateVersion = "25.05"; networking = { inherit hostName; }; }; in diff --git a/nix/modules/system.nix b/nix/modules/system.nix new file mode 100644 index 0000000..c2af5c0 --- /dev/null +++ b/nix/modules/system.nix @@ -0,0 +1,10 @@ +{ + flake.modules.nixos.default = { + system.stateVersion = "25.11"; + }; + flake.modules.homeManager.default = + { osConfig, ... }: + { + home.stateVersion = osConfig.system.stateVersion; + }; +} diff --git a/nix/modules/users.nix b/nix/modules/users.nix index cfdeba5..6a423fd 100644 --- a/nix/modules/users.nix +++ b/nix/modules/users.nix @@ -1,12 +1,13 @@ { config, lib, ... }: let - inherit (config.flake.lib) flattenAttrs; + cfg = config.flake; + inherit (config.flake.lib) forAllUsers flattenAttrs; inherit (lib.attrsets) filterAttrs; - owner = flattenAttrs (filterAttrs (_: v: (v.primary or false)) config.flake.manifest.users); + owner = flattenAttrs (filterAttrs (_: v: (v.primary or false)) cfg.manifest.users); in { flake.modules.nixos.default = - { pkgs, ... }: + { pkgs, config, ... }: { #TODO: move sudo/security options elsewhere security.sudo.wheelNeedsPassword = false; @@ -26,5 +27,12 @@ in openssh.authorizedKeys.keys = [ owner.pubkey ]; }; }; + home-manager.users = forAllUsers ( + name: _: { + #TODO: move into nixos/darwin config - should not apply to homeConfigurations + home.username = name; + home.homeDirectory = config.users.users.${name}.home; + } + ); }; }