enable statx

This commit is contained in:
2023-10-01 23:14:05 +03:00
parent 5c83f7407a
commit 25e8191177
15 changed files with 110 additions and 122 deletions

View File

@@ -16,6 +16,6 @@
programs.ssh.knownHosts = let
sshAttrs = lib.genAttrs ["extraHostNames" "publicKey"] (_: null);
in
lib.mapAttrs (_name: cfg: builtins.intersectAttrs sshAttrs cfg) myData.hosts;
lib.mapAttrs (_name: builtins.intersectAttrs sshAttrs) myData.hosts;
};
}

View File

@@ -2,9 +2,10 @@
config,
lib,
myData,
#home-manager,
...
}: {
}: let
cfg = config.mj.base.users;
in {
options.mj.base.users = with lib.types; {
devEnvironment = lib.mkOption {
type = bool;
@@ -12,25 +13,23 @@
};
passwd = lib.mkOption {
type = attrsOf (submodule (
{...}: {
options = {
passwordFile = lib.mkOption {
type = nullOr path;
default = null;
};
initialPassword = lib.mkOption {
type = nullOr str;
default = null;
};
extraGroups = lib.mkOption {
type = listOf str;
default = [];
};
type = attrsOf (submodule {
options = {
passwordFile = lib.mkOption {
type = nullOr path;
default = null;
};
}
));
initialPassword = lib.mkOption {
type = nullOr str;
default = null;
};
extraGroups = lib.mkOption {
type = listOf str;
default = [];
};
};
});
};
};
@@ -38,13 +37,11 @@
users = {
mutableUsers = false;
users = let
passwd = config.mj.base.users.passwd;
in {
users = {
motiejus =
{
isNormalUser = true;
extraGroups = ["wheel"] ++ passwd.motiejus.extraGroups;
extraGroups = ["wheel"] ++ cfg.passwd.motiejus.extraGroups;
uid = myData.uidgid.motiejus;
openssh.authorizedKeys.keys = [myData.people_pubkeys.motiejus];
}
@@ -52,17 +49,17 @@
n: v:
(n == "passwordFile" || n == "initialPassword") && v != null
)
passwd.motiejus or {};
cfg.passwd.motiejus or {};
root = assert lib.assertMsg (passwd ? root) "root password needs to be defined";
lib.filterAttrs (_: v: v != null) passwd.root;
root = assert lib.assertMsg (cfg.passwd ? root) "root password needs to be defined";
lib.filterAttrs (_: v: v != null) cfg.passwd.root;
};
};
home-manager.useGlobalPkgs = true;
home-manager.users.motiejus = {pkgs, ...}: {
home.stateVersion = config.mj.stateVersion;
home.packages = lib.mkIf config.mj.base.users.devEnvironment [pkgs.go];
home.packages = lib.mkIf cfg.devEnvironment [pkgs.go];
programs.direnv.enable = true;
@@ -71,7 +68,7 @@
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
plugins = lib.mkIf config.mj.base.users.devEnvironment [
plugins = lib.mkIf cfg.devEnvironment [
pkgs.vimPlugins.fugitive
pkgs.vimPlugins.vim-go
pkgs.vimPlugins.zig-vim

View File

@@ -27,20 +27,18 @@ in {
dirs = lib.mkOption {
default = {};
type = listOf (submodule (
{...}: {
options = {
mountpoint = lib.mkOption {type = path;};
repo = lib.mkOption {type = str;};
paths = lib.mkOption {type = listOf str;};
patterns = lib.mkOption {
type = listOf str;
default = [];
};
backup_at = lib.mkOption {type = str;};
type = listOf (submodule {
options = {
mountpoint = lib.mkOption {type = path;};
repo = lib.mkOption {type = str;};
paths = lib.mkOption {type = listOf str;};
patterns = lib.mkOption {
type = listOf str;
default = [];
};
}
));
backup_at = lib.mkOption {type = str;};
};
});
};
};
@@ -69,13 +67,14 @@ in {
lib.nameValuePair
"${lib.strings.sanitizeDerivationName mountpoint}-${toString i}"
({
inherit (attrs.repo);
inherit (attrs.paths);
doInit = true;
repo = attrs.repo;
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.mj.base.zfsborg.passwordPath}";
};
paths = attrs.paths;
extraArgs = "--remote-path=borg1";
compression = "auto,lzma";
startAt = attrs.backup_at;
@@ -96,9 +95,7 @@ in {
BORG_RSH = ''ssh -i "${config.mj.base.zfsborg.sshKeyPath}"'';
};
}
// lib.optionalAttrs (attrs ? patterns) {
patterns = attrs.patterns;
})
// lib.optionalAttrs (attrs ? patterns) {inherit (attrs.patterns);})
)
dirs
);