From 978e59b0a25e67a1fb9f142889a215c64f09f75e Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Sun, 26 Oct 2025 22:24:33 +0100 Subject: [PATCH 1/5] treewide: mark unused lambda arguments --- modules/accounts/email.nix | 2 +- modules/files.nix | 10 +++++----- modules/launchd/default.nix | 6 +++--- modules/lib/dag.nix | 2 +- modules/lib/generators.nix | 4 ++-- modules/lib/stdlib-extended.nix | 2 +- modules/lib/strings.nix | 2 +- modules/misc/fontconfig.nix | 2 +- modules/misc/news.nix | 2 +- modules/misc/nix.nix | 4 ++-- modules/misc/nixpkgs-disabled.nix | 2 +- modules/misc/nixpkgs.nix | 4 ++-- modules/misc/qt.nix | 2 +- modules/misc/xdg-mime-apps.nix | 2 +- modules/misc/xdg-user-dirs.nix | 2 +- modules/programs/aerc/accounts.nix | 6 +++--- modules/programs/alacritty.nix | 2 +- modules/programs/alot/default.nix | 2 +- modules/programs/astroid/default.nix | 4 ++-- modules/programs/borgmatic.nix | 2 +- modules/programs/docker-cli.nix | 2 +- modules/programs/element-desktop.nix | 2 +- modules/programs/emacs.nix | 4 ++-- modules/programs/feh.nix | 6 +++--- modules/programs/firefox/profiles/search.nix | 2 +- modules/programs/fzf.nix | 4 ++-- modules/programs/gnome-terminal.nix | 2 +- modules/programs/i3status.nix | 4 ++-- modules/programs/joplin-desktop.nix | 2 +- modules/programs/lutris.nix | 4 ++-- modules/programs/mbsync/default.nix | 14 +++++++------- modules/programs/meli.nix | 4 ++-- modules/programs/mujmap.nix | 2 +- modules/programs/neomutt/default.nix | 2 +- modules/programs/neovim.nix | 2 +- modules/programs/papis.nix | 2 +- modules/programs/password-store.nix | 2 +- modules/programs/radio-active.nix | 4 ++-- modules/programs/ripgrep-all.nix | 2 +- modules/programs/sbt.nix | 2 +- modules/programs/skim.nix | 4 ++-- modules/programs/smug.nix | 4 ++-- modules/programs/ssh.nix | 4 ++-- modules/programs/thunderbird.nix | 8 ++++---- modules/programs/vdirsyncer/default.nix | 4 ++-- modules/programs/vim.nix | 2 +- modules/programs/vscode/default.nix | 8 ++++---- modules/programs/waybar.nix | 2 +- modules/programs/wofi.nix | 2 +- modules/services/activitywatch.nix | 4 ++-- modules/services/git-sync.nix | 2 +- modules/services/macos-remap-keys/keytables.nix | 2 +- modules/services/mako.nix | 4 ++-- modules/services/picom.nix | 2 +- modules/services/podman-linux/containers.nix | 2 +- modules/services/podman-linux/default.nix | 2 +- modules/services/recoll.nix | 4 ++-- modules/services/unison.nix | 2 +- modules/services/way-displays.nix | 2 +- modules/services/window-managers/bspwm/default.nix | 2 +- modules/services/window-managers/hyprland.nix | 6 +++--- modules/services/window-managers/i3-sway/i3.nix | 2 +- .../window-managers/i3-sway/lib/functions.nix | 8 ++++---- modules/services/window-managers/i3-sway/sway.nix | 8 ++++---- modules/services/window-managers/xmonad.nix | 2 +- modules/targets/darwin/user-defaults/default.nix | 6 ++++-- nix-darwin/default.nix | 2 +- overlay.nix | 2 +- tests/darwinScrublist.nix | 2 +- tests/default.nix | 8 ++++---- tests/integration/standalone/restic.nix | 2 +- tests/modules/accounts/email-test-accounts.nix | 2 +- tests/modules/misc/qt/qt-platform-theme-gtk.nix | 6 +++--- tests/modules/misc/xdg/portal.nix | 2 +- tests/modules/misc/xsession/basic.nix | 2 +- .../misc/xsession/keyboard-without-layout.nix | 2 +- .../programs/aerospace/aerospace-colemak.nix | 2 +- tests/modules/programs/aerospace/aerospace.nix | 2 +- tests/modules/programs/browserpass/browserpass.nix | 2 +- tests/modules/programs/carapace/fish.nix | 2 +- tests/modules/programs/firefox/common.nix | 2 +- tests/modules/programs/gnome-shell/gnome-shell.nix | 2 +- .../modules/programs/kitty/theme-to-themeFile.nix | 2 +- .../programs/kubecolor/does-have-openshift.nix | 2 +- .../sketchybar/sketchybar-service-integration.nix | 2 +- tests/modules/programs/texlive/texlive-minimal.nix | 2 +- .../programs/tmux/disable-confirmation-prompt.nix | 2 +- tests/modules/programs/tmux/emacs-with-plugins.nix | 2 +- tests/modules/programs/tmux/mouse-enabled.nix | 2 +- tests/modules/programs/tmux/prefix.nix | 2 +- .../programs/tmux/shortcut-without-prefix.nix | 2 +- tests/modules/programs/tmux/vi-all-true.nix | 2 +- tests/modules/services/emacs/darwin/basic.nix | 2 +- .../services/emacs/linux/emacs-default-editor.nix | 2 +- .../services/emacs/linux/emacs-service-27.nix | 2 +- ...s-service-28-after-graphical-session-target.nix | 2 +- .../services/emacs/linux/emacs-service-28.nix | 2 +- .../services/emacs/linux/emacs-socket-27.nix | 2 +- .../services/emacs/linux/emacs-socket-28.nix | 2 +- .../emacs-socket-and-startWithUserSession.nix | 2 +- tests/modules/services/fusuma/fusuma-stubs.nix | 2 +- tests/modules/services/i3/i3-followmouse.nix | 2 +- .../modules/services/podman-linux/podman-stubs.nix | 2 +- tests/modules/services/sway/sway-check-config.nix | 2 +- tests/modules/services/syncthing/extra-options.nix | 2 +- tests/stubs.nix | 2 +- treefmt.toml | 2 +- 107 files changed, 162 insertions(+), 160 deletions(-) diff --git a/modules/accounts/email.nix b/modules/accounts/email.nix index e3f6f0445344..fa418e331fb8 100644 --- a/modules/accounts/email.nix +++ b/modules/accounts/email.nix @@ -9,7 +9,7 @@ let ; cfg = config.accounts.email; - enabledAccounts = lib.filterAttrs (n: v: v.enable) cfg.accounts; + enabledAccounts = lib.filterAttrs (_n: v: v.enable) cfg.accounts; gpgModule = types.submodule { options = { diff --git a/modules/files.nix b/modules/files.nix index ba45665b94a0..e2c04f6c05ac 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -7,7 +7,7 @@ let - cfg = lib.filterAttrs (n: f: f.enable) config.home.file; + cfg = lib.filterAttrs (_n: f: f.enable) config.home.file; homeDirectory = config.home.homeDirectory; @@ -52,8 +52,8 @@ in ( let dups = lib.attrNames ( - lib.filterAttrs (n: v: v > 1) ( - lib.foldAttrs (acc: v: acc + v) 0 (lib.mapAttrsToList (n: v: { ${v.target} = 1; }) cfg) + lib.filterAttrs (_n: v: v > 1) ( + lib.foldAttrs (acc: v: acc + v) 0 (lib.mapAttrsToList (_n: v: { ${v.target} = 1; }) cfg) ) ); dupsStr = lib.concatStringsSep ", " dups; @@ -96,7 +96,7 @@ in # Paths that should be forcibly overwritten by Home Manager. # Caveat emptor! forcedPaths = lib.concatMapStringsSep " " (p: ''"$HOME"/${lib.escapeShellArg p}'') ( - lib.mapAttrsToList (n: v: v.target) (lib.filterAttrs (n: v: v.force) cfg) + lib.mapAttrsToList (_n: v: v.target) (lib.filterAttrs (_n: v: v.force) cfg) ); storeDir = lib.escapeShellArg builtins.storeDir; @@ -358,7 +358,7 @@ in } '' + lib.concatStrings ( - lib.mapAttrsToList (n: v: '' + lib.mapAttrsToList (_n: v: '' insertFile ${ lib.escapeShellArgs [ (sourceStorePath v) diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index baebdfdce94b..90eb6be3616c 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -45,9 +45,9 @@ let toAgent = config: pkgs.writeText "${config.Label}.plist" (toPlist { escape = true; } config); - agentPlists = lib.mapAttrs' (n: v: lib.nameValuePair "${v.config.Label}.plist" (toAgent v.config)) ( - lib.filterAttrs (n: v: v.enable) cfg.agents - ); + agentPlists = lib.mapAttrs' ( + _n: v: lib.nameValuePair "${v.config.Label}.plist" (toAgent v.config) + ) (lib.filterAttrs (_n: v: v.enable) cfg.agents); agentsDrv = pkgs.runCommand "home-manager-agents" { } '' mkdir -p "$out" diff --git a/modules/lib/dag.nix b/modules/lib/dag.nix index c709195666f8..4678a540aeb1 100644 --- a/modules/lib/dag.nix +++ b/modules/lib/dag.nix @@ -86,7 +86,7 @@ in topoSort = dag: let - dagBefore = dag: name: builtins.attrNames (filterAttrs (n: v: builtins.elem name v.before) dag); + dagBefore = dag: name: builtins.attrNames (filterAttrs (_n: v: builtins.elem name v.before) dag); normalizedDag = mapAttrs (n: v: { name = n; data = v.data; diff --git a/modules/lib/generators.nix b/modules/lib/generators.nix index ee8461df5931..d4aabf8101dc 100644 --- a/modules/lib/generators.nix +++ b/modules/lib/generators.nix @@ -28,7 +28,7 @@ toHyprconf' = indent: attrs: let - sections = filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs; + sections = filterAttrs (_n: v: isAttrs v || (isList v && all isAttrs v)) attrs; mkSection = n: attrs: @@ -45,7 +45,7 @@ inherit indent; }; - allFields = filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v))) attrs; + allFields = filterAttrs (_n: v: !(isAttrs v || (isList v && all isAttrs v))) attrs; isImportantField = n: _: foldl (acc: prev: if hasPrefix prev n then true else acc) false importantPrefixes; diff --git a/modules/lib/stdlib-extended.nix b/modules/lib/stdlib-extended.nix index 6e8eee5ed9c0..66da1199b801 100644 --- a/modules/lib/stdlib-extended.nix +++ b/modules/lib/stdlib-extended.nix @@ -7,7 +7,7 @@ let mkHmLib = import ./.; in nixpkgsLib.extend ( - self: super: { + self: _super: { hm = mkHmLib { lib = self; }; } ) diff --git a/modules/lib/strings.nix b/modules/lib/strings.nix index b8dd6baa4c97..e8e700c51150 100644 --- a/modules/lib/strings.nix +++ b/modules/lib/strings.nix @@ -29,7 +29,7 @@ rec { ++ upperChars ++ stringToCharacters "0123456789"; - empties = l: genList (x: "") (length l); + empties = l: genList (_x: "") (length l); unsafeInName = stringToCharacters (replaceStrings safeChars (empties safeChars) path); diff --git a/modules/misc/fontconfig.nix b/modules/misc/fontconfig.nix index a2bb39879cd0..ea15d7558924 100644 --- a/modules/misc/fontconfig.nix +++ b/modules/misc/fontconfig.nix @@ -337,7 +337,7 @@ in }; xdg.configFile = lib.mapAttrs' ( - name: config: + _name: config: lib.nameValuePair "fontconfig/conf.d/${builtins.toString config.priority}-hm-${config.label}.conf" { inherit (config) enable text; source = lib.mkIf (config.source != null) config.source; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 856e9d29e0c2..b5bfaa8f32c9 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -53,7 +53,7 @@ let ); isNixFile = n: v: v == "regular" && lib.hasSuffix ".nix" n; - isDirectory = n: v: v == "directory"; + isDirectory = _n: v: v == "directory"; # Recursively collect all .nix files from a directory collectNixFiles = diff --git a/modules/misc/nix.nix b/modules/misc/nix.nix index cc569c68d86e..4287580d7e8e 100644 --- a/modules/misc/nix.nix +++ b/modules/misc/nix.nix @@ -269,7 +269,7 @@ in path = config.flake.outPath; } // lib.filterAttrs ( - n: v: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash" + n: _v: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash" ) config.flake ); }; @@ -345,7 +345,7 @@ in (mkIf (cfg.registry != { }) { xdg.configFile."nix/registry.json".source = jsonFormat.generate "registry.json" { version = cfg.registryVersion; - flakes = mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry; + flakes = mapAttrsToList (_n: v: { inherit (v) from to exact; }) cfg.registry; }; }) diff --git a/modules/misc/nixpkgs-disabled.nix b/modules/misc/nixpkgs-disabled.nix index 5388026ed67a..db946b7b15a7 100644 --- a/modules/misc/nixpkgs-disabled.nix +++ b/modules/misc/nixpkgs-disabled.nix @@ -46,7 +46,7 @@ let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false; in traceXIfNot isConfig; - merge = args: lib.fold (def: mergeConfig def.value) { }; + merge = _args: lib.fold (def: mergeConfig def.value) { }; }; # Copied from nixpkgs.nix. diff --git a/modules/misc/nixpkgs.nix b/modules/misc/nixpkgs.nix index d6963610b55e..46eac03d6b43 100644 --- a/modules/misc/nixpkgs.nix +++ b/modules/misc/nixpkgs.nix @@ -43,7 +43,7 @@ let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false; in traceXIfNot isConfig; - merge = args: lib.fold (def: mergeConfig def.value) { }; + merge = _args: lib.fold (def: mergeConfig def.value) { }; }; overlayType = lib.mkOptionType { @@ -53,7 +53,7 @@ let merge = lib.mergeOneOption; }; - _pkgs = import pkgsPath (lib.filterAttrs (n: v: v != null) config.nixpkgs); + _pkgs = import pkgsPath (lib.filterAttrs (_n: v: v != null) config.nixpkgs); in { diff --git a/modules/misc/qt.nix b/modules/misc/qt.nix index 0fe00d7777bc..4738054c4c0b 100644 --- a/modules/misc/qt.nix +++ b/modules/misc/qt.nix @@ -323,7 +323,7 @@ in }; # Necessary because home.sessionVariables doesn't support mkIf - envVars = lib.filterAttrs (n: v: v != null) { + envVars = lib.filterAttrs (_n: v: v != null) { QT_QPA_PLATFORMTHEME = if (platformTheme.name != null) then styleNames.${platformTheme.name} or platformTheme.name diff --git a/modules/misc/xdg-mime-apps.nix b/modules/misc/xdg-mime-apps.nix index feeef7b30545..378ffb083d90 100644 --- a/modules/misc/xdg-mime-apps.nix +++ b/modules/misc/xdg-mime-apps.nix @@ -142,7 +142,7 @@ in xdg.configFile."mimeapps.list".source = let - joinValues = lib.mapAttrs (n: lib.concatStringsSep ";"); + joinValues = lib.mapAttrs (_n: lib.concatStringsSep ";"); baseFile = (pkgs.formats.ini { }).generate "mimeapps.list" { "Added Associations" = joinValues cfg.associations.added; diff --git a/modules/misc/xdg-user-dirs.nix b/modules/misc/xdg-user-dirs.nix index e3d3db5449ef..7efb5cdf3f5b 100644 --- a/modules/misc/xdg-user-dirs.nix +++ b/modules/misc/xdg-user-dirs.nix @@ -113,7 +113,7 @@ in config = let directories = - (lib.filterAttrs (n: v: !isNull v) { + (lib.filterAttrs (_n: v: !isNull v) { XDG_DESKTOP_DIR = cfg.desktop; XDG_DOCUMENTS_DIR = cfg.documents; XDG_DOWNLOAD_DIR = cfg.download; diff --git a/modules/programs/aerc/accounts.nix b/modules/programs/aerc/accounts.nix index 050352ee94e2..923f073fbd65 100644 --- a/modules/programs/aerc/accounts.nix +++ b/modules/programs/aerc/accounts.nix @@ -145,7 +145,7 @@ in }; mkAccount = - name: account: + _name: account: let nullOrMap = f: v: if v == null then v else f v; @@ -168,7 +168,7 @@ in "?" + builtins.concatStringsSep "&" ( lib.attrsets.mapAttrsToList (k: v: k + "=" + lib.strings.escapeURL v) ( - lib.attrsets.filterAttrs (k: v: v != null) params + lib.attrsets.filterAttrs (_k: v: v != null) params ) ) else @@ -242,7 +242,7 @@ in } // optPwCmd "outgoing" passwordCommand; - msmtp = cfg: { + msmtp = _cfg: { outgoing = "msmtpq --read-envelope-from --read-recipients"; }; diff --git a/modules/programs/alacritty.nix b/modules/programs/alacritty.nix index ef3bcabaa3ee..0f7faf3ec04a 100644 --- a/modules/programs/alacritty.nix +++ b/modules/programs/alacritty.nix @@ -99,7 +99,7 @@ in xdg.configFile."alacritty/alacritty.toml" = lib.mkIf (cfg.settings != { }) { source = (tomlFormat.generate "alacritty.toml" cfg.settings).overrideAttrs ( - finalAttrs: prevAttrs: { + _finalAttrs: prevAttrs: { buildCommand = lib.concatStringsSep "\n" [ prevAttrs.buildCommand # TODO: why is this needed? Is there a better way to retain escape sequences? diff --git a/modules/programs/alot/default.nix b/modules/programs/alot/default.nix index f4673a7ef81b..6d3d6ddb2278 100644 --- a/modules/programs/alot/default.nix +++ b/modules/programs/alot/default.nix @@ -138,7 +138,7 @@ let submoduleToAttrs = m: lib.filterAttrs (name: v: name != "_module" && v != null) m; in lib.generators.toINI { mkSectionName = mk2ndLevelSectionName; } ( - lib.mapAttrs (name: x: submoduleToAttrs x) cfg.tags + lib.mapAttrs (_name: x: submoduleToAttrs x) cfg.tags ) ) + '' diff --git a/modules/programs/astroid/default.nix b/modules/programs/astroid/default.nix index 7a3c98ec753b..b9b84a19b434 100644 --- a/modules/programs/astroid/default.nix +++ b/modules/programs/astroid/default.nix @@ -12,7 +12,7 @@ let jsonFormat = pkgs.formats.json { }; astroidAccounts = lib.filterAttrs ( - n: v: v.enable && v.astroid.enable + _n: v: v.enable && v.astroid.enable ) config.accounts.email.accounts; boolOpt = b: if b then "true" else "false"; @@ -51,7 +51,7 @@ let astroidConfig = lib.foldl' lib.recursiveUpdate template [ { astroid.notmuch_config = "${config.xdg.configHome}/notmuch/default/config"; - accounts = lib.mapAttrs (n: accountAttr) astroidAccounts; + accounts = lib.mapAttrs (_n: accountAttr) astroidAccounts; crypto.gpg.path = "${pkgs.gnupg}/bin/gpg"; } cfg.extraConfig diff --git a/modules/programs/borgmatic.nix b/modules/programs/borgmatic.nix index 776e5934007f..409877669ea8 100644 --- a/modules/programs/borgmatic.nix +++ b/modules/programs/borgmatic.nix @@ -232,7 +232,7 @@ let } ); - removeNullValues = attrSet: lib.filterAttrs (key: value: value != null) attrSet; + removeNullValues = attrSet: lib.filterAttrs (_key: value: value != null) attrSet; hmFiles = builtins.attrValues config.home.file; hmSymlinks = (lib.filter (file: !file.recursive) hmFiles); diff --git a/modules/programs/docker-cli.nix b/modules/programs/docker-cli.nix index 937b910139aa..ce17e0f705f6 100644 --- a/modules/programs/docker-cli.nix +++ b/modules/programs/docker-cli.nix @@ -96,7 +96,7 @@ in }; } // lib.mapAttrs' ( - n: ctx: + _n: ctx: let path = "${cfg.configDir}/contexts/meta/${builtins.hashString "sha256" ctx.Name}/meta.json"; in diff --git a/modules/programs/element-desktop.nix b/modules/programs/element-desktop.nix index ab7a4c16d465..b6a8e215f45e 100644 --- a/modules/programs/element-desktop.nix +++ b/modules/programs/element-desktop.nix @@ -112,7 +112,7 @@ in in defaultConfig // (lib.mapAttrs' ( - name: value: + name: _value: lib.nameValuePair "${prefix}/Element-${name}/config.json" { source = (formatter.generate "element-desktop-${name}" cfg.profiles."${name}"); } diff --git a/modules/programs/emacs.nix b/modules/programs/emacs.nix index a4de9c4fc589..d8cdace3ec4c 100644 --- a/modules/programs/emacs.nix +++ b/modules/programs/emacs.nix @@ -69,7 +69,7 @@ in }; extraPackages = mkOption { - default = self: [ ]; + default = _self: [ ]; type = lib.hm.types.selectorFunction; defaultText = "epkgs: []"; example = literalExpression "epkgs: [ epkgs.emms epkgs.magit ]"; @@ -81,7 +81,7 @@ in }; overrides = mkOption { - default = self: super: { }; + default = _self: _super: { }; type = lib.hm.types.overlayFunction; defaultText = "self: super: {}"; example = literalExpression '' diff --git a/modules/programs/feh.nix b/modules/programs/feh.nix index 26b1a6bc8b9a..0c495a87c570 100644 --- a/modules/programs/feh.nix +++ b/modules/programs/feh.nix @@ -26,8 +26,8 @@ let renderBindings = bindings: let - enabled = filterAttrs (n: v: v != null) bindings; - disabled = filterAttrs (n: v: v == null) bindings; + enabled = filterAttrs (_n: v: v != null) bindings; + disabled = filterAttrs (_n: v: v == null) bindings; render = mapAttrsToList renderBinding; in lib.concatStringsSep "\n" (render disabled ++ render enabled); @@ -139,7 +139,7 @@ in config = lib.mkIf cfg.enable { assertions = [ { - assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { }); + assertion = ((filterAttrs (_n: v: v == "") cfg.keybindings) == { }); message = "To disable a keybinding, use `null` instead of an empty string."; } ]; diff --git a/modules/programs/firefox/profiles/search.nix b/modules/programs/firefox/profiles/search.nix index bfa31b6af976..2b4ea52699f9 100644 --- a/modules/programs/firefox/profiles/search.nix +++ b/modules/programs/firefox/profiles/search.nix @@ -49,7 +49,7 @@ let } // (removeAttrs input [ "icon" ]) // optionalAttrs (input ? icon || input ? iconMapObj) { - iconMapObj = mapAttrs (name: iconUrl) ( + iconMapObj = mapAttrs (_name: iconUrl) ( (optionalAttrs (input ? icon) { # Convenience to specify single icon instead of map "16" = input.icon; diff --git a/modules/programs/fzf.nix b/modules/programs/fzf.nix index 37da1562034a..1545b4bc2c35 100644 --- a/modules/programs/fzf.nix +++ b/modules/programs/fzf.nix @@ -194,8 +194,8 @@ in config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.sessionVariables = lib.mapAttrs (n: v: toString v) ( - lib.filterAttrs (n: v: v != [ ] && v != null) { + home.sessionVariables = lib.mapAttrs (_n: v: toString v) ( + lib.filterAttrs (_n: v: v != [ ] && v != null) { FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand; FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions; FZF_CTRL_R_OPTS = cfg.historyWidgetOptions; diff --git a/modules/programs/gnome-terminal.nix b/modules/programs/gnome-terminal.nix index 80f0846e099b..b7258d1a8e91 100644 --- a/modules/programs/gnome-terminal.nix +++ b/modules/programs/gnome-terminal.nix @@ -394,7 +394,7 @@ in }; "${dconfPath}/profiles:" = { - default = lib.head (lib.attrNames (lib.filterAttrs (n: v: v.default) cfg.profile)); + default = lib.head (lib.attrNames (lib.filterAttrs (_n: v: v.default) cfg.profile)); list = lib.attrNames cfg.profile; }; } diff --git a/modules/programs/i3status.nix b/modules/programs/i3status.nix index f24f8afbf122..38cfcdd4b4a5 100644 --- a/modules/programs/i3status.nix +++ b/modules/programs/i3status.nix @@ -14,7 +14,7 @@ let cfg = config.programs.i3status; - enabledModules = lib.filterAttrs (n: v: v.enable) cfg.modules; + enabledModules = lib.filterAttrs (_n: v: v.enable) cfg.modules; formatOrder = n: ''order += "${n}"''; @@ -232,7 +232,7 @@ in [ ] ++ lib.optional (cfg.general != { }) (formatModule "general" cfg.general) ++ map formatOrder (sortAttrNamesByPosition lib.lessThan enabledModules) - ++ lib.mapAttrsToList formatModule (lib.mapAttrs (n: v: v.settings) enabledModules) + ++ lib.mapAttrsToList formatModule (lib.mapAttrs (_n: v: v.settings) enabledModules) ); }; } diff --git a/modules/programs/joplin-desktop.nix b/modules/programs/joplin-desktop.nix index 2acdd58ded15..5084a00f3e4f 100644 --- a/modules/programs/joplin-desktop.nix +++ b/modules/programs/joplin-desktop.nix @@ -98,7 +98,7 @@ in activateJoplinDesktopConfig = let newConfig = jsonFormat.generate "joplin-settings.json" ( - lib.attrsets.filterAttrs (n: v: (v != null) && (v != "")) ( + lib.attrsets.filterAttrs (_n: v: (v != null) && (v != "")) ( { # TODO: find a better way to convert nix attribute names to strings: # sync.interval = ... -> "sync.interval" = ... diff --git a/modules/programs/lutris.nix b/modules/programs/lutris.nix index 3361430581f6..9917ceaefd4d 100644 --- a/modules/programs/lutris.nix +++ b/modules/programs/lutris.nix @@ -188,7 +188,7 @@ in lutris-overrides = { # This only adds pkgs.steam to the extraPkgs, I see no reason to ever enable it. steamSupport = false; - extraPkgs = (prev: cfg.extraPackages ++ optional (cfg.steamPackage != null) cfg.steamPackage); + extraPkgs = (_prev: cfg.extraPackages ++ optional (cfg.steamPackage != null) cfg.steamPackage); }; in [ (cfg.package.override lutris-overrides) ]; @@ -198,7 +198,7 @@ in buildRunnerConfig = ( runner_name: runner_config: # Remove the unset values so they don't end up on the final config. - filterAttrsRecursive (name: value: value != { } && value != null && value != "") { + filterAttrsRecursive (_name: value: value != { } && value != null && value != "") { "${runner_name}" = runner_config.settings.runner # If set translate .package to runner_executable diff --git a/modules/programs/mbsync/default.nix b/modules/programs/mbsync/default.nix index 1b252416c9fd..6daeae34d64d 100644 --- a/modules/programs/mbsync/default.nix +++ b/modules/programs/mbsync/default.nix @@ -27,20 +27,20 @@ let # Given a SINGLE group's channels attribute set, return true if ANY of the channel's # patterns use the invalidOption attribute set value name. channelInvalidOption = - channels: invalidOption: any (c: c) (mapAttrsToList (c: lib.hasAttr invalidOption) channels); + channels: invalidOption: any (c: c) (mapAttrsToList (_c: lib.hasAttr invalidOption) channels); # Given a SINGLE account's groups attribute set, return true if ANY of the account's group's channel's patterns use the invalidOption attribute set value name. groupInvalidOption = groups: invalidOption: any (g: g) ( - mapAttrsToList (groupName: groupVals: channelInvalidOption groupVals.channels invalidOption) groups + mapAttrsToList (_groupName: groupVals: channelInvalidOption groupVals.channels invalidOption) groups ); # Given all accounts (ensure that accounts passed in here ARE mbsync-using accounts) # return true if ANY of the account's groups' channels' patterns use the # invalidOption attribute set value name. accountInvalidOption = - accounts: invalidOption: + _accounts: invalidOption: any (a: a) (map (account: groupInvalidOption account.mbsync.groups invalidOption) mbsyncAccounts); genTlsConfig = @@ -203,7 +203,7 @@ let genChannelStrings = groupName: channels: lib.optionals (channels != { }) ( - mapAttrsToList (channelName: info: genChannelString groupName info) channels + mapAttrsToList (_channelName: info: genChannelString groupName info) channels ); # Given a group, return a string that configures all the channels within # the group. @@ -211,7 +211,7 @@ let # Generate all channel configurations for all groups for this account. in concatStringsSep "\n" ( - lib.remove "" (mapAttrsToList (name: group: genGroupsChannels group) groups) + lib.remove "" (mapAttrsToList (_name: group: genGroupsChannels group) groups) ); # Given the attr set of groups, return a string which maps channels to groups @@ -221,7 +221,7 @@ let # Given the name of the group and the attribute set of channels, make # make "Channel -" for each channel to list os strings genChannelStrings = - groupName: channels: mapAttrsToList (name: info: "Channel ${groupName}-${name}") channels; + groupName: channels: mapAttrsToList (name: _info: "Channel ${groupName}-${name}") channels; # Take in 1 group, if the group has channels specified, construct the # "Group " header and each of the channels. genGroupChannelString = @@ -234,7 +234,7 @@ let # Given set of groups, generates list of strings, where each string is one # of the groups and its constituent channels. genGroupsStrings = mapAttrsToList ( - name: info: concatStringsSep "\n" (genGroupChannelString groups.${name}) + name: _info: concatStringsSep "\n" (genGroupChannelString groups.${name}) ) groups; # Join all non-empty groups. combined = concatStringsSep "\n\n" (lib.remove "" genGroupsStrings) + "\n"; diff --git a/modules/programs/meli.nix b/modules/programs/meli.nix index 4b853e78c9ba..daf42b6d7704 100644 --- a/modules/programs/meli.nix +++ b/modules/programs/meli.nix @@ -18,13 +18,13 @@ let tomlFormat = pkgs.formats.toml { }; enabledAccounts = lib.attrsets.filterAttrs ( - name: value: value.enable && (value.meli.enable or false) + _name: value: value.enable && (value.meli.enable or false) ) config.accounts.email.accounts; meliAccounts = (lib.attrsets.mapAttrs (name: value: (mkMeliAccounts name value)) enabledAccounts); mkMeliAccounts = ( - name: account: { + _name: account: { root_mailbox = "${config.accounts.email.maildirBasePath}/${account.maildir.path}"; format = "Maildir"; identity = account.address; diff --git a/modules/programs/mujmap.nix b/modules/programs/mujmap.nix index b31bfb2d099b..c258584f5ad5 100644 --- a/modules/programs/mujmap.nix +++ b/modules/programs/mujmap.nix @@ -23,7 +23,7 @@ let settingsFormat = pkgs.formats.toml { }; - filterNull = attrs: lib.attrsets.filterAttrs (n: v: v != null) attrs; + filterNull = attrs: lib.attrsets.filterAttrs (_n: v: v != null) attrs; configFile = account: diff --git a/modules/programs/neomutt/default.nix b/modules/programs/neomutt/default.nix index 732a4d47bfd7..88b92797edf3 100644 --- a/modules/programs/neomutt/default.nix +++ b/modules/programs/neomutt/default.nix @@ -21,7 +21,7 @@ let cfg = config.programs.neomutt; neomuttAccountsCfg = filterAttrs ( - n: a: a.enable && a.neomutt.enable + _n: a: a.enable && a.neomutt.enable ) config.accounts.email.accounts; neomuttAccounts = attrValues neomuttAccountsCfg; diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index 7c5baafe8f4a..144aa90ba3b5 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -450,7 +450,7 @@ in grouped = lib.lists.groupBy (x: x.type) pluginsNormalized; configsOnly = lib.foldl (acc: p: if p.config != null then acc ++ [ p.config ] else acc) [ ]; in - lib.mapAttrs (name: vals: lib.concatStringsSep "\n" (configsOnly vals)) grouped; + lib.mapAttrs (_name: vals: lib.concatStringsSep "\n" (configsOnly vals)) grouped; home.packages = [ cfg.finalPackage ]; diff --git a/modules/programs/papis.nix b/modules/programs/papis.nix index c1adf76709fd..ae1490f0f142 100644 --- a/modules/programs/papis.nix +++ b/modules/programs/papis.nix @@ -13,7 +13,7 @@ let lib.mapAttrsToList (n: v: if v.isDefault then n else null) cfg.libraries ); - settingsIni = (lib.mapAttrs (n: v: v.settings) cfg.libraries) // { + settingsIni = (lib.mapAttrs (_n: v: v.settings) cfg.libraries) // { settings = cfg.settings // lib.optionalAttrs (cfg.libraries != { }) { diff --git a/modules/programs/password-store.nix b/modules/programs/password-store.nix index ebdcf27f742c..a4ada931b4ff 100644 --- a/modules/programs/password-store.nix +++ b/modules/programs/password-store.nix @@ -55,7 +55,7 @@ in services.pass-secret-service.storePath = lib.mkDefault cfg.settings.PASSWORD_STORE_DIR; xsession.importedVariables = lib.mkIf config.xsession.enable ( - lib.mapAttrsToList (name: value: name) cfg.settings + lib.mapAttrsToList (name: _value: name) cfg.settings ); }; } diff --git a/modules/programs/radio-active.nix b/modules/programs/radio-active.nix index 455f5ced62de..00223f332b11 100644 --- a/modules/programs/radio-active.nix +++ b/modules/programs/radio-active.nix @@ -104,7 +104,7 @@ in radio-active = if player == "mpv" then pkgs.radio-active.overrideAttrs ( - finalAttrs: previousAttrs: { + _finalAttrs: previousAttrs: { postPatch = '' ${previousAttrs.postPatch} @@ -116,7 +116,7 @@ in ) else if player == "vlc" then pkgs.radio-active.overrideAttrs ( - finalAttrs: previousAttrs: { + _finalAttrs: previousAttrs: { postPatch = '' ${previousAttrs.postPatch} diff --git a/modules/programs/ripgrep-all.nix b/modules/programs/ripgrep-all.nix index 9a24b5bfbe92..93a220adb741 100644 --- a/modules/programs/ripgrep-all.nix +++ b/modules/programs/ripgrep-all.nix @@ -94,7 +94,7 @@ in file."${configPath}" = lib.mkIf (cfg.custom_adapters != [ ]) { source = (pkgs.formats.json { }).generate "ripgrep-all" { "$schema" = "./config.schema.json"; - custom_adapters = map (lib.filterAttrs (n: v: v != null)) cfg.custom_adapters; + custom_adapters = map (lib.filterAttrs (_n: v: v != null)) cfg.custom_adapters; }; }; }; diff --git a/modules/programs/sbt.nix b/modules/programs/sbt.nix index a45436d68aa1..0a5f980db4e0 100644 --- a/modules/programs/sbt.nix +++ b/modules/programs/sbt.nix @@ -43,7 +43,7 @@ let ${concatStrings (lib.mapAttrsToList (name: value: "${name}: ${value}") value)} ''; - renderRepositories = repos: '' + renderRepositories = _repos: '' [repositories] ${concatStrings (map renderRepository cfg.repositories)}''; diff --git a/modules/programs/skim.nix b/modules/programs/skim.nix index 223f1ae01767..2ff24ff8188f 100644 --- a/modules/programs/skim.nix +++ b/modules/programs/skim.nix @@ -98,8 +98,8 @@ in config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.sessionVariables = lib.mapAttrs (n: v: toString v) ( - lib.filterAttrs (n: v: v != [ ] && v != null) { + home.sessionVariables = lib.mapAttrs (_n: v: toString v) ( + lib.filterAttrs (_n: v: v != [ ] && v != null) { SKIM_ALT_C_COMMAND = cfg.changeDirWidgetCommand; SKIM_ALT_C_OPTS = cfg.changeDirWidgetOptions; SKIM_CTRL_R_OPTS = cfg.historyWidgetOptions; diff --git a/modules/programs/smug.nix b/modules/programs/smug.nix index 144c56ff0470..1f110d3126a4 100644 --- a/modules/programs/smug.nix +++ b/modules/programs/smug.nix @@ -148,7 +148,7 @@ in config = let - cleanedProjects = lib.filterAttrsRecursive (name: value: value != null) cfg.projects; + cleanedProjects = lib.filterAttrsRecursive (_name: value: value != null) cfg.projects; mkProjects = lib.attrsets.mapAttrs' ( k: v: { @@ -163,7 +163,7 @@ in // { session = k; windows = lib.lists.forEach v.windows ( - winprop: (lib.filterAttrsRecursive (name: value: value != null) winprop) + winprop: (lib.filterAttrsRecursive (_name: value: value != null) winprop) ); }; in diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix index f73da437b92d..bcc1bbe5eaa9 100644 --- a/modules/programs/ssh.nix +++ b/modules/programs/ssh.nix @@ -640,10 +640,10 @@ in warnings = mapAttrsToList - (n: v: '' + (n: _v: '' The SSH config match block `programs.ssh.matchBlocks.${n}` sets both of the host and match options. The match option takes precedence.'') - (lib.filterAttrs (n: v: v.data.host != null && v.data.match != null) cfg.matchBlocks); + (lib.filterAttrs (_n: v: v.data.host != null && v.data.match != null) cfg.matchBlocks); } (lib.mkIf cfg.enableDefaultConfig { warnings = [ diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index d87a87f14ea7..e8bc85180c0a 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -228,7 +228,7 @@ let let inherit (contact) id; in - lib.filterAttrs (n: v: v != null) ( + lib.filterAttrs (_n: v: v != null) ( { "ldap_2.servers.contact_${id}.description" = contact.name; "ldap_2.servers.contact_${id}.filename" = "contact_${id}.sqlite"; # this is needed for carddav to work @@ -938,7 +938,7 @@ in # Append the default local folder name "account1". # See https://github.com/nix-community/home-manager/issues/5031. - enabledAccountsIds = (lib.attrsets.mapAttrsToList (name: value: value) accountNameToId) ++ [ + enabledAccountsIds = (lib.attrsets.mapAttrsToList (_name: value: value) accountNameToId) ++ [ "account1" ]; in @@ -957,7 +957,7 @@ in accountsOrderIds = map (a: accountNameToId."${a}" or a) profile.calendarAccountsOrder; - enabledAccountsIds = (lib.attrsets.mapAttrsToList (name: value: value) accountNameToId); + enabledAccountsIds = (lib.attrsets.mapAttrsToList (_name: value: value) accountNameToId); in lib.optionals (calendarAccounts != [ ]) ( accountsOrderIds ++ (lib.lists.subtractLists accountsOrderIds enabledAccountsIds) @@ -1012,7 +1012,7 @@ in } ) ++ (mapAttrsToList ( - name: profile: + name: _profile: let emailAccountsWithFilters = ( filter (a: a.thunderbird.messageFilters != [ ]) ( diff --git a/modules/programs/vdirsyncer/default.nix b/modules/programs/vdirsyncer/default.nix index 06ad33d0d3a9..4f79bb15836b 100644 --- a/modules/programs/vdirsyncer/default.nix +++ b/modules/programs/vdirsyncer/default.nix @@ -298,7 +298,7 @@ in in mapAttrsToList ( - a: v': + a: _v': [ { assertion = (lib.elem a allowed); @@ -325,7 +325,7 @@ in ++ map ( attrs: let - defined = lib.attrNames (filterAttrs (n: v: v != null) (lib.genAttrs attrs (a: v.${a} or null))); + defined = lib.attrNames (filterAttrs (_n: v: v != null) (lib.genAttrs attrs (a: v.${a} or null))); in { assertion = lib.length defined <= 1; diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index 6773c87864a4..71afb018fe5d 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -57,7 +57,7 @@ let options = let opt = - name: type: + _name: type: mkOption { type = types.nullOr type; default = null; diff --git a/modules/programs/vscode/default.nix b/modules/programs/vscode/default.nix index 4eba83784636..3d5c04a86595 100644 --- a/modules/programs/vscode/default.nix +++ b/modules/programs/vscode/default.nix @@ -389,7 +389,7 @@ in (mkIf ( (lib.filterAttrs ( - n: v: + _n: v: (v ? enableExtensionUpdateCheck || v ? enableUpdateCheck) && (v.enableExtensionUpdateCheck != null || v.enableUpdateCheck != null) ) allProfilesExceptDefault) != { } @@ -412,7 +412,7 @@ in PATH=${lib.makeBinPath [ pkgs.jq ]}''${PATH:+:}$PATH file="${userDir}/globalStorage/storage.json" file_write="" - profiles=(${lib.escapeShellArgs (flatten (mapAttrsToList (n: v: n) allProfilesExceptDefault))}) + profiles=(${lib.escapeShellArgs (flatten (mapAttrsToList (n: _v: n) allProfilesExceptDefault))}) if [ -f "$file" ]; then existing_profiles=$(jq '.userDataProfiles // [] | map({ (.name): .location }) | add // {}' "$file") @@ -517,7 +517,7 @@ in # causes VSCode to create the extensions.json with all the extensions # in the extension directory, which includes extensions from other profiles. lib.mkMerge ( - lib.concatMap toPaths (flatten (mapAttrsToList (n: v: v.extensions) cfg.profiles)) + lib.concatMap toPaths (flatten (mapAttrsToList (_n: v: v.extensions) cfg.profiles)) ++ lib.optional ( @@ -550,7 +550,7 @@ in combinedExtensionsDrv = pkgs.buildEnv { name = "vscode-extensions"; paths = - (flatten (mapAttrsToList (n: v: v.extensions) cfg.profiles)) + (flatten (mapAttrsToList (_n: v: v.extensions) cfg.profiles)) ++ lib.optional ( ( lib.versionAtLeast vscodeVersion "1.74.0" diff --git a/modules/programs/waybar.nix b/modules/programs/waybar.nix index 86fc49d476c1..19a899370539 100644 --- a/modules/programs/waybar.nix +++ b/modules/programs/waybar.nix @@ -24,7 +24,7 @@ let jsonFormat = pkgs.formats.json { }; mkMargin = - name: + _name: mkOption { type = types.nullOr types.int; default = null; diff --git a/modules/programs/wofi.nix b/modules/programs/wofi.nix index 699445ec6e7f..760be9ba5485 100644 --- a/modules/programs/wofi.nix +++ b/modules/programs/wofi.nix @@ -14,7 +14,7 @@ let '' # Generated by Home Manager. '' - + lib.generators.toKeyValue { } (lib.filterAttrs (name: value: value != null) attrs); + + lib.generators.toKeyValue { } (lib.filterAttrs (_name: value: value != null) attrs); in { meta.maintainers = [ lib.maintainers.christoph-heiss ]; diff --git a/modules/services/activitywatch.nix b/modules/services/activitywatch.nix index f21710677320..dd192926e301 100644 --- a/modules/services/activitywatch.nix +++ b/modules/services/activitywatch.nix @@ -12,7 +12,7 @@ let cfg = config.services.activitywatch; mkWatcherService = - name: cfg: + _name: cfg: let jobName = "activitywatch-watcher-${cfg.name}"; in @@ -122,7 +122,7 @@ let }; generateWatchersConfig = - name: cfg: + _name: cfg: let # We're only assuming the generated filepath this since most watchers # uses the ActivityWatch client library which has `load_config_toml` diff --git a/modules/services/git-sync.nix b/modules/services/git-sync.nix index ce0e78afd41e..b672312f4a15 100644 --- a/modules/services/git-sync.nix +++ b/modules/services/git-sync.nix @@ -42,7 +42,7 @@ let }; }; - mkAgent = name: repo: { + mkAgent = _name: repo: { enable = true; config = { StartInterval = repo.interval; diff --git a/modules/services/macos-remap-keys/keytables.nix b/modules/services/macos-remap-keys/keytables.nix index f035e96ec0db..738168eead18 100644 --- a/modules/services/macos-remap-keys/keytables.nix +++ b/modules/services/macos-remap-keys/keytables.nix @@ -137,7 +137,7 @@ let mapToInt = keyPage: attrs: lib.mapAttrs ( - name: value: + _name: value: let keycode = lib.fromHexString (lib.removePrefix "0x" value); in diff --git a/modules/services/mako.nix b/modules/services/mako.nix index cca30a2eda64..c1ef584ebe9e 100644 --- a/modules/services/mako.nix +++ b/modules/services/mako.nix @@ -19,8 +19,8 @@ let let formatValue = v: if builtins.isBool v then if v then "true" else "false" else toString v; - globalSettings = lib.filterAttrs (n: v: !(lib.isAttrs v)) config; - sectionSettings = lib.filterAttrs (n: v: lib.isAttrs v) config; + globalSettings = lib.filterAttrs (_n: v: !(lib.isAttrs v)) config; + sectionSettings = lib.filterAttrs (_n: v: lib.isAttrs v) config; globalLines = lib.concatStringsSep "\n" ( lib.mapAttrsToList (k: v: "${k}=${formatValue v}") globalSettings diff --git a/modules/services/picom.nix b/modules/services/picom.nix index f07a3ef02886..2f48bea7e938 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -41,7 +41,7 @@ let description = "pair of ${x.description}"; }; - mkDefaultAttrs = mapAttrs (n: v: mkDefault v); + mkDefaultAttrs = mapAttrs (_n: v: mkDefault v); # Basically a tinkered lib.generators.mkKeyValueDefault # It either serializes a top-level definition "key: { values };" diff --git a/modules/services/podman-linux/containers.nix b/modules/services/podman-linux/containers.nix index 384190f33ffe..d7afff7fd0ef 100644 --- a/modules/services/podman-linux/containers.nix +++ b/modules/services/podman-linux/containers.nix @@ -63,7 +63,7 @@ let let quadletName = extractQuadletReference type value; quadletsOfType = lib.filterAttrs ( - n: v: v.quadletData.resourceType == type + _n: v: v.quadletData.resourceType == type ) cfg.internal.builtQuadlets; in if (lib.hasAttr quadletName quadletsOfType) then diff --git a/modules/services/podman-linux/default.nix b/modules/services/podman-linux/default.nix index ecabeec99bed..e7a9db1fd6a7 100644 --- a/modules/services/podman-linux/default.nix +++ b/modules/services/podman-linux/default.nix @@ -109,7 +109,7 @@ in else "${pkgs.skopeo.policy}/default-policy.json"; "containers/registries.conf".source = toml.generate "registries.conf" { - registries = lib.mapAttrs (n: v: { registries = v; }) cfg.settings.registries; + registries = lib.mapAttrs (_n: v: { registries = v; }) cfg.settings.registries; }; "containers/storage.conf".source = toml.generate "storage.conf" cfg.settings.storage; "containers/containers.conf".source = toml.generate "containers.conf" cfg.settings.containers; diff --git a/modules/services/recoll.nix b/modules/services/recoll.nix index 9002abfa6b69..37a0cb5196d9 100644 --- a/modules/services/recoll.nix +++ b/modules/services/recoll.nix @@ -64,8 +64,8 @@ let # There's a possibility of attributes with attrsets overriding other # top-level attributes with non-attrsets so we're forcing the attrsets to # come last. - _config = lib.mapAttrsToList convert (lib.filterAttrs (k: v: !isAttrs v) attr); - _config' = lib.mapAttrsToList convert (lib.filterAttrs (k: v: isAttrs v) attr); + _config = lib.mapAttrsToList convert (lib.filterAttrs (_k: v: !isAttrs v) attr); + _config' = lib.mapAttrsToList convert (lib.filterAttrs (_k: v: isAttrs v) attr); config = _config ++ _config'; in lib.concatStringsSep "\n" config; diff --git a/modules/services/unison.nix b/modules/services/unison.nix index 3b81a36fac05..8c3560f0e7d2 100644 --- a/modules/services/unison.nix +++ b/modules/services/unison.nix @@ -144,7 +144,7 @@ in ); systemd.user.timers = makeDefs ( - name: pairCfg: { + name: _pairCfg: { Unit.Description = "Unison pair sync auto-restart (${name})"; Install.WantedBy = [ "timers.target" ]; Timer = { diff --git a/modules/services/way-displays.nix b/modules/services/way-displays.nix index 1ddfe19daaad..d06ac52c7ca1 100644 --- a/modules/services/way-displays.nix +++ b/modules/services/way-displays.nix @@ -88,7 +88,7 @@ in home.packages = [ cfg.package ]; - wayland.windowManager = lib.mapAttrs (name: _: { + wayland.windowManager = lib.mapAttrs (_name: _: { systemd.variables = lib.mkOptionDefault [ "XDG_VTNR" ]; }) options.wayland.windowManager; diff --git a/modules/services/window-managers/bspwm/default.nix b/modules/services/window-managers/bspwm/default.nix index 6c5f64f65789..7640edd74fa0 100644 --- a/modules/services/window-managers/bspwm/default.nix +++ b/modules/services/window-managers/bspwm/default.nix @@ -59,7 +59,7 @@ let formatDirective = n: v: "${camelToSnake n}=${formatValue v}"; directivesStr = escapeShellArgs ( - mapAttrsToList formatDirective (lib.filterAttrs (n: v: v != null) directives) + mapAttrsToList formatDirective (lib.filterAttrs (_n: v: v != null) directives) ); in "bspc rule -a ${escapeShellArg target} ${directivesStr}"; diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 1a1caee450eb..9d2ac5553d94 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -347,12 +347,12 @@ in # attrset of { = ; } for all submaps submapWarningsAttrset = builtins.mapAttrs ( - name: submap: filterNonBinds submap.settings + _name: submap: filterNonBinds submap.settings ) cfg.submaps; submapWarnings = lib.mapAttrsToList (submapName: nonBinds: '' wayland.windowManager.hyprland.submaps."${submapName}".settings: found non-bind entries: [${builtins.toString nonBinds}], which will have no effect in a submap - '') (lib.filterAttrs (n: v: v != [ ]) submapWarningsAttrset); + '') (lib.filterAttrs (_n: v: v != [ ]) submapWarningsAttrset); in submapWarnings ++ lib.optional inconsistent warning; @@ -368,7 +368,7 @@ in importantPrefixes = cfg.importantPrefixes ++ lib.optional cfg.sourceFirst "source"; pluginsToHyprconf = - plugins: + _plugins: lib.hm.generators.toHyprconf { attrs = { "exec-once" = diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index 7fba897a79f0..fa270f22f5dc 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -43,7 +43,7 @@ let keybindings = mkOption { type = types.attrsOf (types.nullOr types.str); - default = lib.mapAttrs (n: lib.mkOptionDefault) { + default = lib.mapAttrs (_n: lib.mkOptionDefault) { "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; "${cfg.config.modifier}+Shift+q" = "kill"; "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; diff --git a/modules/services/window-managers/i3-sway/lib/functions.nix b/modules/services/window-managers/i3-sway/lib/functions.nix index 2b8ecd7ef03e..01e043701065 100644 --- a/modules/services/window-managers/i3-sway/lib/functions.nix +++ b/modules/services/window-managers/i3-sway/lib/functions.nix @@ -16,11 +16,11 @@ rec { "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]"; keybindingDefaultWorkspace = lib.filterAttrs ( - n: v: cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace + _n: v: cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace ) cfg.config.keybindings; keybindingsRest = lib.filterAttrs ( - n: v: cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace + _n: v: cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace ) cfg.config.keybindings; keybindingsStr = @@ -120,7 +120,7 @@ rec { ... }: let - colorsNotNull = lib.filterAttrs (n: v: v != null) colors != { }; + colorsNotNull = lib.filterAttrs (_n: v: v != null) colors != { }; in lib.concatMapStrings (x: x + "\n") ( indent (lib.lists.subtractLists [ "" null ] ( @@ -221,7 +221,7 @@ rec { level ? 1, }: let - prefix = concatStringsSep "" (lib.genList (x: " ") (level * 2)); + prefix = concatStringsSep "" (lib.genList (_x: " ") (level * 2)); in (lib.imap1 ( diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 3fb08dfc87af..334829f7dc60 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -77,7 +77,7 @@ let keybindings = mkOption { type = types.attrsOf (types.nullOr types.str); - default = lib.mapAttrs (n: lib.mkOptionDefault) { + default = lib.mapAttrs (_n: lib.mkOptionDefault) { "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; "${cfg.config.modifier}+Shift+q" = "kill"; "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; @@ -478,9 +478,9 @@ let (keycodebindingsStr keycodebindings) ] ++ optional (builtins.attrNames bindswitches != [ ]) (bindswitchesStr bindswitches) - ++ mapAttrsToList inputStr (filterAttrs (n: v: n == "*") input) - ++ mapAttrsToList inputStr (filterAttrs (n: v: hasPrefix "type:" n) input) - ++ mapAttrsToList inputStr (filterAttrs (n: v: n != "*" && !(hasPrefix "type:" n)) input) + ++ mapAttrsToList inputStr (filterAttrs (n: _v: n == "*") input) + ++ mapAttrsToList inputStr (filterAttrs (n: _v: hasPrefix "type:" n) input) + ++ mapAttrsToList inputStr (filterAttrs (n: _v: n != "*" && !(hasPrefix "type:" n)) input) ++ mapAttrsToList outputStr output # outputs ++ mapAttrsToList seatStr seat # seats ++ mapAttrsToList (modeStr cfg.config.bindkeysToCode) modes # modes diff --git a/modules/services/window-managers/xmonad.nix b/modules/services/window-managers/xmonad.nix index e0c5019a722f..c003adf021eb 100644 --- a/modules/services/window-managers/xmonad.nix +++ b/modules/services/window-managers/xmonad.nix @@ -39,7 +39,7 @@ in }; extraPackages = mkOption { - default = self: [ ]; + default = _self: [ ]; defaultText = "self: []"; example = literalExpression '' haskellPackages: [ diff --git a/modules/targets/darwin/user-defaults/default.nix b/modules/targets/darwin/user-defaults/default.nix index 153f0d164223..b4493ae28e10 100644 --- a/modules/targets/darwin/user-defaults/default.nix +++ b/modules/targets/darwin/user-defaults/default.nix @@ -20,9 +20,11 @@ let domain: attrs: "run /usr/bin/defaults ${cliFlags} import ${lib.escapeShellArg domain} ${toDefaultsFile domain attrs}"; - nonNullDefaults = lib.mapAttrs (domain: attrs: (lib.filterAttrs (n: v: v != null) attrs)) settings; + nonNullDefaults = lib.mapAttrs ( + _domain: attrs: (lib.filterAttrs (_n: v: v != null) attrs) + ) settings; - writableDefaults = lib.filterAttrs (domain: attrs: attrs != { }) nonNullDefaults; + writableDefaults = lib.filterAttrs (_domain: attrs: attrs != { }) nonNullDefaults; in lib.mapAttrsToList toActivationCmd writableDefaults; diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 971c2769aeb9..830f28f16710 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -18,7 +18,7 @@ in (lib.mkIf (cfg.users != { }) { system.activationScripts.postActivation.text = lib.concatStringsSep "\n" ( lib.mapAttrsToList ( - username: usercfg: + _username: usercfg: let driverVersion = if cfg.enableLegacyProfileManagement then "0" else "1"; in diff --git a/overlay.nix b/overlay.nix index 78fcb60ce3cf..f974bf05d050 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,3 +1,3 @@ -final: prev: { +_final: prev: { home-manager = prev.callPackage ./home-manager { path = toString ./.; }; } diff --git a/tests/darwinScrublist.nix b/tests/darwinScrublist.nix index 1287f681258c..985bde957110 100644 --- a/tests/darwinScrublist.nix +++ b/tests/darwinScrublist.nix @@ -190,7 +190,7 @@ let # Create an overlay that scrubs packages in the scrublist packageScrubOverlay = - self: super: + _self: super: lib.mapAttrs ( name: value: if lib.elem name packagesToScrub then diff --git a/tests/default.nix b/tests/default.nix index 88ff40ecea7f..3df7c3d7df0f 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -47,7 +47,7 @@ let # Globally unscrub a few selected packages that are used by a wide selection of tests. whitelist = let - inner = self: super: { + inner = _self: super: { inherit (pkgs) coreutils crudini @@ -66,7 +66,7 @@ let fish ; - xorg = super.xorg.overrideScope (self: super: { inherit (pkgs.xorg) lndir; }); + xorg = super.xorg.overrideScope (_self: _super: { inherit (pkgs.xorg) lndir; }); }; outer = @@ -85,12 +85,12 @@ let # TODO: fix darwin stdenv stubbing if isDarwin then let - rawPkgs = lib.makeExtensible (final: pkgs); + rawPkgs = lib.makeExtensible (_final: pkgs); in builtins.traceVerbose "eval scrubbed darwin nixpkgs" (rawPkgs.extend darwinScrublist) else let - rawScrubbedPkgs = lib.makeExtensible (final: scrubDerivations pkgs); + rawScrubbedPkgs = lib.makeExtensible (_final: scrubDerivations pkgs); in builtins.traceVerbose "eval scrubbed nixpkgs" (rawScrubbedPkgs.extend whitelist); diff --git a/tests/integration/standalone/restic.nix b/tests/integration/standalone/restic.nix index aa45acfc448b..2e1d706a8381 100644 --- a/tests/integration/standalone/restic.nix +++ b/tests/integration/standalone/restic.nix @@ -12,7 +12,7 @@ let ''; dynDir = testDir.overrideAttrs ( - final: prev: { + _final: prev: { buildCommand = prev.buildCommand + '' echo more secret data > $out/top-secret echo shhhh > $out/top-secret-v2 diff --git a/tests/modules/accounts/email-test-accounts.nix b/tests/modules/accounts/email-test-accounts.nix index ae37e7f2fa85..0679bae95e88 100644 --- a/tests/modules/accounts/email-test-accounts.nix +++ b/tests/modules/accounts/email-test-accounts.nix @@ -37,7 +37,7 @@ accountAttrOptions = options.accounts.email.accounts.type.nestedTypes.elemType.getSubOptions [ ]; throwOnAttrAccess = - baseName: builtins.mapAttrs (n: v: throw "Unexpected access of ${baseName}.${n}"); + baseName: builtins.mapAttrs (n: _v: throw "Unexpected access of ${baseName}.${n}"); # Don't want to do anything with these account attributes. ignoredAttrNames = [ diff --git a/tests/modules/misc/qt/qt-platform-theme-gtk.nix b/tests/modules/misc/qt/qt-platform-theme-gtk.nix index 8e19f47f6d18..f0794fad73c8 100644 --- a/tests/modules/misc/qt/qt-platform-theme-gtk.nix +++ b/tests/modules/misc/qt/qt-platform-theme-gtk.nix @@ -12,15 +12,15 @@ }; nixpkgs.overlays = [ - (final: prev: { + (_final: prev: { libsForQt5 = prev.libsForQt5.overrideScope ( - qt5final: qt5prev: { + _qt5final: _qt5prev: { qtstyleplugins = config.lib.test.mkStubPackage { outPath = null; }; } ); qt6Packages = prev.qt6Packages.overrideScope ( - qt6final: qt6prev: { + _qt6final: _qt6prev: { qt6gtk2 = config.lib.test.mkStubPackage { outPath = null; }; } ); diff --git a/tests/modules/misc/xdg/portal.nix b/tests/modules/misc/xdg/portal.nix index 745f17b2c39b..c8bb5d06cbae 100644 --- a/tests/modules/misc/xdg/portal.nix +++ b/tests/modules/misc/xdg/portal.nix @@ -21,7 +21,7 @@ lib.mkIf config.test.enableBig { }; }; - test.unstubs = [ (self: super: { inherit (realPkgs) xdg-desktop-portal; }) ]; + test.unstubs = [ (_self: _super: { inherit (realPkgs) xdg-desktop-portal; }) ]; nmt.script = '' assertFileExists home-path/share/systemd/user/xdg-desktop-portal.service diff --git a/tests/modules/misc/xsession/basic.nix b/tests/modules/misc/xsession/basic.nix index 70ff05922a42..3dcc6b397ba0 100644 --- a/tests/modules/misc/xsession/basic.nix +++ b/tests/modules/misc/xsession/basic.nix @@ -9,7 +9,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { xorg = super.xorg // { setxkbmap = super.xorg.setxkbmap // { outPath = "@setxkbmap@"; diff --git a/tests/modules/misc/xsession/keyboard-without-layout.nix b/tests/modules/misc/xsession/keyboard-without-layout.nix index 0618bca45e3b..1d1935355e8c 100644 --- a/tests/modules/misc/xsession/keyboard-without-layout.nix +++ b/tests/modules/misc/xsession/keyboard-without-layout.nix @@ -18,7 +18,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { xorg = super.xorg // { setxkbmap = super.xorg.setxkbmap // { outPath = "@setxkbmap@"; diff --git a/tests/modules/programs/aerospace/aerospace-colemak.nix b/tests/modules/programs/aerospace/aerospace-colemak.nix index 7014e2924afe..717588efb3cf 100644 --- a/tests/modules/programs/aerospace/aerospace-colemak.nix +++ b/tests/modules/programs/aerospace/aerospace-colemak.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: let hmPkgs = pkgs.extend ( - self: super: { + _self: _super: { aerospace = config.lib.test.mkStubPackage { name = "aerospace"; buildScript = '' diff --git a/tests/modules/programs/aerospace/aerospace.nix b/tests/modules/programs/aerospace/aerospace.nix index 080a781e7eed..7c8e0ce46d38 100644 --- a/tests/modules/programs/aerospace/aerospace.nix +++ b/tests/modules/programs/aerospace/aerospace.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: let hmPkgs = pkgs.extend ( - self: super: { + _self: _super: { aerospace = config.lib.test.mkStubPackage { name = "aerospace"; buildScript = '' diff --git a/tests/modules/programs/browserpass/browserpass.nix b/tests/modules/programs/browserpass/browserpass.nix index 653741b173aa..77d9b0a00875 100644 --- a/tests/modules/programs/browserpass/browserpass.nix +++ b/tests/modules/programs/browserpass/browserpass.nix @@ -13,7 +13,7 @@ ]; }; - nixpkgs.overlays = [ (self: super: { inherit (realPkgs) browserpass; }) ]; + nixpkgs.overlays = [ (_self: _super: { inherit (realPkgs) browserpass; }) ]; nmt.script = if realPkgs.stdenv.hostPlatform.isDarwin then diff --git a/tests/modules/programs/carapace/fish.nix b/tests/modules/programs/carapace/fish.nix index 1e01739bce1c..b04283dcd8d6 100644 --- a/tests/modules/programs/carapace/fish.nix +++ b/tests/modules/programs/carapace/fish.nix @@ -11,7 +11,7 @@ lib.mkIf config.test.enableBig { fish.enable = true; }; - nixpkgs.overlays = [ (self: super: { inherit (realPkgs) carapace; }) ]; + nixpkgs.overlays = [ (_self: _super: { inherit (realPkgs) carapace; }) ]; nmt.script = let diff --git a/tests/modules/programs/firefox/common.nix b/tests/modules/programs/firefox/common.nix index 14218705e462..fa1e4a78fddd 100644 --- a/tests/modules/programs/firefox/common.nix +++ b/tests/modules/programs/firefox/common.nix @@ -1,7 +1,7 @@ name: builtins.mapAttrs ( - test: module: + _test: module: import module [ "programs" name diff --git a/tests/modules/programs/gnome-shell/gnome-shell.nix b/tests/modules/programs/gnome-shell/gnome-shell.nix index 42a1118df33d..d305480c0a04 100644 --- a/tests/modules/programs/gnome-shell/gnome-shell.nix +++ b/tests/modules/programs/gnome-shell/gnome-shell.nix @@ -43,7 +43,7 @@ let in { nixpkgs.overlays = [ - (final: prev: { gnome-shell-extensions = dummy-gnome-shell-extensions; }) + (_final: _prev: { gnome-shell-extensions = dummy-gnome-shell-extensions; }) ]; programs.gnome-shell.enable = true; diff --git a/tests/modules/programs/kitty/theme-to-themeFile.nix b/tests/modules/programs/kitty/theme-to-themeFile.nix index 849be1e2ecf1..9138c973d985 100644 --- a/tests/modules/programs/kitty/theme-to-themeFile.nix +++ b/tests/modules/programs/kitty/theme-to-themeFile.nix @@ -21,7 +21,7 @@ lib.mkIf config.test.enableLegacyIfd { ) ]; - nixpkgs.overlays = [ (self: super: { inherit (realPkgs) kitty-themes; }) ]; + nixpkgs.overlays = [ (_self: _super: { inherit (realPkgs) kitty-themes; }) ]; nmt.script = '' assertFileExists home-files/.config/kitty/kitty.conf diff --git a/tests/modules/programs/kubecolor/does-have-openshift.nix b/tests/modules/programs/kubecolor/does-have-openshift.nix index 8866bc4df743..10d1ab758050 100644 --- a/tests/modules/programs/kubecolor/does-have-openshift.nix +++ b/tests/modules/programs/kubecolor/does-have-openshift.nix @@ -17,7 +17,7 @@ }; }; nixpkgs.overlays = [ - (self: super: rec { + (_self: _super: rec { openshift = config.lib.test.mkStubPackage { name = "openshift"; version = "4.16.0"; diff --git a/tests/modules/programs/sketchybar/sketchybar-service-integration.nix b/tests/modules/programs/sketchybar/sketchybar-service-integration.nix index 9c7bfb123551..7a0c76767d33 100644 --- a/tests/modules/programs/sketchybar/sketchybar-service-integration.nix +++ b/tests/modules/programs/sketchybar/sketchybar-service-integration.nix @@ -6,7 +6,7 @@ let hmPkgs = pkgs.extend ( - self: super: { + _self: _super: { sketchybar = config.lib.test.mkStubPackage { name = "sketchybar"; buildScript = '' diff --git a/tests/modules/programs/texlive/texlive-minimal.nix b/tests/modules/programs/texlive/texlive-minimal.nix index bf913249cafa..a33d57401c0f 100644 --- a/tests/modules/programs/texlive/texlive-minimal.nix +++ b/tests/modules/programs/texlive/texlive-minimal.nix @@ -5,7 +5,7 @@ # Set up a minimal mocked texlive package set. nixpkgs.overlays = [ - (self: super: { + (_self: _super: { texlive = { collection-basic = pkgs.writeTextDir "collection-basic" ""; combine = diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix index 8860fb76c963..2d2dd7fcc2d5 100644 --- a/tests/modules/programs/tmux/disable-confirmation-prompt.nix +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix @@ -6,7 +6,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { tmuxPlugins = super.tmuxPlugins // { sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; diff --git a/tests/modules/programs/tmux/emacs-with-plugins.nix b/tests/modules/programs/tmux/emacs-with-plugins.nix index f8847b879a4d..9b9fa3ed64ae 100644 --- a/tests/modules/programs/tmux/emacs-with-plugins.nix +++ b/tests/modules/programs/tmux/emacs-with-plugins.nix @@ -17,7 +17,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { tmuxPlugins = super.tmuxPlugins // { fzf-tmux-url = super.tmuxPlugins.fzf-tmux-url // { rtp = "@tmuxplugin_fzf_tmux_url_rtp@"; diff --git a/tests/modules/programs/tmux/mouse-enabled.nix b/tests/modules/programs/tmux/mouse-enabled.nix index 49fda07297a5..97f8ca2cc3ad 100644 --- a/tests/modules/programs/tmux/mouse-enabled.nix +++ b/tests/modules/programs/tmux/mouse-enabled.nix @@ -6,7 +6,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { tmuxPlugins = super.tmuxPlugins // { sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; diff --git a/tests/modules/programs/tmux/prefix.nix b/tests/modules/programs/tmux/prefix.nix index e2336a8585ab..f71fa2266b32 100644 --- a/tests/modules/programs/tmux/prefix.nix +++ b/tests/modules/programs/tmux/prefix.nix @@ -6,7 +6,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { tmuxPlugins = super.tmuxPlugins // { sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; diff --git a/tests/modules/programs/tmux/shortcut-without-prefix.nix b/tests/modules/programs/tmux/shortcut-without-prefix.nix index d9a2bf493ca8..17f609ab60a0 100644 --- a/tests/modules/programs/tmux/shortcut-without-prefix.nix +++ b/tests/modules/programs/tmux/shortcut-without-prefix.nix @@ -7,7 +7,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { tmuxPlugins = super.tmuxPlugins // { sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; diff --git a/tests/modules/programs/tmux/vi-all-true.nix b/tests/modules/programs/tmux/vi-all-true.nix index e8d2d187f425..baf676da0bdd 100644 --- a/tests/modules/programs/tmux/vi-all-true.nix +++ b/tests/modules/programs/tmux/vi-all-true.nix @@ -10,7 +10,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { tmuxPlugins = super.tmuxPlugins // { sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; diff --git a/tests/modules/services/emacs/darwin/basic.nix b/tests/modules/services/emacs/darwin/basic.nix index 97ac5db7487b..46f36a57cbed 100644 --- a/tests/modules/services/emacs/darwin/basic.nix +++ b/tests/modules/services/emacs/darwin/basic.nix @@ -2,7 +2,7 @@ { nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/emacs/linux/emacs-default-editor.nix b/tests/modules/services/emacs/linux/emacs-default-editor.nix index 04490cd56ad9..8fbea86235a1 100644 --- a/tests/modules/services/emacs/linux/emacs-default-editor.nix +++ b/tests/modules/services/emacs/linux/emacs-default-editor.nix @@ -2,7 +2,7 @@ { nixpkgs.overlays = [ - (self: super: { + (_self: _super: { # Use `cat` instead of `echo` to prevent arguments from being # interpreted as an option. emacs = pkgs.writeShellScriptBin "emacsclient" ''${pkgs.coreutils}/bin/cat <<< "$*"''; diff --git a/tests/modules/services/emacs/linux/emacs-service-27.nix b/tests/modules/services/emacs/linux/emacs-service-27.nix index f28301a95363..5eb32793d888 100644 --- a/tests/modules/services/emacs/linux/emacs-service-27.nix +++ b/tests/modules/services/emacs/linux/emacs-service-27.nix @@ -2,7 +2,7 @@ { nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/emacs/linux/emacs-service-28-after-graphical-session-target.nix b/tests/modules/services/emacs/linux/emacs-service-28-after-graphical-session-target.nix index f5b3a6eda064..092a29cfff37 100644 --- a/tests/modules/services/emacs/linux/emacs-service-28-after-graphical-session-target.nix +++ b/tests/modules/services/emacs/linux/emacs-service-28-after-graphical-session-target.nix @@ -2,7 +2,7 @@ { nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-28.2" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/emacs/linux/emacs-service-28.nix b/tests/modules/services/emacs/linux/emacs-service-28.nix index d41d5d91ed38..a9b548db03c9 100644 --- a/tests/modules/services/emacs/linux/emacs-service-28.nix +++ b/tests/modules/services/emacs/linux/emacs-service-28.nix @@ -3,7 +3,7 @@ { config = { nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/emacs/linux/emacs-socket-27.nix b/tests/modules/services/emacs/linux/emacs-socket-27.nix index a99e78bb7df4..358f6b5644db 100644 --- a/tests/modules/services/emacs/linux/emacs-socket-27.nix +++ b/tests/modules/services/emacs/linux/emacs-socket-27.nix @@ -3,7 +3,7 @@ { config = { nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/emacs/linux/emacs-socket-28.nix b/tests/modules/services/emacs/linux/emacs-socket-28.nix index 1c94971f1a64..1c74c07206d2 100644 --- a/tests/modules/services/emacs/linux/emacs-socket-28.nix +++ b/tests/modules/services/emacs/linux/emacs-socket-28.nix @@ -3,7 +3,7 @@ { config = { nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/emacs/linux/emacs-socket-and-startWithUserSession.nix b/tests/modules/services/emacs/linux/emacs-socket-and-startWithUserSession.nix index 48b42b34c48a..dbcd5d16d2ef 100644 --- a/tests/modules/services/emacs/linux/emacs-socket-and-startWithUserSession.nix +++ b/tests/modules/services/emacs/linux/emacs-socket-and-startWithUserSession.nix @@ -8,7 +8,7 @@ }; nixpkgs.overlays = [ - (self: super: rec { + (_self: super: rec { emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; diff --git a/tests/modules/services/fusuma/fusuma-stubs.nix b/tests/modules/services/fusuma/fusuma-stubs.nix index b46a14a16607..a161afaac5b8 100644 --- a/tests/modules/services/fusuma/fusuma-stubs.nix +++ b/tests/modules/services/fusuma/fusuma-stubs.nix @@ -5,7 +5,7 @@ (_: super: { inherit (realPkgs) remarshal; python3Packages = super.python3Packages.overrideScope ( - self: super: { inherit (realPkgs.python3Packages) pyyaml; } + _self: _super: { inherit (realPkgs.python3Packages) pyyaml; } ); }) ]; diff --git a/tests/modules/services/i3/i3-followmouse.nix b/tests/modules/services/i3/i3-followmouse.nix index 021bc47840a5..176714469eee 100644 --- a/tests/modules/services/i3/i3-followmouse.nix +++ b/tests/modules/services/i3/i3-followmouse.nix @@ -6,7 +6,7 @@ }; nixpkgs.overlays = [ - (self: super: { + (_self: super: { dmenu = super.dmenu // { outPath = "@dmenu@"; }; diff --git a/tests/modules/services/podman-linux/podman-stubs.nix b/tests/modules/services/podman-linux/podman-stubs.nix index 70f3bfbc66ae..416affe707de 100644 --- a/tests/modules/services/podman-linux/podman-stubs.nix +++ b/tests/modules/services/podman-linux/podman-stubs.nix @@ -1,5 +1,5 @@ { realPkgs, ... }: { - nixpkgs.overlays = [ (self: super: { inherit (realPkgs) podman skopeo; }) ]; + nixpkgs.overlays = [ (_self: _super: { inherit (realPkgs) podman skopeo; }) ]; } diff --git a/tests/modules/services/sway/sway-check-config.nix b/tests/modules/services/sway/sway-check-config.nix index 71611ec8918c..88b44390ebe8 100644 --- a/tests/modules/services/sway/sway-check-config.nix +++ b/tests/modules/services/sway/sway-check-config.nix @@ -11,7 +11,7 @@ lib.mkIf config.test.enableBig { checkConfig = true; }; - nixpkgs.overlays = [ (self: super: { inherit (realPkgs) xvfb-run; }) ]; + nixpkgs.overlays = [ (_self: _super: { inherit (realPkgs) xvfb-run; }) ]; nmt.script = '' assertFileExists home-files/.config/sway/config diff --git a/tests/modules/services/syncthing/extra-options.nix b/tests/modules/services/syncthing/extra-options.nix index 5732b5776f60..8f80b6aa4d1e 100644 --- a/tests/modules/services/syncthing/extra-options.nix +++ b/tests/modules/services/syncthing/extra-options.nix @@ -3,7 +3,7 @@ lib.mkMerge [ { test.stubs.writers = { - extraAttrs.writeBash = (name: fn: "@syncthing-wrapper@"); + extraAttrs.writeBash = (_name: _fn: "@syncthing-wrapper@"); }; services.syncthing = { diff --git a/tests/stubs.nix b/tests/stubs.nix index 00c26644e02f..24158c2c3855 100644 --- a/tests/stubs.nix +++ b/tests/stubs.nix @@ -109,7 +109,7 @@ in test.stubOverlays = lib.optional (config.test.stubs != { }) ( - self: super: + _self: super: lib.mapAttrs ( n: v: builtins.traceVerbose "${n} - stubbed" ( diff --git a/treefmt.toml b/treefmt.toml index cab0579db50e..365fa5dc376e 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -7,7 +7,7 @@ includes = [ "*.nix" ] [formatter.deadnix] command = "deadnix" -options = [ "--edit", "--no-lambda-arg", "--no-lambda-pattern-names" ] +options = [ "--edit", "--no-lambda-pattern-names" ] includes = [ "*.nix" ] [formatter.keep-sorted] From 18ace0e93b81138ce2e166d8cfd4a2525a0aad0a Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Sun, 26 Oct 2025 22:29:55 +0100 Subject: [PATCH 2/5] treewide: remove unused attrs patterns --- modules/launchd/default.nix | 2 +- modules/lib/booleans.nix | 1 - modules/lib/default.nix | 2 +- modules/programs/aerc/accounts.nix | 1 - modules/programs/docker-cli.nix | 2 +- modules/programs/firefoxpwa.nix | 2 +- modules/programs/obsidian.nix | 4 +-- modules/services/activitywatch.nix | 2 -- modules/services/mopidy.nix | 1 - modules/services/radicle.nix | 1 - modules/services/recoll.nix | 1 - modules/services/window-managers/hyprland.nix | 31 +++++++++---------- .../window-managers/i3-sway/lib/functions.nix | 2 +- modules/targets/darwin/default.nix | 2 -- .../standalone/alice-home-init.nix | 2 -- .../standalone/home-with-symbols-init.nix | 2 -- tests/modules/config/i18n/default.nix | 2 +- tests/modules/misc/gtk/gtk-colorscheme.nix | 1 - tests/modules/misc/xdg/user-dirs-null.nix | 1 - tests/modules/programs/algia/settings.nix | 7 ----- tests/modules/programs/fish/abbrs.nix | 1 - .../modules/programs/fish/format-scripts.nix | 2 +- tests/modules/programs/go/old-options.nix | 1 - .../modules/programs/go/suboptions-unset.nix | 2 +- .../programs/i3status-rust/with-custom.nix | 1 - .../programs/i3status-rust/with-default.nix | 1 - .../i3status-rust/with-extra-settings.nix | 1 - .../i3status-rust/with-multiple-bars.nix | 1 - .../i3status-rust/with-version-02xx.nix | 1 - .../programs/jjui/example-settings.nix | 1 - tests/modules/programs/jjui/null-package.nix | 1 - .../example-quickAccessTerminalConfig.nix | 1 - .../programs/mods/basic-configuration.nix | 2 +- .../programs/mpv/mpv-example-settings.nix | 5 --- .../programs/radicle/basic-configuration.nix | 2 -- tests/modules/programs/ssh/includes.nix | 5 --- .../programs/tex-fmt/custom-settings.nix | 2 +- .../programs/tex-fmt/default-settings.nix | 2 +- .../programs/vesktop/basic-configuration.nix | 2 -- .../services/caffeine/basic-service.nix | 2 -- .../services/fnott/example-settings.nix | 1 - .../services/fnott/systemd-user-service.nix | 1 - .../services/gnome-keyring/basic-service.nix | 2 -- .../gnome-keyring/custom-components.nix | 2 -- .../basic-configuration.nix | 2 -- .../services/hyprland/submaps-config.nix | 2 -- tests/modules/services/playerctld/basic.nix | 2 +- treefmt.toml | 2 +- 48 files changed, 30 insertions(+), 89 deletions(-) diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index 90eb6be3616c..c161dc6ca36b 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -14,7 +14,7 @@ let dstDir = "${config.home.homeDirectory}/Library/LaunchAgents"; launchdConfig = - { config, name, ... }: + { name, ... }: { options = { enable = lib.mkEnableOption name; diff --git a/modules/lib/booleans.nix b/modules/lib/booleans.nix index fd3aa3a3e887..e9c51bc4328c 100644 --- a/modules/lib/booleans.nix +++ b/modules/lib/booleans.nix @@ -1,4 +1,3 @@ -{ lib }: { # Converts a boolean to a yes/no string. This is used in lots of # configuration formats. diff --git a/modules/lib/default.nix b/modules/lib/default.nix index 7adc7198706f..ed829c756dde 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -5,7 +5,7 @@ rec { assertions = import ./assertions.nix { inherit lib; }; - booleans = import ./booleans.nix { inherit lib; }; + booleans = import ./booleans.nix; darwin = import ./darwin.nix { inherit lib; }; deprecations = import ./deprecations.nix { inherit lib; }; generators = import ./generators.nix { inherit lib; }; diff --git a/modules/programs/aerc/accounts.nix b/modules/programs/aerc/accounts.nix index 923f073fbd65..a7dfa75ecc97 100644 --- a/modules/programs/aerc/accounts.nix +++ b/modules/programs/aerc/accounts.nix @@ -188,7 +188,6 @@ in userName, imap, passwordCommand, - aerc, ... }@cfg: let diff --git a/modules/programs/docker-cli.nix b/modules/programs/docker-cli.nix index ce17e0f705f6..b0c8186e5abe 100644 --- a/modules/programs/docker-cli.nix +++ b/modules/programs/docker-cli.nix @@ -35,7 +35,7 @@ in contexts = mkOption { type = lib.types.attrsOf ( lib.types.submodule ( - { name, config, ... }: + { name, ... }: { freeformType = jsonFormat.type; options = { diff --git a/modules/programs/firefoxpwa.nix b/modules/programs/firefoxpwa.nix index ec12848f1376..27d8c37081fe 100644 --- a/modules/programs/firefoxpwa.nix +++ b/modules/programs/firefoxpwa.nix @@ -16,7 +16,7 @@ let mkUlidAssertions = path: lib.concatMap ( - { name, value }: + { name, ... }: let length = 26; allowed = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; diff --git a/modules/programs/obsidian.nix b/modules/programs/obsidian.nix index 5be87ff75d1b..0af9d3d88080 100644 --- a/modules/programs/obsidian.nix +++ b/modules/programs/obsidian.nix @@ -157,7 +157,7 @@ in description = "List of vaults to create."; type = types.attrsOf ( types.submodule ( - { name, config, ... }: + { name, ... }: { options = { enable = mkOption { @@ -345,7 +345,7 @@ in extraFiles = let extraFilesOptions = - { name, config, ... }: + { name, ... }: { options = { source = mkOption { diff --git a/modules/services/activitywatch.nix b/modules/services/activitywatch.nix index dd192926e301..42389cff9b5c 100644 --- a/modules/services/activitywatch.nix +++ b/modules/services/activitywatch.nix @@ -1,6 +1,5 @@ { config, - options, lib, pkgs, ... @@ -46,7 +45,6 @@ let { name, config, - options, ... }: { diff --git a/modules/services/mopidy.nix b/modules/services/mopidy.nix index 875b2d571b6b..8e343e7f5acb 100644 --- a/modules/services/mopidy.nix +++ b/modules/services/mopidy.nix @@ -1,6 +1,5 @@ { config, - options, lib, pkgs, ... diff --git a/modules/services/radicle.nix b/modules/services/radicle.nix index 511382761ea4..319483521e46 100644 --- a/modules/services/radicle.nix +++ b/modules/services/radicle.nix @@ -2,7 +2,6 @@ config, lib, pkgs, - options, ... }: let diff --git a/modules/services/recoll.nix b/modules/services/recoll.nix index 37a0cb5196d9..c82a54ecf0c7 100644 --- a/modules/services/recoll.nix +++ b/modules/services/recoll.nix @@ -1,6 +1,5 @@ { config, - options, lib, pkgs, ... diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 9d2ac5553d94..819660c0b1c6 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -224,19 +224,18 @@ in ''; default = { }; type = lib.types.attrsOf ( - lib.types.submodule ( - { name, config, ... }: - { - options = { - settings = lib.mkOption { - type = (with lib.types; attrsOf (listOf str)) // { - description = "Hyprland binds"; - }; - default = { }; - description = '' + lib.types.submodule + { + options = { + settings = lib.mkOption { + type = (with lib.types; attrsOf (listOf str)) // { + description = "Hyprland binds"; + }; + default = { }; + description = '' Hyprland binds to be put in the submap - ''; - example = lib.literalExpression '' + ''; + example = lib.literalExpression '' { binde = [ ", right, resizeactive, 10 0" @@ -249,11 +248,11 @@ in ", escape, submap, reset" ]; } - ''; - }; + ''; }; - } - ) + }; + } + ); example = lib.literalExpression '' { diff --git a/modules/services/window-managers/i3-sway/lib/functions.nix b/modules/services/window-managers/i3-sway/lib/functions.nix index 01e043701065..ea0eef5f25ec 100644 --- a/modules/services/window-managers/i3-sway/lib/functions.nix +++ b/modules/services/window-managers/i3-sway/lib/functions.nix @@ -1,8 +1,8 @@ { cfg, - config, lib, moduleName, + ... }: let inherit (lib) concatStringsSep mapAttrsToList optionalString; diff --git a/modules/targets/darwin/default.nix b/modules/targets/darwin/default.nix index 6f551e04b1f7..f13dd9e9130e 100644 --- a/modules/targets/darwin/default.nix +++ b/modules/targets/darwin/default.nix @@ -1,7 +1,5 @@ { - config, lib, - pkgs, ... }: diff --git a/tests/integration/standalone/alice-home-init.nix b/tests/integration/standalone/alice-home-init.nix index 6a21e324ddf8..946ddd4f891d 100644 --- a/tests/integration/standalone/alice-home-init.nix +++ b/tests/integration/standalone/alice-home-init.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { # Home Manager needs a bit of information about you and the paths it should # manage. diff --git a/tests/integration/standalone/home-with-symbols-init.nix b/tests/integration/standalone/home-with-symbols-init.nix index 0574a4f03ea4..5506041fcaf5 100644 --- a/tests/integration/standalone/home-with-symbols-init.nix +++ b/tests/integration/standalone/home-with-symbols-init.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { # Home Manager needs a bit of information about you and the paths it should # manage. diff --git a/tests/modules/config/i18n/default.nix b/tests/modules/config/i18n/default.nix index 69cf5b41362a..b52ff6c22245 100644 --- a/tests/modules/config/i18n/default.nix +++ b/tests/modules/config/i18n/default.nix @@ -16,7 +16,7 @@ }; i18n-custom-locales = - { config, pkgs, ... }: + { pkgs, ... }: { config = let diff --git a/tests/modules/misc/gtk/gtk-colorscheme.nix b/tests/modules/misc/gtk/gtk-colorscheme.nix index c35c604d8ae2..aca8fa86f40c 100644 --- a/tests/modules/misc/gtk/gtk-colorscheme.nix +++ b/tests/modules/misc/gtk/gtk-colorscheme.nix @@ -1,4 +1,3 @@ -{ pkgs, ... }: { gtk = { enable = true; diff --git a/tests/modules/misc/xdg/user-dirs-null.nix b/tests/modules/misc/xdg/user-dirs-null.nix index 9fd878d5cd94..5d36582f5e7e 100644 --- a/tests/modules/misc/xdg/user-dirs-null.nix +++ b/tests/modules/misc/xdg/user-dirs-null.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/algia/settings.nix b/tests/modules/programs/algia/settings.nix index 93068c173376..1b0c20d5cc40 100644 --- a/tests/modules/programs/algia/settings.nix +++ b/tests/modules/programs/algia/settings.nix @@ -1,10 +1,3 @@ -{ - lib, - pkgs, - config, - ... -}: - { programs.algia = { enable = true; diff --git a/tests/modules/programs/fish/abbrs.nix b/tests/modules/programs/fish/abbrs.nix index 030d65c3e34d..1df452f6816e 100644 --- a/tests/modules/programs/fish/abbrs.nix +++ b/tests/modules/programs/fish/abbrs.nix @@ -1,4 +1,3 @@ -{ config, ... }: { config = { programs.fish = { diff --git a/tests/modules/programs/fish/format-scripts.nix b/tests/modules/programs/fish/format-scripts.nix index 310987fb543b..cbb0a9d29590 100644 --- a/tests/modules/programs/fish/format-scripts.nix +++ b/tests/modules/programs/fish/format-scripts.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: let diff --git a/tests/modules/programs/go/old-options.nix b/tests/modules/programs/go/old-options.nix index d8007efa1a2f..23e1a4b9e099 100644 --- a/tests/modules/programs/go/old-options.nix +++ b/tests/modules/programs/go/old-options.nix @@ -2,7 +2,6 @@ lib, options, pkgs, - config, ... }: diff --git a/tests/modules/programs/go/suboptions-unset.nix b/tests/modules/programs/go/suboptions-unset.nix index 83ca58509c14..2703c0144f97 100644 --- a/tests/modules/programs/go/suboptions-unset.nix +++ b/tests/modules/programs/go/suboptions-unset.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { programs.go = { diff --git a/tests/modules/programs/i3status-rust/with-custom.nix b/tests/modules/programs/i3status-rust/with-custom.nix index 4c80014b8b51..e76ec77a6ef7 100644 --- a/tests/modules/programs/i3status-rust/with-custom.nix +++ b/tests/modules/programs/i3status-rust/with-custom.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/i3status-rust/with-default.nix b/tests/modules/programs/i3status-rust/with-default.nix index ba9f26c81375..64146f11c165 100644 --- a/tests/modules/programs/i3status-rust/with-default.nix +++ b/tests/modules/programs/i3status-rust/with-default.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/i3status-rust/with-extra-settings.nix b/tests/modules/programs/i3status-rust/with-extra-settings.nix index d098aae6217e..5ac2ea555f64 100644 --- a/tests/modules/programs/i3status-rust/with-extra-settings.nix +++ b/tests/modules/programs/i3status-rust/with-extra-settings.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/i3status-rust/with-multiple-bars.nix b/tests/modules/programs/i3status-rust/with-multiple-bars.nix index 9198c1bdd421..a24ce5f3751a 100644 --- a/tests/modules/programs/i3status-rust/with-multiple-bars.nix +++ b/tests/modules/programs/i3status-rust/with-multiple-bars.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/i3status-rust/with-version-02xx.nix b/tests/modules/programs/i3status-rust/with-version-02xx.nix index 8ca1cb5547f3..1c0ec46abf0a 100644 --- a/tests/modules/programs/i3status-rust/with-version-02xx.nix +++ b/tests/modules/programs/i3status-rust/with-version-02xx.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/jjui/example-settings.nix b/tests/modules/programs/jjui/example-settings.nix index 30598f0716ca..8cc67bc0bd80 100644 --- a/tests/modules/programs/jjui/example-settings.nix +++ b/tests/modules/programs/jjui/example-settings.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/jjui/null-package.nix b/tests/modules/programs/jjui/null-package.nix index 4fa1e57804ac..0a5ccd98e4b9 100644 --- a/tests/modules/programs/jjui/null-package.nix +++ b/tests/modules/programs/jjui/null-package.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: diff --git a/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix b/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix index ef47b8aa85f7..3069a396cd67 100644 --- a/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix +++ b/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix @@ -1,4 +1,3 @@ -{ lib, pkgs, ... }: { config = { programs.kitty = { diff --git a/tests/modules/programs/mods/basic-configuration.nix b/tests/modules/programs/mods/basic-configuration.nix index 5ed807b7826a..c84ac030cc8d 100644 --- a/tests/modules/programs/mods/basic-configuration.nix +++ b/tests/modules/programs/mods/basic-configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { config = { programs.mods = { diff --git a/tests/modules/programs/mpv/mpv-example-settings.nix b/tests/modules/programs/mpv/mpv-example-settings.nix index 269788d66a33..813aaaf72a6e 100644 --- a/tests/modules/programs/mpv/mpv-example-settings.nix +++ b/tests/modules/programs/mpv/mpv-example-settings.nix @@ -1,8 +1,3 @@ -{ - config, - ... -}: - { programs.mpv = { enable = true; diff --git a/tests/modules/programs/radicle/basic-configuration.nix b/tests/modules/programs/radicle/basic-configuration.nix index 378cb844997b..5edc72d1e684 100644 --- a/tests/modules/programs/radicle/basic-configuration.nix +++ b/tests/modules/programs/radicle/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { config = { programs.radicle.enable = true; diff --git a/tests/modules/programs/ssh/includes.nix b/tests/modules/programs/ssh/includes.nix index ff1f983d05f0..b6a20f7ebbb8 100644 --- a/tests/modules/programs/ssh/includes.nix +++ b/tests/modules/programs/ssh/includes.nix @@ -1,8 +1,3 @@ -{ - config, - ... -}: - { config = { programs.ssh = { diff --git a/tests/modules/programs/tex-fmt/custom-settings.nix b/tests/modules/programs/tex-fmt/custom-settings.nix index e7e1d9802b6f..b5647761f2e9 100644 --- a/tests/modules/programs/tex-fmt/custom-settings.nix +++ b/tests/modules/programs/tex-fmt/custom-settings.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { config = { programs.tex-fmt = { diff --git a/tests/modules/programs/tex-fmt/default-settings.nix b/tests/modules/programs/tex-fmt/default-settings.nix index 971e6da2f423..a17cd403f343 100644 --- a/tests/modules/programs/tex-fmt/default-settings.nix +++ b/tests/modules/programs/tex-fmt/default-settings.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { config = { programs.tex-fmt = { diff --git a/tests/modules/programs/vesktop/basic-configuration.nix b/tests/modules/programs/vesktop/basic-configuration.nix index 3a01cac4a63a..6737678ca082 100644 --- a/tests/modules/programs/vesktop/basic-configuration.nix +++ b/tests/modules/programs/vesktop/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { config = { programs.vesktop = { diff --git a/tests/modules/services/caffeine/basic-service.nix b/tests/modules/services/caffeine/basic-service.nix index 06ae0a4b09e6..4b7e55a3b92b 100644 --- a/tests/modules/services/caffeine/basic-service.nix +++ b/tests/modules/services/caffeine/basic-service.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { config = { services.caffeine = { diff --git a/tests/modules/services/fnott/example-settings.nix b/tests/modules/services/fnott/example-settings.nix index dca76ae050b8..982764080b94 100644 --- a/tests/modules/services/fnott/example-settings.nix +++ b/tests/modules/services/fnott/example-settings.nix @@ -1,6 +1,5 @@ { config, - lib, ... }: diff --git a/tests/modules/services/fnott/systemd-user-service.nix b/tests/modules/services/fnott/systemd-user-service.nix index a2117d827703..e36c505838e8 100644 --- a/tests/modules/services/fnott/systemd-user-service.nix +++ b/tests/modules/services/fnott/systemd-user-service.nix @@ -1,6 +1,5 @@ { config, - lib, ... }: diff --git a/tests/modules/services/gnome-keyring/basic-service.nix b/tests/modules/services/gnome-keyring/basic-service.nix index 805ea1e92711..12a9374fb022 100644 --- a/tests/modules/services/gnome-keyring/basic-service.nix +++ b/tests/modules/services/gnome-keyring/basic-service.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { config = { services.gnome-keyring = { diff --git a/tests/modules/services/gnome-keyring/custom-components.nix b/tests/modules/services/gnome-keyring/custom-components.nix index 1fd202d574b7..fbf76c0bffe2 100644 --- a/tests/modules/services/gnome-keyring/custom-components.nix +++ b/tests/modules/services/gnome-keyring/custom-components.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { config = { services.gnome-keyring = { diff --git a/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix b/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix index 444c88624fa3..2f12bd64e54b 100644 --- a/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix +++ b/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { config = { services.home-manager.autoUpgrade = { diff --git a/tests/modules/services/hyprland/submaps-config.nix b/tests/modules/services/hyprland/submaps-config.nix index af54671c4c41..dacf85ce1e46 100644 --- a/tests/modules/services/hyprland/submaps-config.nix +++ b/tests/modules/services/hyprland/submaps-config.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { wayland.windowManager.hyprland = { enable = true; diff --git a/tests/modules/services/playerctld/basic.nix b/tests/modules/services/playerctld/basic.nix index ea492531ae16..c8cba4a984e4 100644 --- a/tests/modules/services/playerctld/basic.nix +++ b/tests/modules/services/playerctld/basic.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { config = { diff --git a/treefmt.toml b/treefmt.toml index 365fa5dc376e..8ac241ffe7af 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -7,7 +7,7 @@ includes = [ "*.nix" ] [formatter.deadnix] command = "deadnix" -options = [ "--edit", "--no-lambda-pattern-names" ] +options = [ "--edit" ] includes = [ "*.nix" ] [formatter.keep-sorted] From e8b4c763c11341bf27c542884ec2fbfdc7a375be Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Sun, 26 Oct 2025 22:44:13 +0100 Subject: [PATCH 3/5] treewide: remove redundant `config = { ... }` wrapping --- modules/i18n/input-method/hime.nix | 29 +- modules/i18n/input-method/nabi.nix | 29 +- modules/services/window-managers/hyprland.nix | 29 +- tests/modules/launchd/agents.nix | 42 +- .../fontconfig/multiple-font-packages.nix | 18 +- tests/modules/misc/pam/session-variables.nix | 22 +- tests/modules/misc/pam/yubico-no-ids.nix | 8 +- tests/modules/misc/pam/yubico-with-ids.nix | 22 +- tests/modules/misc/xdg/default-locations.nix | 52 +- tests/modules/misc/xdg/desktop-entries.nix | 166 +++--- tests/modules/misc/xdg/file-gen.nix | 54 +- tests/modules/misc/xdg/mime-disabled.nix | 14 +- tests/modules/misc/xdg/mime-packages.nix | 58 +- tests/modules/misc/xdg/system-dirs.nix | 58 +- tests/modules/misc/xdg/user-dirs-null.nix | 36 +- tests/modules/misc/xsession/basic.nix | 60 +- .../misc/xsession/keyboard-without-layout.nix | 58 +- tests/modules/programs/abook/no-settings.nix | 10 +- .../modules/programs/abook/with-settings.nix | 44 +- tests/modules/programs/aerc/assertion.nix | 90 ++- tests/modules/programs/aerc/noSettings.nix | 24 +- tests/modules/programs/aerc/oauth.nix | 62 +- tests/modules/programs/aerc/settings.nix | 540 +++++++++--------- .../bash/bash-history-control-with-file.nix | 22 +- .../programs/bottom/empty-settings.nix | 16 +- .../programs/bottom/example-settings.nix | 34 +- .../modules/programs/boxxy/empty-settings.nix | 10 +- .../programs/boxxy/example-settings.nix | 46 +- .../programs/clock-rs/empty-settings.nix | 28 +- .../programs/clock-rs/example-settings.nix | 66 ++- tests/modules/programs/darcs/author.nix | 22 +- tests/modules/programs/darcs/boring.nix | 24 +- tests/modules/programs/dircolors/settings.nix | 66 ++- .../dircolors/xdg-config-settings.nix | 68 ++- .../programs/discocss/basic-configuration.nix | 50 +- tests/modules/programs/discocss/no-css.nix | 16 +- .../modules/programs/discocss/no-packages.nix | 52 +- tests/modules/programs/eww/basic-config.nix | 20 +- tests/modules/programs/eww/null-config.nix | 16 +- tests/modules/programs/fish/abbrs.nix | 156 +++-- tests/modules/programs/fish/binds.nix | 82 ++- .../modules/programs/fish/format-scripts.nix | 48 +- tests/modules/programs/fish/functions.nix | 48 +- tests/modules/programs/fish/manpage.nix | 20 +- tests/modules/programs/fish/no-functions.nix | 28 +- tests/modules/programs/fish/plugins.nix | 44 +- .../programs/gcc/basic-configuration.nix | 18 +- tests/modules/programs/gcc/with-colors.nix | 32 +- .../git/git-with-signing-key-id-legacy.nix | 40 +- .../programs/gpg/override-defaults.nix | 38 +- .../programs/grep/basic-configuration.nix | 18 +- tests/modules/programs/grep/with-colors.nix | 24 +- .../programs/htop/example-settings.nix | 94 ++- .../programs/htop/settings-without-fields.nix | 47 +- .../programs/hyprshot/basic-configuration.nix | 18 +- .../programs/i3blocks/with-ordered-blocks.nix | 74 ++- .../programs/i3status-rust/with-custom.nix | 384 +++++++------ .../programs/i3status-rust/with-default.nix | 98 ++-- .../i3status-rust/with-extra-settings.nix | 406 +++++++------ .../i3status-rust/with-multiple-bars.nix | 172 +++--- .../i3status-rust/with-version-02xx.nix | 90 ++- .../programs/imv/basic-configuration.nix | 26 +- .../programs/imv/empty-configuration.nix | 16 +- .../modules/programs/inori/default-config.nix | 10 +- tests/modules/programs/inori/full-config.nix | 102 ++-- .../modules/programs/jjui/empty-settings.nix | 10 +- .../programs/jjui/example-settings.nix | 34 +- tests/modules/programs/jjui/null-package.nix | 38 +- .../programs/kitty/example-mkOrder.nix | 82 ++- .../example-quickAccessTerminalConfig.nix | 28 +- .../programs/kitty/example-settings.nix | 76 ++- .../programs/kitty/null-shellIntegration.nix | 24 +- .../looking-glass-client/empty-settings.nix | 16 +- .../looking-glass-client/example-settings.nix | 54 +- tests/modules/programs/man/apropos.nix | 20 +- tests/modules/programs/man/no-manpath.nix | 14 +- .../programs/mangohud/basic-configuration.nix | 78 ++- .../programs/mise/default-settings.nix | 18 +- .../programs/mods/basic-configuration.nix | 34 +- .../programs/radicle/basic-configuration.nix | 14 +- .../programs/readline/using-all-options.nix | 42 +- .../programs/ripgrep-all/custom-arguments.nix | 98 ++-- .../ripgrep-all/default-arguments.nix | 18 +- .../programs/ripgrep/custom-arguments.nix | 36 +- .../programs/ripgrep/default-arguments.nix | 16 +- tests/modules/programs/sbt/credentials.nix | 20 +- tests/modules/programs/sbt/plugins.nix | 22 +- tests/modules/programs/sbt/repositories.nix | 20 +- .../modules/programs/sbt/user-config-path.nix | 28 +- .../programs/senpai/empty-settings.nix | 26 +- .../programs/senpai/example-settings.nix | 62 +- .../programs/sesh/basic-configuration.nix | 50 +- tests/modules/programs/sheldon/default.nix | 30 +- ...ds-dynamic-bind-path-with-port-asserts.nix | 30 +- ...forwards-dynamic-valid-bind-no-asserts.nix | 64 +-- ...ards-local-bind-path-with-port-asserts.nix | 36 +- ...ards-local-host-path-with-port-asserts.nix | 36 +- ...rds-remote-bind-path-with-port-asserts.nix | 36 +- ...rds-remote-host-path-with-port-asserts.nix | 36 +- tests/modules/programs/ssh/includes.nix | 26 +- .../programs/ssh/match-blocks-attrs.nix | 108 ++-- .../ssh/match-blocks-match-and-hosts.nix | 50 +- .../programs/swayr/basic-configuration.nix | 226 ++++---- .../programs/swayr/empty-configuration.nix | 26 +- .../programs/tealdeer/custom-settings.nix | 54 +- .../programs/tealdeer/default-settings.nix | 26 +- .../programs/tex-fmt/custom-settings.nix | 46 +- .../programs/tex-fmt/default-settings.nix | 24 +- .../programs/texlive/texlive-minimal.nix | 38 +- tests/modules/programs/tmux/default-shell.nix | 18 +- .../tmux/disable-confirmation-prompt.nix | 36 +- .../programs/tmux/emacs-with-plugins.nix | 70 ++- tests/modules/programs/tmux/mouse-enabled.nix | 36 +- tests/modules/programs/tmux/not-enabled.nix | 14 +- tests/modules/programs/tmux/prefix.nix | 36 +- .../programs/tmux/secure-socket-enabled.nix | 20 +- .../programs/tmux/shortcut-without-prefix.nix | 38 +- tests/modules/programs/tmux/vi-all-true.nix | 42 +- .../programs/vesktop/basic-configuration.nix | 96 ++-- .../waybar/deprecated-modules-option.nix | 70 ++- .../programs/waybar/settings-complex.nix | 140 +++-- .../programs/waybar/settings-with-attrs.nix | 46 +- tests/modules/programs/waybar/styling.nix | 72 ++- .../systemd-with-graphical-session-target.nix | 28 +- .../programs/wleave/layout-multiple.nix | 112 ++-- .../modules/programs/wleave/layout-single.nix | 40 +- tests/modules/programs/wleave/styling.nix | 58 +- .../programs/wlogout/layout-multiple.nix | 106 ++-- .../programs/wlogout/layout-single.nix | 40 +- tests/modules/programs/wlogout/styling.nix | 58 +- .../programs/wofi/basic-configuration.nix | 54 +- .../programs/wofi/empty-configuration.nix | 18 +- .../programs/xmobar/basic-configuration.nix | 62 +- tests/modules/programs/zsh/dotdir.nix | 98 ++-- tests/modules/programs/zsh/history-path.nix | 64 +-- tests/modules/programs/zsh/plugins.nix | 78 ++- tests/modules/programs/zsh/zprof.nix | 20 +- .../modules/services/arrpc/custom-target.nix | 20 +- .../services/caffeine/basic-service.nix | 18 +- .../services/dropbox/basic-configuration.nix | 18 +- .../services/emacs/linux/emacs-service-28.nix | 76 ++- .../services/emacs/linux/emacs-socket-27.nix | 90 ++- .../services/emacs/linux/emacs-socket-28.nix | 84 ++- .../services/fnott/example-settings.nix | 36 +- .../services/fnott/systemd-user-service.nix | 26 +- .../services/gnome-keyring/basic-service.nix | 18 +- .../gnome-keyring/custom-components.nix | 28 +- .../linux/basic-configuration.nix | 26 +- .../basic-configuration.nix | 22 +- .../services/kanshi/alias-assertion.nix | 36 +- .../services/kanshi/basic-configuration.nix | 126 ++-- .../services/kanshi/new-configuration.nix | 130 +++-- .../pantalaimon/basic-configuration.nix | 38 +- .../modules/services/pizauth/basic-config.nix | 140 +++-- tests/modules/services/playerctld/basic.nix | 38 +- .../services/polybar/basic-configuration.nix | 102 ++-- .../services/polybar/empty-configuration.nix | 26 +- .../services/shikane/basic-configuration.nix | 80 ++- .../services/tldr-update/tldr-update.nix | 26 +- .../services/trayer/basic-configuration.nix | 38 +- .../services/way-displays/configuration.nix | 72 ++- .../services/wlsunset/wlsunset-service.nix | 32 +- .../xsettingsd/basic-configuration.nix | 36 +- tests/modules/targets-darwin/darwin.nix | 10 +- .../modules/targets-darwin/user-defaults.nix | 22 +- tests/modules/targets-linux/generic-linux.nix | 36 +- 166 files changed, 4384 insertions(+), 4720 deletions(-) diff --git a/modules/i18n/input-method/hime.nix b/modules/i18n/input-method/hime.nix index f8b743e31ee9..c2bb7910ad8f 100644 --- a/modules/i18n/input-method/hime.nix +++ b/modules/i18n/input-method/hime.nix @@ -7,24 +7,21 @@ let im = config.i18n.inputMethod; in -{ - config = lib.mkIf (im.enable && im.type == "hime") { - i18n.inputMethod.package = pkgs.hime; +lib.mkIf (im.enable && im.type == "hime") { + i18n.inputMethod.package = pkgs.hime; - home.sessionVariables = { - GTK_IM_MODULE = "hime"; - QT_IM_MODULE = "hime"; - XMODIFIERS = "@im=hime"; - }; + home.sessionVariables = { + GTK_IM_MODULE = "hime"; + QT_IM_MODULE = "hime"; + XMODIFIERS = "@im=hime"; + }; - systemd.user.services.hime-daemon = { - Unit = { - Description = "Hime input method editor"; - PartOf = [ "graphical-session.desktop" ]; - }; - Service.ExecStart = "${pkgs.hime}/bin/hime"; - Install.WantedBy = [ "graphical-session.target" ]; + systemd.user.services.hime-daemon = { + Unit = { + Description = "Hime input method editor"; + PartOf = [ "graphical-session.desktop" ]; }; + Service.ExecStart = "${pkgs.hime}/bin/hime"; + Install.WantedBy = [ "graphical-session.target" ]; }; - } diff --git a/modules/i18n/input-method/nabi.nix b/modules/i18n/input-method/nabi.nix index d96423590afd..6767e627ea7c 100644 --- a/modules/i18n/input-method/nabi.nix +++ b/modules/i18n/input-method/nabi.nix @@ -7,24 +7,21 @@ let im = config.i18n.inputMethod; in -{ - config = lib.mkIf (im.enable && im.type == "nabi") { - i18n.inputMethod.package = pkgs.nabi; +lib.mkIf (im.enable && im.type == "nabi") { + i18n.inputMethod.package = pkgs.nabi; - home.sessionVariables = { - GTK_IM_MODULE = "nabi"; - QT_IM_MODULE = "nabi"; - XMODIFIERS = "@im=nabi"; - }; + home.sessionVariables = { + GTK_IM_MODULE = "nabi"; + QT_IM_MODULE = "nabi"; + XMODIFIERS = "@im=nabi"; + }; - systemd.user.services.nabi-daemon = { - Unit = { - Description = "Nabi input method editor"; - PartOf = [ "graphical-session.desktop" ]; - }; - Service.ExecStart = "${pkgs.nabi}/bin/nabi"; - Install.WantedBy = [ "graphical-session.target" ]; + systemd.user.services.nabi-daemon = { + Unit = { + Description = "Nabi input method editor"; + PartOf = [ "graphical-session.desktop" ]; }; + Service.ExecStart = "${pkgs.nabi}/bin/nabi"; + Install.WantedBy = [ "graphical-session.target" ]; }; - } diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 819660c0b1c6..96f8876bffdb 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -224,8 +224,7 @@ in ''; default = { }; type = lib.types.attrsOf ( - lib.types.submodule - { + lib.types.submodule { options = { settings = lib.mkOption { type = (with lib.types; attrsOf (listOf str)) // { @@ -233,21 +232,21 @@ in }; default = { }; description = '' - Hyprland binds to be put in the submap + Hyprland binds to be put in the submap ''; example = lib.literalExpression '' - { - binde = [ - ", right, resizeactive, 10 0" - ", left, resizeactive, -10 0" - ", up, resizeactive, 0 -10" - ", down, resizeactive, 0 10" - ]; - - bind = [ - ", escape, submap, reset" - ]; - } + { + binde = [ + ", right, resizeactive, 10 0" + ", left, resizeactive, -10 0" + ", up, resizeactive, 0 -10" + ", down, resizeactive, 0 10" + ]; + + bind = [ + ", escape, submap, reset" + ]; + } ''; }; }; diff --git a/tests/modules/launchd/agents.nix b/tests/modules/launchd/agents.nix index 76e6fa65e754..b237b67ec32c 100644 --- a/tests/modules/launchd/agents.nix +++ b/tests/modules/launchd/agents.nix @@ -1,27 +1,25 @@ { - config = { - launchd.agents."test-service" = { - enable = true; - config = { - ProgramArguments = [ - "/some/command" - "--with-arguments" - "foo" - ]; - KeepAlive = { - Crashed = true; - SuccessfulExit = false; - }; - ProcessType = "Background"; - UnrecognizedByHomeManager = "should make it to the resulting plist"; - "\"Special\" characters" = ""; + launchd.agents."test-service" = { + enable = true; + config = { + ProgramArguments = [ + "/some/command" + "--with-arguments" + "foo" + ]; + KeepAlive = { + Crashed = true; + SuccessfulExit = false; }; + ProcessType = "Background"; + UnrecognizedByHomeManager = "should make it to the resulting plist"; + "\"Special\" characters" = ""; }; - - nmt.script = '' - serviceFile=LaunchAgents/org.nix-community.home.test-service.plist - assertFileExists $serviceFile - assertFileContent $serviceFile ${./expected-agent.plist} - ''; }; + + nmt.script = '' + serviceFile=LaunchAgents/org.nix-community.home.test-service.plist + assertFileExists $serviceFile + assertFileContent $serviceFile ${./expected-agent.plist} + ''; } diff --git a/tests/modules/misc/fontconfig/multiple-font-packages.nix b/tests/modules/misc/fontconfig/multiple-font-packages.nix index 9c47e5683ca9..26049830a17d 100644 --- a/tests/modules/misc/fontconfig/multiple-font-packages.nix +++ b/tests/modules/misc/fontconfig/multiple-font-packages.nix @@ -1,15 +1,13 @@ { pkgs, ... }: { - config = { - home.packages = [ - pkgs.comic-relief - pkgs.unifont - ]; + home.packages = [ + pkgs.comic-relief + pkgs.unifont + ]; - fonts.fontconfig.enable = true; + fonts.fontconfig.enable = true; - nmt.script = '' - assertDirectoryNotEmpty home-path/lib/fontconfig/cache - ''; - }; + nmt.script = '' + assertDirectoryNotEmpty home-path/lib/fontconfig/cache + ''; } diff --git a/tests/modules/misc/pam/session-variables.nix b/tests/modules/misc/pam/session-variables.nix index dd4f7cdbbb85..18cfbd0f9322 100644 --- a/tests/modules/misc/pam/session-variables.nix +++ b/tests/modules/misc/pam/session-variables.nix @@ -1,16 +1,14 @@ { config, ... }: { - config = { - pam.sessionVariables = { - V1 = "v1"; - V2 = "v2-${config.pam.sessionVariables.V1}"; - }; - - nmt.script = '' - assertFileExists home-files/.pam_environment - assertFileContent \ - home-files/.pam_environment \ - ${./session-variables-expected.txt} - ''; + pam.sessionVariables = { + V1 = "v1"; + V2 = "v2-${config.pam.sessionVariables.V1}"; }; + + nmt.script = '' + assertFileExists home-files/.pam_environment + assertFileContent \ + home-files/.pam_environment \ + ${./session-variables-expected.txt} + ''; } diff --git a/tests/modules/misc/pam/yubico-no-ids.nix b/tests/modules/misc/pam/yubico-no-ids.nix index 0236ccd593b6..47c55e358d88 100644 --- a/tests/modules/misc/pam/yubico-no-ids.nix +++ b/tests/modules/misc/pam/yubico-no-ids.nix @@ -1,7 +1,5 @@ { - config = { - nmt.script = '' - assertPathNotExists home-files/.yubico/authorized_yubikeys - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.yubico/authorized_yubikeys + ''; } diff --git a/tests/modules/misc/pam/yubico-with-ids.nix b/tests/modules/misc/pam/yubico-with-ids.nix index 7e6dc42617e4..71a049a3176c 100644 --- a/tests/modules/misc/pam/yubico-with-ids.nix +++ b/tests/modules/misc/pam/yubico-with-ids.nix @@ -1,15 +1,13 @@ { - config = { - pam.yubico.authorizedYubiKeys.ids = [ - "abcdefghijkl" - "012345678912" - ]; + pam.yubico.authorizedYubiKeys.ids = [ + "abcdefghijkl" + "012345678912" + ]; - nmt.script = '' - assertFileExists home-files/.yubico/authorized_yubikeys - assertFileContent \ - home-files/.yubico/authorized_yubikeys \ - ${builtins.toFile "yubico-with-ids-expected.txt" "hm-user:abcdefghijkl:012345678912"} - ''; - }; + nmt.script = '' + assertFileExists home-files/.yubico/authorized_yubikeys + assertFileContent \ + home-files/.yubico/authorized_yubikeys \ + ${builtins.toFile "yubico-with-ids-expected.txt" "hm-user:abcdefghijkl:012345678912"} + ''; } diff --git a/tests/modules/misc/xdg/default-locations.nix b/tests/modules/misc/xdg/default-locations.nix index 3af7d1457245..af368b53a3fc 100644 --- a/tests/modules/misc/xdg/default-locations.nix +++ b/tests/modules/misc/xdg/default-locations.nix @@ -1,32 +1,30 @@ { config, ... }: { - config = { - # Test fallback behavior for stateVersion >= 20.09, which is pure. - xdg.enable = false; - home.stateVersion = "20.09"; + # Test fallback behavior for stateVersion >= 20.09, which is pure. + xdg.enable = false; + home.stateVersion = "20.09"; - xdg.configFile.test.text = "config"; - xdg.dataFile.test.text = "data"; - home.file."${config.xdg.cacheHome}/test".text = "cache"; - home.file."${config.xdg.stateHome}/test".text = "state"; + xdg.configFile.test.text = "config"; + xdg.dataFile.test.text = "data"; + home.file."${config.xdg.cacheHome}/test".text = "cache"; + home.file."${config.xdg.stateHome}/test".text = "state"; - nmt.script = '' - assertFileExists home-files/.config/test - assertFileExists home-files/.local/share/test - assertFileExists home-files/.cache/test - assertFileExists home-files/.local/state/test - assertFileContent \ - home-files/.config/test \ - ${builtins.toFile "test" "config"} - assertFileContent \ - home-files/.local/share/test \ - ${builtins.toFile "test" "data"} - assertFileContent \ - home-files/.cache/test \ - ${builtins.toFile "test" "cache"} - assertFileContent \ - home-files/.local/state/test \ - ${builtins.toFile "test" "state"} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/test + assertFileExists home-files/.local/share/test + assertFileExists home-files/.cache/test + assertFileExists home-files/.local/state/test + assertFileContent \ + home-files/.config/test \ + ${builtins.toFile "test" "config"} + assertFileContent \ + home-files/.local/share/test \ + ${builtins.toFile "test" "data"} + assertFileContent \ + home-files/.cache/test \ + ${builtins.toFile "test" "cache"} + assertFileContent \ + home-files/.local/state/test \ + ${builtins.toFile "test" "state"} + ''; } diff --git a/tests/modules/misc/xdg/desktop-entries.nix b/tests/modules/misc/xdg/desktop-entries.nix index 01079da459ee..15645c8a015a 100644 --- a/tests/modules/misc/xdg/desktop-entries.nix +++ b/tests/modules/misc/xdg/desktop-entries.nix @@ -1,94 +1,92 @@ { pkgs, ... }: { - config = { - xdg.desktopEntries = { - full = { - # full definition - type = "Application"; - exec = "test --option"; - icon = "test"; - comment = "My Application"; - terminal = true; - name = "Test"; - genericName = "Web Browser"; - mimeType = [ - "text/html" - "text/xml" - ]; - categories = [ - "Network" - "WebBrowser" - ]; - startupNotify = false; - noDisplay = false; - prefersNonDefaultGPU = false; - settings = { - Keywords = "calc;math"; - DBusActivatable = "false"; + xdg.desktopEntries = { + full = { + # full definition + type = "Application"; + exec = "test --option"; + icon = "test"; + comment = "My Application"; + terminal = true; + name = "Test"; + genericName = "Web Browser"; + mimeType = [ + "text/html" + "text/xml" + ]; + categories = [ + "Network" + "WebBrowser" + ]; + startupNotify = false; + noDisplay = false; + prefersNonDefaultGPU = false; + settings = { + Keywords = "calc;math"; + DBusActivatable = "false"; + }; + actions = { + "New-Window" = { + name = "New Window"; + exec = "test --new-window"; + icon = "test"; }; - actions = { - "New-Window" = { - name = "New Window"; - exec = "test --new-window"; - icon = "test"; - }; - "Default" = { - exec = "test --default"; - }; + "Default" = { + exec = "test --default"; }; }; - min = { - # minimal definition - name = "Test"; - }; - deprecated = { - exec = "test --option"; - name = "Test"; - # Deprecated options - fileValidation = true; - extraConfig = '' - [X-ExtraSection] - Exec=foo -o - ''; - }; }; + min = { + # minimal definition + name = "Test"; + }; + deprecated = { + exec = "test --option"; + name = "Test"; + # Deprecated options + fileValidation = true; + extraConfig = '' + [X-ExtraSection] + Exec=foo -o + ''; + }; + }; - #testing that preexisting entries in the store are overridden - home.packages = [ - (pkgs.makeDesktopItem { - name = "full"; - desktopName = "We don't want this"; - exec = "no"; - }) - (pkgs.makeDesktopItem { - name = "min"; - desktopName = "We don't want this"; - exec = "no"; - }) - ]; + #testing that preexisting entries in the store are overridden + home.packages = [ + (pkgs.makeDesktopItem { + name = "full"; + desktopName = "We don't want this"; + exec = "no"; + }) + (pkgs.makeDesktopItem { + name = "min"; + desktopName = "We don't want this"; + exec = "no"; + }) + ]; - test.asserts.assertions.expected = - let - currentFile = toString ./desktop-entries.nix; - in - [ - '' - The option definition `fileValidation' in `${currentFile}' no longer has any effect; please remove it. - Validation of the desktop file is always enabled. - '' - '' - The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it. - The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs. - '' - ]; + test.asserts.assertions.expected = + let + currentFile = toString ./desktop-entries.nix; + in + [ + '' + The option definition `fileValidation' in `${currentFile}' no longer has any effect; please remove it. + Validation of the desktop file is always enabled. + '' + '' + The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it. + The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs. + '' + ]; - nmt.script = '' - assertFileExists home-path/share/applications/full.desktop - assertFileExists home-path/share/applications/min.desktop - assertFileContent home-path/share/applications/full.desktop \ - ${./desktop-full-expected.desktop} - assertFileContent home-path/share/applications/min.desktop \ - ${./desktop-min-expected.desktop} - ''; - }; + nmt.script = '' + assertFileExists home-path/share/applications/full.desktop + assertFileExists home-path/share/applications/min.desktop + assertFileContent home-path/share/applications/full.desktop \ + ${./desktop-full-expected.desktop} + assertFileContent home-path/share/applications/min.desktop \ + ${./desktop-min-expected.desktop} + ''; } diff --git a/tests/modules/misc/xdg/file-gen.nix b/tests/modules/misc/xdg/file-gen.nix index 0cffde592316..c06a8aa3c65d 100644 --- a/tests/modules/misc/xdg/file-gen.nix +++ b/tests/modules/misc/xdg/file-gen.nix @@ -1,33 +1,31 @@ { config, ... }: { - config = { - xdg.configHome = /. + "${config.home.homeDirectory}/.dummy-config"; - xdg.dataHome = /. + "${config.home.homeDirectory}/.dummy-data"; - xdg.cacheHome = /. + "${config.home.homeDirectory}/.dummy-cache"; - xdg.stateHome = /. + "${config.home.homeDirectory}/.dummy-state"; + xdg.configHome = /. + "${config.home.homeDirectory}/.dummy-config"; + xdg.dataHome = /. + "${config.home.homeDirectory}/.dummy-data"; + xdg.cacheHome = /. + "${config.home.homeDirectory}/.dummy-cache"; + xdg.stateHome = /. + "${config.home.homeDirectory}/.dummy-state"; - xdg.configFile.test.text = "config"; - xdg.dataFile.test.text = "data"; - xdg.stateFile.test.text = "state"; - home.file."${config.xdg.cacheHome}/test".text = "cache"; + xdg.configFile.test.text = "config"; + xdg.dataFile.test.text = "data"; + xdg.stateFile.test.text = "state"; + home.file."${config.xdg.cacheHome}/test".text = "cache"; - nmt.script = '' - assertFileExists home-files/.dummy-config/test - assertFileExists home-files/.dummy-cache/test - assertFileExists home-files/.dummy-data/test - assertFileExists home-files/.dummy-state/test - assertFileContent \ - home-files/.dummy-config/test \ - ${builtins.toFile "test" "config"} - assertFileContent \ - home-files/.dummy-data/test \ - ${builtins.toFile "test" "data"} - assertFileContent \ - home-files/.dummy-cache/test \ - ${builtins.toFile "test" "cache"} - assertFileContent \ - home-files/.dummy-state/test \ - ${builtins.toFile "test" "state"} - ''; - }; + nmt.script = '' + assertFileExists home-files/.dummy-config/test + assertFileExists home-files/.dummy-cache/test + assertFileExists home-files/.dummy-data/test + assertFileExists home-files/.dummy-state/test + assertFileContent \ + home-files/.dummy-config/test \ + ${builtins.toFile "test" "config"} + assertFileContent \ + home-files/.dummy-data/test \ + ${builtins.toFile "test" "data"} + assertFileContent \ + home-files/.dummy-cache/test \ + ${builtins.toFile "test" "cache"} + assertFileContent \ + home-files/.dummy-state/test \ + ${builtins.toFile "test" "state"} + ''; } diff --git a/tests/modules/misc/xdg/mime-disabled.nix b/tests/modules/misc/xdg/mime-disabled.nix index 43885528b937..542baba5439e 100644 --- a/tests/modules/misc/xdg/mime-disabled.nix +++ b/tests/modules/misc/xdg/mime-disabled.nix @@ -1,10 +1,8 @@ { - config = { - xdg.mime.enable = false; - nmt.script = '' - # assert that neither application is run - assertPathNotExists home-path/share/applications/mimeinfo.cache - assertPathNotExists home-path/share/applications/mime - ''; - }; + xdg.mime.enable = false; + nmt.script = '' + # assert that neither application is run + assertPathNotExists home-path/share/applications/mimeinfo.cache + assertPathNotExists home-path/share/applications/mime + ''; } diff --git a/tests/modules/misc/xdg/mime-packages.nix b/tests/modules/misc/xdg/mime-packages.nix index c0341aab97f3..d2ef966867ec 100644 --- a/tests/modules/misc/xdg/mime-packages.nix +++ b/tests/modules/misc/xdg/mime-packages.nix @@ -3,36 +3,34 @@ let inherit (config.lib.test) mkStubPackage; in { - config = { - xdg.mime.enable = true; - xdg.mime.sharedMimeInfoPackage = mkStubPackage { - name = "update-mime-database"; - buildScript = '' - mkdir -p $out/bin - echo '#!/bin/sh' > $out/bin/update-mime-database - echo 'mkdir -p $out/share/mime && touch $out/share/mime/mime.cache' >> $out/bin/update-mime-database - chmod +x $out/bin/update-mime-database - ''; - }; - xdg.mime.desktopFileUtilsPackage = mkStubPackage { - name = "desktop-file-utils"; - buildScript = '' - mkdir -p $out/bin - echo '#!/bin/sh' > $out/bin/update-desktop-database - echo 'mkdir -p $out/share/applications/ && ln -s ${./mime-expected.cache} $out/share/applications/mimeinfo.cache' >> $out/bin/update-desktop-database - chmod +x $out/bin/update-desktop-database - ''; - }; - nmt.script = '' - assertFileExists home-path/share/applications/mimeinfo.cache # Check that update-desktop-database created file - # Check that update-desktop-database file matches expected - assertFileContent \ - home-path/share/applications/mimeinfo.cache \ - ${./mime-expected.cache} - - assertDirectoryExists home-path/share/mime # Check that update-mime-database created directory - assertFileExists home-path/share/mime/mime.cache # Check that update-mime-database created file - + xdg.mime.enable = true; + xdg.mime.sharedMimeInfoPackage = mkStubPackage { + name = "update-mime-database"; + buildScript = '' + mkdir -p $out/bin + echo '#!/bin/sh' > $out/bin/update-mime-database + echo 'mkdir -p $out/share/mime && touch $out/share/mime/mime.cache' >> $out/bin/update-mime-database + chmod +x $out/bin/update-mime-database + ''; + }; + xdg.mime.desktopFileUtilsPackage = mkStubPackage { + name = "desktop-file-utils"; + buildScript = '' + mkdir -p $out/bin + echo '#!/bin/sh' > $out/bin/update-desktop-database + echo 'mkdir -p $out/share/applications/ && ln -s ${./mime-expected.cache} $out/share/applications/mimeinfo.cache' >> $out/bin/update-desktop-database + chmod +x $out/bin/update-desktop-database ''; }; + nmt.script = '' + assertFileExists home-path/share/applications/mimeinfo.cache # Check that update-desktop-database created file + # Check that update-desktop-database file matches expected + assertFileContent \ + home-path/share/applications/mimeinfo.cache \ + ${./mime-expected.cache} + + assertDirectoryExists home-path/share/mime # Check that update-mime-database created directory + assertFileExists home-path/share/mime/mime.cache # Check that update-mime-database created file + + ''; } diff --git a/tests/modules/misc/xdg/system-dirs.nix b/tests/modules/misc/xdg/system-dirs.nix index 240e5ef9a9e1..701e096c61f4 100644 --- a/tests/modules/misc/xdg/system-dirs.nix +++ b/tests/modules/misc/xdg/system-dirs.nix @@ -5,36 +5,34 @@ }: { - config = { - xdg.systemDirs.config = [ - "/etc/xdg" - "/foo/bar" - ]; - xdg.systemDirs.data = [ - "/usr/local/share" - "/usr/share" - "/baz/quux" - ]; + xdg.systemDirs.config = [ + "/etc/xdg" + "/foo/bar" + ]; + xdg.systemDirs.data = [ + "/usr/local/share" + "/usr/share" + "/baz/quux" + ]; - nmt.script = '' - envFile=home-files/.config/environment.d/10-home-manager.conf - assertFileExists $envFile - assertFileContent $envFile ${pkgs.writeText "expected" '' - LOCALE_ARCHIVE_2_27=${config.i18n.glibcLocales}/lib/locale/locale-archive - XDG_CACHE_HOME=/home/hm-user/.cache - XDG_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS} - XDG_CONFIG_HOME=/home/hm-user/.config - XDG_DATA_DIRS=/usr/local/share:/usr/share:/baz/quux''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS} - XDG_DATA_HOME=/home/hm-user/.local/share - XDG_STATE_HOME=/home/hm-user/.local/state - ''} + nmt.script = '' + envFile=home-files/.config/environment.d/10-home-manager.conf + assertFileExists $envFile + assertFileContent $envFile ${pkgs.writeText "expected" '' + LOCALE_ARCHIVE_2_27=${config.i18n.glibcLocales}/lib/locale/locale-archive + XDG_CACHE_HOME=/home/hm-user/.cache + XDG_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS} + XDG_CONFIG_HOME=/home/hm-user/.config + XDG_DATA_DIRS=/usr/local/share:/usr/share:/baz/quux''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS} + XDG_DATA_HOME=/home/hm-user/.local/share + XDG_STATE_HOME=/home/hm-user/.local/state + ''} - sessionVarsFile=home-path/etc/profile.d/hm-session-vars.sh - assertFileExists $sessionVarsFile - assertFileContains $sessionVarsFile \ - 'export XDG_CONFIG_DIRS="/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}"' - assertFileContains $sessionVarsFile \ - 'export XDG_DATA_DIRS="/usr/local/share:/usr/share:/baz/quux''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"' - ''; - }; + sessionVarsFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileExists $sessionVarsFile + assertFileContains $sessionVarsFile \ + 'export XDG_CONFIG_DIRS="/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}"' + assertFileContains $sessionVarsFile \ + 'export XDG_DATA_DIRS="/usr/local/share:/usr/share:/baz/quux''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"' + ''; } diff --git a/tests/modules/misc/xdg/user-dirs-null.nix b/tests/modules/misc/xdg/user-dirs-null.nix index 5d36582f5e7e..37f91de544ab 100644 --- a/tests/modules/misc/xdg/user-dirs-null.nix +++ b/tests/modules/misc/xdg/user-dirs-null.nix @@ -4,24 +4,22 @@ }: { - config = { - xdg.userDirs = { - enable = true; - desktop = null; - }; - - nmt.script = '' - configFile=home-files/.config/user-dirs.dirs - assertFileExists $configFile - assertFileContent $configFile ${pkgs.writeText "expected" '' - XDG_DOCUMENTS_DIR="/home/hm-user/Documents" - XDG_DOWNLOAD_DIR="/home/hm-user/Downloads" - XDG_MUSIC_DIR="/home/hm-user/Music" - XDG_PICTURES_DIR="/home/hm-user/Pictures" - XDG_PUBLICSHARE_DIR="/home/hm-user/Public" - XDG_TEMPLATES_DIR="/home/hm-user/Templates" - XDG_VIDEOS_DIR="/home/hm-user/Videos" - ''} - ''; + xdg.userDirs = { + enable = true; + desktop = null; }; + + nmt.script = '' + configFile=home-files/.config/user-dirs.dirs + assertFileExists $configFile + assertFileContent $configFile ${pkgs.writeText "expected" '' + XDG_DOCUMENTS_DIR="/home/hm-user/Documents" + XDG_DOWNLOAD_DIR="/home/hm-user/Downloads" + XDG_MUSIC_DIR="/home/hm-user/Music" + XDG_PICTURES_DIR="/home/hm-user/Pictures" + XDG_PUBLICSHARE_DIR="/home/hm-user/Public" + XDG_TEMPLATES_DIR="/home/hm-user/Templates" + XDG_VIDEOS_DIR="/home/hm-user/Videos" + ''} + ''; } diff --git a/tests/modules/misc/xsession/basic.nix b/tests/modules/misc/xsession/basic.nix index 3dcc6b397ba0..7cc81fc64417 100644 --- a/tests/modules/misc/xsession/basic.nix +++ b/tests/modules/misc/xsession/basic.nix @@ -1,38 +1,36 @@ { - config = { - xsession = { - enable = true; - windowManager.command = "window manager command"; - importedVariables = [ "EXTRA_IMPORTED_VARIABLE" ]; - initExtra = "init extra commands"; - profileExtra = "profile extra commands"; - }; + xsession = { + enable = true; + windowManager.command = "window manager command"; + importedVariables = [ "EXTRA_IMPORTED_VARIABLE" ]; + initExtra = "init extra commands"; + profileExtra = "profile extra commands"; + }; - nixpkgs.overlays = [ - (_self: super: { - xorg = super.xorg // { - setxkbmap = super.xorg.setxkbmap // { - outPath = "@setxkbmap@"; - }; + nixpkgs.overlays = [ + (_self: super: { + xorg = super.xorg // { + setxkbmap = super.xorg.setxkbmap // { + outPath = "@setxkbmap@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.xprofile - assertFileContent \ - home-files/.xprofile \ - ${./basic-xprofile-expected.txt} + nmt.script = '' + assertFileExists home-files/.xprofile + assertFileContent \ + home-files/.xprofile \ + ${./basic-xprofile-expected.txt} - assertFileExists home-files/.xsession - assertFileContent \ - home-files/.xsession \ - ${./basic-xsession-expected.txt} + assertFileExists home-files/.xsession + assertFileContent \ + home-files/.xsession \ + ${./basic-xsession-expected.txt} - assertFileExists home-files/.config/systemd/user/setxkbmap.service - assertFileContent \ - home-files/.config/systemd/user/setxkbmap.service \ - ${./basic-setxkbmap-expected.service} - ''; - }; + assertFileExists home-files/.config/systemd/user/setxkbmap.service + assertFileContent \ + home-files/.config/systemd/user/setxkbmap.service \ + ${./basic-setxkbmap-expected.service} + ''; } diff --git a/tests/modules/misc/xsession/keyboard-without-layout.nix b/tests/modules/misc/xsession/keyboard-without-layout.nix index 1d1935355e8c..f3facac1643e 100644 --- a/tests/modules/misc/xsession/keyboard-without-layout.nix +++ b/tests/modules/misc/xsession/keyboard-without-layout.nix @@ -1,37 +1,35 @@ { - config = { - home.stateVersion = "19.09"; + home.stateVersion = "19.09"; - home.keyboard = { - options = [ - "ctrl:nocaps" - "altwin:no_win" - ]; - }; + home.keyboard = { + options = [ + "ctrl:nocaps" + "altwin:no_win" + ]; + }; - xsession = { - enable = true; - windowManager.command = "window manager command"; - importedVariables = [ "EXTRA_IMPORTED_VARIABLE" ]; - initExtra = "init extra commands"; - profileExtra = "profile extra commands"; - }; + xsession = { + enable = true; + windowManager.command = "window manager command"; + importedVariables = [ "EXTRA_IMPORTED_VARIABLE" ]; + initExtra = "init extra commands"; + profileExtra = "profile extra commands"; + }; - nixpkgs.overlays = [ - (_self: super: { - xorg = super.xorg // { - setxkbmap = super.xorg.setxkbmap // { - outPath = "@setxkbmap@"; - }; + nixpkgs.overlays = [ + (_self: super: { + xorg = super.xorg // { + setxkbmap = super.xorg.setxkbmap // { + outPath = "@setxkbmap@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/systemd/user/setxkbmap.service - assertFileContent \ - home-files/.config/systemd/user/setxkbmap.service \ - ${./keyboard-without-layout-expected.service} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/systemd/user/setxkbmap.service + assertFileContent \ + home-files/.config/systemd/user/setxkbmap.service \ + ${./keyboard-without-layout-expected.service} + ''; } diff --git a/tests/modules/programs/abook/no-settings.nix b/tests/modules/programs/abook/no-settings.nix index 942c19e50eb8..30b0c310caa1 100644 --- a/tests/modules/programs/abook/no-settings.nix +++ b/tests/modules/programs/abook/no-settings.nix @@ -1,9 +1,7 @@ { - config = { - programs.abook.enable = true; + programs.abook.enable = true; - nmt.script = '' - assertPathNotExists home-files/.config/abook/abookrc - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/abook/abookrc + ''; } diff --git a/tests/modules/programs/abook/with-settings.nix b/tests/modules/programs/abook/with-settings.nix index a02c9d6fda5a..54cc5772d8b0 100644 --- a/tests/modules/programs/abook/with-settings.nix +++ b/tests/modules/programs/abook/with-settings.nix @@ -1,32 +1,30 @@ { - config = { - programs.abook = { - enable = true; + programs.abook = { + enable = true; - extraConfig = '' - # Defining a new custom field - # ----------------------------- + extraConfig = '' + # Defining a new custom field + # ----------------------------- - field pager = Pager - field address_lines = Address, list - field birthday = Birthday, date + field pager = Pager + field address_lines = Address, list + field birthday = Birthday, date - # Defining a view/tab - # --------------------- + # Defining a view/tab + # --------------------- - view CONTACT = name, email - view ADDRESS = address_lines, city, state, zip, country - view PHONE = phone, workphone, pager, mobile, fax - view OTHER = url, birthday + view CONTACT = name, email + view ADDRESS = address_lines, city, state, zip, country + view PHONE = phone, workphone, pager, mobile, fax + view OTHER = url, birthday - # Automatically save database on exit - set autosave=true - ''; - }; - - nmt.script = '' - assertFileExists home-files/.config/abook/abookrc - assertFileContent home-files/.config/abook/abookrc ${./with-settings.cfg} + # Automatically save database on exit + set autosave=true ''; }; + + nmt.script = '' + assertFileExists home-files/.config/abook/abookrc + assertFileContent home-files/.config/abook/abookrc ${./with-settings.cfg} + ''; } diff --git a/tests/modules/programs/aerc/assertion.nix b/tests/modules/programs/aerc/assertion.nix index d628da64108b..1f80440cada3 100644 --- a/tests/modules/programs/aerc/assertion.nix +++ b/tests/modules/programs/aerc/assertion.nix @@ -1,54 +1,52 @@ { - config = { - test.asserts.assertions.expected = [ - '' - Only the ui section of $XDG_CONFIG_HOME/aerc.conf supports contextual (per-account) configuration. - Please configure it with accounts.email.accounts._.aerc.extraConfig.ui and move any other - configuration to programs.aerc.extraConfig. - '' - ]; - test.asserts.warnings.expected = [ - '' - aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset. - This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5): - > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600). - > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials. - These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444). - Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`. - This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. - '' - ]; + test.asserts.assertions.expected = [ + '' + Only the ui section of $XDG_CONFIG_HOME/aerc.conf supports contextual (per-account) configuration. + Please configure it with accounts.email.accounts._.aerc.extraConfig.ui and move any other + configuration to programs.aerc.extraConfig. + '' + ]; + test.asserts.warnings.expected = [ + '' + aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset. + This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5): + > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600). + > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials. + These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444). + Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`. + This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. + '' + ]; - programs.aerc = { - enable = true; - extraAccounts = { - Test1 = { - source = "maildir:///dev/null"; - enable-folders-sort = true; - folders = [ - "INBOX" - "SENT" - "JUNK" - ]; - }; - }; - extraConfig.general = { - # unsafe-accounts-conf = true; - pgp-provider = "gpg"; + programs.aerc = { + enable = true; + extraAccounts = { + Test1 = { + source = "maildir:///dev/null"; + enable-folders-sort = true; + folders = [ + "INBOX" + "SENT" + "JUNK" + ]; }; }; + extraConfig.general = { + # unsafe-accounts-conf = true; + pgp-provider = "gpg"; + }; + }; - accounts.email.accounts.Test2 = { - address = "addr@mail.invalid"; - userName = "addr@mail.invalid"; - realName = "Foo Bar"; - primary = true; - imap.host = "imap.host.invalid"; - passwordCommand = "echo PaSsWorD!"; - aerc = { - enable = true; - extraConfig.general.pgp-provider = "internal"; - }; + accounts.email.accounts.Test2 = { + address = "addr@mail.invalid"; + userName = "addr@mail.invalid"; + realName = "Foo Bar"; + primary = true; + imap.host = "imap.host.invalid"; + passwordCommand = "echo PaSsWorD!"; + aerc = { + enable = true; + extraConfig.general.pgp-provider = "internal"; }; }; } diff --git a/tests/modules/programs/aerc/noSettings.nix b/tests/modules/programs/aerc/noSettings.nix index 50e534dc55b8..c45cc8655397 100644 --- a/tests/modules/programs/aerc/noSettings.nix +++ b/tests/modules/programs/aerc/noSettings.nix @@ -1,15 +1,13 @@ { - config = { - nmt.script = - let - dir = "home-files/.config/aerc"; - in - '' - assertPathNotExists ${dir}/accounts.conf - assertPathNotExists ${dir}/aerc.conf - assertPathNotExists ${dir}/binds.conf - assertPathNotExists ${dir}/stylesets - ''; - programs.aerc.enable = true; - }; + nmt.script = + let + dir = "home-files/.config/aerc"; + in + '' + assertPathNotExists ${dir}/accounts.conf + assertPathNotExists ${dir}/aerc.conf + assertPathNotExists ${dir}/binds.conf + assertPathNotExists ${dir}/stylesets + ''; + programs.aerc.enable = true; } diff --git a/tests/modules/programs/aerc/oauth.nix b/tests/modules/programs/aerc/oauth.nix index 314338002c25..076768387d16 100644 --- a/tests/modules/programs/aerc/oauth.nix +++ b/tests/modules/programs/aerc/oauth.nix @@ -1,40 +1,38 @@ { config, pkgs, ... }: { - config = { - nmt.script = - let - dir = - if (pkgs.stdenv.isDarwin && !config.xdg.enable) then - "home-files/Library/Preferences/aerc" - else - "home-files/.config/aerc"; - in - '' - assertFileContent ${dir}/accounts.conf ${./oauth.expected} - ''; - programs.aerc = { - enable = true; - extraConfig.general.unsafe-accounts-conf = true; - }; + nmt.script = + let + dir = + if (pkgs.stdenv.isDarwin && !config.xdg.enable) then + "home-files/Library/Preferences/aerc" + else + "home-files/.config/aerc"; + in + '' + assertFileContent ${dir}/accounts.conf ${./oauth.expected} + ''; + programs.aerc = { + enable = true; + extraConfig.general.unsafe-accounts-conf = true; + }; - accounts.email.accounts = { - basic = { - realName = "Annie X. Hacker"; - userName = "anniex"; - address = "anniex@mail.invalid"; - primary = true; - flavor = "outlook.office365.com"; + accounts.email.accounts = { + basic = { + realName = "Annie X. Hacker"; + userName = "anniex"; + address = "anniex@mail.invalid"; + primary = true; + flavor = "outlook.office365.com"; - aerc = rec { - enable = true; - imapAuth = "xoauth2"; - smtpAuth = imapAuth; - imapOauth2Params = { - client_id = "9e5f94bc-e8a4-4e73-b8be-63364c29d753"; - token_endpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token"; - }; - smtpOauth2Params = imapOauth2Params; + aerc = rec { + enable = true; + imapAuth = "xoauth2"; + smtpAuth = imapAuth; + imapOauth2Params = { + client_id = "9e5f94bc-e8a4-4e73-b8be-63364c29d753"; + token_endpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token"; }; + smtpOauth2Params = imapOauth2Params; }; }; }; diff --git a/tests/modules/programs/aerc/settings.nix b/tests/modules/programs/aerc/settings.nix index c41fc51a40b0..33ce6b04caa1 100644 --- a/tests/modules/programs/aerc/settings.nix +++ b/tests/modules/programs/aerc/settings.nix @@ -1,314 +1,312 @@ { config, pkgs, ... }: { - config = { - nmt.script = - let - dir = - if (pkgs.stdenv.isDarwin && !config.xdg.enable) then - "home-files/Library/Preferences/aerc" - else - "home-files/.config/aerc"; - in - '' - assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected} - assertFileContent ${dir}/binds.conf ${./extraBinds.expected} - assertFileContent ${dir}/aerc.conf ${./extraConfig.expected} - assertFileContent ${dir}/templates/bar ${./templates.expected} - assertFileContent ${dir}/templates/foo ${./templates.expected} - assertFileContent ${dir}/stylesets/default ${./stylesets.expected} - assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected} - ''; + nmt.script = + let + dir = + if (pkgs.stdenv.isDarwin && !config.xdg.enable) then + "home-files/Library/Preferences/aerc" + else + "home-files/.config/aerc"; + in + '' + assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected} + assertFileContent ${dir}/binds.conf ${./extraBinds.expected} + assertFileContent ${dir}/aerc.conf ${./extraConfig.expected} + assertFileContent ${dir}/templates/bar ${./templates.expected} + assertFileContent ${dir}/templates/foo ${./templates.expected} + assertFileContent ${dir}/stylesets/default ${./stylesets.expected} + assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected} + ''; - programs.aerc = { - enable = true; + programs.aerc = { + enable = true; - extraAccounts = { - Test1 = { - source = "maildir:///dev/null"; - enable-folders-sort = true; - folders = [ - "INBOX" - "SENT" - "JUNK" - ]; - }; - Test2 = { - pgp-key-id = 42; - }; + extraAccounts = { + Test1 = { + source = "maildir:///dev/null"; + enable-folders-sort = true; + folders = [ + "INBOX" + "SENT" + "JUNK" + ]; }; - - extraBinds = { - global = { - "" = ":prev-tab"; - "" = ":next-tab"; - "" = ":term"; - }; - messages = { - q = ":quit"; - j = ":next"; - }; - "compose::editor" = { - "$noinherit" = "true"; - "$ex" = ""; - "" = ":prev-field"; - }; + Test2 = { + pgp-key-id = 42; }; + }; - extraConfig = { - general.unsafe-accounts-conf = true; - ui = { - index-format = null; - sort = "-r date"; - spinner = [ - true - 2 - 3.4 - "5" - ]; - sidebar-width = 42; - mouse-enabled = false; - test-float = 1337.42; - }; - "ui:account=Test" = { - sidebar-width = 1337; - }; + extraBinds = { + global = { + "" = ":prev-tab"; + "" = ":next-tab"; + "" = ":term"; + }; + messages = { + q = ":quit"; + j = ":next"; + }; + "compose::editor" = { + "$noinherit" = "true"; + "$ex" = ""; + "" = ":prev-field"; + }; + }; - # https://github.com/nix-community/home-manager/issues/6059 - filters = '' - text/plain=colorize - text/calendar=calendar - message/delivery-status=colorize - message/rfc822=colorize - text/html=pandoc -f html -t plain | colorize - text/html=html | colorize - text/*=bat -fP --file-name="$AERC_FILENAME" - .headers=colorize - ''; + extraConfig = { + general.unsafe-accounts-conf = true; + ui = { + index-format = null; + sort = "-r date"; + spinner = [ + true + 2 + 3.4 + "5" + ]; + sidebar-width = 42; + mouse-enabled = false; + test-float = 1337.42; + }; + "ui:account=Test" = { + sidebar-width = 1337; }; - stylesets = { - asLines = '' - *.default = true - *.selected.reverse = toggle - *error.bold = true - error.fg = red - header.bold = true - title.reverse = true + # https://github.com/nix-community/home-manager/issues/6059 + filters = '' + text/plain=colorize + text/calendar=calendar + message/delivery-status=colorize + message/rfc822=colorize + text/html=pandoc -f html -t plain | colorize + text/html=html | colorize + text/*=bat -fP --file-name="$AERC_FILENAME" + .headers=colorize + ''; + }; - [ui] - tab.selected.reverse = toggle - ''; - default = { - global = { - "*.default" = "true"; - "*error.bold" = "true"; - "error.fg" = "red"; - "header.bold" = "true"; - "*.selected.reverse" = "toggle"; - "title.reverse" = "true"; - }; - ui."tab.selected.reverse" = "toggle"; + stylesets = { + asLines = '' + *.default = true + *.selected.reverse = toggle + *error.bold = true + error.fg = red + header.bold = true + title.reverse = true + + [ui] + tab.selected.reverse = toggle + ''; + default = { + global = { + "*.default" = "true"; + "*error.bold" = "true"; + "error.fg" = "red"; + "header.bold" = "true"; + "*.selected.reverse" = "toggle"; + "title.reverse" = "true"; }; + ui."tab.selected.reverse" = "toggle"; }; + }; - templates = rec { - foo = '' - X-Mailer: aerc {{version}} + templates = rec { + foo = '' + X-Mailer: aerc {{version}} - Just a test. - ''; - bar = foo; - }; + Just a test. + ''; + bar = foo; }; + }; - accounts.email.accounts = - let - basics = { - aerc = { - enable = true; - }; - realName = "Foo Bar"; - userName = "foobar"; - address = "addr@mail.invalid"; - folders = { - drafts = ""; - inbox = ""; - sent = ""; - trash = ""; - }; + accounts.email.accounts = + let + basics = { + aerc = { + enable = true; }; - in - { - primary = basics // { - primary = true; - imap = { - host = "imap.host.invalid"; - port = 1337; - tls.enable = true; - tls.useStartTls = true; - }; + realName = "Foo Bar"; + userName = "foobar"; + address = "addr@mail.invalid"; + folders = { + drafts = ""; + inbox = ""; + sent = ""; + trash = ""; }; - a_imap-nopasscmd-tls-starttls-folders = basics // { - imap = { - host = "imap.host.invalid"; - port = 1337; - tls.enable = true; - tls.useStartTls = true; - }; - folders = { - drafts = "aercDrafts"; - inbox = "aercInbox"; - sent = "aercSent"; - }; + }; + in + { + primary = basics // { + primary = true; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = true; + tls.useStartTls = true; }; - b_imap-passcmd-tls-nostarttls-extraAccounts = basics // { - passwordCommand = "echo PaSsWorD!"; - imap = { - host = "imap.host.invalid"; - port = 1337; - tls.enable = true; - tls.useStartTls = false; - }; - aerc = { - enable = true; - extraAccounts = { - connection-timeout = "42s"; - }; - }; + }; + a_imap-nopasscmd-tls-starttls-folders = basics // { + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = true; + tls.useStartTls = true; }; - c_imap-passcmd-notls-nostarttls-extraConfig = basics // { - passwordCommand = "echo PaSsWorD!"; - aerc = { - enable = true; - extraConfig = { - ui.index-format = "%42.1337n"; - }; - }; - imap = { - host = "imap.host.invalid"; - port = 1337; - tls.enable = false; - tls.useStartTls = false; - }; + folders = { + drafts = "aercDrafts"; + inbox = "aercInbox"; + sent = "aercSent"; }; - d_imap-passcmd-notls-starttls-extraBinds = basics // { - passwordCommand = "echo PaSsWorD!"; - imap = { - host = "imap.host.invalid"; - port = 1337; - tls.enable = false; - tls.useStartTls = true; - }; - aerc = { - enable = true; - extraBinds = { - messages = { - d = ":move Trash"; - }; - }; - }; + }; + b_imap-passcmd-tls-nostarttls-extraAccounts = basics // { + passwordCommand = "echo PaSsWorD!"; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = true; + tls.useStartTls = false; }; - e_smtp-nopasscmd-tls-starttls = basics // { - smtp = { - host = "smtp.host.invalid"; - port = 42; - tls.enable = true; - tls.useStartTls = true; + aerc = { + enable = true; + extraAccounts = { + connection-timeout = "42s"; }; }; - f_smtp-passcmd-tls-nostarttls = basics // { - passwordCommand = "echo PaSsWorD!"; - smtp = { - host = "smtp.host.invalid"; - port = 42; - tls.enable = true; - tls.useStartTls = false; + }; + c_imap-passcmd-notls-nostarttls-extraConfig = basics // { + passwordCommand = "echo PaSsWorD!"; + aerc = { + enable = true; + extraConfig = { + ui.index-format = "%42.1337n"; }; }; - g_smtp-passcmd-notls-nostarttls = basics // { - passwordCommand = "echo PaSsWorD!"; - smtp = { - host = "smtp.host.invalid"; - port = 42; - tls.enable = false; - tls.useStartTls = false; - }; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = false; + tls.useStartTls = false; + }; + }; + d_imap-passcmd-notls-starttls-extraBinds = basics // { + passwordCommand = "echo PaSsWorD!"; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = false; + tls.useStartTls = true; }; - h_smtp-passcmd-notls-starttls = basics // { - passwordCommand = "echo PaSsWorD!"; - smtp = { - host = "smtp.host.invalid"; - port = 42; - tls.enable = false; - tls.useStartTls = true; + aerc = { + enable = true; + extraBinds = { + messages = { + d = ":move Trash"; + }; }; }; - i1_maildir-mbsync = basics // { - mbsync.enable = true; + }; + e_smtp-nopasscmd-tls-starttls = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = true; + tls.useStartTls = true; }; - i2_maildirpp-mbsync = basics // { - mbsync.enable = true; - mbsync.subFolders = "Maildir++"; + }; + f_smtp-passcmd-tls-nostarttls = basics // { + passwordCommand = "echo PaSsWorD!"; + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = true; + tls.useStartTls = false; }; - i3_maildir_flatten-mbsync = basics // { - mbsync.enable = true; - mbsync.subFolders = "Maildir++"; - mbsync.flatten = "."; + }; + g_smtp-passcmd-notls-nostarttls = basics // { + passwordCommand = "echo PaSsWorD!"; + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = false; + tls.useStartTls = false; }; - j_maildir-offlineimap = basics // { - offlineimap.enable = true; + }; + h_smtp-passcmd-notls-starttls = basics // { + passwordCommand = "echo PaSsWorD!"; + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = false; + tls.useStartTls = true; }; - k_notEnabled = basics // { - aerc.enable = false; + }; + i1_maildir-mbsync = basics // { + mbsync.enable = true; + }; + i2_maildirpp-mbsync = basics // { + mbsync.enable = true; + mbsync.subFolders = "Maildir++"; + }; + i3_maildir_flatten-mbsync = basics // { + mbsync.enable = true; + mbsync.subFolders = "Maildir++"; + mbsync.flatten = "."; + }; + j_maildir-offlineimap = basics // { + offlineimap.enable = true; + }; + k_notEnabled = basics // { + aerc.enable = false; + }; + l_smtp-auth-none = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; }; - l_smtp-auth-none = basics // { - smtp = { - host = "smtp.host.invalid"; - port = 42; - }; - aerc = { - enable = true; - smtpAuth = "none"; - }; + aerc = { + enable = true; + smtpAuth = "none"; }; - m_smtp-auth-plain = basics // { - smtp = { - host = "smtp.host.invalid"; - port = 42; - }; - aerc = { - enable = true; - smtpAuth = "plain"; - }; + }; + m_smtp-auth-plain = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; }; - n_smtp-auth-login = basics // { - smtp = { - host = "smtp.host.invalid"; - port = 42; - }; - aerc = { - enable = true; - smtpAuth = "login"; - }; + aerc = { + enable = true; + smtpAuth = "plain"; }; - o_msmtp = basics // { - msmtp = { - enable = true; - }; + }; + n_smtp-auth-login = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; }; - p_overwrite_defaults = basics // { - smtp.host = "should.be.overwritten.invalid"; - imap.host = "should.be.overwritten.invalid"; - aerc = { - enable = true; - extraAccounts = { - from = "test "; - outgoing = "imap+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337"; - source = "smtp+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337"; - postpone = "dRaFts"; - }; + aerc = { + enable = true; + smtpAuth = "login"; + }; + }; + o_msmtp = basics // { + msmtp = { + enable = true; + }; + }; + p_overwrite_defaults = basics // { + smtp.host = "should.be.overwritten.invalid"; + imap.host = "should.be.overwritten.invalid"; + aerc = { + enable = true; + extraAccounts = { + from = "test "; + outgoing = "imap+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337"; + source = "smtp+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337"; + postpone = "dRaFts"; }; }; }; - }; + }; } diff --git a/tests/modules/programs/bash/bash-history-control-with-file.nix b/tests/modules/programs/bash/bash-history-control-with-file.nix index d3193232a3ac..9d7d1f20a97a 100644 --- a/tests/modules/programs/bash/bash-history-control-with-file.nix +++ b/tests/modules/programs/bash/bash-history-control-with-file.nix @@ -1,16 +1,14 @@ { - config = { - programs.bash = { - enable = true; - historyControl = [ "erasedups" ]; - historyFile = "/home/hm-user/foo/bash/history"; - }; + programs.bash = { + enable = true; + historyControl = [ "erasedups" ]; + historyFile = "/home/hm-user/foo/bash/history"; + }; - nmt.script = '' - assertFileExists home-files/.bashrc + nmt.script = '' + assertFileExists home-files/.bashrc - assertFileRegex home-files/.bashrc \ - '^mkdir -p "\$(dirname "\$HISTFILE")"' - ''; - }; + assertFileRegex home-files/.bashrc \ + '^mkdir -p "\$(dirname "\$HISTFILE")"' + ''; } diff --git a/tests/modules/programs/bottom/empty-settings.nix b/tests/modules/programs/bottom/empty-settings.nix index 268a48485e53..aabd99960273 100644 --- a/tests/modules/programs/bottom/empty-settings.nix +++ b/tests/modules/programs/bottom/empty-settings.nix @@ -1,13 +1,11 @@ { config, ... }: { - config = { - programs.bottom = { - enable = true; - package = config.lib.test.mkStubPackage { }; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/bottom - ''; + programs.bottom = { + enable = true; + package = config.lib.test.mkStubPackage { }; }; + + nmt.script = '' + assertPathNotExists home-files/.config/bottom + ''; } diff --git a/tests/modules/programs/bottom/example-settings.nix b/tests/modules/programs/bottom/example-settings.nix index 9ffe1f584f98..0602272af893 100644 --- a/tests/modules/programs/bottom/example-settings.nix +++ b/tests/modules/programs/bottom/example-settings.nix @@ -1,26 +1,24 @@ { config, ... }: { - config = { - programs.bottom = { - enable = true; - package = config.lib.test.mkStubPackage { }; + programs.bottom = { + enable = true; + package = config.lib.test.mkStubPackage { }; - settings = { - flags = { - avg_cpu = true; - temperature_type = "c"; - }; + settings = { + flags = { + avg_cpu = true; + temperature_type = "c"; + }; - colors = { - low_battery_color = "red"; - }; + colors = { + low_battery_color = "red"; }; }; - - nmt.script = '' - assertFileContent \ - "home-files/.config/bottom/bottom.toml" \ - ${./example-settings-expected.toml} - ''; }; + + nmt.script = '' + assertFileContent \ + "home-files/.config/bottom/bottom.toml" \ + ${./example-settings-expected.toml} + ''; } diff --git a/tests/modules/programs/boxxy/empty-settings.nix b/tests/modules/programs/boxxy/empty-settings.nix index 61692a237234..5e3af90e84c3 100644 --- a/tests/modules/programs/boxxy/empty-settings.nix +++ b/tests/modules/programs/boxxy/empty-settings.nix @@ -1,9 +1,7 @@ { - config = { - programs.boxxy.enable = true; + programs.boxxy.enable = true; - nmt.script = '' - assertPathNotExists home-files/.config/boxxy - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/boxxy + ''; } diff --git a/tests/modules/programs/boxxy/example-settings.nix b/tests/modules/programs/boxxy/example-settings.nix index a22eb510761e..1f6f2801ef57 100644 --- a/tests/modules/programs/boxxy/example-settings.nix +++ b/tests/modules/programs/boxxy/example-settings.nix @@ -1,27 +1,25 @@ { - config = { - programs.boxxy.enable = true; - programs.boxxy.rules = [ - { - name = "example rule"; - target = "~/Arduino"; - rewrite = "~/.local/share/boxxy"; - mode = "directory"; - only = [ - "arduino" - "Arduino" - ]; - env = { - "ENVIRONMENT_THING" = "some value"; - }; - context = [ "/home/test_user/your_project_repo" ]; - } - ]; + programs.boxxy.enable = true; + programs.boxxy.rules = [ + { + name = "example rule"; + target = "~/Arduino"; + rewrite = "~/.local/share/boxxy"; + mode = "directory"; + only = [ + "arduino" + "Arduino" + ]; + env = { + "ENVIRONMENT_THING" = "some value"; + }; + context = [ "/home/test_user/your_project_repo" ]; + } + ]; - nmt.script = '' - boxxyyaml=home-files/.config/boxxy/boxxy.yaml - assertFileExists $boxxyyaml - assertFileContent $boxxyyaml ${./example-boxxy.yaml} - ''; - }; + nmt.script = '' + boxxyyaml=home-files/.config/boxxy/boxxy.yaml + assertFileExists $boxxyyaml + assertFileContent $boxxyyaml ${./example-boxxy.yaml} + ''; } diff --git a/tests/modules/programs/clock-rs/empty-settings.nix b/tests/modules/programs/clock-rs/empty-settings.nix index fc51bc0ae7b2..47a697945704 100644 --- a/tests/modules/programs/clock-rs/empty-settings.nix +++ b/tests/modules/programs/clock-rs/empty-settings.nix @@ -1,20 +1,18 @@ { pkgs, ... }: { - config = { - programs.clock-rs.enable = true; + programs.clock-rs.enable = true; - tests.stubs.clock-rs = { }; + tests.stubs.clock-rs = { }; - nmt.script = - let - configDir = - if pkgs.stdenv.isDarwin then - "home-files/Library/Application Support/clock-rs" - else - "home-files/.config/clock-rs"; - in - '' - assertPathNotExists "${configDir}/conf.toml" - ''; - }; + nmt.script = + let + configDir = + if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/clock-rs" + else + "home-files/.config/clock-rs"; + in + '' + assertPathNotExists "${configDir}/conf.toml" + ''; } diff --git a/tests/modules/programs/clock-rs/example-settings.nix b/tests/modules/programs/clock-rs/example-settings.nix index df9cad26806f..6f69ac18969e 100644 --- a/tests/modules/programs/clock-rs/example-settings.nix +++ b/tests/modules/programs/clock-rs/example-settings.nix @@ -1,42 +1,40 @@ { pkgs, ... }: { - config = { - programs.clock-rs = { - enable = true; - settings = { - general = { - color = "magenta"; - interval = 250; - blink = true; - bold = true; - }; + programs.clock-rs = { + enable = true; + settings = { + general = { + color = "magenta"; + interval = 250; + blink = true; + bold = true; + }; - position = { - horizontal = "start"; - vertical = "end"; - }; + position = { + horizontal = "start"; + vertical = "end"; + }; - date = { - fmt = "%A, %B %d, %Y"; - use_12h = true; - utc = true; - hide_seconds = true; - }; + date = { + fmt = "%A, %B %d, %Y"; + use_12h = true; + utc = true; + hide_seconds = true; }; }; - - nmt.script = - let - configDir = - if pkgs.stdenv.isDarwin then - "home-files/Library/Application Support/clock-rs" - else - "home-files/.config/clock-rs"; - in - '' - assertFileExists "${configDir}/conf.toml" - assertFileContent "${configDir}/conf.toml" \ - ${./example-settings-expected.toml} - ''; }; + + nmt.script = + let + configDir = + if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/clock-rs" + else + "home-files/.config/clock-rs"; + in + '' + assertFileExists "${configDir}/conf.toml" + assertFileContent "${configDir}/conf.toml" \ + ${./example-settings-expected.toml} + ''; } diff --git a/tests/modules/programs/darcs/author.nix b/tests/modules/programs/darcs/author.nix index 3505bda56f61..e0ee8767b13a 100644 --- a/tests/modules/programs/darcs/author.nix +++ b/tests/modules/programs/darcs/author.nix @@ -1,15 +1,13 @@ { - config = { - programs.darcs = { - enable = true; - author = [ - "Real Person " - "Real Person " - ]; - }; - - nmt.script = '' - assertFileContent home-files/.darcs/author ${./author-expected.txt} - ''; + programs.darcs = { + enable = true; + author = [ + "Real Person " + "Real Person " + ]; }; + + nmt.script = '' + assertFileContent home-files/.darcs/author ${./author-expected.txt} + ''; } diff --git a/tests/modules/programs/darcs/boring.nix b/tests/modules/programs/darcs/boring.nix index db5e2c629ec1..613f934e990b 100644 --- a/tests/modules/programs/darcs/boring.nix +++ b/tests/modules/programs/darcs/boring.nix @@ -1,16 +1,14 @@ { - config = { - programs.darcs = { - enable = true; - boring = [ - "^.idea$" - ".iml$" - "^.stack-work$" - ]; - }; - - nmt.script = '' - assertFileContent home-files/.darcs/boring ${./boring-expected.txt} - ''; + programs.darcs = { + enable = true; + boring = [ + "^.idea$" + ".iml$" + "^.stack-work$" + ]; }; + + nmt.script = '' + assertFileContent home-files/.darcs/boring ${./boring-expected.txt} + ''; } diff --git a/tests/modules/programs/dircolors/settings.nix b/tests/modules/programs/dircolors/settings.nix index 2ac722c53200..4cb5dd6c1de6 100644 --- a/tests/modules/programs/dircolors/settings.nix +++ b/tests/modules/programs/dircolors/settings.nix @@ -1,44 +1,42 @@ { config, pkgs, ... }: { - config = { - programs.zsh.enable = true; - programs.nushell.enable = true; + programs.zsh.enable = true; + programs.nushell.enable = true; - programs.dircolors = { - enable = true; + programs.dircolors = { + enable = true; - settings = { - OTHER_WRITABLE = "30;46"; - ".sh" = "01;32"; - ".csh" = "01;32"; - }; - - extraConfig = '' - # Extra dircolors configuration. - ''; + settings = { + OTHER_WRITABLE = "30;46"; + ".sh" = "01;32"; + ".csh" = "01;32"; }; - nmt.script = - let - nushellConfigDir = - if pkgs.stdenv.isDarwin && !config.xdg.enable then - "home-files/Library/Application Support/nushell" - else - "home-files/.config/nushell"; - in - '' - assertFileContent \ - home-files/.dir_colors \ - ${./settings-expected.conf} + extraConfig = '' + # Extra dircolors configuration. + ''; + }; + + nmt.script = + let + nushellConfigDir = + if pkgs.stdenv.isDarwin && !config.xdg.enable then + "home-files/Library/Application Support/nushell" + else + "home-files/.config/nushell"; + in + '' + assertFileContent \ + home-files/.dir_colors \ + ${./settings-expected.conf} - assertFileRegex \ - home-files/.zshrc \ - "eval \$(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)" + assertFileRegex \ + home-files/.zshrc \ + "eval \$(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)" - assertFileExists "${nushellConfigDir}/env.nu" - assertFileRegex "${nushellConfigDir}/env.nu" \ - "source /nix/store/[^/]*-dircolors.nu" - ''; - }; + assertFileExists "${nushellConfigDir}/env.nu" + assertFileRegex "${nushellConfigDir}/env.nu" \ + "source /nix/store/[^/]*-dircolors.nu" + ''; } diff --git a/tests/modules/programs/dircolors/xdg-config-settings.nix b/tests/modules/programs/dircolors/xdg-config-settings.nix index 6fde1a878403..9ff6bf664d78 100644 --- a/tests/modules/programs/dircolors/xdg-config-settings.nix +++ b/tests/modules/programs/dircolors/xdg-config-settings.nix @@ -1,45 +1,43 @@ { config, pkgs, ... }: { - config = { - home.preferXdgDirectories = true; + home.preferXdgDirectories = true; - programs.zsh.enable = true; - programs.nushell.enable = true; + programs.zsh.enable = true; + programs.nushell.enable = true; - programs.dircolors = { - enable = true; + programs.dircolors = { + enable = true; - settings = { - OTHER_WRITABLE = "30;46"; - ".sh" = "01;32"; - ".csh" = "01;32"; - }; - - extraConfig = '' - # Extra dircolors configuration. - ''; + settings = { + OTHER_WRITABLE = "30;46"; + ".sh" = "01;32"; + ".csh" = "01;32"; }; - nmt.script = - let - nushellConfigDir = - if pkgs.stdenv.isDarwin && !config.xdg.enable then - "home-files/Library/Application Support/nushell" - else - "home-files/.config/nushell"; - in - '' - assertFileContent \ - home-files/.config/dir_colors \ - ${./settings-expected.conf} + extraConfig = '' + # Extra dircolors configuration. + ''; + }; + + nmt.script = + let + nushellConfigDir = + if pkgs.stdenv.isDarwin && !config.xdg.enable then + "home-files/Library/Application Support/nushell" + else + "home-files/.config/nushell"; + in + '' + assertFileContent \ + home-files/.config/dir_colors \ + ${./settings-expected.conf} - assertFileRegex \ - home-files/.zshrc \ - "eval \$(${pkgs.coreutils}/bin/dircolors -b ${config.xdg.configHome}/dir_colors)" + assertFileRegex \ + home-files/.zshrc \ + "eval \$(${pkgs.coreutils}/bin/dircolors -b ${config.xdg.configHome}/dir_colors)" - assertFileExists "${nushellConfigDir}/env.nu" - assertFileRegex "${nushellConfigDir}/env.nu" \ - "source /nix/store/[^/]*-dircolors.nu" - ''; - }; + assertFileExists "${nushellConfigDir}/env.nu" + assertFileRegex "${nushellConfigDir}/env.nu" \ + "source /nix/store/[^/]*-dircolors.nu" + ''; } diff --git a/tests/modules/programs/discocss/basic-configuration.nix b/tests/modules/programs/discocss/basic-configuration.nix index 92a30e81aed1..2eb0bb32c0ba 100644 --- a/tests/modules/programs/discocss/basic-configuration.nix +++ b/tests/modules/programs/discocss/basic-configuration.nix @@ -1,34 +1,32 @@ { - config = { - programs.discocss = { - enable = true; - package = null; + programs.discocss = { + enable = true; + package = null; - discordAlias = false; + discordAlias = false; - css = '' - /* Custom Discord theme */ - .theme-dark { - --background-primary: #2f3136; - --background-secondary: #36393f; - } + css = '' + /* Custom Discord theme */ + .theme-dark { + --background-primary: #2f3136; + --background-secondary: #36393f; + } - .chat-3bRxxu { - background: var(--background-primary); - } + .chat-3bRxxu { + background: var(--background-primary); + } - .content-yTz4x3:before { - content: "Custom CSS Loaded"; - color: #43b581; - } - ''; - }; - - nmt.script = '' - assertFileExists home-files/.config/discocss/custom.css - assertFileContent \ - home-files/.config/discocss/custom.css \ - ${./with-custom-css-expected.css} + .content-yTz4x3:before { + content: "Custom CSS Loaded"; + color: #43b581; + } ''; }; + + nmt.script = '' + assertFileExists home-files/.config/discocss/custom.css + assertFileContent \ + home-files/.config/discocss/custom.css \ + ${./with-custom-css-expected.css} + ''; } diff --git a/tests/modules/programs/discocss/no-css.nix b/tests/modules/programs/discocss/no-css.nix index a5a753ad92ea..5a4b737db0d6 100644 --- a/tests/modules/programs/discocss/no-css.nix +++ b/tests/modules/programs/discocss/no-css.nix @@ -1,12 +1,10 @@ { - config = { - programs.discocss = { - enable = true; - discordAlias = false; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/discocss/custom.css - ''; + programs.discocss = { + enable = true; + discordAlias = false; }; + + nmt.script = '' + assertPathNotExists home-files/.config/discocss/custom.css + ''; } diff --git a/tests/modules/programs/discocss/no-packages.nix b/tests/modules/programs/discocss/no-packages.nix index 62c1d1077f51..8d85029fbba8 100644 --- a/tests/modules/programs/discocss/no-packages.nix +++ b/tests/modules/programs/discocss/no-packages.nix @@ -1,34 +1,32 @@ { - config = { - programs.discocss = { - enable = true; - package = null; - discordPackage = null; - discordAlias = false; + programs.discocss = { + enable = true; + package = null; + discordPackage = null; + discordAlias = false; - css = '' - /* Custom Discord theme */ - .theme-dark { - --background-primary: #2f3136; - --background-secondary: #36393f; - } + css = '' + /* Custom Discord theme */ + .theme-dark { + --background-primary: #2f3136; + --background-secondary: #36393f; + } - .chat-3bRxxu { - background: var(--background-primary); - } + .chat-3bRxxu { + background: var(--background-primary); + } - .content-yTz4x3:before { - content: "Custom CSS Loaded"; - color: #43b581; - } - ''; - }; - - nmt.script = '' - assertFileExists home-files/.config/discocss/custom.css - assertFileContent \ - home-files/.config/discocss/custom.css \ - ${./with-custom-css-expected.css} + .content-yTz4x3:before { + content: "Custom CSS Loaded"; + color: #43b581; + } ''; }; + + nmt.script = '' + assertFileExists home-files/.config/discocss/custom.css + assertFileContent \ + home-files/.config/discocss/custom.css \ + ${./with-custom-css-expected.css} + ''; } diff --git a/tests/modules/programs/eww/basic-config.nix b/tests/modules/programs/eww/basic-config.nix index 30059d4f1bb4..90d23af8e521 100644 --- a/tests/modules/programs/eww/basic-config.nix +++ b/tests/modules/programs/eww/basic-config.nix @@ -1,15 +1,13 @@ { - config = { - programs.eww = { - enable = true; - configDir = ./config-dir; - }; + programs.eww = { + enable = true; + configDir = ./config-dir; + }; - nmt.script = '' - yuckDir=home-files/.config/eww + nmt.script = '' + yuckDir=home-files/.config/eww - assertFileExists $yuckDir/eww.yuck - assertFileExists $yuckDir/eww.scss - ''; - }; + assertFileExists $yuckDir/eww.yuck + assertFileExists $yuckDir/eww.scss + ''; } diff --git a/tests/modules/programs/eww/null-config.nix b/tests/modules/programs/eww/null-config.nix index a26b84bd45c8..a56795ce87f1 100644 --- a/tests/modules/programs/eww/null-config.nix +++ b/tests/modules/programs/eww/null-config.nix @@ -1,13 +1,11 @@ { - config = { - programs.eww = { - enable = true; - }; + programs.eww = { + enable = true; + }; - nmt.script = '' - yuckDir=home-files/.config/eww + nmt.script = '' + yuckDir=home-files/.config/eww - assertPathNotExists $yuckDir/eww.yuck - ''; - }; + assertPathNotExists $yuckDir/eww.yuck + ''; } diff --git a/tests/modules/programs/fish/abbrs.nix b/tests/modules/programs/fish/abbrs.nix index 1df452f6816e..e6c41f85ebd8 100644 --- a/tests/modules/programs/fish/abbrs.nix +++ b/tests/modules/programs/fish/abbrs.nix @@ -1,86 +1,84 @@ { - config = { - programs.fish = { - enable = true; + programs.fish = { + enable = true; - shellAbbrs = { - l = "less"; - gco = "git checkout"; - "-C" = { - position = "anywhere"; - expansion = "--color"; - }; - L = { - position = "anywhere"; - setCursor = true; - expansion = "% | less"; - }; - "!!" = { - position = "anywhere"; - function = "last_history_item"; - }; - vim_edit_texts = { - position = "command"; - regex = ".+\\.txt"; - function = "vim_edit"; - }; - "4DIRS" = { - setCursor = "!"; - expansion = '' - for dir in */ - cd $dir - ! - cd .. - end - ''; - }; - co = { - command = "git"; - expansion = "checkout"; - }; - s = { - command = [ - "git" - "hg" - ]; - expansion = "status"; - }; - dotdot = { - regex = "^\\.\\.+$"; - function = "multicd"; - }; + shellAbbrs = { + l = "less"; + gco = "git checkout"; + "-C" = { + position = "anywhere"; + expansion = "--color"; + }; + L = { + position = "anywhere"; + setCursor = true; + expansion = "% | less"; + }; + "!!" = { + position = "anywhere"; + function = "last_history_item"; + }; + vim_edit_texts = { + position = "command"; + regex = ".+\\.txt"; + function = "vim_edit"; + }; + "4DIRS" = { + setCursor = "!"; + expansion = '' + for dir in */ + cd $dir + ! + cd .. + end + ''; + }; + co = { + command = "git"; + expansion = "checkout"; + }; + s = { + command = [ + "git" + "hg" + ]; + expansion = "status"; + }; + dotdot = { + regex = "^\\.\\.+$"; + function = "multicd"; }; }; + }; - nmt = { - description = "if fish.shellAbbrs is set, check fish.config contains valid abbreviations"; - script = '' - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add -- l less" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add -- gco 'git checkout'" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --position anywhere -- -C --color" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --position anywhere --set-cursor -- L '% | less'" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --function last_history_item --position anywhere -- !!" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --function vim_edit --position command --regex '.+\.txt' -- vim_edit_texts" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add '--set-cursor=!' -- 4DIRS 'for dir in */ - cd \$dir - ! - cd .. - end - '" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --command git -- co checkout" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --command git --command hg -- s status" - assertFileContains home-files/.config/fish/config.fish \ - "abbr --add --function multicd --regex '^\.\.+$' -- dotdot" - ''; - }; + nmt = { + description = "if fish.shellAbbrs is set, check fish.config contains valid abbreviations"; + script = '' + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add -- l less" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add -- gco 'git checkout'" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --position anywhere -- -C --color" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --position anywhere --set-cursor -- L '% | less'" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --function last_history_item --position anywhere -- !!" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --function vim_edit --position command --regex '.+\.txt' -- vim_edit_texts" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add '--set-cursor=!' -- 4DIRS 'for dir in */ + cd \$dir + ! + cd .. + end + '" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --command git -- co checkout" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --command git --command hg -- s status" + assertFileContains home-files/.config/fish/config.fish \ + "abbr --add --function multicd --regex '^\.\.+$' -- dotdot" + ''; }; } diff --git a/tests/modules/programs/fish/binds.nix b/tests/modules/programs/fish/binds.nix index 99c93e74bc3e..57540f6a8b72 100644 --- a/tests/modules/programs/fish/binds.nix +++ b/tests/modules/programs/fish/binds.nix @@ -1,54 +1,52 @@ { lib, ... }: { - config = { - programs.fish = { - enable = true; + programs.fish = { + enable = true; - binds = { - "ctrl-d".command = "exit"; + binds = { + "ctrl-d".command = "exit"; - "ctrl-c" = { - mode = "insert"; - command = [ - "kill-whole-line" - "repaint" - ]; - }; - - "ctrl-g" = { - command = [ - "git diff" - "repaint" - ]; - }; + "ctrl-c" = { + mode = "insert"; + command = [ + "kill-whole-line" + "repaint" + ]; + }; - "alt-s".erase = true; - "alt-s".operate = "preset"; - "alt-s".command = "fish_commandline_prepend sudo"; + "ctrl-g" = { + command = [ + "git diff" + "repaint" + ]; }; + + "alt-s".erase = true; + "alt-s".operate = "preset"; + "alt-s".command = "fish_commandline_prepend sudo"; }; + }; - # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( - builtins.toFile "empty" "" - ); + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); - nmt = { - description = "if fish.binds is set, check function exists and contains valid binds"; - script = '' - assertFileExists home-files/.config/fish/functions/fish_user_key_bindings.fish + nmt = { + description = "if fish.binds is set, check function exists and contains valid binds"; + script = '' + assertFileExists home-files/.config/fish/functions/fish_user_key_bindings.fish - assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ - "bind ctrl-d exit" - assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ - "bind --mode insert ctrl-c kill-whole-line repaint" - assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ - "bind ctrl-g 'git diff' repaint" - assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ - "bind -e --preset alt-s" - assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ - "bind --preset alt-s 'fish_commandline_prepend sudo" - ''; - }; + assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ + "bind ctrl-d exit" + assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ + "bind --mode insert ctrl-c kill-whole-line repaint" + assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ + "bind ctrl-g 'git diff' repaint" + assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ + "bind -e --preset alt-s" + assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ + "bind --preset alt-s 'fish_commandline_prepend sudo" + ''; }; } diff --git a/tests/modules/programs/fish/format-scripts.nix b/tests/modules/programs/fish/format-scripts.nix index cbb0a9d29590..5585a3853007 100644 --- a/tests/modules/programs/fish/format-scripts.nix +++ b/tests/modules/programs/fish/format-scripts.nix @@ -20,32 +20,30 @@ let in { - config = { - programs.fish = { - enable = true; - - formatFishScripts = true; - - functions = { - func = ''echo "foo"''; - func-multi = '' - echo bar - if foo - bar - baz - end - ''; - }; - }; + programs.fish = { + enable = true; - nmt.script = '' - assertFileExists home-files/.config/fish/functions/func.fish - echo ${expectedFunc} - assertFileContent home-files/.config/fish/functions/func.fish ${expectedFunc} + formatFishScripts = true; - assertFileExists home-files/.config/fish/functions/func-multi.fish - echo ${expectedFuncMulti} - assertFileContent home-files/.config/fish/functions/func-multi.fish ${expectedFuncMulti} - ''; + functions = { + func = ''echo "foo"''; + func-multi = '' + echo bar + if foo + bar + baz + end + ''; + }; }; + + nmt.script = '' + assertFileExists home-files/.config/fish/functions/func.fish + echo ${expectedFunc} + assertFileContent home-files/.config/fish/functions/func.fish ${expectedFunc} + + assertFileExists home-files/.config/fish/functions/func-multi.fish + echo ${expectedFuncMulti} + assertFileContent home-files/.config/fish/functions/func-multi.fish ${expectedFuncMulti} + ''; } diff --git a/tests/modules/programs/fish/functions.nix b/tests/modules/programs/fish/functions.nix index 4953246a288d..fddc7318f064 100644 --- a/tests/modules/programs/fish/functions.nix +++ b/tests/modules/programs/fish/functions.nix @@ -15,36 +15,34 @@ let in { - config = { - programs.fish = { - enable = true; - - functions = { - func = ''echo "Hello"''; - func-event = { - body = ''echo "Not found!"''; - onEvent = "fish_command_not_found"; - }; + programs.fish = { + enable = true; + + functions = { + func = ''echo "Hello"''; + func-event = { + body = ''echo "Not found!"''; + onEvent = "fish_command_not_found"; }; }; + }; - # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( - builtins.toFile "empty" "" - ); + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); - nmt = { - description = "if fish.function is set, check file exists and contents match"; - script = '' - assertFileExists home-files/.config/fish/functions/func.fish - echo ${func} - assertFileContent home-files/.config/fish/functions/func.fish ${func} + nmt = { + description = "if fish.function is set, check file exists and contents match"; + script = '' + assertFileExists home-files/.config/fish/functions/func.fish + echo ${func} + assertFileContent home-files/.config/fish/functions/func.fish ${func} - assertFileExists home-files/.config/fish/functions/func-event.fish - echo ${funcEvent} - assertFileContent home-files/.config/fish/functions/func-event.fish ${funcEvent} - ''; + assertFileExists home-files/.config/fish/functions/func-event.fish + echo ${funcEvent} + assertFileContent home-files/.config/fish/functions/func-event.fish ${funcEvent} + ''; - }; }; } diff --git a/tests/modules/programs/fish/manpage.nix b/tests/modules/programs/fish/manpage.nix index 50916cefa7ab..dc98a874a98c 100644 --- a/tests/modules/programs/fish/manpage.nix +++ b/tests/modules/programs/fish/manpage.nix @@ -1,15 +1,13 @@ { pkgs, ... }: { - config = { - programs.fish = { - enable = true; - }; - - home.packages = [ - (pkgs.runCommand "manpage-with-space" { } '' - mkdir -p $out/share/man/man1 - echo "It works!" >"$out/share/man/man1/hello -inject.1" - '') - ]; + programs.fish = { + enable = true; }; + + home.packages = [ + (pkgs.runCommand "manpage-with-space" { } '' + mkdir -p $out/share/man/man1 + echo "It works!" >"$out/share/man/man1/hello -inject.1" + '') + ]; } diff --git a/tests/modules/programs/fish/no-functions.nix b/tests/modules/programs/fish/no-functions.nix index f42c677fcab7..5cca5273a63a 100644 --- a/tests/modules/programs/fish/no-functions.nix +++ b/tests/modules/programs/fish/no-functions.nix @@ -1,23 +1,21 @@ { lib, ... }: { - config = { - programs.fish = { - enable = true; + programs.fish = { + enable = true; - functions = { }; - }; + functions = { }; + }; - # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( - builtins.toFile "empty" "" - ); + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); - nmt = { - description = "if fish.functions is blank, the functions folder should not exist."; - script = '' - assertPathNotExists home-files/.config/fish/functions - ''; + nmt = { + description = "if fish.functions is blank, the functions folder should not exist."; + script = '' + assertPathNotExists home-files/.config/fish/functions + ''; - }; }; } diff --git a/tests/modules/programs/fish/plugins.nix b/tests/modules/programs/fish/plugins.nix index a5d75842f4a8..1762205c350e 100644 --- a/tests/modules/programs/fish/plugins.nix +++ b/tests/modules/programs/fish/plugins.nix @@ -34,31 +34,29 @@ let in { - config = { - programs.fish = { - enable = true; - - plugins = [ - { - name = "foo"; - src = fooPluginSrc; - } - ]; - }; + programs.fish = { + enable = true; + + plugins = [ + { + name = "foo"; + src = fooPluginSrc; + } + ]; + }; - # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( - builtins.toFile "empty" "" - ); + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); - nmt = { - description = "if fish.plugins set, check conf.d file exists and contents match"; - script = '' - assertDirectoryExists home-files/.config/fish/conf.d - assertFileExists home-files/.config/fish/conf.d/plugin-foo.fish - assertFileContent home-files/.config/fish/conf.d/plugin-foo.fish ${generatedConfdFile} - ''; + nmt = { + description = "if fish.plugins set, check conf.d file exists and contents match"; + script = '' + assertDirectoryExists home-files/.config/fish/conf.d + assertFileExists home-files/.config/fish/conf.d/plugin-foo.fish + assertFileContent home-files/.config/fish/conf.d/plugin-foo.fish ${generatedConfdFile} + ''; - }; }; } diff --git a/tests/modules/programs/gcc/basic-configuration.nix b/tests/modules/programs/gcc/basic-configuration.nix index 50b3e5c670c5..c7e3db2fb523 100644 --- a/tests/modules/programs/gcc/basic-configuration.nix +++ b/tests/modules/programs/gcc/basic-configuration.nix @@ -1,13 +1,11 @@ { - config = { - programs.gcc = { - enable = true; - }; - - nmt.script = '' - # Verify no GCC_COLORS environment variable is set when colors is empty - hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh - assertFileNotRegex $hmEnvFile 'GCC_COLORS' - ''; + programs.gcc = { + enable = true; }; + + nmt.script = '' + # Verify no GCC_COLORS environment variable is set when colors is empty + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileNotRegex $hmEnvFile 'GCC_COLORS' + ''; } diff --git a/tests/modules/programs/gcc/with-colors.nix b/tests/modules/programs/gcc/with-colors.nix index 2a9d543f24ae..33e74627d3b8 100644 --- a/tests/modules/programs/gcc/with-colors.nix +++ b/tests/modules/programs/gcc/with-colors.nix @@ -1,21 +1,19 @@ { - config = { - programs.gcc = { - enable = true; - colors = { - error = "01;31"; - warning = "01;33"; - note = "01;36"; - caret = "01;32"; - locus = "01"; - quote = "01"; - }; + programs.gcc = { + enable = true; + colors = { + error = "01;31"; + warning = "01;33"; + note = "01;36"; + caret = "01;32"; + locus = "01"; + quote = "01"; }; - - nmt.script = '' - hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh - assertFileExists $hmEnvFile - assertFileRegex $hmEnvFile 'export GCC_COLORS="caret=01;32:error=01;31:locus=01:note=01;36:quote=01:warning=01;33"' - ''; }; + + nmt.script = '' + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileExists $hmEnvFile + assertFileRegex $hmEnvFile 'export GCC_COLORS="caret=01;32:error=01;31:locus=01:note=01;36:quote=01:warning=01;33"' + ''; } diff --git a/tests/modules/programs/git/git-with-signing-key-id-legacy.nix b/tests/modules/programs/git/git-with-signing-key-id-legacy.nix index 984324e17449..e5406633c707 100644 --- a/tests/modules/programs/git/git-with-signing-key-id-legacy.nix +++ b/tests/modules/programs/git/git-with-signing-key-id-legacy.nix @@ -1,29 +1,27 @@ { lib, options, ... }: { - config = { - programs.git = { - enable = true; - settings = { - user = { - name = "John Doe"; - email = "user@example.org"; - }; + programs.git = { + enable = true; + settings = { + user = { + name = "John Doe"; + email = "user@example.org"; }; + }; - signing = { - gpgPath = "path-to-gpg"; - key = "00112233445566778899AABBCCDDEEFF"; - signByDefault = true; - }; + signing = { + gpgPath = "path-to-gpg"; + key = "00112233445566778899AABBCCDDEEFF"; + signByDefault = true; }; + }; - test.asserts.warnings.expected = [ - "The option `programs.git.signing.gpgPath' defined in ${lib.showFiles options.programs.git.signing.gpgPath.files} has been renamed to `programs.git.signing.signer'." - ]; + test.asserts.warnings.expected = [ + "The option `programs.git.signing.gpgPath' defined in ${lib.showFiles options.programs.git.signing.gpgPath.files} has been renamed to `programs.git.signing.signer'." + ]; - nmt.script = '' - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${./git-with-signing-key-id-legacy-expected.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config ${./git-with-signing-key-id-legacy-expected.conf} + ''; } diff --git a/tests/modules/programs/gpg/override-defaults.nix b/tests/modules/programs/gpg/override-defaults.nix index 0dc5d3dc6405..31a885f0d37e 100644 --- a/tests/modules/programs/gpg/override-defaults.nix +++ b/tests/modules/programs/gpg/override-defaults.nix @@ -1,27 +1,25 @@ { config, ... }: { - config = { - programs.gpg = { - enable = true; + programs.gpg = { + enable = true; - settings = { - no-comments = false; - s2k-cipher-algo = "AES128"; - throw-keyids = true; - trusted-key = [ - "0xXXXXXXXXXXXXX" - "0xYYYYYYYYYYYYY" - ]; - }; - - homedir = "${config.home.homeDirectory}/bar/foopg"; + settings = { + no-comments = false; + s2k-cipher-algo = "AES128"; + throw-keyids = true; + trusted-key = [ + "0xXXXXXXXXXXXXX" + "0xYYYYYYYYYYYYY" + ]; }; - nmt.script = '' - assertFileExists home-files/bar/foopg/gpg.conf - assertFileContent home-files/bar/foopg/gpg.conf ${./override-defaults-expected.conf} - - assertFileNotRegex activate "^unset GNUPGHOME keyId importTrust$" - ''; + homedir = "${config.home.homeDirectory}/bar/foopg"; }; + + nmt.script = '' + assertFileExists home-files/bar/foopg/gpg.conf + assertFileContent home-files/bar/foopg/gpg.conf ${./override-defaults-expected.conf} + + assertFileNotRegex activate "^unset GNUPGHOME keyId importTrust$" + ''; } diff --git a/tests/modules/programs/grep/basic-configuration.nix b/tests/modules/programs/grep/basic-configuration.nix index 845b02ccaf3d..72b0f31bbc41 100644 --- a/tests/modules/programs/grep/basic-configuration.nix +++ b/tests/modules/programs/grep/basic-configuration.nix @@ -1,13 +1,11 @@ { - config = { - programs.grep = { - enable = true; - }; - - nmt.script = '' - # Verify no GREP_COLORS environment variable is set when colors is empty - hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh - assertFileNotRegex $hmEnvFile 'GCC_COLORS' - ''; + programs.grep = { + enable = true; }; + + nmt.script = '' + # Verify no GREP_COLORS environment variable is set when colors is empty + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileNotRegex $hmEnvFile 'GCC_COLORS' + ''; } diff --git a/tests/modules/programs/grep/with-colors.nix b/tests/modules/programs/grep/with-colors.nix index a76c58e1b49b..a3c39bf7223b 100644 --- a/tests/modules/programs/grep/with-colors.nix +++ b/tests/modules/programs/grep/with-colors.nix @@ -1,17 +1,15 @@ { - config = { - programs.grep = { - enable = true; - colors = { - error = "01;31"; - match = "01;32"; - }; + programs.grep = { + enable = true; + colors = { + error = "01;31"; + match = "01;32"; }; - - nmt.script = '' - # Check that grep colors are set in session variables - assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ - 'export GREP_COLORS="error=01;31:match=01;32"' - ''; }; + + nmt.script = '' + # Check that grep colors are set in session variables + assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ + 'export GREP_COLORS="error=01;31:match=01;32"' + ''; } diff --git a/tests/modules/programs/htop/example-settings.nix b/tests/modules/programs/htop/example-settings.nix index 5eedfbf5cad4..05f4ea4fac83 100644 --- a/tests/modules/programs/htop/example-settings.nix +++ b/tests/modules/programs/htop/example-settings.nix @@ -1,53 +1,51 @@ { config, ... }: { - config = { - programs.htop.enable = true; - programs.htop.settings = { - color_scheme = 6; - cpu_count_from_one = 0; - delay = 15; - fields = with config.lib.htop.fields; [ - PID - USER - PRIORITY - NICE - M_SIZE - M_RESIDENT - M_SHARE - STATE - PERCENT_CPU - PERCENT_MEM - TIME - COMM - ]; - highlight_base_name = 1; - highlight_megabytes = 1; - highlight_threads = 1; - } - // ( - with config.lib.htop; - leftMeters [ - (bar "AllCPUs2") - (bar "Memory") - (bar "Swap") - (text "Zram") - ] - ) - // ( - with config.lib.htop; - rightMeters [ - (text "Tasks") - (text "LoadAverage") - (text "Uptime") - (text "Systemd") - ] - ); + programs.htop.enable = true; + programs.htop.settings = { + color_scheme = 6; + cpu_count_from_one = 0; + delay = 15; + fields = with config.lib.htop.fields; [ + PID + USER + PRIORITY + NICE + M_SIZE + M_RESIDENT + M_SHARE + STATE + PERCENT_CPU + PERCENT_MEM + TIME + COMM + ]; + highlight_base_name = 1; + highlight_megabytes = 1; + highlight_threads = 1; + } + // ( + with config.lib.htop; + leftMeters [ + (bar "AllCPUs2") + (bar "Memory") + (bar "Swap") + (text "Zram") + ] + ) + // ( + with config.lib.htop; + rightMeters [ + (text "Tasks") + (text "LoadAverage") + (text "Uptime") + (text "Systemd") + ] + ); - nmt.script = '' - htoprc=home-files/.config/htop/htoprc - assertFileExists $htoprc - assertFileContent $htoprc ${./example-htoprc.txt} - ''; - }; + nmt.script = '' + htoprc=home-files/.config/htop/htoprc + assertFileExists $htoprc + assertFileContent $htoprc ${./example-htoprc.txt} + ''; } diff --git a/tests/modules/programs/htop/settings-without-fields.nix b/tests/modules/programs/htop/settings-without-fields.nix index 0221b5ef72a3..9d071f1a489e 100644 --- a/tests/modules/programs/htop/settings-without-fields.nix +++ b/tests/modules/programs/htop/settings-without-fields.nix @@ -1,31 +1,28 @@ { pkgs, ... }: { - config = { - programs.htop.enable = true; - programs.htop.settings = { - color_scheme = 6; - }; - - # Test that the 'fields' key is written in addition to the customized - # settings or htop won't read the options. - nmt.script = - let - fields = - if pkgs.stdenv.hostPlatform.isDarwin then - "0 48 17 18 38 39 2 46 47 49 1" - else - "0 48 17 18 38 39 40 2 46 47 49 1"; - in - '' - htoprc=home-files/.config/htop/htoprc - assertFileExists $htoprc - assertFileContent $htoprc \ - ${builtins.toFile "htoprc-expected" '' - color_scheme=6 - fields=${fields} - ''} - ''; + programs.htop.enable = true; + programs.htop.settings = { + color_scheme = 6; }; + # Test that the 'fields' key is written in addition to the customized + # settings or htop won't read the options. + nmt.script = + let + fields = + if pkgs.stdenv.hostPlatform.isDarwin then + "0 48 17 18 38 39 2 46 47 49 1" + else + "0 48 17 18 38 39 40 2 46 47 49 1"; + in + '' + htoprc=home-files/.config/htop/htoprc + assertFileExists $htoprc + assertFileContent $htoprc \ + ${builtins.toFile "htoprc-expected" '' + color_scheme=6 + fields=${fields} + ''} + ''; } diff --git a/tests/modules/programs/hyprshot/basic-configuration.nix b/tests/modules/programs/hyprshot/basic-configuration.nix index c0521998c9a1..ed063cb4cefa 100644 --- a/tests/modules/programs/hyprshot/basic-configuration.nix +++ b/tests/modules/programs/hyprshot/basic-configuration.nix @@ -1,13 +1,11 @@ { - config = { - programs.hyprshot = { - enable = true; - saveLocation = "dummy"; - }; - - nmt.script = '' - assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ - 'export HYPRSHOT_DIR="dummy"' - ''; + programs.hyprshot = { + enable = true; + saveLocation = "dummy"; }; + + nmt.script = '' + assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ + 'export HYPRSHOT_DIR="dummy"' + ''; } diff --git a/tests/modules/programs/i3blocks/with-ordered-blocks.nix b/tests/modules/programs/i3blocks/with-ordered-blocks.nix index 5925e595d3f6..43d4e03dcf2e 100644 --- a/tests/modules/programs/i3blocks/with-ordered-blocks.nix +++ b/tests/modules/programs/i3blocks/with-ordered-blocks.nix @@ -16,47 +16,45 @@ let ''; in { - config = { - programs.i3blocks = { - enable = true; - package = config.lib.test.mkStubPackage { }; - bars = { - bar1 = { - block1first = { - command = "echo first"; - interval = 1; - }; - block2third = lib.hm.dag.entryAfter [ "block3second" ] { - command = "echo third"; - interval = 3; - }; - block3second = lib.hm.dag.entryAfter [ "block1first" ] { - command = "echo second"; - interval = 2; - }; + programs.i3blocks = { + enable = true; + package = config.lib.test.mkStubPackage { }; + bars = { + bar1 = { + block1first = { + command = "echo first"; + interval = 1; }; - bar2 = { - block1first = { - command = "echo first"; - interval = 1; - }; - block2third = lib.hm.dag.entryAfter [ "block3second" ] { - command = "echo third"; - interval = 3; - }; - block3second = lib.hm.dag.entryAfter [ "block1first" ] { - command = "echo second"; - interval = 2; - }; + block2third = lib.hm.dag.entryAfter [ "block3second" ] { + command = "echo third"; + interval = 3; + }; + block3second = lib.hm.dag.entryAfter [ "block1first" ] { + command = "echo second"; + interval = 2; + }; + }; + bar2 = { + block1first = { + command = "echo first"; + interval = 1; + }; + block2third = lib.hm.dag.entryAfter [ "block3second" ] { + command = "echo third"; + interval = 3; + }; + block3second = lib.hm.dag.entryAfter [ "block1first" ] { + command = "echo second"; + interval = 2; }; }; }; - - nmt.script = '' - assertFileExists home-files/.config/i3blocks/bar1 - assertFileExists home-files/.config/i3blocks/bar2 - assertFileContent home-files/.config/i3blocks/bar1 ${expectedConfig} - assertFileContent home-files/.config/i3blocks/bar2 ${expectedConfig} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/i3blocks/bar1 + assertFileExists home-files/.config/i3blocks/bar2 + assertFileContent home-files/.config/i3blocks/bar1 ${expectedConfig} + assertFileContent home-files/.config/i3blocks/bar2 ${expectedConfig} + ''; } diff --git a/tests/modules/programs/i3status-rust/with-custom.nix b/tests/modules/programs/i3status-rust/with-custom.nix index e76ec77a6ef7..f7c6ecbf8846 100644 --- a/tests/modules/programs/i3status-rust/with-custom.nix +++ b/tests/modules/programs/i3status-rust/with-custom.nix @@ -4,201 +4,199 @@ }: { - config = { - programs.i3status-rust = { - enable = true; - bars = { - custom = { - blocks = [ - { - block = "disk_space"; - path = "/"; - info_type = "available"; - interval = 60; - warning = 20.0; - alert = 10.0; - } - { - block = "memory"; - display_type = "memory"; - format_mem = "{Mug}GB ({Mup}%)"; - format_swap = "{SUp}%"; - } - { - block = "cpu"; - interval = 1; - format = " $icon $barchart "; - } - { - block = "load"; - interval = 1; - format = " $icon $1m $5m "; - } - { - block = "temperature"; - interval = 10; - format = "$icon $min min, $max max, $average avg"; - chip = "*-isa-*"; - } - { - block = "net"; - device = "enp9s0u2u1u2c2"; - interval = 5; - } - { - block = "speedtest"; - format = " ^icon_ping $ping "; - } - { - block = "xrandr"; - interval = 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 - } - { - block = "sound"; - format = "{output_name} {volume}%"; - click = [ - { - button = "left"; - cmd = "pavucontrol --tab=3"; - } - ]; - mappings = { - "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; - "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; - }; - } - { - block = "music"; - player = "spotify"; - buttons = [ - "play" - "prev" - "next" - ]; - click = [ - { - button = "play"; - action = "music_play"; - } - { - button = "prev"; - action = "music_prev"; - } - { - button = "next"; - action = "music_next"; - } - ]; - } - { - block = "time"; - interval = 60; - format = " $timestamp.datetime(f:'%a %d/%m %R') "; - } - { block = "battery"; } - ]; - - icons = "awesome5"; - - theme = "gruvbox-dark"; - }; + programs.i3status-rust = { + enable = true; + bars = { + custom = { + blocks = [ + { + block = "disk_space"; + path = "/"; + info_type = "available"; + interval = 60; + warning = 20.0; + alert = 10.0; + } + { + block = "memory"; + display_type = "memory"; + format_mem = "{Mug}GB ({Mup}%)"; + format_swap = "{SUp}%"; + } + { + block = "cpu"; + interval = 1; + format = " $icon $barchart "; + } + { + block = "load"; + interval = 1; + format = " $icon $1m $5m "; + } + { + block = "temperature"; + interval = 10; + format = "$icon $min min, $max max, $average avg"; + chip = "*-isa-*"; + } + { + block = "net"; + device = "enp9s0u2u1u2c2"; + interval = 5; + } + { + block = "speedtest"; + format = " ^icon_ping $ping "; + } + { + block = "xrandr"; + interval = 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 + } + { + block = "sound"; + format = "{output_name} {volume}%"; + click = [ + { + button = "left"; + cmd = "pavucontrol --tab=3"; + } + ]; + mappings = { + "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; + "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; + }; + } + { + block = "music"; + player = "spotify"; + buttons = [ + "play" + "prev" + "next" + ]; + click = [ + { + button = "play"; + action = "music_play"; + } + { + button = "prev"; + action = "music_prev"; + } + { + button = "next"; + action = "music_next"; + } + ]; + } + { + block = "time"; + interval = 60; + format = " $timestamp.datetime(f:'%a %d/%m %R') "; + } + { block = "battery"; } + ]; + + icons = "awesome5"; + + theme = "gruvbox-dark"; }; }; + }; - test.stubs.i3status-rust = { - version = "0.30.0"; - }; - - nmt.script = '' - assertFileExists home-files/.config/i3status-rust/config-custom.toml - assertFileContent home-files/.config/i3status-rust/config-custom.toml \ - ${pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 - - [[block]] - block = "memory" - display_type = "memory" - format_mem = "{Mug}GB ({Mup}%)" - format_swap = "{SUp}%" - - [[block]] - block = "cpu" - format = " $icon $barchart " - interval = 1 - - [[block]] - block = "load" - format = " $icon $1m $5m " - interval = 1 - - [[block]] - block = "temperature" - chip = "*-isa-*" - format = "$icon $min min, $max max, $average avg" - interval = 10 - - [[block]] - block = "net" - device = "enp9s0u2u1u2c2" - interval = 5 - - [[block]] - block = "speedtest" - format = " ^icon_ping $ping " - - [[block]] - block = "xrandr" - interval = 6000 - - [[block]] - block = "sound" - format = "{output_name} {volume}%" - - [[block.click]] - button = "left" - cmd = "pavucontrol --tab=3" - - [block.mappings] - "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" - "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" - - [[block]] - block = "music" - buttons = ["play", "prev", "next"] - player = "spotify" - - [[block.click]] - action = "music_play" - button = "play" - - [[block.click]] - action = "music_prev" - button = "prev" - - [[block.click]] - action = "music_next" - button = "next" - - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 - - [[block]] - block = "battery" - - [icons] - icons = "awesome5" - - [theme] - theme = "gruvbox-dark" - ''} - ''; + test.stubs.i3status-rust = { + version = "0.30.0"; }; + + nmt.script = '' + assertFileExists home-files/.config/i3status-rust/config-custom.toml + assertFileContent home-files/.config/i3status-rust/config-custom.toml \ + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 + + [[block]] + block = "memory" + display_type = "memory" + format_mem = "{Mug}GB ({Mup}%)" + format_swap = "{SUp}%" + + [[block]] + block = "cpu" + format = " $icon $barchart " + interval = 1 + + [[block]] + block = "load" + format = " $icon $1m $5m " + interval = 1 + + [[block]] + block = "temperature" + chip = "*-isa-*" + format = "$icon $min min, $max max, $average avg" + interval = 10 + + [[block]] + block = "net" + device = "enp9s0u2u1u2c2" + interval = 5 + + [[block]] + block = "speedtest" + format = " ^icon_ping $ping " + + [[block]] + block = "xrandr" + interval = 6000 + + [[block]] + block = "sound" + format = "{output_name} {volume}%" + + [[block.click]] + button = "left" + cmd = "pavucontrol --tab=3" + + [block.mappings] + "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" + "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" + + [[block]] + block = "music" + buttons = ["play", "prev", "next"] + player = "spotify" + + [[block.click]] + action = "music_play" + button = "play" + + [[block.click]] + action = "music_prev" + button = "prev" + + [[block.click]] + action = "music_next" + button = "next" + + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 + + [[block]] + block = "battery" + + [icons] + icons = "awesome5" + + [theme] + theme = "gruvbox-dark" + ''} + ''; } diff --git a/tests/modules/programs/i3status-rust/with-default.nix b/tests/modules/programs/i3status-rust/with-default.nix index 64146f11c165..ca958ad990e9 100644 --- a/tests/modules/programs/i3status-rust/with-default.nix +++ b/tests/modules/programs/i3status-rust/with-default.nix @@ -4,55 +4,53 @@ }: { - config = { - programs.i3status-rust = { - enable = true; - }; - - test.stubs.i3status-rust = { - version = "0.31.2"; - }; - - nmt.script = '' - assertFileExists home-files/.config/i3status-rust/config-default.toml - assertFileContent home-files/.config/i3status-rust/config-default.toml \ - ${pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 - - [[block]] - block = "memory" - format = " $icon mem_used_percents " - format_alt = " $icon $swap_used_percents " - - [[block]] - block = "cpu" - interval = 1 - - [[block]] - block = "load" - format = " $icon $1m " - interval = 1 - - [[block]] - block = "sound" - - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 - - [icons] - icons = "none" - - [theme] - theme = "plain" - ''} - ''; + programs.i3status-rust = { + enable = true; }; + + test.stubs.i3status-rust = { + version = "0.31.2"; + }; + + nmt.script = '' + assertFileExists home-files/.config/i3status-rust/config-default.toml + assertFileContent home-files/.config/i3status-rust/config-default.toml \ + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 + + [[block]] + block = "memory" + format = " $icon mem_used_percents " + format_alt = " $icon $swap_used_percents " + + [[block]] + block = "cpu" + interval = 1 + + [[block]] + block = "load" + format = " $icon $1m " + interval = 1 + + [[block]] + block = "sound" + + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 + + [icons] + icons = "none" + + [theme] + theme = "plain" + ''} + ''; } diff --git a/tests/modules/programs/i3status-rust/with-extra-settings.nix b/tests/modules/programs/i3status-rust/with-extra-settings.nix index 5ac2ea555f64..0ac4e48e6490 100644 --- a/tests/modules/programs/i3status-rust/with-extra-settings.nix +++ b/tests/modules/programs/i3status-rust/with-extra-settings.nix @@ -4,215 +4,213 @@ }: { - config = { - programs.i3status-rust = { - enable = true; - bars = { - extra-settings = { - blocks = [ - { - block = "disk_space"; - path = "/"; - info_type = "available"; - interval = 60; - warning = 20.0; - alert = 10.0; - } - { - block = "memory"; - display_type = "memory"; - format_mem = "{Mug}GB ({Mup}%)"; - format_swap = "{SUp}%"; - } - { - block = "cpu"; - interval = 1; - format = " $icon $barchart "; - } - { - block = "load"; - interval = 1; - format = " $icon $1m $5m "; - } - { - block = "temperature"; - interval = 10; - format = "$icon $min min, $max max, $average avg"; - chip = "*-isa-*"; - } - { - block = "net"; - device = "enp9s0u2u1u2c2"; - interval = 5; - } - { - block = "speedtest"; - format = " ^icon_ping $ping "; - } - { - block = "xrandr"; - interval = 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 - } - { - block = "sound"; - format = "{output_name} {volume}%"; - click = [ - { - button = "left"; - cmd = "pavucontrol --tab=3"; - } - ]; - mappings = { - "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; - "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; - }; - } - { - block = "music"; - player = "spotify"; - buttons = [ - "play" - "prev" - "next" - ]; - click = [ - { - button = "play"; - action = "music_play"; - } - { - button = "prev"; - action = "music_prev"; - } - { - button = "next"; - action = "music_next"; - } - ]; - } - { - block = "time"; - interval = 60; - format = " $timestamp.datetime(f:'%a %d/%m %R') "; - } - { block = "battery"; } - ]; - - icons = "awesome5"; - - settings = { - theme = { - theme = "solarized-dark"; - overrides = { - idle_bg = "#123456"; - idle_fg = "#abcdef"; - }; + programs.i3status-rust = { + enable = true; + bars = { + extra-settings = { + blocks = [ + { + block = "disk_space"; + path = "/"; + info_type = "available"; + interval = 60; + warning = 20.0; + alert = 10.0; + } + { + block = "memory"; + display_type = "memory"; + format_mem = "{Mug}GB ({Mup}%)"; + format_swap = "{SUp}%"; + } + { + block = "cpu"; + interval = 1; + format = " $icon $barchart "; + } + { + block = "load"; + interval = 1; + format = " $icon $1m $5m "; + } + { + block = "temperature"; + interval = 10; + format = "$icon $min min, $max max, $average avg"; + chip = "*-isa-*"; + } + { + block = "net"; + device = "enp9s0u2u1u2c2"; + interval = 5; + } + { + block = "speedtest"; + format = " ^icon_ping $ping "; + } + { + block = "xrandr"; + interval = 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 + } + { + block = "sound"; + format = "{output_name} {volume}%"; + click = [ + { + button = "left"; + cmd = "pavucontrol --tab=3"; + } + ]; + mappings = { + "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; + "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; + }; + } + { + block = "music"; + player = "spotify"; + buttons = [ + "play" + "prev" + "next" + ]; + click = [ + { + button = "play"; + action = "music_play"; + } + { + button = "prev"; + action = "music_prev"; + } + { + button = "next"; + action = "music_next"; + } + ]; + } + { + block = "time"; + interval = 60; + format = " $timestamp.datetime(f:'%a %d/%m %R') "; + } + { block = "battery"; } + ]; + + icons = "awesome5"; + + settings = { + theme = { + theme = "solarized-dark"; + overrides = { + idle_bg = "#123456"; + idle_fg = "#abcdef"; }; }; - - theme = "gruvbox-dark"; }; - }; - }; - test.stubs.i3status-rust = { - version = "0.30.0"; + theme = "gruvbox-dark"; + }; }; + }; - nmt.script = '' - assertFileExists home-files/.config/i3status-rust/config-extra-settings.toml - assertFileContent home-files/.config/i3status-rust/config-extra-settings.toml \ - ${pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 - - [[block]] - block = "memory" - display_type = "memory" - format_mem = "{Mug}GB ({Mup}%)" - format_swap = "{SUp}%" - - [[block]] - block = "cpu" - format = " $icon $barchart " - interval = 1 - - [[block]] - block = "load" - format = " $icon $1m $5m " - interval = 1 - - [[block]] - block = "temperature" - chip = "*-isa-*" - format = "$icon $min min, $max max, $average avg" - interval = 10 - - [[block]] - block = "net" - device = "enp9s0u2u1u2c2" - interval = 5 - - [[block]] - block = "speedtest" - format = " ^icon_ping $ping " - - [[block]] - block = "xrandr" - interval = 6000 - - [[block]] - block = "sound" - format = "{output_name} {volume}%" - - [[block.click]] - button = "left" - cmd = "pavucontrol --tab=3" - - [block.mappings] - "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" - "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" - - [[block]] - block = "music" - buttons = ["play", "prev", "next"] - player = "spotify" - - [[block.click]] - action = "music_play" - button = "play" - - [[block.click]] - action = "music_prev" - button = "prev" - - [[block.click]] - action = "music_next" - button = "next" - - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 - - [[block]] - block = "battery" - - [icons] - icons = "awesome5" - - [theme] - theme = "solarized-dark" - - [theme.overrides] - idle_bg = "#123456" - idle_fg = "#abcdef" - ''} - ''; + test.stubs.i3status-rust = { + version = "0.30.0"; }; + + nmt.script = '' + assertFileExists home-files/.config/i3status-rust/config-extra-settings.toml + assertFileContent home-files/.config/i3status-rust/config-extra-settings.toml \ + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 + + [[block]] + block = "memory" + display_type = "memory" + format_mem = "{Mug}GB ({Mup}%)" + format_swap = "{SUp}%" + + [[block]] + block = "cpu" + format = " $icon $barchart " + interval = 1 + + [[block]] + block = "load" + format = " $icon $1m $5m " + interval = 1 + + [[block]] + block = "temperature" + chip = "*-isa-*" + format = "$icon $min min, $max max, $average avg" + interval = 10 + + [[block]] + block = "net" + device = "enp9s0u2u1u2c2" + interval = 5 + + [[block]] + block = "speedtest" + format = " ^icon_ping $ping " + + [[block]] + block = "xrandr" + interval = 6000 + + [[block]] + block = "sound" + format = "{output_name} {volume}%" + + [[block.click]] + button = "left" + cmd = "pavucontrol --tab=3" + + [block.mappings] + "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" + "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" + + [[block]] + block = "music" + buttons = ["play", "prev", "next"] + player = "spotify" + + [[block.click]] + action = "music_play" + button = "play" + + [[block.click]] + action = "music_prev" + button = "prev" + + [[block.click]] + action = "music_next" + button = "next" + + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 + + [[block]] + block = "battery" + + [icons] + icons = "awesome5" + + [theme] + theme = "solarized-dark" + + [theme.overrides] + idle_bg = "#123456" + idle_fg = "#abcdef" + ''} + ''; } diff --git a/tests/modules/programs/i3status-rust/with-multiple-bars.nix b/tests/modules/programs/i3status-rust/with-multiple-bars.nix index a24ce5f3751a..4c2dc4f52b05 100644 --- a/tests/modules/programs/i3status-rust/with-multiple-bars.nix +++ b/tests/modules/programs/i3status-rust/with-multiple-bars.nix @@ -4,98 +4,96 @@ }: { - config = { - programs.i3status-rust = { - enable = true; - - bars = { - - top = { - blocks = [ - { - block = "disk_space"; - info_type = "available"; - interval = 60; - warning = 20.0; - alert = 10.0; - } - { - block = "memory"; - format_mem = " $icon $Mug ($Mup) "; - format_swap = " $icon $SUp "; - } - ]; - }; - - bottom = { - blocks = [ - { - block = "cpu"; - interval = 1; - format = " $icon $barchart "; - } - { - block = "load"; - interval = 1; - format = " $icon $1m $5m "; - } - ]; - icons = "awesome5"; - - theme = "gruvbox-dark"; - }; + programs.i3status-rust = { + enable = true; + + bars = { + + top = { + blocks = [ + { + block = "disk_space"; + info_type = "available"; + interval = 60; + warning = 20.0; + alert = 10.0; + } + { + block = "memory"; + format_mem = " $icon $Mug ($Mup) "; + format_swap = " $icon $SUp "; + } + ]; + }; + bottom = { + blocks = [ + { + block = "cpu"; + interval = 1; + format = " $icon $barchart "; + } + { + block = "load"; + interval = 1; + format = " $icon $1m $5m "; + } + ]; + icons = "awesome5"; + + theme = "gruvbox-dark"; }; }; - test.stubs.i3status-rust = { - version = "0.30.0"; - }; + }; - nmt.script = '' - assertFileExists home-files/.config/i3status-rust/config-top.toml - assertFileContent home-files/.config/i3status-rust/config-top.toml \ - ${pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - warning = 20.0 - - [[block]] - block = "memory" - format_mem = " $icon $Mug ($Mup) " - format_swap = " $icon $SUp " - - [icons] - icons = "none" - - [theme] - theme = "plain" - ''} - - assertFileExists home-files/.config/i3status-rust/config-bottom.toml - assertFileContent \ - home-files/.config/i3status-rust/config-bottom.toml \ - ${pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - block = "cpu" - format = " $icon $barchart " - interval = 1 - - [[block]] - block = "load" - format = " $icon $1m $5m " - interval = 1 - - [icons] - icons = "awesome5" - - [theme] - theme = "gruvbox-dark" - ''} - ''; + test.stubs.i3status-rust = { + version = "0.30.0"; }; + + nmt.script = '' + assertFileExists home-files/.config/i3status-rust/config-top.toml + assertFileContent home-files/.config/i3status-rust/config-top.toml \ + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + warning = 20.0 + + [[block]] + block = "memory" + format_mem = " $icon $Mug ($Mup) " + format_swap = " $icon $SUp " + + [icons] + icons = "none" + + [theme] + theme = "plain" + ''} + + assertFileExists home-files/.config/i3status-rust/config-bottom.toml + assertFileContent \ + home-files/.config/i3status-rust/config-bottom.toml \ + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + block = "cpu" + format = " $icon $barchart " + interval = 1 + + [[block]] + block = "load" + format = " $icon $1m $5m " + interval = 1 + + [icons] + icons = "awesome5" + + [theme] + theme = "gruvbox-dark" + ''} + ''; } diff --git a/tests/modules/programs/i3status-rust/with-version-02xx.nix b/tests/modules/programs/i3status-rust/with-version-02xx.nix index 1c0ec46abf0a..66ad8c805d32 100644 --- a/tests/modules/programs/i3status-rust/with-version-02xx.nix +++ b/tests/modules/programs/i3status-rust/with-version-02xx.nix @@ -4,51 +4,49 @@ }: { - config = { - programs.i3status-rust = { - enable = true; - }; - - test.stubs.i3status-rust = { - version = "0.29.9"; - }; - - nmt.script = '' - assertFileExists home-files/.config/i3status-rust/config-default.toml - assertFileContent home-files/.config/i3status-rust/config-default.toml \ - ${pkgs.writeText "i3status-rust-expected-config" '' - icons = "none" - theme = "plain" - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 - - [[block]] - block = "memory" - format = " $icon mem_used_percents " - format_alt = " $icon $swap_used_percents " - - [[block]] - block = "cpu" - interval = 1 - - [[block]] - block = "load" - format = " $icon $1m " - interval = 1 - - [[block]] - block = "sound" - - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 - ''} - ''; + programs.i3status-rust = { + enable = true; }; + + test.stubs.i3status-rust = { + version = "0.29.9"; + }; + + nmt.script = '' + assertFileExists home-files/.config/i3status-rust/config-default.toml + assertFileContent home-files/.config/i3status-rust/config-default.toml \ + ${pkgs.writeText "i3status-rust-expected-config" '' + icons = "none" + theme = "plain" + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 + + [[block]] + block = "memory" + format = " $icon mem_used_percents " + format_alt = " $icon $swap_used_percents " + + [[block]] + block = "cpu" + interval = 1 + + [[block]] + block = "load" + format = " $icon $1m " + interval = 1 + + [[block]] + block = "sound" + + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 + ''} + ''; } diff --git a/tests/modules/programs/imv/basic-configuration.nix b/tests/modules/programs/imv/basic-configuration.nix index e62a9d49c28f..cd74f930b85b 100644 --- a/tests/modules/programs/imv/basic-configuration.nix +++ b/tests/modules/programs/imv/basic-configuration.nix @@ -1,20 +1,18 @@ { pkgs, ... }: { - config = { - programs.imv = { - enable = true; - package = pkgs.writeScriptBin "dummy-imv" ""; - settings = { - options.background = "ffffff"; - aliases.x = "close"; - }; + programs.imv = { + enable = true; + package = pkgs.writeScriptBin "dummy-imv" ""; + settings = { + options.background = "ffffff"; + aliases.x = "close"; }; - - nmt.script = '' - assertFileExists home-files/.config/imv/config - assertFileContent home-files/.config/imv/config \ - ${./basic-configuration.conf} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/imv/config + assertFileContent home-files/.config/imv/config \ + ${./basic-configuration.conf} + ''; } diff --git a/tests/modules/programs/imv/empty-configuration.nix b/tests/modules/programs/imv/empty-configuration.nix index 1c46b4c6592f..1a54f8eb71c8 100644 --- a/tests/modules/programs/imv/empty-configuration.nix +++ b/tests/modules/programs/imv/empty-configuration.nix @@ -1,14 +1,12 @@ { pkgs, ... }: { - config = { - programs.imv = { - enable = true; - package = pkgs.writeScriptBin "dummy-imv" ""; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/imv/config - ''; + programs.imv = { + enable = true; + package = pkgs.writeScriptBin "dummy-imv" ""; }; + + nmt.script = '' + assertPathNotExists home-files/.config/imv/config + ''; } diff --git a/tests/modules/programs/inori/default-config.nix b/tests/modules/programs/inori/default-config.nix index 80d61506e880..85b5dd563679 100644 --- a/tests/modules/programs/inori/default-config.nix +++ b/tests/modules/programs/inori/default-config.nix @@ -1,9 +1,7 @@ { - config = { - programs.inori.enable = true; + programs.inori.enable = true; - nmt.script = '' - assertPathNotExists home-files/.config/inori/config.toml - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/inori/config.toml + ''; } diff --git a/tests/modules/programs/inori/full-config.nix b/tests/modules/programs/inori/full-config.nix index 5e2c33f3ac33..a25055c52e0a 100644 --- a/tests/modules/programs/inori/full-config.nix +++ b/tests/modules/programs/inori/full-config.nix @@ -1,59 +1,57 @@ { - config = { - programs.inori = { - enable = true; - settings = { - seek_seconds = 10; - dvorak_keybindings = true; - keybindings = { - toggle_playpause = [ - "p" - "" - ]; - next_song = [ - ">" - "C-n" - ]; - previous_song = [ - "<" - "C-p" - ]; - seek = ""; - seek_backwards = ""; + programs.inori = { + enable = true; + settings = { + seek_seconds = 10; + dvorak_keybindings = true; + keybindings = { + toggle_playpause = [ + "p" + "" + ]; + next_song = [ + ">" + "C-n" + ]; + previous_song = [ + "<" + "C-p" + ]; + seek = ""; + seek_backwards = ""; - up = "k"; - down = "j"; - left = "h"; - right = "l"; - top = [ - "g g" - "" - ]; - bottom = [ - "G" - "" - ]; - quit = [ - "" - "q" - ]; - }; - theme = { - status_artist.fg = "#fab387"; - status_album.fg = "#89b4fa"; - status_title = { - fg = "#cba6f7"; - add_modifier = "BOLD"; - }; - album.fg = "#89b4fa"; - playing.fg = "#a6e3a1"; + up = "k"; + down = "j"; + left = "h"; + right = "l"; + top = [ + "g g" + "" + ]; + bottom = [ + "G" + "" + ]; + quit = [ + "" + "q" + ]; + }; + theme = { + status_artist.fg = "#fab387"; + status_album.fg = "#89b4fa"; + status_title = { + fg = "#cba6f7"; + add_modifier = "BOLD"; }; + album.fg = "#89b4fa"; + playing.fg = "#a6e3a1"; }; }; - - nmt.script = '' - assertFileExists home-files/.config/inori/config.toml - assertFileContent home-files/.config/inori/config.toml ${./full-config.toml} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/inori/config.toml + assertFileContent home-files/.config/inori/config.toml ${./full-config.toml} + ''; } diff --git a/tests/modules/programs/jjui/empty-settings.nix b/tests/modules/programs/jjui/empty-settings.nix index 0de0946fbcd2..8cb4647beef3 100644 --- a/tests/modules/programs/jjui/empty-settings.nix +++ b/tests/modules/programs/jjui/empty-settings.nix @@ -1,9 +1,7 @@ { - config = { - programs.jjui.enable = true; + programs.jjui.enable = true; - nmt.script = '' - assertPathNotExists home-files/.config/jjui - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/jjui + ''; } diff --git a/tests/modules/programs/jjui/example-settings.nix b/tests/modules/programs/jjui/example-settings.nix index 8cc67bc0bd80..afa09502027a 100644 --- a/tests/modules/programs/jjui/example-settings.nix +++ b/tests/modules/programs/jjui/example-settings.nix @@ -4,25 +4,23 @@ }: { - config = { - programs.jjui = { - enable = true; - settings = { - revisions = { - template = "builtin_log_compact"; - revset = "ancestors(@ | heads(remote_branches())) ~ empty()"; - }; + programs.jjui = { + enable = true; + settings = { + revisions = { + template = "builtin_log_compact"; + revset = "ancestors(@ | heads(remote_branches())) ~ empty()"; }; }; - - nmt.script = - let - configDir = if !pkgs.stdenv.isDarwin then ".config/jjui" else "Library/Application Support/jjui"; - in - '' - assertFileContent \ - "home-files/${configDir}/config.toml" \ - ${./example-settings-expected.toml} - ''; }; + + nmt.script = + let + configDir = if !pkgs.stdenv.isDarwin then ".config/jjui" else "Library/Application Support/jjui"; + in + '' + assertFileContent \ + "home-files/${configDir}/config.toml" \ + ${./example-settings-expected.toml} + ''; } diff --git a/tests/modules/programs/jjui/null-package.nix b/tests/modules/programs/jjui/null-package.nix index 0a5ccd98e4b9..af299fcf56f9 100644 --- a/tests/modules/programs/jjui/null-package.nix +++ b/tests/modules/programs/jjui/null-package.nix @@ -4,26 +4,24 @@ }: { - config = { - programs.jjui = { - enable = true; - package = null; - settings = { - revisions.template = "builtin_log_oneline"; - }; + programs.jjui = { + enable = true; + package = null; + settings = { + revisions.template = "builtin_log_oneline"; }; - - nmt.script = - let - configDir = if !pkgs.stdenv.isDarwin then ".config/jjui" else "Library/Application Support/jjui"; - in - '' - assertFileContent \ - "home-files/${configDir}/config.toml" \ - ${pkgs.writeText "expected" '' - [revisions] - template = "builtin_log_oneline" - ''} - ''; }; + + nmt.script = + let + configDir = if !pkgs.stdenv.isDarwin then ".config/jjui" else "Library/Application Support/jjui"; + in + '' + assertFileContent \ + "home-files/${configDir}/config.toml" \ + ${pkgs.writeText "expected" '' + [revisions] + template = "builtin_log_oneline" + ''} + ''; } diff --git a/tests/modules/programs/kitty/example-mkOrder.nix b/tests/modules/programs/kitty/example-mkOrder.nix index acc58287f132..34553e06ce03 100644 --- a/tests/modules/programs/kitty/example-mkOrder.nix +++ b/tests/modules/programs/kitty/example-mkOrder.nix @@ -1,49 +1,47 @@ { lib, pkgs, ... }: { - config = { - programs.kitty = { - enable = true; - - darwinLaunchOptions = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin [ - "--single-instance" - "--directory=/tmp/my-dir" - "--listen-on=unix:/tmp/my-socket" - ]; - - settings = { - scrollback_lines = 10000; - enable_audio_bell = false; - update_check_interval = 0; - background_opacity = 0.5; - }; - - font.name = "DejaVu Sans"; - font.size = 8; - - keybindings = { - "ctrl+c" = "copy_or_interrupt"; - "ctrl+f>2" = "set_font_size 20"; - }; - - actionAliases = { - "launch_tab" = "launch --cwd=current --type=tab"; - "launch_window" = "launch --cwd=current --type=os-window"; - }; - - environment = { - LS_COLORS = "1"; - }; - - extraConfig = lib.mkOrder 535 '' - include ~/.cache/wal/colors-kitty.conf - ''; + programs.kitty = { + enable = true; + + darwinLaunchOptions = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin [ + "--single-instance" + "--directory=/tmp/my-dir" + "--listen-on=unix:/tmp/my-socket" + ]; + + settings = { + scrollback_lines = 10000; + enable_audio_bell = false; + update_check_interval = 0; + background_opacity = 0.5; }; - nmt.script = '' - assertFileExists home-files/.config/kitty/kitty.conf - assertFileContent \ - home-files/.config/kitty/kitty.conf \ - ${./example-mkOrder-expected.conf} + font.name = "DejaVu Sans"; + font.size = 8; + + keybindings = { + "ctrl+c" = "copy_or_interrupt"; + "ctrl+f>2" = "set_font_size 20"; + }; + + actionAliases = { + "launch_tab" = "launch --cwd=current --type=tab"; + "launch_window" = "launch --cwd=current --type=os-window"; + }; + + environment = { + LS_COLORS = "1"; + }; + + extraConfig = lib.mkOrder 535 '' + include ~/.cache/wal/colors-kitty.conf ''; }; + + nmt.script = '' + assertFileExists home-files/.config/kitty/kitty.conf + assertFileContent \ + home-files/.config/kitty/kitty.conf \ + ${./example-mkOrder-expected.conf} + ''; } diff --git a/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix b/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix index 3069a396cd67..e5f9c99f973b 100644 --- a/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix +++ b/tests/modules/programs/kitty/example-quickAccessTerminalConfig.nix @@ -1,20 +1,18 @@ { - config = { - programs.kitty = { - enable = true; + programs.kitty = { + enable = true; - quickAccessTerminalConfig = { - start_as_hidden = false; - hide_on_focus_loss = false; - background_opacity = 0.85; - }; + quickAccessTerminalConfig = { + start_as_hidden = false; + hide_on_focus_loss = false; + background_opacity = 0.85; }; - - nmt.script = '' - assertFileExists home-files/.config/kitty/quick-access-terminal.conf - assertFileContent \ - home-files/.config/kitty/quick-access-terminal.conf \ - ${./example-quickAccessTerminalConfig-expected.conf} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/kitty/quick-access-terminal.conf + assertFileContent \ + home-files/.config/kitty/quick-access-terminal.conf \ + ${./example-quickAccessTerminalConfig-expected.conf} + ''; } diff --git a/tests/modules/programs/kitty/example-settings.nix b/tests/modules/programs/kitty/example-settings.nix index 484dacda64e2..fd499ee67ec7 100644 --- a/tests/modules/programs/kitty/example-settings.nix +++ b/tests/modules/programs/kitty/example-settings.nix @@ -1,50 +1,48 @@ { lib, pkgs, ... }: { - config = { - programs.kitty = { - enable = true; + programs.kitty = { + enable = true; - darwinLaunchOptions = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin [ - "--single-instance" - "--directory=/tmp/my-dir" - "--listen-on=unix:/tmp/my-socket" - ]; + darwinLaunchOptions = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin [ + "--single-instance" + "--directory=/tmp/my-dir" + "--listen-on=unix:/tmp/my-socket" + ]; - settings = { - scrollback_lines = 10000; - enable_audio_bell = false; - update_check_interval = 0; - background_opacity = 0.5; - }; - - font.name = "DejaVu Sans"; - font.size = 8; + settings = { + scrollback_lines = 10000; + enable_audio_bell = false; + update_check_interval = 0; + background_opacity = 0.5; + }; - keybindings = { - "ctrl+c" = "copy_or_interrupt"; - "ctrl+f>2" = "set_font_size 20"; - }; + font.name = "DejaVu Sans"; + font.size = 8; - actionAliases = { - "launch_tab" = "launch --cwd=current --type=tab"; - "launch_window" = "launch --cwd=current --type=os-window"; - }; + keybindings = { + "ctrl+c" = "copy_or_interrupt"; + "ctrl+f>2" = "set_font_size 20"; + }; - environment = { - LS_COLORS = "1"; - }; + actionAliases = { + "launch_tab" = "launch --cwd=current --type=tab"; + "launch_window" = "launch --cwd=current --type=os-window"; }; - nmt.script = '' - assertFileExists home-files/.config/kitty/kitty.conf - assertFileContent \ - home-files/.config/kitty/kitty.conf \ - ${./example-settings-expected.conf} - '' - + lib.optionalString pkgs.stdenv.hostPlatform.isDarwin '' - assertFileContent \ - home-files/.config/kitty/macos-launch-services-cmdline \ - ${./example-macos-launch-services-cmdline} - ''; + environment = { + LS_COLORS = "1"; + }; }; + + nmt.script = '' + assertFileExists home-files/.config/kitty/kitty.conf + assertFileContent \ + home-files/.config/kitty/kitty.conf \ + ${./example-settings-expected.conf} + '' + + lib.optionalString pkgs.stdenv.hostPlatform.isDarwin '' + assertFileContent \ + home-files/.config/kitty/macos-launch-services-cmdline \ + ${./example-macos-launch-services-cmdline} + ''; } diff --git a/tests/modules/programs/kitty/null-shellIntegration.nix b/tests/modules/programs/kitty/null-shellIntegration.nix index 0346ee92b1bb..09b09126d671 100644 --- a/tests/modules/programs/kitty/null-shellIntegration.nix +++ b/tests/modules/programs/kitty/null-shellIntegration.nix @@ -1,18 +1,16 @@ { - config = { - programs.kitty = { - enable = true; + programs.kitty = { + enable = true; - shellIntegration.mode = null; - }; + shellIntegration.mode = null; + }; - test.stubs.kitty = { }; + test.stubs.kitty = { }; - nmt.script = '' - assertFileExists home-files/.config/kitty/kitty.conf - assertFileContent \ - home-files/.config/kitty/kitty.conf \ - ${./null-shellIntegration-expected.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/kitty/kitty.conf + assertFileContent \ + home-files/.config/kitty/kitty.conf \ + ${./null-shellIntegration-expected.conf} + ''; } diff --git a/tests/modules/programs/looking-glass-client/empty-settings.nix b/tests/modules/programs/looking-glass-client/empty-settings.nix index 0b9a99f21681..25f462775d65 100644 --- a/tests/modules/programs/looking-glass-client/empty-settings.nix +++ b/tests/modules/programs/looking-glass-client/empty-settings.nix @@ -1,13 +1,11 @@ { config, ... }: { - config = { - programs.looking-glass-client = { - enable = true; - package = config.lib.test.mkStubPackage { }; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/looking-glass/client.ini - ''; + programs.looking-glass-client = { + enable = true; + package = config.lib.test.mkStubPackage { }; }; + + nmt.script = '' + assertPathNotExists home-files/.config/looking-glass/client.ini + ''; } diff --git a/tests/modules/programs/looking-glass-client/example-settings.nix b/tests/modules/programs/looking-glass-client/example-settings.nix index 18dcd6fae953..adaf25ba4e91 100644 --- a/tests/modules/programs/looking-glass-client/example-settings.nix +++ b/tests/modules/programs/looking-glass-client/example-settings.nix @@ -1,38 +1,36 @@ { config, ... }: { - config = { - programs.looking-glass-client = { - enable = true; - package = config.lib.test.mkStubPackage { }; + programs.looking-glass-client = { + enable = true; + package = config.lib.test.mkStubPackage { }; - settings = { - app = { - allowDMA = true; - shmFile = "/dev/kvmfr0"; - }; + settings = { + app = { + allowDMA = true; + shmFile = "/dev/kvmfr0"; + }; - win = { - fullScreen = true; - showFPS = false; - jitRender = true; - }; + win = { + fullScreen = true; + showFPS = false; + jitRender = true; + }; - spice = { - enable = true; - audio = true; - }; + spice = { + enable = true; + audio = true; + }; - input = { - rawMouse = true; - escapeKey = 62; - }; + input = { + rawMouse = true; + escapeKey = 62; }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/looking-glass/client.ini \ - ${./example-config.ini} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/looking-glass/client.ini \ + ${./example-config.ini} + ''; } diff --git a/tests/modules/programs/man/apropos.nix b/tests/modules/programs/man/apropos.nix index 312497c37dc6..00d2f65c453d 100644 --- a/tests/modules/programs/man/apropos.nix +++ b/tests/modules/programs/man/apropos.nix @@ -1,14 +1,12 @@ { - config = { - programs.man = { - enable = true; - generateCaches = true; - }; - - nmt.script = '' - assertFileExists home-files/.manpath - CACHE_DIR=$(cat $TESTED/home-files/.manpath | cut --delimiter=' ' --fields=3) - assertFileExists "$CACHE_DIR/index.db" - ''; + programs.man = { + enable = true; + generateCaches = true; }; + + nmt.script = '' + assertFileExists home-files/.manpath + CACHE_DIR=$(cat $TESTED/home-files/.manpath | cut --delimiter=' ' --fields=3) + assertFileExists "$CACHE_DIR/index.db" + ''; } diff --git a/tests/modules/programs/man/no-manpath.nix b/tests/modules/programs/man/no-manpath.nix index 150b0f8a2e12..13e0e880a1a6 100644 --- a/tests/modules/programs/man/no-manpath.nix +++ b/tests/modules/programs/man/no-manpath.nix @@ -1,11 +1,9 @@ { - config = { - programs.man = { - enable = true; - }; - - nmt.script = '' - assertPathNotExists home-files/.manpath - ''; + programs.man = { + enable = true; }; + + nmt.script = '' + assertPathNotExists home-files/.manpath + ''; } diff --git a/tests/modules/programs/mangohud/basic-configuration.nix b/tests/modules/programs/mangohud/basic-configuration.nix index 32f47af8bc99..4ea479f85ef7 100644 --- a/tests/modules/programs/mangohud/basic-configuration.nix +++ b/tests/modules/programs/mangohud/basic-configuration.nix @@ -1,47 +1,45 @@ { config, ... }: { - config = { - programs.mangohud = { - enable = true; - package = config.lib.test.mkStubPackage { }; - settings = { - output_folder = /home/user/Documents/mangohud; - fps_limit = [ - 30 - 60 - ]; - vsync = 0; - legacy_layout = false; - cpu_stats = true; - cpu_temp = true; - cpu_power = true; - cpu_text = "CPU"; - cpu_mhz = true; - cpu_load_change = true; - cpu_load_value = true; - media_player_name = "spotify"; - media_player_order = [ - "title" - "artist" - "album" - ]; - }; - settingsPerApplication = { - mpv = { - output_folder = /home/user/Documents/mpv-mangohud; - no_display = true; - }; + programs.mangohud = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = { + output_folder = /home/user/Documents/mangohud; + fps_limit = [ + 30 + 60 + ]; + vsync = 0; + legacy_layout = false; + cpu_stats = true; + cpu_temp = true; + cpu_power = true; + cpu_text = "CPU"; + cpu_mhz = true; + cpu_load_change = true; + cpu_load_value = true; + media_player_name = "spotify"; + media_player_order = [ + "title" + "artist" + "album" + ]; + }; + settingsPerApplication = { + mpv = { + output_folder = /home/user/Documents/mpv-mangohud; + no_display = true; }; }; - - nmt.script = '' - assertFileExists home-files/.config/MangoHud/MangoHud.conf - assertFileContent home-files/.config/MangoHud/MangoHud.conf \ - ${./basic-configuration.conf} - assertFileExists home-files/.config/MangoHud/mpv.conf - assertFileContent home-files/.config/MangoHud/mpv.conf \ - ${./basic-configuration-mpv.conf} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/MangoHud/MangoHud.conf + assertFileContent home-files/.config/MangoHud/MangoHud.conf \ + ${./basic-configuration.conf} + assertFileExists home-files/.config/MangoHud/mpv.conf + assertFileContent home-files/.config/MangoHud/mpv.conf \ + ${./basic-configuration-mpv.conf} + ''; } diff --git a/tests/modules/programs/mise/default-settings.nix b/tests/modules/programs/mise/default-settings.nix index d3729178cf99..f4d6f91b647b 100644 --- a/tests/modules/programs/mise/default-settings.nix +++ b/tests/modules/programs/mise/default-settings.nix @@ -1,14 +1,12 @@ { config, ... }: { - config = { - programs.mise = { - package = config.lib.test.mkStubPackage { name = "mise"; }; - enable = true; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/mise/config.toml - assertPathNotExists home-files/.config/mise/settings.toml - ''; + programs.mise = { + package = config.lib.test.mkStubPackage { name = "mise"; }; + enable = true; }; + + nmt.script = '' + assertPathNotExists home-files/.config/mise/config.toml + assertPathNotExists home-files/.config/mise/settings.toml + ''; } diff --git a/tests/modules/programs/mods/basic-configuration.nix b/tests/modules/programs/mods/basic-configuration.nix index c84ac030cc8d..519b4065705e 100644 --- a/tests/modules/programs/mods/basic-configuration.nix +++ b/tests/modules/programs/mods/basic-configuration.nix @@ -1,27 +1,25 @@ { pkgs, ... }: { - config = { - programs.mods = { - enable = true; - package = pkgs.writeScriptBin "dummy-mods" ""; - settings = { - default-model = "llama3.2"; - apis = { - ollama = { - base-url = "http://localhost:11434/api"; - models = { - "llama3.2" = { - max-input-chars = 650000; - }; + programs.mods = { + enable = true; + package = pkgs.writeScriptBin "dummy-mods" ""; + settings = { + default-model = "llama3.2"; + apis = { + ollama = { + base-url = "http://localhost:11434/api"; + models = { + "llama3.2" = { + max-input-chars = 650000; }; }; }; }; }; - nmt.script = '' - assertFileExists home-files/.config/mods/mods.yml - assertFileContent home-files/.config/mods/mods.yml \ - ${./basic-configuration.yml} - ''; }; + nmt.script = '' + assertFileExists home-files/.config/mods/mods.yml + assertFileContent home-files/.config/mods/mods.yml \ + ${./basic-configuration.yml} + ''; } diff --git a/tests/modules/programs/radicle/basic-configuration.nix b/tests/modules/programs/radicle/basic-configuration.nix index 5edc72d1e684..b34b9418c6fc 100644 --- a/tests/modules/programs/radicle/basic-configuration.nix +++ b/tests/modules/programs/radicle/basic-configuration.nix @@ -1,11 +1,9 @@ { - config = { - programs.radicle.enable = true; + programs.radicle.enable = true; - nmt.script = '' - assertFileContent \ - home-files/.radicle/config.json \ - ${./basic-configuration.json} - ''; - }; + nmt.script = '' + assertFileContent \ + home-files/.radicle/config.json \ + ${./basic-configuration.json} + ''; } diff --git a/tests/modules/programs/readline/using-all-options.nix b/tests/modules/programs/readline/using-all-options.nix index a2ae4fafb8e8..172d0f63f67c 100644 --- a/tests/modules/programs/readline/using-all-options.nix +++ b/tests/modules/programs/readline/using-all-options.nix @@ -1,30 +1,28 @@ { - config = { - programs.readline = { - enable = true; + programs.readline = { + enable = true; - bindings = { - "\\C-h" = "backward-kill-word"; - "Control-p" = ''"whups"''; - }; - - variables = { - bell-style = "audible"; - completion-map-case = true; - completion-prefix-display-length = 2; - }; + bindings = { + "\\C-h" = "backward-kill-word"; + "Control-p" = ''"whups"''; + }; - extraConfig = '' - $if mode=emacs - "\e[1~": beginning-of-line - $endif - ''; + variables = { + bell-style = "audible"; + completion-map-case = true; + completion-prefix-display-length = 2; }; - nmt.script = '' - assertFileContent \ - home-files/.inputrc \ - ${./using-all-options.txt} + extraConfig = '' + $if mode=emacs + "\e[1~": beginning-of-line + $endif ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.inputrc \ + ${./using-all-options.txt} + ''; } diff --git a/tests/modules/programs/ripgrep-all/custom-arguments.nix b/tests/modules/programs/ripgrep-all/custom-arguments.nix index b647a66fcd37..998620dbd143 100644 --- a/tests/modules/programs/ripgrep-all/custom-arguments.nix +++ b/tests/modules/programs/ripgrep-all/custom-arguments.nix @@ -1,55 +1,53 @@ { pkgs, config, ... }: { - config = { - programs.ripgrep-all = { - enable = true; - package = config.lib.test.mkStubPackage { name = "ripgrep-all"; }; - custom_adapters = [ + programs.ripgrep-all = { + enable = true; + package = config.lib.test.mkStubPackage { name = "ripgrep-all"; }; + custom_adapters = [ + { + name = "gron"; + version = 1; + description = "Transform JSON into discrete JS assignments"; + extensions = [ "json" ]; + mimetypes = [ "application/json" ]; + binary = "/bin/gron"; + disabled_by_default = false; + match_only_by_mime = false; + } + ]; + }; + + nmt.script = + let + configPath = + if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/ripgrep-all/config.jsonc" + else + ".config/ripgrep-all/config.jsonc"; + in + '' + assertFileExists "home-files/${configPath}" + assertFileContent "home-files/${configPath}" ${pkgs.writeText "ripgrep-all.expected" '' { - name = "gron"; - version = 1; - description = "Transform JSON into discrete JS assignments"; - extensions = [ "json" ]; - mimetypes = [ "application/json" ]; - binary = "/bin/gron"; - disabled_by_default = false; - match_only_by_mime = false; + "$schema": "./config.schema.json", + "custom_adapters": [ + { + "args": [], + "binary": "/bin/gron", + "description": "Transform JSON into discrete JS assignments", + "disabled_by_default": false, + "extensions": [ + "json" + ], + "match_only_by_mime": false, + "mimetypes": [ + "application/json" + ], + "name": "gron", + "version": 1 + } + ] } - ]; - }; - - nmt.script = - let - configPath = - if pkgs.stdenv.hostPlatform.isDarwin then - "Library/Application Support/ripgrep-all/config.jsonc" - else - ".config/ripgrep-all/config.jsonc"; - in - '' - assertFileExists "home-files/${configPath}" - assertFileContent "home-files/${configPath}" ${pkgs.writeText "ripgrep-all.expected" '' - { - "$schema": "./config.schema.json", - "custom_adapters": [ - { - "args": [], - "binary": "/bin/gron", - "description": "Transform JSON into discrete JS assignments", - "disabled_by_default": false, - "extensions": [ - "json" - ], - "match_only_by_mime": false, - "mimetypes": [ - "application/json" - ], - "name": "gron", - "version": 1 - } - ] - } - ''} - ''; - }; + ''} + ''; } diff --git a/tests/modules/programs/ripgrep-all/default-arguments.nix b/tests/modules/programs/ripgrep-all/default-arguments.nix index dcbc9f4307ae..0e29ec17dce4 100644 --- a/tests/modules/programs/ripgrep-all/default-arguments.nix +++ b/tests/modules/programs/ripgrep-all/default-arguments.nix @@ -1,14 +1,12 @@ { config, ... }: { - config = { - programs.ripgrep-all = { - enable = true; - package = config.lib.test.mkStubPackage { name = "ripgrep-all"; }; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/ripgrep-all/config.jsonc - assertPathNotExists 'home-files/Library/Application Support/ripgrep-all/config.jsonc' - ''; + programs.ripgrep-all = { + enable = true; + package = config.lib.test.mkStubPackage { name = "ripgrep-all"; }; }; + + nmt.script = '' + assertPathNotExists home-files/.config/ripgrep-all/config.jsonc + assertPathNotExists 'home-files/Library/Application Support/ripgrep-all/config.jsonc' + ''; } diff --git a/tests/modules/programs/ripgrep/custom-arguments.nix b/tests/modules/programs/ripgrep/custom-arguments.nix index 7fe21ec3ff6e..d2dfff251f80 100644 --- a/tests/modules/programs/ripgrep/custom-arguments.nix +++ b/tests/modules/programs/ripgrep/custom-arguments.nix @@ -1,23 +1,21 @@ { pkgs, config, ... }: { - config = { - programs.ripgrep = { - enable = true; - package = config.lib.test.mkStubPackage { name = "ripgrep"; }; - arguments = [ - "--max-columns-preview" - "--colors=line:style:bold" - "--no-require-git" - ]; - }; - - nmt.script = '' - assertFileExists home-files/.config/ripgrep/ripgreprc - assertFileContent home-files/.config/ripgrep/ripgreprc ${pkgs.writeText "ripgrep.expected" '' - --max-columns-preview - --colors=line:style:bold - --no-require-git - ''} - ''; + programs.ripgrep = { + enable = true; + package = config.lib.test.mkStubPackage { name = "ripgrep"; }; + arguments = [ + "--max-columns-preview" + "--colors=line:style:bold" + "--no-require-git" + ]; }; + + nmt.script = '' + assertFileExists home-files/.config/ripgrep/ripgreprc + assertFileContent home-files/.config/ripgrep/ripgreprc ${pkgs.writeText "ripgrep.expected" '' + --max-columns-preview + --colors=line:style:bold + --no-require-git + ''} + ''; } diff --git a/tests/modules/programs/ripgrep/default-arguments.nix b/tests/modules/programs/ripgrep/default-arguments.nix index 9e858f66959a..76faa67c25ce 100644 --- a/tests/modules/programs/ripgrep/default-arguments.nix +++ b/tests/modules/programs/ripgrep/default-arguments.nix @@ -1,13 +1,11 @@ { config, ... }: { - config = { - programs.ripgrep = { - enable = true; - package = config.lib.test.mkStubPackage { name = "ripgrep"; }; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/ripgrep/ripgreprc - ''; + programs.ripgrep = { + enable = true; + package = config.lib.test.mkStubPackage { name = "ripgrep"; }; }; + + nmt.script = '' + assertPathNotExists home-files/.config/ripgrep/ripgreprc + ''; } diff --git a/tests/modules/programs/sbt/credentials.nix b/tests/modules/programs/sbt/credentials.nix index 50b7f051c289..da6f5ee2e3e2 100644 --- a/tests/modules/programs/sbt/credentials.nix +++ b/tests/modules/programs/sbt/credentials.nix @@ -25,16 +25,14 @@ let credentialsSbtPath = ".sbt/1.0/credentials.sbt"; in { - config = { - programs.sbt = { - enable = true; - credentials = credentials; - package = pkgs.writeScriptBin "sbt" ""; - }; - - nmt.script = '' - assertFileExists "home-files/${credentialsSbtPath}" - assertFileContent "home-files/${credentialsSbtPath}" "${expectedCredentialsSbt}" - ''; + programs.sbt = { + enable = true; + credentials = credentials; + package = pkgs.writeScriptBin "sbt" ""; }; + + nmt.script = '' + assertFileExists "home-files/${credentialsSbtPath}" + assertFileContent "home-files/${credentialsSbtPath}" "${expectedCredentialsSbt}" + ''; } diff --git a/tests/modules/programs/sbt/plugins.nix b/tests/modules/programs/sbt/plugins.nix index c07118c25092..62cc4b962bd2 100644 --- a/tests/modules/programs/sbt/plugins.nix +++ b/tests/modules/programs/sbt/plugins.nix @@ -28,17 +28,15 @@ let in { - config = { - programs.sbt = { - enable = true; - plugins = plugins; - pluginsExtra = pluginsExtra; - package = pkgs.writeScriptBin "sbt" ""; - }; - - nmt.script = '' - assertFileExists "home-files/${pluginsSbtPath}" - assertFileContent "home-files/${pluginsSbtPath}" "${expectedPluginsSbt}" - ''; + programs.sbt = { + enable = true; + plugins = plugins; + pluginsExtra = pluginsExtra; + package = pkgs.writeScriptBin "sbt" ""; }; + + nmt.script = '' + assertFileExists "home-files/${pluginsSbtPath}" + assertFileContent "home-files/${pluginsSbtPath}" "${expectedPluginsSbt}" + ''; } diff --git a/tests/modules/programs/sbt/repositories.nix b/tests/modules/programs/sbt/repositories.nix index 58df66886026..d464331105fe 100644 --- a/tests/modules/programs/sbt/repositories.nix +++ b/tests/modules/programs/sbt/repositories.nix @@ -23,16 +23,14 @@ let repositoriesSbtPath = ".sbt/repositories"; in { - config = { - programs.sbt = { - enable = true; - repositories = repositories; - package = pkgs.writeScriptBin "sbt" ""; - }; - - nmt.script = '' - assertFileExists "home-files/${repositoriesSbtPath}" - assertFileContent "home-files/${repositoriesSbtPath}" "${expectedRepositories}" - ''; + programs.sbt = { + enable = true; + repositories = repositories; + package = pkgs.writeScriptBin "sbt" ""; }; + + nmt.script = '' + assertFileExists "home-files/${repositoriesSbtPath}" + assertFileContent "home-files/${repositoriesSbtPath}" "${expectedRepositories}" + ''; } diff --git a/tests/modules/programs/sbt/user-config-path.nix b/tests/modules/programs/sbt/user-config-path.nix index ca0de7db3f3a..15a8dcec1085 100644 --- a/tests/modules/programs/sbt/user-config-path.nix +++ b/tests/modules/programs/sbt/user-config-path.nix @@ -23,20 +23,18 @@ let baseSbtPath = ".config/sbt"; in { - config = { - programs.sbt = { - enable = true; - plugins = plugins; - credentials = credentials; - repositories = repositories; - baseUserConfigPath = ".config/sbt"; - package = pkgs.writeScriptBin "sbt" ""; - }; - - nmt.script = '' - assertFileExists "home-files/${baseSbtPath}/1.0/plugins/plugins.sbt" - assertFileExists "home-files/${baseSbtPath}/1.0/credentials.sbt" - assertFileExists "home-files/${baseSbtPath}/repositories" - ''; + programs.sbt = { + enable = true; + plugins = plugins; + credentials = credentials; + repositories = repositories; + baseUserConfigPath = ".config/sbt"; + package = pkgs.writeScriptBin "sbt" ""; }; + + nmt.script = '' + assertFileExists "home-files/${baseSbtPath}/1.0/plugins/plugins.sbt" + assertFileExists "home-files/${baseSbtPath}/1.0/credentials.sbt" + assertFileExists "home-files/${baseSbtPath}/repositories" + ''; } diff --git a/tests/modules/programs/senpai/empty-settings.nix b/tests/modules/programs/senpai/empty-settings.nix index eeed8a39c8b2..6503d1992244 100644 --- a/tests/modules/programs/senpai/empty-settings.nix +++ b/tests/modules/programs/senpai/empty-settings.nix @@ -1,20 +1,18 @@ { config, ... }: { - config = { - programs.senpai = { - enable = true; - package = config.lib.test.mkStubPackage { }; - config = { - address = "irc.libera.chat"; - nickname = "Guest123456"; - }; + programs.senpai = { + enable = true; + package = config.lib.test.mkStubPackage { }; + config = { + address = "irc.libera.chat"; + nickname = "Guest123456"; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/senpai/senpai.scfg \ - ${./empty-settings-expected.conf} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/senpai/senpai.scfg \ + ${./empty-settings-expected.conf} + ''; } diff --git a/tests/modules/programs/senpai/example-settings.nix b/tests/modules/programs/senpai/example-settings.nix index 7922b25989ec..ffa0f3d4eb04 100644 --- a/tests/modules/programs/senpai/example-settings.nix +++ b/tests/modules/programs/senpai/example-settings.nix @@ -1,39 +1,37 @@ { config, ... }: { - config = { - programs.senpai = { - enable = true; - package = config.lib.test.mkStubPackage { }; - config = { - address = "irc.libera.chat"; - nickname = "Guest123456"; - password-cmd = [ - "gopass" - "show" - "irc/guest" - ]; - username = "senpai"; - realname = "Guest von Lenon"; - channel = [ "#rahxephon" ]; - highlight = [ - "guest" - "senpai" - "lenon" - ]; - pane-widths = { - nicknames = 16; - }; - colors = { - prompt = 2; - }; + programs.senpai = { + enable = true; + package = config.lib.test.mkStubPackage { }; + config = { + address = "irc.libera.chat"; + nickname = "Guest123456"; + password-cmd = [ + "gopass" + "show" + "irc/guest" + ]; + username = "senpai"; + realname = "Guest von Lenon"; + channel = [ "#rahxephon" ]; + highlight = [ + "guest" + "senpai" + "lenon" + ]; + pane-widths = { + nicknames = 16; + }; + colors = { + prompt = 2; }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/senpai/senpai.scfg \ - ${./example-settings-expected.conf} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/senpai/senpai.scfg \ + ${./example-settings-expected.conf} + ''; } diff --git a/tests/modules/programs/sesh/basic-configuration.nix b/tests/modules/programs/sesh/basic-configuration.nix index 120cae3aa23e..78a044fe9d85 100644 --- a/tests/modules/programs/sesh/basic-configuration.nix +++ b/tests/modules/programs/sesh/basic-configuration.nix @@ -1,33 +1,31 @@ { pkgs, ... }: { - config = { - programs.fzf.tmux.enableShellIntegration = true; + programs.fzf.tmux.enableShellIntegration = true; - programs.sesh = { - enable = true; - package = pkgs.writeScriptBin "dummy-polybar" ""; - settings = { - default_session.startup_command = "nvim -c ':Telescope find_files'"; - session = [ - { - name = "Downloads 📥"; - path = "~/Downloads"; - startup_command = "ls"; - } - { - name = "tmux config"; - path = "~/c/dotfiles/.config/tmux"; - startup_command = "nvim tmux.conf"; - } - ]; - }; + programs.sesh = { + enable = true; + package = pkgs.writeScriptBin "dummy-polybar" ""; + settings = { + default_session.startup_command = "nvim -c ':Telescope find_files'"; + session = [ + { + name = "Downloads 📥"; + path = "~/Downloads"; + startup_command = "ls"; + } + { + name = "tmux config"; + path = "~/c/dotfiles/.config/tmux"; + startup_command = "nvim tmux.conf"; + } + ]; }; - - nmt.script = '' - assertFileExists home-files/.config/sesh/sesh.toml - assertFileContent home-files/.config/sesh/sesh.toml \ - ${./basic-configuration.toml} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/sesh/sesh.toml + assertFileContent home-files/.config/sesh/sesh.toml \ + ${./basic-configuration.toml} + ''; } diff --git a/tests/modules/programs/sheldon/default.nix b/tests/modules/programs/sheldon/default.nix index 31001ab71949..256f79287a1a 100644 --- a/tests/modules/programs/sheldon/default.nix +++ b/tests/modules/programs/sheldon/default.nix @@ -1,25 +1,21 @@ { - config = { - programs.sheldon = { - enable = true; - settings = { - shell = "zsh"; - plugins = { - zsh-syntax-highlighting = { - github = "zsh-users/zsh-syntax-highlighting"; - apply = [ "defer" ]; - }; - }; - templates = { - defer = '' - {{ hooks | get: "pre" | nl }}{% for file in files %}zsh-defer source "{{ file }}" - {% endfor %}{{ hooks | get: "post" | nl }}''; + programs.sheldon = { + enable = true; + settings = { + shell = "zsh"; + plugins = { + zsh-syntax-highlighting = { + github = "zsh-users/zsh-syntax-highlighting"; + apply = [ "defer" ]; }; }; + templates = { + defer = '' + {{ hooks | get: "pre" | nl }}{% for file in files %}zsh-defer source "{{ file }}" + {% endfor %}{{ hooks | get: "post" | nl }}''; + }; }; }; - test.stubs.sheldon = { }; - nmt.script = "assertFileContent home-files/.config/sheldon/plugins.toml ${./plugins.toml}"; } diff --git a/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix index 64d3e8e36e4a..d776d33e8fab 100644 --- a/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix @@ -1,21 +1,19 @@ { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - dynamicBindPathWithPort = { - dynamicForwards = [ - { - # Error: - address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - port = 3000; - } - ]; - }; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + dynamicBindPathWithPort = { + dynamicForwards = [ + { + # Error: + address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + port = 3000; + } + ]; }; }; - - test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; }; + + test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; } diff --git a/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix b/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix index 909d27e86b76..daa8a955f861 100644 --- a/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix +++ b/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix @@ -1,41 +1,39 @@ { config, lib, ... }: { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - dynamicBindPathNoPort = { - dynamicForwards = [ - { - # OK: - address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - } - ]; - }; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + dynamicBindPathNoPort = { + dynamicForwards = [ + { + # OK: + address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + } + ]; + }; - dynamicBindAddressWithPort = { - dynamicForwards = [ - { - # OK: - address = "127.0.0.1"; - port = 3000; - } - ]; - }; + dynamicBindAddressWithPort = { + dynamicForwards = [ + { + # OK: + address = "127.0.0.1"; + port = 3000; + } + ]; }; }; + }; - home.file.result.text = builtins.toJSON ( - map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) - ); + home.file.result.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); - nmt.script = '' - assertFileExists home-files/.ssh/config - assertFileContent \ - home-files/.ssh/config \ - ${./forwards-dynamic-valid-bind-no-asserts-expected.conf} - assertFileContent home-files/result ${./no-assertions.json} - ''; - }; + nmt.script = '' + assertFileExists home-files/.ssh/config + assertFileContent \ + home-files/.ssh/config \ + ${./forwards-dynamic-valid-bind-no-asserts-expected.conf} + assertFileContent home-files/result ${./no-assertions.json} + ''; } diff --git a/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix index d435224fddbd..5d3f4637ebb0 100644 --- a/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix @@ -1,25 +1,23 @@ { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - localBindPathWithPort = { - localForwards = [ - { - # OK: - host.address = "127.0.0.1"; - host.port = 3000; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + localBindPathWithPort = { + localForwards = [ + { + # OK: + host.address = "127.0.0.1"; + host.port = 3000; - # Error: - bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - bind.port = 3000; - } - ]; - }; + # Error: + bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + bind.port = 3000; + } + ]; }; }; - - test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; }; + + test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; } diff --git a/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix index 283b5fcc796f..e6b5a8699dcd 100644 --- a/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix @@ -1,25 +1,23 @@ { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - localHostPathWithPort = { - localForwards = [ - { - # OK: - bind.address = "127.0.0.1"; - bind.port = 3000; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + localHostPathWithPort = { + localForwards = [ + { + # OK: + bind.address = "127.0.0.1"; + bind.port = 3000; - # Error: - host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - host.port = 3000; - } - ]; - }; + # Error: + host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + host.port = 3000; + } + ]; }; }; - - test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; }; + + test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; } diff --git a/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix index 9720e346efc5..c5c6479b67b6 100644 --- a/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix @@ -1,25 +1,23 @@ { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - remoteBindPathWithPort = { - remoteForwards = [ - { - # OK: - host.address = "127.0.0.1"; - host.port = 3000; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + remoteBindPathWithPort = { + remoteForwards = [ + { + # OK: + host.address = "127.0.0.1"; + host.port = 3000; - # Error: - bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - bind.port = 3000; - } - ]; - }; + # Error: + bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + bind.port = 3000; + } + ]; }; }; - - test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; }; + + test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; } diff --git a/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix index 52fd409bbc4f..5282934a447a 100644 --- a/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix @@ -1,25 +1,23 @@ { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - remoteHostPathWithPort = { - remoteForwards = [ - { - # OK: - bind.address = "127.0.0.1"; - bind.port = 3000; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + remoteHostPathWithPort = { + remoteForwards = [ + { + # OK: + bind.address = "127.0.0.1"; + bind.port = 3000; - # Error: - host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - host.port = 3000; - } - ]; - }; + # Error: + host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + host.port = 3000; + } + ]; }; }; - - test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; }; + + test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ]; } diff --git a/tests/modules/programs/ssh/includes.nix b/tests/modules/programs/ssh/includes.nix index b6a20f7ebbb8..a8bc2917dd6d 100644 --- a/tests/modules/programs/ssh/includes.nix +++ b/tests/modules/programs/ssh/includes.nix @@ -1,17 +1,15 @@ { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - includes = [ - "config.d/*" - "other/dir" - ]; - }; - - nmt.script = '' - assertFileExists home-files/.ssh/config - assertFileContains home-files/.ssh/config "Include config.d/* other/dir" - ''; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + includes = [ + "config.d/*" + "other/dir" + ]; }; + + nmt.script = '' + assertFileExists home-files/.ssh/config + assertFileContains home-files/.ssh/config "Include config.d/* other/dir" + ''; } diff --git a/tests/modules/programs/ssh/match-blocks-attrs.nix b/tests/modules/programs/ssh/match-blocks-attrs.nix index abd312efbbce..f9ff65985edf 100644 --- a/tests/modules/programs/ssh/match-blocks-attrs.nix +++ b/tests/modules/programs/ssh/match-blocks-attrs.nix @@ -1,66 +1,64 @@ { config, lib, ... }: { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - abc = { - identityFile = null; - proxyJump = "jump-host"; - }; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + abc = { + identityFile = null; + proxyJump = "jump-host"; + }; - ordered = lib.hm.dag.entryAfter [ "xyz" ] { port = 1; }; + ordered = lib.hm.dag.entryAfter [ "xyz" ] { port = 1; }; - xyz = { - identityFile = "file"; - serverAliveInterval = 60; - serverAliveCountMax = 10; - localForwards = [ - { - bind.port = 8080; - host.address = "10.0.0.1"; - host.port = 80; - } - ]; - remoteForwards = [ - { - bind.port = 8081; - host.address = "10.0.0.2"; - host.port = 80; - } - { - bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - host.address = "/run/user/1000/gnupg/S.gpg-agent"; - } - ]; - dynamicForwards = [ { port = 2839; } ]; - setEnv = { - FOO = "foo12"; - BAR = "_bar_ 42"; - }; + xyz = { + identityFile = "file"; + serverAliveInterval = 60; + serverAliveCountMax = 10; + localForwards = [ + { + bind.port = 8080; + host.address = "10.0.0.1"; + host.port = 80; + } + ]; + remoteForwards = [ + { + bind.port = 8081; + host.address = "10.0.0.2"; + host.port = 80; + } + { + bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + host.address = "/run/user/1000/gnupg/S.gpg-agent"; + } + ]; + dynamicForwards = [ { port = 2839; } ]; + setEnv = { + FOO = "foo12"; + BAR = "_bar_ 42"; }; + }; - "* !github.com" = { - identityFile = [ - "file1" - "file2" - ]; - port = 516; - }; + "* !github.com" = { + identityFile = [ + "file1" + "file2" + ]; + port = 516; }; }; + }; - home.file.assertions.text = builtins.toJSON ( - map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) - ); + home.file.assertions.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); - nmt.script = '' - assertFileExists home-files/.ssh/config - assertFileContent \ - home-files/.ssh/config \ - ${./match-blocks-attrs-expected.conf} - assertFileContent home-files/assertions ${./no-assertions.json} - ''; - }; + nmt.script = '' + assertFileExists home-files/.ssh/config + assertFileContent \ + home-files/.ssh/config \ + ${./match-blocks-attrs-expected.conf} + assertFileContent home-files/assertions ${./no-assertions.json} + ''; } diff --git a/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix b/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix index a68769d9d1ff..a42539fa4fdd 100644 --- a/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix +++ b/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix @@ -1,35 +1,33 @@ { config, lib, ... }: { - config = { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - abc = { - port = 2222; - }; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + abc = { + port = 2222; + }; - xyz = { - match = "host xyz canonical"; - port = 2223; - }; + xyz = { + match = "host xyz canonical"; + port = 2223; + }; - "* !github.com" = { - port = 516; - }; + "* !github.com" = { + port = 516; }; }; + }; - home.file.assertions.text = builtins.toJSON ( - map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) - ); + home.file.assertions.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); - nmt.script = '' - assertFileExists home-files/.ssh/config - assertFileContent \ - home-files/.ssh/config \ - ${./match-blocks-match-and-hosts-expected.conf} - assertFileContent home-files/assertions ${./no-assertions.json} - ''; - }; + nmt.script = '' + assertFileExists home-files/.ssh/config + assertFileContent \ + home-files/.ssh/config \ + ${./match-blocks-match-and-hosts-expected.conf} + assertFileContent home-files/assertions ${./no-assertions.json} + ''; } diff --git a/tests/modules/programs/swayr/basic-configuration.nix b/tests/modules/programs/swayr/basic-configuration.nix index deb8010fa036..3ca7f46d5f5b 100644 --- a/tests/modules/programs/swayr/basic-configuration.nix +++ b/tests/modules/programs/swayr/basic-configuration.nix @@ -1,127 +1,125 @@ { config, ... }: { - config = { - programs.swayr = { - enable = true; - package = config.lib.test.mkStubPackage { }; - systemd.enable = true; - settings = { - menu = { - executable = "wofi"; - args = [ - "--show=dmenu" - "--allow-markup" - "--allow-images" - "--insensitive" - "--cache-file=/dev/null" - "--parse-search" - "--height=40%" - "--prompt={prompt}" - ]; - }; + programs.swayr = { + enable = true; + package = config.lib.test.mkStubPackage { }; + systemd.enable = true; + settings = { + menu = { + executable = "wofi"; + args = [ + "--show=dmenu" + "--allow-markup" + "--allow-images" + "--insensitive" + "--cache-file=/dev/null" + "--parse-search" + "--height=40%" + "--prompt={prompt}" + ]; + }; - format = { - output_format = ''{indent}Output {name} ({id})''; - workspace_format = ''{indent}Workspace {name} [{layout}] on output {output_name} ({id})''; - container_format = ''{indent}Container [{layout}] {marks} on workspace {workspace_name} ({id})''; - window_format = ''img:{app_icon}:text:{indent}{app_name} — {urgency_start}“{title}”{urgency_end} {marks} on workspace {workspace_name} / {output_name} ({id})''; - indent = " "; - urgency_start = ''''; - urgency_end = ""; - html_escape = true; - }; + format = { + output_format = ''{indent}Output {name} ({id})''; + workspace_format = ''{indent}Workspace {name} [{layout}] on output {output_name} ({id})''; + container_format = ''{indent}Container [{layout}] {marks} on workspace {workspace_name} ({id})''; + window_format = ''img:{app_icon}:text:{indent}{app_name} — {urgency_start}“{title}”{urgency_end} {marks} on workspace {workspace_name} / {output_name} ({id})''; + indent = " "; + urgency_start = ''''; + urgency_end = ""; + html_escape = true; + }; - layout = { - auto_tile = false; - auto_tile_min_window_width_per_output_width = [ - [ - 800 - 400 - ] - [ - 1024 - 500 - ] - [ - 1280 - 600 - ] - [ - 1400 - 680 - ] - [ - 1440 - 700 - ] - [ - 1600 - 780 - ] - [ - 1680 - 780 - ] - [ - 1920 - 920 - ] - [ - 2048 - 980 - ] - [ - 2560 - 1000 - ] - [ - 3440 - 1200 - ] - [ - 3840 - 1280 - ] - [ - 4096 - 1400 - ] - [ - 4480 - 1600 - ] - [ - 7680 - 2400 - ] - ]; - }; + layout = { + auto_tile = false; + auto_tile_min_window_width_per_output_width = [ + [ + 800 + 400 + ] + [ + 1024 + 500 + ] + [ + 1280 + 600 + ] + [ + 1400 + 680 + ] + [ + 1440 + 700 + ] + [ + 1600 + 780 + ] + [ + 1680 + 780 + ] + [ + 1920 + 920 + ] + [ + 2048 + 980 + ] + [ + 2560 + 1000 + ] + [ + 3440 + 1200 + ] + [ + 3840 + 1280 + ] + [ + 4096 + 1400 + ] + [ + 4480 + 1600 + ] + [ + 7680 + 2400 + ] + ]; + }; - focus = { - lockin_delay = 750; - }; + focus = { + lockin_delay = 750; + }; - misc = { - seq_inhibit = false; - }; + misc = { + seq_inhibit = false; }; - extraConfig = '' - [extra] - foo = "\ubar" - ''; }; + extraConfig = '' + [extra] + foo = "\ubar" + ''; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/swayrd.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/swayrd.service - assertFileExists $serviceFile - assertFileRegex $serviceFile 'ExecStart=.*/bin/swayrd' - assertFileRegex $serviceFile 'Environment=RUST_BACKTRACE=1' + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/swayrd' + assertFileRegex $serviceFile 'Environment=RUST_BACKTRACE=1' - assertFileExists home-files/.config/swayr/config.toml - assertFileContent home-files/.config/swayr/config.toml \ - ${./basic-configuration.toml} - ''; - }; + assertFileExists home-files/.config/swayr/config.toml + assertFileContent home-files/.config/swayr/config.toml \ + ${./basic-configuration.toml} + ''; } diff --git a/tests/modules/programs/swayr/empty-configuration.nix b/tests/modules/programs/swayr/empty-configuration.nix index a68c1073c5cb..2d187319ee4c 100644 --- a/tests/modules/programs/swayr/empty-configuration.nix +++ b/tests/modules/programs/swayr/empty-configuration.nix @@ -1,21 +1,19 @@ { config, ... }: { - config = { - programs.swayr = { - enable = true; - package = config.lib.test.mkStubPackage { }; - systemd.enable = true; - }; + programs.swayr = { + enable = true; + package = config.lib.test.mkStubPackage { }; + systemd.enable = true; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/swayrd.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/swayrd.service - assertFileExists $serviceFile - assertFileRegex $serviceFile 'ExecStart=.*/bin/swayrd' - assertFileRegex $serviceFile 'Environment=RUST_BACKTRACE=1' + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/swayrd' + assertFileRegex $serviceFile 'Environment=RUST_BACKTRACE=1' - assertPathNotExists home-files/.config/swayr/config.toml - ''; - }; + assertPathNotExists home-files/.config/swayr/config.toml + ''; } diff --git a/tests/modules/programs/tealdeer/custom-settings.nix b/tests/modules/programs/tealdeer/custom-settings.nix index ea7c5deaa933..506c23345333 100644 --- a/tests/modules/programs/tealdeer/custom-settings.nix +++ b/tests/modules/programs/tealdeer/custom-settings.nix @@ -1,35 +1,33 @@ { config, pkgs, ... }: { - config = { - programs.tealdeer = { - package = config.lib.test.mkStubPackage { name = "tldr"; }; - enable = true; - settings = { - updates = { - auto_update = true; - auto_update_interval_hours = 72; - }; - display = { - use_pager = false; - }; + programs.tealdeer = { + package = config.lib.test.mkStubPackage { name = "tldr"; }; + enable = true; + settings = { + updates = { + auto_update = true; + auto_update_interval_hours = 72; + }; + display = { + use_pager = false; }; }; + }; - nmt.script = - let - expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; - in - '' - assertFileExists "${expectedConfigPath}" - assertFileContent "${expectedConfigPath}" ${pkgs.writeText "tealdeer.config-custom.expected" '' - [display] - use_pager = false + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; + in + '' + assertFileExists "${expectedConfigPath}" + assertFileContent "${expectedConfigPath}" ${pkgs.writeText "tealdeer.config-custom.expected" '' + [display] + use_pager = false - [updates] - auto_update = true - auto_update_interval_hours = 72 - ''} - ''; - }; + [updates] + auto_update = true + auto_update_interval_hours = 72 + ''} + ''; } diff --git a/tests/modules/programs/tealdeer/default-settings.nix b/tests/modules/programs/tealdeer/default-settings.nix index a1638013af33..4cc5023d134f 100644 --- a/tests/modules/programs/tealdeer/default-settings.nix +++ b/tests/modules/programs/tealdeer/default-settings.nix @@ -1,18 +1,16 @@ { config, pkgs, ... }: { - config = { - programs.tealdeer = { - package = config.lib.test.mkStubPackage { name = "tldr"; }; - enable = true; - }; - - nmt.script = - let - expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; - in - '' - assertPathNotExists "${expectedConfigPath}" - ''; + programs.tealdeer = { + package = config.lib.test.mkStubPackage { name = "tldr"; }; + enable = true; }; + + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; + in + '' + assertPathNotExists "${expectedConfigPath}" + ''; } diff --git a/tests/modules/programs/tex-fmt/custom-settings.nix b/tests/modules/programs/tex-fmt/custom-settings.nix index b5647761f2e9..b1ce5cbe73ae 100644 --- a/tests/modules/programs/tex-fmt/custom-settings.nix +++ b/tests/modules/programs/tex-fmt/custom-settings.nix @@ -1,29 +1,27 @@ { pkgs, ... }: { - config = { - programs.tex-fmt = { - enable = true; - settings = { - wrap = true; - tabsize = 2; - tabchar = "space"; - lists = [ ]; - }; + programs.tex-fmt = { + enable = true; + settings = { + wrap = true; + tabsize = 2; + tabchar = "space"; + lists = [ ]; }; - - nmt.script = - let - expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; - in - '' - assertFileExists "${expectedConfigPath}" - assertFileContent "${expectedConfigPath}" ${pkgs.writeText "tex-fmt.config-custom.expected" '' - lists = [] - tabchar = "space" - tabsize = 2 - wrap = true - ''} - ''; }; + + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; + in + '' + assertFileExists "${expectedConfigPath}" + assertFileContent "${expectedConfigPath}" ${pkgs.writeText "tex-fmt.config-custom.expected" '' + lists = [] + tabchar = "space" + tabsize = 2 + wrap = true + ''} + ''; } diff --git a/tests/modules/programs/tex-fmt/default-settings.nix b/tests/modules/programs/tex-fmt/default-settings.nix index a17cd403f343..aa4f34e5f1ca 100644 --- a/tests/modules/programs/tex-fmt/default-settings.nix +++ b/tests/modules/programs/tex-fmt/default-settings.nix @@ -1,17 +1,15 @@ { pkgs, ... }: { - config = { - programs.tex-fmt = { - enable = true; - }; - - nmt.script = - let - expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; - in - '' - assertPathNotExists "${expectedConfigPath}" - ''; + programs.tex-fmt = { + enable = true; }; + + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; + in + '' + assertPathNotExists "${expectedConfigPath}" + ''; } diff --git a/tests/modules/programs/texlive/texlive-minimal.nix b/tests/modules/programs/texlive/texlive-minimal.nix index a33d57401c0f..63c33e26c122 100644 --- a/tests/modules/programs/texlive/texlive-minimal.nix +++ b/tests/modules/programs/texlive/texlive-minimal.nix @@ -1,25 +1,23 @@ { lib, pkgs, ... }: { - config = { - programs.texlive.enable = true; + programs.texlive.enable = true; - # Set up a minimal mocked texlive package set. - nixpkgs.overlays = [ - (_self: _super: { - texlive = { - collection-basic = pkgs.writeTextDir "collection-basic" ""; - combine = - tpkgs: - pkgs.symlinkJoin { - name = "dummy-texlive-combine"; - paths = lib.attrValues tpkgs; - }; - }; - }) - ]; + # Set up a minimal mocked texlive package set. + nixpkgs.overlays = [ + (_self: _super: { + texlive = { + collection-basic = pkgs.writeTextDir "collection-basic" ""; + combine = + tpkgs: + pkgs.symlinkJoin { + name = "dummy-texlive-combine"; + paths = lib.attrValues tpkgs; + }; + }; + }) + ]; - nmt.script = '' - assertFileExists home-path/collection-basic - ''; - }; + nmt.script = '' + assertFileExists home-path/collection-basic + ''; } diff --git a/tests/modules/programs/tmux/default-shell.nix b/tests/modules/programs/tmux/default-shell.nix index bd1bb198f37e..6917eb051fb4 100644 --- a/tests/modules/programs/tmux/default-shell.nix +++ b/tests/modules/programs/tmux/default-shell.nix @@ -1,13 +1,11 @@ { - config = { - programs.tmux = { - enable = true; - shell = "/usr/bin/myshell"; - }; - - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf ${./default-shell.conf} - ''; + programs.tmux = { + enable = true; + shell = "/usr/bin/myshell"; }; + + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf ${./default-shell.conf} + ''; } diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix index 2d2dd7fcc2d5..8a59fcbcbe00 100644 --- a/tests/modules/programs/tmux/disable-confirmation-prompt.nix +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix @@ -1,24 +1,22 @@ { - config = { - programs.tmux = { - enable = true; - disableConfirmationPrompt = true; - }; + programs.tmux = { + enable = true; + disableConfirmationPrompt = true; + }; - nixpkgs.overlays = [ - (_self: super: { - tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { - rtp = "@sensible_rtp@"; - }; + nixpkgs.overlays = [ + (_self: super: { + tmuxPlugins = super.tmuxPlugins // { + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf \ - ${./disable-confirmation-prompt.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ + ${./disable-confirmation-prompt.conf} + ''; } diff --git a/tests/modules/programs/tmux/emacs-with-plugins.nix b/tests/modules/programs/tmux/emacs-with-plugins.nix index 9b9fa3ed64ae..32fb7328dd2e 100644 --- a/tests/modules/programs/tmux/emacs-with-plugins.nix +++ b/tests/modules/programs/tmux/emacs-with-plugins.nix @@ -1,46 +1,44 @@ { pkgs, ... }: { - config = { - programs.tmux = { - aggressiveResize = true; - clock24 = true; - enable = true; - keyMode = "emacs"; - newSession = true; - reverseSplit = true; + programs.tmux = { + aggressiveResize = true; + clock24 = true; + enable = true; + keyMode = "emacs"; + newSession = true; + reverseSplit = true; - plugins = with pkgs.tmuxPlugins; [ - logging - prefix-highlight - fzf-tmux-url - ]; - }; + plugins = with pkgs.tmuxPlugins; [ + logging + prefix-highlight + fzf-tmux-url + ]; + }; - nixpkgs.overlays = [ - (_self: super: { - tmuxPlugins = super.tmuxPlugins // { - fzf-tmux-url = super.tmuxPlugins.fzf-tmux-url // { - rtp = "@tmuxplugin_fzf_tmux_url_rtp@"; - }; + nixpkgs.overlays = [ + (_self: super: { + tmuxPlugins = super.tmuxPlugins // { + fzf-tmux-url = super.tmuxPlugins.fzf-tmux-url // { + rtp = "@tmuxplugin_fzf_tmux_url_rtp@"; + }; - logging = super.tmuxPlugins.logging // { - rtp = "@tmuxplugin_logging_rtp@"; - }; + logging = super.tmuxPlugins.logging // { + rtp = "@tmuxplugin_logging_rtp@"; + }; - prefix-highlight = super.tmuxPlugins.prefix-highlight // { - rtp = "@tmuxplugin_prefix_highlight_rtp@"; - }; + prefix-highlight = super.tmuxPlugins.prefix-highlight // { + rtp = "@tmuxplugin_prefix_highlight_rtp@"; + }; - sensible = super.tmuxPlugins.sensible // { - rtp = "@tmuxplugin_sensible_rtp@"; - }; + sensible = super.tmuxPlugins.sensible // { + rtp = "@tmuxplugin_sensible_rtp@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf ${./emacs-with-plugins.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf ${./emacs-with-plugins.conf} + ''; } diff --git a/tests/modules/programs/tmux/mouse-enabled.nix b/tests/modules/programs/tmux/mouse-enabled.nix index 97f8ca2cc3ad..24b9f482e9a2 100644 --- a/tests/modules/programs/tmux/mouse-enabled.nix +++ b/tests/modules/programs/tmux/mouse-enabled.nix @@ -1,24 +1,22 @@ { - config = { - programs.tmux = { - enable = true; - mouse = true; - }; + programs.tmux = { + enable = true; + mouse = true; + }; - nixpkgs.overlays = [ - (_self: super: { - tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { - rtp = "@sensible_rtp@"; - }; + nixpkgs.overlays = [ + (_self: super: { + tmuxPlugins = super.tmuxPlugins // { + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf \ - ${./mouse-enabled.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ + ${./mouse-enabled.conf} + ''; } diff --git a/tests/modules/programs/tmux/not-enabled.nix b/tests/modules/programs/tmux/not-enabled.nix index 16c8137a8aeb..9a4766b60bfa 100644 --- a/tests/modules/programs/tmux/not-enabled.nix +++ b/tests/modules/programs/tmux/not-enabled.nix @@ -1,11 +1,9 @@ { - config = { - programs.tmux = { - enable = false; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/tmux/tmux.conf - ''; + programs.tmux = { + enable = false; }; + + nmt.script = '' + assertPathNotExists home-files/.config/tmux/tmux.conf + ''; } diff --git a/tests/modules/programs/tmux/prefix.nix b/tests/modules/programs/tmux/prefix.nix index f71fa2266b32..c24a726415df 100644 --- a/tests/modules/programs/tmux/prefix.nix +++ b/tests/modules/programs/tmux/prefix.nix @@ -1,24 +1,22 @@ { - config = { - programs.tmux = { - enable = true; - prefix = "C-a"; - }; + programs.tmux = { + enable = true; + prefix = "C-a"; + }; - nixpkgs.overlays = [ - (_self: super: { - tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { - rtp = "@sensible_rtp@"; - }; + nixpkgs.overlays = [ + (_self: super: { + tmuxPlugins = super.tmuxPlugins // { + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf \ - ${./prefix.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ + ${./prefix.conf} + ''; } diff --git a/tests/modules/programs/tmux/secure-socket-enabled.nix b/tests/modules/programs/tmux/secure-socket-enabled.nix index eeb708f7cbae..b463c4734510 100644 --- a/tests/modules/programs/tmux/secure-socket-enabled.nix +++ b/tests/modules/programs/tmux/secure-socket-enabled.nix @@ -1,14 +1,12 @@ { - config = { - programs.tmux = { - enable = true; - secureSocket = true; - }; - - nmt.script = '' - assertFileExists home-path/etc/profile.d/hm-session-vars.sh - assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ - 'export TMUX_TMPDIR="''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}"' - ''; + programs.tmux = { + enable = true; + secureSocket = true; }; + + nmt.script = '' + assertFileExists home-path/etc/profile.d/hm-session-vars.sh + assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ + 'export TMUX_TMPDIR="''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}"' + ''; } diff --git a/tests/modules/programs/tmux/shortcut-without-prefix.nix b/tests/modules/programs/tmux/shortcut-without-prefix.nix index 17f609ab60a0..2f04ae1b288a 100644 --- a/tests/modules/programs/tmux/shortcut-without-prefix.nix +++ b/tests/modules/programs/tmux/shortcut-without-prefix.nix @@ -1,25 +1,23 @@ { - config = { - programs.tmux = { - enable = true; - shortcut = "a"; - prefix = null; - }; + programs.tmux = { + enable = true; + shortcut = "a"; + prefix = null; + }; - nixpkgs.overlays = [ - (_self: super: { - tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { - rtp = "@sensible_rtp@"; - }; + nixpkgs.overlays = [ + (_self: super: { + tmuxPlugins = super.tmuxPlugins // { + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf \ - ${./shortcut-without-prefix.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ + ${./shortcut-without-prefix.conf} + ''; } diff --git a/tests/modules/programs/tmux/vi-all-true.nix b/tests/modules/programs/tmux/vi-all-true.nix index baf676da0bdd..9ab721c0a90c 100644 --- a/tests/modules/programs/tmux/vi-all-true.nix +++ b/tests/modules/programs/tmux/vi-all-true.nix @@ -1,27 +1,25 @@ { - config = { - programs.tmux = { - aggressiveResize = true; - clock24 = true; - enable = true; - keyMode = "vi"; - newSession = true; - reverseSplit = true; - }; + programs.tmux = { + aggressiveResize = true; + clock24 = true; + enable = true; + keyMode = "vi"; + newSession = true; + reverseSplit = true; + }; - nixpkgs.overlays = [ - (_self: super: { - tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { - rtp = "@sensible_rtp@"; - }; + nixpkgs.overlays = [ + (_self: super: { + tmuxPlugins = super.tmuxPlugins // { + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; }; - }) - ]; + }; + }) + ]; - nmt.script = '' - assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf ${./vi-all-true.conf} - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf ${./vi-all-true.conf} + ''; } diff --git a/tests/modules/programs/vesktop/basic-configuration.nix b/tests/modules/programs/vesktop/basic-configuration.nix index 6737678ca082..0e53139081b5 100644 --- a/tests/modules/programs/vesktop/basic-configuration.nix +++ b/tests/modules/programs/vesktop/basic-configuration.nix @@ -1,57 +1,55 @@ { - config = { - programs.vesktop = { - enable = true; + programs.vesktop = { + enable = true; + settings = { + tray = false; + minimizeToTray = false; + hardwareAcceleration = true; + customTitleBar = false; + staticTitle = true; + discordBranch = "stable"; + }; + vencord = { + themes.my_theme = '' + .privateChannels_f0963d::after { + content: ""; + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 1000; + background: linear-gradient(to bottom, transparent 85%, var(--base00)); + pointer-events: none; + } + ''; settings = { - tray = false; - minimizeToTray = false; - hardwareAcceleration = true; - customTitleBar = false; - staticTitle = true; - discordBranch = "stable"; - }; - vencord = { - themes.my_theme = '' - .privateChannels_f0963d::after { - content: ""; - position: absolute; - width: 100%; - height: 100%; - top: 0; - left: 0; - z-index: 1000; - background: linear-gradient(to bottom, transparent 85%, var(--base00)); - pointer-events: none; - } - ''; - settings = { - autoUpdate = false; - autoUpdateNotification = false; - notifyAboutUpdates = false; - useQuickCss = true; - disableMinSize = true; - plugins = { - MessageLogger = { - enabled = true; - ignoreSelf = true; - }; - FakeNitro.enabled = true; + autoUpdate = false; + autoUpdateNotification = false; + notifyAboutUpdates = false; + useQuickCss = true; + disableMinSize = true; + plugins = { + MessageLogger = { + enabled = true; + ignoreSelf = true; }; + FakeNitro.enabled = true; }; }; }; - - nmt.script = '' - configDir=home-files/.config/vesktop - assertFileExists $configDir/settings.json - assertFileContent $configDir/settings.json \ - ${./basic-settings.json} - assertFileExists $configDir/settings/settings.json - assertFileContent $configDir/settings/settings.json \ - ${./basic-vencord-settings.json} - assertFileExists $configDir/themes/my_theme.css - assertFileContent $configDir/themes/my_theme.css \ - ${./basic-theme.css} - ''; }; + + nmt.script = '' + configDir=home-files/.config/vesktop + assertFileExists $configDir/settings.json + assertFileContent $configDir/settings.json \ + ${./basic-settings.json} + assertFileExists $configDir/settings/settings.json + assertFileContent $configDir/settings/settings.json \ + ${./basic-vencord-settings.json} + assertFileExists $configDir/themes/my_theme.css + assertFileContent $configDir/themes/my_theme.css \ + ${./basic-theme.css} + ''; } diff --git a/tests/modules/programs/waybar/deprecated-modules-option.nix b/tests/modules/programs/waybar/deprecated-modules-option.nix index eddf949ee886..2d89e845aaa5 100644 --- a/tests/modules/programs/waybar/deprecated-modules-option.nix +++ b/tests/modules/programs/waybar/deprecated-modules-option.nix @@ -1,43 +1,41 @@ { config, ... }: { - config = { - home.stateVersion = "22.05"; + home.stateVersion = "22.05"; - programs.waybar = { - package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; - enable = true; - settings = [ - { - modules-center = [ "test" ]; - modules = { - "test" = { }; - }; - } - ]; - }; - - test.asserts.assertions.expected = [ - '' - The `programs.waybar.settings.[].modules` option has been removed. - It is now possible to declare modules in the configuration without nesting them under the `modules` option. - '' + programs.waybar = { + package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; + enable = true; + settings = [ + { + modules-center = [ "test" ]; + modules = { + "test" = { }; + }; + } ]; - - nmt.script = '' - assertPathNotExists home-files/.config/waybar/style.css - assertFileContent \ - home-files/.config/waybar/config \ - ${builtins.toFile "waybar-deprecated-modules-option.json" '' - [ - { - "modules-center": [ - "test" - ], - "test": {} - } - ] - ''} - ''; }; + + test.asserts.assertions.expected = [ + '' + The `programs.waybar.settings.[].modules` option has been removed. + It is now possible to declare modules in the configuration without nesting them under the `modules` option. + '' + ]; + + nmt.script = '' + assertPathNotExists home-files/.config/waybar/style.css + assertFileContent \ + home-files/.config/waybar/config \ + ${builtins.toFile "waybar-deprecated-modules-option.json" '' + [ + { + "modules-center": [ + "test" + ], + "test": {} + } + ] + ''} + ''; } diff --git a/tests/modules/programs/waybar/settings-complex.nix b/tests/modules/programs/waybar/settings-complex.nix index 438e0f5506b9..08291d8d534e 100644 --- a/tests/modules/programs/waybar/settings-complex.nix +++ b/tests/modules/programs/waybar/settings-complex.nix @@ -1,80 +1,78 @@ { config, ... }: { - config = { - home.stateVersion = "21.11"; + home.stateVersion = "21.11"; - programs.waybar = { - package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; - enable = true; - settings = [ - { - layer = "top"; - position = "top"; - height = 30; - output = [ "DP-1" ]; - modules-left = [ - "sway/workspaces" - "sway/mode" - "custom/my-module" - ]; - modules-center = [ "sway/window" ]; - modules-right = [ - "idle_inhibitor" - "pulseaudio" - "network" - "cpu" - "memory" - "backlight" - "tray" - "battery#bat1" - "battery#bat2" - "clock" - ]; + programs.waybar = { + package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; + enable = true; + settings = [ + { + layer = "top"; + position = "top"; + height = 30; + output = [ "DP-1" ]; + modules-left = [ + "sway/workspaces" + "sway/mode" + "custom/my-module" + ]; + modules-center = [ "sway/window" ]; + modules-right = [ + "idle_inhibitor" + "pulseaudio" + "network" + "cpu" + "memory" + "backlight" + "tray" + "battery#bat1" + "battery#bat2" + "clock" + ]; - modules = { - "sway/workspaces" = { - disable-scroll = true; - all-outputs = true; - }; - "sway/mode" = { - tooltip = false; - }; - "sway/window" = { - max-length = 120; - }; - "idle_inhibitor" = { - format = "{icon}"; - }; - "custom/my-module" = { - format = "hello from {}"; - exec = - let - dummyScript = config.lib.test.mkStubPackage { outPath = "@dummy@"; }; - in - "${dummyScript}/bin/dummy"; - }; + modules = { + "sway/workspaces" = { + disable-scroll = true; + all-outputs = true; }; - } - { - position = "bottom"; - output = [ "!DP-1" ]; - modules-left = [ "sway/mode" ]; - modules-center = [ "clock" ]; - modules = { - "sway/mode" = { - tooltip = true; - }; + "sway/mode" = { + tooltip = false; }; - } - ]; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/waybar/style.css - assertFileContent \ - home-files/.config/waybar/config \ - ${./settings-complex-expected.json} - ''; + "sway/window" = { + max-length = 120; + }; + "idle_inhibitor" = { + format = "{icon}"; + }; + "custom/my-module" = { + format = "hello from {}"; + exec = + let + dummyScript = config.lib.test.mkStubPackage { outPath = "@dummy@"; }; + in + "${dummyScript}/bin/dummy"; + }; + }; + } + { + position = "bottom"; + output = [ "!DP-1" ]; + modules-left = [ "sway/mode" ]; + modules-center = [ "clock" ]; + modules = { + "sway/mode" = { + tooltip = true; + }; + }; + } + ]; }; + + nmt.script = '' + assertPathNotExists home-files/.config/waybar/style.css + assertFileContent \ + home-files/.config/waybar/config \ + ${./settings-complex-expected.json} + ''; } diff --git a/tests/modules/programs/waybar/settings-with-attrs.nix b/tests/modules/programs/waybar/settings-with-attrs.nix index 7b0a68e7f548..e40cf2df1d23 100644 --- a/tests/modules/programs/waybar/settings-with-attrs.nix +++ b/tests/modules/programs/waybar/settings-with-attrs.nix @@ -6,30 +6,28 @@ }: { - config = { - home.stateVersion = "21.11"; + home.stateVersion = "21.11"; - programs.waybar = { - package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; - enable = true; - settings = - let - settingsComplex = - (import ./settings-complex.nix { - inherit config lib pkgs; - }).config.programs.waybar.settings; - in - { - mainBar = builtins.head settingsComplex; - secondaryBar = builtins.elemAt settingsComplex 1; - }; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/waybar/style.css - assertFileContent \ - home-files/.config/waybar/config \ - ${./settings-complex-expected.json} - ''; + programs.waybar = { + package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; + enable = true; + settings = + let + settingsComplex = + (import ./settings-complex.nix { + inherit config lib pkgs; + }).programs.waybar.settings; + in + { + mainBar = builtins.head settingsComplex; + secondaryBar = builtins.elemAt settingsComplex 1; + }; }; + + nmt.script = '' + assertPathNotExists home-files/.config/waybar/style.css + assertFileContent \ + home-files/.config/waybar/config \ + ${./settings-complex-expected.json} + ''; } diff --git a/tests/modules/programs/waybar/styling.nix b/tests/modules/programs/waybar/styling.nix index 0025acd5f603..5947e56e3752 100644 --- a/tests/modules/programs/waybar/styling.nix +++ b/tests/modules/programs/waybar/styling.nix @@ -1,44 +1,42 @@ { config, ... }: { - config = { - home.stateVersion = "21.11"; + home.stateVersion = "21.11"; - programs.waybar = { - package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; - enable = true; - style = '' - * { - border: none; - border-radius: 0; - font-family: Source Code Pro; - font-weight: bold; - color: #abb2bf; - font-size: 18px; - min-height: 0px; - } - window#waybar { - background: #16191C; - color: #aab2bf; - } - #window { - padding: 0 0px; - } - #workspaces button:hover { - box-shadow: inherit; - text-shadow: inherit; - background: #16191C; - border: #16191C; - padding: 0 3px; - } - ''; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/waybar/config - assertFileContent \ - home-files/.config/waybar/style.css \ - ${./styling-expected.css} + programs.waybar = { + package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; + enable = true; + style = '' + * { + border: none; + border-radius: 0; + font-family: Source Code Pro; + font-weight: bold; + color: #abb2bf; + font-size: 18px; + min-height: 0px; + } + window#waybar { + background: #16191C; + color: #aab2bf; + } + #window { + padding: 0 0px; + } + #workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; + background: #16191C; + border: #16191C; + padding: 0 3px; + } ''; }; + + nmt.script = '' + assertPathNotExists home-files/.config/waybar/config + assertFileContent \ + home-files/.config/waybar/style.css \ + ${./styling-expected.css} + ''; } diff --git a/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix b/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix index 4beddf41faaf..83dc8762e12b 100644 --- a/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix +++ b/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix @@ -1,22 +1,20 @@ { config, ... }: { - config = { - home.stateVersion = "21.11"; + home.stateVersion = "21.11"; - programs.waybar = { - package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; - enable = true; - systemd.enable = true; - systemd.target = "sway-session.target"; - }; + programs.waybar = { + package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; + enable = true; + systemd.enable = true; + systemd.target = "sway-session.target"; + }; - nmt.script = '' - assertPathNotExists home-files/.config/waybar/config - assertPathNotExists home-files/.config/waybar/style.css + nmt.script = '' + assertPathNotExists home-files/.config/waybar/config + assertPathNotExists home-files/.config/waybar/style.css - serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/waybar.service) - assertFileContent "$serviceFile" ${./systemd-with-graphical-session-target.service} - ''; - }; + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/waybar.service) + assertFileContent "$serviceFile" ${./systemd-with-graphical-session-target.service} + ''; } diff --git a/tests/modules/programs/wleave/layout-multiple.nix b/tests/modules/programs/wleave/layout-multiple.nix index 6c218d21b61b..e4e591e134c6 100644 --- a/tests/modules/programs/wleave/layout-multiple.nix +++ b/tests/modules/programs/wleave/layout-multiple.nix @@ -1,64 +1,62 @@ { config, ... }: { - config = { - home.stateVersion = "22.11"; + home.stateVersion = "22.11"; - programs.wleave = { - package = config.lib.test.mkStubPackage { outPath = "@wleave@"; }; - enable = true; - settings = { - no-version-info = true; - buttons-per-row = "3"; + programs.wleave = { + package = config.lib.test.mkStubPackage { outPath = "@wleave@"; }; + enable = true; + settings = { + no-version-info = true; + buttons-per-row = "3"; - buttons = [ - { - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown"; - keybind = "s"; - } - { - label = "hibernate"; - action = "systemctl hibernate"; - text = "Hibernate"; - keybind = "h"; - height = 0.5; - width = 0.5; - } - { - label = "suspend"; - action = "systemctl suspend"; - text = "Suspend"; - keybind = "u"; - circular = true; - } - { - label = "exit"; - action = "swaymsg exit"; - text = "Exit"; - keybind = "e"; - } - { - label = "reboot"; - action = "systemctl reboot"; - text = "Reboot"; - keybind = "r"; - } - { - label = "lock"; - action = "gtklock"; - text = "Lock"; - keybind = "l"; - } - ]; - }; + buttons = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + height = 0.5; + width = 0.5; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "u"; + circular = true; + } + { + label = "exit"; + action = "swaymsg exit"; + text = "Exit"; + keybind = "e"; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + } + { + label = "lock"; + action = "gtklock"; + text = "Lock"; + keybind = "l"; + } + ]; }; - - nmt.script = '' - assertPathNotExists home-files/.config/wleave/style.css - assertFileContent \ - home-files/.config/wleave/layout.json \ - ${./layout-multiple-expected.json} - ''; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wleave/style.css + assertFileContent \ + home-files/.config/wleave/layout.json \ + ${./layout-multiple-expected.json} + ''; } diff --git a/tests/modules/programs/wleave/layout-single.nix b/tests/modules/programs/wleave/layout-single.nix index 031ca5cc5371..c366ade483b7 100644 --- a/tests/modules/programs/wleave/layout-single.nix +++ b/tests/modules/programs/wleave/layout-single.nix @@ -1,26 +1,24 @@ { config, ... }: { - config = { - home.stateVersion = "22.11"; + home.stateVersion = "22.11"; - programs.wleave = { - package = config.lib.test.mkStubPackage { outPath = "@wleave@"; }; - enable = true; - settings.buttons = [ - { - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown"; - keybind = "s"; - } - ]; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/wleave/style.css - assertFileContent \ - home-files/.config/wleave/layout.json \ - ${./layout-single-expected.json} - ''; + programs.wleave = { + package = config.lib.test.mkStubPackage { outPath = "@wleave@"; }; + enable = true; + settings.buttons = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + ]; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wleave/style.css + assertFileContent \ + home-files/.config/wleave/layout.json \ + ${./layout-single-expected.json} + ''; } diff --git a/tests/modules/programs/wleave/styling.nix b/tests/modules/programs/wleave/styling.nix index f4b6c536a77d..8f173a803be0 100644 --- a/tests/modules/programs/wleave/styling.nix +++ b/tests/modules/programs/wleave/styling.nix @@ -1,36 +1,34 @@ { config, ... }: { - config = { - home.stateVersion = "22.11"; + home.stateVersion = "22.11"; - programs.wleave = { - package = config.lib.test.mkStubPackage { outPath = "@wleave@"; }; - enable = true; - style = '' - * { - border: none; - border-radius: 0; - font-family: Source Code Pro; - font-weight: bold; - color: #abb2bf; - font-size: 18px; - min-height: 0px; - } - window { - background: #16191C; - color: #aab2bf; - } - #window { - padding: 0 0px; - } - ''; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/wleave/layout.json - assertFileContent \ - home-files/.config/wleave/style.css \ - ${./styling-expected.css} + programs.wleave = { + package = config.lib.test.mkStubPackage { outPath = "@wleave@"; }; + enable = true; + style = '' + * { + border: none; + border-radius: 0; + font-family: Source Code Pro; + font-weight: bold; + color: #abb2bf; + font-size: 18px; + min-height: 0px; + } + window { + background: #16191C; + color: #aab2bf; + } + #window { + padding: 0 0px; + } ''; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wleave/layout.json + assertFileContent \ + home-files/.config/wleave/style.css \ + ${./styling-expected.css} + ''; } diff --git a/tests/modules/programs/wlogout/layout-multiple.nix b/tests/modules/programs/wlogout/layout-multiple.nix index 4d8898eb3316..fe0763ce0bd0 100644 --- a/tests/modules/programs/wlogout/layout-multiple.nix +++ b/tests/modules/programs/wlogout/layout-multiple.nix @@ -1,59 +1,57 @@ { config, ... }: { - config = { - home.stateVersion = "22.11"; + home.stateVersion = "22.11"; - programs.wlogout = { - package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; - enable = true; - layout = [ - { - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown"; - keybind = "s"; - } - { - label = "hibernate"; - action = "systemctl hibernate"; - text = "Hibernate"; - keybind = "h"; - height = 0.5; - width = 0.5; - } - { - label = "suspend"; - action = "systemctl suspend"; - text = "Suspend"; - keybind = "u"; - circular = true; - } - { - label = "exit"; - action = "swaymsg exit"; - text = "Exit"; - keybind = "e"; - } - { - label = "reboot"; - action = "systemctl reboot"; - text = "Reboot"; - keybind = "r"; - } - { - label = "lock"; - action = "gtklock"; - text = "Lock"; - keybind = "l"; - } - ]; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/wlogout/style.css - assertFileContent \ - home-files/.config/wlogout/layout \ - ${./layout-multiple-expected.json} - ''; + programs.wlogout = { + package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; + enable = true; + layout = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + height = 0.5; + width = 0.5; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "u"; + circular = true; + } + { + label = "exit"; + action = "swaymsg exit"; + text = "Exit"; + keybind = "e"; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + } + { + label = "lock"; + action = "gtklock"; + text = "Lock"; + keybind = "l"; + } + ]; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wlogout/style.css + assertFileContent \ + home-files/.config/wlogout/layout \ + ${./layout-multiple-expected.json} + ''; } diff --git a/tests/modules/programs/wlogout/layout-single.nix b/tests/modules/programs/wlogout/layout-single.nix index 1b1788bf5b17..2e9b486b0cea 100644 --- a/tests/modules/programs/wlogout/layout-single.nix +++ b/tests/modules/programs/wlogout/layout-single.nix @@ -1,26 +1,24 @@ { config, ... }: { - config = { - home.stateVersion = "22.11"; + home.stateVersion = "22.11"; - programs.wlogout = { - package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; - enable = true; - layout = [ - { - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown"; - keybind = "s"; - } - ]; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/wlogout/style.css - assertFileContent \ - home-files/.config/wlogout/layout \ - ${./layout-single-expected.json} - ''; + programs.wlogout = { + package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; + enable = true; + layout = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + ]; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wlogout/style.css + assertFileContent \ + home-files/.config/wlogout/layout \ + ${./layout-single-expected.json} + ''; } diff --git a/tests/modules/programs/wlogout/styling.nix b/tests/modules/programs/wlogout/styling.nix index bca1b024fac6..d6450200b385 100644 --- a/tests/modules/programs/wlogout/styling.nix +++ b/tests/modules/programs/wlogout/styling.nix @@ -1,36 +1,34 @@ { config, ... }: { - config = { - home.stateVersion = "22.11"; + home.stateVersion = "22.11"; - programs.wlogout = { - package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; - enable = true; - style = '' - * { - border: none; - border-radius: 0; - font-family: Source Code Pro; - font-weight: bold; - color: #abb2bf; - font-size: 18px; - min-height: 0px; - } - window { - background: #16191C; - color: #aab2bf; - } - #window { - padding: 0 0px; - } - ''; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/wlogout/layout - assertFileContent \ - home-files/.config/wlogout/style.css \ - ${./styling-expected.css} + programs.wlogout = { + package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; + enable = true; + style = '' + * { + border: none; + border-radius: 0; + font-family: Source Code Pro; + font-weight: bold; + color: #abb2bf; + font-size: 18px; + min-height: 0px; + } + window { + background: #16191C; + color: #aab2bf; + } + #window { + padding: 0 0px; + } ''; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wlogout/layout + assertFileContent \ + home-files/.config/wlogout/style.css \ + ${./styling-expected.css} + ''; } diff --git a/tests/modules/programs/wofi/basic-configuration.nix b/tests/modules/programs/wofi/basic-configuration.nix index afcb69c77e11..9ae1a6ec4f89 100644 --- a/tests/modules/programs/wofi/basic-configuration.nix +++ b/tests/modules/programs/wofi/basic-configuration.nix @@ -1,35 +1,33 @@ { pkgs, ... }: { - config = { - programs.wofi = { - enable = true; - package = pkgs.writeScriptBin "dummy-wofi" ""; - style = '' - * { - font-family: monospace; - } - window { - background-color: #7c818c; - } - ''; - settings = { - drun-print_command = true; - insensitive = true; - show = "drun"; - xoffset = 50; - yoffset = 200; - }; + programs.wofi = { + enable = true; + package = pkgs.writeScriptBin "dummy-wofi" ""; + style = '' + * { + font-family: monospace; + } + window { + background-color: #7c818c; + } + ''; + settings = { + drun-print_command = true; + insensitive = true; + show = "drun"; + xoffset = 50; + yoffset = 200; }; + }; - nmt.script = '' - assertFileExists home-files/.config/wofi/config - assertFileContent home-files/.config/wofi/config \ - ${./basic-configuration.conf} + nmt.script = '' + assertFileExists home-files/.config/wofi/config + assertFileContent home-files/.config/wofi/config \ + ${./basic-configuration.conf} - assertFileExists home-files/.config/wofi/style.css - assertFileContent home-files/.config/wofi/style.css \ - ${./basic-style.css} - ''; - }; + assertFileExists home-files/.config/wofi/style.css + assertFileContent home-files/.config/wofi/style.css \ + ${./basic-style.css} + ''; } diff --git a/tests/modules/programs/wofi/empty-configuration.nix b/tests/modules/programs/wofi/empty-configuration.nix index b3e4a4f6c986..39f272cbdd5f 100644 --- a/tests/modules/programs/wofi/empty-configuration.nix +++ b/tests/modules/programs/wofi/empty-configuration.nix @@ -1,15 +1,13 @@ { pkgs, ... }: { - config = { - programs.wofi = { - enable = true; - package = pkgs.writeScriptBin "dummy-wofi" ""; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/wofi/config - assertPathNotExists home-files/.config/wofi/style.css - ''; + programs.wofi = { + enable = true; + package = pkgs.writeScriptBin "dummy-wofi" ""; }; + + nmt.script = '' + assertPathNotExists home-files/.config/wofi/config + assertPathNotExists home-files/.config/wofi/style.css + ''; } diff --git a/tests/modules/programs/xmobar/basic-configuration.nix b/tests/modules/programs/xmobar/basic-configuration.nix index 88abf90ca973..3e110a9c207a 100644 --- a/tests/modules/programs/xmobar/basic-configuration.nix +++ b/tests/modules/programs/xmobar/basic-configuration.nix @@ -1,37 +1,35 @@ { config, ... }: { - config = { - programs.xmobar = { - enable = true; - package = config.lib.test.mkStubPackage { }; - extraConfig = '' - Config - { font = "Fira Code" - , borderColor = "#d0d0d0" - , border = FullB - , borderWidth = 3 - , bgColor = "#222" - , fgColor = "grey" - , position = TopSize C 99 30 - , commands = - [ Run Cpu ["-t", "cpu: %"] 10 - , Run Network "enp3s0" ["-S", "True", "-t", "eth: /"] 10 - , Run Memory ["-t","mem: %"] 10 - , Run Date "date: %a %d %b %Y %H:%M:%S " "date" 10 - , Run StdinReader - ] - , sepChar = "%" - , alignSep = "}{" - , template = " %StdinReader% | %cpu% | %memory% | %enp3s0% }{%date% " - } - ''; - }; - - nmt.script = '' - assertFileExists home-files/.config/xmobar/.xmobarrc - assertFileContent \ - home-files/.config/xmobar/.xmobarrc \ - ${./basic-configuration.expected} + programs.xmobar = { + enable = true; + package = config.lib.test.mkStubPackage { }; + extraConfig = '' + Config + { font = "Fira Code" + , borderColor = "#d0d0d0" + , border = FullB + , borderWidth = 3 + , bgColor = "#222" + , fgColor = "grey" + , position = TopSize C 99 30 + , commands = + [ Run Cpu ["-t", "cpu: %"] 10 + , Run Network "enp3s0" ["-S", "True", "-t", "eth: /"] 10 + , Run Memory ["-t","mem: %"] 10 + , Run Date "date: %a %d %b %Y %H:%M:%S " "date" 10 + , Run StdinReader + ] + , sepChar = "%" + , alignSep = "}{" + , template = " %StdinReader% | %cpu% | %memory% | %enp3s0% }{%date% " + } ''; }; + + nmt.script = '' + assertFileExists home-files/.config/xmobar/.xmobarrc + assertFileContent \ + home-files/.config/xmobar/.xmobarrc \ + ${./basic-configuration.expected} + ''; } diff --git a/tests/modules/programs/zsh/dotdir.nix b/tests/modules/programs/zsh/dotdir.nix index 244b19859ce7..a91d6e2d54a7 100644 --- a/tests/modules/programs/zsh/dotdir.nix +++ b/tests/modules/programs/zsh/dotdir.nix @@ -27,61 +27,59 @@ let relDotDir = lib.removePrefix home dotDir; in { - config = { - programs.zsh = { - enable = true; - inherit dotDir; - }; + programs.zsh = { + enable = true; + inherit dotDir; + }; - test.stubs.zsh = { }; + test.stubs.zsh = { }; - test.asserts.warnings.expected = lib.optionals (case == "relative") [ - '' - Using relative paths in programs.zsh.dotDir is deprecated and will be removed in a future release. - Current dotDir: subdir/subdir2 - Consider using absolute paths or home-manager config options instead. - You can replace relative paths or environment variables with options like: - - config.home.homeDirectory (user's home directory) - - config.xdg.configHome (XDG config directory) - - config.xdg.dataHome (XDG data directory) - - config.xdg.cacheHome (XDG cache directory) - '' - ]; + test.asserts.warnings.expected = lib.optionals (case == "relative") [ + '' + Using relative paths in programs.zsh.dotDir is deprecated and will be removed in a future release. + Current dotDir: subdir/subdir2 + Consider using absolute paths or home-manager config options instead. + You can replace relative paths or environment variables with options like: + - config.home.homeDirectory (user's home directory) + - config.xdg.configHome (XDG config directory) + - config.xdg.dataHome (XDG data directory) + - config.xdg.cacheHome (XDG cache directory) + '' + ]; + + test.asserts.assertions.expected = lib.optionals (case == "shell-variable") [ + '' + programs.zsh.dotDir cannot contain shell variables as it is used for file creation at build time. + Current dotDir: ''${XDG_CONFIG_HOME:-''$HOME/.config}/zsh + Consider using an absolute path or home-manager config options instead. + You can replace shell variables with options like: + - config.home.homeDirectory (user's home directory) + - config.xdg.configHome (XDG config directory) + - config.xdg.dataHome (XDG data directory) + - config.xdg.cacheHome (XDG cache directory) + '' + ]; - test.asserts.assertions.expected = lib.optionals (case == "shell-variable") [ + nmt.script = + if case == "shell-variable" then '' - programs.zsh.dotDir cannot contain shell variables as it is used for file creation at build time. - Current dotDir: ''${XDG_CONFIG_HOME:-''$HOME/.config}/zsh - Consider using an absolute path or home-manager config options instead. - You can replace shell variables with options like: - - config.home.homeDirectory (user's home directory) - - config.xdg.configHome (XDG config directory) - - config.xdg.dataHome (XDG data directory) - - config.xdg.cacheHome (XDG cache directory) + # Shell variable case should fail assertion, no files to check + echo "Shell variable case should trigger assertion failure" '' - ]; - - nmt.script = - if case == "shell-variable" then - '' - # Shell variable case should fail assertion, no files to check - echo "Shell variable case should trigger assertion failure" - '' - else - lib.concatStringsSep "\n" [ - # check dotDir entrypoint exists - "assertFileExists home-files/${relDotDir}/.zshenv" + else + lib.concatStringsSep "\n" [ + # check dotDir entrypoint exists + "assertFileExists home-files/${relDotDir}/.zshenv" - # for non-default dotDir only: - (lib.optionalString (case != "default") '' - # check .zshenv in homeDirectory sources .zshenv in dotDir - assertFileRegex home-files/.zshenv \ - "source [\"']\?${absDotDir}/.zshenv[\"']\?" + # for non-default dotDir only: + (lib.optionalString (case != "default") '' + # check .zshenv in homeDirectory sources .zshenv in dotDir + assertFileRegex home-files/.zshenv \ + "source [\"']\?${absDotDir}/.zshenv[\"']\?" - # check that .zshenv in dotDir exports ZDOTDIR - assertFileRegex home-files/${relDotDir}/.zshenv \ - "export ZDOTDIR=[\"']\?${absDotDir}[\"']\?" - '') - ]; - }; + # check that .zshenv in dotDir exports ZDOTDIR + assertFileRegex home-files/${relDotDir}/.zshenv \ + "export ZDOTDIR=[\"']\?${absDotDir}[\"']\?" + '') + ]; } diff --git a/tests/modules/programs/zsh/history-path.nix b/tests/modules/programs/zsh/history-path.nix index f43b1cbca2a7..32bb9527ef07 100644 --- a/tests/modules/programs/zsh/history-path.nix +++ b/tests/modules/programs/zsh/history-path.nix @@ -38,41 +38,39 @@ let customHistAbsPath; in { - config = { - programs.zsh = { - enable = true; - history.path = testPath; - dotDir = lib.mkIf (case == "zdotdir-variable") "${homeDir}/.config/zsh"; - }; + programs.zsh = { + enable = true; + history.path = testPath; + dotDir = lib.mkIf (case == "zdotdir-variable") "${homeDir}/.config/zsh"; + }; + + test.stubs.zsh = { }; - test.stubs.zsh = { }; + test.asserts.warnings.expected = lib.optionals (case == "relative") [ + '' + Using relative paths in programs.zsh.history.path is deprecated and will be removed in a future release. + Consider using absolute paths or home-manager config options instead. + You can replace relative paths or environment variables with options like: + - config.home.homeDirectory (user's home directory) + - config.xdg.configHome (XDG config directory) + - config.xdg.dataHome (XDG data directory) + - config.xdg.cacheHome (XDG cache directory) + Current history.path: some/subdir/.zsh_history + '' + ]; - test.asserts.warnings.expected = lib.optionals (case == "relative") [ + nmt.script = + if case == "xdg-variable" then '' - Using relative paths in programs.zsh.history.path is deprecated and will be removed in a future release. - Consider using absolute paths or home-manager config options instead. - You can replace relative paths or environment variables with options like: - - config.home.homeDirectory (user's home directory) - - config.xdg.configHome (XDG config directory) - - config.xdg.dataHome (XDG data directory) - - config.xdg.cacheHome (XDG cache directory) - Current history.path: some/subdir/.zsh_history + assertFileContains home-files/.zshrc 'HISTFILE="''${XDG_STATE_HOME:-''$HOME/.local/state}/zsh/history"' '' - ]; - - nmt.script = - if case == "xdg-variable" then - '' - assertFileContains home-files/.zshrc 'HISTFILE="''${XDG_STATE_HOME:-''$HOME/.local/state}/zsh/history"' - '' - else if case == "zdotdir-variable" then - '' - assertFileContains home-files/.config/zsh/.zshrc 'HISTFILE="$ZDOTDIR/.zsh_history"' - assertFileContains home-files/.config/zsh/.zshenv "export ZDOTDIR=${homeDir}/.config/zsh" - '' - else - '' - assertFileRegex home-files/.zshrc '^HISTFILE="${expectedPath}"$' - ''; - }; + else if case == "zdotdir-variable" then + '' + assertFileContains home-files/.config/zsh/.zshrc 'HISTFILE="$ZDOTDIR/.zsh_history"' + assertFileContains home-files/.config/zsh/.zshenv "export ZDOTDIR=${homeDir}/.config/zsh" + '' + else + '' + assertFileRegex home-files/.zshrc '^HISTFILE="${expectedPath}"$' + ''; } diff --git a/tests/modules/programs/zsh/plugins.nix b/tests/modules/programs/zsh/plugins.nix index d69b8095fd8a..f9b92fc85e4b 100644 --- a/tests/modules/programs/zsh/plugins.nix +++ b/tests/modules/programs/zsh/plugins.nix @@ -4,48 +4,46 @@ let mockZshPluginSrc = pkgs.writeText "mockZshPluginSrc" "echo example"; in { - config = { - programs.zsh = { - enable = true; - plugins = [ - { - name = "mockPlugin"; - file = "share/mockPlugin/mockPlugin.plugin.zsh"; - src = mockZshPluginSrc; - completions = [ - "share/zsh/site-functions" - "share/zsh/vendor-completions" - ]; - } - ]; - }; + programs.zsh = { + enable = true; + plugins = [ + { + name = "mockPlugin"; + file = "share/mockPlugin/mockPlugin.plugin.zsh"; + src = mockZshPluginSrc; + completions = [ + "share/zsh/site-functions" + "share/zsh/vendor-completions" + ]; + } + ]; + }; - test.stubs.zsh = { }; + test.stubs.zsh = { }; - nmt.script = '' - # Test the plugin directories loop structure - assertFileContains home-files/.zshrc '# Add plugin directories to PATH and fpath' - assertFileContains home-files/.zshrc 'plugin_dirs=(' - assertFileContains home-files/.zshrc 'mockPlugin' - assertFileContains home-files/.zshrc 'for plugin_dir in "''${plugin_dirs[@]}"; do' - assertFileContains home-files/.zshrc 'path+="/home/hm-user/.zsh/plugins/$plugin_dir"' - assertFileContains home-files/.zshrc 'fpath+="/home/hm-user/.zsh/plugins/$plugin_dir"' + nmt.script = '' + # Test the plugin directories loop structure + assertFileContains home-files/.zshrc '# Add plugin directories to PATH and fpath' + assertFileContains home-files/.zshrc 'plugin_dirs=(' + assertFileContains home-files/.zshrc 'mockPlugin' + assertFileContains home-files/.zshrc 'for plugin_dir in "''${plugin_dirs[@]}"; do' + assertFileContains home-files/.zshrc 'path+="/home/hm-user/.zsh/plugins/$plugin_dir"' + assertFileContains home-files/.zshrc 'fpath+="/home/hm-user/.zsh/plugins/$plugin_dir"' - # Test the completion paths loop structure - assertFileContains home-files/.zshrc '# Add completion paths to fpath' - assertFileContains home-files/.zshrc 'completion_paths=(' - assertFileContains home-files/.zshrc 'mockPlugin/share/zsh/site-functions' - assertFileContains home-files/.zshrc 'mockPlugin/share/zsh/vendor-completions' - assertFileContains home-files/.zshrc 'for completion_path in "''${completion_paths[@]}"; do' - assertFileContains home-files/.zshrc 'fpath+="/home/hm-user/.zsh/plugins/$completion_path"' + # Test the completion paths loop structure + assertFileContains home-files/.zshrc '# Add completion paths to fpath' + assertFileContains home-files/.zshrc 'completion_paths=(' + assertFileContains home-files/.zshrc 'mockPlugin/share/zsh/site-functions' + assertFileContains home-files/.zshrc 'mockPlugin/share/zsh/vendor-completions' + assertFileContains home-files/.zshrc 'for completion_path in "''${completion_paths[@]}"; do' + assertFileContains home-files/.zshrc 'fpath+="/home/hm-user/.zsh/plugins/$completion_path"' - # Test the plugin loading structure - assertFileContains home-files/.zshrc '# Source plugins' - assertFileContains home-files/.zshrc 'plugins=(' - assertFileContains home-files/.zshrc 'mockPlugin/share/mockPlugin/mockPlugin.plugin.zsh' - assertFileContains home-files/.zshrc 'for plugin in "''${plugins[@]}"; do' - assertFileContains home-files/.zshrc '[[ -f "/home/hm-user/.zsh/plugins/$plugin" ]] && source "/home/hm-user/.zsh/plugins/$plugin"' - assertFileContains home-files/.zshrc 'done' - ''; - }; + # Test the plugin loading structure + assertFileContains home-files/.zshrc '# Source plugins' + assertFileContains home-files/.zshrc 'plugins=(' + assertFileContains home-files/.zshrc 'mockPlugin/share/mockPlugin/mockPlugin.plugin.zsh' + assertFileContains home-files/.zshrc 'for plugin in "''${plugins[@]}"; do' + assertFileContains home-files/.zshrc '[[ -f "/home/hm-user/.zsh/plugins/$plugin" ]] && source "/home/hm-user/.zsh/plugins/$plugin"' + assertFileContains home-files/.zshrc 'done' + ''; } diff --git a/tests/modules/programs/zsh/zprof.nix b/tests/modules/programs/zsh/zprof.nix index 16841a8bad00..ae5ccaf965a1 100644 --- a/tests/modules/programs/zsh/zprof.nix +++ b/tests/modules/programs/zsh/zprof.nix @@ -1,15 +1,13 @@ { - config = { - programs.zsh = { - enable = true; - zprof.enable = true; - }; + programs.zsh = { + enable = true; + zprof.enable = true; + }; - test.stubs.zsh = { }; + test.stubs.zsh = { }; - nmt.script = '' - assertFileRegex home-files/.zshrc 'zmodload zsh/zprof' - assertFileRegex home-files/.zshrc '^zprof$' - ''; - }; + nmt.script = '' + assertFileRegex home-files/.zshrc 'zmodload zsh/zprof' + assertFileRegex home-files/.zshrc '^zprof$' + ''; } diff --git a/tests/modules/services/arrpc/custom-target.nix b/tests/modules/services/arrpc/custom-target.nix index cf107a7275fb..bef159678a7e 100644 --- a/tests/modules/services/arrpc/custom-target.nix +++ b/tests/modules/services/arrpc/custom-target.nix @@ -1,14 +1,12 @@ { - config = { - services.arrpc = { - enable = true; - systemdTarget = "sway-session.target"; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/systemd/user/arRPC.service \ - ${./custom-target-expected.service} - ''; + services.arrpc = { + enable = true; + systemdTarget = "sway-session.target"; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/arRPC.service \ + ${./custom-target-expected.service} + ''; } diff --git a/tests/modules/services/caffeine/basic-service.nix b/tests/modules/services/caffeine/basic-service.nix index 4b7e55a3b92b..e427af88dd8b 100644 --- a/tests/modules/services/caffeine/basic-service.nix +++ b/tests/modules/services/caffeine/basic-service.nix @@ -1,13 +1,11 @@ { - config = { - services.caffeine = { - enable = true; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/systemd/user/caffeine.service \ - ${./basic-service-expected.service} - ''; + services.caffeine = { + enable = true; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/caffeine.service \ + ${./basic-service-expected.service} + ''; } diff --git a/tests/modules/services/dropbox/basic-configuration.nix b/tests/modules/services/dropbox/basic-configuration.nix index e5ad067267a6..37329d46eece 100644 --- a/tests/modules/services/dropbox/basic-configuration.nix +++ b/tests/modules/services/dropbox/basic-configuration.nix @@ -1,16 +1,14 @@ { config, ... }: { - config = { - services.dropbox = { - enable = true; - path = "${config.home.homeDirectory}/dropbox"; - }; + services.dropbox = { + enable = true; + path = "${config.home.homeDirectory}/dropbox"; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/dropbox.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/dropbox.service - assertFileExists $serviceFile - ''; - }; + assertFileExists $serviceFile + ''; } diff --git a/tests/modules/services/emacs/linux/emacs-service-28.nix b/tests/modules/services/emacs/linux/emacs-service-28.nix index a9b548db03c9..29c7b628b311 100644 --- a/tests/modules/services/emacs/linux/emacs-service-28.nix +++ b/tests/modules/services/emacs/linux/emacs-service-28.nix @@ -1,47 +1,45 @@ { lib, pkgs, ... }: { - config = { - nixpkgs.overlays = [ - (_self: super: rec { - emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { - outPath = "@emacs@"; - }; - emacsPackagesFor = - _: - lib.makeScope super.newScope (_: { - emacsWithPackages = _: emacs; - }); - }) - ]; + nixpkgs.overlays = [ + (_self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); + }) + ]; - programs.emacs.enable = true; - services.emacs.enable = true; - services.emacs.client.enable = true; - services.emacs.extraOptions = [ - "-f" - "exwm-enable" - ]; + programs.emacs.enable = true; + services.emacs.enable = true; + services.emacs.client.enable = true; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; - nmt.script = '' - assertPathNotExists home-files/.config/systemd/user/emacs.socket - assertFileExists home-files/.config/systemd/user/emacs.service - assertFileExists home-path/share/applications/emacsclient.desktop + nmt.script = '' + assertPathNotExists home-files/.config/systemd/user/emacs.socket + assertFileExists home-files/.config/systemd/user/emacs.service + assertFileExists home-path/share/applications/emacsclient.desktop - assertFileContent \ - home-files/.config/systemd/user/emacs.service \ - ${pkgs.substitute { - src = ./emacs-service-emacs.service; - substitutions = [ - "--replace" - "@runtimeShell@" - pkgs.runtimeShell - ]; - }} + assertFileContent \ + home-files/.config/systemd/user/emacs.service \ + ${pkgs.substitute { + src = ./emacs-service-emacs.service; + substitutions = [ + "--replace" + "@runtimeShell@" + pkgs.runtimeShell + ]; + }} - assertFileContent \ - home-path/share/applications/emacsclient.desktop \ - ${./emacs-28-emacsclient.desktop} - ''; - }; + assertFileContent \ + home-path/share/applications/emacsclient.desktop \ + ${./emacs-28-emacsclient.desktop} + ''; } diff --git a/tests/modules/services/emacs/linux/emacs-socket-27.nix b/tests/modules/services/emacs/linux/emacs-socket-27.nix index 358f6b5644db..0297aec9ef66 100644 --- a/tests/modules/services/emacs/linux/emacs-socket-27.nix +++ b/tests/modules/services/emacs/linux/emacs-socket-27.nix @@ -1,55 +1,53 @@ { lib, pkgs, ... }: { - config = { - nixpkgs.overlays = [ - (_self: super: rec { - emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // { - outPath = "@emacs@"; - }; - emacsPackagesFor = - _: - lib.makeScope super.newScope (_: { - emacsWithPackages = _: emacs; - }); - }) - ]; + nixpkgs.overlays = [ + (_self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); + }) + ]; - programs.emacs.enable = true; - services.emacs.enable = true; - services.emacs.client.enable = true; - services.emacs.extraOptions = [ - "-f" - "exwm-enable" - ]; - services.emacs.socketActivation.enable = true; + programs.emacs.enable = true; + services.emacs.enable = true; + services.emacs.client.enable = true; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; + services.emacs.socketActivation.enable = true; - nmt.script = '' - assertFileExists home-files/.config/systemd/user/emacs.socket - assertFileExists home-files/.config/systemd/user/emacs.service - assertFileExists home-path/share/applications/emacsclient.desktop + nmt.script = '' + assertFileExists home-files/.config/systemd/user/emacs.socket + assertFileExists home-files/.config/systemd/user/emacs.service + assertFileExists home-path/share/applications/emacsclient.desktop - assertFileContent \ - home-files/.config/systemd/user/emacs.socket \ - ${./emacs-socket-emacs.socket} + assertFileContent \ + home-files/.config/systemd/user/emacs.socket \ + ${./emacs-socket-emacs.socket} - assertFileContent \ - home-files/.config/systemd/user/emacs.service \ - ${pkgs.substitute { - src = ./emacs-socket-27-emacs.service; - substitutions = [ - "--replace" - "@runtimeShell@" - pkgs.runtimeShell - "--replace" - "@coreutils@" - pkgs.coreutils - ]; - }} + assertFileContent \ + home-files/.config/systemd/user/emacs.service \ + ${pkgs.substitute { + src = ./emacs-socket-27-emacs.service; + substitutions = [ + "--replace" + "@runtimeShell@" + pkgs.runtimeShell + "--replace" + "@coreutils@" + pkgs.coreutils + ]; + }} - assertFileContent \ - home-path/share/applications/emacsclient.desktop \ - ${./emacs-27-emacsclient.desktop} - ''; - }; + assertFileContent \ + home-path/share/applications/emacsclient.desktop \ + ${./emacs-27-emacsclient.desktop} + ''; } diff --git a/tests/modules/services/emacs/linux/emacs-socket-28.nix b/tests/modules/services/emacs/linux/emacs-socket-28.nix index 1c74c07206d2..c68112936f5b 100644 --- a/tests/modules/services/emacs/linux/emacs-socket-28.nix +++ b/tests/modules/services/emacs/linux/emacs-socket-28.nix @@ -1,52 +1,50 @@ { lib, pkgs, ... }: { - config = { - nixpkgs.overlays = [ - (_self: super: rec { - emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { - outPath = "@emacs@"; - }; - emacsPackagesFor = - _: - lib.makeScope super.newScope (_: { - emacsWithPackages = _: emacs; - }); - }) - ]; + nixpkgs.overlays = [ + (_self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); + }) + ]; - programs.emacs.enable = true; - services.emacs.enable = true; - services.emacs.client.enable = true; - services.emacs.extraOptions = [ - "-f" - "exwm-enable" - ]; - services.emacs.socketActivation.enable = true; + programs.emacs.enable = true; + services.emacs.enable = true; + services.emacs.client.enable = true; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; + services.emacs.socketActivation.enable = true; - nmt.script = '' - assertFileExists home-files/.config/systemd/user/emacs.socket - assertFileExists home-files/.config/systemd/user/emacs.service - assertFileExists home-path/share/applications/emacsclient.desktop + nmt.script = '' + assertFileExists home-files/.config/systemd/user/emacs.socket + assertFileExists home-files/.config/systemd/user/emacs.service + assertFileExists home-path/share/applications/emacsclient.desktop - assertFileContent \ - home-files/.config/systemd/user/emacs.socket \ - ${./emacs-socket-emacs.socket} + assertFileContent \ + home-files/.config/systemd/user/emacs.socket \ + ${./emacs-socket-emacs.socket} - assertFileContent \ - home-files/.config/systemd/user/emacs.service \ - ${pkgs.substitute { - src = ./emacs-socket-28-emacs.service; - substitutions = [ - "--replace" - "@runtimeShell@" - pkgs.runtimeShell - ]; - }} + assertFileContent \ + home-files/.config/systemd/user/emacs.service \ + ${pkgs.substitute { + src = ./emacs-socket-28-emacs.service; + substitutions = [ + "--replace" + "@runtimeShell@" + pkgs.runtimeShell + ]; + }} - assertFileContent \ - home-path/share/applications/emacsclient.desktop \ - ${./emacs-28-emacsclient.desktop} - ''; - }; + assertFileContent \ + home-path/share/applications/emacsclient.desktop \ + ${./emacs-28-emacsclient.desktop} + ''; } diff --git a/tests/modules/services/fnott/example-settings.nix b/tests/modules/services/fnott/example-settings.nix index 982764080b94..12338aebc8a3 100644 --- a/tests/modules/services/fnott/example-settings.nix +++ b/tests/modules/services/fnott/example-settings.nix @@ -4,28 +4,26 @@ }: { - config = { - services.fnott = { - enable = true; - package = config.lib.test.mkStubPackage { }; + services.fnott = { + enable = true; + package = config.lib.test.mkStubPackage { }; - settings = { - main = { - notification-margin = 5; - }; + settings = { + main = { + notification-margin = 5; + }; - low = { - timeout = 5; - title-font = "Dina:weight=bold:slant=italic"; - title-color = "ffffff"; - }; + low = { + timeout = 5; + title-font = "Dina:weight=bold:slant=italic"; + title-color = "ffffff"; }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/fnott/fnott.ini \ - ${./example-settings-expected.ini} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/fnott/fnott.ini \ + ${./example-settings-expected.ini} + ''; } diff --git a/tests/modules/services/fnott/systemd-user-service.nix b/tests/modules/services/fnott/systemd-user-service.nix index e36c505838e8..2f4fae183417 100644 --- a/tests/modules/services/fnott/systemd-user-service.nix +++ b/tests/modules/services/fnott/systemd-user-service.nix @@ -4,20 +4,18 @@ }: { - config = { - services.fnott = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@fnott@"; }; - }; + services.fnott = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@fnott@"; }; + }; - nmt.script = '' - assertFileContent \ - home-files/.config/systemd/user/fnott.service \ - ${./systemd-user-service-expected.service} + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/fnott.service \ + ${./systemd-user-service-expected.service} - assertFileContent \ - home-files/.local/share/dbus-1/services/fnott.service \ - ${./systemd-user-dbus-service-expected.service} - ''; - }; + assertFileContent \ + home-files/.local/share/dbus-1/services/fnott.service \ + ${./systemd-user-dbus-service-expected.service} + ''; } diff --git a/tests/modules/services/gnome-keyring/basic-service.nix b/tests/modules/services/gnome-keyring/basic-service.nix index 12a9374fb022..b2657c4145ad 100644 --- a/tests/modules/services/gnome-keyring/basic-service.nix +++ b/tests/modules/services/gnome-keyring/basic-service.nix @@ -1,13 +1,11 @@ { - config = { - services.gnome-keyring = { - enable = true; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/systemd/user/gnome-keyring.service \ - ${./basic-service-expected.service} - ''; + services.gnome-keyring = { + enable = true; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/gnome-keyring.service \ + ${./basic-service-expected.service} + ''; } diff --git a/tests/modules/services/gnome-keyring/custom-components.nix b/tests/modules/services/gnome-keyring/custom-components.nix index fbf76c0bffe2..dcda689e2596 100644 --- a/tests/modules/services/gnome-keyring/custom-components.nix +++ b/tests/modules/services/gnome-keyring/custom-components.nix @@ -1,18 +1,16 @@ { - config = { - services.gnome-keyring = { - enable = true; - components = [ - "pkcs11" - "secrets" - "ssh" - ]; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/systemd/user/gnome-keyring.service \ - ${./custom-components-expected.service} - ''; + services.gnome-keyring = { + enable = true; + components = [ + "pkcs11" + "secrets" + "ssh" + ]; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/gnome-keyring.service \ + ${./custom-components-expected.service} + ''; } diff --git a/tests/modules/services/home-manager-auto-expire/linux/basic-configuration.nix b/tests/modules/services/home-manager-auto-expire/linux/basic-configuration.nix index 0e6a4f44841b..e8a83ed3f185 100644 --- a/tests/modules/services/home-manager-auto-expire/linux/basic-configuration.nix +++ b/tests/modules/services/home-manager-auto-expire/linux/basic-configuration.nix @@ -1,18 +1,16 @@ { - config = { - services.home-manager.autoExpire = { - enable = true; - timestamp = "-7 days"; - frequency = "00:00"; - cleanup.store = true; - }; + services.home-manager.autoExpire = { + enable = true; + timestamp = "-7 days"; + frequency = "00:00"; + cleanup.store = true; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/home-manager-auto-expire.service - assertFileExists $serviceFile + nmt.script = '' + serviceFile=home-files/.config/systemd/user/home-manager-auto-expire.service + assertFileExists $serviceFile - timerFile=home-files/.config/systemd/user/home-manager-auto-expire.timer - assertFileExists $timerFile - ''; - }; + timerFile=home-files/.config/systemd/user/home-manager-auto-expire.timer + assertFileExists $timerFile + ''; } diff --git a/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix b/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix index 2f12bd64e54b..8e0ebe8c78f6 100644 --- a/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix +++ b/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix @@ -1,16 +1,14 @@ { - config = { - services.home-manager.autoUpgrade = { - enable = true; - frequency = "00:00"; - }; + services.home-manager.autoUpgrade = { + enable = true; + frequency = "00:00"; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/home-manager-auto-upgrade.service - assertFileExists $serviceFile + nmt.script = '' + serviceFile=home-files/.config/systemd/user/home-manager-auto-upgrade.service + assertFileExists $serviceFile - timerFile=home-files/.config/systemd/user/home-manager-auto-upgrade.timer - assertFileExists $timerFile - ''; - }; + timerFile=home-files/.config/systemd/user/home-manager-auto-upgrade.timer + assertFileExists $timerFile + ''; } diff --git a/tests/modules/services/kanshi/alias-assertion.nix b/tests/modules/services/kanshi/alias-assertion.nix index 20f4b7ce9654..5c9c77a013c1 100644 --- a/tests/modules/services/kanshi/alias-assertion.nix +++ b/tests/modules/services/kanshi/alias-assertion.nix @@ -1,24 +1,22 @@ { config, ... }: { - config = { - services.kanshi = { - enable = true; - package = config.lib.test.mkStubPackage { }; - settings = [ - { - profile.name = "nomad"; - profile.outputs = [ - { - criteria = "eDP-1"; - alias = "test"; - } - ]; - } - ]; - }; - - test.asserts.assertions.expected = [ - "Output kanshi.*.output.alias can only be defined on global scope" + services.kanshi = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = [ + { + profile.name = "nomad"; + profile.outputs = [ + { + criteria = "eDP-1"; + alias = "test"; + } + ]; + } ]; }; + + test.asserts.assertions.expected = [ + "Output kanshi.*.output.alias can only be defined on global scope" + ]; } diff --git a/tests/modules/services/kanshi/basic-configuration.nix b/tests/modules/services/kanshi/basic-configuration.nix index 30f114b8be73..01084711f220 100644 --- a/tests/modules/services/kanshi/basic-configuration.nix +++ b/tests/modules/services/kanshi/basic-configuration.nix @@ -1,72 +1,70 @@ { config, ... }: { - config = { - services.kanshi = { - enable = true; - package = config.lib.test.mkStubPackage { }; - profiles = { - nomad = { - outputs = [ - { - criteria = "eDP-1"; - status = "enable"; - } - ]; - }; - desktop = { - exec = [ - ''echo "1 two 3"'' - ''echo "4 five 6"'' - ]; - outputs = [ - { - criteria = "eDP-1"; - status = "disable"; - } - { - criteria = "Iiyama North America PLE2483H-DP"; - status = "enable"; - position = "0,0"; - } - { - criteria = "Iiyama North America PLE2483H-DP 1158765348486"; - status = "enable"; - position = "1920,0"; - scale = 2.1; - mode = "1920x1080"; - transform = "flipped-270"; - } - ]; - }; - backwardsCompat = { - outputs = [ - { - criteria = "LVDS-1"; - status = "enable"; - } - ]; - exec = ''echo "7 eight 9"''; - }; + services.kanshi = { + enable = true; + package = config.lib.test.mkStubPackage { }; + profiles = { + nomad = { + outputs = [ + { + criteria = "eDP-1"; + status = "enable"; + } + ]; + }; + desktop = { + exec = [ + ''echo "1 two 3"'' + ''echo "4 five 6"'' + ]; + outputs = [ + { + criteria = "eDP-1"; + status = "disable"; + } + { + criteria = "Iiyama North America PLE2483H-DP"; + status = "enable"; + position = "0,0"; + } + { + criteria = "Iiyama North America PLE2483H-DP 1158765348486"; + status = "enable"; + position = "1920,0"; + scale = 2.1; + mode = "1920x1080"; + transform = "flipped-270"; + } + ]; + }; + backwardsCompat = { + outputs = [ + { + criteria = "LVDS-1"; + status = "enable"; + } + ]; + exec = ''echo "7 eight 9"''; }; - extraConfig = '' - profile test { - output "*" enable - } - ''; }; + extraConfig = '' + profile test { + output "*" enable + } + ''; + }; - test.asserts.warnings.expected = [ - "kanshi.profiles option is deprecated. Use kanshi.settings instead." - "kanshi.extraConfig option is deprecated. Use kanshi.settings instead." - ]; + test.asserts.warnings.expected = [ + "kanshi.profiles option is deprecated. Use kanshi.settings instead." + "kanshi.extraConfig option is deprecated. Use kanshi.settings instead." + ]; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/kanshi.service - assertFileExists $serviceFile + nmt.script = '' + serviceFile=home-files/.config/systemd/user/kanshi.service + assertFileExists $serviceFile - assertFileExists home-files/.config/kanshi/config - assertFileContent home-files/.config/kanshi/config \ - ${./basic-configuration.conf} - ''; - }; + assertFileExists home-files/.config/kanshi/config + assertFileContent home-files/.config/kanshi/config \ + ${./basic-configuration.conf} + ''; } diff --git a/tests/modules/services/kanshi/new-configuration.nix b/tests/modules/services/kanshi/new-configuration.nix index febae98a53da..4001e601f08c 100644 --- a/tests/modules/services/kanshi/new-configuration.nix +++ b/tests/modules/services/kanshi/new-configuration.nix @@ -1,71 +1,69 @@ { config, ... }: { - config = { - services.kanshi = { - enable = true; - package = config.lib.test.mkStubPackage { }; - settings = [ - { include = "path/to/included/file"; } - { - output = { - criteria = "Iiyama North America PLE2483H-DP"; - alias = "iiyama"; - }; - } - { - profile.name = "nomad"; - profile.outputs = [ - { - criteria = "eDP-1"; - status = "enable"; - } - ]; - } - { - profile.name = "desktop"; - profile.exec = [ - ''echo "1 two 3"'' - ''echo "4 five 6"'' - ]; - profile.outputs = [ - { - criteria = "eDP-1"; - status = "disable"; - } - { - criteria = "$iiyama"; - status = "enable"; - position = "0,0"; - } - { - criteria = "Iiyama North America PLE2483H-DP 1158765348486"; - status = "enable"; - position = "1920,0"; - scale = 2.1; - mode = "1920x1080"; - transform = "flipped-270"; - } - ]; - } - { - profile.outputs = [ - { - criteria = "LVDS-1"; - status = "enable"; - } - ]; - profile.exec = ''echo "7 eight 9"''; - } - ]; - }; + services.kanshi = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = [ + { include = "path/to/included/file"; } + { + output = { + criteria = "Iiyama North America PLE2483H-DP"; + alias = "iiyama"; + }; + } + { + profile.name = "nomad"; + profile.outputs = [ + { + criteria = "eDP-1"; + status = "enable"; + } + ]; + } + { + profile.name = "desktop"; + profile.exec = [ + ''echo "1 two 3"'' + ''echo "4 five 6"'' + ]; + profile.outputs = [ + { + criteria = "eDP-1"; + status = "disable"; + } + { + criteria = "$iiyama"; + status = "enable"; + position = "0,0"; + } + { + criteria = "Iiyama North America PLE2483H-DP 1158765348486"; + status = "enable"; + position = "1920,0"; + scale = 2.1; + mode = "1920x1080"; + transform = "flipped-270"; + } + ]; + } + { + profile.outputs = [ + { + criteria = "LVDS-1"; + status = "enable"; + } + ]; + profile.exec = ''echo "7 eight 9"''; + } + ]; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/kanshi.service - assertFileExists $serviceFile + nmt.script = '' + serviceFile=home-files/.config/systemd/user/kanshi.service + assertFileExists $serviceFile - assertFileExists home-files/.config/kanshi/config - assertFileContent home-files/.config/kanshi/config \ - ${./new-configuration.conf} - ''; - }; + assertFileExists home-files/.config/kanshi/config + assertFileContent home-files/.config/kanshi/config \ + ${./new-configuration.conf} + ''; } diff --git a/tests/modules/services/pantalaimon/basic-configuration.nix b/tests/modules/services/pantalaimon/basic-configuration.nix index 21f762dfe601..776e583eb013 100644 --- a/tests/modules/services/pantalaimon/basic-configuration.nix +++ b/tests/modules/services/pantalaimon/basic-configuration.nix @@ -1,27 +1,25 @@ { config, ... }: { - config = { - services.pantalaimon = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@pantalaimon@"; }; - settings = { - Default = { - LogLevel = "Debug"; - SSL = true; - }; - local-matrix = { - Homeserver = "https://matrix.org"; - ListenAddress = "127.0.0.1"; - ListenPort = 8008; - }; + services.pantalaimon = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@pantalaimon@"; }; + settings = { + Default = { + LogLevel = "Debug"; + SSL = true; + }; + local-matrix = { + Homeserver = "https://matrix.org"; + ListenAddress = "127.0.0.1"; + ListenPort = 8008; }; }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/pantalaimon.service - assertFileExists $serviceFile - assertFileRegex $serviceFile 'ExecStart=@pantalaimon@/bin/pantalaimon -c /nix/store/.*-pantalaimon.conf' - ''; }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/pantalaimon.service + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=@pantalaimon@/bin/pantalaimon -c /nix/store/.*-pantalaimon.conf' + ''; } diff --git a/tests/modules/services/pizauth/basic-config.nix b/tests/modules/services/pizauth/basic-config.nix index dd5a18ab763d..12bfc0c1ebe8 100644 --- a/tests/modules/services/pizauth/basic-config.nix +++ b/tests/modules/services/pizauth/basic-config.nix @@ -1,83 +1,81 @@ { pkgs, ... }: { - config = { - services.pizauth = { - enable = true; - extraConfig = '' - refresh_at_least = 15s; - ''; - accounts = { - test1 = { - authUri = "authUri1"; - tokenUri = "tokenUri1"; - clientId = "clientId1"; - clientSecret = "clientSecret1"; - loginHint = "testLogin1"; - extraConfig = '' - redirectUri = "redirectUri1"; - refresh_retry = 30s; - ''; - }; - test2 = { - authUri = "authUri2"; - tokenUri = "tokenUri2"; - clientId = "clientId2"; - clientSecret = "clientSecret2"; - scopes = [ - "scope1" - "offline_access" - ]; - }; - test3 = { - authUri = "authUri3"; - tokenUri = "tokenUri3"; - clientId = "clientId3"; - scopes = [ - ]; - }; + services.pizauth = { + enable = true; + extraConfig = '' + refresh_at_least = 15s; + ''; + accounts = { + test1 = { + authUri = "authUri1"; + tokenUri = "tokenUri1"; + clientId = "clientId1"; + clientSecret = "clientSecret1"; + loginHint = "testLogin1"; + extraConfig = '' + redirectUri = "redirectUri1"; + refresh_retry = 30s; + ''; + }; + test2 = { + authUri = "authUri2"; + tokenUri = "tokenUri2"; + clientId = "clientId2"; + clientSecret = "clientSecret2"; + scopes = [ + "scope1" + "offline_access" + ]; + }; + test3 = { + authUri = "authUri3"; + tokenUri = "tokenUri3"; + clientId = "clientId3"; + scopes = [ + ]; }; }; + }; - test.stubs.pizauth = { }; + test.stubs.pizauth = { }; - nmt.script = '' - local serviceFile=home-files/.config/systemd/user/pizauth.service + nmt.script = '' + local serviceFile=home-files/.config/systemd/user/pizauth.service - assertFileExists $serviceFile - assertFileRegex $serviceFile 'ExecStart=.*/bin/dummy server -vvvv -d' + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/dummy server -vvvv -d' - assertFileExists home-files/.config/pizauth.conf - assertFileContent home-files/.config/pizauth.conf \ - ${pkgs.writeText "expected-config" '' - refresh_at_least = 15s; + assertFileExists home-files/.config/pizauth.conf + assertFileContent home-files/.config/pizauth.conf \ + ${pkgs.writeText "expected-config" '' + refresh_at_least = 15s; - account "test1" { - auth_uri = "authUri1"; - token_uri = "tokenUri1"; - client_id = "clientId1"; - client_secret = "clientSecret1"; - login_hint = "testLogin1"; - redirectUri = "redirectUri1"; - refresh_retry = 30s; - } + account "test1" { + auth_uri = "authUri1"; + token_uri = "tokenUri1"; + client_id = "clientId1"; + client_secret = "clientSecret1"; + login_hint = "testLogin1"; + redirectUri = "redirectUri1"; + refresh_retry = 30s; + } - account "test2" { - auth_uri = "authUri2"; - token_uri = "tokenUri2"; - client_id = "clientId2"; - client_secret = "clientSecret2"; - scopes = [ - "scope1", - "offline_access" - ]; - } + account "test2" { + auth_uri = "authUri2"; + token_uri = "tokenUri2"; + client_id = "clientId2"; + client_secret = "clientSecret2"; + scopes = [ + "scope1", + "offline_access" + ]; + } - account "test3" { - auth_uri = "authUri3"; - token_uri = "tokenUri3"; - client_id = "clientId3"; - } - ''} - ''; - }; + account "test3" { + auth_uri = "authUri3"; + token_uri = "tokenUri3"; + client_id = "clientId3"; + } + ''} + ''; } diff --git a/tests/modules/services/playerctld/basic.nix b/tests/modules/services/playerctld/basic.nix index c8cba4a984e4..f4657f77cfc0 100644 --- a/tests/modules/services/playerctld/basic.nix +++ b/tests/modules/services/playerctld/basic.nix @@ -1,29 +1,27 @@ { pkgs, ... }: { - config = { - services.playerctld.enable = true; - services.playerctld.package = pkgs.writeScriptBin "playerctld" "" // { - outPath = "@playerctld@"; - }; + services.playerctld.enable = true; + services.playerctld.package = pkgs.writeScriptBin "playerctld" "" // { + outPath = "@playerctld@"; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/playerctld.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/playerctld.service - assertFileExists "$serviceFile" + assertFileExists "$serviceFile" - assertFileContent "$serviceFile" "${pkgs.writeText "playerctld-test" '' - [Install] - WantedBy=default.target + assertFileContent "$serviceFile" "${pkgs.writeText "playerctld-test" '' + [Install] + WantedBy=default.target - [Service] - BusName=org.mpris.MediaPlayer2.playerctld - ExecStart=@playerctld@/bin/playerctld - Type=dbus + [Service] + BusName=org.mpris.MediaPlayer2.playerctld + ExecStart=@playerctld@/bin/playerctld + Type=dbus - [Unit] - Description=MPRIS media player daemon - ''}" - ''; - }; + [Unit] + Description=MPRIS media player daemon + ''}" + ''; } diff --git a/tests/modules/services/polybar/basic-configuration.nix b/tests/modules/services/polybar/basic-configuration.nix index 227c54ab319c..47e9c8f61975 100644 --- a/tests/modules/services/polybar/basic-configuration.nix +++ b/tests/modules/services/polybar/basic-configuration.nix @@ -1,62 +1,60 @@ { config, ... }: { - config = { - services.polybar = { - enable = true; - package = config.lib.test.mkStubPackage { }; - script = "polybar bar &"; - config = { - "bar/top" = { - monitor = "\${env:MONITOR:eDP1}"; - width = "100%"; - height = "3%"; - radius = 0; - modules-center = "date"; - }; - "module/date" = { - type = "internal/date"; - internal = 5; - date = "%d.%m.%y"; - time = "%H:%M"; - label = "%time% %date%"; - }; + services.polybar = { + enable = true; + package = config.lib.test.mkStubPackage { }; + script = "polybar bar &"; + config = { + "bar/top" = { + monitor = "\${env:MONITOR:eDP1}"; + width = "100%"; + height = "3%"; + radius = 0; + modules-center = "date"; }; - settings = { - "module/volume" = { - type = "internal/pulseaudio"; - format.volume = " "; - label.muted.text = "🔇"; - label.muted.foreground = "#666"; - ramp.volume = [ - "🔈" - "🔉" - "🔊" - ]; - click.right = "pavucontrol &"; - }; + "module/date" = { + type = "internal/date"; + internal = 5; + date = "%d.%m.%y"; + time = "%H:%M"; + label = "%time% %date%"; }; - extraConfig = '' - [module/date] - type = internal/date - interval = 5 - date = "%d.%m.%y" - time = %H:%M - format-prefix-foreground = ''${colors.foreground-alt} - label = %time% %date% - ''; }; + settings = { + "module/volume" = { + type = "internal/pulseaudio"; + format.volume = " "; + label.muted.text = "🔇"; + label.muted.foreground = "#666"; + ramp.volume = [ + "🔈" + "🔉" + "🔊" + ]; + click.right = "pavucontrol &"; + }; + }; + extraConfig = '' + [module/date] + type = internal/date + interval = 5 + date = "%d.%m.%y" + time = %H:%M + format-prefix-foreground = ''${colors.foreground-alt} + label = %time% %date% + ''; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/polybar.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/polybar.service - assertFileExists $serviceFile - assertFileRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' - assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' + assertFileExists $serviceFile + assertFileRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' + assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' - assertFileExists home-files/.config/polybar/config.ini - assertFileContent home-files/.config/polybar/config.ini \ - ${./basic-configuration.conf} - ''; - }; + assertFileExists home-files/.config/polybar/config.ini + assertFileContent home-files/.config/polybar/config.ini \ + ${./basic-configuration.conf} + ''; } diff --git a/tests/modules/services/polybar/empty-configuration.nix b/tests/modules/services/polybar/empty-configuration.nix index 984e6b0cb86d..b4cac7c06108 100644 --- a/tests/modules/services/polybar/empty-configuration.nix +++ b/tests/modules/services/polybar/empty-configuration.nix @@ -1,21 +1,19 @@ { config, ... }: { - config = { - services.polybar = { - enable = true; - package = config.lib.test.mkStubPackage { }; - script = "polybar bar &"; - }; + services.polybar = { + enable = true; + package = config.lib.test.mkStubPackage { }; + script = "polybar bar &"; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/polybar.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/polybar.service - assertFileExists $serviceFile - assertFileNotRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' - assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' + assertFileExists $serviceFile + assertFileNotRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' + assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' - assertPathNotExists home-files/.config/polybar/config.ini - ''; - }; + assertPathNotExists home-files/.config/polybar/config.ini + ''; } diff --git a/tests/modules/services/shikane/basic-configuration.nix b/tests/modules/services/shikane/basic-configuration.nix index 4c01e44beb11..fd116f8a9e27 100644 --- a/tests/modules/services/shikane/basic-configuration.nix +++ b/tests/modules/services/shikane/basic-configuration.nix @@ -1,47 +1,45 @@ { config, ... }: { - config = { - services.shikane = { - enable = true; - package = config.lib.test.mkStubPackage { }; - settings = { - profile = [ - { - name = "external-monitor-default"; - output = [ - { - match = "eDP-1"; - enable = true; - } - { - match = "HDMI-A-1"; - enable = true; - position = { - x = 1920; - y = 0; - }; - } - ]; - } - { - name = "builtin"; - output = [ - { - match = "eDP-1"; - enable = true; - } - ]; - } - ]; - }; + services.shikane = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = { + profile = [ + { + name = "external-monitor-default"; + output = [ + { + match = "eDP-1"; + enable = true; + } + { + match = "HDMI-A-1"; + enable = true; + position = { + x = 1920; + y = 0; + }; + } + ]; + } + { + name = "builtin"; + output = [ + { + match = "eDP-1"; + enable = true; + } + ]; + } + ]; }; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/shikane.service - assertFileExists $serviceFile + nmt.script = '' + serviceFile=home-files/.config/systemd/user/shikane.service + assertFileExists $serviceFile - assertFileExists home-files/.config/shikane/config.toml - assertFileContent home-files/.config/shikane/config.toml ${./expected.toml} - ''; - }; + assertFileExists home-files/.config/shikane/config.toml + assertFileContent home-files/.config/shikane/config.toml ${./expected.toml} + ''; } diff --git a/tests/modules/services/tldr-update/tldr-update.nix b/tests/modules/services/tldr-update/tldr-update.nix index 90daeed12543..65dc0e7798a8 100644 --- a/tests/modules/services/tldr-update/tldr-update.nix +++ b/tests/modules/services/tldr-update/tldr-update.nix @@ -1,21 +1,19 @@ { config, ... }: { - config = { - home.stateVersion = "24.11"; + home.stateVersion = "24.11"; - services.tldr-update = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@tldr@"; }; - period = "monthly"; - }; + services.tldr-update = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@tldr@"; }; + period = "monthly"; + }; - nmt.script = '' - serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/tldr-update.service) - assertFileContent "$serviceFile" ${./tldr-update.service} + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/tldr-update.service) + assertFileContent "$serviceFile" ${./tldr-update.service} - timerFile=$(normalizeStorePaths home-files/.config/systemd/user/tldr-update.timer) - assertFileContent "$timerFile" ${./tldr-update.timer} - ''; - }; + timerFile=$(normalizeStorePaths home-files/.config/systemd/user/tldr-update.timer) + assertFileContent "$timerFile" ${./tldr-update.timer} + ''; } diff --git a/tests/modules/services/trayer/basic-configuration.nix b/tests/modules/services/trayer/basic-configuration.nix index 2574fd36cbfe..8d3b2a9683e3 100644 --- a/tests/modules/services/trayer/basic-configuration.nix +++ b/tests/modules/services/trayer/basic-configuration.nix @@ -1,27 +1,25 @@ { config, ... }: { - config = { - services.trayer = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@trayer@"; }; - settings = { - edge = "top"; - padding = 6; - SetDockType = true; - tint = "0x282c34"; - SetPartialStrut = true; - expand = true; - monitor = 1; - }; + services.trayer = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@trayer@"; }; + settings = { + edge = "top"; + padding = 6; + SetDockType = true; + tint = "0x282c34"; + SetPartialStrut = true; + expand = true; + monitor = 1; }; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/trayer.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/trayer.service - assertFileExists $serviceFile - assertFileContains $serviceFile \ - 'ExecStart=@trayer@/bin/trayer --SetDockType true --SetPartialStrut true --edge top --expand true --monitor 1 --padding 6 --tint 0x282c34' - ''; - }; + assertFileExists $serviceFile + assertFileContains $serviceFile \ + 'ExecStart=@trayer@/bin/trayer --SetDockType true --SetPartialStrut true --edge top --expand true --monitor 1 --padding 6 --tint 0x282c34' + ''; } diff --git a/tests/modules/services/way-displays/configuration.nix b/tests/modules/services/way-displays/configuration.nix index 7ee5751ab0bc..e9b7d5a71f94 100644 --- a/tests/modules/services/way-displays/configuration.nix +++ b/tests/modules/services/way-displays/configuration.nix @@ -1,43 +1,41 @@ { config, ... }: { - config = { - services.way-displays = { - enable = true; - package = config.lib.test.mkStubPackage { }; - settings = { - CALLBACK_CMD = "notify-send \"way-displays \${CALLBACK_LEVEL}\" \"\${CALLBACK_MSG}\""; - ORDER = [ - "eDP-1" - "DELL U2419HC" - "DELL U2415" - "HP E24 G5" - "HP E24 G5" - ]; - ALIGN = "MIDDLE"; - VRR_OFF = [ - "DELL U2419HC" - "DELL U2415" - ]; - TRANSFORM = [ - { - NAME_DESC = "DELL U2419HC"; - TRANSFORM = "90"; - } - { - NAME_DESC = "HP E24 G5"; - TRANSFORM = "90"; - } - ]; - }; + services.way-displays = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = { + CALLBACK_CMD = "notify-send \"way-displays \${CALLBACK_LEVEL}\" \"\${CALLBACK_MSG}\""; + ORDER = [ + "eDP-1" + "DELL U2419HC" + "DELL U2415" + "HP E24 G5" + "HP E24 G5" + ]; + ALIGN = "MIDDLE"; + VRR_OFF = [ + "DELL U2419HC" + "DELL U2415" + ]; + TRANSFORM = [ + { + NAME_DESC = "DELL U2419HC"; + TRANSFORM = "90"; + } + { + NAME_DESC = "HP E24 G5"; + TRANSFORM = "90"; + } + ]; }; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/way-displays.service - assertFileExists $serviceFile + nmt.script = '' + serviceFile=home-files/.config/systemd/user/way-displays.service + assertFileExists $serviceFile - assertFileExists home-files/.config/way-displays/cfg.yaml - assertFileContent home-files/.config/way-displays/cfg.yaml \ - ${./configuration.yaml} - ''; - }; + assertFileExists home-files/.config/way-displays/cfg.yaml + assertFileContent home-files/.config/way-displays/cfg.yaml \ + ${./configuration.yaml} + ''; } diff --git a/tests/modules/services/wlsunset/wlsunset-service.nix b/tests/modules/services/wlsunset/wlsunset-service.nix index 27263a252c65..4942882bc428 100644 --- a/tests/modules/services/wlsunset/wlsunset-service.nix +++ b/tests/modules/services/wlsunset/wlsunset-service.nix @@ -1,23 +1,21 @@ { config, ... }: { - config = { - services.wlsunset = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@wlsunset@"; }; - latitude = "12.3"; - longitude = "128.8"; - temperature.day = 6000; - temperature.night = 3500; - gamma = "0.6"; - systemdTarget = "test.target"; - }; + services.wlsunset = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@wlsunset@"; }; + latitude = "12.3"; + longitude = "128.8"; + temperature.day = 6000; + temperature.night = 3500; + gamma = "0.6"; + systemdTarget = "test.target"; + }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/wlsunset.service + nmt.script = '' + serviceFile=home-files/.config/systemd/user/wlsunset.service - assertFileExists $serviceFile - assertFileContent $serviceFile ${./wlsunset-service-expected.service} - ''; - }; + assertFileExists $serviceFile + assertFileContent $serviceFile ${./wlsunset-service-expected.service} + ''; } diff --git a/tests/modules/services/xsettingsd/basic-configuration.nix b/tests/modules/services/xsettingsd/basic-configuration.nix index 2804f34a9c11..58175a5ef4c3 100644 --- a/tests/modules/services/xsettingsd/basic-configuration.nix +++ b/tests/modules/services/xsettingsd/basic-configuration.nix @@ -1,26 +1,24 @@ { config, ... }: { - config = { - services.xsettingsd = { - enable = true; - package = config.lib.test.mkStubPackage { }; - settings = { - "Net/ThemeName" = "Numix"; - "Xft/Antialias" = true; - "Xft/Hinting" = true; - "Xft/RGBA" = "rgb"; - }; + services.xsettingsd = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = { + "Net/ThemeName" = "Numix"; + "Xft/Antialias" = true; + "Xft/Hinting" = true; + "Xft/RGBA" = "rgb"; }; - nmt.script = '' - serviceFile=home-files/.config/systemd/user/xsettingsd.service + }; + nmt.script = '' + serviceFile=home-files/.config/systemd/user/xsettingsd.service - assertFileExists $serviceFile - assertFileRegex $serviceFile 'ExecStart=.*/bin/xsettingsd.*' + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/xsettingsd.*' - assertFileExists ${config.services.xsettingsd.configFile} - assertFileContent ${config.services.xsettingsd.configFile} \ - ${./basic-configuration.conf} - ''; - }; + assertFileExists ${config.services.xsettingsd.configFile} + assertFileContent ${config.services.xsettingsd.configFile} \ + ${./basic-configuration.conf} + ''; } diff --git a/tests/modules/targets-darwin/darwin.nix b/tests/modules/targets-darwin/darwin.nix index bf63468b4968..93616a585e05 100644 --- a/tests/modules/targets-darwin/darwin.nix +++ b/tests/modules/targets-darwin/darwin.nix @@ -6,11 +6,9 @@ let ''; in { - config = { - home.packages = [ darwinTestApp ]; + home.packages = [ darwinTestApp ]; - nmt.script = '' - assertFileExists 'home-files/Applications/Home Manager Apps/example-app' - ''; - }; + nmt.script = '' + assertFileExists 'home-files/Applications/Home Manager Apps/example-app' + ''; } diff --git a/tests/modules/targets-darwin/user-defaults.nix b/tests/modules/targets-darwin/user-defaults.nix index 2a11398c5952..ba5a42b8e797 100644 --- a/tests/modules/targets-darwin/user-defaults.nix +++ b/tests/modules/targets-darwin/user-defaults.nix @@ -1,15 +1,13 @@ { - config = { - targets.darwin = { - defaults."com.apple.desktopservices".DSDontWriteNetworkStores = true; - currentHostDefaults."com.apple.controlcenter".BatteryShowPercentage = true; - }; - - nmt.script = '' - assertFileRegex activate \ - "/usr/bin/defaults import com.apple.desktopservices /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" - assertFileRegex activate \ - "/usr/bin/defaults -currentHost import com.apple.controlcenter /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" - ''; + targets.darwin = { + defaults."com.apple.desktopservices".DSDontWriteNetworkStores = true; + currentHostDefaults."com.apple.controlcenter".BatteryShowPercentage = true; }; + + nmt.script = '' + assertFileRegex activate \ + "/usr/bin/defaults import com.apple.desktopservices /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" + assertFileRegex activate \ + "/usr/bin/defaults -currentHost import com.apple.controlcenter /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" + ''; } diff --git a/tests/modules/targets-linux/generic-linux.nix b/tests/modules/targets-linux/generic-linux.nix index e838cbab7424..398cb7500f83 100644 --- a/tests/modules/targets-linux/generic-linux.nix +++ b/tests/modules/targets-linux/generic-linux.nix @@ -11,27 +11,25 @@ let ]; in { - config = { - targets.genericLinux.enable = true; + targets.genericLinux.enable = true; - xdg.systemDirs.data = [ "/foo" ]; + xdg.systemDirs.data = [ "/foo" ]; - nmt.script = '' - envFile=home-files/.config/environment.d/10-home-manager.conf - assertFileExists $envFile - assertFileContains $envFile \ - 'XDG_DATA_DIRS=${expectedXdgDataDirs}''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}' - assertFileContains $envFile \ - 'TERMINFO_DIRS=/home/hm-user/.nix-profile/share/terminfo:$TERMINFO_DIRS''${TERMINFO_DIRS:+:}/etc/terminfo:/lib/terminfo:/usr/share/terminfo' + nmt.script = '' + envFile=home-files/.config/environment.d/10-home-manager.conf + assertFileExists $envFile + assertFileContains $envFile \ + 'XDG_DATA_DIRS=${expectedXdgDataDirs}''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}' + assertFileContains $envFile \ + 'TERMINFO_DIRS=/home/hm-user/.nix-profile/share/terminfo:$TERMINFO_DIRS''${TERMINFO_DIRS:+:}/etc/terminfo:/lib/terminfo:/usr/share/terminfo' - sessionVarsFile=home-path/etc/profile.d/hm-session-vars.sh - assertFileExists $sessionVarsFile - assertFileContains $sessionVarsFile \ - '. "${pkgs.nix}/etc/profile.d/nix.sh"' + sessionVarsFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileExists $sessionVarsFile + assertFileContains $sessionVarsFile \ + '. "${pkgs.nix}/etc/profile.d/nix.sh"' - assertFileContains \ - home-path/etc/profile.d/hm-session-vars.sh \ - 'export TERM="$TERM"' - ''; - }; + assertFileContains \ + home-path/etc/profile.d/hm-session-vars.sh \ + 'export TERM="$TERM"' + ''; } From 5e17365824b8e5243282c065cf549c395e57dc38 Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Mon, 27 Oct 2025 08:29:23 +0100 Subject: [PATCH 4/5] tests/integration: simplify `pkgs.linkFarm` usage --- tests/integration/default.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/integration/default.nix b/tests/integration/default.nix index bceacaaf7984..255c2369cf63 100644 --- a/tests/integration/default.nix +++ b/tests/integration/default.nix @@ -29,7 +29,4 @@ let standalone-standard-basics = runTest ./standalone/standard-basics.nix; }; in -tests -// { - all = pkgs.linkFarm "all" (pkgs.lib.mapAttrsToList (name: path: { inherit name path; }) tests); -} +tests // { all = pkgs.linkFarm "all" tests; } From 70d33bbc03c3eb06a3e31a7d5b559263b46751ed Mon Sep 17 00:00:00 2001 From: Benedikt Rips Date: Mon, 27 Oct 2025 08:41:13 +0100 Subject: [PATCH 5/5] hyprland: use previously unused lambda parameter --- modules/services/window-managers/hyprland.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 96f8876bffdb..bc4ba72f2f03 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -366,7 +366,7 @@ in importantPrefixes = cfg.importantPrefixes ++ lib.optional cfg.sourceFirst "source"; pluginsToHyprconf = - _plugins: + plugins: lib.hm.generators.toHyprconf { attrs = { "exec-once" = @@ -374,7 +374,7 @@ in mkEntry = entry: if lib.types.package.check entry then "${entry}/lib/lib${entry.pname}.so" else entry; in - map (p: "hyprctl plugin load ${mkEntry p}") cfg.plugins; + map (p: "hyprctl plugin load ${mkEntry p}") plugins; }; inherit importantPrefixes; };