This commit is contained in:
parent
5f644d0ccd
commit
a394b9cefd
167 changed files with 2795 additions and 2122 deletions
|
@ -7,10 +7,12 @@
|
|||
vpn,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
cfg = config.ccr;
|
||||
inherit (lib) types;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.ccr = {
|
||||
enable = lib.mkEnableOption "ccr";
|
||||
|
||||
|
@ -31,12 +33,12 @@ in {
|
|||
|
||||
modules = lib.mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
packages = lib.mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
autologin = lib.mkOption {
|
||||
|
@ -56,63 +58,74 @@ in {
|
|||
|
||||
extraGroups = lib.mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
|
||||
extraModules = lib.mkOption {
|
||||
type = types.listOf types.deferredModule;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
backupPaths = lib.mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
(lib.optionalAttrs (builtins.hasAttr "backup" options) {
|
||||
backup.paths = cfg.backupPaths;
|
||||
})
|
||||
{
|
||||
# FIXME shouldn't set these groups by default
|
||||
ccr.extraGroups = ["wheel" "fuse" "video" "dialout" "systemd-journal" "camera"];
|
||||
ccr.modules = ["shell" "git" "nix-index" "btop"];
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
(lib.optionalAttrs (builtins.hasAttr "backup" options) {
|
||||
backup.paths = cfg.backupPaths;
|
||||
})
|
||||
{
|
||||
# FIXME shouldn't set these groups by default
|
||||
ccr.extraGroups = [
|
||||
"wheel"
|
||||
"fuse"
|
||||
"video"
|
||||
"dialout"
|
||||
"systemd-journal"
|
||||
"camera"
|
||||
];
|
||||
ccr.modules = [
|
||||
"shell"
|
||||
"git"
|
||||
"nix-index"
|
||||
"btop"
|
||||
];
|
||||
|
||||
users.users.${cfg.username} = {
|
||||
inherit (config.ccr) hashedPassword extraGroups description;
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
shell = cfg.shell;
|
||||
openssh.authorizedKeys.keys = config.ccr.authorizedKeys;
|
||||
};
|
||||
users.users.${cfg.username} = {
|
||||
inherit (config.ccr) hashedPassword extraGroups description;
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
shell = cfg.shell;
|
||||
openssh.authorizedKeys.keys = config.ccr.authorizedKeys;
|
||||
};
|
||||
|
||||
programs.fish.enable = true;
|
||||
programs.fish.enable = true;
|
||||
|
||||
services.getty.autologinUser =
|
||||
if config.ccr.autologin
|
||||
then cfg.username
|
||||
else null;
|
||||
services.getty.autologinUser = if config.ccr.autologin then cfg.username else null;
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${cfg.username} = {
|
||||
imports =
|
||||
fleetHmModules cfg.modules
|
||||
++ [
|
||||
{
|
||||
_module.args = {
|
||||
inherit (config.age) secrets;
|
||||
inherit (cfg) username;
|
||||
inherit vpn;
|
||||
hostname = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
]
|
||||
++ cfg.extraModules;
|
||||
home.packages = cfg.packages;
|
||||
home.stateVersion = config.system.stateVersion;
|
||||
};
|
||||
}
|
||||
]);
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${cfg.username} = {
|
||||
imports =
|
||||
fleetHmModules cfg.modules
|
||||
++ [
|
||||
{
|
||||
_module.args = {
|
||||
inherit (config.age) secrets;
|
||||
inherit (cfg) username;
|
||||
inherit vpn;
|
||||
hostname = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
]
|
||||
++ cfg.extraModules;
|
||||
home.packages = cfg.packages;
|
||||
home.stateVersion = config.system.stateVersion;
|
||||
};
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue