Compare commits
7 Commits
3b5bb7bc66
...
a394733024
| Author | SHA1 | Date | |
|---|---|---|---|
| a394733024 | |||
| 9a3c639efe | |||
| b1dd43f2ca | |||
| 59d36c35ff | |||
| ce2d635b85 | |||
| 6fbed5161a | |||
| 2a58de8648 |
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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 = {};
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
)
|
||||
);
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user