Compare commits

...

7 Commits

Author SHA1 Message Date
a394733024 function 2025-08-19 00:55:45 -05:00
9a3c639efe recursion 2025-08-19 00:55:45 -05:00
b1dd43f2ca args 2025-08-19 00:55:45 -05:00
59d36c35ff convention 2025-08-19 00:55:45 -05:00
ce2d635b85 convention? 2025-08-19 00:55:45 -05:00
6fbed5161a try 2025-08-19 00:55:45 -05:00
2a58de8648 type? 2025-08-19 00:55:45 -05:00
4 changed files with 38 additions and 64 deletions

View File

@@ -3,7 +3,6 @@
imports = [ imports = [
./programs ./programs
./services ./services
./users
]; ];
options.homeconfig = with lib; { options.homeconfig = with lib; {
@@ -12,7 +11,7 @@
default = null; default = null;
}; };
username = mkOption { name = mkOption {
type = with types; nullOr str; type = with types; nullOr str;
default = null; default = null;
}; };
@@ -30,9 +29,9 @@
config = { 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; programs.home-manager.enable = config.homeconfig.standalone.enable;
}; };

View File

@@ -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 = {};
}

View File

@@ -38,7 +38,7 @@
defaultSopsFile = ./secrets.yaml; defaultSopsFile = ./secrets.yaml;
defaultSopsFormat = "yaml"; defaultSopsFormat = "yaml";
}; };
/*
nix = { nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
settings = { settings = {
@@ -58,7 +58,7 @@
port = 2222; port = 2222;
}; };
}; };
*/
services.mpris-proxy.enable = true; services.mpris-proxy.enable = true;
programs.ssh.enable = true; programs.ssh.enable = true;

View File

@@ -3,52 +3,52 @@
options.sysconfig = with lib; { options.sysconfig = with lib; {
users = let users = let
userType = types.submodule ({ username, ... }: { userType = types.submodule ({ name, ... }: {
options = { options = with lib; {
username = lib.mkOption { name = mkOption {
type = with types; str; type = with types; passwdEntry str;
default = username; default = name;
}; };
home-manager = { home-manager = {
enable = lib.mkOption { enable = mkOption {
type = with types; bool; type = with types; bool;
default = false; default = false;
}; };
standalone = lib.mkOption { standalone = mkOption {
type = with types; bool; type = with types; bool;
default = false; default = false;
description = "is this home-manager standalone?"; description = "is this home-manager standalone?";
}; };
extraModules = lib.mkOption { extraModules = mkOption {
type = with types; listOf raw; type = with types; listOf raw;
default = []; default = [];
}; };
}; };
sshKeys = lib.mkOption { sshKeys = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = []; default = [];
}; };
uid = lib.mkOption { uid = mkOption {
type = with types; nullOr int; type = with types; nullOr int;
default = null; default = null;
}; };
hashedPasswordFile = lib.mkOption { hashedPasswordFile = mkOption {
type = with types; nullOr str; type = with types; nullOr str;
default = null; default = null;
}; };
extraGroups = lib.mkOption { extraGroups = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = []; default = [];
}; };
shell = lib.mkOption { shell = mkOption {
type = with types; package; type = with types; package;
default = pkgs.shadow; default = pkgs.shadow;
}; };
@@ -64,7 +64,7 @@
config = { config = {
users.users = builtins.mapAttrs (name: user: { users.users = builtins.mapAttrs (name: user: {
name = user.username; name = user.name;
isNormalUser = true; isNormalUser = true;
uid = user.uid; uid = user.uid;
hashedPasswordFile = lib.mkIf (user.hashedPasswordFile != null) user.hashedPasswordFile; hashedPasswordFile = lib.mkIf (user.hashedPasswordFile != null) user.hashedPasswordFile;
@@ -83,25 +83,26 @@
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
inputs.home-manager-config inputs.home-manager-config
]; ];
users = (builtins.mapAttrs users = builtins.listToAttrs (builtins.map
(name: user: (lib.mkMerge [ (x: {
{ name = x;
homeconfig = { value = (lib.mkMerge ([
host = config.sysconfig.host; {
username = user.username; homeconfig = {
graphical = config.sysconfig.graphical; host = config.sysconfig.host;
}; name = x;
} graphical = config.sysconfig.graphical;
] ++ (if inputs ? ${user.username} then [ (inputs.${user.username} { config = config.home-manager.users.${user.username}; }) ] else []) };
++ user.home-manager.extraModules)) }
(builtins.removeAttrs ] ++ (if inputs ? ${x} then [ (inputs.${x} { config = config.home-manager.users.${x}; inherit lib pkgs inputs; }) ] else [])
config.sysconfig.users ++ config.sysconfig.users.${x}.home-manager.extraModules));
(builtins.partition })
(name: (config.sysconfig.users.${name}.home-manager.enable && !config.sysconfig.users.${name}.home-manager.standalone)) (builtins.partition
(builtins.attrNames config.sysconfig.users) (y: (config.sysconfig.users.${y}.home-manager.enable && !config.sysconfig.users.${y}.home-manager.standalone))
).wrong (builtins.attrNames config.sysconfig.users)
) ).wrong
); );
}; };
}; };
} }