multi-user toggle init
This commit is contained in:
@@ -14,7 +14,11 @@
|
||||
description = "The shell to use system-wide (bash or zsh)";
|
||||
};
|
||||
config = {
|
||||
users.users.jawz.shell = pkgs.${config.my.shell.type};
|
||||
users.users = let
|
||||
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
|
||||
in lib.mkMerge (map (user: {
|
||||
${user}.shell = pkgs.${config.my.shell.type};
|
||||
}) users);
|
||||
programs.zsh.enable = config.my.shell.type == "zsh";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,11 +7,16 @@
|
||||
{
|
||||
options.my.shell.exercism.enable = lib.mkEnableOption "Exercism coding practice platform";
|
||||
config = lib.mkIf config.my.shell.exercism.enable {
|
||||
users.users.jawz.packages = builtins.attrValues {
|
||||
users.users = let
|
||||
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
exercism # learn to code
|
||||
bats # testing system, required by Exercism
|
||||
;
|
||||
};
|
||||
};
|
||||
in lib.mkMerge (map (user: {
|
||||
${user}.packages = packages;
|
||||
}) users);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,41 +8,53 @@
|
||||
{
|
||||
options.my.shell.multimedia.enable = lib.mkEnableOption "multimedia CLI tools and codecs";
|
||||
config = lib.mkIf config.my.shell.multimedia.enable {
|
||||
sops.secrets."gallery-dl/secrets" = {
|
||||
sops.secrets."gallery-dl/secrets" = let
|
||||
# Use first user for secret ownership
|
||||
user = if lib.isString config.my.toggleUsers.shell then config.my.toggleUsers.shell else (lib.head config.my.toggleUsers.shell);
|
||||
in {
|
||||
sopsFile = ../../secrets/gallery.yaml;
|
||||
owner = "jawz";
|
||||
owner = user;
|
||||
mode = "0400";
|
||||
};
|
||||
home-manager.users.jawz.programs = {
|
||||
yt-dlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "all";
|
||||
cookies-from-browser = "firefox+gnomekeyring:/home/jawz/.librewolf/jawz";
|
||||
home-manager.users = let
|
||||
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
|
||||
in lib.mkMerge (map (user: {
|
||||
${user}.programs = {
|
||||
yt-dlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "all";
|
||||
cookies-from-browser = "firefox+gnomekeyring:/home/${user}/.librewolf/${user}";
|
||||
};
|
||||
};
|
||||
gallery-dl = {
|
||||
enable = true;
|
||||
settings = inputs.self.lib.importDotfile ../../dotfiles/gallery-dl.nix;
|
||||
};
|
||||
${config.my.shell.type} = {
|
||||
initExtra = lib.mkAfter ''
|
||||
if [ -r "${config.sops.secrets."gallery-dl/secrets".path}" ]; then
|
||||
set -a # automatically export all variables
|
||||
source "${config.sops.secrets."gallery-dl/secrets".path}"
|
||||
set +a # stop automatically exporting
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
gallery-dl = {
|
||||
enable = true;
|
||||
settings = inputs.self.lib.importDotfile ../../dotfiles/gallery-dl.nix;
|
||||
};
|
||||
${config.my.shell.type} = {
|
||||
initExtra = lib.mkAfter ''
|
||||
if [ -r "${config.sops.secrets."gallery-dl/secrets".path}" ]; then
|
||||
set -a # automatically export all variables
|
||||
source "${config.sops.secrets."gallery-dl/secrets".path}"
|
||||
set +a # stop automatically exporting
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
users.users.jawz.packages = builtins.attrValues {
|
||||
}) users);
|
||||
users.users = let
|
||||
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ffmpeg # not ffmpreg, the coolest video conversion tool!
|
||||
imagemagick # photoshop what??
|
||||
ffpb # make ffmpeg encoding... a bit fun
|
||||
;
|
||||
};
|
||||
};
|
||||
in lib.mkMerge (map (user: {
|
||||
${user}.packages = packages;
|
||||
}) users);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@ in
|
||||
{
|
||||
options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities";
|
||||
config = lib.mkIf config.my.shell.tools.enable {
|
||||
home-manager.users.jawz.programs = {
|
||||
home-manager.users = let
|
||||
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
|
||||
in lib.mkMerge (map (user: {
|
||||
${user}.programs = {
|
||||
hstr.enable = true;
|
||||
htop = {
|
||||
enable = true;
|
||||
@@ -52,7 +55,7 @@ in
|
||||
PASSWORD_STORE_NOPAGER = "false";
|
||||
PASSWORD_STORE_NOTIFICATIONS = "false";
|
||||
PASSWORD_STORE_PARSING = "true";
|
||||
PASSWORD_STORE_PATH = "/home/jawz/.local/share/pass";
|
||||
PASSWORD_STORE_PATH = "/home/${user}/.local/share/pass";
|
||||
PASSWORD_STORE_SAFECONTENT = "true";
|
||||
};
|
||||
};
|
||||
@@ -84,7 +87,8 @@ in
|
||||
source "$(fzf-share)/completion.bash"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}) users);
|
||||
programs = {
|
||||
starship.enable = true;
|
||||
tmux.enable = true;
|
||||
@@ -94,7 +98,9 @@ in
|
||||
vimAlias = true;
|
||||
};
|
||||
};
|
||||
users.users.jawz.packages = builtins.attrValues {
|
||||
users.users = let
|
||||
users = if lib.isString config.my.toggleUsers.shell then [ config.my.toggleUsers.shell ] else config.my.toggleUsers.shell;
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ripgrep # modern grep
|
||||
dust # rusty du similar to gdu
|
||||
@@ -108,7 +114,10 @@ in
|
||||
smartmontools # check hard drie health
|
||||
rmlint # amazing dupe finder that integrates well with BTRFS
|
||||
;
|
||||
};
|
||||
};
|
||||
in lib.mkMerge (map (user: {
|
||||
${user}.packages = packages;
|
||||
}) users);
|
||||
environment.variables = {
|
||||
HISTFILE = "\${XDG_STATE_HOME}/bash/history";
|
||||
LESSHISTFILE = "-";
|
||||
|
||||
Reference in New Issue
Block a user