multi-user toggle init
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user