From 9a3c639efe81563afe1bdba1064a07f9bd3c118c Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 18 Aug 2025 23:41:55 -0500 Subject: [PATCH] recursion --- home-manager/default.nix | 7 +++---- home-manager/users/default.nix | 26 -------------------------- system-config/users/default.nix | 8 ++++---- 3 files changed, 7 insertions(+), 34 deletions(-) delete mode 100644 home-manager/users/default.nix diff --git a/home-manager/default.nix b/home-manager/default.nix index cef5a9f..3482042 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -3,7 +3,6 @@ imports = [ ./programs ./services - ./users ]; options.homeconfig = with lib; { @@ -12,7 +11,7 @@ default = null; }; - username = mkOption { + name = mkOption { type = with types; nullOr str; default = null; }; @@ -30,9 +29,9 @@ config = { - home.username = lib.mkDefault config.homeconfig.username; + home.username = lib.mkDefault config.homeconfig.name; - home.homeDirectory = lib.mkDefault "/home/${config.homeconfig.username}"; + home.homeDirectory = lib.mkDefault "/home/${config.home.username}"; programs.home-manager.enable = config.homeconfig.standalone.enable; }; diff --git a/home-manager/users/default.nix b/home-manager/users/default.nix deleted file mode 100644 index 0a02c09..0000000 --- a/home-manager/users/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ config, lib, osConfig, ... }: { - - imports = [ - ./nathan - ]; - - options.homeconfig = { - host = lib.options.mkOption { - type = lib.types.nullOr lib.types.str; - default = osConfig.sysconfig.host; - }; - - username = lib.options.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - }; - - home-manager.enable = lib.options.mkOption { - type = lib.types.bool; - default = false; - description = "Whether this is a standalone home-manager setup"; - }; - }; - - config = {}; -} diff --git a/system-config/users/default.nix b/system-config/users/default.nix index 7e84bb8..fad0a9b 100644 --- a/system-config/users/default.nix +++ b/system-config/users/default.nix @@ -5,7 +5,7 @@ userType = types.submodule ({ name, ... }: { options = with lib; { - username = mkOption { + usrname = mkOption { type = with types; passwdEntry str; default = name; }; @@ -64,7 +64,7 @@ config = { users.users = builtins.mapAttrs (name: user: { - name = user.username; + name = user.usrname; isNormalUser = true; uid = user.uid; hashedPasswordFile = lib.mkIf (user.hashedPasswordFile != null) user.hashedPasswordFile; @@ -88,11 +88,11 @@ { homeconfig = { host = config.sysconfig.host; - username = user.username; + name = user.usrname; graphical = config.sysconfig.graphical; }; } - ] ++ (if inputs ? ${user.username} then [ (inputs.${user.username} { config = config.home-manager.users.${user.username}; inherit inputs; }) ] else []) + ] ++ (if inputs ? ${user.usrname} then [ (inputs.${user.usrname} { config = config.home-manager.users.${user.usrname}; inherit lib pkgs inputs; }) ] else []) ++ user.home-manager.extraModules))) (builtins.removeAttrs config.sysconfig.users