From e0c1e40f27d53c78744dcef76afd415039a405af Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sat, 21 Sep 2024 20:37:33 +0200 Subject: [PATCH] feat: add module for media consumption packages --- home/terminal/fish/default.nix | 5 ++-- hosts/brontes/configuration.nix | 2 ++ hosts/brontes/home.nix | 8 +++---- options/media.nix | 41 +++++++++++++++++++++++++++++++++ parts/lib/functions.nix | 1 + 5 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 options/media.nix diff --git a/home/terminal/fish/default.nix b/home/terminal/fish/default.nix index 5cb0c25..ef9db13 100644 --- a/home/terminal/fish/default.nix +++ b/home/terminal/fish/default.nix @@ -10,8 +10,9 @@ cat = "bat"; sd = ''cd "$(dirname "$HOME/$(env --chdir ~ fzf)")"''; mkdir = "mkdir --parent"; - cp = "cp -i"; - mv = "mv -i"; + cp = "cp -vi"; + mv = "mv -vi"; + rm = "rm -v"; }; functions = { gitignore = "curl -sL https://www.gitignore.io/api/$argv"; diff --git a/hosts/brontes/configuration.nix b/hosts/brontes/configuration.nix index 774945c..7d8fa5f 100644 --- a/hosts/brontes/configuration.nix +++ b/hosts/brontes/configuration.nix @@ -86,5 +86,7 @@ pop-icon-theme ]; + media.enableAll = true; + system.stateVersion = "24.05"; } diff --git a/hosts/brontes/home.nix b/hosts/brontes/home.nix index e119cda..b5938ab 100644 --- a/hosts/brontes/home.nix +++ b/hosts/brontes/home.nix @@ -41,7 +41,6 @@ loupe seahorse gimp - vlc pavucontrol thunderbird keepassxc @@ -49,13 +48,12 @@ protonmail-bridge-gui varia signal-desktop - calibre tagger - soundconverter - foliate - kid3 prismlauncher + kid3 + soundconverter + # proprietary obsidian diff --git a/options/media.nix b/options/media.nix new file mode 100644 index 0000000..359bf15 --- /dev/null +++ b/options/media.nix @@ -0,0 +1,41 @@ +{ + lib, + pkgs, + config, + ... +}: +let + cfg = config.media; + mkMedia = defPackages: { + enable = lib.mkOption { default = cfg.enableAll; }; + packages = lib.mkOption { default = defPackages; }; + }; +in +{ + options.media = { + enableAll = lib.mkEnableOption ""; + audio = mkMedia [ + pkgs.feishin + pkgs.lollypop + ]; + video = mkMedia [ + pkgs.vlc + ]; + ebook = mkMedia [ + pkgs.calibre + pkgs.foliate + ]; + }; + + config = { + environment.systemPackages = lib.flatten ( + lib.map (opt: opt.packages) ( + lib.filter (opt: opt.enable) [ + cfg.audio + cfg.video + cfg.ebook + ] + ) + ); + }; +} diff --git a/parts/lib/functions.nix b/parts/lib/functions.nix index 1b26555..f4400f4 100644 --- a/parts/lib/functions.nix +++ b/parts/lib/functions.nix @@ -27,6 +27,7 @@ "${self}/hosts/${hostname}/configuration.nix" "${self}/options" "${self}/options/pulseview.nix" + "${self}/options/media.nix" { networking.hostName = hostname; } ] ++ extraModules; specialArgs = {