From 8eb2f2a26ae540cc89300eed97c61fa264c2ff7f Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 17 Jul 2025 21:12:50 +0200 Subject: [PATCH] treewide: Remove unwanted dependencies (#7487) Fixes interpolation of packages in the default and example texts. --- modules/programs/alot/accounts.nix | 9 +++++++++ modules/programs/awscli.nix | 2 +- modules/programs/newsboat.nix | 1 + modules/programs/ranger.nix | 2 +- modules/programs/swayr.nix | 2 +- modules/programs/termite.nix | 2 +- modules/programs/tmux.nix | 2 +- modules/services/fluidsynth.nix | 3 +++ modules/services/grobi.nix | 8 ++++---- modules/services/swayidle.nix | 6 +++--- modules/services/twmn.nix | 2 +- modules/services/unison.nix | 10 ++++++++++ .../window-managers/i3-sway/lib/options.nix | 13 +++++++++++-- modules/services/window-managers/i3-sway/sway.nix | 6 +++--- 14 files changed, 50 insertions(+), 18 deletions(-) diff --git a/modules/programs/alot/accounts.nix b/modules/programs/alot/accounts.nix index 663c5374..da764cca 100644 --- a/modules/programs/alot/accounts.nix +++ b/modules/programs/alot/accounts.nix @@ -23,6 +23,15 @@ in "'\\[?{" + ''"name": "(?P.*)", "address": "(?P.+)", "name-addr": ".*"'' + "}[,\\]]?'"; shellcommand_external_filtering = "False"; }; + defaultText = lib.literalExpression '' + { + type = "shellcommand"; + command = "''\'''${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'"; + regexp = + "'\\[?{" + '''"name": "(?P.*)", "address": "(?P.+)", "name-addr": ".*"''' + "}[,\\]]?'"; + shellcommand_external_filtering = "False"; + } + ''; example = lib.literalExpression '' { type = "shellcommand"; diff --git a/modules/programs/awscli.nix b/modules/programs/awscli.nix index c379f8a1..f97579fd 100644 --- a/modules/programs/awscli.nix +++ b/modules/programs/awscli.nix @@ -41,7 +41,7 @@ in example = lib.literalExpression '' { "default" = { - "credential_process" = "${pkgs.pass}/bin/pass show aws"; + "credential_process" = "''${pkgs.pass}/bin/pass show aws"; }; }; ''; diff --git a/modules/programs/newsboat.nix b/modules/programs/newsboat.nix index 507e72e5..0dfe9a5c 100644 --- a/modules/programs/newsboat.nix +++ b/modules/programs/newsboat.nix @@ -122,6 +122,7 @@ in browser = mkOption { type = types.str; default = "${pkgs.xdg-utils}/bin/xdg-open"; + defaultText = lib.literalExpression "\${pkgs.xdg-utils}/bin/xdg-open"; description = "External browser to use."; }; diff --git a/modules/programs/ranger.nix b/modules/programs/ranger.nix index 0e48dd99..e1853cbf 100644 --- a/modules/programs/ranger.nix +++ b/modules/programs/ranger.nix @@ -137,7 +137,7 @@ in description = '' A command to run for the matching file. ''; - example = literalExpression ''"${pkgs.vim}/bin/vim -- \"$@\""''; + example = literalExpression ''"''${pkgs.vim}/bin/vim -- \"$@\""''; }; }; } diff --git a/modules/programs/swayr.nix b/modules/programs/swayr.nix index beabb833..11f8692e 100644 --- a/modules/programs/swayr.nix +++ b/modules/programs/swayr.nix @@ -26,7 +26,7 @@ in default = { }; example = lib.literalExpression '' menu = { - executable = "${pkgs.wofi}/bin/wofi"; + executable = "''${pkgs.wofi}/bin/wofi"; args = [ "--show=dmenu" "--allow-markup" diff --git a/modules/programs/termite.nix b/modules/programs/termite.nix index 945aea9b..bac51813 100644 --- a/modules/programs/termite.nix +++ b/modules/programs/termite.nix @@ -124,7 +124,7 @@ in browser = mkOption { default = null; type = types.nullOr types.str; - example = "${pkgs.xdg-utils}/xdg-open"; + example = "\${pkgs.xdg-utils}/xdg-open"; description = '' Set the default browser for opening links. If its not set, $BROWSER is read. If that's not set, url hints will be disabled. diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index ec7ea19e..8f1c70e5 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -302,7 +302,7 @@ in shell = mkOption { default = defaultShell; - example = literalExpression "${pkgs.zsh}/bin/zsh"; + example = literalExpression "\${pkgs.zsh}/bin/zsh"; type = with types; nullOr str; description = "Set the default-shell tmux variable."; }; diff --git a/modules/services/fluidsynth.nix b/modules/services/fluidsynth.nix index 2fe699c6..1d10dc46 100644 --- a/modules/services/fluidsynth.nix +++ b/modules/services/fluidsynth.nix @@ -20,6 +20,9 @@ in soundFont = mkOption { type = types.path; default = "${pkgs.soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2"; + defaultText = lib.literalExpression '' + "''${pkgs.soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2"; + ''; description = '' The soundfont file to use, in SoundFont 2 format. ''; diff --git a/modules/services/grobi.nix b/modules/services/grobi.nix index ce40b211..d0ff0557 100644 --- a/modules/services/grobi.nix +++ b/modules/services/grobi.nix @@ -43,8 +43,8 @@ in primary = true; atomic = true; execute_after = [ - "${pkgs.xorg.xrandr}/bin/xrandr --dpi 96" - "${pkgs.xmonad-with-packages}/bin/xmonad --restart"; + "''${pkgs.xorg.xrandr}/bin/xrandr --dpi 96" + "''${pkgs.xmonad-with-packages}/bin/xmonad --restart"; ]; } { @@ -54,8 +54,8 @@ in primary = true; atomic = true; execute_after = [ - "${pkgs.xorg.xrandr}/bin/xrandr --dpi 120" - "${pkgs.xmonad-with-packages}/bin/xmonad --restart"; + "''${pkgs.xorg.xrandr}/bin/xrandr --dpi 120" + "''${pkgs.xmonad-with-packages}/bin/xmonad --restart"; ]; } ] diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index cdf54b19..bec389e4 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -76,8 +76,8 @@ in default = [ ]; example = literalExpression '' [ - { timeout = 60; command = "${pkgs.swaylock}/bin/swaylock -fF"; } - { timeout = 90; command = "${pkgs.systemd}/bin/systemctl suspend"; } + { timeout = 60; command = "''${pkgs.swaylock}/bin/swaylock -fF"; } + { timeout = 90; command = "''${pkgs.systemd}/bin/systemctl suspend"; } ] ''; description = "List of commands to run after idle timeout."; @@ -88,7 +88,7 @@ in default = [ ]; example = literalExpression '' [ - { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock -fF"; } + { event = "before-sleep"; command = "''${pkgs.swaylock}/bin/swaylock -fF"; } { event = "lock"; command = "lock"; } ] ''; diff --git a/modules/services/twmn.nix b/modules/services/twmn.nix index 4d7111d6..e419bb6b 100644 --- a/modules/services/twmn.nix +++ b/modules/services/twmn.nix @@ -54,7 +54,7 @@ in extraConfig = mkOption { type = types.attrs; default = { }; - example = literalExpression ''{ main.activation_command = "\${pkgs.hello}/bin/hello"; }''; + example = literalExpression ''{ main.activation_command = "''${pkgs.hello}/bin/hello"; }''; description = '' Extra configuration options to add to the twmnd config file. See diff --git a/modules/services/unison.nix b/modules/services/unison.nix index 36b4609b..3b81a36f 100644 --- a/modules/services/unison.nix +++ b/modules/services/unison.nix @@ -42,6 +42,16 @@ let batch = "true"; log = "false"; # don't log to file, handled by systemd }; + defaultText = lib.literalExpression '' + { + repeat = "watch"; + sshcmd = "''${pkgs.openssh}/bin/ssh"; + ui = "text"; + auto = "true"; + batch = "true"; + log = "false"; # don't log to file, handled by systemd + } + ''; description = '' Additional command line options as a dictionary to pass to the `unison` program. diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index d62aef5a..ec1c6bc2 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -98,7 +98,6 @@ let defaultText = literalExpression '' null for state version ≥ 20.09, as example otherwise ''; - example = default; } ); in @@ -181,7 +180,7 @@ let pkg = if isSway && isNull cfg.package then pkgs.sway else cfg.package; in "${pkg}/bin/${moduleName}bar"; - defaultText = "i3bar"; + defaultText = literalExpression "i3bar"; description = "Command that will be used to start a bar."; example = if isI3 then "\${pkgs.i3}/bin/i3bar -t" else "\${pkgs.waybar}/bin/waybar"; }; @@ -189,6 +188,7 @@ let statusCommand = mkNullableOption { type = types.str; default = "${pkgs.i3status}/bin/i3status"; + defaultText = literalExpression "\${pkgs.i3status}/bin/i3status"; description = "Command that will be used to get status lines."; }; @@ -959,6 +959,9 @@ in terminal = mkOption { type = types.str; default = if isI3 then "i3-sensible-terminal" else "${pkgs.foot}/bin/foot"; + defaultText = literalExpression ( + if isI3 then ''"i3-sensible-terminal"'' else "\${pkgs.foot}/bin/foot" + ); description = "Default terminal to run."; example = "alacritty"; }; @@ -970,6 +973,12 @@ in "${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --" else "${pkgs.dmenu}/bin/dmenu_run"; + defaultText = literalExpression ( + if isSway then + "\${pkgs.dmenu}/bin/dmenu_path | \${pkgs.dmenu}/bin/dmenu | \${pkgs.findutils}/bin/xargs swaymsg exec --" + else + "\${pkgs.dmenu}/bin/dmenu_run" + ); description = "Default launcher to use."; example = "bemenu-run"; }; diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 1d016da6..2d8a2cd6 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -155,9 +155,9 @@ let let modifier = config.wayland.windowManager.sway.config.modifier; in lib.mkOptionDefault { - "''${modifier}+Return" = "exec ${cfg.config.terminal}"; + "''${modifier}+Return" = "exec ''${cfg.config.terminal}"; "''${modifier}+Shift+q" = "kill"; - "''${modifier}+d" = "exec ${cfg.config.menu}"; + "''${modifier}+d" = "exec ''${cfg.config.menu}"; } ''; }; @@ -509,7 +509,7 @@ in withBaseWrapper = cfg.wrapperFeatures.base; withGtkWrapper = cfg.wrapperFeatures.gtk; }; - defaultText = lib.literalExpression "${pkgs.sway}"; + defaultText = lib.literalExpression "\${pkgs.sway}"; description = '' Sway package to use. Will override the options 'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'.