diff --git a/cerulean/home/default.nix b/cerulean/home/default.nix deleted file mode 100644 index 8ae23c6..0000000 --- a/cerulean/home/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -# NOTE: you can access the system configuration via the `osConfig` arg -{ - username, - lib, - ... -}: { - # WARNING: required for home-manager to work - programs.home-manager.enable = true; # user must apply lib.mkForce - # Nicely reload systemd units when changing configs - systemd.user.startServices = lib.mkDefault "sd-switch"; - - home = { - username = lib.mkDefault username; - homeDirectory = lib.mkDefault "/home/${username}"; - - sessionVariables = { - NIX_SHELL_PRESERVE_PROMPT = lib.mkDefault 1; - }; - }; -} diff --git a/cerulean/nixos/home.nix b/cerulean/nixos/home.nix index 82117d8..a63b6e8 100644 --- a/cerulean/nixos/home.nix +++ b/cerulean/nixos/home.nix @@ -12,22 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. { - _cerulean, - config, root, + config, lib, + _cerulean, ... } @ args: let inherit (builtins) + attrNames + filter pathExists ; - - inherit - (lib) - filterAttrs - mapAttrs - ; in { imports = [ _cerulean.homeManager.nixosModules.default @@ -53,27 +49,18 @@ in { config = { home-manager = { - useUserPackages = lib.mkDefault false; - useGlobalPkgs = lib.mkDefault true; - - overwriteBackup = lib.mkDefault false; - backupFileExtension = lib.mkDefault "bak"; - users = config.users.users - |> filterAttrs (name: value: value.manageHome && pathExists /${root}/homes/${name}) - |> mapAttrs (name: _: {...}: { - imports = [/${root}/homes/${name}]; - - # per-user arguments - _module.args.username = name; - }); + |> attrNames + |> filter (x: pathExists (root + "/homes/${x}")) + |> (x: + lib.genAttrs x (y: + import (root + "/homes/${y}"))); extraSpecialArgs = _cerulean.specialArgs; sharedModules = [ - ../home - - (import /${root}/nixpkgs.nix) + # user configuration + (import (root + "/nixpkgs.nix")) # options declarations (import ./nixpkgs.nix (args // {contextName = "homes";})) ]; diff --git a/cerulean/nixos/nixpkgs.nix b/cerulean/nixos/nixpkgs.nix index 946748b..40a3d57 100644 --- a/cerulean/nixos/nixpkgs.nix +++ b/cerulean/nixos/nixpkgs.nix @@ -73,23 +73,19 @@ in { _module.args = removeAttrs repos ["pkgs" "base"]; nixpkgs = let - nixpkgsConfig = { + nixpkgConfig = { config = lib.mkForce (basePkgs.config or {}); overlays = lib.mkForce (basePkgs.overlays or []); }; - - nixpkgsHostsConfig = - nixpkgsConfig - // { - flake.source = lib.mkForce base; - }; - - nixpkgsHomesConfig = lib.mkIf (!config.home-manager.useGlobalPkgs) nixpkgsConfig; in if contextName == "hosts" - then nixpkgsHostsConfig + then + nixpkgConfig + // { + flake.source = lib.mkForce base; + } else if contextName == "homes" - then nixpkgsHomesConfig + then nixpkgConfig else {}; }; } diff --git a/cerulean/snow/lib/nodes.nix b/cerulean/snow/lib/nodes.nix index 48a583d..f9b6537 100644 --- a/cerulean/snow/lib/nodes.nix +++ b/cerulean/snow/lib/nodes.nix @@ -65,7 +65,7 @@ # flatten recursion result |> concatLists # find import location - |> map (group: nt.findImport /${root}/groups/${group._name}) + |> map (group: nt.findImport (/${root}/groups/${group._name}) # filter by uniqueness |> nt.prim.unique # ignore missing groups