nixy: add global USER variable

This commit is contained in:
Asmir A 2025-01-15 11:41:32 +01:00
parent 1240d5d3a2
commit 9f78cde62f
Signed by: asmir
GPG Key ID: 020C42B7A9ABA3E2

View File

@ -7,6 +7,9 @@
zremap, zremap,
... ...
}: }:
let
USER = "akill";
in
{ {
imports = [ ]; imports = [ ];
@ -45,12 +48,12 @@
"borgbase_enc_key" = { "borgbase_enc_key" = {
sopsFile = ./secrets/borgbase_enc_key.yaml; sopsFile = ./secrets/borgbase_enc_key.yaml;
owner = config.users.users.akill.name; owner = config.users.users.${USER}.name;
}; };
"borgbase_ssh_key" = { "borgbase_ssh_key" = {
sopsFile = ./secrets/borgbase_ssh_key.yaml; sopsFile = ./secrets/borgbase_ssh_key.yaml;
owner = config.users.users.akill.name; owner = config.users.users.${USER}.name;
}; };
}; };
}; };
@ -110,7 +113,7 @@
doas.enable = true; doas.enable = true;
doas.extraRules = [ doas.extraRules = [
{ {
users = [ "akill" ]; users = [ USER ];
keepEnv = true; keepEnv = true;
persist = true; persist = true;
} }
@ -437,7 +440,7 @@
{ {
keys = [ 113 ]; keys = [ 113 ];
events = [ "key" ]; events = [ "key" ];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master toggle'"; command = "/run/current-system/sw/bin/runuser -l ${USER} -c 'amixer -q set Master toggle'";
} }
{ {
@ -446,7 +449,7 @@
"key" "key"
"rep" "rep"
]; ];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%- unmute'"; command = "/run/current-system/sw/bin/runuser -l ${USER} -c 'amixer -q set Master 5%- unmute'";
} }
{ {
@ -455,7 +458,7 @@
"key" "key"
"rep" "rep"
]; ];
command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%+ unmute'"; command = "/run/current-system/sw/bin/runuser -l ${USER} -c 'amixer -q set Master 5%+ unmute'";
} }
{ {
@ -494,7 +497,7 @@
borgbackup.jobs."borgbase" = borgbackup.jobs."borgbase" =
let let
user = config.users.users.akill; user = config.users.users.${USER};
home = user.home; home = user.home;
in in
{ {
@ -631,7 +634,7 @@
algorithm = "zstd"; algorithm = "zstd";
}; };
users.users.akill = { users.users.${USER} = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.zsh; shell = pkgs.zsh;
extraGroups = [ extraGroups = [