diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-18 12:15:20 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-18 12:15:20 +0530 |
| commit | 4124a5ae231a585b945c9547a3ab0c37a4eba7e3 (patch) | |
| tree | b51774266eab457a13ee176bd6cd76b093b16d03 /modules/scripts/default.nix | |
| parent | 302f83b23b364b08dc47725266db5e20437d71e4 (diff) | |
| download | home-manager-config-4124a5ae231a585b945c9547a3ab0c37a4eba7e3.tar.gz home-manager-config-4124a5ae231a585b945c9547a3ab0c37a4eba7e3.zip | |
refactor: replace zsh deps with runtimeShell, migrate scripts from symlinkJoin to runCommand, add missing assertions and deps
Scripts: Migrated from symlinkJoin to runCommand; replaced zsh
dependency with pkgs.runtimeShell across polybar, scripts, and
fzf-launcher
Assertions: Added gopass/gpg checks for neomutt, signing checks for git,
git dependency for lazygit, file-preview deps for lf, desktop/kitten
checks for scripts
Lazygit: Fixed mkIf placement, imported assertions
Neomutt: Removed verbose keybinding descriptions
Nixvim: Removed <c-c> notification-clear mapping
File preview: Replaced libreoffice document preview with pandoc/antiword
(terminal-based)
Fzf launcher: Fixed bash compatibility (setopt → shopt -s)
Deps: Added coreutils, fontconfig, antiword, pandoc, util-linux, bash,
findutils, grep, sed, gawk, ncurses to various scripts
Diffstat (limited to 'modules/scripts/default.nix')
| -rw-r--r-- | modules/scripts/default.nix | 86 |
1 files changed, 57 insertions, 29 deletions
diff --git a/modules/scripts/default.nix b/modules/scripts/default.nix index ffde799..a2d9e1a 100644 --- a/modules/scripts/default.nix +++ b/modules/scripts/default.nix @@ -6,8 +6,7 @@ ... }: let - shell = - if config.terminal.zsh.enable then (lib.getExe config.terminal.zsh.package) else "/usr/bin/env sh"; + shell = pkgs.runtimeShell; mkScript = name: path: env: deps: @@ -24,16 +23,20 @@ let ''; }; in - pkgs.symlinkJoin { - name = name; - paths = [ wrappedScript ] ++ deps; - buildInputs = [ pkgs.makeWrapper ]; - postBuild = '' + pkgs.runCommand name + { + name = name; + nativeBuildInputs = [ pkgs.makeWrapper ]; + meta.mainProgram = name; + } + '' + mkdir -p $out/bin + cp ${wrappedScript}/bin/${name} $out/bin/${name} + chmod +x $out/bin/${name} + wrapProgram $out/bin/${name} \ --prefix PATH : ${lib.makeBinPath deps} ''; - meta.mainProgram = name; - }; # Script definitions: { path, env?, deps?, conditions? } # condition: attrset of { option (string path), value (expected value) } @@ -60,22 +63,26 @@ let config.terminal.bat.package config.media.ffmpeg.package config.file-management.ouch.package + pkgs.coreutils pkgs.file + pkgs.fontconfig pkgs.librsvg + pkgs.antiword + pkgs.pandoc pkgs.poppler-utils + pkgs.util-linux ]; conditions = [ { - option = "media.ffmpeg.enable"; + option = "terminal.kitty.enable"; value = true; } { - option = "file-management.ouch.enable"; + option = "media.ffmpeg.enable"; value = true; } { - # not a dependency - option = "office.zathura.enable"; + option = "file-management.ouch.enable"; value = true; } { @@ -101,26 +108,30 @@ let deps = [ config.terminal.fzf.package pkgs.util-linux - config.terminal.zsh.package ]; conditions = [ { option = "terminal.fzf.enable"; value = true; } - { - option = "terminal.zsh.enable"; - value = true; - } ]; }; i3-keybindings = { path = ./i3-keybindings.sh; + deps = [ + pkgs.coreutils + pkgs.gawk + pkgs.ncurses + ]; conditions = [ { option = "desktop.enable"; value = true; } + { + option = "terminal.less.enable"; + value = true; + } ]; }; screen-recording = { @@ -147,6 +158,7 @@ let config.system.nvtop.package config.terminal.tmux.package config.terminal.kitty.package + pkgs.bash ]; conditions = [ { @@ -175,6 +187,10 @@ let deps = [ config.terminal.fzf.package config.security.openvpn.package + pkgs.coreutils + pkgs.findutils + pkgs.gnugrep + pkgs.gnused ]; conditions = [ { @@ -200,6 +216,10 @@ let path = ./neomutt-sync.sh; deps = [ pkgs.dialog + pkgs.coreutils + pkgs.gawk + pkgs.gnused + pkgs.util-linux config.programs.mbsync.package config.programs.notmuch.package ]; @@ -299,17 +319,25 @@ in }; }; - assertions = lib.concatLists ( - lib.mapAttrsToList ( - name: def: - map (cond: { - assertion = - !config.scripts.${name}.enable - || lib.attrByPath (lib.splitString "." cond.option) false config == cond.value; - message = "scripts.${name} is enabled but requires `${cond.option} = ${builtins.toJSON cond.value}`."; - }) (def.conditions or [ ]) - ) scriptDefs - ); + assertions = + lib.concatLists ( + lib.mapAttrsToList ( + name: def: + map (cond: { + assertion = + !config.scripts.${name}.enable + || lib.attrByPath (lib.splitString "." cond.option) false config == cond.value; + message = "scripts.${name} is enabled but requires `${cond.option} = ${builtins.toJSON cond.value}`."; + }) (def.conditions or [ ]) + ) scriptDefs + ) + ++ lib.mapAttrsToList (name: _: { + assertion = + !config.scripts.${name}.enable + || !config.scripts.${name}.desktop.enable + || config.terminal.kitty.enable; + message = "scripts.${name}.desktop.enable requires terminal.kitty.enable because desktop entries launch scripts in kitty."; + }) scriptDefs; home.packages = [ pkgs.file |
