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