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 = [
./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;
};

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;
defaultSopsFormat = "yaml";
};
/*
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
settings = {
@@ -58,7 +58,7 @@
port = 2222;
};
};
*/
services.mpris-proxy.enable = true;
programs.ssh.enable = true;

View File

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