From 7a3f0b3b8df1b913890f5fad04d34f2af91da858 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 31 Jan 2025 21:24:47 +0100 Subject: [PATCH] tests: rework derivation stubbing Instead of having to manually stub packages that should not be downloaded we instead automatically stub all packages (except a small list of whitelisted ones). Tests can re-introduce the real package by using the `realPkgs` module argument. --- tests/default.nix | 110 ++++++-- tests/modules/config/i18n/default.nix | 19 +- .../input-method/fcitx5-configuration.nix | 8 +- .../i18n/input-method/fcitx5-stubs.nix | 57 ---- .../i18n/input-method/kime-configuration.nix | 2 - tests/modules/misc/debug/default.nix | 4 +- .../misc/fontconfig/no-font-package.nix | 20 +- .../misc/fontconfig/single-font-package.nix | 18 +- tests/modules/misc/gtk/gtk2-basic-config.nix | 36 +-- .../misc/gtk/gtk2-config-file-location.nix | 22 +- .../modules/misc/gtk/gtk3-basic-settings.nix | 32 +-- tests/modules/misc/manual/manual.nix | 36 +-- tests/modules/misc/numlock/numlock.nix | 18 +- .../misc/qt/qt-platform-theme-gnome.nix | 7 - .../modules/misc/qt/qt-platform-theme-gtk.nix | 8 +- tests/modules/misc/xdg/autostart.nix | 52 ++-- tests/modules/misc/xdg/portal.nix | 14 +- tests/modules/programs/abook/no-settings.nix | 2 - .../modules/programs/abook/with-settings.nix | 2 - tests/modules/programs/aerc/assertion.nix | 2 - tests/modules/programs/aerc/noSettings.nix | 2 - tests/modules/programs/aerc/settings.nix | 2 - .../modules/programs/aerospace/aerospace.nix | 2 - .../programs/alacritty/empty-settings.nix | 12 +- .../programs/alacritty/example-settings.nix | 44 ++- .../programs/alacritty/settings-merging.nix | 56 ++-- .../programs/alacritty/toml-config.nix | 50 ++-- tests/modules/programs/alot/alot.nix | 44 ++- tests/modules/programs/antidote/antidote.nix | 7 - tests/modules/programs/aria2/settings.nix | 58 ++-- tests/modules/programs/atuin/bash.nix | 7 - .../modules/programs/atuin/empty-settings.nix | 7 - .../programs/atuin/example-settings.nix | 5 - tests/modules/programs/atuin/fish.nix | 5 - tests/modules/programs/atuin/no-shell.nix | 5 - tests/modules/programs/atuin/set-flags.nix | 5 - tests/modules/programs/atuin/zsh.nix | 7 - .../programs/autojump/default-settings.nix | 22 +- .../autorandr/basic-configuration.nix | 112 ++++---- tests/modules/programs/autorandr/scale.nix | 48 ++-- tests/modules/programs/awscli/awscli.nix | 4 - tests/modules/programs/bacon/bacon.nix | 2 +- tests/modules/programs/bacon/empty-config.nix | 2 - tests/modules/programs/bash/completion.nix | 6 - tests/modules/programs/bash/logout.nix | 38 ++- .../programs/bash/session-variables.nix | 50 ++-- tests/modules/programs/bat/bat.nix | 90 +++--- .../programs/bat/deprecated-options.nix | 110 ++++---- tests/modules/programs/beets/mpdstats.nix | 7 - tests/modules/programs/beets/mpdupdate.nix | 3 - .../programs/bemenu/basic-configuration.nix | 2 - .../programs/bemenu/empty-configuration.nix | 4 +- .../borgmatic/basic-configuration.nix | 6 +- .../both-sourcedirectories-and-patterns.nix | 10 +- .../exclude-hm-symlinks-nothing-else.nix | 13 +- .../borgmatic/exclude-hm-symlinks.nix | 7 +- .../borgmatic/include-hm-symlinks.nix | 7 +- ...neither-sourcedirectories-nor-patterns.nix | 10 +- .../borgmatic/patterns-configuration.nix | 7 +- .../modules/programs/boxxy/empty-settings.nix | 2 - .../programs/boxxy/example-settings.nix | 2 - tests/modules/programs/broot/broot.nix | 7 +- .../programs/browserpass/browserpass.nix | 59 ++-- .../modules/programs/btop/empty-settings.nix | 4 - tests/modules/programs/carapace/bash.nix | 4 +- tests/modules/programs/carapace/fish.nix | 6 +- tests/modules/programs/carapace/zsh.nix | 4 +- tests/modules/programs/cmus/cmus.nix | 4 - tests/modules/programs/comodoro/comodoro.nix | 4 - tests/modules/programs/direnv/bash.nix | 22 +- tests/modules/programs/direnv/nix-direnv.nix | 22 +- tests/modules/programs/direnv/nushell.nix | 4 +- .../programs/direnv/stdlib-and-nix-direnv.nix | 30 +- tests/modules/programs/direnv/stdlib.nix | 26 +- .../fastfetch/basic-configuration.nix | 2 - .../fastfetch/default-configuration.nix | 2 - tests/modules/programs/feh/feh-bindings.nix | 50 ++-- .../programs/feh/feh-empty-settings.nix | 18 +- tests/modules/programs/feh/feh-themes.nix | 50 ++-- .../programs/firefox/final-package.nix | 30 +- .../firefox/setup-firefox-mock-overlay.nix | 50 ++-- .../modules/programs/foot/empty-settings.nix | 16 +- .../programs/foot/example-settings.nix | 38 ++- .../programs/foot/systemd-user-service.nix | 27 +- .../programs/freetube/basic-configuration.nix | 4 - .../programs/fuzzel/empty-settings.nix | 4 - .../programs/gallery-dl/gallery-dl.nix | 2 - tests/modules/programs/gh-dash/config.nix | 4 - tests/modules/programs/gh/config-file.nix | 40 ++- .../modules/programs/gh/credential-helper.nix | 4 - tests/modules/programs/gh/extensions.nix | 3 +- tests/modules/programs/gh/warnings.nix | 60 ++-- .../programs/ghostty/empty-settings.nix | 2 +- .../programs/ghostty/example-theme.nix | 3 +- .../programs/git-cliff/example-settings.nix | 6 - .../programs/git-credential-oauth/basic.nix | 4 +- .../git-credential-oauth/extra-flags.nix | 4 +- tests/modules/programs/git/git-with-email.nix | 62 ++--- tests/modules/programs/git/git-with-hooks.nix | 4 +- tests/modules/programs/git/git-with-msmtp.nix | 65 ++--- .../programs/git/git-with-signing-key-id.nix | 34 ++- .../git/git-with-str-extra-config.nix | 43 ++- .../git/git-without-signing-key-id.nix | 34 ++- tests/modules/programs/git/git.nix | 141 +++++----- .../programs/gnome-shell/gnome-shell.nix | 2 - .../gnome-terminal/bad-profile-name.nix | 7 - .../gnome-terminal/gnome-terminal-1.nix | 100 +++---- tests/modules/programs/go/go-telemetry.nix | 5 - .../programs/gpg/immutable-keyfiles.nix | 9 +- .../modules/programs/gpg/mutable-keyfiles.nix | 5 - .../gradle/alternate-home-settings.nix | 38 ++- .../programs/gradle/empty-settings.nix | 18 +- .../programs/gradle/example-settings.nix | 68 +++-- .../programs/gradle/init-scripts-settings.nix | 56 ++-- .../programs/granted/integration-disabled.nix | 4 - .../programs/granted/integration-enabled.nix | 4 - .../programs/helix/example-settings.nix | 262 +++++++++--------- .../programs/hexchat/basic-configuration.nix | 99 +++---- tests/modules/programs/himalaya/basic.nix | 6 - .../modules/programs/htop/empty-settings.nix | 16 +- .../programs/htop/example-settings.nix | 6 +- tests/modules/programs/htop/header_layout.nix | 6 +- .../programs/htop/settings-without-fields.nix | 6 +- .../programs/hyfetch/empty-settings.nix | 16 +- tests/modules/programs/hyfetch/settings.nix | 4 - .../programs/hyprlock/basic-configuration.nix | 4 - .../hyprlock/complex-configuration.nix | 4 - .../programs/i3blocks/with-ordered-blocks.nix | 18 +- .../i3status-rust/with-version-0311.nix | 14 +- .../modules/programs/i3status/with-custom.nix | 112 ++++---- .../programs/i3status/with-default.nix | 128 ++++----- .../programs/irssi/example-settings.nix | 44 ++- .../joplin-desktop/basic-configuration.nix | 2 - .../modules/programs/jujutsu/empty-config.nix | 2 - .../programs/k9s/deprecated-options.nix | 6 +- tests/modules/programs/k9s/empty-settings.nix | 5 +- .../programs/k9s/partial-skin-settings.nix | 4 - tests/modules/programs/kakoune/no-plugins.nix | 4 - tests/modules/programs/kakoune/stubs.nix | 28 +- .../modules/programs/kakoune/use-plugins.nix | 6 +- .../whitespace-highlighter-corner-cases.nix | 4 - .../kakoune/whitespace-highlighter.nix | 4 +- tests/modules/programs/khal/config.nix | 6 +- tests/modules/programs/khard/basic_config.nix | 2 - tests/modules/programs/khard/dirty_path.nix | 2 - tests/modules/programs/khard/empty_config.nix | 2 - .../programs/khard/multiple_accounts.nix | 2 - .../programs/kitty/example-settings.nix | 2 - .../programs/kitty/theme-to-themeFile.nix | 42 +-- .../programs/kodi/example-addon-settings.nix | 2 + .../programs/kodi/example-settings.nix | 6 +- .../modules/programs/kodi/example-sources.nix | 7 +- tests/modules/programs/kodi/kodi-stubs.nix | 10 + .../programs/kubecolor/empty-config.nix | 2 - tests/modules/programs/ledger/ledger.nix | 4 - .../programs/less/less-with-custom-keys.nix | 6 - tests/modules/programs/lesspipe/lesspipe.nix | 2 - tests/modules/programs/lf/all-options.nix | 86 +++--- tests/modules/programs/lf/minimal-options.nix | 17 +- tests/modules/programs/lf/no-pv-keybind.nix | 30 +- .../modules/programs/lsd/example-settings.nix | 104 ++++--- .../mbsync/mbsync-master-slave-change.nix | 95 ------- tests/modules/programs/mbsync/mbsync.nix | 146 +++++----- tests/modules/programs/micro/micro.nix | 4 - .../programs/mpv/mpv-example-settings.nix | 2 - .../programs/mpv/mpv-invalid-settings.nix | 8 +- tests/modules/programs/mpv/mpv-stubs.nix | 29 -- .../programs/mu/basic-configuration.nix | 4 - .../programs/mu/custom-configuration.nix | 2 - .../ncmpcpp-linux/ncmpcpp-issue-3560.nix | 31 +-- .../ncmpcpp-linux/ncmpcpp-use-mpd-config.nix | 27 +- .../ncmpcpp/ncmpcpp-empty-settings.nix | 16 +- .../ncmpcpp/ncmpcpp-example-settings.nix | 100 ++++--- tests/modules/programs/ne/defprefs.nix | 36 +-- tests/modules/programs/ne/passthroughs.nix | 44 ++- .../neomutt/neomutt-no-folder-change.nix | 38 +-- .../programs/neomutt/neomutt-not-primary.nix | 32 +-- .../programs/neomutt/neomutt-unmailboxes.nix | 38 +-- .../neomutt-with-binds-invalid-settings.nix | 40 ++- .../neomutt-with-binds-with-warning.nix | 106 ++++--- .../programs/neomutt/neomutt-with-binds.nix | 110 ++++---- .../programs/neomutt/neomutt-with-gpg.nix | 47 ++-- .../neomutt-with-imap-type-mailboxes.nix | 92 +++--- .../programs/neomutt/neomutt-with-imap.nix | 66 ++--- .../programs/neomutt/neomutt-with-msmtp.nix | 52 ++-- .../neomutt/neomutt-with-named-mailboxes.nix | 76 +++-- .../neomutt-with-signature-command.nix | 68 +++-- .../neomutt/neomutt-with-signature.nix | 74 +++-- .../neomutt/neomutt-with-starttls.nix | 60 ++-- tests/modules/programs/neomutt/neomutt.nix | 58 ++-- tests/modules/programs/neovide/neovide.nix | 4 - tests/modules/programs/neovim/coc-config.nix | 36 ++- .../programs/neovim/extra-lua-init.nix | 33 +-- tests/modules/programs/neovim/no-init.nix | 42 ++- .../modules/programs/neovim/plugin-config.nix | 56 ++-- tests/modules/programs/neovim/runtime.nix | 96 ++++--- tests/modules/programs/neovim/stubs.nix | 35 +++ .../newsboat/newsboat-basics-2003.nix | 44 ++- .../newsboat/newsboat-basics-2105.nix | 46 ++- .../programs/newsboat/newsboat-basics.nix | 42 ++- .../programs/nheko/nheko-empty-settings.nix | 2 - .../programs/nheko/nheko-example-settings.nix | 2 - .../nix-index/assert-on-command-not-found.nix | 44 ++- .../programs/nix-index/integrations.nix | 52 ++-- .../programs/nix-your-shell/enable-shells.nix | 6 - .../programs/nushell/example-settings.nix | 5 +- tests/modules/programs/oh-my-posh/bash.nix | 4 - tests/modules/programs/oh-my-posh/fish.nix | 2 - tests/modules/programs/oh-my-posh/nushell.nix | 5 - tests/modules/programs/oh-my-posh/zsh.nix | 7 - .../openstackclient/openstackclient.nix | 4 - tests/modules/programs/pandoc/csl.nix | 2 - tests/modules/programs/pandoc/defaults.nix | 44 +-- tests/modules/programs/pandoc/templates.nix | 2 - tests/modules/programs/papis/papis.nix | 4 - .../pay-respects/integration-disabled.nix | 12 +- .../pay-respects/integration-enabled.nix | 12 +- tests/modules/programs/pet/settings_21_05.nix | 7 - tests/modules/programs/pet/settings_21_11.nix | 7 - tests/modules/programs/pet/snippets.nix | 37 +-- .../modules/programs/pistol/associations.nix | 2 - tests/modules/programs/pistol/config.nix | 2 - .../programs/pistol/double-association.nix | 2 - .../programs/pistol/missing-association.nix | 2 - tests/modules/programs/pls/bash.nix | 39 +-- tests/modules/programs/pls/fish.nix | 48 ++-- tests/modules/programs/pls/zsh.nix | 43 ++- .../programs/poetry/custom-settings.nix | 2 - .../programs/poetry/default-settings.nix | 2 - tests/modules/programs/powerline-go/bash.nix | 46 ++- .../powerline-go/bashmodulesright.nix | 48 ++-- tests/modules/programs/powerline-go/fish.nix | 48 ++-- tests/modules/programs/powerline-go/zsh.nix | 49 ++-- .../programs/powerline-go/zshmodulesright.nix | 51 ++-- .../programs/pubs/pubs-example-settings.nix | 4 - tests/modules/programs/pyenv/bash.nix | 4 - tests/modules/programs/pyenv/fish.nix | 4 - tests/modules/programs/pyenv/zsh.nix | 4 - tests/modules/programs/qcal/http-calendar.nix | 4 - tests/modules/programs/qcal/mixed.nix | 4 - .../modules/programs/qcal/webdav-calendar.nix | 4 - .../programs/qutebrowser/greasemonkey.nix | 6 +- .../programs/qutebrowser/keybindings.nix | 4 +- .../programs/qutebrowser/quickmarks.nix | 4 +- .../modules/programs/qutebrowser/settings.nix | 4 +- .../modules/programs/ranger/configuration.nix | 4 - tests/modules/programs/rbw/empty-settings.nix | 2 - tests/modules/programs/rbw/rbw-stubs.nix | 12 - tests/modules/programs/rbw/settings.nix | 6 +- .../modules/programs/rbw/simple-settings.nix | 4 +- tests/modules/programs/rio/empty-settings.nix | 4 - .../modules/programs/rio/example-settings.nix | 4 +- .../programs/rofi-pass/rofi-pass-config.nix | 49 ++-- .../programs/rofi-pass/rofi-pass-root.nix | 41 +-- .../rofi/config-with-deprecated-options.nix | 3 - tests/modules/programs/rofi/custom-theme.nix | 60 ++-- tests/modules/programs/rofi/valid-config.nix | 48 ++-- tests/modules/programs/ruff/ruff.nix | 4 - tests/modules/programs/sagemath/sagemath.nix | 2 - .../programs/sapling/sapling-basic.nix | 2 - .../modules/programs/sapling/sapling-most.nix | 2 - tests/modules/programs/sbt/credentials.nix | 4 +- .../programs/sbt/deprecated-options.nix | 4 - tests/modules/programs/sbt/plugins.nix | 4 +- .../modules/programs/sbt/user-config-path.nix | 4 +- tests/modules/programs/scmpuff/bash.nix | 4 - tests/modules/programs/scmpuff/fish.nix | 2 - tests/modules/programs/scmpuff/no-aliases.nix | 2 - tests/modules/programs/scmpuff/no-bash.nix | 4 - tests/modules/programs/scmpuff/no-fish.nix | 2 - tests/modules/programs/scmpuff/no-shell.nix | 7 - tests/modules/programs/scmpuff/no-zsh.nix | 7 - tests/modules/programs/scmpuff/zsh.nix | 7 - .../programs/sftpman/assert-on-no-sshkey.nix | 26 +- .../programs/sftpman/example-settings.nix | 72 +++-- .../sioyek/sioyek-basic-configuration.nix | 4 - tests/modules/programs/sm64ex/settings.nix | 142 +++++----- .../programs/spotify-player/settings.nix | 2 - .../starship/fish_with_interactive.nix | 42 ++- .../starship/fish_with_transience.nix | 26 +- .../starship/fish_without_interactive.nix | 70 +++-- .../starship/fish_without_transience.nix | 22 +- tests/modules/programs/starship/settings.nix | 88 +++--- .../programs/taskwarrior/taskwarrior.nix | 63 ++--- .../programs/terminator/config-file.nix | 6 +- .../programs/thefuck/integration-disabled.nix | 4 - .../thefuck/integration-enabled-instant.nix | 4 - .../programs/thefuck/integration-enabled.nix | 4 - .../programs/thunderbird/thunderbird.nix | 2 - tests/modules/programs/tmate/tmate.nix | 4 - tests/modules/programs/todoman/config.nix | 2 - .../programs/tofi/basic-configuration.nix | 45 ++- tests/modules/programs/topgrade/settings.nix | 2 - .../translate-shell/translate-shell.nix | 4 - .../modules/programs/vifm/empty-settings.nix | 4 - .../programs/vim-vint/basic-configuration.nix | 4 - .../wezterm/bash-integration-default.nix | 4 - .../wezterm/bash-integration-disabled.nix | 4 - .../wezterm/bash-integration-enabled.nix | 4 - .../programs/wezterm/empty-setting.nix | 4 - .../programs/wezterm/example-setting.nix | 4 - .../wezterm/zsh-integration-default.nix | 5 - .../wezterm/zsh-integration-disabled.nix | 5 - .../wezterm/zsh-integration-enabled.nix | 5 - .../wpaperd/wpaperd-example-settings.nix | 36 +-- .../programs/yambar/empty-settings.nix | 4 - .../programs/yambar/example-settings.nix | 4 - .../yazi/bash-integration-enabled.nix | 4 - .../yazi/fish-integration-enabled.nix | 2 - .../modules/programs/yazi/init-lua-string.nix | 4 +- .../yazi/nushell-integration-enabled.nix | 2 - tests/modules/programs/yazi/settings.nix | 4 - .../programs/yazi/zsh-integration-enabled.nix | 4 - .../programs/yt-dlp/yt-dlp-extraConfig.nix | 4 - .../programs/yt-dlp/yt-dlp-simple-config.nix | 4 - .../modules/programs/zellij/enable-shells.nix | 11 +- tests/modules/programs/zk/zk.nix | 4 - tests/modules/programs/zplug/modules.nix | 5 - .../programs/zsh/history-ignore-pattern.nix | 13 +- .../programs/zsh/history-path-new-custom.nix | 22 +- .../programs/zsh/history-path-new-default.nix | 16 +- .../programs/zsh/history-path-old-custom.nix | 22 +- .../programs/zsh/history-path-old-default.nix | 16 +- .../programs/zsh/history-substring-search.nix | 30 +- tests/modules/programs/zsh/prezto.nix | 17 +- .../programs/zsh/session-variables.nix | 26 +- .../programs/zsh/syntax-highlighting.nix | 30 +- tests/modules/programs/zsh/zsh-abbr.nix | 4 - tests/modules/programs/zsh/zsh-stubs.nix | 22 -- .../services/activitywatch/basic-setup.nix | 1 - .../activitywatch/empty-server-settings.nix | 2 - .../modules/services/avizo/with-settings.nix | 4 - .../services/avizo/without-settings.nix | 4 - .../services/barrier/basic-configuration.nix | 4 - .../services/blanket/basic-configuration.nix | 6 +- .../borgmatic/basic-configuration.nix | 32 +-- .../borgmatic/basic-configuration.service | 2 +- .../services/cachix-agent/basic-setup.nix | 7 +- .../cliphist/cliphist-extra-options.nix | 7 +- .../cliphist-multiple-session-targets.nix | 7 - .../cliphist/cliphist-sway-session-target.nix | 5 - .../clipman/clipman-sway-session-target.nix | 7 - tests/modules/services/comodoro/comodoro.nix | 4 - .../services/conky/basic-configuration.nix | 4 - .../services/copyq/basic-configuration.nix | 22 +- .../services/copyq/basic-expected.service | 2 +- .../copyq/dont-force-x-configuration.nix | 22 +- .../copyq/dont-force-x-expected.service | 2 +- .../services/darkman/basic-configuration.nix | 2 - .../services/darkman/no-configuration.nix | 7 +- .../services/devilspie2/configuration.nix | 4 - .../services/dropbox/basic-configuration.nix | 3 - .../espanso-darwin/basic-configuration.nix | 4 +- .../services/espanso/basic-configuration.nix | 4 - .../services/flameshot/empty-settings.nix | 6 +- .../services/flameshot/example-settings.nix | 4 - tests/modules/services/fluidsynth/service.nix | 2 - .../modules/services/fusuma/fusuma-stubs.nix | 11 + tests/modules/services/fusuma/service.nix | 3 +- tests/modules/services/fusuma/settings.nix | 6 +- tests/modules/services/git-sync/basic.nix | 5 +- .../modules/services/git-sync/whitespace.nix | 8 +- .../services/glance/default-settings.nix | 4 - .../services/glance/example-settings.nix | 4 - tests/modules/services/glance/glance.service | 2 +- .../services/gpg-agent/default-homedir.nix | 38 +-- .../services/gpg-agent/override-homedir.nix | 47 ++-- .../services/hypridle/basic-configuration.nix | 5 - .../services/hypridle/no-configuration.nix | 4 - .../hyprpaper/basic-configuration.nix | 4 - .../services/hyprpaper/no-configuration.nix | 4 - .../services/imapnotify-darwin/launchd.nix | 6 +- .../services/imapnotify/imapnotify.nix | 6 +- .../modules/services/lieer/lieer-service.nix | 4 - .../basic-configuration-expected.service | 2 +- .../basic-configuration.nix | 4 - .../services/mopidy/basic-configuration.nix | 2 - tests/modules/services/mopidy/mopidy-scan.nix | 4 +- .../mpd-mpris/configuration-basic.nix | 4 - .../configuration-with-local-mpd.nix | 4 - .../mpd-mpris/configuration-with-password.nix | 4 - .../services/mpd/basic-configuration.nix | 6 - .../services/mpd/basic-configuration.service | 2 +- .../mpd/before-state-version-22_11.nix | 6 - .../services/mpd/start-when-needed.nix | 6 - .../services/mpd/start-when-needed.service | 2 +- tests/modules/services/mpd/xdg-music-dir.nix | 6 - .../services/mpdris2/basic-configuration.nix | 4 - .../mpdris2/basic-configuration.service | 2 +- .../services/mpdris2/with-password.nix | 4 - .../modules/services/nix-gc-darwin/basic.nix | 4 - tests/modules/services/nix-gc/basic.nix | 4 - .../modules/services/ollama/darwin/basic.nix | 2 - tests/modules/services/ollama/linux/basic.nix | 16 +- .../linux/set-environment-variables.nix | 32 +-- tests/modules/services/pasystray/service.nix | 8 - tests/modules/services/pbgopy/service.nix | 20 +- ...picom-basic-configuration-expected.service | 2 +- .../picom/picom-basic-configuration.nix | 4 - .../services/podman-linux/configuration.nix | 2 - .../services/podman-linux/container.nix | 4 +- .../integration-network-expected.service | 2 +- .../services/podman-linux/integration.nix | 4 +- .../services/podman-linux/manifest.nix | 4 +- .../podman-linux/network-expected.service | 2 +- .../modules/services/podman-linux/network.nix | 4 +- .../services/podman-linux/podman-stubs.nix | 5 + .../gammastep-basic-configuration.nix | 44 ++- .../redshift-basic-configuration.nix | 44 ++- .../screen-locker/basic-configuration.nix | 43 ++- .../services/screen-locker/moved-options.nix | 56 ++-- .../services/screen-locker/no-xautolock.nix | 39 ++- .../signaturepdf/basic-configuration.nix | 7 +- .../snixembed/basic-configuration.nix | 4 - .../snixembed/basic-configuration.service | 2 +- .../services/swayidle/basic-configuration.nix | 2 +- .../syncthing/common/extra-options.nix | 4 +- .../linux/tray-as-bool-triggers-warning.nix | 22 +- .../modules/services/syncthing/linux/tray.nix | 22 +- .../services/trayscale/hide-window.nix | 4 +- .../services/trayscale/show-window.nix | 4 +- .../services/twmn/basic-configuration.nix | 88 +++--- tests/modules/services/udiskie/basic.nix | 20 +- tests/modules/services/udiskie/no-tray.nix | 26 +- .../services/volnoti/package-option.nix | 2 - .../window-managers/bspwm/bspwm-stubs.nix | 13 - .../window-managers/bspwm/configuration.nix | 4 - .../herbstluftwm/herbstluftwm-no-tags.nix | 6 - .../herbstluftwm-simple-config.nix | 6 - .../herbstluftwm/herbstluftwm-stubs.nix | 13 - .../hyprland/hyprland-stubs.nix | 21 -- .../hyprland/multiple-devices-config.conf | 2 +- .../hyprland/multiple-devices-config.nix | 4 +- .../hyprland/null-all-packages-config.nix | 4 +- .../hyprland/null-package-config.nix | 2 - .../hyprland/null-portal-package-config.nix | 2 - .../hyprland/simple-config.conf | 2 +- .../hyprland/simple-config.nix | 4 +- .../hyprland/sourceFirst-false-config.conf | 2 +- .../hyprland/sourceFirst-false-config.nix | 2 - .../services/window-managers/i3/i3-stubs.nix | 16 +- .../window-managers/river/configuration.nix | 9 - .../services/window-managers/river/init | 2 +- .../window-managers/river/river-stubs.nix | 13 - .../spectrwm/spectrwm-simple-config.nix | 6 - .../spectrwm/spectrwm-stubs.nix | 13 - .../sway/sway-bar-focused-colors.conf | 2 +- .../sway/sway-bar-focused-colors.nix | 6 +- ...way-bindkeys-to-code-and-extra-config.conf | 2 +- ...sway-bindkeys-to-code-and-extra-config.nix | 6 +- .../sway/sway-check-config.nix | 4 +- .../window-managers/sway/sway-default.conf | 2 +- .../window-managers/sway/sway-default.nix | 4 +- .../sway/sway-followmouse-expected.conf | 2 +- .../sway-followmouse-legacy-expected.conf | 2 +- .../sway/sway-followmouse-legacy.nix | 2 - .../window-managers/sway/sway-followmouse.nix | 2 - .../window-managers/sway/sway-modules.conf | 2 +- .../window-managers/sway/sway-modules.nix | 2 - .../window-managers/sway/sway-no-xwayland.nix | 6 +- .../window-managers/sway/sway-null-config.nix | 8 +- .../sway/sway-null-package.conf | 2 +- .../sway/sway-null-package.nix | 2 - .../window-managers/sway/sway-post-2003.conf | 2 +- .../window-managers/sway/sway-post-2003.nix | 4 +- .../window-managers/sway/sway-stubs.nix | 22 -- .../sway/sway-systemd-autostart.nix | 4 +- .../sway/sway-systemd-variables.conf | 2 +- .../sway/sway-systemd-variables.nix | 4 +- .../sway/sway-workspace-default-expected.conf | 2 +- .../sway/sway-workspace-default.nix | 4 +- .../sway/sway-workspace-output-expected.conf | 2 +- .../sway/sway-workspace-output.nix | 4 +- .../sway/swaynag-empty-settings.nix | 2 - .../sway/swaynag-example-settings.nix | 42 ++- .../window-managers/wayfire/configuration.ini | 2 +- .../window-managers/wayfire/configuration.nix | 8 +- .../window-managers/wayfire/wayfire-stubs.nix | 13 - .../window-managers/wayfire/wf-shell.nix | 9 +- tests/stubs.nix | 62 +++-- 480 files changed, 3557 insertions(+), 5511 deletions(-) delete mode 100644 tests/modules/i18n/input-method/fcitx5-stubs.nix create mode 100644 tests/modules/programs/kodi/kodi-stubs.nix delete mode 100644 tests/modules/programs/mbsync/mbsync-master-slave-change.nix delete mode 100644 tests/modules/programs/mpv/mpv-stubs.nix create mode 100644 tests/modules/programs/neovim/stubs.nix delete mode 100644 tests/modules/programs/rbw/rbw-stubs.nix delete mode 100644 tests/modules/programs/zsh/zsh-stubs.nix create mode 100644 tests/modules/services/fusuma/fusuma-stubs.nix create mode 100644 tests/modules/services/podman-linux/podman-stubs.nix delete mode 100644 tests/modules/services/window-managers/bspwm/bspwm-stubs.nix delete mode 100644 tests/modules/services/window-managers/herbstluftwm/herbstluftwm-stubs.nix delete mode 100644 tests/modules/services/window-managers/hyprland/hyprland-stubs.nix delete mode 100644 tests/modules/services/window-managers/river/river-stubs.nix delete mode 100644 tests/modules/services/window-managers/spectrwm/spectrwm-stubs.nix delete mode 100644 tests/modules/services/window-managers/sway/sway-stubs.nix delete mode 100644 tests/modules/services/window-managers/wayfire/wayfire-stubs.nix diff --git a/tests/default.nix b/tests/default.nix index ae8a91eff..98531f856 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -9,31 +9,105 @@ let sha256 = "0qhn7nnwdwzh910ss78ga2d00v42b0lspfd7ybl61mpfgz3lmdcj"; }; + # Recursively replace each derivation in the given attribute set with the same + # derivation but with the `outPath` attribute set to the string + # `"@package-name@"`. This allows the tests to refer to derivations through + # their values without establishing an actual dependency on the derivation + # output. + scrubDerivations = attrs: + let + scrubDerivation = name: value: + let + scrubbedValue = scrubDerivations value; + + newDrvAttrs = { + buildScript = abort "no build allowed"; + + outPath = builtins.traceVerbose ("${name} - got out path") + "@${lib.getName value}@"; + + # Prevent getOutput from descending into outputs + outputSpecified = true; + + # Allow the original package to be used in derivation inputs + __spliced = { + buildHost = value; + hostTarget = value; + }; + }; + in if lib.isAttrs value then + if lib.isDerivation value then + scrubbedValue // newDrvAttrs + else + scrubbedValue + else + value; + in lib.mapAttrs scrubDerivation attrs; + + # Globally unscrub a few selected packages that are used by a wide selection of tests. + whitelist = let + inner = self: super: { + inherit (pkgs) + coreutils jq desktop-file-utils diffutils findutils glibcLocales gettext + gnugrep gnused shared-mime-info emptyDirectory + # Needed by pretty much all tests that have anything to do with fish. + babelfish fish; + + xorg = + super.xorg.overrideScope (self: super: { inherit (pkgs.xorg) lndir; }); + }; + + outer = self: super: + inner self super // { + buildPackages = super.buildPackages.extend inner; + }; + in outer; + + scrubbedPkgs = + let rawScrubbedPkgs = lib.makeExtensible (final: scrubDerivations pkgs); + in builtins.traceVerbose "eval scrubbed nixpkgs" + (rawScrubbedPkgs.extend whitelist); + modules = import ../modules/modules.nix { inherit lib pkgs; check = false; - } ++ [{ - # Bypass reference inside modules/modules.nix to make the test - # suite more pure. - _module.args.pkgsPath = pkgs.path; + } ++ [ + ({ config, ... }: { + _module.args = { + # Prevent the nixpkgs module from working. We want to minimize the number + # of evaluations of Nixpkgs. + pkgsPath = abort "pkgs path is unavailable in tests"; + realPkgs = pkgs; + pkgs = let + overlays = config.test.stubOverlays ++ lib.optionals + (config.nixpkgs.overlays != null && config.nixpkgs.overlays != [ ]) + config.nixpkgs.overlays; + stubbedPkgs = if overlays == [ ] then + scrubbedPkgs + else + builtins.traceVerbose "eval overlayed nixpkgs" + (lib.foldr (o: p: p.extend o) scrubbedPkgs overlays); + in lib.mkImageMediaOverride stubbedPkgs; + }; - # Fix impurities. Without these some of the user's environment - # will leak into the tests through `builtins.getEnv`. - xdg.enable = true; - home = { - username = "hm-user"; - homeDirectory = "/home/hm-user"; - stateVersion = lib.mkDefault "18.09"; - }; + # Fix impurities. Without these some of the user's environment + # will leak into the tests through `builtins.getEnv`. + xdg.enable = true; + home = { + username = "hm-user"; + homeDirectory = "/home/hm-user"; + stateVersion = lib.mkDefault "18.09"; + }; - # Avoid including documentation since this will cause - # unnecessary rebuilds of the tests. - manual.manpages.enable = lib.mkDefault false; + # Avoid including documentation since this will cause + # unnecessary rebuilds of the tests. + manual.manpages.enable = lib.mkDefault false; - imports = [ ./asserts.nix ./big-test.nix ./stubs.nix ]; + imports = [ ./asserts.nix ./big-test.nix ./stubs.nix ]; - test.enableBig = enableBig; - }]; + test.enableBig = enableBig; + }) + ]; isDarwin = pkgs.stdenv.hostPlatform.isDarwin; isLinux = pkgs.stdenv.hostPlatform.isLinux; diff --git a/tests/modules/config/i18n/default.nix b/tests/modules/config/i18n/default.nix index 667b3b1d9..b3a7c7cc2 100644 --- a/tests/modules/config/i18n/default.nix +++ b/tests/modules/config/i18n/default.nix @@ -15,24 +15,23 @@ }; }; - i18n-custom-locales = { pkgs, ... }: { - config = let stub = pkgs.glibcLocalesCustom; - in { - test.stubs.glibcLocalesCustom = { - inherit (pkgs.glibcLocales) version; - outPath = null; # we need a real path for this stub + i18n-custom-locales = { config, pkgs, ... }: { + config = let + customGlibcLocales = pkgs.glibcLocales.override { + allLocales = false; + locales = [ "en_US.UTF-8/UTF-8" ]; }; - - i18n.glibcLocales = stub; + in { + i18n.glibcLocales = customGlibcLocales; nmt.script = '' hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh assertFileExists $hmEnvFile - assertFileRegex $hmEnvFile 'LOCALE_ARCHIVE_.*${stub}' + assertFileRegex $hmEnvFile 'LOCALE_ARCHIVE_.*${customGlibcLocales}' envFile=home-files/.config/environment.d/10-home-manager.conf assertFileExists $envFile - assertFileRegex $envFile 'LOCALE_ARCHIVE_.*${stub}' + assertFileRegex $envFile 'LOCALE_ARCHIVE_.*${customGlibcLocales}' ''; }; }; diff --git a/tests/modules/i18n/input-method/fcitx5-configuration.nix b/tests/modules/i18n/input-method/fcitx5-configuration.nix index 1e37a8bdf..8990e49dd 100644 --- a/tests/modules/i18n/input-method/fcitx5-configuration.nix +++ b/tests/modules/i18n/input-method/fcitx5-configuration.nix @@ -1,13 +1,13 @@ -{ config, pkgs, ... }: - -{ - imports = [ ./fcitx5-stubs.nix ]; +{ config, lib, realPkgs, ... }: +lib.mkIf config.test.enableBig { i18n.inputMethod = { enabled = "fcitx5"; fcitx5.waylandFrontend = true; }; + _module.args.pkgs = lib.mkForce realPkgs; + nmt.script = '' assertFileExists home-files/.config/systemd/user/fcitx5-daemon.service assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'GTK_IM_MODULE' diff --git a/tests/modules/i18n/input-method/fcitx5-stubs.nix b/tests/modules/i18n/input-method/fcitx5-stubs.nix deleted file mode 100644 index 9712a7518..000000000 --- a/tests/modules/i18n/input-method/fcitx5-stubs.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - test.stubs = { - fcitx5 = { - version = "0"; - outPath = null; - buildScript = '' - mkdir -p $out/bin $out/share/applications $out/share/dbus-1/services $out/etc/xdg/autostart - touch $out/bin/fcitx5 \ - $out/bin/fcitx5-config-qt \ - $out/share/applications/org.fcitx.Fcitx5.desktop \ - $out/share/dbus-1/services/org.fcitx.Fcitx5.service \ - $out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop - # The grep usage of fcitx5-with-addons expects one of the files to match with the fcitx5.out - # https://github.com/NixOS/nixpkgs/blob/d2eb4be48705289791428c07aca8ff654c1422ba/pkgs/tools/inputmethods/fcitx5/with-addons.nix#L40-L44 - echo $out >> $out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop - chmod +x $out/bin/fcitx5 \ - $out/bin/fcitx5-config-qt - ''; - }; - fcitx5-lua = { outPath = null; }; - fcitx5-gtk = { outPath = null; }; - - gtk2 = { - buildScript = '' - mkdir -p $out/bin - echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-2.0 - chmod +x $out/bin/* - ''; - }; - gtk3 = { - buildScript = '' - mkdir -p $out/bin - echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-3.0 - chmod +x $out/bin/* - ''; - }; - }; - - nixpkgs.overlays = [ - (final: prev: { - libsForQt5 = prev.libsForQt5.overrideScope (qt5final: qt5prev: { - fcitx5-chinese-addons = prev.mkStubPackage { outPath = null; }; - fcitx5-configtool = prev.mkStubPackage { outPath = null; }; - fcitx5-qt = prev.mkStubPackage { outPath = null; }; - - fcitx5-with-addons = qt5prev.fcitx5-with-addons.override { - inherit (final) libsForQt5 qt6Packages; - }; - }); - - qt6Packages = prev.qt6Packages.overrideScope (qt6final: qt6prev: { - fcitx5-qt = prev.mkStubPackage { outPath = null; }; - }); - - }) - ]; -} diff --git a/tests/modules/i18n/input-method/kime-configuration.nix b/tests/modules/i18n/input-method/kime-configuration.nix index b79694608..52ec07cf9 100644 --- a/tests/modules/i18n/input-method/kime-configuration.nix +++ b/tests/modules/i18n/input-method/kime-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - let kimeConfig = '' diff --git a/tests/modules/misc/debug/default.nix b/tests/modules/misc/debug/default.nix index 7eb286666..e7cde48a6 100644 --- a/tests/modules/misc/debug/default.nix +++ b/tests/modules/misc/debug/default.nix @@ -1,8 +1,8 @@ { - debug = { pkgs, config, lib, ... }: + debug = { realPkgs, config, lib, ... }: lib.mkIf config.test.enableBig { home.enableDebugInfo = true; - home.packages = with pkgs; [ curl gdb ]; + home.packages = with realPkgs; [ curl gdb ]; nmt.script = '' [ -L $TESTED/home-path/lib/debug/curl ] \ diff --git a/tests/modules/misc/fontconfig/no-font-package.nix b/tests/modules/misc/fontconfig/no-font-package.nix index c4c687a13..52b2a74d6 100644 --- a/tests/modules/misc/fontconfig/no-font-package.nix +++ b/tests/modules/misc/fontconfig/no-font-package.nix @@ -1,17 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - home.packages = [ - # Look, no font! - ]; + home.packages = [ + # Look, no font! + ]; - fonts.fontconfig.enable = true; + fonts.fontconfig.enable = true; - nmt.script = '' - assertPathNotExists home-path/lib/fontconfig/cache - ''; - }; + nmt.script = '' + assertPathNotExists home-path/lib/fontconfig/cache + ''; } diff --git a/tests/modules/misc/fontconfig/single-font-package.nix b/tests/modules/misc/fontconfig/single-font-package.nix index b70bdf8a9..dcf62238b 100644 --- a/tests/modules/misc/fontconfig/single-font-package.nix +++ b/tests/modules/misc/fontconfig/single-font-package.nix @@ -1,15 +1,13 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, realPkgs, ... }: -with lib; +lib.mkIf config.test.enableBig { + home.packages = [ pkgs.comic-relief ]; -{ - config = { - home.packages = [ pkgs.comic-relief ]; + fonts.fontconfig.enable = true; - fonts.fontconfig.enable = true; + _module.args.pkgs = lib.mkForce realPkgs; - nmt.script = '' - assertDirectoryNotEmpty home-path/lib/fontconfig/cache - ''; - }; + nmt.script = '' + assertDirectoryNotEmpty home-path/lib/fontconfig/cache + ''; } diff --git a/tests/modules/misc/gtk/gtk2-basic-config.nix b/tests/modules/misc/gtk/gtk2-basic-config.nix index 5671ac93e..684e852fb 100644 --- a/tests/modules/misc/gtk/gtk2-basic-config.nix +++ b/tests/modules/misc/gtk/gtk2-basic-config.nix @@ -1,25 +1,17 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - gtk = { - enable = true; - theme.name = "Adwaita"; - gtk2.extraConfig = "gtk-can-change-accels = 1"; - }; - - test.stubs.dconf = { }; - - nmt.script = '' - assertFileExists home-files/.gtkrc-2.0 - - assertFileContent home-files/.gtkrc-2.0 \ - ${./gtk2-basic-config-expected.conf} - - assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ - 'GTK2_RC_FILES=.*/.gtkrc-2.0' - ''; + gtk = { + enable = true; + theme.name = "Adwaita"; + gtk2.extraConfig = "gtk-can-change-accels = 1"; }; + + nmt.script = '' + assertFileExists home-files/.gtkrc-2.0 + + assertFileContent home-files/.gtkrc-2.0 \ + ${./gtk2-basic-config-expected.conf} + + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ + 'GTK2_RC_FILES=.*/.gtkrc-2.0' + ''; } diff --git a/tests/modules/misc/gtk/gtk2-config-file-location.nix b/tests/modules/misc/gtk/gtk2-config-file-location.nix index a08998384..514ac7571 100644 --- a/tests/modules/misc/gtk/gtk2-config-file-location.nix +++ b/tests/modules/misc/gtk/gtk2-config-file-location.nix @@ -1,18 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - gtk.enable = true; - gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + gtk.enable = true; + gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; - test.stubs.dconf = { }; - - nmt.script = '' - assertFileExists home-files/.config/gtk-2.0/gtkrc - assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ - 'GTK2_RC_FILES=.*/\.config/gtk-2.0/gtkrc' - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/gtk-2.0/gtkrc + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ + 'GTK2_RC_FILES=.*/\.config/gtk-2.0/gtkrc' + ''; } diff --git a/tests/modules/misc/gtk/gtk3-basic-settings.nix b/tests/modules/misc/gtk/gtk3-basic-settings.nix index 058dd85b2..d09c1e2ab 100644 --- a/tests/modules/misc/gtk/gtk3-basic-settings.nix +++ b/tests/modules/misc/gtk/gtk3-basic-settings.nix @@ -1,24 +1,16 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - gtk = { - enable = true; - gtk3.extraConfig = { - gtk-cursor-blink = false; - gtk-recent-files-limit = 20; - }; + gtk = { + enable = true; + gtk3.extraConfig = { + gtk-cursor-blink = false; + gtk-recent-files-limit = 20; }; - - test.stubs.dconf = { }; - - nmt.script = '' - assertFileExists home-files/.config/gtk-3.0/settings.ini - - assertFileContent home-files/.config/gtk-3.0/settings.ini \ - ${./gtk3-basic-settings-expected.ini} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/gtk-3.0/settings.ini + + assertFileContent home-files/.config/gtk-3.0/settings.ini \ + ${./gtk3-basic-settings-expected.ini} + ''; } diff --git a/tests/modules/misc/manual/manual.nix b/tests/modules/misc/manual/manual.nix index 1e79cdb7a..6ac6c0b53 100644 --- a/tests/modules/misc/manual/manual.nix +++ b/tests/modules/misc/manual/manual.nix @@ -1,22 +1,22 @@ -{ ... }: +{ lib, realPkgs, ... }: { - config = { - manual = { - html.enable = true; - manpages.enable = true; - json.enable = true; - }; - - nmt.script = '' - assertFileExists home-path/share/doc/home-manager/index.xhtml - assertFileExists home-path/share/doc/home-manager/options.json - assertFileExists home-path/share/doc/home-manager/options.xhtml - assertFileExists home-path/share/doc/home-manager/nixos-options.xhtml - assertFileExists home-path/share/doc/home-manager/nix-darwin-options.xhtml - assertFileExists home-path/share/doc/home-manager/release-notes.xhtml - assertFileExists home-path/share/man/man1/home-manager.1 - assertFileExists home-path/share/man/man5/home-configuration.nix.5 - ''; + manual = { + html.enable = true; + manpages.enable = true; + json.enable = true; }; + + _module.args.pkgs = lib.mkForce realPkgs; + + nmt.script = '' + assertFileExists home-path/share/doc/home-manager/index.xhtml + assertFileExists home-path/share/doc/home-manager/options.json + assertFileExists home-path/share/doc/home-manager/options.xhtml + assertFileExists home-path/share/doc/home-manager/nixos-options.xhtml + assertFileExists home-path/share/doc/home-manager/nix-darwin-options.xhtml + assertFileExists home-path/share/doc/home-manager/release-notes.xhtml + assertFileExists home-path/share/man/man1/home-manager.1 + assertFileExists home-path/share/man/man5/home-configuration.nix.5 + ''; } diff --git a/tests/modules/misc/numlock/numlock.nix b/tests/modules/misc/numlock/numlock.nix index 5616de1c5..a46a52f94 100644 --- a/tests/modules/misc/numlock/numlock.nix +++ b/tests/modules/misc/numlock/numlock.nix @@ -1,16 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - xsession.numlock.enable = true; + xsession.numlock.enable = true; - test.stubs.numlockx = { }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/numlockx.service - assertFileExists $serviceFile - ''; - }; + nmt.script = '' + serviceFile=home-files/.config/systemd/user/numlockx.service + assertFileExists $serviceFile + ''; } diff --git a/tests/modules/misc/qt/qt-platform-theme-gnome.nix b/tests/modules/misc/qt/qt-platform-theme-gnome.nix index ca5829ee7..9feeee640 100644 --- a/tests/modules/misc/qt/qt-platform-theme-gnome.nix +++ b/tests/modules/misc/qt/qt-platform-theme-gnome.nix @@ -6,13 +6,6 @@ style.name = "adwaita"; }; - test.stubs = { - qgnomeplatform = { }; - qgnomeplatform-qt6 = { }; - adwaita-qt = { }; - adwaita-qt6 = { }; - }; - nmt.script = '' assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ 'QT_QPA_PLATFORMTHEME="gnome"' diff --git a/tests/modules/misc/qt/qt-platform-theme-gtk.nix b/tests/modules/misc/qt/qt-platform-theme-gtk.nix index 22107016c..7b179c287 100644 --- a/tests/modules/misc/qt/qt-platform-theme-gtk.nix +++ b/tests/modules/misc/qt/qt-platform-theme-gtk.nix @@ -1,6 +1,6 @@ -{ - imports = [ ../../i18n/input-method/fcitx5-stubs.nix ]; +{ config, ... }: +{ qt = { enable = true; platformTheme.name = "gtk"; @@ -11,11 +11,11 @@ nixpkgs.overlays = [ (final: prev: { libsForQt5 = prev.libsForQt5.overrideScope (qt5final: qt5prev: { - qtstyleplugins = prev.mkStubPackage { outPath = null; }; + qtstyleplugins = config.lib.test.mkStubPackage { outPath = null; }; }); qt6Packages = prev.qt6Packages.overrideScope (qt6final: qt6prev: { - qt6gtk2 = prev.mkStubPackage { outPath = null; }; + qt6gtk2 = config.lib.test.mkStubPackage { outPath = null; }; }); }) ]; diff --git a/tests/modules/misc/xdg/autostart.nix b/tests/modules/misc/xdg/autostart.nix index b93580414..754d11396 100644 --- a/tests/modules/misc/xdg/autostart.nix +++ b/tests/modules/misc/xdg/autostart.nix @@ -1,20 +1,38 @@ -{ pkgs, ... }: { - config = { - xdg.autostart = { - enable = true; - entries = [ - "${pkgs.evolution}/share/applications/org.gnome.Evolution.desktop" - "${pkgs.tdesktop}/share/applications/org.telegram.desktop.desktop" - ]; - }; +{ pkgs, ... }: - nmt.script = '' - assertFileExists home-files/.config/autostart/org.gnome.Evolution.desktop - assertFileContent home-files/.config/autostart/org.gnome.Evolution.desktop \ - ${pkgs.evolution}/share/applications/org.gnome.Evolution.desktop - assertFileExists home-files/.config/autostart/org.telegram.desktop.desktop - assertFileContent home-files/.config/autostart/org.telegram.desktop.desktop \ - ${pkgs.tdesktop}/share/applications/org.telegram.desktop.desktop - ''; +{ + xdg.autostart = { + enable = true; + entries = [ + "${pkgs.test1}/share/applications/test1.desktop" + "${pkgs.test2}/share/applications/test2.desktop" + ]; }; + + test.stubs = { + test1 = { + outPath = null; + buildScript = '' + mkdir -p $out/share/applications + echo test1 > $out/share/applications/test1.desktop + ''; + }; + test2 = { + outPath = null; + buildScript = '' + mkdir -p $out/share/applications + echo test2 > $out/share/applications/test2.desktop + ''; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/autostart/test1.desktop + assertFileContent home-files/.config/autostart/test1.desktop \ + ${pkgs.test1}/share/applications/test1.desktop + + assertFileExists home-files/.config/autostart/test2.desktop + assertFileContent home-files/.config/autostart/test2.desktop \ + ${pkgs.test2}/share/applications/test2.desktop + ''; } diff --git a/tests/modules/misc/xdg/portal.nix b/tests/modules/misc/xdg/portal.nix index e9ac8e381..48527b129 100644 --- a/tests/modules/misc/xdg/portal.nix +++ b/tests/modules/misc/xdg/portal.nix @@ -1,26 +1,28 @@ -{ config, lib, pkgs, ... }: +{ config, lib, realPkgs, ... }: lib.mkIf config.test.enableBig { xdg.portal = { enable = true; extraPortals = - [ pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-wlr ]; - configPackages = [ pkgs.hyprland ]; + [ realPkgs.xdg-desktop-portal-hyprland realPkgs.xdg-desktop-portal-wlr ]; + configPackages = [ realPkgs.hyprland ]; config = { sway.default = [ "wlr" "gtk" ]; }; }; + test.unstubs = [ (self: super: { inherit (realPkgs) xdg-desktop-portal; }) ]; + nmt.script = '' assertFileExists home-path/share/systemd/user/xdg-desktop-portal.service assertFileExists home-path/share/systemd/user/xdg-desktop-portal-wlr.service assertFileExists home-path/share/systemd/user/xdg-desktop-portal-hyprland.service assertFileContent home-path/share/xdg-desktop-portal/portals/hyprland.portal \ - ${pkgs.xdg-desktop-portal-hyprland}/share/xdg-desktop-portal/portals/hyprland.portal + ${realPkgs.xdg-desktop-portal-hyprland}/share/xdg-desktop-portal/portals/hyprland.portal assertFileContent home-path/share/xdg-desktop-portal/portals/wlr.portal \ - ${pkgs.xdg-desktop-portal-wlr}/share/xdg-desktop-portal/portals/wlr.portal + ${realPkgs.xdg-desktop-portal-wlr}/share/xdg-desktop-portal/portals/wlr.portal assertFileContent home-path/share/xdg-desktop-portal/hyprland-portals.conf \ - ${pkgs.hyprland}/share/xdg-desktop-portal/hyprland-portals.conf + ${realPkgs.hyprland}/share/xdg-desktop-portal/hyprland-portals.conf assertFileContent home-files/.config/xdg-desktop-portal/sway-portals.conf \ ${./sway-portals-expected.conf} ''; diff --git a/tests/modules/programs/abook/no-settings.nix b/tests/modules/programs/abook/no-settings.nix index f8b096fb1..a8e5de78c 100644 --- a/tests/modules/programs/abook/no-settings.nix +++ b/tests/modules/programs/abook/no-settings.nix @@ -6,8 +6,6 @@ with lib; config = { programs.abook.enable = true; - test.stubs.abook = { }; - 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 e89ad7dad..22703a172 100644 --- a/tests/modules/programs/abook/with-settings.nix +++ b/tests/modules/programs/abook/with-settings.nix @@ -28,8 +28,6 @@ with lib; ''; }; - test.stubs.abook = { }; - 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 9b37f0824..dfdbe3f7d 100644 --- a/tests/modules/programs/aerc/assertion.nix +++ b/tests/modules/programs/aerc/assertion.nix @@ -19,8 +19,6 @@ with lib; This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. '']; - test.stubs.aerc = { }; - programs.aerc = { enable = true; extraAccounts = { diff --git a/tests/modules/programs/aerc/noSettings.nix b/tests/modules/programs/aerc/noSettings.nix index c941c19b7..fc4cb2dbb 100644 --- a/tests/modules/programs/aerc/noSettings.nix +++ b/tests/modules/programs/aerc/noSettings.nix @@ -12,7 +12,5 @@ with lib; assertPathNotExists ${dir}/stylesets ''; programs.aerc.enable = true; - - test.stubs.aerc = { }; }; } diff --git a/tests/modules/programs/aerc/settings.nix b/tests/modules/programs/aerc/settings.nix index af4d16f70..8d59f1e6c 100644 --- a/tests/modules/programs/aerc/settings.nix +++ b/tests/modules/programs/aerc/settings.nix @@ -19,8 +19,6 @@ with lib; assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected} ''; - test.stubs.aerc = { }; - programs.aerc = { enable = true; diff --git a/tests/modules/programs/aerospace/aerospace.nix b/tests/modules/programs/aerospace/aerospace.nix index db32c531b..9e06ad8f0 100644 --- a/tests/modules/programs/aerospace/aerospace.nix +++ b/tests/modules/programs/aerospace/aerospace.nix @@ -17,8 +17,6 @@ }; }; - test.stubs.aerospace = { }; - nmt.script = '' assertFileContent home-files/.config/aerospace/aerospace.toml ${ ./settings-expected.toml diff --git a/tests/modules/programs/alacritty/empty-settings.nix b/tests/modules/programs/alacritty/empty-settings.nix index c587018e5..4aa010672 100644 --- a/tests/modules/programs/alacritty/empty-settings.nix +++ b/tests/modules/programs/alacritty/empty-settings.nix @@ -1,11 +1,7 @@ { - config = { - programs.alacritty.enable = true; + programs.alacritty.enable = true; - test.stubs.alacritty = { }; - - nmt.script = '' - assertPathNotExists home-files/.config/alacritty - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/alacritty + ''; } diff --git a/tests/modules/programs/alacritty/example-settings.nix b/tests/modules/programs/alacritty/example-settings.nix index ccda3b2c5..fca3bf68d 100644 --- a/tests/modules/programs/alacritty/example-settings.nix +++ b/tests/modules/programs/alacritty/example-settings.nix @@ -1,31 +1,23 @@ -{ config, ... }: - { - config = { - programs.alacritty = { - enable = true; - package = config.lib.test.mkStubPackage { }; - - settings = { - window.dimensions = { - lines = 3; - columns = 200; - }; - - keyboard.bindings = [{ - key = "K"; - mods = "Control"; - chars = "\\u000c"; - }]; + programs.alacritty = { + enable = true; + settings = { + window.dimensions = { + lines = 3; + columns = 200; }; + + keyboard.bindings = [{ + key = "K"; + mods = "Control"; + chars = "\\u000c"; + }]; }; - - test.stubs = { alacritty = { }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/alacritty/alacritty.toml \ - ${./example-settings-expected.toml} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/alacritty/alacritty.toml \ + ${./example-settings-expected.toml} + ''; } diff --git a/tests/modules/programs/alacritty/settings-merging.nix b/tests/modules/programs/alacritty/settings-merging.nix index 1d47b77a6..e86bf5e42 100644 --- a/tests/modules/programs/alacritty/settings-merging.nix +++ b/tests/modules/programs/alacritty/settings-merging.nix @@ -1,39 +1,33 @@ -{ config, lib, ... }: +{ lib, ... }: { - config = { - programs.alacritty = { - enable = true; - package = config.lib.test.mkStubPackage { }; + programs.alacritty = { + enable = true; + settings = { + window.dimensions = { + lines = 3; + columns = 200; + }; - settings = { - window.dimensions = { - lines = 3; - columns = 200; - }; + keyboard.bindings = [{ + key = "K"; + mods = "Control"; + chars = "\\u000c"; + }]; - keyboard.bindings = [{ - key = "K"; - mods = "Control"; - chars = "\\u000c"; - }]; - - font = let - defaultFont = - lib.mkMerge [ (lib.mkIf true "SFMono") (lib.mkIf false "Iosevka") ]; - in { - normal.family = defaultFont; - bold.family = defaultFont; - }; + font = let + defaultFont = + lib.mkMerge [ (lib.mkIf true "SFMono") (lib.mkIf false "Iosevka") ]; + in { + normal.family = defaultFont; + bold.family = defaultFont; }; }; - - test.stubs = { alacritty = { }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/alacritty/alacritty.toml \ - ${./settings-toml-expected.toml} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/alacritty/alacritty.toml \ + ${./settings-toml-expected.toml} + ''; } diff --git a/tests/modules/programs/alacritty/toml-config.nix b/tests/modules/programs/alacritty/toml-config.nix index 8235d44c2..b065fa302 100644 --- a/tests/modules/programs/alacritty/toml-config.nix +++ b/tests/modules/programs/alacritty/toml-config.nix @@ -1,36 +1,28 @@ -{ config, ... }: - { - config = { - programs.alacritty = { - enable = true; - package = config.lib.test.mkStubPackage { }; + programs.alacritty = { + enable = true; + settings = { + window.dimensions = { + lines = 3; + columns = 200; + }; - settings = { - window.dimensions = { - lines = 3; - columns = 200; - }; + keyboard.bindings = [{ + key = "K"; + mods = "Control"; + chars = "\\u000c"; + }]; - keyboard.bindings = [{ - key = "K"; - mods = "Control"; - chars = "\\u000c"; - }]; - - font = { - normal.family = "SFMono"; - bold.family = "SFMono"; - }; + font = { + normal.family = "SFMono"; + bold.family = "SFMono"; }; }; - - test.stubs = { alacritty = { }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/alacritty/alacritty.toml \ - ${./settings-toml-expected.toml} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/alacritty/alacritty.toml \ + ${./settings-toml-expected.toml} + ''; } diff --git a/tests/modules/programs/alot/alot.nix b/tests/modules/programs/alot/alot.nix index 6316fbd76..279b99144 100644 --- a/tests/modules/programs/alot/alot.nix +++ b/tests/modules/programs/alot/alot.nix @@ -1,34 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - alot = { - contactCompletion = { }; - extraConfig = '' - auto_remove_unread = True - ask_subject = False - handle_mouse = True - ''; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + alot = { + contactCompletion = { }; + extraConfig = '' + auto_remove_unread = True + ask_subject = False + handle_mouse = True + ''; }; + imap.port = 993; }; - - programs.alot = { enable = true; }; - - test.stubs.alot = { }; - - nmt.script = '' - assertFileExists home-files/.config/alot/config - assertFileContent home-files/.config/alot/config ${./alot-expected.conf} - ''; }; + + programs.alot = { enable = true; }; + + nmt.script = '' + assertFileExists home-files/.config/alot/config + assertFileContent home-files/.config/alot/config ${./alot-expected.conf} + ''; } diff --git a/tests/modules/programs/antidote/antidote.nix b/tests/modules/programs/antidote/antidote.nix index 3d8fff6a9..ec697e02c 100644 --- a/tests/modules/programs/antidote/antidote.nix +++ b/tests/modules/programs/antidote/antidote.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - let relToDotDirCustom = ".zshplugins"; in { programs.zsh = { @@ -12,11 +10,6 @@ in { }; }; - test.stubs = { - antidote = { }; - zsh = { }; - }; - nmt.script = '' assertFileContains home-files/${relToDotDirCustom}/.zshrc \ 'source @antidote@/share/antidote/antidote.zsh' diff --git a/tests/modules/programs/aria2/settings.nix b/tests/modules/programs/aria2/settings.nix index 346de9679..a0ba02a3f 100644 --- a/tests/modules/programs/aria2/settings.nix +++ b/tests/modules/programs/aria2/settings.nix @@ -1,40 +1,32 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.aria2 = { - enable = true; + programs.aria2 = { + enable = true; - settings = { - listen-port = 60000; - dht-listen-port = 60000; - seed-ratio = 1.0; - max-upload-limit = "50K"; - ftp-pasv = true; - }; - - extraConfig = '' - # Extra aria2 configuration. - ''; + settings = { + listen-port = 60000; + dht-listen-port = 60000; + seed-ratio = 1.0; + max-upload-limit = "50K"; + ftp-pasv = true; }; - test.stubs.aria2 = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/aria2/aria2.conf \ - ${ - pkgs.writeText "aria2-expected-config.conf" '' - dht-listen-port=60000 - ftp-pasv=true - listen-port=60000 - max-upload-limit=50K - seed-ratio=1.000000 - # Extra aria2 configuration. - '' - } + extraConfig = '' + # Extra aria2 configuration. ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/aria2/aria2.conf \ + ${ + builtins.toFile "aria2-expected-config.conf" '' + dht-listen-port=60000 + ftp-pasv=true + listen-port=60000 + max-upload-limit=50K + seed-ratio=1.000000 + # Extra aria2 configuration. + '' + } + ''; } diff --git a/tests/modules/programs/atuin/bash.nix b/tests/modules/programs/atuin/bash.nix index 21d306b2f..5176a79ba 100644 --- a/tests/modules/programs/atuin/bash.nix +++ b/tests/modules/programs/atuin/bash.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { atuin.enable = true; @@ -9,11 +7,6 @@ }; }; - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/atuin/empty-settings.nix b/tests/modules/programs/atuin/empty-settings.nix index be6b55986..b10fa4891 100644 --- a/tests/modules/programs/atuin/empty-settings.nix +++ b/tests/modules/programs/atuin/empty-settings.nix @@ -1,13 +1,6 @@ -{ ... }: - { programs.atuin.enable = true; - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertPathNotExists home-files/.config/atuin/config.toml ''; diff --git a/tests/modules/programs/atuin/example-settings.nix b/tests/modules/programs/atuin/example-settings.nix index 98aca707d..dab1b9e3a 100644 --- a/tests/modules/programs/atuin/example-settings.nix +++ b/tests/modules/programs/atuin/example-settings.nix @@ -12,11 +12,6 @@ }; }; - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertFileContent \ home-files/.config/atuin/config.toml \ diff --git a/tests/modules/programs/atuin/fish.nix b/tests/modules/programs/atuin/fish.nix index 49d9a2821..f67c9cfa1 100644 --- a/tests/modules/programs/atuin/fish.nix +++ b/tests/modules/programs/atuin/fish.nix @@ -10,11 +10,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertFileExists home-files/.config/fish/config.fish assertFileContains \ diff --git a/tests/modules/programs/atuin/no-shell.nix b/tests/modules/programs/atuin/no-shell.nix index c6481e427..6cab60e27 100644 --- a/tests/modules/programs/atuin/no-shell.nix +++ b/tests/modules/programs/atuin/no-shell.nix @@ -17,11 +17,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertFileNotRegex home-files/.zshrc 'atuin init zsh' assertFileNotRegex home-files/.bashrc 'atuin init bash' diff --git a/tests/modules/programs/atuin/set-flags.nix b/tests/modules/programs/atuin/set-flags.nix index ebc68a5d1..14c719708 100644 --- a/tests/modules/programs/atuin/set-flags.nix +++ b/tests/modules/programs/atuin/set-flags.nix @@ -16,11 +16,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/atuin/zsh.nix b/tests/modules/programs/atuin/zsh.nix index 2cb4fefef..b83f9258c 100644 --- a/tests/modules/programs/atuin/zsh.nix +++ b/tests/modules/programs/atuin/zsh.nix @@ -1,16 +1,9 @@ -{ ... }: - { programs = { atuin.enable = true; zsh.enable = true; }; - test.stubs = { - atuin = { name = "atuin"; }; - bash-preexec = { }; - }; - nmt.script = '' assertFileExists home-files/.zshrc assertFileContains \ diff --git a/tests/modules/programs/autojump/default-settings.nix b/tests/modules/programs/autojump/default-settings.nix index e7d40bb37..a886a029c 100644 --- a/tests/modules/programs/autojump/default-settings.nix +++ b/tests/modules/programs/autojump/default-settings.nix @@ -1,18 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.autojump.enable = true; + programs.autojump.enable = true; - test.stubs.autojump = { - buildScript = "mkdir -p $out/bin; touch $out/bin/autojump"; - outPath = null; - }; - - nmt.script = '' - assertFileExists home-path/bin/autojump - ''; + test.stubs.autojump = { + buildScript = "mkdir -p $out/bin; touch $out/bin/autojump"; + outPath = null; }; + + nmt.script = '' + assertFileExists home-path/bin/autojump + ''; } diff --git a/tests/modules/programs/autorandr/basic-configuration.nix b/tests/modules/programs/autorandr/basic-configuration.nix index d0f14ec86..3a2e74202 100644 --- a/tests/modules/programs/autorandr/basic-configuration.nix +++ b/tests/modules/programs/autorandr/basic-configuration.nix @@ -1,66 +1,60 @@ -{ config, pkgs, ... }: - { - config = { - programs.autorandr = { - enable = true; - profiles = { - default = { - fingerprint = { - DP1 = "XXX"; - DP2 = "YYY"; - }; - config = { - DP1.enable = false; - DP2 = { - crtc = 0; - primary = true; - position = "0x0"; - mode = "1920x1080"; - filter = "nearest"; - transform = [ - [ 0.6 0.0 0.0 ] # a b c - [ 0.0 0.6 0.0 ] # d e f - [ 0.0 0.0 1.0 ] # g h i - ]; - extraConfig = '' - key1 value1 - key2 value2 - ''; - }; + programs.autorandr = { + enable = true; + profiles = { + default = { + fingerprint = { + DP1 = "XXX"; + DP2 = "YYY"; + }; + config = { + DP1.enable = false; + DP2 = { + crtc = 0; + primary = true; + position = "0x0"; + mode = "1920x1080"; + filter = "nearest"; + transform = [ + [ 0.6 0.0 0.0 ] # a b c + [ 0.0 0.6 0.0 ] # d e f + [ 0.0 0.0 1.0 ] # g h i + ]; + extraConfig = '' + key1 value1 + key2 value2 + ''; }; }; }; }; - - test.stubs.autorandr = { }; - - nmt.script = '' - config=home-files/.config/autorandr/default/config - setup=home-files/.config/autorandr/default/setup - - assertFileExists $setup - assertFileRegex $setup 'DP1 XXX' - assertFileRegex $setup 'DP2 YYY' - - assertFileExists $config - assertFileContent $config \ - ${ - pkgs.writeText "basic-configuration.conf" '' - output DP1 - off - - output DP2 - pos 0x0 - crtc 0 - primary - mode 1920x1080 - filter nearest - transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000 - key1 value1 - key2 value2 - '' - } - ''; }; + + nmt.script = '' + config=home-files/.config/autorandr/default/config + setup=home-files/.config/autorandr/default/setup + + assertFileExists $setup + assertFileRegex $setup 'DP1 XXX' + assertFileRegex $setup 'DP2 YYY' + + assertFileExists $config + assertFileContent $config \ + ${ + builtins.toFile "basic-configuration.conf" '' + output DP1 + off + + output DP2 + pos 0x0 + crtc 0 + primary + mode 1920x1080 + filter nearest + transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000 + key1 value1 + key2 value2 + '' + } + ''; } diff --git a/tests/modules/programs/autorandr/scale.nix b/tests/modules/programs/autorandr/scale.nix index 095778a43..0fd55ae76 100644 --- a/tests/modules/programs/autorandr/scale.nix +++ b/tests/modules/programs/autorandr/scale.nix @@ -1,34 +1,28 @@ -{ config, pkgs, ... }: - { - config = { - programs.autorandr = { - enable = true; - profiles = { - default = { - fingerprint.DP1 = "XXX"; - config.DP1 = { - scale = { - x = 2; - y = 4; - }; + programs.autorandr = { + enable = true; + profiles = { + default = { + fingerprint.DP1 = "XXX"; + config.DP1 = { + scale = { + x = 2; + y = 4; }; }; }; }; - - test.stubs.autorandr = { }; - - nmt.script = '' - config=home-files/.config/autorandr/default/config - - assertFileExists $config - assertFileContent $config \ - ${ - pkgs.writeText "scale-expected.conf" '' - output DP1 - scale 2x4'' - } - ''; }; + + nmt.script = '' + config=home-files/.config/autorandr/default/config + + assertFileExists $config + assertFileContent $config \ + ${ + builtins.toFile "scale-expected.conf" '' + output DP1 + scale 2x4'' + } + ''; } diff --git a/tests/modules/programs/awscli/awscli.nix b/tests/modules/programs/awscli/awscli.nix index 0a96990ad..abcfc8a25 100644 --- a/tests/modules/programs/awscli/awscli.nix +++ b/tests/modules/programs/awscli/awscli.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { awscli = { @@ -14,8 +12,6 @@ }; }; - test.stubs.awscli2 = { }; - nmt.script = '' assertFileExists home-files/.aws/config assertFileContent home-files/.aws/config \ diff --git a/tests/modules/programs/bacon/bacon.nix b/tests/modules/programs/bacon/bacon.nix index 6df88456d..712c6da3b 100644 --- a/tests/modules/programs/bacon/bacon.nix +++ b/tests/modules/programs/bacon/bacon.nix @@ -21,7 +21,7 @@ in { }; }; }; - test.stubs.bacon = { }; + nmt.script = '' assertFileExists 'home-files/${configDir}/prefs.toml' assertFileContent 'home-files/${configDir}/prefs.toml' ${./expected.toml} diff --git a/tests/modules/programs/bacon/empty-config.nix b/tests/modules/programs/bacon/empty-config.nix index 51ceb94e5..def614d39 100644 --- a/tests/modules/programs/bacon/empty-config.nix +++ b/tests/modules/programs/bacon/empty-config.nix @@ -7,8 +7,6 @@ let in { programs.bacon.enable = true; - test.stubs.bacon = { }; - nmt.script = '' assertPathNotExists 'home-files/${configDir}/prefs.toml' ''; diff --git a/tests/modules/programs/bash/completion.nix b/tests/modules/programs/bash/completion.nix index 2e5e69dd1..744da3d7a 100644 --- a/tests/modules/programs/bash/completion.nix +++ b/tests/modules/programs/bash/completion.nix @@ -1,12 +1,6 @@ -{ config, lib, pkgs, ... }: - -with lib; - { programs.bash.enable = true; - test.stubs.bash-completion = { }; - nmt.script = '' assertFileExists home-files/.bashrc diff --git a/tests/modules/programs/bash/logout.nix b/tests/modules/programs/bash/logout.nix index c366c520e..5fb78a94f 100644 --- a/tests/modules/programs/bash/logout.nix +++ b/tests/modules/programs/bash/logout.nix @@ -1,27 +1,21 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.bash = { - enable = true; - enableCompletion = false; + programs.bash = { + enable = true; + enableCompletion = false; - logoutExtra = '' - clear-console - ''; - }; - - nmt.script = '' - assertFileExists home-files/.bash_logout - assertFileContent \ - home-files/.bash_logout \ - ${ - builtins.toFile "logout-expected" '' - clear-console - '' - } + logoutExtra = '' + clear-console ''; }; + + nmt.script = '' + assertFileExists home-files/.bash_logout + assertFileContent \ + home-files/.bash_logout \ + ${ + builtins.toFile "logout-expected" '' + clear-console + '' + } + ''; } diff --git a/tests/modules/programs/bash/session-variables.nix b/tests/modules/programs/bash/session-variables.nix index bbf2b71ab..01d204b77 100644 --- a/tests/modules/programs/bash/session-variables.nix +++ b/tests/modules/programs/bash/session-variables.nix @@ -1,33 +1,29 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs.bash = { - enable = true; - enableCompletion = false; + programs.bash = { + enable = true; + enableCompletion = false; - sessionVariables = { - V1 = "v1"; - V2 = "v2-${config.programs.bash.sessionVariables.V1}"; - }; + sessionVariables = { + V1 = "v1"; + V2 = "v2-${config.programs.bash.sessionVariables.V1}"; }; - - nmt.script = '' - assertFileExists home-files/.profile - assertFileContent \ - home-files/.profile \ - ${ - builtins.toFile "session-variables-expected" '' - . "/home/hm-user/.nix-profile/etc/profile.d/hm-session-vars.sh" - - export V1="v1" - export V2="v2-v1" - - - '' - } - ''; }; + + nmt.script = '' + assertFileExists home-files/.profile + assertFileContent \ + home-files/.profile \ + ${ + builtins.toFile "session-variables-expected" '' + . "/home/hm-user/.nix-profile/etc/profile.d/hm-session-vars.sh" + + export V1="v1" + export V2="v2-v1" + + + '' + } + ''; } diff --git a/tests/modules/programs/bat/bat.nix b/tests/modules/programs/bat/bat.nix index 578310486..bc07489ca 100644 --- a/tests/modules/programs/bat/bat.nix +++ b/tests/modules/programs/bat/bat.nix @@ -1,58 +1,50 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.bat = { - enable = true; + programs.bat = { + enable = true; - config = { - theme = "TwoDark"; - pager = "less -FR"; - map-syntax = [ "*.jenkinsfile:Groovy" "*.props:Java Properties" ]; - show-all = true; + config = { + theme = "TwoDark"; + pager = "less -FR"; + map-syntax = [ "*.jenkinsfile:Groovy" "*.props:Java Properties" ]; + show-all = true; - # False boolean options should not appear in the config - lessopen = false; - }; - - themes.testtheme.src = pkgs.writeText "testtheme.tmTheme" '' - This is a test theme. - ''; - - syntaxes.testsyntax.src = pkgs.writeText "testsyntax.sublime-syntax" '' - This is a test syntax. - ''; + # False boolean options should not appear in the config + lessopen = false; }; - test.stubs.bat = { }; + themes.testtheme.src = builtins.toFile "testtheme.tmTheme" '' + This is a test theme. + ''; - nmt.script = '' - assertFileExists home-files/.config/bat/config - assertFileContent home-files/.config/bat/config ${ - pkgs.writeText "bat.expected" '' - --map-syntax='*.jenkinsfile:Groovy' - --map-syntax='*.props:Java Properties' - --pager='less -FR' - --theme=TwoDark - --show-all - '' - } - - assertFileExists home-files/.config/bat/themes/testtheme.tmTheme - assertFileContent home-files/.config/bat/themes/testtheme.tmTheme ${ - pkgs.writeText "bat.expected" '' - This is a test theme. - '' - } - - assertFileExists home-files/.config/bat/syntaxes/testsyntax.sublime-syntax - assertFileContent home-files/.config/bat/syntaxes/testsyntax.sublime-syntax ${ - pkgs.writeText "bat.expected" '' - This is a test syntax. - '' - } + syntaxes.testsyntax.src = builtins.toFile "testsyntax.sublime-syntax" '' + This is a test syntax. ''; }; + + nmt.script = '' + assertFileExists home-files/.config/bat/config + assertFileContent home-files/.config/bat/config ${ + builtins.toFile "bat.expected" '' + --map-syntax='*.jenkinsfile:Groovy' + --map-syntax='*.props:Java Properties' + --pager='less -FR' + --theme=TwoDark + --show-all + '' + } + + assertFileExists home-files/.config/bat/themes/testtheme.tmTheme + assertFileContent home-files/.config/bat/themes/testtheme.tmTheme ${ + builtins.toFile "bat.expected" '' + This is a test theme. + '' + } + + assertFileExists home-files/.config/bat/syntaxes/testsyntax.sublime-syntax + assertFileContent home-files/.config/bat/syntaxes/testsyntax.sublime-syntax ${ + builtins.toFile "bat.expected" '' + This is a test syntax. + '' + } + ''; } diff --git a/tests/modules/programs/bat/deprecated-options.nix b/tests/modules/programs/bat/deprecated-options.nix index 096815cbe..b00333d82 100644 --- a/tests/modules/programs/bat/deprecated-options.nix +++ b/tests/modules/programs/bat/deprecated-options.nix @@ -1,67 +1,59 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.bat = { - enable = true; + programs.bat = { + enable = true; - config = { - theme = "TwoDark"; - pager = "less -FR"; - map-syntax = [ "*.jenkinsfile:Groovy" "*.props:Java Properties" ]; - }; - - themes.testtheme = '' - This is a test theme. - ''; - - syntaxes.testsyntax = '' - This is a test syntax. - ''; + config = { + theme = "TwoDark"; + pager = "less -FR"; + map-syntax = [ "*.jenkinsfile:Groovy" "*.props:Java Properties" ]; }; - test.stubs.bat = { }; + themes.testtheme = '' + This is a test theme. + ''; - test.asserts.warnings.enable = true; - test.asserts.warnings.expected = [ - '' - Using programs.bat.themes as a string option is deprecated and will be - removed in the future. Please change to using it as an attribute set - instead. - '' - '' - Using programs.bat.syntaxes as a string option is deprecated and will be - removed in the future. Please change to using it as an attribute set - instead. - '' - ]; - - nmt.script = '' - assertFileExists home-files/.config/bat/config - assertFileContent home-files/.config/bat/config ${ - pkgs.writeText "bat.expected" '' - --map-syntax='*.jenkinsfile:Groovy' - --map-syntax='*.props:Java Properties' - --pager='less -FR' - --theme=TwoDark - '' - } - - assertFileExists home-files/.config/bat/themes/testtheme.tmTheme - assertFileContent home-files/.config/bat/themes/testtheme.tmTheme ${ - pkgs.writeText "bat.expected" '' - This is a test theme. - '' - } - - assertFileExists home-files/.config/bat/syntaxes/testsyntax.sublime-syntax - assertFileContent home-files/.config/bat/syntaxes/testsyntax.sublime-syntax ${ - pkgs.writeText "bat.expected" '' - This is a test syntax. - '' - } + syntaxes.testsyntax = '' + This is a test syntax. ''; }; + + test.asserts.warnings.enable = true; + test.asserts.warnings.expected = [ + '' + Using programs.bat.themes as a string option is deprecated and will be + removed in the future. Please change to using it as an attribute set + instead. + '' + '' + Using programs.bat.syntaxes as a string option is deprecated and will be + removed in the future. Please change to using it as an attribute set + instead. + '' + ]; + + nmt.script = '' + assertFileExists home-files/.config/bat/config + assertFileContent home-files/.config/bat/config ${ + builtins.toFile "bat.expected" '' + --map-syntax='*.jenkinsfile:Groovy' + --map-syntax='*.props:Java Properties' + --pager='less -FR' + --theme=TwoDark + '' + } + + assertFileExists home-files/.config/bat/themes/testtheme.tmTheme + assertFileContent home-files/.config/bat/themes/testtheme.tmTheme ${ + builtins.toFile "bat.expected" '' + This is a test theme. + '' + } + + assertFileExists home-files/.config/bat/syntaxes/testsyntax.sublime-syntax + assertFileContent home-files/.config/bat/syntaxes/testsyntax.sublime-syntax ${ + builtins.toFile "bat.expected" '' + This is a test syntax. + '' + } + ''; } diff --git a/tests/modules/programs/beets/mpdstats.nix b/tests/modules/programs/beets/mpdstats.nix index d825f85bd..e3291a174 100644 --- a/tests/modules/programs/beets/mpdstats.nix +++ b/tests/modules/programs/beets/mpdstats.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { home.stateVersion = "23.05"; @@ -14,11 +12,6 @@ mpdIntegration.enableStats = true; }; - test.stubs = { - beets = { }; - mpd = { }; - }; - nmt.script = '' assertFileExists home-files/.config/beets/config.yaml assertFileContent \ diff --git a/tests/modules/programs/beets/mpdupdate.nix b/tests/modules/programs/beets/mpdupdate.nix index b73da81e8..eba8800c0 100644 --- a/tests/modules/programs/beets/mpdupdate.nix +++ b/tests/modules/programs/beets/mpdupdate.nix @@ -1,11 +1,8 @@ -{ config, ... }: - { home.stateVersion = "23.05"; programs.beets = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@beets@"; }; mpdIntegration.enableUpdate = true; }; diff --git a/tests/modules/programs/bemenu/basic-configuration.nix b/tests/modules/programs/bemenu/basic-configuration.nix index 01708d202..cf556ef6a 100644 --- a/tests/modules/programs/bemenu/basic-configuration.nix +++ b/tests/modules/programs/bemenu/basic-configuration.nix @@ -19,8 +19,6 @@ }; }; - test.stubs.bemenu = { }; - nmt.script = '' assertFileExists home-path/etc/profile.d/hm-session-vars.sh assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ diff --git a/tests/modules/programs/bemenu/empty-configuration.nix b/tests/modules/programs/bemenu/empty-configuration.nix index d9e729696..a07dfc436 100644 --- a/tests/modules/programs/bemenu/empty-configuration.nix +++ b/tests/modules/programs/bemenu/empty-configuration.nix @@ -1,7 +1,5 @@ { - programs.bemenu = { enable = true; }; - - test.stubs.bemenu = { }; + programs.bemenu.enable = true; nmt.script = '' assertFileExists home-path/etc/profile.d/hm-session-vars.sh diff --git a/tests/modules/programs/borgmatic/basic-configuration.nix b/tests/modules/programs/borgmatic/basic-configuration.nix index 15a57ca78..21333baf4 100644 --- a/tests/modules/programs/borgmatic/basic-configuration.nix +++ b/tests/modules/programs/borgmatic/basic-configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, realPkgs, ... }: let @@ -61,8 +61,6 @@ in { }; }; - test.stubs.borgmatic = { }; - nmt.script = '' config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml assertFileExists $config_file @@ -120,7 +118,7 @@ in { builtins.elemAt backups.main.hooks.extraConfig.before_actions 0 }" - yq=${pkgs.yq-go}/bin/yq + yq=${realPkgs.yq-go}/bin/yq for filter in "''${!expectations[@]}"; do expected_value="''${expectations[$filter]}" diff --git a/tests/modules/programs/borgmatic/both-sourcedirectories-and-patterns.nix b/tests/modules/programs/borgmatic/both-sourcedirectories-and-patterns.nix index 106a0c18c..9d9ee3232 100644 --- a/tests/modules/programs/borgmatic/both-sourcedirectories-and-patterns.nix +++ b/tests/modules/programs/borgmatic/both-sourcedirectories-and-patterns.nix @@ -1,10 +1,4 @@ -{ config, pkgs, ... }: - -let - - backups = config.programs.borgmatic.backups; - -in { +{ programs.borgmatic = { enable = true; backups = { @@ -18,8 +12,6 @@ in { }; }; - test.stubs.borgmatic = { }; - test.asserts.assertions.expected = ['' Borgmatic backup configuration "main" cannot specify both 'location.sourceDirectories' and 'location.patterns'. '']; diff --git a/tests/modules/programs/borgmatic/exclude-hm-symlinks-nothing-else.nix b/tests/modules/programs/borgmatic/exclude-hm-symlinks-nothing-else.nix index cadd7fd23..e04d05157 100644 --- a/tests/modules/programs/borgmatic/exclude-hm-symlinks-nothing-else.nix +++ b/tests/modules/programs/borgmatic/exclude-hm-symlinks-nothing-else.nix @@ -1,11 +1,6 @@ -{ config, pkgs, ... }: +{ realPkgs, ... }: -let - - backups = config.programs.borgmatic.backups; - excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar"; - -in { +{ programs.borgmatic = { enable = true; backups = { @@ -19,13 +14,11 @@ in { }; }; - test.stubs.borgmatic = { }; - nmt.script = '' config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml assertFileExists $config_file - yq=${pkgs.yq-go}/bin/yq + yq=${realPkgs.yq-go}/bin/yq hmExclusionsFile=$($yq '.exclude_from[0]' $config_file) expected_content='/home/hm-user/.config/borgmatic.d/main.yaml' diff --git a/tests/modules/programs/borgmatic/exclude-hm-symlinks.nix b/tests/modules/programs/borgmatic/exclude-hm-symlinks.nix index bc0e50129..056b1443f 100644 --- a/tests/modules/programs/borgmatic/exclude-hm-symlinks.nix +++ b/tests/modules/programs/borgmatic/exclude-hm-symlinks.nix @@ -1,8 +1,7 @@ -{ config, pkgs, ... }: +{ realPkgs, ... }: let - backups = config.programs.borgmatic.backups; excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar"; in { @@ -20,8 +19,6 @@ in { }; }; - test.stubs.borgmatic = { }; - nmt.script = '' config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml assertFileExists $config_file @@ -30,7 +27,7 @@ in { expectations[exclude_from[0]]="${excludeFile}" - yq=${pkgs.yq-go}/bin/yq + yq=${realPkgs.yq-go}/bin/yq for filter in "''${!expectations[@]}"; do expected_value="''${expectations[$filter]}" diff --git a/tests/modules/programs/borgmatic/include-hm-symlinks.nix b/tests/modules/programs/borgmatic/include-hm-symlinks.nix index dd9908b56..b89f7e2b9 100644 --- a/tests/modules/programs/borgmatic/include-hm-symlinks.nix +++ b/tests/modules/programs/borgmatic/include-hm-symlinks.nix @@ -1,8 +1,7 @@ -{ config, pkgs, ... }: +{ realPkgs, ... }: let - backups = config.programs.borgmatic.backups; excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar"; in { @@ -20,8 +19,6 @@ in { }; }; - test.stubs.borgmatic = { }; - nmt.script = '' config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml assertFileExists $config_file @@ -30,7 +27,7 @@ in { expectations[exclude_from[0]]="${excludeFile}" - yq=${pkgs.yq-go}/bin/yq + yq=${realPkgs.yq-go}/bin/yq for filter in "''${!expectations[@]}"; do expected_value="''${expectations[$filter]}" diff --git a/tests/modules/programs/borgmatic/neither-sourcedirectories-nor-patterns.nix b/tests/modules/programs/borgmatic/neither-sourcedirectories-nor-patterns.nix index 596fdf1cd..bf0653329 100644 --- a/tests/modules/programs/borgmatic/neither-sourcedirectories-nor-patterns.nix +++ b/tests/modules/programs/borgmatic/neither-sourcedirectories-nor-patterns.nix @@ -1,17 +1,9 @@ -{ config, pkgs, ... }: - -let - - backups = config.programs.borgmatic.backups; - -in { +{ programs.borgmatic = { enable = true; backups = { main = { location = { repositories = [ "/mnt/disk1" ]; }; }; }; }; - test.stubs.borgmatic = { }; - test.asserts.assertions.expected = ['' Borgmatic backup configuration "main" must specify one of 'location.sourceDirectories' or 'location.patterns'. '']; diff --git a/tests/modules/programs/borgmatic/patterns-configuration.nix b/tests/modules/programs/borgmatic/patterns-configuration.nix index 098708cad..d92237d43 100644 --- a/tests/modules/programs/borgmatic/patterns-configuration.nix +++ b/tests/modules/programs/borgmatic/patterns-configuration.nix @@ -1,8 +1,7 @@ -{ config, pkgs, ... }: +{ config, realPkgs, ... }: let - boolToString = bool: if bool then "true" else "false"; backups = config.programs.borgmatic.backups; in { @@ -23,8 +22,6 @@ in { }; }; - test.stubs.borgmatic = { }; - nmt.script = '' config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml assertFileExists $config_file @@ -44,7 +41,7 @@ in { builtins.elemAt backups.main.location.patterns 3 }" - yq=${pkgs.yq-go}/bin/yq + yq=${realPkgs.yq-go}/bin/yq for filter in "''${!expectations[@]}"; do expected_value="''${expectations[$filter]}" diff --git a/tests/modules/programs/boxxy/empty-settings.nix b/tests/modules/programs/boxxy/empty-settings.nix index 3a34cd5cd..133d670f5 100644 --- a/tests/modules/programs/boxxy/empty-settings.nix +++ b/tests/modules/programs/boxxy/empty-settings.nix @@ -6,8 +6,6 @@ with lib; config = { programs.boxxy.enable = true; - test.stubs.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 7ecec4167..6f10a56c3 100644 --- a/tests/modules/programs/boxxy/example-settings.nix +++ b/tests/modules/programs/boxxy/example-settings.nix @@ -15,8 +15,6 @@ with lib; context = [ "/home/test_user/your_project_repo" ]; }]; - test.stubs.boxxy = { }; - nmt.script = '' boxxyyaml=home-files/.config/boxxy/boxxy.yaml assertFileExists $boxxyyaml diff --git a/tests/modules/programs/broot/broot.nix b/tests/modules/programs/broot/broot.nix index 8bb7c02c4..f4061b692 100644 --- a/tests/modules/programs/broot/broot.nix +++ b/tests/modules/programs/broot/broot.nix @@ -1,4 +1,4 @@ -{ ... }: +{ realPkgs, ... }: { programs.broot = { @@ -6,10 +6,7 @@ settings.modal = true; }; - tests.stubs = { - broot = { }; - hjson = { }; - }; + nixpkgs.overlays = [ (self: super: { inherit (realPkgs) broot hjson; }) ]; nmt.script = '' assertFileExists home-files/.config/broot/conf.toml diff --git a/tests/modules/programs/browserpass/browserpass.nix b/tests/modules/programs/browserpass/browserpass.nix index 7211c0ed8..14d50af06 100644 --- a/tests/modules/programs/browserpass/browserpass.nix +++ b/tests/modules/programs/browserpass/browserpass.nix @@ -1,35 +1,32 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ realPkgs, ... }: { - config = { - programs.browserpass = { - enable = true; - browsers = - [ "brave" "chrome" "chromium" "firefox" "librewolf" "vivaldi" ]; - }; - - nmt.script = if pkgs.stdenv.hostPlatform.isDarwin then '' - for dir in "BraveSoftware/Brave-Browser" "Google/Chrome" "Chromium" "Mozilla" "LibreWolf" "Vivaldi"; do - assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json" - done - - for dir in "Google/Chrome" "Chromium" "Vivaldi"; do - assertFileExists "home-files/Library/Application Support/$dir/policies/managed/com.github.browserpass.native.json" - done - '' else '' - for dir in "BraveSoftware/Brave-Browser" "google-chrome" "chromium" "vivaldi"; do - assertFileExists "home-files/.config/$dir/NativeMessagingHosts/com.github.browserpass.native.json" - done - - for dir in "google-chrome" "chromium" "vivaldi"; do - assertFileExists "home-files/.config/$dir/policies/managed/com.github.browserpass.native.json" - done - - for dir in ".mozilla" ".librewolf"; do - assertFileExists "home-files/$dir/native-messaging-hosts/com.github.browserpass.native.json" - done - ''; + programs.browserpass = { + enable = true; + browsers = [ "brave" "chrome" "chromium" "firefox" "librewolf" "vivaldi" ]; }; + + nixpkgs.overlays = [ (self: super: { inherit (realPkgs) browserpass; }) ]; + + nmt.script = if realPkgs.stdenv.hostPlatform.isDarwin then '' + for dir in "BraveSoftware/Brave-Browser" "Google/Chrome" "Chromium" "Mozilla" "LibreWolf" "Vivaldi"; do + assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json" + done + + for dir in "Google/Chrome" "Chromium" "Vivaldi"; do + assertFileExists "home-files/Library/Application Support/$dir/policies/managed/com.github.browserpass.native.json" + done + '' else '' + for dir in "BraveSoftware/Brave-Browser" "google-chrome" "chromium" "vivaldi"; do + assertFileExists "home-files/.config/$dir/NativeMessagingHosts/com.github.browserpass.native.json" + done + + for dir in "google-chrome" "chromium" "vivaldi"; do + assertFileExists "home-files/.config/$dir/policies/managed/com.github.browserpass.native.json" + done + + for dir in ".mozilla" ".librewolf"; do + assertFileExists "home-files/$dir/native-messaging-hosts/com.github.browserpass.native.json" + done + ''; } diff --git a/tests/modules/programs/btop/empty-settings.nix b/tests/modules/programs/btop/empty-settings.nix index 21aad857d..1fcab6339 100644 --- a/tests/modules/programs/btop/empty-settings.nix +++ b/tests/modules/programs/btop/empty-settings.nix @@ -1,10 +1,6 @@ -{ ... }: - { programs.btop.enable = true; - test.stubs.btop = { }; - nmt.script = '' assertPathNotExists home-files/.config/btop ''; diff --git a/tests/modules/programs/carapace/bash.nix b/tests/modules/programs/carapace/bash.nix index 7377df3c3..bfcd9a2f0 100644 --- a/tests/modules/programs/carapace/bash.nix +++ b/tests/modules/programs/carapace/bash.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { carapace.enable = true; @@ -9,6 +7,6 @@ nmt.script = '' assertFileExists home-files/.bashrc assertFileRegex home-files/.bashrc \ - 'source <(/nix/store/.*carapace.*/bin/carapace _carapace bash)' + 'source <(@carapace@/bin/carapace _carapace bash)' ''; } diff --git a/tests/modules/programs/carapace/fish.nix b/tests/modules/programs/carapace/fish.nix index 6b71cef5a..f0a281d38 100644 --- a/tests/modules/programs/carapace/fish.nix +++ b/tests/modules/programs/carapace/fish.nix @@ -1,11 +1,13 @@ -{ ... }: +{ config, lib, realPkgs, ... }: -{ +lib.mkIf config.test.enableBig { programs = { carapace.enable = true; fish.enable = true; }; + nixpkgs.overlays = [ (self: super: { inherit (realPkgs) carapace; }) ]; + nmt.script = '' assertFileExists home-files/.config/fish/config.fish assertFileRegex home-files/.config/fish/config.fish \ diff --git a/tests/modules/programs/carapace/zsh.nix b/tests/modules/programs/carapace/zsh.nix index 5ab4fe8a1..a10fd2533 100644 --- a/tests/modules/programs/carapace/zsh.nix +++ b/tests/modules/programs/carapace/zsh.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { carapace.enable = true; @@ -9,6 +7,6 @@ nmt.script = '' assertFileExists home-files/.zshrc assertFileRegex home-files/.zshrc \ - 'source <(/nix/store/.*carapace.*/bin/carapace _carapace zsh)' + 'source <(@carapace@/bin/carapace _carapace zsh)' ''; } diff --git a/tests/modules/programs/cmus/cmus.nix b/tests/modules/programs/cmus/cmus.nix index 303bad767..8feb087cb 100644 --- a/tests/modules/programs/cmus/cmus.nix +++ b/tests/modules/programs/cmus/cmus.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.cmus = { enable = true; @@ -7,8 +5,6 @@ extraConfig = "test"; }; - test.stubs.cmus = { }; - nmt.script = '' assertFileContent \ home-files/.config/cmus/rc \ diff --git a/tests/modules/programs/comodoro/comodoro.nix b/tests/modules/programs/comodoro/comodoro.nix index 37f43b448..bd7d924dd 100644 --- a/tests/modules/programs/comodoro/comodoro.nix +++ b/tests/modules/programs/comodoro/comodoro.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.comodoro = { enable = true; @@ -26,8 +24,6 @@ }; }; - test.stubs.comodoro = { }; - nmt.script = '' assertFileExists home-files/.config/comodoro/config.toml assertFileContent home-files/.config/comodoro/config.toml ${./expected.toml} diff --git a/tests/modules/programs/direnv/bash.nix b/tests/modules/programs/direnv/bash.nix index db0d6b391..7feb65cc1 100644 --- a/tests/modules/programs/direnv/bash.nix +++ b/tests/modules/programs/direnv/bash.nix @@ -1,17 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.bash.enable = true; - programs.direnv.enable = true; + programs.bash.enable = true; + programs.direnv.enable = true; - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileRegex \ - home-files/.bashrc \ - 'eval "\$(/nix/store/.*direnv.*/bin/direnv hook bash)"' - ''; - }; + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileRegex \ + home-files/.bashrc \ + 'eval "\$(@direnv@/bin/direnv hook bash)"' + ''; } diff --git a/tests/modules/programs/direnv/nix-direnv.nix b/tests/modules/programs/direnv/nix-direnv.nix index 588cd6ed6..5b83647fd 100644 --- a/tests/modules/programs/direnv/nix-direnv.nix +++ b/tests/modules/programs/direnv/nix-direnv.nix @@ -1,16 +1,14 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ realPkgs, ... }: { - config = { - programs.bash.enable = true; - programs.direnv.enable = true; - programs.direnv.nix-direnv.enable = true; + programs.bash.enable = true; + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileExists home-files/.config/direnv/lib/hm-nix-direnv.sh - ''; - }; + nixpkgs.overlays = [ (_: _: { inherit (realPkgs) nix-direnv; }) ]; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileExists home-files/.config/direnv/lib/hm-nix-direnv.sh + ''; } diff --git a/tests/modules/programs/direnv/nushell.nix b/tests/modules/programs/direnv/nushell.nix index 502b325d5..6bc2fba7d 100644 --- a/tests/modules/programs/direnv/nushell.nix +++ b/tests/modules/programs/direnv/nushell.nix @@ -4,8 +4,6 @@ programs.nushell.enable = true; programs.direnv.enable = true; - test.stubs.nushell = { }; - nmt.script = let configFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then "home-files/Library/Application Support/nushell/config.nu" @@ -13,6 +11,6 @@ "home-files/.config/nushell/config.nu"; in '' assertFileExists "${configFile}" - assertFileRegex "${configFile}" '/nix/store/.*direnv.*/bin/direnv export json' + assertFileRegex "${configFile}" '@direnv@/bin/direnv export json' ''; } diff --git a/tests/modules/programs/direnv/stdlib-and-nix-direnv.nix b/tests/modules/programs/direnv/stdlib-and-nix-direnv.nix index 3bfd768c4..a712704f6 100644 --- a/tests/modules/programs/direnv/stdlib-and-nix-direnv.nix +++ b/tests/modules/programs/direnv/stdlib-and-nix-direnv.nix @@ -1,21 +1,19 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ realPkgs, ... }: let expectedContent = "something important"; in { - config = { - programs.bash.enable = true; - programs.direnv.enable = true; - programs.direnv.nix-direnv.enable = true; - programs.direnv.stdlib = expectedContent; + programs.bash.enable = true; + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; + programs.direnv.stdlib = expectedContent; - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileExists home-files/.config/direnv/lib/hm-nix-direnv.sh - assertFileRegex \ - home-files/.config/direnv/direnvrc \ - '${expectedContent}' - ''; - }; + nixpkgs.overlays = [ (_: _: { inherit (realPkgs) nix-direnv; }) ]; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileExists home-files/.config/direnv/lib/hm-nix-direnv.sh + assertFileRegex \ + home-files/.config/direnv/direnvrc \ + '${expectedContent}' + ''; } diff --git a/tests/modules/programs/direnv/stdlib.nix b/tests/modules/programs/direnv/stdlib.nix index 2a859132f..3f7a55e03 100644 --- a/tests/modules/programs/direnv/stdlib.nix +++ b/tests/modules/programs/direnv/stdlib.nix @@ -1,20 +1,14 @@ -{ config, lib, pkgs, ... }: - -with lib; - let expectedContent = "something important"; in { - config = { - programs.bash.enable = true; - programs.direnv.enable = true; - programs.direnv.stdlib = expectedContent; + programs.bash.enable = true; + programs.direnv.enable = true; + programs.direnv.stdlib = expectedContent; - nmt.script = '' - assertPathNotExists home-files/.config/direnv/lib/hm-nix-direnv.sh - assertFileExists home-files/.bashrc - assertFileRegex \ - home-files/.config/direnv/direnvrc \ - '${expectedContent}' - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/direnv/lib/hm-nix-direnv.sh + assertFileExists home-files/.bashrc + assertFileRegex \ + home-files/.config/direnv/direnvrc \ + '${expectedContent}' + ''; } diff --git a/tests/modules/programs/fastfetch/basic-configuration.nix b/tests/modules/programs/fastfetch/basic-configuration.nix index a0b6783a8..3e333b3f0 100644 --- a/tests/modules/programs/fastfetch/basic-configuration.nix +++ b/tests/modules/programs/fastfetch/basic-configuration.nix @@ -29,8 +29,6 @@ }; }; - test.stubs.fastfetch = { }; - nmt.script = let configFile = "home-files/.config/fastfetch/config.jsonc"; in '' assertFileExists "${configFile}" diff --git a/tests/modules/programs/fastfetch/default-configuration.nix b/tests/modules/programs/fastfetch/default-configuration.nix index 428081d4d..0fa35d7e7 100644 --- a/tests/modules/programs/fastfetch/default-configuration.nix +++ b/tests/modules/programs/fastfetch/default-configuration.nix @@ -1,8 +1,6 @@ { programs.fastfetch.enable = true; - test.stubs.fastfetch = { }; - nmt.script = '' assertPathNotExists "home-files/.config/fastfetch/config.jsonc" ''; diff --git a/tests/modules/programs/feh/feh-bindings.nix b/tests/modules/programs/feh/feh-bindings.nix index 787b02d7c..fc13d0e21 100644 --- a/tests/modules/programs/feh/feh-bindings.nix +++ b/tests/modules/programs/feh/feh-bindings.nix @@ -1,32 +1,26 @@ -{ pkgs, ... }: - { - config = { - programs.feh.enable = true; + programs.feh.enable = true; - programs.feh.buttons = { - zoom_in = null; - zoom_out = 4; - next_img = "C-4"; - prev_img = [ 3 "C-3" ]; - }; - - programs.feh.keybindings = { - zoom_in = null; - zoom_out = "minus"; - prev_img = [ "h" "Left" ]; - }; - - test.stubs.feh = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/feh/buttons \ - ${./feh-bindings-expected-buttons} - - assertFileContent \ - home-files/.config/feh/keys \ - ${./feh-bindings-expected-keys} - ''; + programs.feh.buttons = { + zoom_in = null; + zoom_out = 4; + next_img = "C-4"; + prev_img = [ 3 "C-3" ]; }; + + programs.feh.keybindings = { + zoom_in = null; + zoom_out = "minus"; + prev_img = [ "h" "Left" ]; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/feh/buttons \ + ${./feh-bindings-expected-buttons} + + assertFileContent \ + home-files/.config/feh/keys \ + ${./feh-bindings-expected-keys} + ''; } diff --git a/tests/modules/programs/feh/feh-empty-settings.nix b/tests/modules/programs/feh/feh-empty-settings.nix index 9a50e20bf..0c50e9ffb 100644 --- a/tests/modules/programs/feh/feh-empty-settings.nix +++ b/tests/modules/programs/feh/feh-empty-settings.nix @@ -1,15 +1,9 @@ -{ pkgs, ... }: - { - config = { - programs.feh.enable = true; + programs.feh.enable = true; - test.stubs.feh = { }; - - nmt.script = '' - assertPathNotExists home-files/.config/feh/buttons - assertPathNotExists home-files/.config/feh/keys - assertPathNotExists home-files/.config/feh/themes - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/feh/buttons + assertPathNotExists home-files/.config/feh/keys + assertPathNotExists home-files/.config/feh/themes + ''; } diff --git a/tests/modules/programs/feh/feh-themes.nix b/tests/modules/programs/feh/feh-themes.nix index f06ea0716..398277d6d 100644 --- a/tests/modules/programs/feh/feh-themes.nix +++ b/tests/modules/programs/feh/feh-themes.nix @@ -1,32 +1,26 @@ -{ pkgs, ... }: - { - config = { - programs.feh.enable = true; + programs.feh.enable = true; - programs.feh.themes = { - feh = [ "--image-bg" "black" ]; - webcam = [ "--multiwindow" "--reload" "20" ]; - present = [ "--full-screen" "--sort" "name" "--hide-pointer" ]; - booth = [ "--full-screen" "--hide-pointer" "--slideshow-delay" "20" ]; - imagemap = [ - "-rVq" - "--thumb-width" - "40" - "--thumb-height" - "30" - "--index-info" - "%n\\n%wx%h" - ]; - example = [ "--info" "foo bar" ]; - }; - - test.stubs.feh = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/feh/themes \ - ${./feh-themes-expected} - ''; + programs.feh.themes = { + feh = [ "--image-bg" "black" ]; + webcam = [ "--multiwindow" "--reload" "20" ]; + present = [ "--full-screen" "--sort" "name" "--hide-pointer" ]; + booth = [ "--full-screen" "--hide-pointer" "--slideshow-delay" "20" ]; + imagemap = [ + "-rVq" + "--thumb-width" + "40" + "--thumb-height" + "30" + "--index-info" + "%n\\n%wx%h" + ]; + example = [ "--info" "foo bar" ]; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/feh/themes \ + ${./feh-themes-expected} + ''; } diff --git a/tests/modules/programs/firefox/final-package.nix b/tests/modules/programs/firefox/final-package.nix index ec310ee33..277b3e105 100644 --- a/tests/modules/programs/firefox/final-package.nix +++ b/tests/modules/programs/firefox/final-package.nix @@ -1,25 +1,21 @@ modulePath: -{ config, lib, pkgs, ... }: +{ config, lib, realPkgs, ... }: let cfg = lib.getAttrFromPath modulePath config; - firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath; +in lib.mkIf config.test.enableBig +(lib.setAttrByPath modulePath { enable = true; } // { + home.stateVersion = "19.09"; -in { - imports = [ firefoxMockOverlay ]; + _module.args.pkgs = lib.mkForce realPkgs; - config = lib.mkIf config.test.enableBig - (lib.setAttrByPath modulePath { enable = true; } // { - home.stateVersion = "19.09"; - - nmt.script = '' - package=${cfg.package} - finalPackage=${cfg.finalPackage} - if [[ $package != $finalPackage ]]; then - fail "Expected finalPackage ($finalPackage) to equal package ($package)" - fi - ''; - }); -} + nmt.script = '' + package=${cfg.package} + finalPackage=${cfg.finalPackage} + if [[ $package != $finalPackage ]]; then + fail "Expected finalPackage ($finalPackage) to equal package ($package)" + fi + ''; +}) diff --git a/tests/modules/programs/firefox/setup-firefox-mock-overlay.nix b/tests/modules/programs/firefox/setup-firefox-mock-overlay.nix index ecbd492fa..736eff7ca 100644 --- a/tests/modules/programs/firefox/setup-firefox-mock-overlay.nix +++ b/tests/modules/programs/firefox/setup-firefox-mock-overlay.nix @@ -1,30 +1,36 @@ modulePath: -{ config, lib, pkgs, ... }: - -with lib; +{ config, lib, realPkgs, ... }: let - cfg = getAttrFromPath modulePath config; + cfg = lib.getAttrFromPath modulePath config; in { - nixpkgs.overlays = [ - (self: super: { - "${cfg.wrappedPackageName}-unwrapped" = - pkgs.runCommandLocal "${cfg.wrappedPackageName}-0" { - meta.description = "I pretend to be ${cfg.name}"; - passthru.gtk3 = null; - } '' - mkdir -p "$out"/{bin,lib} - touch "$out/bin/${cfg.wrappedPackageName}" - chmod 755 "$out/bin/${cfg.wrappedPackageName}" - ''; + test.stubs = let unwrappedName = "${cfg.wrappedPackageName}-unwrapped"; + in { + "${unwrappedName}" = { + name = unwrappedName; + extraAttrs = { + binaryName = cfg.wrappedPackageName; + gtk3 = null; + meta.description = "I pretend to be ${cfg.name}"; + }; + outPath = null; + buildScript = '' + echo BUILD + mkdir -p "$out"/{bin,lib} + touch "$out/bin/${cfg.wrappedPackageName}" + chmod 755 "$out/bin/${cfg.wrappedPackageName}" + ''; + }; - chrome-gnome-shell = - pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } '' - mkdir -p $out/lib/mozilla/native-messaging-hosts - touch $out/lib/mozilla/native-messaging-hosts/dummy - ''; - }) - ]; + chrome-gnome-shell = { + buildScript = '' + mkdir -p $out/lib/mozilla/native-messaging-hosts + touch $out/lib/mozilla/native-messaging-hosts/dummy + ''; + }; + }; + + nixpkgs.overlays = [ (_: _: { inherit (realPkgs) mozlz4a; }) ]; } diff --git a/tests/modules/programs/foot/empty-settings.nix b/tests/modules/programs/foot/empty-settings.nix index 26b82e7fb..f156dae2e 100644 --- a/tests/modules/programs/foot/empty-settings.nix +++ b/tests/modules/programs/foot/empty-settings.nix @@ -1,15 +1,7 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.foot.enable = true; + programs.foot.enable = true; - test.stubs.foot = { }; - - nmt.script = '' - assertPathNotExists home-files/.config/foot - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/foot + ''; } diff --git a/tests/modules/programs/foot/example-settings.nix b/tests/modules/programs/foot/example-settings.nix index 8390305ea..392b916e6 100644 --- a/tests/modules/programs/foot/example-settings.nix +++ b/tests/modules/programs/foot/example-settings.nix @@ -1,29 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs.foot = { - enable = true; - package = config.lib.test.mkStubPackage { }; + programs.foot = { + enable = true; + package = config.lib.test.mkStubPackage { }; - settings = { - main = { - term = "xterm-256color"; + settings = { + main = { + term = "xterm-256color"; - font = "Fira Code:size=11"; - dpi-aware = "yes"; - }; - - mouse = { hide-when-typing = "yes"; }; + font = "Fira Code:size=11"; + dpi-aware = "yes"; }; - }; - nmt.script = '' - assertFileContent \ - home-files/.config/foot/foot.ini \ - ${./example-settings-expected.ini} - ''; + mouse = { hide-when-typing = "yes"; }; + }; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/foot/foot.ini \ + ${./example-settings-expected.ini} + ''; } diff --git a/tests/modules/programs/foot/systemd-user-service.nix b/tests/modules/programs/foot/systemd-user-service.nix index 5ebd90675..c313c0f20 100644 --- a/tests/modules/programs/foot/systemd-user-service.nix +++ b/tests/modules/programs/foot/systemd-user-service.nix @@ -1,19 +1,14 @@ -{ config, lib, pkgs, ... }: - { - config = { - programs.foot = { - package = config.lib.test.mkStubPackage { outPath = "@foot@"; }; - enable = true; - server.enable = true; - }; - - nmt.script = '' - assertPathNotExists home-files/.config/foot/foot.ini - - assertFileContent \ - home-files/.config/systemd/user/foot.service \ - ${./systemd-user-service-expected.service} - ''; + programs.foot = { + enable = true; + server.enable = true; }; + + nmt.script = '' + assertPathNotExists home-files/.config/foot/foot.ini + + assertFileContent \ + home-files/.config/systemd/user/foot.service \ + ${./systemd-user-service-expected.service} + ''; } diff --git a/tests/modules/programs/freetube/basic-configuration.nix b/tests/modules/programs/freetube/basic-configuration.nix index a30d3bed4..dd3cdaf13 100644 --- a/tests/modules/programs/freetube/basic-configuration.nix +++ b/tests/modules/programs/freetube/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { programs.freetube = { enable = true; @@ -17,8 +15,6 @@ }; }; - test.stubs.freetube = { }; - nmt.script = '' assertFileExists home-files/.config/FreeTube/hm_settings.db assertFileContent home-files/.config/FreeTube/hm_settings.db \ diff --git a/tests/modules/programs/fuzzel/empty-settings.nix b/tests/modules/programs/fuzzel/empty-settings.nix index e14aad4f5..74e275ff3 100644 --- a/tests/modules/programs/fuzzel/empty-settings.nix +++ b/tests/modules/programs/fuzzel/empty-settings.nix @@ -1,10 +1,6 @@ -{ ... }: - { programs.fuzzel.enable = true; - test.stubs.fuzzel = { }; - nmt.script = '' assertPathNotExists home-files/.config/fuzzel ''; diff --git a/tests/modules/programs/gallery-dl/gallery-dl.nix b/tests/modules/programs/gallery-dl/gallery-dl.nix index 2cc94e1e0..fdfa3395a 100644 --- a/tests/modules/programs/gallery-dl/gallery-dl.nix +++ b/tests/modules/programs/gallery-dl/gallery-dl.nix @@ -12,8 +12,6 @@ }; }; - test.stubs.gallery-dl = { }; - nmt.script = '' assertFileContent home-files/.config/gallery-dl/config.json \ ${builtins.toFile "gallery-dl-expected-settings.json" '' diff --git a/tests/modules/programs/gh-dash/config.nix b/tests/modules/programs/gh-dash/config.nix index 9972d6738..cb07d13aa 100644 --- a/tests/modules/programs/gh-dash/config.nix +++ b/tests/modules/programs/gh-dash/config.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.gh-dash = { enable = true; @@ -11,8 +9,6 @@ }; }; - test.stubs.gh = { }; - nmt.script = '' assertFileExists home-files/.config/gh-dash/config.yml assertFileContent home-files/.config/gh-dash/config.yml ${ diff --git a/tests/modules/programs/gh/config-file.nix b/tests/modules/programs/gh/config-file.nix index e7c17d5d9..b23c92d62 100644 --- a/tests/modules/programs/gh/config-file.nix +++ b/tests/modules/programs/gh/config-file.nix @@ -1,26 +1,20 @@ -{ config, lib, pkgs, ... }: - { - config = { - programs.gh = { - enable = true; - settings.aliases = { co = "pr checkout"; }; - settings.editor = "vim"; - }; - - test.stubs.gh = { }; - - nmt.script = '' - assertFileExists home-files/.config/gh/config.yml - assertFileContent home-files/.config/gh/config.yml ${ - builtins.toFile "config-file.yml" '' - aliases: - co: pr checkout - editor: vim - git_protocol: https - version: '1' - '' - } - ''; + programs.gh = { + enable = true; + settings.aliases = { co = "pr checkout"; }; + settings.editor = "vim"; }; + + nmt.script = '' + assertFileExists home-files/.config/gh/config.yml + assertFileContent home-files/.config/gh/config.yml ${ + builtins.toFile "config-file.yml" '' + aliases: + co: pr checkout + editor: vim + git_protocol: https + version: '1' + '' + } + ''; } diff --git a/tests/modules/programs/gh/credential-helper.nix b/tests/modules/programs/gh/credential-helper.nix index 771572318..547ad446a 100644 --- a/tests/modules/programs/gh/credential-helper.nix +++ b/tests/modules/programs/gh/credential-helper.nix @@ -1,5 +1,3 @@ -{ config, lib, pkgs, ... }: - { programs.gh = { enable = true; @@ -11,8 +9,6 @@ programs.git.enable = true; - test.stubs.gh = { }; - nmt.script = '' assertFileExists home-files/.config/git/config assertFileContent home-files/.config/git/config \ diff --git a/tests/modules/programs/gh/extensions.nix b/tests/modules/programs/gh/extensions.nix index c8824ed09..4426e2a9b 100644 --- a/tests/modules/programs/gh/extensions.nix +++ b/tests/modules/programs/gh/extensions.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ pkgs, ... }: { programs.gh = { @@ -7,7 +7,6 @@ }; test.stubs = { - gh = { }; gh-eco = { name = "gh-eco"; buildScript = '' diff --git a/tests/modules/programs/gh/warnings.nix b/tests/modules/programs/gh/warnings.nix index bf7e5df8e..6a4a9361c 100644 --- a/tests/modules/programs/gh/warnings.nix +++ b/tests/modules/programs/gh/warnings.nix @@ -1,36 +1,32 @@ -{ config, options, lib, pkgs, ... }: +{ options, lib, ... }: { - config = { - programs.gh = { - enable = true; - aliases = { co = "pr checkout"; }; - editor = "vim"; - }; - - test.stubs.gh = { }; - - test.asserts.warnings.expected = [ - "The option `programs.gh.editor' defined in ${ - lib.showFiles options.programs.gh.editor.files - } has been renamed to `programs.gh.settings.editor'." - "The option `programs.gh.aliases' defined in ${ - lib.showFiles options.programs.gh.aliases.files - } has been renamed to `programs.gh.settings.aliases'." - ]; - test.asserts.warnings.enable = true; - - nmt.script = '' - assertFileExists home-files/.config/gh/config.yml - assertFileContent home-files/.config/gh/config.yml ${ - builtins.toFile "config-file.yml" '' - aliases: - co: pr checkout - editor: vim - git_protocol: https - version: '1' - '' - } - ''; + programs.gh = { + enable = true; + aliases = { co = "pr checkout"; }; + editor = "vim"; }; + + test.asserts.warnings.expected = [ + "The option `programs.gh.editor' defined in ${ + lib.showFiles options.programs.gh.editor.files + } has been renamed to `programs.gh.settings.editor'." + "The option `programs.gh.aliases' defined in ${ + lib.showFiles options.programs.gh.aliases.files + } has been renamed to `programs.gh.settings.aliases'." + ]; + test.asserts.warnings.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/gh/config.yml + assertFileContent home-files/.config/gh/config.yml ${ + builtins.toFile "config-file.yml" '' + aliases: + co: pr checkout + editor: vim + git_protocol: https + version: '1' + '' + } + ''; } diff --git a/tests/modules/programs/ghostty/empty-settings.nix b/tests/modules/programs/ghostty/empty-settings.nix index 4e5e83e8d..1ea025eb5 100644 --- a/tests/modules/programs/ghostty/empty-settings.nix +++ b/tests/modules/programs/ghostty/empty-settings.nix @@ -1,6 +1,6 @@ { programs.ghostty.enable = true; - test.stubs.ghostty = { }; + nmt.script = '' assertPathNotExists home-files/.config/ghostty/config ''; diff --git a/tests/modules/programs/ghostty/example-theme.nix b/tests/modules/programs/ghostty/example-theme.nix index b4d211595..29f40a897 100644 --- a/tests/modules/programs/ghostty/example-theme.nix +++ b/tests/modules/programs/ghostty/example-theme.nix @@ -1,7 +1,6 @@ -{ config, ... }: { +{ programs.ghostty = { enable = true; - package = config.lib.test.mkStubPackage { }; themes = { catppuccin-mocha = { diff --git a/tests/modules/programs/git-cliff/example-settings.nix b/tests/modules/programs/git-cliff/example-settings.nix index 5c865d48e..c0330b3da 100644 --- a/tests/modules/programs/git-cliff/example-settings.nix +++ b/tests/modules/programs/git-cliff/example-settings.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { programs.git-cliff = { enable = true; @@ -13,8 +9,6 @@ with lib; }; }; - test.stubs.git-cliff = { }; - nmt.script = '' assertFileContent \ home-files/.config/git-cliff/cliff.toml \ diff --git a/tests/modules/programs/git-credential-oauth/basic.nix b/tests/modules/programs/git-credential-oauth/basic.nix index 741adfbfb..2e82c8303 100644 --- a/tests/modules/programs/git-credential-oauth/basic.nix +++ b/tests/modules/programs/git-credential-oauth/basic.nix @@ -1,12 +1,10 @@ -{ config, pkgs, ... }: +{ config, ... }: { programs.git-credential-oauth = { enable = true; }; programs.git = { enable = true; }; - test.stubs.git-credential-oauth = { }; - nmt.script = '' assertFileExists home-files/.config/git/config assertFileContains \ diff --git a/tests/modules/programs/git-credential-oauth/extra-flags.nix b/tests/modules/programs/git-credential-oauth/extra-flags.nix index 7a586ede6..e258512a7 100644 --- a/tests/modules/programs/git-credential-oauth/extra-flags.nix +++ b/tests/modules/programs/git-credential-oauth/extra-flags.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, ... }: { programs.git-credential-oauth = { @@ -8,8 +8,6 @@ programs.git = { enable = true; }; - test.stubs.git-credential-oauth = { }; - nmt.script = '' assertFileExists home-files/.config/git/config assertFileContains \ diff --git a/tests/modules/programs/git/git-with-email.nix b/tests/modules/programs/git/git-with-email.nix index 0999eaa87..db6053a53 100644 --- a/tests/modules/programs/git/git-with-email.nix +++ b/tests/modules/programs/git/git-with-email.nix @@ -1,40 +1,36 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ realPkgs, ... }: { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts.hm-account.smtp.tls.certificatesFile = - "/etc/test/certificates.crt"; - programs.git = { - enable = true; - package = pkgs.gitMinimal; - userEmail = "hm@example.com"; - userName = "H. M. Test"; - }; + accounts.email.accounts.hm-account.smtp.tls.certificatesFile = + "/etc/test/certificates.crt"; - home.stateVersion = "20.09"; - - nmt.script = '' - function assertGitConfig() { - local value - value=$(${pkgs.gitMinimal}/bin/git config \ - --file $TESTED/home-files/.config/git/config \ - --get $1) - if [[ $value != $2 ]]; then - fail "Expected option '$1' to have value '$2' but it was '$value'" - fi - } - - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-with-email-expected.conf - } - - assertGitConfig "sendemail.hm@example.com.from" "H. M. Test " - assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. " - ''; + programs.git = { + enable = true; + userEmail = "hm@example.com"; + userName = "H. M. Test"; }; + + home.stateVersion = "20.09"; + + nmt.script = '' + function assertGitConfig() { + local value + value=$(${realPkgs.gitMinimal}/bin/git config \ + --file $TESTED/home-files/.config/git/config \ + --get $1) + if [[ $value != $2 ]]; then + fail "Expected option '$1' to have value '$2' but it was '$value'" + fi + } + + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config ${ + ./git-with-email-expected.conf + } + + assertGitConfig "sendemail.hm@example.com.from" "H. M. Test " + assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. " + ''; } diff --git a/tests/modules/programs/git/git-with-hooks.nix b/tests/modules/programs/git/git-with-hooks.nix index 83f1059bc..6dcf15e21 100644 --- a/tests/modules/programs/git/git-with-hooks.nix +++ b/tests/modules/programs/git/git-with-hooks.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ realPkgs, ... }: { programs.git = { @@ -8,7 +8,7 @@ nmt.script = '' function getGitConfig() { - ${pkgs.gitMinimal}/bin/git config \ + ${realPkgs.gitMinimal}/bin/git config \ --file $TESTED/home-files/.config/git/config \ --get $1 } diff --git a/tests/modules/programs/git/git-with-msmtp.nix b/tests/modules/programs/git/git-with-msmtp.nix index 80e082c97..917955130 100644 --- a/tests/modules/programs/git/git-with-msmtp.nix +++ b/tests/modules/programs/git/git-with-msmtp.nix @@ -1,43 +1,36 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, realPkgs, ... }: { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts."hm@example.com".msmtp.enable = true; + accounts.email.accounts."hm@example.com".msmtp.enable = true; - programs.git = { - enable = true; - package = pkgs.gitMinimal; - userEmail = "hm@example.com"; - userName = "H. M. Test"; - }; - - home.stateVersion = "20.09"; - - test.stubs.msmtp = { }; - - nmt.script = '' - function assertGitConfig() { - local value - value=$(${pkgs.gitMinimal}/bin/git config \ - --file $TESTED/home-files/.config/git/config \ - --get $1) - if [[ $value != $2 ]]; then - fail "Expected option '$1' to have value '$2' but it was '$value'" - fi - } - - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config \ - ${./git-with-msmtp-expected.conf} - - assertGitConfig "sendemail.hm@example.com.from" "H. M. Test " - assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. " - assertGitConfig "sendemail.hm@example.com.smtpServer" "${pkgs.msmtp}/bin/msmtp" - assertGitConfig "sendemail.hm@example.com.envelopeSender" "auto" - ''; + programs.git = { + enable = true; + userEmail = "hm@example.com"; + userName = "H. M. Test"; }; + + home.stateVersion = "20.09"; + + nmt.script = '' + function assertGitConfig() { + local value + value=$(${realPkgs.gitMinimal}/bin/git config \ + --file $TESTED/home-files/.config/git/config \ + --get $1) + if [[ $value != $2 ]]; then + fail "Expected option '$1' to have value '$2' but it was '$value'" + fi + } + + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config \ + ${./git-with-msmtp-expected.conf} + + assertGitConfig "sendemail.hm@example.com.from" "H. M. Test " + assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. " + assertGitConfig "sendemail.hm@example.com.smtpServer" "${pkgs.msmtp}/bin/msmtp" + assertGitConfig "sendemail.hm@example.com.envelopeSender" "auto" + ''; } diff --git a/tests/modules/programs/git/git-with-signing-key-id.nix b/tests/modules/programs/git/git-with-signing-key-id.nix index 8d182505f..a6386e347 100644 --- a/tests/modules/programs/git/git-with-signing-key-id.nix +++ b/tests/modules/programs/git/git-with-signing-key-id.nix @@ -1,22 +1,20 @@ -{ pkgs, ... }: { - config = { - programs.git = { - enable = true; - userName = "John Doe"; - userEmail = "user@example.org"; +{ + programs.git = { + enable = true; + userName = "John Doe"; + userEmail = "user@example.org"; - signing = { - gpgPath = "path-to-gpg"; - key = "00112233445566778899AABBCCDDEEFF"; - signByDefault = true; - }; + signing = { + gpgPath = "path-to-gpg"; + key = "00112233445566778899AABBCCDDEEFF"; + signByDefault = true; }; - - nmt.script = '' - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-with-signing-key-id-expected.conf - } - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config ${ + ./git-with-signing-key-id-expected.conf + } + ''; } diff --git a/tests/modules/programs/git/git-with-str-extra-config.nix b/tests/modules/programs/git/git-with-str-extra-config.nix index b2294c65b..d9bd7e572 100644 --- a/tests/modules/programs/git/git-with-str-extra-config.nix +++ b/tests/modules/programs/git/git-with-str-extra-config.nix @@ -1,29 +1,22 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.git = { - enable = true; - package = pkgs.gitMinimal; - extraConfig = '' - This can be anything. - ''; - userEmail = "user@example.org"; - userName = "John Doe"; - }; - - test.asserts.warnings.expected = ['' - Using programs.git.extraConfig as a string option is - deprecated and will be removed in the future. Please - change to using it as an attribute set instead. - '']; - - nmt.script = '' - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config \ - ${./git-with-str-extra-config-expected.conf} + programs.git = { + enable = true; + extraConfig = '' + This can be anything. ''; + userEmail = "user@example.org"; + userName = "John Doe"; }; + + test.asserts.warnings.expected = ['' + Using programs.git.extraConfig as a string option is + deprecated and will be removed in the future. Please + change to using it as an attribute set instead. + '']; + + nmt.script = '' + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config \ + ${./git-with-str-extra-config-expected.conf} + ''; } diff --git a/tests/modules/programs/git/git-without-signing-key-id.nix b/tests/modules/programs/git/git-without-signing-key-id.nix index 3428c40d7..a06cb692e 100644 --- a/tests/modules/programs/git/git-without-signing-key-id.nix +++ b/tests/modules/programs/git/git-without-signing-key-id.nix @@ -1,22 +1,20 @@ -{ pkgs, ... }: { - config = { - programs.git = { - enable = true; - userName = "John Doe"; - userEmail = "user@example.org"; +{ + programs.git = { + enable = true; + userName = "John Doe"; + userEmail = "user@example.org"; - signing = { - gpgPath = "path-to-gpg"; - key = null; - signByDefault = true; - }; + signing = { + gpgPath = "path-to-gpg"; + key = null; + signByDefault = true; }; - - nmt.script = '' - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-without-signing-key-id-expected.conf - } - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config ${ + ./git-without-signing-key-id-expected.conf + } + ''; } diff --git a/tests/modules/programs/git/git.nix b/tests/modules/programs/git/git.nix index fb949be00..51ed97180 100644 --- a/tests/modules/programs/git/git.nix +++ b/tests/modules/programs/git/git.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ lib, pkgs, ... }: let @@ -21,81 +19,74 @@ let }; in { - config = { - programs.git = mkMerge [ - { + programs.git = lib.mkMerge [ + { + enable = true; + package = pkgs.gitMinimal; + aliases = { + a1 = "foo"; + a2 = "bar"; + escapes = ''"\n ''; + }; + extraConfig = { + extra = { + name = "value"; + multiple = [ 1 ]; + }; + }; + ignores = [ "*~" "*.swp" ]; + includes = [ + { path = "~/path/to/config.inc"; } + { + path = "~/path/to/conditional.inc"; + condition = "gitdir:~/src/dir"; + } + { + condition = "gitdir:~/src/dir"; + contents = gitInclude; + } + { + condition = "gitdir:~/src/otherproject"; + contents = gitInclude; + contentSuffix = "gitconfig-work"; + } + ]; + signing = { + gpgPath = "path-to-gpg"; + key = "00112233445566778899AABBCCDDEEFF"; + signByDefault = true; + }; + userEmail = "user@example.org"; + userName = "John Doe"; + lfs.enable = true; + delta = { enable = true; - package = pkgs.gitMinimal; - aliases = { - a1 = "foo"; - a2 = "bar"; - escapes = ''"\n ''; - }; - extraConfig = { - extra = { - name = "value"; - multiple = [ 1 ]; + options = { + features = "decorations"; + whitespace-error-style = "22 reverse"; + decorations = { + commit-decoration-style = "bold yellow box ul"; + file-style = "bold yellow ul"; + file-decoration-style = "none"; }; }; - ignores = [ "*~" "*.swp" ]; - includes = [ - { path = "~/path/to/config.inc"; } - { - path = "~/path/to/conditional.inc"; - condition = "gitdir:~/src/dir"; - } - { - condition = "gitdir:~/src/dir"; - contents = gitInclude; - } - { - condition = "gitdir:~/src/otherproject"; - contents = gitInclude; - contentSuffix = "gitconfig-work"; - } - ]; - signing = { - gpgPath = "path-to-gpg"; - key = "00112233445566778899AABBCCDDEEFF"; - signByDefault = true; - }; - userEmail = "user@example.org"; - userName = "John Doe"; - lfs.enable = true; - delta = { - enable = true; - options = { - features = "decorations"; - whitespace-error-style = "22 reverse"; - decorations = { - commit-decoration-style = "bold yellow box ul"; - file-style = "bold yellow ul"; - file-decoration-style = "none"; - }; - }; - }; - } + }; + } - { - aliases.a2 = mkForce "baz"; - extraConfig."extra \"backcompat.with.dots\"".previously = "worked"; - extraConfig.extra.boolean = true; - extraConfig.extra.integer = 38; - extraConfig.extra.multiple = [ 2 ]; - extraConfig.extra.subsection.value = "test"; - } - ]; + { + aliases.a2 = lib.mkForce "baz"; + extraConfig."extra \"backcompat.with.dots\"".previously = "worked"; + extraConfig.extra.boolean = true; + extraConfig.extra.integer = 38; + extraConfig.extra.multiple = [ 2 ]; + extraConfig.extra.subsection.value = "test"; + } + ]; - test.stubs = { - git-lfs = { }; - delta = { }; - }; - - nmt.script = '' - assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - substituteExpected ./git-expected.conf - } - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config ${ + substituteExpected ./git-expected.conf + } + ''; } diff --git a/tests/modules/programs/gnome-shell/gnome-shell.nix b/tests/modules/programs/gnome-shell/gnome-shell.nix index 6c3eb6bca..b9cc327d9 100644 --- a/tests/modules/programs/gnome-shell/gnome-shell.nix +++ b/tests/modules/programs/gnome-shell/gnome-shell.nix @@ -79,8 +79,6 @@ in { } ]; - test.stubs.dconf = { }; - nmt.script = '' assertFileExists home-path/share/gnome-shell/extensions/dummy-package/test assertFileExists home-path/share/gnome-shell/extensions/test-extension/test diff --git a/tests/modules/programs/gnome-terminal/bad-profile-name.nix b/tests/modules/programs/gnome-terminal/bad-profile-name.nix index 308b9306e..91554909f 100644 --- a/tests/modules/programs/gnome-terminal/bad-profile-name.nix +++ b/tests/modules/programs/gnome-terminal/bad-profile-name.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { programs.gnome-terminal = { enable = true; @@ -13,11 +11,6 @@ }; }; - nixpkgs.overlays = - [ (self: super: { gnome-terminal = config.lib.test.mkStubPackage { }; }) ]; - - test.stubs.dconf = { }; - test.asserts.assertions.expected = ['' The attribute name of a Gnome Terminal profile must be a UUID. Incorrect profile names: another-bad-name, bad-name'']; diff --git a/tests/modules/programs/gnome-terminal/gnome-terminal-1.nix b/tests/modules/programs/gnome-terminal/gnome-terminal-1.nix index 6dab6a2b4..3c0a786ab 100644 --- a/tests/modules/programs/gnome-terminal/gnome-terminal-1.nix +++ b/tests/modules/programs/gnome-terminal/gnome-terminal-1.nix @@ -1,62 +1,50 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.gnome-terminal = { - enable = true; - profile = { - "e0b782ed-6aca-44eb-8c75-62b3706b6220" = { - allowBold = true; - audibleBell = true; - backspaceBinding = "ascii-delete"; - boldIsBright = true; - colors = { - backgroundColor = "#2E3436"; - foregroundColor = "#D3D7C1"; - palette = [ - "#000000" - "#AA0000" - "#00AA00" - "#AA5500" - "#0000AA" - "#AA00AA" - "#00AAAA" - "#AAAAAA" - "#555555" - "#FF5555" - "#55FF55" - "#FFFF55" - "#5555FF" - "#FF55FF" - "#55FFFF" - "#FFFFFF" - ]; - }; - cursorBlinkMode = "off"; - cursorShape = "underline"; - default = true; - deleteBinding = "delete-sequence"; - scrollbackLines = 1000000; - scrollOnOutput = false; - showScrollbar = false; - transparencyPercent = 5; - visibleName = "kamadorueda"; + programs.gnome-terminal = { + enable = true; + profile = { + "e0b782ed-6aca-44eb-8c75-62b3706b6220" = { + allowBold = true; + audibleBell = true; + backspaceBinding = "ascii-delete"; + boldIsBright = true; + colors = { + backgroundColor = "#2E3436"; + foregroundColor = "#D3D7C1"; + palette = [ + "#000000" + "#AA0000" + "#00AA00" + "#AA5500" + "#0000AA" + "#AA00AA" + "#00AAAA" + "#AAAAAA" + "#555555" + "#FF5555" + "#55FF55" + "#FFFF55" + "#5555FF" + "#FF55FF" + "#55FFFF" + "#FFFFFF" + ]; }; + cursorBlinkMode = "off"; + cursorShape = "underline"; + default = true; + deleteBinding = "delete-sequence"; + scrollbackLines = 1000000; + scrollOnOutput = false; + showScrollbar = false; + transparencyPercent = 5; + visibleName = "kamadorueda"; }; - showMenubar = false; }; - - nixpkgs.overlays = [ - (self: super: { gnome-terminal = config.lib.test.mkStubPackage { }; }) - ]; - - test.stubs.dconf = { }; - - nmt.script = '' - dconfIni=$(grep -oPm 1 '/nix/store/[a-z0-9]*?-hm-dconf.ini' $TESTED/activate) - assertFileContent $dconfIni ${./gnome-terminal-1.conf} - ''; + showMenubar = false; }; + + nmt.script = '' + dconfIni=$(grep -oPm 1 '/nix/store/[a-z0-9]*?-hm-dconf.ini' $TESTED/activate) + assertFileContent $dconfIni ${./gnome-terminal-1.conf} + ''; } diff --git a/tests/modules/programs/go/go-telemetry.nix b/tests/modules/programs/go/go-telemetry.nix index 4ea06cbc8..b5fda3d3a 100644 --- a/tests/modules/programs/go/go-telemetry.nix +++ b/tests/modules/programs/go/go-telemetry.nix @@ -9,11 +9,6 @@ }; }; - test.stubs = { - go = { }; - systemd = { }; - }; - nm.script = let modeFileDir = if !pkgs.stdenv.isDarwin then ".config/go/telemetry" diff --git a/tests/modules/programs/gpg/immutable-keyfiles.nix b/tests/modules/programs/gpg/immutable-keyfiles.nix index b359d71e4..34ef9f0fe 100644 --- a/tests/modules/programs/gpg/immutable-keyfiles.nix +++ b/tests/modules/programs/gpg/immutable-keyfiles.nix @@ -1,15 +1,16 @@ -{ config, lib, pkgs, ... }: +{ realPkgs, ... }: { programs.gpg = { enable = true; + package = realPkgs.gnupg; mutableKeys = false; mutableTrust = false; publicKeys = [ { - source = pkgs.fetchurl { + source = realPkgs.fetchurl { url = "https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x44CF42371ADF842E12F116EAA9D3F98FCCF5460B"; hash = "sha256-bSluCZh6ijwppigk8iF2BwWKZgq1WDbIjyYQRK772dM="; @@ -17,7 +18,7 @@ trust = 1; # "unknown" } { - source = pkgs.fetchurl { + source = realPkgs.fetchurl { url = "https://www.rsync.net/resources/pubkey.txt"; sha256 = "16nzqfb1kvsxjkq919hxsawx6ydvip3md3qyhdmw54qx6drnxckl"; }; @@ -40,7 +41,7 @@ # Export Trust export WORKDIR=$(mktemp -d) - ${pkgs.gnupg}/bin/gpg -q --export-ownertrust > $WORKDIR/gpgtrust.txt + ${realPkgs.gnupg}/bin/gpg -q --export-ownertrust > $WORKDIR/gpgtrust.txt # Check Trust assertFileRegex $WORKDIR/gpgtrust.txt \ diff --git a/tests/modules/programs/gpg/mutable-keyfiles.nix b/tests/modules/programs/gpg/mutable-keyfiles.nix index 6ffcb7053..1c03c96bf 100644 --- a/tests/modules/programs/gpg/mutable-keyfiles.nix +++ b/tests/modules/programs/gpg/mutable-keyfiles.nix @@ -1,5 +1,3 @@ -{ config, lib, pkgs, ... }: - { programs.gpg = { enable = true; @@ -13,9 +11,6 @@ ]; }; - test.stubs.gnupg = { }; - test.stubs.systemd = { }; # depends on gnupg.override - nmt.script = '' assertFileContains activate "export GNUPGHOME=/home/hm-user/.gnupg" diff --git a/tests/modules/programs/gradle/alternate-home-settings.nix b/tests/modules/programs/gradle/alternate-home-settings.nix index dc885ab19..c278302ba 100644 --- a/tests/modules/programs/gradle/alternate-home-settings.nix +++ b/tests/modules/programs/gradle/alternate-home-settings.nix @@ -1,26 +1,20 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { - config = { - programs.gradle = { - enable = true; - home = ".gbt"; - settings = { "org.gradle.caching" = true; }; - initScripts = { "some-script.gradle".text = "println 'hello world'"; }; - }; - - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; - - test.stubs.gradle = { }; - - nmt.script = '' - assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ - 'export GRADLE_USER_HOME="/home/hm-user/.gbt"' - assertFileExists home-files/.gbt/gradle.properties - assertFileExists home-files/.gbt/init.d/some-script.gradle - ''; + programs.gradle = { + enable = true; + home = ".gbt"; + settings = { "org.gradle.caching" = true; }; + initScripts = { "some-script.gradle".text = "println 'hello world'"; }; }; + + programs.java.package = + pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + + nmt.script = '' + assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ + 'export GRADLE_USER_HOME="/home/hm-user/.gbt"' + assertFileExists home-files/.gbt/gradle.properties + assertFileExists home-files/.gbt/init.d/some-script.gradle + ''; } diff --git a/tests/modules/programs/gradle/empty-settings.nix b/tests/modules/programs/gradle/empty-settings.nix index 8ed465751..6b9970843 100644 --- a/tests/modules/programs/gradle/empty-settings.nix +++ b/tests/modules/programs/gradle/empty-settings.nix @@ -1,17 +1,13 @@ { pkgs, ... }: { - config = { - programs.gradle.enable = true; + programs.gradle.enable = true; - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + programs.java.package = + pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; - test.stubs.gradle = { }; - - nmt.script = '' - assertPathNotExists home-files/.gradle - assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'GRADLE_USER_HOME' - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.gradle + assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'GRADLE_USER_HOME' + ''; } diff --git a/tests/modules/programs/gradle/example-settings.nix b/tests/modules/programs/gradle/example-settings.nix index 19b8c070a..5944d66c4 100644 --- a/tests/modules/programs/gradle/example-settings.nix +++ b/tests/modules/programs/gradle/example-settings.nix @@ -1,42 +1,36 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { - config = { - programs.gradle = { - enable = true; - settings = { - "org.gradle.caching" = true; - "org.gradle.parallel" = true; - "org.gradle.java.home" = pkgs.jdk17; - "org.gradle.java.installations.paths" = "${pkgs.jdk8},${pkgs.jdk11}"; - }; + programs.gradle = { + enable = true; + settings = { + "org.gradle.caching" = true; + "org.gradle.parallel" = true; + "org.gradle.java.home" = pkgs.jdk17; + "org.gradle.java.installations.paths" = "${pkgs.jdk8},${pkgs.jdk11}"; }; - - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; - - test.stubs = { - gradle = { }; - jdk = { }; - jdk8 = { }; - jdk11 = { }; - jdk17 = { }; - }; - - nmt.script = '' - assertFileExists home-files/.gradle/gradle.properties - assertFileContent home-files/.gradle/gradle.properties ${ - builtins.toFile "gradle.expected" '' - # Generated with Nix - - org.gradle.caching = true - org.gradle.java.home = @jdk17@ - org.gradle.java.installations.paths = @jdk8@,@jdk11@ - org.gradle.parallel = true - '' - } - ''; }; + + programs.java.package = + pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + + test.stubs = { + jdk8 = { }; + jdk11 = { }; + jdk17 = { }; + }; + + nmt.script = '' + assertFileExists home-files/.gradle/gradle.properties + assertFileContent home-files/.gradle/gradle.properties ${ + builtins.toFile "gradle.expected" '' + # Generated with Nix + + org.gradle.caching = true + org.gradle.java.home = @jdk17@ + org.gradle.java.installations.paths = @jdk8@,@jdk11@ + org.gradle.parallel = true + '' + } + ''; } diff --git a/tests/modules/programs/gradle/init-scripts-settings.nix b/tests/modules/programs/gradle/init-scripts-settings.nix index 49d9a8dce..680368366 100644 --- a/tests/modules/programs/gradle/init-scripts-settings.nix +++ b/tests/modules/programs/gradle/init-scripts-settings.nix @@ -1,37 +1,31 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { - config = { - programs.gradle = { - enable = true; + programs.gradle = { + enable = true; - initScripts = { - "inline-init-script.gradle".text = '' - println 'inline-init-script' - ''; - "external-init-script.gradle".source = ./external-init-script.gradle; - }; + initScripts = { + "inline-init-script.gradle".text = '' + println 'inline-init-script' + ''; + "external-init-script.gradle".source = ./external-init-script.gradle; }; - - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; - - test.stubs.gradle = { }; - - nmt.script = '' - assertFileExists home-files/.gradle/init.d/inline-init-script.gradle - assertFileContent home-files/.gradle/init.d/inline-init-script.gradle ${ - pkgs.writeText "gradle.expected" '' - println 'inline-init-script' - '' - } - - assertFileExists home-files/.gradle/init.d/external-init-script.gradle - assertFileContent home-files/.gradle/init.d/external-init-script.gradle ${ - ./external-init-script.gradle - } - ''; }; + + programs.java.package = + pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + + nmt.script = '' + assertFileExists home-files/.gradle/init.d/inline-init-script.gradle + assertFileContent home-files/.gradle/init.d/inline-init-script.gradle ${ + pkgs.writeText "gradle.expected" '' + println 'inline-init-script' + '' + } + + assertFileExists home-files/.gradle/init.d/external-init-script.gradle + assertFileContent home-files/.gradle/init.d/external-init-script.gradle ${ + ./external-init-script.gradle + } + ''; } diff --git a/tests/modules/programs/granted/integration-disabled.nix b/tests/modules/programs/granted/integration-disabled.nix index 90f8d494a..2b3141cc7 100644 --- a/tests/modules/programs/granted/integration-disabled.nix +++ b/tests/modules/programs/granted/integration-disabled.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - { programs = { granted.enable = true; @@ -7,8 +5,6 @@ zsh.enable = true; }; - test.stubs.granted = { }; - nmt.script = '' assertFileExists home-files/.zshrc assertFileNotRegex \ diff --git a/tests/modules/programs/granted/integration-enabled.nix b/tests/modules/programs/granted/integration-enabled.nix index 5bb903aae..25e70c8e9 100644 --- a/tests/modules/programs/granted/integration-enabled.nix +++ b/tests/modules/programs/granted/integration-enabled.nix @@ -1,13 +1,9 @@ -{ pkgs, ... }: - { programs = { granted.enable = true; zsh.enable = true; }; - test.stubs.granted = { }; - nmt.script = '' assertFileExists home-files/.zshrc assertFileContains \ diff --git a/tests/modules/programs/helix/example-settings.nix b/tests/modules/programs/helix/example-settings.nix index c60883a12..69a5ef557 100644 --- a/tests/modules/programs/helix/example-settings.nix +++ b/tests/modules/programs/helix/example-settings.nix @@ -1,144 +1,138 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs.helix = { - enable = true; + programs.helix = { + enable = true; - settings = { - theme = "base16"; - editor = { - line-number = "relative"; - lsp.display-messages = true; - }; - keys.normal = { - space.space = "file_picker"; - space.w = ":w"; - space.q = ":q"; - esc = [ "collapse_selection" "keep_primary_selection" ]; - }; + settings = { + theme = "base16"; + editor = { + line-number = "relative"; + lsp.display-messages = true; }; - - languages = { - language-server.typescript-language-server = let - typescript-language-server = config.lib.test.mkStubPackage { - outPath = "@typescript-language-server@"; - }; - typescript = - config.lib.test.mkStubPackage { outPath = "@typescript@"; }; - in { - command = - "${typescript-language-server}/bin/typescript-language-server"; - args = [ - "--stdio" - "--tsserver-path=${typescript}/lib/node_modules/typescript/lib" - ]; - }; - - language = [{ - name = "rust"; - auto-format = false; - }]; - }; - - ignores = [ ".build/" "!.gitignore" ]; - - themes = { - base16 = let - transparent = "none"; - gray = "#665c54"; - dark-gray = "#3c3836"; - white = "#fbf1c7"; - black = "#282828"; - red = "#fb4934"; - green = "#b8bb26"; - yellow = "#fabd2f"; - orange = "#fe8019"; - blue = "#83a598"; - magenta = "#d3869b"; - cyan = "#8ec07c"; - in { - "ui.menu" = transparent; - "ui.menu.selected" = { modifiers = [ "reversed" ]; }; - "ui.linenr" = { - fg = gray; - bg = dark-gray; - }; - "ui.popup" = { modifiers = [ "reversed" ]; }; - "ui.linenr.selected" = { - fg = white; - bg = black; - modifiers = [ "bold" ]; - }; - "ui.selection" = { - fg = black; - bg = blue; - }; - "ui.selection.primary" = { modifiers = [ "reversed" ]; }; - "comment" = { fg = gray; }; - "ui.statusline" = { - fg = white; - bg = dark-gray; - }; - "ui.statusline.inactive" = { - fg = dark-gray; - bg = white; - }; - "ui.help" = { - fg = dark-gray; - bg = white; - }; - "ui.cursor" = { modifiers = [ "reversed" ]; }; - "variable" = red; - "variable.builtin" = orange; - "constant.numeric" = orange; - "constant" = orange; - "attributes" = yellow; - "type" = yellow; - "ui.cursor.match" = { - fg = yellow; - modifiers = [ "underlined" ]; - }; - "string" = green; - "variable.other.member" = red; - "constant.character.escape" = cyan; - "function" = blue; - "constructor" = blue; - "special" = blue; - "keyword" = magenta; - "label" = magenta; - "namespace" = blue; - "diff.plus" = green; - "diff.delta" = yellow; - "diff.minus" = red; - "diagnostic" = { modifiers = [ "underlined" ]; }; - "ui.gutter" = { bg = black; }; - "info" = blue; - "hint" = dark-gray; - "debug" = dark-gray; - "warning" = yellow; - "error" = red; - }; + keys.normal = { + space.space = "file_picker"; + space.w = ":w"; + space.q = ":q"; + esc = [ "collapse_selection" "keep_primary_selection" ]; }; }; - test.stubs.helix = { }; + languages = { + language-server.typescript-language-server = let + typescript-language-server = config.lib.test.mkStubPackage { + outPath = "@typescript-language-server@"; + }; + typescript = + config.lib.test.mkStubPackage { outPath = "@typescript@"; }; + in { + command = + "${typescript-language-server}/bin/typescript-language-server"; + args = [ + "--stdio" + "--tsserver-path=${typescript}/lib/node_modules/typescript/lib" + ]; + }; - nmt.script = '' - assertFileContent \ - home-files/.config/helix/config.toml \ - ${./settings-expected.toml} - assertFileContent \ - home-files/.config/helix/languages.toml \ - ${./languages-expected.toml} - assertFileContent \ - home-files/.config/helix/ignore \ - ${./ignore-expected} - assertFileContent \ - home-files/.config/helix/themes/base16.toml \ - ${./theme-base16-expected.toml} - ''; + language = [{ + name = "rust"; + auto-format = false; + }]; + }; + + ignores = [ ".build/" "!.gitignore" ]; + + themes = { + base16 = let + transparent = "none"; + gray = "#665c54"; + dark-gray = "#3c3836"; + white = "#fbf1c7"; + black = "#282828"; + red = "#fb4934"; + green = "#b8bb26"; + yellow = "#fabd2f"; + orange = "#fe8019"; + blue = "#83a598"; + magenta = "#d3869b"; + cyan = "#8ec07c"; + in { + "ui.menu" = transparent; + "ui.menu.selected" = { modifiers = [ "reversed" ]; }; + "ui.linenr" = { + fg = gray; + bg = dark-gray; + }; + "ui.popup" = { modifiers = [ "reversed" ]; }; + "ui.linenr.selected" = { + fg = white; + bg = black; + modifiers = [ "bold" ]; + }; + "ui.selection" = { + fg = black; + bg = blue; + }; + "ui.selection.primary" = { modifiers = [ "reversed" ]; }; + "comment" = { fg = gray; }; + "ui.statusline" = { + fg = white; + bg = dark-gray; + }; + "ui.statusline.inactive" = { + fg = dark-gray; + bg = white; + }; + "ui.help" = { + fg = dark-gray; + bg = white; + }; + "ui.cursor" = { modifiers = [ "reversed" ]; }; + "variable" = red; + "variable.builtin" = orange; + "constant.numeric" = orange; + "constant" = orange; + "attributes" = yellow; + "type" = yellow; + "ui.cursor.match" = { + fg = yellow; + modifiers = [ "underlined" ]; + }; + "string" = green; + "variable.other.member" = red; + "constant.character.escape" = cyan; + "function" = blue; + "constructor" = blue; + "special" = blue; + "keyword" = magenta; + "label" = magenta; + "namespace" = blue; + "diff.plus" = green; + "diff.delta" = yellow; + "diff.minus" = red; + "diagnostic" = { modifiers = [ "underlined" ]; }; + "ui.gutter" = { bg = black; }; + "info" = blue; + "hint" = dark-gray; + "debug" = dark-gray; + "warning" = yellow; + "error" = red; + }; + }; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/helix/config.toml \ + ${./settings-expected.toml} + assertFileContent \ + home-files/.config/helix/languages.toml \ + ${./languages-expected.toml} + assertFileContent \ + home-files/.config/helix/ignore \ + ${./ignore-expected} + assertFileContent \ + home-files/.config/helix/themes/base16.toml \ + ${./theme-base16-expected.toml} + ''; } diff --git a/tests/modules/programs/hexchat/basic-configuration.nix b/tests/modules/programs/hexchat/basic-configuration.nix index 6371a0e0b..7fba91da7 100644 --- a/tests/modules/programs/hexchat/basic-configuration.nix +++ b/tests/modules/programs/hexchat/basic-configuration.nix @@ -1,61 +1,54 @@ -{ config, lib, pkgs, ... }: - { - config = { - programs.hexchat = { - enable = true; - overwriteConfigFiles = true; - channels = { - oftc = { - charset = "UTF-8 (Unicode)"; - userName = "user"; - password = "password"; - loginMethod = "sasl"; - nickname = "user"; - nickname2 = "user_"; - realName = "real_user"; - options = { - autoconnect = true; - forceSSL = true; - }; - servers = [ "irc.oftc.net" ]; - autojoin = [ "#home-manager" ]; - }; - efnet = { - options = { forceSSL = true; }; - servers = [ - "irc.choopa.net" - "irc.colosolutions.net" - "irc.mzima.net" - "irc.prison.net" - ]; - autojoin = [ "#computers" ]; + programs.hexchat = { + enable = true; + overwriteConfigFiles = true; + channels = { + oftc = { + charset = "UTF-8 (Unicode)"; + userName = "user"; + password = "password"; + loginMethod = "sasl"; + nickname = "user"; + nickname2 = "user_"; + realName = "real_user"; + options = { + autoconnect = true; + forceSSL = true; }; + servers = [ "irc.oftc.net" ]; + autojoin = [ "#home-manager" ]; }; - settings = { - dcc_dir = "/home/user/Downloads"; - irc_nick1 = "user"; - irc_nick2 = "user_"; - irc_nick3 = "user__"; - irc_user_name = "user"; - irc_real_name = "real user"; - text_font = "Monospace 14"; - text_font_main = "Monospace 14"; - gui_slist_skip = "1"; # Skip network list on start-up - gui_quit_dialog = "0"; + efnet = { + options = { forceSSL = true; }; + servers = [ + "irc.choopa.net" + "irc.colosolutions.net" + "irc.mzima.net" + "irc.prison.net" + ]; + autojoin = [ "#computers" ]; }; }; - - test.stubs.hexchat = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/hexchat/hexchat.conf \ - ${./basic-configuration-expected-main-config} - assertFileContent \ - home-files/.config/hexchat/servlist.conf \ - ${./basic-configuration-expected-serverlist-config} - ''; + settings = { + dcc_dir = "/home/user/Downloads"; + irc_nick1 = "user"; + irc_nick2 = "user_"; + irc_nick3 = "user__"; + irc_user_name = "user"; + irc_real_name = "real user"; + text_font = "Monospace 14"; + text_font_main = "Monospace 14"; + gui_slist_skip = "1"; # Skip network list on start-up + gui_quit_dialog = "0"; + }; }; + nmt.script = '' + assertFileContent \ + home-files/.config/hexchat/hexchat.conf \ + ${./basic-configuration-expected-main-config} + assertFileContent \ + home-files/.config/hexchat/servlist.conf \ + ${./basic-configuration-expected-serverlist-config} + ''; } diff --git a/tests/modules/programs/himalaya/basic.nix b/tests/modules/programs/himalaya/basic.nix index f31a8464c..05fdef3f6 100644 --- a/tests/modules/programs/himalaya/basic.nix +++ b/tests/modules/programs/himalaya/basic.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; @@ -15,8 +11,6 @@ with lib; programs.himalaya = { enable = true; }; - test.stubs.himalaya = { }; - nmt.script = '' assertFileExists home-files/.config/himalaya/config.toml assertFileContent home-files/.config/himalaya/config.toml ${ diff --git a/tests/modules/programs/htop/empty-settings.nix b/tests/modules/programs/htop/empty-settings.nix index b8e43600f..d5b740397 100644 --- a/tests/modules/programs/htop/empty-settings.nix +++ b/tests/modules/programs/htop/empty-settings.nix @@ -1,15 +1,7 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.htop.enable = true; + programs.htop.enable = true; - test.stubs.htop = { }; - - nmt.script = '' - assertPathNotExists home-files/.config/htop - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/htop + ''; } diff --git a/tests/modules/programs/htop/example-settings.nix b/tests/modules/programs/htop/example-settings.nix index 71685434a..04c72f434 100644 --- a/tests/modules/programs/htop/example-settings.nix +++ b/tests/modules/programs/htop/example-settings.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { config = { @@ -36,8 +34,6 @@ with lib; (text "Systemd") ]); - test.stubs.htop = { }; - nmt.script = '' htoprc=home-files/.config/htop/htoprc assertFileExists $htoprc diff --git a/tests/modules/programs/htop/header_layout.nix b/tests/modules/programs/htop/header_layout.nix index aaf628522..e9de2bec9 100644 --- a/tests/modules/programs/htop/header_layout.nix +++ b/tests/modules/programs/htop/header_layout.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, pkgs, ... }: { config = with config.lib.htop; { @@ -13,8 +11,6 @@ with lib; column_meters_modes_1 = [ modes.Text modes.Text modes.Text modes.Text ]; }; - test.stubs.htop = { }; - # Test that the 'fields' key is written in addition to the customized # settings or htop won't read the options. nmt.script = let diff --git a/tests/modules/programs/htop/settings-without-fields.nix b/tests/modules/programs/htop/settings-without-fields.nix index f1efac2d4..e538a0756 100644 --- a/tests/modules/programs/htop/settings-without-fields.nix +++ b/tests/modules/programs/htop/settings-without-fields.nix @@ -1,14 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { config = { programs.htop.enable = true; programs.htop.settings = { color_scheme = 6; }; - test.stubs.htop = { }; - # Test that the 'fields' key is written in addition to the customized # settings or htop won't read the options. nmt.script = let diff --git a/tests/modules/programs/hyfetch/empty-settings.nix b/tests/modules/programs/hyfetch/empty-settings.nix index badb5220f..e02f72842 100644 --- a/tests/modules/programs/hyfetch/empty-settings.nix +++ b/tests/modules/programs/hyfetch/empty-settings.nix @@ -1,15 +1,7 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.hyfetch.enable = true; + programs.hyfetch.enable = true; - test.stubs.hyfetch = { }; - - nmt.script = '' - assertPathNotExists home-files/.config/hyfetch.json - ''; - }; + nmt.script = '' + assertPathNotExists home-files/.config/hyfetch.json + ''; } diff --git a/tests/modules/programs/hyfetch/settings.nix b/tests/modules/programs/hyfetch/settings.nix index 1cd98dc26..0210b65ed 100644 --- a/tests/modules/programs/hyfetch/settings.nix +++ b/tests/modules/programs/hyfetch/settings.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.hyfetch = { enable = true; @@ -17,8 +15,6 @@ }; }; - test.stubs.hyfetch = { }; - nmt.script = '' assertFileContent home-files/.config/hyfetch.json ${./hyfetch.json} ''; diff --git a/tests/modules/programs/hyprlock/basic-configuration.nix b/tests/modules/programs/hyprlock/basic-configuration.nix index c4f6821e6..606c1f75a 100644 --- a/tests/modules/programs/hyprlock/basic-configuration.nix +++ b/tests/modules/programs/hyprlock/basic-configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.hyprlock = { enable = true; @@ -35,8 +33,6 @@ }; }; - test.stubs.hyprlock = { }; - nmt.script = '' assertFileContent \ home-files/.config/hypr/hyprlock.conf \ diff --git a/tests/modules/programs/hyprlock/complex-configuration.nix b/tests/modules/programs/hyprlock/complex-configuration.nix index 8544a8c52..b8a9f9817 100644 --- a/tests/modules/programs/hyprlock/complex-configuration.nix +++ b/tests/modules/programs/hyprlock/complex-configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.hyprlock = { enable = true; @@ -173,8 +171,6 @@ }; }; - test.stubs.hyprlock = { }; - nmt.script = '' assertFileContent \ home-files/.config/hypr/hyprlock.conf \ diff --git a/tests/modules/programs/i3blocks/with-ordered-blocks.nix b/tests/modules/programs/i3blocks/with-ordered-blocks.nix index c2c9e6477..f7a81b9c3 100644 --- a/tests/modules/programs/i3blocks/with-ordered-blocks.nix +++ b/tests/modules/programs/i3blocks/with-ordered-blocks.nix @@ -1,9 +1,7 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, lib, ... }: let - expectedConfig = pkgs.writeText "i3blocks-expected-config" '' + expectedConfig = builtins.toFile "i3blocks-expected-config" '' [block1first] command=echo first interval=1 @@ -21,17 +19,17 @@ in { programs.i3blocks = { enable = true; package = config.lib.test.mkStubPackage { }; - bars = with lib; { + bars = { bar1 = { block1first = { command = "echo first"; interval = 1; }; - block2third = hm.dag.entryAfter [ "block3second" ] { + block2third = lib.hm.dag.entryAfter [ "block3second" ] { command = "echo third"; interval = 3; }; - block3second = hm.dag.entryAfter [ "block1first" ] { + block3second = lib.hm.dag.entryAfter [ "block1first" ] { command = "echo second"; interval = 2; }; @@ -41,11 +39,11 @@ in { command = "echo first"; interval = 1; }; - block2third = hm.dag.entryAfter [ "block3second" ] { + block2third = lib.hm.dag.entryAfter [ "block3second" ] { command = "echo third"; interval = 3; }; - block3second = hm.dag.entryAfter [ "block1first" ] { + block3second = lib.hm.dag.entryAfter [ "block1first" ] { command = "echo second"; interval = 2; }; @@ -53,8 +51,6 @@ in { }; }; - test.stubs.i3blocks = { }; - nmt.script = '' assertFileExists home-files/.config/i3blocks/bar1 assertFileExists home-files/.config/i3blocks/bar2 diff --git a/tests/modules/programs/i3status-rust/with-version-0311.nix b/tests/modules/programs/i3status-rust/with-version-0311.nix index d84cdd7cc..3f928c07b 100644 --- a/tests/modules/programs/i3status-rust/with-version-0311.nix +++ b/tests/modules/programs/i3status-rust/with-version-0311.nix @@ -1,13 +1,9 @@ -{ config, lib, pkgs, ... }: - { - config = { - programs.i3status-rust = { enable = true; }; + programs.i3status-rust = { enable = true; }; - test.stubs.i3status-rust = { version = "0.31.1"; }; + test.stubs.i3status-rust = { version = "0.31.1"; }; - test.asserts.assertions.expected = [ - "Only i3status-rust <0.31.0 or ≥0.31.2 is supported due to a config format incompatibility." - ]; - }; + test.asserts.assertions.expected = [ + "Only i3status-rust <0.31.0 or ≥0.31.2 is supported due to a config format incompatibility." + ]; } diff --git a/tests/modules/programs/i3status/with-custom.nix b/tests/modules/programs/i3status/with-custom.nix index 8b673b8ad..fcaa0c632 100644 --- a/tests/modules/programs/i3status/with-custom.nix +++ b/tests/modules/programs/i3status/with-custom.nix @@ -1,67 +1,61 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs.i3status = { - enable = true; - enableDefault = false; + programs.i3status = { + enable = true; + enableDefault = false; - general = { - colors = true; - color_good = "#e0e0e0"; - color_degraded = "#d7ae00"; - color_bad = "#f69d6a"; - interval = 1; - }; - - package = config.lib.test.mkStubPackage { }; - - modules = { - "volume master" = { - position = 1; - settings = { - format = "♪ %volume"; - format_muted = "♪ muted (%volume)"; - device = "pulse:1"; - }; - }; - "disk /" = { - position = 2; - settings = { format = "/ %avail"; }; - }; - }; + general = { + colors = true; + color_good = "#e0e0e0"; + color_degraded = "#d7ae00"; + color_bad = "#f69d6a"; + interval = 1; }; - test.stubs.i3status = { }; + package = config.lib.test.mkStubPackage { }; - nmt.script = '' - assertFileContent \ - home-files/.config/i3status/config \ - ${ - pkgs.writeText "i3status-expected-config" '' - general { - color_bad = "#f69d6a" - color_degraded = "#d7ae00" - color_good = "#e0e0e0" - colors = true - interval = 1 - } - - order += "volume master" - order += "disk /" - disk / { - format = "/ %avail" - } - - volume master { - device = "pulse:1" - format = "♪ %volume" - format_muted = "♪ muted (%volume)" - } - '' - } - ''; + modules = { + "volume master" = { + position = 1; + settings = { + format = "♪ %volume"; + format_muted = "♪ muted (%volume)"; + device = "pulse:1"; + }; + }; + "disk /" = { + position = 2; + settings = { format = "/ %avail"; }; + }; + }; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/i3status/config \ + ${ + builtins.toFile "i3status-expected-config" '' + general { + color_bad = "#f69d6a" + color_degraded = "#d7ae00" + color_good = "#e0e0e0" + colors = true + interval = 1 + } + + order += "volume master" + order += "disk /" + disk / { + format = "/ %avail" + } + + volume master { + device = "pulse:1" + format = "♪ %volume" + format_muted = "♪ muted (%volume)" + } + '' + } + ''; } diff --git a/tests/modules/programs/i3status/with-default.nix b/tests/modules/programs/i3status/with-default.nix index d56ecc205..735dad1f0 100644 --- a/tests/modules/programs/i3status/with-default.nix +++ b/tests/modules/programs/i3status/with-default.nix @@ -1,71 +1,63 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.i3status = { - enable = true; - enableDefault = true; - }; - - test.stubs.i3status = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/i3status/config \ - ${ - pkgs.writeText "i3status-expected-config" '' - general { - colors = true - interval = 5 - } - - order += "ipv6" - order += "wireless _first_" - order += "ethernet _first_" - order += "battery all" - order += "disk /" - order += "load" - order += "memory" - order += "tztime local" - battery all { - format = "%status %percentage %remaining" - } - - disk / { - format = "%avail" - } - - ethernet _first_ { - format_down = "E: down" - format_up = "E: %ip (%speed)" - } - - ipv6 { - - } - - load { - format = "%1min" - } - - memory { - format = "%used | %available" - format_degraded = "MEMORY < %available" - threshold_degraded = "1G" - } - - tztime local { - format = "%Y-%m-%d %H:%M:%S" - } - - wireless _first_ { - format_down = "W: down" - format_up = "W: (%quality at %essid) %ip" - } - '' - } - ''; + programs.i3status = { + enable = true; + enableDefault = true; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/i3status/config \ + ${ + builtins.toFile "i3status-expected-config" '' + general { + colors = true + interval = 5 + } + + order += "ipv6" + order += "wireless _first_" + order += "ethernet _first_" + order += "battery all" + order += "disk /" + order += "load" + order += "memory" + order += "tztime local" + battery all { + format = "%status %percentage %remaining" + } + + disk / { + format = "%avail" + } + + ethernet _first_ { + format_down = "E: down" + format_up = "E: %ip (%speed)" + } + + ipv6 { + + } + + load { + format = "%1min" + } + + memory { + format = "%used | %available" + format_degraded = "MEMORY < %available" + threshold_degraded = "1G" + } + + tztime local { + format = "%Y-%m-%d %H:%M:%S" + } + + wireless _first_ { + format_down = "W: down" + format_up = "W: (%quality at %essid) %ip" + } + '' + } + ''; } diff --git a/tests/modules/programs/irssi/example-settings.nix b/tests/modules/programs/irssi/example-settings.nix index f279b03c8..bec6699a9 100644 --- a/tests/modules/programs/irssi/example-settings.nix +++ b/tests/modules/programs/irssi/example-settings.nix @@ -1,31 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs.irssi = { - enable = true; - networks.oftc = { - nick = "nick"; - saslExternal = true; - server = { - address = "irc.oftc.net"; - port = 6697; - autoConnect = true; - ssl.certificateFile = - "${config.home.homeDirectory}/.irssi/certs/nick.pem"; - }; - channels.home-manager.autoJoin = true; + programs.irssi = { + enable = true; + networks.oftc = { + nick = "nick"; + saslExternal = true; + server = { + address = "irc.oftc.net"; + port = 6697; + autoConnect = true; + ssl.certificateFile = + "${config.home.homeDirectory}/.irssi/certs/nick.pem"; }; + channels.home-manager.autoJoin = true; }; - - test.stubs.irssi = { }; - - nmt.script = '' - assertFileContent \ - home-files/.irssi/config \ - ${./example-settings-expected.config} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.irssi/config \ + ${./example-settings-expected.config} + ''; } diff --git a/tests/modules/programs/joplin-desktop/basic-configuration.nix b/tests/modules/programs/joplin-desktop/basic-configuration.nix index 9f986798f..361e6f5d9 100644 --- a/tests/modules/programs/joplin-desktop/basic-configuration.nix +++ b/tests/modules/programs/joplin-desktop/basic-configuration.nix @@ -11,8 +11,6 @@ }; }; - test.stubs.joplin-desktop = { }; - nmt.script = '' assertFileContains activate \ '/home/hm-user/.config/joplin-desktop/settings.json' diff --git a/tests/modules/programs/jujutsu/empty-config.nix b/tests/modules/programs/jujutsu/empty-config.nix index 55b5d87e8..27a1c393e 100644 --- a/tests/modules/programs/jujutsu/empty-config.nix +++ b/tests/modules/programs/jujutsu/empty-config.nix @@ -6,8 +6,6 @@ let in { programs.jujutsu.enable = true; - test.stubs.jujutsu = { }; - nmt.script = '' assertPathNotExists 'home-files/${configDir}/jj/config.toml' ''; diff --git a/tests/modules/programs/k9s/deprecated-options.nix b/tests/modules/programs/k9s/deprecated-options.nix index a2bf4685a..97f779c3d 100644 --- a/tests/modules/programs/k9s/deprecated-options.nix +++ b/tests/modules/programs/k9s/deprecated-options.nix @@ -1,4 +1,6 @@ -{ config, lib, options, ... }: { +{ lib, options, ... }: + +{ programs.k9s = { enable = true; skin = { @@ -16,8 +18,6 @@ }; }; - test.stubs.k9s = { }; - test.asserts.warnings.enable = true; test.asserts.warnings.expected = [ "The option `programs.k9s.skin' defined in ${ diff --git a/tests/modules/programs/k9s/empty-settings.nix b/tests/modules/programs/k9s/empty-settings.nix index 355340054..6ff4276f7 100644 --- a/tests/modules/programs/k9s/empty-settings.nix +++ b/tests/modules/programs/k9s/empty-settings.nix @@ -1,11 +1,10 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ programs.k9s.enable = true; xdg.enable = lib.mkIf pkgs.stdenv.isDarwin (lib.mkForce false); - test.stubs.k9s = { }; - nmt.script = let configDir = if !pkgs.stdenv.isDarwin then ".config/k9s" diff --git a/tests/modules/programs/k9s/partial-skin-settings.nix b/tests/modules/programs/k9s/partial-skin-settings.nix index ba2a61ce5..84fee27ec 100644 --- a/tests/modules/programs/k9s/partial-skin-settings.nix +++ b/tests/modules/programs/k9s/partial-skin-settings.nix @@ -1,5 +1,3 @@ -{ config, ... }: - # When not specified in `programs.k9s.settings.ui.skin`, # test that the first skin name (alphabetically) is used in the config file @@ -44,8 +42,6 @@ }; }; - test.stubs.k9s = { }; - nmt.script = '' assertFileExists home-files/.config/k9s/config.yaml assertFileContent \ diff --git a/tests/modules/programs/kakoune/no-plugins.nix b/tests/modules/programs/kakoune/no-plugins.nix index d1505751b..372491b1b 100644 --- a/tests/modules/programs/kakoune/no-plugins.nix +++ b/tests/modules/programs/kakoune/no-plugins.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ./stubs.nix ]; diff --git a/tests/modules/programs/kakoune/stubs.nix b/tests/modules/programs/kakoune/stubs.nix index 28a816418..bcfed4053 100644 --- a/tests/modules/programs/kakoune/stubs.nix +++ b/tests/modules/programs/kakoune/stubs.nix @@ -1,12 +1,22 @@ { - test.stubs.kakoune-unwrapped = { - name = "dummy-kakoune"; - version = "1"; - outPath = null; - buildScript = '' - mkdir -p $out/bin $out/share/kak/doc - touch $out/bin/kak - chmod +x $out/bin/kak - ''; + test.stubs = { + kakoune-test-plugin = { + outPath = null; + buildScript = '' + mkdir -p $out/share/kak/autoload/plugins + touch $out/share/kak/autoload/plugins/kakoune-test-plugin + ''; + }; + + kakoune-unwrapped = { + name = "dummy-kakoune"; + version = "1"; + outPath = null; + buildScript = '' + mkdir -p $out/bin $out/share/kak/doc + touch $out/bin/kak + chmod +x $out/bin/kak + ''; + }; }; } diff --git a/tests/modules/programs/kakoune/use-plugins.nix b/tests/modules/programs/kakoune/use-plugins.nix index de7b3a123..12719d55c 100644 --- a/tests/modules/programs/kakoune/use-plugins.nix +++ b/tests/modules/programs/kakoune/use-plugins.nix @@ -1,13 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { imports = [ ./stubs.nix ]; programs.kakoune = { enable = true; - plugins = [ pkgs.kakounePlugins.prelude-kak ]; + plugins = [ pkgs.kakoune-test-plugin ]; }; nmt.script = '' diff --git a/tests/modules/programs/kakoune/whitespace-highlighter-corner-cases.nix b/tests/modules/programs/kakoune/whitespace-highlighter-corner-cases.nix index 4beb4b9e5..4e7d9aa31 100644 --- a/tests/modules/programs/kakoune/whitespace-highlighter-corner-cases.nix +++ b/tests/modules/programs/kakoune/whitespace-highlighter-corner-cases.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ./stubs.nix ]; diff --git a/tests/modules/programs/kakoune/whitespace-highlighter.nix b/tests/modules/programs/kakoune/whitespace-highlighter.nix index 1c80fe5f2..7923906bd 100644 --- a/tests/modules/programs/kakoune/whitespace-highlighter.nix +++ b/tests/modules/programs/kakoune/whitespace-highlighter.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ lib, ... }: { imports = [ ./stubs.nix ]; diff --git a/tests/modules/programs/khal/config.nix b/tests/modules/programs/khal/config.nix index c4a359458..2493e6fc2 100644 --- a/tests/modules/programs/khal/config.nix +++ b/tests/modules/programs/khal/config.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.khal = { enable = true; @@ -8,8 +6,8 @@ view.agenda_event_format = "{calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{reset}"; }; - }; + accounts.calendar = { basePath = "$XDG_CONFIG_HOME/cal"; accounts = { @@ -91,8 +89,6 @@ }; }; - test.stubs = { khal = { }; }; - nmt.script = '' configFile=home-files/.config/khal/config assertFileExists $configFile diff --git a/tests/modules/programs/khard/basic_config.nix b/tests/modules/programs/khard/basic_config.nix index f6f0838c7..41a65dbe9 100644 --- a/tests/modules/programs/khard/basic_config.nix +++ b/tests/modules/programs/khard/basic_config.nix @@ -24,8 +24,6 @@ }; }; - test.stubs.khard = { }; - nmt.script = '' assertFileContent \ home-files/.config/khard/khard.conf \ diff --git a/tests/modules/programs/khard/dirty_path.nix b/tests/modules/programs/khard/dirty_path.nix index 07396a144..8256a73cf 100644 --- a/tests/modules/programs/khard/dirty_path.nix +++ b/tests/modules/programs/khard/dirty_path.nix @@ -12,8 +12,6 @@ programs.khard.enable = true; - test.stubs.khard = { }; - nmt.script = '' assertFileContent \ home-files/.config/khard/khard.conf \ diff --git a/tests/modules/programs/khard/empty_config.nix b/tests/modules/programs/khard/empty_config.nix index 9d19d11c9..dc4247d76 100644 --- a/tests/modules/programs/khard/empty_config.nix +++ b/tests/modules/programs/khard/empty_config.nix @@ -9,8 +9,6 @@ programs.khard.enable = true; - test.stubs.khard = { }; - nmt.script = '' assertFileContent \ home-files/.config/khard/khard.conf \ diff --git a/tests/modules/programs/khard/multiple_accounts.nix b/tests/modules/programs/khard/multiple_accounts.nix index 393510bf8..56ed82ab1 100644 --- a/tests/modules/programs/khard/multiple_accounts.nix +++ b/tests/modules/programs/khard/multiple_accounts.nix @@ -13,8 +13,6 @@ programs.khard.enable = true; - test.stubs.khard = { }; - nmt.script = '' assertFileContent \ home-files/.config/khard/khard.conf \ diff --git a/tests/modules/programs/kitty/example-settings.nix b/tests/modules/programs/kitty/example-settings.nix index 8f2e0b894..d02c04c55 100644 --- a/tests/modules/programs/kitty/example-settings.nix +++ b/tests/modules/programs/kitty/example-settings.nix @@ -31,8 +31,6 @@ with lib; environment = { LS_COLORS = "1"; }; }; - test.stubs.kitty = { }; - nmt.script = '' assertFileExists home-files/.config/kitty/kitty.conf assertFileContent \ diff --git a/tests/modules/programs/kitty/theme-to-themeFile.nix b/tests/modules/programs/kitty/theme-to-themeFile.nix index 84596bba9..988076670 100644 --- a/tests/modules/programs/kitty/theme-to-themeFile.nix +++ b/tests/modules/programs/kitty/theme-to-themeFile.nix @@ -1,24 +1,24 @@ -{ config, lib, pkgs, options, ... }: { - config = { - programs.kitty = { - enable = true; - theme = "Space Gray Eighties"; - }; +{ lib, options, realPkgs, ... }: - test.stubs.kitty = { }; - - test.asserts.warnings.enable = true; - test.asserts.warnings.expected = [ - ("The option `programs.kitty.theme' defined in ${ - lib.showFiles options.programs.kitty.theme.files - } has been changed to `programs.kitty.themeFile' that has a different" - + " type. Please read `programs.kitty.themeFile' documentation and" - + " update your configuration accordingly.") - ]; - - nmt.script = '' - assertFileExists home-files/.config/kitty/kitty.conf - assertFileRegex home-files/.config/kitty/kitty.conf "^include .*themes/SpaceGray_Eighties\.conf$" - ''; +{ + programs.kitty = { + enable = true; + theme = "Space Gray Eighties"; }; + + test.asserts.warnings.enable = true; + test.asserts.warnings.expected = [ + ("The option `programs.kitty.theme' defined in ${ + lib.showFiles options.programs.kitty.theme.files + } has been changed to `programs.kitty.themeFile' that has a different" + + " type. Please read `programs.kitty.themeFile' documentation and" + + " update your configuration accordingly.") + ]; + + nixpkgs.overlays = [ (self: super: { inherit (realPkgs) kitty-themes; }) ]; + + nmt.script = '' + assertFileExists home-files/.config/kitty/kitty.conf + assertFileRegex home-files/.config/kitty/kitty.conf "^include .*themes/SpaceGray_Eighties\.conf$" + ''; } diff --git a/tests/modules/programs/kodi/example-addon-settings.nix b/tests/modules/programs/kodi/example-addon-settings.nix index c591d1ae3..da16965d0 100644 --- a/tests/modules/programs/kodi/example-addon-settings.nix +++ b/tests/modules/programs/kodi/example-addon-settings.nix @@ -1,6 +1,8 @@ { config, ... }: { + imports = [ ./kodi-stubs.nix ]; + programs.kodi = { enable = true; package = config.lib.test.mkStubPackage { }; diff --git a/tests/modules/programs/kodi/example-settings.nix b/tests/modules/programs/kodi/example-settings.nix index bdb48268a..74dd4a830 100644 --- a/tests/modules/programs/kodi/example-settings.nix +++ b/tests/modules/programs/kodi/example-settings.nix @@ -1,10 +1,8 @@ -{ config, ... }: - { + imports = [ ./kodi-stubs.nix ]; + programs.kodi = { enable = true; - package = config.lib.test.mkStubPackage { }; - settings = { videolibrary.showemptytvshows = "true"; }; }; diff --git a/tests/modules/programs/kodi/example-sources.nix b/tests/modules/programs/kodi/example-sources.nix index f49b50001..b06c92767 100644 --- a/tests/modules/programs/kodi/example-sources.nix +++ b/tests/modules/programs/kodi/example-sources.nix @@ -1,10 +1,8 @@ -{ config, ... }: - { + imports = [ ./kodi-stubs.nix ]; + programs.kodi = { enable = true; - package = config.lib.test.mkStubPackage { }; - sources = { video = { default = "movies"; @@ -22,7 +20,6 @@ ]; }; }; - }; nmt.script = '' diff --git a/tests/modules/programs/kodi/kodi-stubs.nix b/tests/modules/programs/kodi/kodi-stubs.nix new file mode 100644 index 000000000..b45a6e50b --- /dev/null +++ b/tests/modules/programs/kodi/kodi-stubs.nix @@ -0,0 +1,10 @@ +{ realPkgs, ... }: + +{ + nixpkgs.overlays = [ + (_: super: { + buildPackages = + super.buildPackages.extend (_: _: { inherit (realPkgs) libxslt; }); + }) + ]; +} diff --git a/tests/modules/programs/kubecolor/empty-config.nix b/tests/modules/programs/kubecolor/empty-config.nix index 732321c50..f88d334b0 100644 --- a/tests/modules/programs/kubecolor/empty-config.nix +++ b/tests/modules/programs/kubecolor/empty-config.nix @@ -12,8 +12,6 @@ in { }; }; - test.stubs.kubecolor = { }; - nmt.script = '' assertPathNotExists 'home-files/${configDir}/kube/color.yaml' ''; diff --git a/tests/modules/programs/ledger/ledger.nix b/tests/modules/programs/ledger/ledger.nix index f120a654d..7a1f9e415 100644 --- a/tests/modules/programs/ledger/ledger.nix +++ b/tests/modules/programs/ledger/ledger.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.ledger = { enable = true; @@ -17,8 +15,6 @@ }; }; - test.stubs.ledger = { }; - nmt.script = '' assertFileContent home-files/.config/ledger/ledgerrc \ ${builtins.toFile "ledger-expected-settings" '' diff --git a/tests/modules/programs/less/less-with-custom-keys.nix b/tests/modules/programs/less/less-with-custom-keys.nix index 23d447189..4e9b4197d 100644 --- a/tests/modules/programs/less/less-with-custom-keys.nix +++ b/tests/modules/programs/less/less-with-custom-keys.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { programs.less = { enable = true; @@ -12,8 +8,6 @@ with lib; ''; }; - test.stubs.less = { }; - nmt.script = '' assertFileExists home-files/.config/lesskey assertFileContent home-files/.config/lesskey ${ diff --git a/tests/modules/programs/lesspipe/lesspipe.nix b/tests/modules/programs/lesspipe/lesspipe.nix index 70dcc954b..44f642466 100644 --- a/tests/modules/programs/lesspipe/lesspipe.nix +++ b/tests/modules/programs/lesspipe/lesspipe.nix @@ -1,8 +1,6 @@ { programs.lesspipe.enable = true; - test.stubs.lesspipe = { }; - nmt.script = '' assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ 'export LESSOPEN="|@lesspipe@/bin/lesspipe.sh %s"' diff --git a/tests/modules/programs/lf/all-options.nix b/tests/modules/programs/lf/all-options.nix index 9632e7cf6..644959b3f 100644 --- a/tests/modules/programs/lf/all-options.nix +++ b/tests/modules/programs/lf/all-options.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - let pvScript = builtins.toFile "pv.sh" "cat $1"; expected = builtins.toFile "settings-expected" '' @@ -33,53 +29,49 @@ let ''; in { - config = { - programs.lf = { - enable = true; + programs.lf = { + enable = true; - cmdKeybindings = { - "" = "should-be-added"; - "" = null; - }; - - commands = { - added = '':echo "foo"''; - removed = null; - multiline = '' - :{{ - push gg - echo "bar" - push i - }}''; - }; - - extraConfig = '' - # More config... - ''; - - keybindings = { - aa = "should-be-added"; - ab = null; - }; - - previewer = { - keybinding = "i"; - source = pvScript; - }; - - settings = { - ignorecase = false; - icons = true; - tabstop = 4; - ratios = [ 2 2 3 ]; - }; + cmdKeybindings = { + "" = "should-be-added"; + "" = null; }; - test.stubs.lf = { }; + commands = { + added = '':echo "foo"''; + removed = null; + multiline = '' + :{{ + push gg + echo "bar" + push i + }}''; + }; - nmt.script = '' - assertFileExists home-files/.config/lf/lfrc - assertFileContent home-files/.config/lf/lfrc ${expected} + extraConfig = '' + # More config... ''; + + keybindings = { + aa = "should-be-added"; + ab = null; + }; + + previewer = { + keybinding = "i"; + source = pvScript; + }; + + settings = { + ignorecase = false; + icons = true; + tabstop = 4; + ratios = [ 2 2 3 ]; + }; }; + + nmt.script = '' + assertFileExists home-files/.config/lf/lfrc + assertFileContent home-files/.config/lf/lfrc ${expected} + ''; } diff --git a/tests/modules/programs/lf/minimal-options.nix b/tests/modules/programs/lf/minimal-options.nix index 078c776e7..c90382862 100644 --- a/tests/modules/programs/lf/minimal-options.nix +++ b/tests/modules/programs/lf/minimal-options.nix @@ -1,17 +1,10 @@ -{ config, lib, pkgs, ... }: +{ + programs.lf = { enable = true; }; -with lib; - -let expected = builtins.toFile "settings-expected" "\n\n\n\n\n\n\n\n\n\n\n"; -in { - config = { - programs.lf = { enable = true; }; - - test.stubs.lf = { }; - - nmt.script = '' + nmt.script = + let expected = builtins.toFile "settings-expected" "\n\n\n\n\n\n\n\n\n\n\n"; + in '' assertFileExists home-files/.config/lf/lfrc assertFileContent home-files/.config/lf/lfrc ${expected} ''; - }; } diff --git a/tests/modules/programs/lf/no-pv-keybind.nix b/tests/modules/programs/lf/no-pv-keybind.nix index c948cf0b5..c290f3e6d 100644 --- a/tests/modules/programs/lf/no-pv-keybind.nix +++ b/tests/modules/programs/lf/no-pv-keybind.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - let pvScript = builtins.toFile "pv.sh" "cat $1"; expected = builtins.toFile "settings-expected" '' @@ -21,22 +17,18 @@ let ''; in { - config = { - programs.lf = { - enable = true; + programs.lf = { + enable = true; - extraConfig = '' - # More config... - ''; - - previewer = { source = pvScript; }; - }; - - test.stubs.lf = { }; - - nmt.script = '' - assertFileExists home-files/.config/lf/lfrc - assertFileContent home-files/.config/lf/lfrc ${expected} + extraConfig = '' + # More config... ''; + + previewer = { source = pvScript; }; }; + + nmt.script = '' + assertFileExists home-files/.config/lf/lfrc + assertFileContent home-files/.config/lf/lfrc ${expected} + ''; } diff --git a/tests/modules/programs/lsd/example-settings.nix b/tests/modules/programs/lsd/example-settings.nix index 01c143a60..f911e22f8 100644 --- a/tests/modules/programs/lsd/example-settings.nix +++ b/tests/modules/programs/lsd/example-settings.nix @@ -1,62 +1,54 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.lsd = { - enable = true; - enableAliases = false; - settings = { - date = "relative"; - blocks = [ "date" "size" "name" ]; - layout = "oneline"; - sorting.dir-grouping = "first"; - ignore-globs = [ ".git" ".hg" ".bsp" ]; + programs.lsd = { + enable = true; + enableAliases = false; + settings = { + date = "relative"; + blocks = [ "date" "size" "name" ]; + layout = "oneline"; + sorting.dir-grouping = "first"; + ignore-globs = [ ".git" ".hg" ".bsp" ]; + }; + colors = { + date = { + day-old = "green"; + older = "dark_green"; }; - colors = { - date = { - day-old = "green"; - older = "dark_green"; - }; - size = { - none = "grey"; - small = "grey"; - medium = "yellow"; - large = "dark_yellow"; - }; - }; - icons = { - name = { - ".trash" = ""; - ".cargo" = ""; - }; - extension = { - "go" = ""; - "hs" = ""; - }; - filetype = { - "dir" = "📂"; - "file" = "📄"; - }; + size = { + none = "grey"; + small = "grey"; + medium = "yellow"; + large = "dark_yellow"; + }; + }; + icons = { + name = { + ".trash" = ""; + ".cargo" = ""; + }; + extension = { + "go" = ""; + "hs" = ""; + }; + filetype = { + "dir" = "📂"; + "file" = "📄"; }; }; - - test.stubs.lsd = { }; - - nmt.script = '' - assertFileExists home-files/.config/lsd/config.yaml - assertFileExists home-files/.config/lsd/colors.yaml - assertFileExists home-files/.config/lsd/icons.yaml - assertFileContent \ - home-files/.config/lsd/config.yaml \ - ${./example-settings-expected.yaml} - assertFileContent \ - home-files/.config/lsd/colors.yaml \ - ${./example-colors-expected.yaml} - assertFileContent \ - home-files/.config/lsd/icons.yaml \ - ${./example-icons-expected.yaml} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/lsd/config.yaml + assertFileExists home-files/.config/lsd/colors.yaml + assertFileExists home-files/.config/lsd/icons.yaml + assertFileContent \ + home-files/.config/lsd/config.yaml \ + ${./example-settings-expected.yaml} + assertFileContent \ + home-files/.config/lsd/colors.yaml \ + ${./example-colors-expected.yaml} + assertFileContent \ + home-files/.config/lsd/icons.yaml \ + ${./example-icons-expected.yaml} + ''; } diff --git a/tests/modules/programs/mbsync/mbsync-master-slave-change.nix b/tests/modules/programs/mbsync/mbsync-master-slave-change.nix deleted file mode 100644 index c6861374b..000000000 --- a/tests/modules/programs/mbsync/mbsync-master-slave-change.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -{ - imports = [ ../../accounts/email-test-accounts.nix ]; - - test.asserts.warnings.expected = [ - "mbsync channels no longer use masterPattern. Use farPattern in its place." - "mbsync channels no longer use slavePattern. Use nearPattern in its place." - ]; - - config = { - programs.mbsync = { - enable = true; - # programs.mbsync.groups and - # accounts.email.accounts..mbsync.groups should NOT be used at the - # same time. - # If they are, then the new version will take precedence. - groups.inboxes = { - "hm@example.com" = [ "Inbox1" "Inbox2" ]; - hm-account = [ "Inbox" ]; - }; - }; - - accounts.email.accounts = { - "hm@example.com".mbsync = { - enable = true; - groups.inboxes = { - channels = { - inbox1 = { - farPattern = "Inbox1"; - nearPattern = "Inboxes"; - }; - inbox2 = { - farPattern = "Inbox2"; - nearPattern = "Inboxes"; - }; - }; - }; - }; - - hm-account.mbsync = { - enable = true; - groups.hm-account = { - channels.earlierPatternMatch = { - farPattern = "Label"; - nearPattern = "SomethingUnderLabel"; - patterns = [ - "ThingUnderLabel" - "!NotThisMaildirThough" - ''"[Weird] Label?"'' - ]; - }; - channels.inbox = { - farPattern = "Inbox"; - nearPattern = "Inbox"; - }; - channels.strangeHostBoxName = { - farPattern = "[Weird]/Label Mess"; - nearPattern = "[AnotherWeird]/Label"; - }; - channels.patternMatch = { - farPattern = "Label"; - nearPattern = "SomethingUnderLabel"; - patterns = [ - "ThingUnderLabel" - "!NotThisMaildirThough" - ''"[Weird] Label?"'' - ]; - }; - }; - # No group should be printed. - groups.emptyGroup = { }; - # Group should be printed, but left with default channels. - groups.emptyChannels = { - channels.empty1 = { }; - channels.empty2 = { }; - }; - }; - }; - - test.asserts.warnings.expected = [ - "mbsync channels no longer use masterPattern. use farPattern in its place." - "mbsync channels no longer use slavePattern. Use nearPattern in its place." - ]; - - test.stubs.isync = { }; - - nmt.script = '' - assertFileExists home-files/.mbsyncrc - assertFileContent home-files/.mbsyncrc ${./mbsync-expected.conf} - ''; - }; -} diff --git a/tests/modules/programs/mbsync/mbsync.nix b/tests/modules/programs/mbsync/mbsync.nix index 3880a313a..506c0073b 100644 --- a/tests/modules/programs/mbsync/mbsync.nix +++ b/tests/modules/programs/mbsync/mbsync.nix @@ -1,86 +1,72 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - programs.mbsync = { - enable = true; - # programs.mbsync.groups and - # accounts.email.accounts..mbsync.groups should NOT be used at the - # same time. - # If they are, then the new version will take precedence. - groups.inboxes = { - "hm@example.com" = [ "Inbox1" "Inbox2" ]; - hm-account = [ "Inbox" ]; - }; + programs.mbsync = { + enable = true; + # programs.mbsync.groups and + # accounts.email.accounts..mbsync.groups should NOT be used at the + # same time. + # If they are, then the new version will take precedence. + groups.inboxes = { + "hm@example.com" = [ "Inbox1" "Inbox2" ]; + hm-account = [ "Inbox" ]; }; - - accounts.email.accounts = { - "hm@example.com".mbsync = { - enable = true; - extraConfig.account.TLSVersions = [ "+1.3" "+1.2" "-1.1" ]; - groups.inboxes = { - channels = { - inbox1 = { - farPattern = "Inbox1"; - nearPattern = "Inboxes"; - }; - inbox2 = { - farPattern = "Inbox2"; - nearPattern = "Inboxes"; - }; - }; - }; - }; - - hm-account.mbsync = { - enable = true; - groups.hm-account = { - channels.earlierPatternMatch = { - farPattern = "Label"; - nearPattern = "SomethingUnderLabel"; - patterns = [ - "ThingUnderLabel" - "!NotThisMaildirThough" - ''"[Weird] Label?"'' - ]; - }; - channels.inbox = { - farPattern = "Inbox"; - nearPattern = "Inbox"; - }; - channels.strangeHostBoxName = { - farPattern = "[Weird]/Label Mess"; - nearPattern = "[AnotherWeird]/Label"; - }; - channels.patternMatch = { - farPattern = "Label"; - nearPattern = "SomethingUnderLabel"; - patterns = [ - "ThingUnderLabel" - "!NotThisMaildirThough" - ''"[Weird] Label?"'' - ]; - }; - }; - # No group should be printed. - groups.emptyGroup = { }; - # Group should be printed, but left with default channels. - groups.emptyChannels = { - channels.empty1 = { }; - channels.empty2 = { }; - }; - }; - }; - - test.stubs.isync = { }; - - nmt.script = '' - assertFileExists home-files/.config/isyncrc - assertFileContent home-files/.config/isyncrc ${./mbsync-expected.conf} - ''; }; + + accounts.email.accounts = { + "hm@example.com".mbsync = { + enable = true; + extraConfig.account.TLSVersions = [ "+1.3" "+1.2" "-1.1" ]; + groups.inboxes = { + channels = { + inbox1 = { + farPattern = "Inbox1"; + nearPattern = "Inboxes"; + }; + inbox2 = { + farPattern = "Inbox2"; + nearPattern = "Inboxes"; + }; + }; + }; + }; + + hm-account.mbsync = { + enable = true; + groups.hm-account = { + channels.earlierPatternMatch = { + farPattern = "Label"; + nearPattern = "SomethingUnderLabel"; + patterns = + [ "ThingUnderLabel" "!NotThisMaildirThough" ''"[Weird] Label?"'' ]; + }; + channels.inbox = { + farPattern = "Inbox"; + nearPattern = "Inbox"; + }; + channels.strangeHostBoxName = { + farPattern = "[Weird]/Label Mess"; + nearPattern = "[AnotherWeird]/Label"; + }; + channels.patternMatch = { + farPattern = "Label"; + nearPattern = "SomethingUnderLabel"; + patterns = + [ "ThingUnderLabel" "!NotThisMaildirThough" ''"[Weird] Label?"'' ]; + }; + }; + # No group should be printed. + groups.emptyGroup = { }; + # Group should be printed, but left with default channels. + groups.emptyChannels = { + channels.empty1 = { }; + channels.empty2 = { }; + }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/isyncrc + assertFileContent home-files/.config/isyncrc ${./mbsync-expected.conf} + ''; } diff --git a/tests/modules/programs/micro/micro.nix b/tests/modules/programs/micro/micro.nix index 92ab90e83..74d589f9e 100644 --- a/tests/modules/programs/micro/micro.nix +++ b/tests/modules/programs/micro/micro.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.micro = { enable = true; @@ -10,8 +8,6 @@ }; }; - test.stubs.micro = { }; - nmt.script = '' assertFileContent home-files/.config/micro/settings.json \ ${builtins.toFile "micro-expected-settings.json" '' diff --git a/tests/modules/programs/mpv/mpv-example-settings.nix b/tests/modules/programs/mpv/mpv-example-settings.nix index 2fc5ca5de..972ccfdbc 100644 --- a/tests/modules/programs/mpv/mpv-example-settings.nix +++ b/tests/modules/programs/mpv/mpv-example-settings.nix @@ -1,8 +1,6 @@ { config, lib, pkgs, ... }: { - imports = [ ./mpv-stubs.nix ]; - programs.mpv = { enable = true; diff --git a/tests/modules/programs/mpv/mpv-invalid-settings.nix b/tests/modules/programs/mpv/mpv-invalid-settings.nix index 896e34fa7..9f661cdd4 100644 --- a/tests/modules/programs/mpv/mpv-invalid-settings.nix +++ b/tests/modules/programs/mpv/mpv-invalid-settings.nix @@ -1,14 +1,18 @@ { config, lib, pkgs, ... }: { - imports = [ ./mpv-stubs.nix ]; - programs.mpv = { enable = true; package = pkgs.emptyDirectory; scripts = [ pkgs.mpvScript ]; }; + test.stubs = { + mpv = { extraAttrs.override = { ... }: pkgs.emptyDirectory; }; + + mpvScript = { extraAttrs = { scriptName = "something"; }; }; + }; + test.asserts.assertions.expected = [ '' The programs.mpv "package" option is mutually exclusive with "scripts" option.'' diff --git a/tests/modules/programs/mpv/mpv-stubs.nix b/tests/modules/programs/mpv/mpv-stubs.nix deleted file mode 100644 index caef8e69d..000000000 --- a/tests/modules/programs/mpv/mpv-stubs.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - nixpkgs.overlays = [ - (final: prev: { - mpvScript = prev.runCommandLocal "mpvScript" { scriptName = "something"; } - "mkdir $out"; - - mpv-unwrapped = let - lua = prev.emptyDirectory.overrideAttrs { - luaversion = "0"; - passthru.withPackages = pkgsFn: prev.emptyDirectory; - }; - mpv-unwrapped' = prev.mpv-unwrapped.override { inherit lua; }; - in mpv-unwrapped'.overrideAttrs { - buildInputs = [ ]; - nativeBuildInputs = [ ]; - builder = prev.writeShellScript "dummy" '' - PATH=${final.coreutils}/bin - mkdir -p $dev $doc $man $out/bin $out/Applications/mpv.app/Contents/MacOS - touch $out/bin/{mpv,umpv} \ - $out/Applications/mpv.app/Contents/MacOS/{mpv,mpv-bundle} - chmod +x $out/bin/{mpv,umpv} \ - $out/Applications/mpv.app/Contents/MacOS/{mpv,mpv-bundle} - ''; - }; - }) - ]; - - test.stubs = { yt-dlp = { }; }; -} diff --git a/tests/modules/programs/mu/basic-configuration.nix b/tests/modules/programs/mu/basic-configuration.nix index 60c14697a..9c180e1d4 100644 --- a/tests/modules/programs/mu/basic-configuration.nix +++ b/tests/modules/programs/mu/basic-configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { imports = [ ../../accounts/email-test-accounts.nix ]; @@ -12,8 +10,6 @@ programs.mu.enable = true; - test.stubs.mu = { name = "mu"; }; - nmt.script = '' assertFileContains activate \ 'if [[ ! -d "/home/hm-user/.cache/mu" || ! "$MU_SORTED_ADDRS" = "foo@example.com hm@example.com" ]]; then' diff --git a/tests/modules/programs/mu/custom-configuration.nix b/tests/modules/programs/mu/custom-configuration.nix index 41f9b84ce..dbaf3d18f 100644 --- a/tests/modules/programs/mu/custom-configuration.nix +++ b/tests/modules/programs/mu/custom-configuration.nix @@ -13,8 +13,6 @@ home = config.xdg.dataHome + "/mu"; }; - test.stubs.mu = { name = "mu"; }; - nmt.script = '' assertFileContains activate \ 'if [[ ! -d "/home/hm-user/.local/share/mu" || ! "$MU_SORTED_ADDRS" = "foo@example.com hm@example.com" ]]; then' diff --git a/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix index ba1607ab8..71a89d91d 100644 --- a/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix +++ b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix @@ -1,25 +1,16 @@ -{ pkgs, ... }: - { - config = { - # Minimal config reproducing - # https://github.com/nix-community/home-manager/issues/3560 - programs.ncmpcpp.enable = true; + # Minimal config reproducing + # https://github.com/nix-community/home-manager/issues/3560 + programs.ncmpcpp.enable = true; - services.mpd.enable = true; - services.mpd.musicDirectory = "~/music"; + services.mpd.enable = true; + services.mpd.musicDirectory = "~/music"; - test.stubs = { - ncmpcpp = { }; - mpd = { }; - }; + nmt.script = '' + assertFileContent \ + home-files/.config/ncmpcpp/config \ + ${./ncmpcpp-issue-3560-expected-config} - nmt.script = '' - assertFileContent \ - home-files/.config/ncmpcpp/config \ - ${./ncmpcpp-issue-3560-expected-config} - - assertPathNotExists home-files/.config/ncmpcpp/bindings - ''; - }; + assertPathNotExists home-files/.config/ncmpcpp/bindings + ''; } diff --git a/tests/modules/programs/ncmpcpp-linux/ncmpcpp-use-mpd-config.nix b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-use-mpd-config.nix index f977bddec..21cf961a0 100644 --- a/tests/modules/programs/ncmpcpp-linux/ncmpcpp-use-mpd-config.nix +++ b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-use-mpd-config.nix @@ -1,23 +1,14 @@ -{ pkgs, ... }: - { - config = { - programs.ncmpcpp.enable = true; + programs.ncmpcpp.enable = true; - services.mpd.enable = true; - services.mpd.musicDirectory = "/home/user/music"; + services.mpd.enable = true; + services.mpd.musicDirectory = "/home/user/music"; - test.stubs = { - ncmpcpp = { }; - mpd = { }; - }; + nmt.script = '' + assertFileContent \ + home-files/.config/ncmpcpp/config \ + ${./ncmpcpp-use-mpd-config-expected-config} - nmt.script = '' - assertFileContent \ - home-files/.config/ncmpcpp/config \ - ${./ncmpcpp-use-mpd-config-expected-config} - - assertPathNotExists home-files/.config/ncmpcpp/bindings - ''; - }; + assertPathNotExists home-files/.config/ncmpcpp/bindings + ''; } diff --git a/tests/modules/programs/ncmpcpp/ncmpcpp-empty-settings.nix b/tests/modules/programs/ncmpcpp/ncmpcpp-empty-settings.nix index 554366509..3a7452a79 100644 --- a/tests/modules/programs/ncmpcpp/ncmpcpp-empty-settings.nix +++ b/tests/modules/programs/ncmpcpp/ncmpcpp-empty-settings.nix @@ -1,15 +1,9 @@ -{ pkgs, ... }: - { - config = { - programs.ncmpcpp.enable = true; + programs.ncmpcpp.enable = true; - test.stubs.ncmpcpp = { }; + nmt.script = '' + assertPathNotExists home-files/.config/ncmpcpp/config - nmt.script = '' - assertPathNotExists home-files/.config/ncmpcpp/config - - assertPathNotExists home-files/.config/ncmpcpp/bindings - ''; - }; + assertPathNotExists home-files/.config/ncmpcpp/bindings + ''; } diff --git a/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix b/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix index a85ea552c..bf916dfbe 100644 --- a/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix +++ b/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix @@ -1,59 +1,53 @@ -{ pkgs, ... }: - { - config = { - programs.ncmpcpp = { - enable = true; - mpdMusicDir = "/home/user/music"; + programs.ncmpcpp = { + enable = true; + mpdMusicDir = "/home/user/music"; - settings = { - user_interface = "alternative"; - display_volume_level = false; - playlist_disable_highlight_delay = 0; - }; - - bindings = [ - { - key = "j"; - command = "scroll_down"; - } - { - key = "k"; - command = "scroll_up"; - } - { - key = "J"; - command = [ "select_item" "scroll_down" ]; - } - { - key = "K"; - command = [ "select_item" "scroll_up" ]; - } - { - key = "x"; - command = "delete_playlist_items"; - } - { - key = "x"; - command = "delete_browser_items"; - } - { - key = "x"; - command = "delete_stored_playlist"; - } - ]; + settings = { + user_interface = "alternative"; + display_volume_level = false; + playlist_disable_highlight_delay = 0; }; - test.stubs.ncmpcpp = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/ncmpcpp/config \ - ${./ncmpcpp-example-settings-expected-config} - - assertFileContent \ - home-files/.config/ncmpcpp/bindings \ - ${./ncmpcpp-example-settings-expected-bindings} - ''; + bindings = [ + { + key = "j"; + command = "scroll_down"; + } + { + key = "k"; + command = "scroll_up"; + } + { + key = "J"; + command = [ "select_item" "scroll_down" ]; + } + { + key = "K"; + command = [ "select_item" "scroll_up" ]; + } + { + key = "x"; + command = "delete_playlist_items"; + } + { + key = "x"; + command = "delete_browser_items"; + } + { + key = "x"; + command = "delete_stored_playlist"; + } + ]; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/ncmpcpp/config \ + ${./ncmpcpp-example-settings-expected-config} + + assertFileContent \ + home-files/.config/ncmpcpp/bindings \ + ${./ncmpcpp-example-settings-expected-bindings} + ''; } diff --git a/tests/modules/programs/ne/defprefs.nix b/tests/modules/programs/ne/defprefs.nix index 64d78d276..1fd8cd7f5 100644 --- a/tests/modules/programs/ne/defprefs.nix +++ b/tests/modules/programs/ne/defprefs.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - let defpref = '' defined through defaultPreferences @@ -12,24 +8,20 @@ let ''; in { - config = { - programs.ne = { - enable = true; - defaultPreferences = defpref; - automaticPreferences.".default" = autopref; - }; + programs.ne = { + enable = true; + defaultPreferences = defpref; + automaticPreferences.".default" = autopref; + }; - test.stubs.ne = { }; - - nmt = { - description = - "Check that it gracefully handles the case of both defaultPreferences and automaticPreferences.'.default' being set, defaulting to the former."; - script = '' - assertFileExists home-files/.ne/.default#ap - assertFileContent home-files/.ne/.default#ap ${ - builtins.toFile "defpref" defpref - } - ''; - }; + nmt = { + description = + "Check that it gracefully handles the case of both defaultPreferences and automaticPreferences.'.default' being set, defaulting to the former."; + script = '' + assertFileExists home-files/.ne/.default#ap + assertFileContent home-files/.ne/.default#ap ${ + builtins.toFile "defpref" defpref + } + ''; }; } diff --git a/tests/modules/programs/ne/passthroughs.nix b/tests/modules/programs/ne/passthroughs.nix index f753826f3..2024b3b6a 100644 --- a/tests/modules/programs/ne/passthroughs.nix +++ b/tests/modules/programs/ne/passthroughs.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ lib, ... }: let @@ -44,29 +42,25 @@ let ''; in { - config = { - programs.ne = { - enable = true; - inherit keybindings; - inherit menus; - inherit virtualExtensions; - inherit automaticPreferences; - }; + programs.ne = { + enable = true; + inherit keybindings; + inherit menus; + inherit virtualExtensions; + inherit automaticPreferences; + }; - test.stubs.ne = { }; + nmt = { + description = "Check that configuration files are correctly written"; + script = lib.concatStringsSep "\n" [ + (checkFile ".keys" keybindings) + (checkFile ".extensions" virtualExtensions) + (checkFile ".menus" menus) - nmt = { - description = "Check that configuration files are correctly written"; - script = concatStringsSep "\n" [ - (checkFile ".keys" keybindings) - (checkFile ".extensions" virtualExtensions) - (checkFile ".menus" menus) - - # Generates a check command for each entry in automaticPreferences. - (concatStringsSep "\n" (mapAttrsToList - (extension: contents: checkFile "${extension}#ap" contents) - automaticPreferences)) - ]; - }; + # Generates a check command for each entry in automaticPreferences. + (lib.concatStringsSep "\n" (lib.mapAttrsToList + (extension: contents: checkFile "${extension}#ap" contents) + automaticPreferences)) + ]; }; } diff --git a/tests/modules/programs/neomutt/neomutt-no-folder-change.nix b/tests/modules/programs/neomutt/neomutt-no-folder-change.nix index 0e874c228..3d6aa86dd 100644 --- a/tests/modules/programs/neomutt/neomutt-no-folder-change.nix +++ b/tests/modules/programs/neomutt/neomutt-no-folder-change.nix @@ -1,29 +1,21 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - msmtp.enable = true; - neomutt.enable = true; - imap.port = 993; - }; + accounts.email.accounts = { + "hm@example.com" = { + msmtp.enable = true; + neomutt.enable = true; + imap.port = 993; }; - - programs.neomutt.enable = true; - programs.neomutt.changeFolderWhenSourcingAccount = false; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-no-folder-change-expected.conf - } - ''; }; + + programs.neomutt.enable = true; + programs.neomutt.changeFolderWhenSourcingAccount = false; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-no-folder-change-expected.conf + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-not-primary.nix b/tests/modules/programs/neomutt/neomutt-not-primary.nix index ccf5444a9..db1f2de64 100644 --- a/tests/modules/programs/neomutt/neomutt-not-primary.nix +++ b/tests/modules/programs/neomutt/neomutt-not-primary.nix @@ -1,25 +1,17 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com".maildir = null; - hm-account.neomutt.enable = true; - }; - - programs.neomutt.enable = true; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-not-primary-expected.conf - } - ''; + accounts.email.accounts = { + "hm@example.com".maildir = null; + hm-account.neomutt.enable = true; }; + + programs.neomutt.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-not-primary-expected.conf + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-unmailboxes.nix b/tests/modules/programs/neomutt/neomutt-unmailboxes.nix index 162379b80..274fb5db8 100644 --- a/tests/modules/programs/neomutt/neomutt-unmailboxes.nix +++ b/tests/modules/programs/neomutt/neomutt-unmailboxes.nix @@ -1,30 +1,22 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - msmtp.enable = true; - neomutt.enable = true; - imap.port = 993; - }; + accounts.email.accounts = { + "hm@example.com" = { + msmtp.enable = true; + neomutt.enable = true; + imap.port = 993; }; - - programs.neomutt.enable = true; - programs.neomutt.unmailboxes = true; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-unmailboxes-expected.conf - } - ''; }; + + programs.neomutt.enable = true; + programs.neomutt.unmailboxes = true; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-unmailboxes-expected.conf + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-binds-invalid-settings.nix b/tests/modules/programs/neomutt/neomutt-with-binds-invalid-settings.nix index 69fe4d9b5..1b420028f 100644 --- a/tests/modules/programs/neomutt/neomutt-with-binds-invalid-settings.nix +++ b/tests/modules/programs/neomutt/neomutt-with-binds-invalid-settings.nix @@ -1,29 +1,21 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.neomutt = { - enable = true; + programs.neomutt = { + enable = true; - binds = [{ - action = "complete-query"; - key = ""; - map = [ ]; - }]; + binds = [{ + action = "complete-query"; + key = ""; + map = [ ]; + }]; - macros = [{ - action = "?^K="; - key = "c"; - map = [ ]; - }]; - }; - - test.stubs.neomutt = { }; - - test.asserts.assertions.expected = [ - "The 'programs.neomutt.(binds|macros).map' list must contain at least one element." - ]; + macros = [{ + action = "?^K="; + key = "c"; + map = [ ]; + }]; }; + + test.asserts.assertions.expected = [ + "The 'programs.neomutt.(binds|macros).map' list must contain at least one element." + ]; } diff --git a/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix b/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix index 54012e9dd..f9d144dfd 100644 --- a/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix +++ b/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix @@ -1,70 +1,62 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; }; + imap.port = 993; }; + }; - programs.neomutt = { - enable = true; - vimKeys = false; + programs.neomutt = { + enable = true; + vimKeys = false; - binds = [ - { - action = "complete-query"; - key = ""; - map = "editor"; - } - { - action = "sidebar-prev"; - key = "\\Cp"; - map = [ "index" "pager" ]; - } - ]; - - macros = [ - { - action = "?"; - key = "s"; - map = "index"; - } - { - action = "?^K="; - key = "c"; - map = [ "index" "pager" ]; - } - ]; - }; - - test.stubs.neomutt = { }; - - test.asserts.warnings.expected = [ - "Specifying 'programs.neomutt.(binds|macros).map' as a string is deprecated, use a list of strings instead. See https://github.com/nix-community/home-manager/pull/1885." + binds = [ + { + action = "complete-query"; + key = ""; + map = "editor"; + } + { + action = "sidebar-prev"; + key = "\\Cp"; + map = [ "index" "pager" ]; + } ]; - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-with-binds-expected.conf + macros = [ + { + action = "?"; + key = "s"; + map = "index"; } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-expected + { + action = "?^K="; + key = "c"; + map = [ "index" "pager" ]; } - ''; + ]; }; + + test.asserts.warnings.expected = [ + "Specifying 'programs.neomutt.(binds|macros).map' as a string is deprecated, use a list of strings instead. See https://github.com/nix-community/home-manager/pull/1885." + ]; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-with-binds-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-binds.nix b/tests/modules/programs/neomutt/neomutt-with-binds.nix index 64ebf80f8..7f97ae9e8 100644 --- a/tests/modules/programs/neomutt/neomutt-with-binds.nix +++ b/tests/modules/programs/neomutt/neomutt-with-binds.nix @@ -1,66 +1,58 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; }; + imap.port = 993; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - - binds = [ - { - action = "complete-query"; - key = ""; - map = [ "editor" ]; - } - { - action = "sidebar-prev"; - key = "\\Cp"; - map = [ "index" "pager" ]; - } - ]; - - macros = [ - { - action = "?"; - key = "s"; - map = [ "index" ]; - } - { - action = "?^K="; - key = "c"; - map = [ "index" "pager" ]; - } - ]; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-with-binds-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + + binds = [ + { + action = "complete-query"; + key = ""; + map = [ "editor" ]; + } + { + action = "sidebar-prev"; + key = "\\Cp"; + map = [ "index" "pager" ]; + } + ]; + + macros = [ + { + action = "?"; + key = "s"; + map = [ "index" ]; + } + { + action = "?^K="; + key = "c"; + map = [ "index" "pager" ]; + } + ]; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-with-binds-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-gpg.nix b/tests/modules/programs/neomutt/neomutt-with-gpg.nix index 2eed53583..1f542d747 100644 --- a/tests/modules/programs/neomutt/neomutt-with-gpg.nix +++ b/tests/modules/programs/neomutt/neomutt-with-gpg.nix @@ -1,32 +1,27 @@ -{ config, lib, pkgs, ... }: -with lib; { +{ imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - gpg = { - encryptByDefault = true; - signByDefault = true; - }; - neomutt.enable = true; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + gpg = { + encryptByDefault = true; + signByDefault = true; }; + neomutt.enable = true; + imap.port = 993; }; - - programs.neomutt.enable = true; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-gpg-expected.conf - } - ''; }; + + programs.neomutt.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-gpg-expected.conf + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-imap-type-mailboxes.nix b/tests/modules/programs/neomutt/neomutt-with-imap-type-mailboxes.nix index 10dcdbed6..65ce1f22c 100644 --- a/tests/modules/programs/neomutt/neomutt-with-imap-type-mailboxes.nix +++ b/tests/modules/programs/neomutt/neomutt-with-imap-type-mailboxes.nix @@ -1,57 +1,49 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - mailboxName = "someCustomName"; - extraMailboxes = [ - "Sent" - { - mailbox = "Junk Email"; - name = "Spam"; - type = "imap"; - } - { mailbox = "Trash"; } - ]; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; + mailboxName = "someCustomName"; + extraMailboxes = [ + "Sent" + { + mailbox = "Junk Email"; + name = "Spam"; + type = "imap"; + } + { mailbox = "Trash"; } + ]; }; + imap.port = 993; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ - ./neomutt-with-imap-type-mailboxes-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-expected - } - - confFile=$(grep -o \ - '/nix/store/.*-account-command.sh/bin/account-command.sh' \ - $TESTED/home-files/.config/neomutt/neomuttrc) - assertFileContent "$(normalizeStorePaths "$confFile")" ${ - ./account-command.sh-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ + ./neomutt-with-imap-type-mailboxes-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-expected + } + + confFile=$(grep -o \ + '/nix/store/.*-account-command.sh/bin/account-command.sh' \ + $TESTED/home-files/.config/neomutt/neomuttrc) + assertFileContent "$(normalizeStorePaths "$confFile")" ${ + ./account-command.sh-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-imap.nix b/tests/modules/programs/neomutt/neomutt-with-imap.nix index 3f234fde7..5d71aed68 100644 --- a/tests/modules/programs/neomutt/neomutt-with-imap.nix +++ b/tests/modules/programs/neomutt/neomutt-with-imap.nix @@ -1,44 +1,36 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - neomutt = { - enable = true; - mailboxType = "imap"; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + neomutt = { + enable = true; + mailboxType = "imap"; + extraConfig = '' + color status cyan default + ''; }; + imap.port = 993; }; - - programs.neomutt.enable = true; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ - ./neomutt-with-imap-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-imap-expected.conf - } - - confFile=$(grep -o \ - '/nix/store/.*-account-command.sh/bin/account-command.sh' \ - $TESTED/home-files/.config/neomutt/neomuttrc) - assertFileContent "$(normalizeStorePaths "$confFile")" ${ - ./account-command.sh-expected - } - ''; }; + + programs.neomutt.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ + ./neomutt-with-imap-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-imap-expected.conf + } + + confFile=$(grep -o \ + '/nix/store/.*-account-command.sh/bin/account-command.sh' \ + $TESTED/home-files/.config/neomutt/neomuttrc) + assertFileContent "$(normalizeStorePaths "$confFile")" ${ + ./account-command.sh-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-msmtp.nix b/tests/modules/programs/neomutt/neomutt-with-msmtp.nix index 48b2197d0..b711307b7 100644 --- a/tests/modules/programs/neomutt/neomutt-with-msmtp.nix +++ b/tests/modules/programs/neomutt/neomutt-with-msmtp.nix @@ -1,37 +1,29 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - msmtp.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + msmtp.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; }; + imap.port = 993; }; - - programs.neomutt.enable = true; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-msmtp-expected.conf - } - ''; }; + + programs.neomutt.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-msmtp-expected.conf + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix b/tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix index fd4fedf01..1d1d2fa47 100644 --- a/tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix +++ b/tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix @@ -1,49 +1,41 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - mailboxName = "someCustomName"; - extraMailboxes = [ - "Sent" - { - mailbox = "Junk Email"; - name = "Spam"; - } - { mailbox = "Trash"; } - ]; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; + mailboxName = "someCustomName"; + extraMailboxes = [ + "Sent" + { + mailbox = "Junk Email"; + name = "Spam"; + } + { mailbox = "Trash"; } + ]; }; + imap.port = 993; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-with-named-mailboxes-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-with-named-mailboxes-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-signature-command.nix b/tests/modules/programs/neomutt/neomutt-with-signature-command.nix index 97c2001f9..3700d0efe 100644 --- a/tests/modules/programs/neomutt/neomutt-with-signature-command.nix +++ b/tests/modules/programs/neomutt/neomutt-with-signature-command.nix @@ -1,45 +1,39 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; - signature = { - showSignature = "append"; - command = pkgs.writeScript "signature" "echo This is my signature"; - }; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; + }; + imap.port = 993; + signature = { + showSignature = "append"; + command = pkgs.writeScript "signature" "echo This is my signature"; }; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-expected.conf - } - expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") - assertFileContent "$expectedSignature" ${ - ./hm-example.com-signature-command-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") + assertFileContent "$expectedSignature" ${ + ./hm-example.com-signature-command-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-signature.nix b/tests/modules/programs/neomutt/neomutt-with-signature.nix index 9461976d3..e8361e0a2 100644 --- a/tests/modules/programs/neomutt/neomutt-with-signature.nix +++ b/tests/modules/programs/neomutt/neomutt-with-signature.nix @@ -1,48 +1,40 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; - signature = { - showSignature = "append"; - text = '' - -- - Test Signature - ''; - }; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; + }; + imap.port = 993; + signature = { + showSignature = "append"; + text = '' + -- + Test Signature + ''; }; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-expected.conf - } - expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") - assertFileContent "$expectedSignature" ${ - ./hm-example.com-signature-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") + assertFileContent "$expectedSignature" ${ + ./hm-example.com-signature-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt-with-starttls.nix b/tests/modules/programs/neomutt/neomutt-with-starttls.nix index 09d37ff9e..441985cac 100644 --- a/tests/modules/programs/neomutt/neomutt-with-starttls.nix +++ b/tests/modules/programs/neomutt/neomutt-with-starttls.nix @@ -1,41 +1,33 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 143; - smtp.tls.useStartTls = true; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; }; + imap.port = 143; + smtp.tls.useStartTls = true; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-starttls-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-starttls-expected + } + ''; } diff --git a/tests/modules/programs/neomutt/neomutt.nix b/tests/modules/programs/neomutt/neomutt.nix index 08c8f5bf3..65d74a4f9 100644 --- a/tests/modules/programs/neomutt/neomutt.nix +++ b/tests/modules/programs/neomutt/neomutt.nix @@ -1,40 +1,32 @@ -{ config, lib, pkgs, ... }: - -with lib; - { imports = [ ../../accounts/email-test-accounts.nix ]; - config = { - accounts.email.accounts = { - "hm@example.com" = { - notmuch.enable = true; - neomutt = { - enable = true; - extraConfig = '' - color status cyan default - ''; - }; - imap.port = 993; + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; }; + imap.port = 993; }; - - programs.neomutt = { - enable = true; - vimKeys = false; - }; - - test.stubs.neomutt = { }; - - nmt.script = '' - assertFileExists home-files/.config/neomutt/neomuttrc - assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/neomuttrc ${ - ./neomutt-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-expected - } - ''; }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + assertFileContent home-files/.config/neomutt/hm@example.com ${ + ./hm-example.com-expected + } + ''; } diff --git a/tests/modules/programs/neovide/neovide.nix b/tests/modules/programs/neovide/neovide.nix index 774964f01..6f3e6525a 100644 --- a/tests/modules/programs/neovide/neovide.nix +++ b/tests/modules/programs/neovide/neovide.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.neovide = { enable = true; @@ -25,8 +23,6 @@ }; }; - test.stubs.neovide = { }; - nmt.script = '' assertFileExists home-files/.config/neovide/config.toml assertFileContent home-files/.config/neovide/config.toml ${./expected.toml} diff --git a/tests/modules/programs/neovim/coc-config.nix b/tests/modules/programs/neovim/coc-config.nix index c16514134..cdb879a0f 100644 --- a/tests/modules/programs/neovim/coc-config.nix +++ b/tests/modules/programs/neovim/coc-config.nix @@ -1,27 +1,23 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.neovim = { + imports = [ ./stubs.nix ]; + + programs.neovim = { + enable = true; + coc = { enable = true; - coc = { - enable = true; - settings = { - # my variable - foo = "bar"; - }; + settings = { + # my variable + foo = "bar"; }; }; - - nmt.script = '' - cocSettings="$TESTED/home-files/.config/nvim/coc-settings.json" - cocSettingsNormalized="$(normalizeStorePaths "$cocSettings")" - - assertFileExists "$cocSettings" - assertFileContent "$cocSettingsNormalized" "${./coc-config.expected}" - ''; }; + + nmt.script = '' + cocSettings="$TESTED/home-files/.config/nvim/coc-settings.json" + cocSettingsNormalized="$(normalizeStorePaths "$cocSettings")" + + assertFileExists "$cocSettings" + assertFileContent "$cocSettingsNormalized" "${./coc-config.expected}" + ''; } diff --git a/tests/modules/programs/neovim/extra-lua-init.nix b/tests/modules/programs/neovim/extra-lua-init.nix index 2abaa6e9e..32f02fb70 100644 --- a/tests/modules/programs/neovim/extra-lua-init.nix +++ b/tests/modules/programs/neovim/extra-lua-init.nix @@ -1,23 +1,20 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.neovim = { - enable = true; + imports = [ ./stubs.nix ]; - extraLuaConfig = '' - -- extraLuaConfig - ''; - }; - nmt.script = '' - nvimFolder="home-files/.config/nvim" - assertFileContent "$nvimFolder/init.lua" ${ - pkgs.writeText "init.lua-expected" '' - -- extraLuaConfig - '' - } + programs.neovim = { + enable = true; + + extraLuaConfig = '' + -- extraLuaConfig ''; }; + + nmt.script = '' + nvimFolder="home-files/.config/nvim" + assertFileContent "$nvimFolder/init.lua" ${ + builtins.toFile "init.lua-expected" '' + -- extraLuaConfig + '' + } + ''; } diff --git a/tests/modules/programs/neovim/no-init.nix b/tests/modules/programs/neovim/no-init.nix index 693bdedec..69d0d08d3 100644 --- a/tests/modules/programs/neovim/no-init.nix +++ b/tests/modules/programs/neovim/no-init.nix @@ -1,28 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { - config = { - programs.neovim = { - enable = true; - vimAlias = true; - withNodeJs = false; - withPython3 = true; - withRuby = false; + imports = [ ./stubs.nix ]; - extraPython3Packages = (ps: with ps; [ jedi pynvim ]); + programs.neovim = { + enable = true; + vimAlias = true; + withNodeJs = false; + withPython3 = true; + withRuby = false; - # plugins without associated config should not trigger the creation of init.vim - plugins = with pkgs.vimPlugins; [ - vim-fugitive - ({ plugin = vim-sensible; }) - ]; - }; - nmt.script = '' - nvimFolder="home-files/.config/nvim" - assertPathNotExists "$nvimFolder/init.vim" - assertPathNotExists "$nvimFolder/init.lua" - ''; + extraPython3Packages = (ps: with ps; [ jedi pynvim ]); + + # plugins without associated config should not trigger the creation of init.vim + plugins = with pkgs.vimPlugins; [ + vim-fugitive + ({ plugin = vim-sensible; }) + ]; }; + nmt.script = '' + nvimFolder="home-files/.config/nvim" + assertPathNotExists "$nvimFolder/init.vim" + assertPathNotExists "$nvimFolder/init.lua" + ''; } diff --git a/tests/modules/programs/neovim/plugin-config.nix b/tests/modules/programs/neovim/plugin-config.nix index b12613588..0e014bc79 100644 --- a/tests/modules/programs/neovim/plugin-config.nix +++ b/tests/modules/programs/neovim/plugin-config.nix @@ -1,34 +1,32 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, realPkgs, ... }: -with lib; - -{ - config = { - programs.neovim = { - enable = true; - extraConfig = '' - let g:hmExtraConfig='HM_EXTRA_CONFIG' - ''; - plugins = with pkgs.vimPlugins; [ - vim-nix - { - plugin = vim-commentary; - config = '' - let g:hmPlugins='HM_PLUGINS_CONFIG' - ''; - } - ]; - extraLuaPackages = [ pkgs.lua51Packages.luautf8 ]; - }; - - nmt.script = '' - vimout=$(mktemp) - echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \ - | ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \ - > "$vimout" || true - assertFileContains "$vimout" "HM_EXTRA_CONFIG" - assertFileContains "$vimout" "HM_PLUGINS_CONFIG" +lib.mkIf config.test.enableBig { + programs.neovim = { + enable = true; + extraConfig = '' + let g:hmExtraConfig='HM_EXTRA_CONFIG' ''; + plugins = with pkgs.vimPlugins; [ + vim-nix + { + plugin = vim-commentary; + config = '' + let g:hmPlugins='HM_PLUGINS_CONFIG' + ''; + } + ]; + extraLuaPackages = [ pkgs.lua51Packages.luautf8 ]; }; + + _module.args.pkgs = lib.mkForce realPkgs; + + nmt.script = '' + vimout=$(mktemp) + echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \ + | ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \ + > "$vimout" || true + assertFileContains "$vimout" "HM_EXTRA_CONFIG" + assertFileContains "$vimout" "HM_PLUGINS_CONFIG" + ''; } diff --git a/tests/modules/programs/neovim/runtime.nix b/tests/modules/programs/neovim/runtime.nix index 7f39c8461..61ec8b9b6 100644 --- a/tests/modules/programs/neovim/runtime.nix +++ b/tests/modules/programs/neovim/runtime.nix @@ -1,53 +1,51 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, realPkgs, ... }: -with lib; +lib.mkIf config.test.enableBig { + programs.neovim = lib.mkMerge [ + { + enable = true; + plugins = with pkgs.vimPlugins; [ + vim-nix + { + plugin = vim-commentary; + runtime = { + "after/ftplugin/c.vim".text = '' + " plugin-specific config + setlocal commentstring=//\ %s + setlocal comments=:// + ''; + }; + } + ]; + extraWrapperArgs = let buildDeps = with pkgs; [ stdenv.cc.cc zlib ]; + in [ + "--suffix" + "LIBRARY_PATH" + ":" + "${lib.makeLibraryPath buildDeps}" + "--suffix" + "PKG_CONFIG_PATH" + ":" + "${lib.makeSearchPathOutput "dev" "lib/pkgconfig" buildDeps}" + ]; + } + { + extraPython3Packages = ps: with ps; [ jedi pynvim ]; + extraLuaPackages = ps: with ps; [ luacheck ]; + } + { + extraPython3Packages = with pkgs.python3Packages; [ jedi pynvim ]; + extraLuaPackages = with pkgs.lua51Packages; [ luacheck ]; + } + ]; -{ - config = { - programs.neovim = lib.mkMerge [ - { - enable = true; - plugins = with pkgs.vimPlugins; [ - vim-nix - { - plugin = vim-commentary; - runtime = { - "after/ftplugin/c.vim".text = '' - " plugin-specific config - setlocal commentstring=//\ %s - setlocal comments=:// - ''; - }; - } - ]; - extraWrapperArgs = let buildDeps = with pkgs; [ stdenv.cc.cc zlib ]; - in [ - "--suffix" - "LIBRARY_PATH" - ":" - "${lib.makeLibraryPath buildDeps}" - "--suffix" - "PKG_CONFIG_PATH" - ":" - "${lib.makeSearchPathOutput "dev" "lib/pkgconfig" buildDeps}" - ]; - } - { - extraPython3Packages = ps: with ps; [ jedi pynvim ]; - extraLuaPackages = ps: with ps; [ luacheck ]; - } - { - extraPython3Packages = with pkgs.python3Packages; [ jedi pynvim ]; - extraLuaPackages = with pkgs.lua51Packages; [ luacheck ]; - } - ]; + _module.args.pkgs = lib.mkForce realPkgs; - nmt.script = '' - ftplugin="home-files/.config/nvim/after/ftplugin/c.vim" - nvimbin="home-path/bin/nvim" - assertFileExists "$ftplugin" - assertFileRegex "$nvimbin" 'LIBRARY_PATH' - assertFileRegex "$nvimbin" 'PKG_CONFIG_PATH' - ''; - }; + nmt.script = '' + ftplugin="home-files/.config/nvim/after/ftplugin/c.vim" + nvimbin="home-path/bin/nvim" + assertFileExists "$ftplugin" + assertFileRegex "$nvimbin" 'LIBRARY_PATH' + assertFileRegex "$nvimbin" 'PKG_CONFIG_PATH' + ''; } diff --git a/tests/modules/programs/neovim/stubs.nix b/tests/modules/programs/neovim/stubs.nix new file mode 100644 index 000000000..edd5cebf2 --- /dev/null +++ b/tests/modules/programs/neovim/stubs.nix @@ -0,0 +1,35 @@ +{ lib, pkgs, ... }: + +{ + test.stubs = { + neovim-unwrapped = { + name = "neovim-unwrapped"; + outPath = null; + buildScript = '' + mkdir -p $out/bin $out/share/applications + echo "Name=Neovim" > $out/share/applications/nvim.desktop + + cp ${pkgs.writeShellScript "nvim" "exit 0"} $out/bin/nvim + chmod +x $out/bin/nvim + ''; + extraAttrs = { + lua = pkgs.writeTextDir "nix-support/utils.sh" '' + function _addToLuaPath() { + return 0 + } + ''; + + meta = let stub = "stub"; + in { + description = stub; + longDescription = stub; + homepage = stub; + mainProgram = stub; + license = [ stub ]; + maintainers = [ stub ]; + platforms = lib.platforms.all; + }; + }; + }; + }; +} diff --git a/tests/modules/programs/newsboat/newsboat-basics-2003.nix b/tests/modules/programs/newsboat/newsboat-basics-2003.nix index 26d5f4b32..592d0f8e6 100644 --- a/tests/modules/programs/newsboat/newsboat-basics-2003.nix +++ b/tests/modules/programs/newsboat/newsboat-basics-2003.nix @@ -1,33 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - home.stateVersion = "20.03"; + home.stateVersion = "20.03"; - programs.newsboat = { - enable = true; + programs.newsboat = { + enable = true; - urls = [ - { - url = "http://example.org/feed.xml"; - tags = [ "tag1" "tag2" ]; - title = "Cool feed"; - } + urls = [ + { + url = "http://example.org/feed.xml"; + tags = [ "tag1" "tag2" ]; + title = "Cool feed"; + } - { url = "http://example.org/feed2.xml"; } - ]; + { url = "http://example.org/feed2.xml"; } + ]; - queries = { "foo" = ''rssurl =~ "example.com"''; }; - }; - - test.stubs.newsboat = { }; - - nmt.script = '' - assertFileContent \ - home-files/.newsboat/urls \ - ${./newsboat-basics-urls-2003.txt} - ''; + queries = { "foo" = ''rssurl =~ "example.com"''; }; }; + + nmt.script = '' + assertFileContent \ + home-files/.newsboat/urls \ + ${./newsboat-basics-urls-2003.txt} + ''; } diff --git a/tests/modules/programs/newsboat/newsboat-basics-2105.nix b/tests/modules/programs/newsboat/newsboat-basics-2105.nix index ec0f33728..8cc46754b 100644 --- a/tests/modules/programs/newsboat/newsboat-basics-2105.nix +++ b/tests/modules/programs/newsboat/newsboat-basics-2105.nix @@ -1,34 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - home.stateVersion = "21.05"; + home.stateVersion = "21.05"; - programs.newsboat = { - enable = true; + programs.newsboat = { + enable = true; - urls = [ - { - url = "http://example.org/feed.xml"; - tags = [ "tag1" "tag2" ]; - title = "Cool feed"; - } + urls = [ + { + url = "http://example.org/feed.xml"; + tags = [ "tag1" "tag2" ]; + title = "Cool feed"; + } - { url = "http://example.org/feed2.xml"; } - ]; + { url = "http://example.org/feed2.xml"; } + ]; - queries = { "foo" = ''rssurl =~ "example.com"''; }; - }; - - test.stubs.newsboat = { }; - - # The format didn't change since 20.03, just the location. - nmt.script = '' - assertFileContent \ - home-files/.config/newsboat/urls \ - ${./newsboat-basics-urls-2003.txt} - ''; + queries = { "foo" = ''rssurl =~ "example.com"''; }; }; + + # The format didn't change since 20.03, just the location. + nmt.script = '' + assertFileContent \ + home-files/.config/newsboat/urls \ + ${./newsboat-basics-urls-2003.txt} + ''; } diff --git a/tests/modules/programs/newsboat/newsboat-basics.nix b/tests/modules/programs/newsboat/newsboat-basics.nix index fe7f85070..fe417a87a 100644 --- a/tests/modules/programs/newsboat/newsboat-basics.nix +++ b/tests/modules/programs/newsboat/newsboat-basics.nix @@ -1,31 +1,23 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.newsboat = { - enable = true; + programs.newsboat = { + enable = true; - urls = [ - { - url = "http://example.org/feed.xml"; - tags = [ "tag1" "tag2" ]; - title = "Cool feed"; - } + urls = [ + { + url = "http://example.org/feed.xml"; + tags = [ "tag1" "tag2" ]; + title = "Cool feed"; + } - { url = "http://example.org/feed2.xml"; } - ]; + { url = "http://example.org/feed2.xml"; } + ]; - queries = { "foo" = ''rssurl =~ "example.com"''; }; - }; - - test.stubs.newsboat = { }; - - nmt.script = '' - assertFileContent \ - home-files/.newsboat/urls \ - ${./newsboat-basics-urls.txt} - ''; + queries = { "foo" = ''rssurl =~ "example.com"''; }; }; + + nmt.script = '' + assertFileContent \ + home-files/.newsboat/urls \ + ${./newsboat-basics-urls.txt} + ''; } diff --git a/tests/modules/programs/nheko/nheko-empty-settings.nix b/tests/modules/programs/nheko/nheko-empty-settings.nix index 65538d9eb..6979ba1df 100644 --- a/tests/modules/programs/nheko/nheko-empty-settings.nix +++ b/tests/modules/programs/nheko/nheko-empty-settings.nix @@ -8,8 +8,6 @@ let in { programs.nheko.enable = true; - test.stubs.nheko = { }; - nmt.script = '' assertPathNotExists "${configDir}/nheko/nheko.conf" ''; diff --git a/tests/modules/programs/nheko/nheko-example-settings.nix b/tests/modules/programs/nheko/nheko-example-settings.nix index 26599c5a0..4700db2ca 100644 --- a/tests/modules/programs/nheko/nheko-example-settings.nix +++ b/tests/modules/programs/nheko/nheko-example-settings.nix @@ -74,8 +74,6 @@ in { }; }; - test.stubs.nheko = { }; - nmt.script = '' assertFileContent \ "${configDir}/nheko/nheko.conf" \ diff --git a/tests/modules/programs/nix-index/assert-on-command-not-found.nix b/tests/modules/programs/nix-index/assert-on-command-not-found.nix index 94d7efc34..511dd7d0c 100644 --- a/tests/modules/programs/nix-index/assert-on-command-not-found.nix +++ b/tests/modules/programs/nix-index/assert-on-command-not-found.nix @@ -1,31 +1,27 @@ -{ lib, pkgs, ... }: +{ lib, ... }: { - config = { - programs.bash.enable = true; - programs.fish.enable = true; - programs.zsh.enable = true; + programs.bash.enable = true; + programs.fish.enable = true; + programs.zsh.enable = true; - programs.command-not-found.enable = true; + programs.command-not-found.enable = true; - # 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" ""); - test.stubs.zsh = { }; + programs.nix-index.enable = true; - programs.nix-index.enable = true; - - # 'command-not-found' does not have a 'fish' integration - test.asserts.assertions.expected = [ - '' - The 'programs.command-not-found.enable' option is mutually exclusive - with the 'programs.nix-index.enableBashIntegration' option. - '' - '' - The 'programs.command-not-found.enable' option is mutually exclusive - with the 'programs.nix-index.enableZshIntegration' option. - '' - ]; - }; + # 'command-not-found' does not have a 'fish' integration + test.asserts.assertions.expected = [ + '' + The 'programs.command-not-found.enable' option is mutually exclusive + with the 'programs.nix-index.enableBashIntegration' option. + '' + '' + The 'programs.command-not-found.enable' option is mutually exclusive + with the 'programs.nix-index.enableZshIntegration' option. + '' + ]; } diff --git a/tests/modules/programs/nix-index/integrations.nix b/tests/modules/programs/nix-index/integrations.nix index 2fd5253ac..6bcda0502 100644 --- a/tests/modules/programs/nix-index/integrations.nix +++ b/tests/modules/programs/nix-index/integrations.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ lib, ... }: let fishRegex = '' @@ -7,36 +7,32 @@ let end ''; in { - config = { - programs.bash.enable = true; - programs.fish.enable = true; - programs.zsh.enable = true; + programs.bash.enable = true; + programs.fish.enable = true; + programs.zsh.enable = true; - # 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" ""); - test.stubs.zsh = { }; + programs.nix-index.enable = true; - programs.nix-index.enable = true; + nmt.script = '' + # Bash integration + assertFileExists home-files/.bashrc + assertFileRegex \ + home-files/.bashrc \ + 'source @nix-index@/etc/profile.d/command-not-found.sh' - nmt.script = '' - # Bash integration - assertFileExists home-files/.bashrc - assertFileRegex \ - home-files/.bashrc \ - 'source /nix/store/.*nix-index.*/etc/profile.d/command-not-found.sh' + # Zsh integration + assertFileExists home-files/.zshrc + assertFileRegex \ + home-files/.zshrc \ + 'source @nix-index@/etc/profile.d/command-not-found.sh' - # Zsh integration - assertFileExists home-files/.zshrc - assertFileRegex \ - home-files/.zshrc \ - 'source /nix/store/.*nix-index.*/etc/profile.d/command-not-found.sh' - - # Fish integration - assertFileExists home-files/.config/fish/config.fish - assertFileRegex \ - home-files/.config/fish/config.fish '${fishRegex}' - ''; - }; + # Fish integration + assertFileExists home-files/.config/fish/config.fish + assertFileRegex \ + home-files/.config/fish/config.fish '${fishRegex}' + ''; } diff --git a/tests/modules/programs/nix-your-shell/enable-shells.nix b/tests/modules/programs/nix-your-shell/enable-shells.nix index ab8c6909e..8c136da4d 100644 --- a/tests/modules/programs/nix-your-shell/enable-shells.nix +++ b/tests/modules/programs/nix-your-shell/enable-shells.nix @@ -13,12 +13,6 @@ zsh.enable = true; }; - test.stubs = { - nix-your-shell = { }; - nushell = { }; - zsh = { }; - }; - nmt.script = let nushellConfigDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then "home-files/Library/Application Support/nushell" diff --git a/tests/modules/programs/nushell/example-settings.nix b/tests/modules/programs/nushell/example-settings.nix index 9f0108a30..cc9e8f8ec 100644 --- a/tests/modules/programs/nushell/example-settings.nix +++ b/tests/modules/programs/nushell/example-settings.nix @@ -1,8 +1,9 @@ -{ pkgs, config, lib, ... }: +{ pkgs, realPkgs, config, lib, ... }: { programs.nushell = { enable = true; + package = realPkgs.nushell; configFile.text = '' let config = { @@ -23,7 +24,7 @@ } ''; - plugins = [ pkgs.nushellPlugins.formats ]; + plugins = [ realPkgs.nushellPlugins.formats ]; shellAliases = { "ll" = "ls -a"; diff --git a/tests/modules/programs/oh-my-posh/bash.nix b/tests/modules/programs/oh-my-posh/bash.nix index 2e3d93ac3..6818df8c7 100644 --- a/tests/modules/programs/oh-my-posh/bash.nix +++ b/tests/modules/programs/oh-my-posh/bash.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { bash.enable = true; @@ -10,8 +8,6 @@ }; }; - test.stubs.oh-my-posh = { }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/oh-my-posh/fish.nix b/tests/modules/programs/oh-my-posh/fish.nix index 07137b986..9e890db45 100644 --- a/tests/modules/programs/oh-my-posh/fish.nix +++ b/tests/modules/programs/oh-my-posh/fish.nix @@ -14,8 +14,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.oh-my-posh = { }; - nmt.script = '' assertFileExists home-files/.config/fish/config.fish assertFileContains \ diff --git a/tests/modules/programs/oh-my-posh/nushell.nix b/tests/modules/programs/oh-my-posh/nushell.nix index da4ffafd3..2e5079e06 100644 --- a/tests/modules/programs/oh-my-posh/nushell.nix +++ b/tests/modules/programs/oh-my-posh/nushell.nix @@ -10,11 +10,6 @@ }; }; - test.stubs = { - oh-my-posh = { }; - nushell = { }; - }; - nmt.script = let configFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then "home-files/Library/Application Support/nushell/config.nu" diff --git a/tests/modules/programs/oh-my-posh/zsh.nix b/tests/modules/programs/oh-my-posh/zsh.nix index 6d2a5bedb..0353a31e6 100644 --- a/tests/modules/programs/oh-my-posh/zsh.nix +++ b/tests/modules/programs/oh-my-posh/zsh.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { zsh.enable = true; @@ -10,11 +8,6 @@ }; }; - test.stubs = { - oh-my-posh = { }; - zsh = { }; - }; - nmt.script = '' assertFileExists home-files/.zshrc assertFileContains \ diff --git a/tests/modules/programs/openstackclient/openstackclient.nix b/tests/modules/programs/openstackclient/openstackclient.nix index 0c5e1f0bc..48d3d38f8 100644 --- a/tests/modules/programs/openstackclient/openstackclient.nix +++ b/tests/modules/programs/openstackclient/openstackclient.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.openstackclient = { enable = true; @@ -22,8 +20,6 @@ }; - test.stubs.openstackclient = { }; - nmt.script = '' assertFileExists home-files/.config/openstack/clouds.yaml assertFileContent home-files/.config/openstack/clouds.yaml \ diff --git a/tests/modules/programs/pandoc/csl.nix b/tests/modules/programs/pandoc/csl.nix index 7384ec995..e23c53288 100644 --- a/tests/modules/programs/pandoc/csl.nix +++ b/tests/modules/programs/pandoc/csl.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { programs.pandoc = { enable = true; diff --git a/tests/modules/programs/pandoc/defaults.nix b/tests/modules/programs/pandoc/defaults.nix index e9288657b..8e3fe39aa 100644 --- a/tests/modules/programs/pandoc/defaults.nix +++ b/tests/modules/programs/pandoc/defaults.nix @@ -1,30 +1,30 @@ -{ config, lib, ... }: +{ config, lib, realPkgs, ... }: let cfg = config.programs.pandoc; -in { - config = lib.mkIf config.test.enableBig { - programs.pandoc = { - enable = true; +in lib.mkIf config.test.enableBig { + programs.pandoc = { + enable = true; - defaults = { - metadata = { author = "John Doe"; }; - pdf-engine = "xelatex"; - citeproc = true; - }; + defaults = { + metadata = { author = "John Doe"; }; + pdf-engine = "xelatex"; + citeproc = true; }; - - nmt.script = '' - assertFileContent ${cfg.defaultsFile} ${./defaults-expected.json} - - # Test that defaults are set by looking at the metadata for an empty file - # (it should contain the author that we set in defaults). - output=$(mktemp) - ${cfg.finalPackage}/bin/pandoc --standalone \ - -f markdown /dev/null \ - -t native -o "$output" - assertFileContent "$output" ${./output-expected} - ''; }; + + nixpkgs.overlays = [ (_: _: { inherit (realPkgs) pandoc; }) ]; + + nmt.script = '' + assertFileContent ${cfg.defaultsFile} ${./defaults-expected.json} + + # Test that defaults are set by looking at the metadata for an empty file + # (it should contain the author that we set in defaults). + output=$(mktemp) + ${cfg.finalPackage}/bin/pandoc --standalone \ + -f markdown /dev/null \ + -t native -o "$output" + assertFileContent "$output" ${./output-expected} + ''; } diff --git a/tests/modules/programs/pandoc/templates.nix b/tests/modules/programs/pandoc/templates.nix index f276381a3..f72e0b8ae 100644 --- a/tests/modules/programs/pandoc/templates.nix +++ b/tests/modules/programs/pandoc/templates.nix @@ -1,5 +1,3 @@ -{ config, ... }: - { programs.pandoc = { enable = true; diff --git a/tests/modules/programs/papis/papis.nix b/tests/modules/programs/papis/papis.nix index 507056bed..19990633f 100644 --- a/tests/modules/programs/papis/papis.nix +++ b/tests/modules/programs/papis/papis.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.papis = { enable = true; @@ -23,8 +21,6 @@ }; }; - test.stubs.papis = { }; - nmt.script = '' assertFileContent home-files/.config/papis/config \ ${builtins.toFile "papis-expected-settings.ini" '' diff --git a/tests/modules/programs/pay-respects/integration-disabled.nix b/tests/modules/programs/pay-respects/integration-disabled.nix index fa0806d3d..a6453e354 100644 --- a/tests/modules/programs/pay-respects/integration-disabled.nix +++ b/tests/modules/programs/pay-respects/integration-disabled.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ programs = { pay-respects.enable = true; pay-respects.enableBashIntegration = false; @@ -11,12 +11,10 @@ nushell.enable = true; }; - test.stubs.pay-respects = { }; - nmt.script = '' - assertFileNotRegex home-files/.bashrc '@pay-respects@/bin/dummy' - assertFileNotRegex home-files/.zshrc '@pay-respects@/bin/dummy' - assertFileNotRegex home-files/.config/fish/config.fish '@pay-respects@/bin/dummy' - assertFileNotRegex home-files/.config/nushell/config.nu '@pay-respects@/bin/dummy' + assertFileNotRegex home-files/.bashrc '@pay-respects@/bin/pay-respects' + assertFileNotRegex home-files/.zshrc '@pay-respects@/bin/pay-respects' + assertFileNotRegex home-files/.config/fish/config.fish '@pay-respects@/bin/pay-respects' + assertFileNotRegex home-files/.config/nushell/config.nu '@pay-respects@/bin/pay-respects' ''; } diff --git a/tests/modules/programs/pay-respects/integration-enabled.nix b/tests/modules/programs/pay-respects/integration-enabled.nix index d5b3d980c..c76463f2b 100644 --- a/tests/modules/programs/pay-respects/integration-enabled.nix +++ b/tests/modules/programs/pay-respects/integration-enabled.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ programs = { pay-respects.enable = true; bash.enable = true; @@ -7,27 +7,25 @@ nushell.enable = true; }; - test.stubs.pay-respects = { }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ home-files/.bashrc \ - 'eval "$(@pay-respects@/bin/dummy bash --alias)"' + 'eval "$(@pay-respects@/bin/pay-respects bash --alias)"' assertFileExists home-files/.zshrc assertFileContains \ home-files/.zshrc \ - 'eval "$(@pay-respects@/bin/dummy zsh --alias)"' + 'eval "$(@pay-respects@/bin/pay-respects zsh --alias)"' assertFileExists home-files/.config/fish/config.fish assertFileContains \ home-files/.config/fish/config.fish \ - '@pay-respects@/bin/dummy fish --alias | source' + '@pay-respects@/bin/pay-respects fish --alias | source' assertFileExists home-files/.config/nushell/config.nu assertFileContains \ home-files/.config/nushell/config.nu \ - '@pay-respects@/bin/dummy nushell --alias []' + '@pay-respects@/bin/pay-respects nushell --alias []' ''; } diff --git a/tests/modules/programs/pet/settings_21_05.nix b/tests/modules/programs/pet/settings_21_05.nix index cf7285487..595737600 100644 --- a/tests/modules/programs/pet/settings_21_05.nix +++ b/tests/modules/programs/pet/settings_21_05.nix @@ -1,17 +1,10 @@ -{ config, lib, pkgs, ... }: - -with lib; - { home.stateVersion = "21.05"; programs.pet = { enable = true; - selectcmdPackage = config.lib.test.mkStubPackage { }; settings.editor = "nvim"; }; - test.stubs.pet = { }; - nmt.script = '' assertFileContent home-files/.config/pet/config.toml \ ${ diff --git a/tests/modules/programs/pet/settings_21_11.nix b/tests/modules/programs/pet/settings_21_11.nix index 0b82d1f37..05bdc2449 100644 --- a/tests/modules/programs/pet/settings_21_11.nix +++ b/tests/modules/programs/pet/settings_21_11.nix @@ -1,12 +1,7 @@ -{ config, lib, pkgs, ... }: - -with lib; - { home.stateVersion = "21.11"; programs.pet = { enable = true; - selectcmdPackage = config.lib.test.mkStubPackage { }; settings = { General = { backend = "Gitlab"; @@ -20,8 +15,6 @@ with lib; }; }; - test.stubs.pet = { }; - nmt.script = '' assertFileContent home-files/.config/pet/config.toml \ ${ diff --git a/tests/modules/programs/pet/snippets.nix b/tests/modules/programs/pet/snippets.nix index 6713b4f16..09dbd17d0 100644 --- a/tests/modules/programs/pet/snippets.nix +++ b/tests/modules/programs/pet/snippets.nix @@ -1,29 +1,14 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.pet = { - enable = true; - selectcmdPackage = pkgs.writeScriptBin "pet-cmd" "" // { - outPath = "@pet-cmd@"; - }; - snippets = [{ - description = "git: search full history for regex"; - command = "git log -p -G "; - tag = [ "git" "regex" ]; - }]; - }; - - nixpkgs.overlays = [ - (self: super: { - pet = pkgs.writeScriptBin "pet" "" // { outPath = "@pet@"; }; - }) - ]; - - nmt.script = '' - assertFileContent home-files/.config/pet/snippet.toml ${./snippet.toml} - ''; + programs.pet = { + enable = true; + snippets = [{ + description = "git: search full history for regex"; + command = "git log -p -G "; + tag = [ "git" "regex" ]; + }]; }; + + nmt.script = '' + assertFileContent home-files/.config/pet/snippet.toml ${./snippet.toml} + ''; } diff --git a/tests/modules/programs/pistol/associations.nix b/tests/modules/programs/pistol/associations.nix index 764060ba9..29158a489 100644 --- a/tests/modules/programs/pistol/associations.nix +++ b/tests/modules/programs/pistol/associations.nix @@ -20,8 +20,6 @@ ]; }; - test.stubs.pistol = { }; - nmt.script = let expected = builtins.toFile "config-expected" '' application/json bat %pistol-filename% diff --git a/tests/modules/programs/pistol/config.nix b/tests/modules/programs/pistol/config.nix index 1999befa6..8df524a3a 100644 --- a/tests/modules/programs/pistol/config.nix +++ b/tests/modules/programs/pistol/config.nix @@ -9,8 +9,6 @@ }; }; - test.stubs.pistol = { }; - test.asserts.assertions.expected = [ (let offendingFile = toString ./config.nix; in '' diff --git a/tests/modules/programs/pistol/double-association.nix b/tests/modules/programs/pistol/double-association.nix index 103f4d057..902c5c4aa 100644 --- a/tests/modules/programs/pistol/double-association.nix +++ b/tests/modules/programs/pistol/double-association.nix @@ -9,8 +9,6 @@ }]; }; - test.stubs.pistol = { }; - test.asserts.assertions.expected = ['' Each entry in programs.pistol.associations must contain exactly one of fpath or mime. diff --git a/tests/modules/programs/pistol/missing-association.nix b/tests/modules/programs/pistol/missing-association.nix index 6ea0a4486..ff47a2381 100644 --- a/tests/modules/programs/pistol/missing-association.nix +++ b/tests/modules/programs/pistol/missing-association.nix @@ -5,8 +5,6 @@ associations = [{ command = "bat %pistol-filename%"; }]; }; - test.stubs.pistol = { }; - test.asserts.assertions.expected = ['' Each entry in programs.pistol.associations must contain exactly one of fpath or mime. diff --git a/tests/modules/programs/pls/bash.nix b/tests/modules/programs/pls/bash.nix index dc1743997..2d3177a40 100644 --- a/tests/modules/programs/pls/bash.nix +++ b/tests/modules/programs/pls/bash.nix @@ -1,29 +1,20 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - bash.enable = true; + programs = { + bash.enable = true; - pls = { - enable = true; - enableAliases = true; - package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; - }; + pls = { + enable = true; + enableAliases = true; }; - - test.stubs.pls = { }; - - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileContains \ - home-files/.bashrc \ - "alias ls=@pls@/bin/pls" - assertFileContains \ - home-files/.bashrc \ - "alias ll='@pls@/bin/pls -d perm -d user -d group -d size -d mtime -d git'" - ''; }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + "alias ls=@pls@/bin/pls" + assertFileContains \ + home-files/.bashrc \ + "alias ll='@pls@/bin/pls -d perm -d user -d group -d size -d mtime -d git'" + ''; } diff --git a/tests/modules/programs/pls/fish.nix b/tests/modules/programs/pls/fish.nix index c745cd768..869feaf8c 100644 --- a/tests/modules/programs/pls/fish.nix +++ b/tests/modules/programs/pls/fish.nix @@ -1,33 +1,27 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, lib, ... }: { - config = { - programs = { - fish.enable = true; + programs = { + fish.enable = true; - pls = { - enable = true; - enableAliases = true; - package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; - }; + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; }; - - # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - mkForce (builtins.toFile "empty" ""); - - test.stubs.pls = { }; - - nmt.script = '' - assertFileExists home-files/.config/fish/config.fish - assertFileContains \ - home-files/.config/fish/config.fish \ - "alias ls @pls@/bin/pls" - assertFileContains \ - home-files/.config/fish/config.fish \ - "alias ll '@pls@/bin/pls -d perm -d user -d group -d size -d mtime -d git'" - ''; }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + "alias ls @pls@/bin/pls" + assertFileContains \ + home-files/.config/fish/config.fish \ + "alias ll '@pls@/bin/pls -d perm -d user -d group -d size -d mtime -d git'" + ''; } diff --git a/tests/modules/programs/pls/zsh.nix b/tests/modules/programs/pls/zsh.nix index bbe68abb5..40e5f1878 100644 --- a/tests/modules/programs/pls/zsh.nix +++ b/tests/modules/programs/pls/zsh.nix @@ -1,32 +1,23 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs = { - zsh.enable = true; + programs = { + zsh.enable = true; - pls = { - enable = true; - enableAliases = true; - package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; - }; + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; }; - - test.stubs = { - pls = { }; - zsh = { }; - }; - - nmt.script = '' - assertFileExists home-files/.zshrc - assertFileContains \ - home-files/.zshrc \ - "alias -- ls=@pls@/bin/pls" - assertFileContains \ - home-files/.zshrc \ - "alias -- ll='@pls@/bin/pls -d perm -d user -d group -d size -d mtime -d git'" - ''; }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + "alias -- ls=@pls@/bin/pls" + assertFileContains \ + home-files/.zshrc \ + "alias -- ll='@pls@/bin/pls -d perm -d user -d group -d size -d mtime -d git'" + ''; } diff --git a/tests/modules/programs/poetry/custom-settings.nix b/tests/modules/programs/poetry/custom-settings.nix index fc9793067..376f8bf1f 100644 --- a/tests/modules/programs/poetry/custom-settings.nix +++ b/tests/modules/programs/poetry/custom-settings.nix @@ -9,8 +9,6 @@ }; }; - test.stubs.poetry = { }; - nmt.script = let expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; diff --git a/tests/modules/programs/poetry/default-settings.nix b/tests/modules/programs/poetry/default-settings.nix index 145cf18ad..31d910047 100644 --- a/tests/modules/programs/poetry/default-settings.nix +++ b/tests/modules/programs/poetry/default-settings.nix @@ -3,8 +3,6 @@ { programs.poetry = { enable = true; }; - test.stubs.poetry = { }; - nmt.script = let expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; diff --git a/tests/modules/programs/powerline-go/bash.nix b/tests/modules/programs/powerline-go/bash.nix index a48e16fe0..bab8b38d3 100644 --- a/tests/modules/programs/powerline-go/bash.nix +++ b/tests/modules/programs/powerline-go/bash.nix @@ -1,33 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - bash.enable = true; + programs = { + bash.enable = true; - powerline-go = { - enable = true; - newline = true; - modules = [ "nix-shell" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; - settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; - }; + powerline-go = { + enable = true; + newline = true; + modules = [ "nix-shell" ]; + pathAliases = { "\\~/project/foo" = "prj-foo"; }; + settings = { + ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; }; }; - - test.stubs.powerline-go = { }; - - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileContains \ - home-files/.bashrc \ - 'PS1=' - assertFileContains \ - home-files/.bashrc \ - '/bin/powerline-go -error $old_exit_status -shell bash -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' - ''; }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + 'PS1=' + assertFileContains \ + home-files/.bashrc \ + '/bin/powerline-go -error $old_exit_status -shell bash -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' + ''; } diff --git a/tests/modules/programs/powerline-go/bashmodulesright.nix b/tests/modules/programs/powerline-go/bashmodulesright.nix index 688c0fad7..6b7c2e3d3 100644 --- a/tests/modules/programs/powerline-go/bashmodulesright.nix +++ b/tests/modules/programs/powerline-go/bashmodulesright.nix @@ -1,34 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - bash.enable = true; + programs = { + bash.enable = true; - powerline-go = { - enable = true; - newline = true; - modules = [ "nix-shell" ]; - modulesRight = [ "git" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; - settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; - }; + powerline-go = { + enable = true; + newline = true; + modules = [ "nix-shell" ]; + modulesRight = [ "git" ]; + pathAliases = { "\\~/project/foo" = "prj-foo"; }; + settings = { + ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; }; }; - - test.stubs.powerline-go = { }; - - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileContains \ - home-files/.bashrc \ - 'eval' - assertFileContains \ - home-files/.bashrc \ - '/bin/powerline-go -error $old_exit_status -shell bash -eval -modules nix-shell -modules-right git -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' - ''; }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + 'eval' + assertFileContains \ + home-files/.bashrc \ + '/bin/powerline-go -error $old_exit_status -shell bash -eval -modules nix-shell -modules-right git -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' + ''; } diff --git a/tests/modules/programs/powerline-go/fish.nix b/tests/modules/programs/powerline-go/fish.nix index 4861d1ba1..f7749c2aa 100644 --- a/tests/modules/programs/powerline-go/fish.nix +++ b/tests/modules/programs/powerline-go/fish.nix @@ -1,34 +1,28 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ lib, ... }: { - config = { - programs = { - fish.enable = true; + programs = { + fish.enable = true; - powerline-go = { - enable = true; - newline = true; - modules = [ "nix-shell" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; - settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; - }; + powerline-go = { + enable = true; + newline = true; + modules = [ "nix-shell" ]; + pathAliases = { "\\~/project/foo" = "prj-foo"; }; + settings = { + ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; }; }; - - # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - mkForce (builtins.toFile "empty" ""); - - test.stubs.powerline-go = { }; - - nmt.script = '' - assertFileExists home-files/.config/fish/config.fish - assertFileContains \ - home-files/.config/fish/config.fish \ - '/bin/powerline-go -error $status -jobs (count (jobs -p)) -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' - ''; }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + '/bin/powerline-go -error $status -jobs (count (jobs -p)) -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' + ''; } diff --git a/tests/modules/programs/powerline-go/zsh.nix b/tests/modules/programs/powerline-go/zsh.nix index 21856e9d1..66845dd53 100644 --- a/tests/modules/programs/powerline-go/zsh.nix +++ b/tests/modules/programs/powerline-go/zsh.nix @@ -1,36 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - zsh.enable = true; + programs = { + zsh.enable = true; - powerline-go = { - enable = true; - newline = true; - modules = [ "nix-shell" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; - settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; - }; + powerline-go = { + enable = true; + newline = true; + modules = [ "nix-shell" ]; + pathAliases = { "\\~/project/foo" = "prj-foo"; }; + settings = { + ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; }; }; - - test.stubs = { - powerline-go = { }; - zsh = { }; - }; - - nmt.script = '' - assertFileExists home-files/.zshrc - assertFileContains \ - home-files/.zshrc \ - 'PS1=' - assertFileContains \ - home-files/.zshrc \ - '/bin/powerline-go -error $? -shell zsh -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' - ''; }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + 'PS1=' + assertFileContains \ + home-files/.zshrc \ + '/bin/powerline-go -error $? -shell zsh -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' + ''; } diff --git a/tests/modules/programs/powerline-go/zshmodulesright.nix b/tests/modules/programs/powerline-go/zshmodulesright.nix index ffe2e1d28..acd43b6fa 100644 --- a/tests/modules/programs/powerline-go/zshmodulesright.nix +++ b/tests/modules/programs/powerline-go/zshmodulesright.nix @@ -1,37 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - zsh.enable = true; + programs = { + zsh.enable = true; - powerline-go = { - enable = true; - newline = true; - modules = [ "nix-shell" ]; - modulesRight = [ "git" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; - settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; - }; + powerline-go = { + enable = true; + newline = true; + modules = [ "nix-shell" ]; + modulesRight = [ "git" ]; + pathAliases = { "\\~/project/foo" = "prj-foo"; }; + settings = { + ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; }; }; - - test.stubs = { - powerline-go = { }; - zsh = { }; - }; - - nmt.script = '' - assertFileExists home-files/.zshrc - assertFileContains \ - home-files/.zshrc \ - 'eval' - assertFileContains \ - home-files/.zshrc \ - '/bin/powerline-go -error $? -shell zsh -eval -modules nix-shell -modules-right git -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' - ''; }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + 'eval' + assertFileContains \ + home-files/.zshrc \ + '/bin/powerline-go -error $? -shell zsh -eval -modules nix-shell -modules-right git -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2' + ''; } diff --git a/tests/modules/programs/pubs/pubs-example-settings.nix b/tests/modules/programs/pubs/pubs-example-settings.nix index 59f228009..773075d76 100644 --- a/tests/modules/programs/pubs/pubs-example-settings.nix +++ b/tests/modules/programs/pubs/pubs-example-settings.nix @@ -1,5 +1,3 @@ -{ config, lib, pkgs, ... }: - { programs.pubs = { enable = true; @@ -27,8 +25,6 @@ ''; }; - test.stubs.pubs = { }; - nmt.script = '' assertFileContent \ home-files/.pubsrc ${./pubs-example-settings-expected-pubsrc} diff --git a/tests/modules/programs/pyenv/bash.nix b/tests/modules/programs/pyenv/bash.nix index ac6a8f0c1..4ef778a3b 100644 --- a/tests/modules/programs/pyenv/bash.nix +++ b/tests/modules/programs/pyenv/bash.nix @@ -1,13 +1,9 @@ -{ ... }: - { programs = { bash.enable = true; pyenv.enable = true; }; - test.stubs.pyenv = { name = "pyenv"; }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/pyenv/fish.nix b/tests/modules/programs/pyenv/fish.nix index 41b4911bb..f3628c666 100644 --- a/tests/modules/programs/pyenv/fish.nix +++ b/tests/modules/programs/pyenv/fish.nix @@ -1,13 +1,9 @@ -{ ... }: - { programs = { fish.enable = true; pyenv.enable = true; }; - test.stubs.pyenv = { name = "pyenv"; }; - nmt.script = '' assertFileExists home-files/.config/fish/config.fish assertFileContains \ diff --git a/tests/modules/programs/pyenv/zsh.nix b/tests/modules/programs/pyenv/zsh.nix index da029fc2c..f36905300 100644 --- a/tests/modules/programs/pyenv/zsh.nix +++ b/tests/modules/programs/pyenv/zsh.nix @@ -1,13 +1,9 @@ -{ ... }: - { programs = { zsh.enable = true; pyenv.enable = true; }; - test.stubs.pyenv = { name = "pyenv"; }; - nmt.script = '' assertFileExists home-files/.zshrc assertFileContains \ diff --git a/tests/modules/programs/qcal/http-calendar.nix b/tests/modules/programs/qcal/http-calendar.nix index c32440601..bc5200ce2 100644 --- a/tests/modules/programs/qcal/http-calendar.nix +++ b/tests/modules/programs/qcal/http-calendar.nix @@ -1,5 +1,3 @@ -{ pkgs, lib, ... }: - { programs.qcal.enable = true; accounts.calendar.accounts.test = { @@ -7,8 +5,6 @@ remote = { url = "https://example.com/events.ical"; }; }; - test.stubs = { qcal = { }; }; - nmt.script = '' assertFileExists home-files/.config/qcal/config.json assertFileContent home-files/.config/qcal/config.json ${ diff --git a/tests/modules/programs/qcal/mixed.nix b/tests/modules/programs/qcal/mixed.nix index d2241bdcb..0083d7945 100644 --- a/tests/modules/programs/qcal/mixed.nix +++ b/tests/modules/programs/qcal/mixed.nix @@ -1,5 +1,3 @@ -{ pkgs, lib, ... }: - { programs.qcal.enable = true; accounts.calendar.accounts = { @@ -17,8 +15,6 @@ }; }; - test.stubs = { qcal = { }; }; - nmt.script = '' assertFileExists home-files/.config/qcal/config.json assertFileContent home-files/.config/qcal/config.json ${ diff --git a/tests/modules/programs/qcal/webdav-calendar.nix b/tests/modules/programs/qcal/webdav-calendar.nix index caefe1f16..9cfe5d32a 100644 --- a/tests/modules/programs/qcal/webdav-calendar.nix +++ b/tests/modules/programs/qcal/webdav-calendar.nix @@ -1,5 +1,3 @@ -{ pkgs, lib, ... }: - { programs.qcal = { enable = true; @@ -15,8 +13,6 @@ }; }; - test.stubs = { qcal = { }; }; - nmt.script = '' assertFileExists home-files/.config/qcal/config.json assertFileContent home-files/.config/qcal/config.json ${ diff --git a/tests/modules/programs/qutebrowser/greasemonkey.nix b/tests/modules/programs/qutebrowser/greasemonkey.nix index d6e8713c7..9377a3951 100644 --- a/tests/modules/programs/qutebrowser/greasemonkey.nix +++ b/tests/modules/programs/qutebrowser/greasemonkey.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: let @@ -19,8 +17,6 @@ in { greasemonkey = [ greasemonkeyScript ]; }; - test.stubs.qutebrowser = { }; - nmt.script = let scriptDir = if pkgs.stdenv.hostPlatform.isDarwin then ".qutebrowser/greasemonkey" diff --git a/tests/modules/programs/qutebrowser/keybindings.nix b/tests/modules/programs/qutebrowser/keybindings.nix index 37ccfeba3..0e1400fde 100644 --- a/tests/modules/programs/qutebrowser/keybindings.nix +++ b/tests/modules/programs/qutebrowser/keybindings.nix @@ -21,8 +21,6 @@ }; }; - test.stubs.qutebrowser = { }; - nmt.script = let qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then ".qutebrowser/config.py" @@ -32,7 +30,7 @@ assertFileContent \ home-files/${qutebrowserConfig} \ ${ - pkgs.writeText "qutebrowser-expected-config.py" '' + builtins.toFile "qutebrowser-expected-config.py" '' config.load_autoconfig(False) c.bindings.default = {} config.bind(",l", "config-cycle spellcheck.languages [\"en-GB\"] [\"en-US\"]", mode="normal") diff --git a/tests/modules/programs/qutebrowser/quickmarks.nix b/tests/modules/programs/qutebrowser/quickmarks.nix index 9437fc614..524808c51 100644 --- a/tests/modules/programs/qutebrowser/quickmarks.nix +++ b/tests/modules/programs/qutebrowser/quickmarks.nix @@ -10,8 +10,6 @@ }; }; - test.stubs.qutebrowser = { }; - nmt.script = let quickmarksFile = if pkgs.stdenv.hostPlatform.isDarwin then ".qutebrowser/quickmarks" @@ -21,7 +19,7 @@ assertFileContent \ home-files/${quickmarksFile} \ ${ - pkgs.writeText "qutebrowser-expected-quickmarks" '' + builtins.toFile "qutebrowser-expected-quickmarks" '' home-manager https://github.com/nix-community/home-manager nixpkgs https://github.com/NixOS/nixpkgs'' } diff --git a/tests/modules/programs/qutebrowser/settings.nix b/tests/modules/programs/qutebrowser/settings.nix index e2cf3915f..91a07132a 100644 --- a/tests/modules/programs/qutebrowser/settings.nix +++ b/tests/modules/programs/qutebrowser/settings.nix @@ -21,8 +21,6 @@ ''; }; - test.stubs.qutebrowser = { }; - nmt.script = let qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then ".qutebrowser/config.py" @@ -32,7 +30,7 @@ assertFileContent \ home-files/${qutebrowserConfig} \ ${ - pkgs.writeText "qutebrowser-expected-config.py" '' + builtins.toFile "qutebrowser-expected-config.py" '' config.load_autoconfig(False) c.colors.hints.bg = "#000000" c.colors.hints.fg = "#ffffff" diff --git a/tests/modules/programs/ranger/configuration.nix b/tests/modules/programs/ranger/configuration.nix index 90541ac32..a9328a358 100644 --- a/tests/modules/programs/ranger/configuration.nix +++ b/tests/modules/programs/ranger/configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.ranger = { enable = true; @@ -31,8 +29,6 @@ ]; }; - test.stubs = { ranger = { }; }; - nmt.script = '' assertFileExists home-files/.config/ranger/rc.conf assertFileContent home-files/.config/ranger/rc.conf \ diff --git a/tests/modules/programs/rbw/empty-settings.nix b/tests/modules/programs/rbw/empty-settings.nix index aa25c876c..53b12fd7d 100644 --- a/tests/modules/programs/rbw/empty-settings.nix +++ b/tests/modules/programs/rbw/empty-settings.nix @@ -8,8 +8,6 @@ let else ".config/rbw/config.json"; in { - imports = [ ./rbw-stubs.nix ]; - programs.rbw.enable = true; nmt.script = '' diff --git a/tests/modules/programs/rbw/rbw-stubs.nix b/tests/modules/programs/rbw/rbw-stubs.nix deleted file mode 100644 index 77436232d..000000000 --- a/tests/modules/programs/rbw/rbw-stubs.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, ... }: - -{ - test.stubs.rbw = { }; - - nixpkgs.overlays = [ - (self: super: { - pinentry-gnome3 = - config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; }; - }) - ]; -} diff --git a/tests/modules/programs/rbw/settings.nix b/tests/modules/programs/rbw/settings.nix index ac5820186..5890fd9ac 100644 --- a/tests/modules/programs/rbw/settings.nix +++ b/tests/modules/programs/rbw/settings.nix @@ -8,18 +8,16 @@ let else ".config/rbw/config.json"; - expected = pkgs.writeText "rbw-expected.json" '' + expected = builtins.toFile "rbw-expected.json" '' { "base_url": "bitwarden.example.com", "email": "name@example.com", "identity_url": "identity.example.com", "lock_timeout": 300, - "pinentry": "@pinentry-gnome3@/bin/dummy" + "pinentry": "@pinentry-gnome3@/bin/pinentry" } ''; in { - imports = [ ./rbw-stubs.nix ]; - programs.rbw = { enable = true; settings = { diff --git a/tests/modules/programs/rbw/simple-settings.nix b/tests/modules/programs/rbw/simple-settings.nix index b690659a9..dbd05da24 100644 --- a/tests/modules/programs/rbw/simple-settings.nix +++ b/tests/modules/programs/rbw/simple-settings.nix @@ -8,7 +8,7 @@ let else ".config/rbw/config.json"; - expected = pkgs.writeText "rbw-expected.json" '' + expected = builtins.toFile "rbw-expected.json" '' { "base_url": null, "email": "name@example.com", @@ -18,8 +18,6 @@ let } ''; in { - imports = [ ./rbw-stubs.nix ]; - programs.rbw = { enable = true; settings = { email = "name@example.com"; }; diff --git a/tests/modules/programs/rio/empty-settings.nix b/tests/modules/programs/rio/empty-settings.nix index 064fc98fa..e89374d1f 100644 --- a/tests/modules/programs/rio/empty-settings.nix +++ b/tests/modules/programs/rio/empty-settings.nix @@ -1,10 +1,6 @@ -_: - { programs.rio.enable = true; - test.stubs.rio = { }; - nmt.script = '' assertPathNotExists home-files/.config/rio ''; diff --git a/tests/modules/programs/rio/example-settings.nix b/tests/modules/programs/rio/example-settings.nix index 68fec3577..48428556b 100644 --- a/tests/modules/programs/rio/example-settings.nix +++ b/tests/modules/programs/rio/example-settings.nix @@ -1,7 +1,7 @@ -{ config, pkgs, ... }: +{ config, ... }: let - expected = pkgs.writeText "rio-expected.toml" '' + expected = builtins.toFile "rio-expected.toml" '' cursor = "_" padding-x = 0 performance = "Low" diff --git a/tests/modules/programs/rofi-pass/rofi-pass-config.nix b/tests/modules/programs/rofi-pass/rofi-pass-config.nix index 2028e840e..8e5e3592d 100644 --- a/tests/modules/programs/rofi-pass/rofi-pass-config.nix +++ b/tests/modules/programs/rofi-pass/rofi-pass-config.nix @@ -1,36 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.rofi = { - enable = true; + programs.rofi = { + enable = true; - pass = { - enable = true; - extraConfig = '' + pass = { + enable = true; + extraConfig = '' + # Extra config for rofi-pass + xdotool_delay=12 + ''; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/rofi-pass/config \ + ${ + builtins.toFile "rofi-pass-expected-config" '' # Extra config for rofi-pass xdotool_delay=12 - ''; - }; - }; - test.stubs = { - rofi = { }; - rofi-pass = { }; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/rofi-pass/config \ - ${ - pkgs.writeText "rofi-pass-expected-config" '' - # Extra config for rofi-pass - xdotool_delay=12 - - '' - } - ''; - }; + '' + } + ''; } diff --git a/tests/modules/programs/rofi-pass/rofi-pass-root.nix b/tests/modules/programs/rofi-pass/rofi-pass-root.nix index 300e89db9..1455b689c 100644 --- a/tests/modules/programs/rofi-pass/rofi-pass-root.nix +++ b/tests/modules/programs/rofi-pass/rofi-pass-root.nix @@ -1,31 +1,20 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.rofi = { + programs.rofi = { + enable = true; + + pass = { enable = true; - - pass = { - enable = true; - stores = [ "~/.local/share/password-store" ]; - }; + stores = [ "~/.local/share/password-store" ]; }; - - test.stubs = { - rofi = { }; - rofi-pass = { }; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/rofi-pass/config \ - ${ - pkgs.writeText "rofi-pass-expected-config" '' - root=~/.local/share/password-store - '' - } - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/rofi-pass/config \ + ${ + builtins.toFile "rofi-pass-expected-config" '' + root=~/.local/share/password-store + '' + } + ''; } diff --git a/tests/modules/programs/rofi/config-with-deprecated-options.nix b/tests/modules/programs/rofi/config-with-deprecated-options.nix index b77c5ac9c..9cc3f281e 100644 --- a/tests/modules/programs/rofi/config-with-deprecated-options.nix +++ b/tests/modules/programs/rofi/config-with-deprecated-options.nix @@ -1,12 +1,9 @@ -{ ... }: - { programs.rofi = { enable = true; colors = { }; }; - test.stubs.rofi = { }; test.asserts.assertions.expected = [ (let offendingFile = toString ./config-with-deprecated-options.nix; in '' diff --git a/tests/modules/programs/rofi/custom-theme.nix b/tests/modules/programs/rofi/custom-theme.nix index 99c9a9896..04890078a 100644 --- a/tests/modules/programs/rofi/custom-theme.nix +++ b/tests/modules/programs/rofi/custom-theme.nix @@ -1,43 +1,37 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { - config = { - programs.rofi = { - enable = true; + programs.rofi = { + enable = true; - theme = let inherit (config.lib.formats.rasi) mkLiteral; - in { - "@import" = "~/.cache/wal/colors-rofi-dark"; + theme = let inherit (config.lib.formats.rasi) mkLiteral; + in { + "@import" = "~/.cache/wal/colors-rofi-dark"; - "*" = { - background-color = mkLiteral "#000000"; - foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )"; - border-color = mkLiteral "#FFFFFF"; - width = 512; - }; + "*" = { + background-color = mkLiteral "#000000"; + foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )"; + border-color = mkLiteral "#FFFFFF"; + width = 512; + }; - "#inputbar" = { children = map mkLiteral [ "prompt" "entry" ]; }; + "#inputbar" = { children = map mkLiteral [ "prompt" "entry" ]; }; - "#textbox-prompt-colon" = { - expand = false; - str = ":"; - margin = mkLiteral "0px 0.3em 0em 0em"; - text-color = mkLiteral "@foreground-color"; - }; + "#textbox-prompt-colon" = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral "@foreground-color"; }; }; - - test.stubs.rofi = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/rofi/config.rasi \ - ${./custom-theme-config.rasi} - assertFileContent \ - home-files/.local/share/rofi/themes/custom.rasi \ - ${./custom-theme.rasi} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/rofi/config.rasi \ + ${./custom-theme-config.rasi} + assertFileContent \ + home-files/.local/share/rofi/themes/custom.rasi \ + ${./custom-theme.rasi} + ''; } diff --git a/tests/modules/programs/rofi/valid-config.nix b/tests/modules/programs/rofi/valid-config.nix index c581c0efd..538d1c422 100644 --- a/tests/modules/programs/rofi/valid-config.nix +++ b/tests/modules/programs/rofi/valid-config.nix @@ -1,32 +1,24 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.rofi = { - enable = true; - font = "Droid Sans Mono 14"; - terminal = "/some/path"; - cycle = false; - window = { - background = "background"; - border = "border"; - separator = "separator"; - }; - extraConfig = { - modi = "drun,emoji,ssh"; - kb-primary-paste = "Control+V,Shift+Insert"; - kb-secondary-paste = "Control+v,Insert"; - }; + programs.rofi = { + enable = true; + font = "Droid Sans Mono 14"; + terminal = "/some/path"; + cycle = false; + window = { + background = "background"; + border = "border"; + separator = "separator"; + }; + extraConfig = { + modi = "drun,emoji,ssh"; + kb-primary-paste = "Control+V,Shift+Insert"; + kb-secondary-paste = "Control+v,Insert"; }; - - test.stubs.rofi = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/rofi/config.rasi \ - ${./valid-config-expected.rasi} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/rofi/config.rasi \ + ${./valid-config-expected.rasi} + ''; } diff --git a/tests/modules/programs/ruff/ruff.nix b/tests/modules/programs/ruff/ruff.nix index 26654d550..895719e84 100644 --- a/tests/modules/programs/ruff/ruff.nix +++ b/tests/modules/programs/ruff/ruff.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.ruff = { enable = true; @@ -14,8 +12,6 @@ }; }; - test.stubs.ruff = { }; - nmt.script = '' assertFileExists home-files/.config/ruff/ruff.toml assertFileContent home-files/.config/ruff/ruff.toml ${./expected.toml} diff --git a/tests/modules/programs/sagemath/sagemath.nix b/tests/modules/programs/sagemath/sagemath.nix index 2f30ac502..5aba153b2 100644 --- a/tests/modules/programs/sagemath/sagemath.nix +++ b/tests/modules/programs/sagemath/sagemath.nix @@ -10,8 +10,6 @@ ''; }; - test.stubs.sage = { }; - nmt.script = '' assertFileExists home-files/.config/sage/init.sage assertFileContent home-files/.config/sage/init.sage \ diff --git a/tests/modules/programs/sapling/sapling-basic.nix b/tests/modules/programs/sapling/sapling-basic.nix index 6f5caabf5..a893f9a4b 100644 --- a/tests/modules/programs/sapling/sapling-basic.nix +++ b/tests/modules/programs/sapling/sapling-basic.nix @@ -7,8 +7,6 @@ userEmail = "johndoe@example.com"; }; - test.stubs.sapling = { }; - nmt.script = let configfile = if pkgs.stdenv.isDarwin then "Library/Preferences/sapling/sapling.conf" diff --git a/tests/modules/programs/sapling/sapling-most.nix b/tests/modules/programs/sapling/sapling-most.nix index 7280e21ec..17916ee93 100644 --- a/tests/modules/programs/sapling/sapling-most.nix +++ b/tests/modules/programs/sapling/sapling-most.nix @@ -17,8 +17,6 @@ }; }; - test.stubs.sapling = { }; - nmt.script = let configfile = if pkgs.stdenv.isDarwin then "Library/Preferences/sapling/sapling.conf" diff --git a/tests/modules/programs/sbt/credentials.nix b/tests/modules/programs/sbt/credentials.nix index 1a79582ab..78bd3a1f2 100644 --- a/tests/modules/programs/sbt/credentials.nix +++ b/tests/modules/programs/sbt/credentials.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: let credentials = [ diff --git a/tests/modules/programs/sbt/deprecated-options.nix b/tests/modules/programs/sbt/deprecated-options.nix index c760354a4..6a16b52bd 100644 --- a/tests/modules/programs/sbt/deprecated-options.nix +++ b/tests/modules/programs/sbt/deprecated-options.nix @@ -1,13 +1,9 @@ -{ ... }: - { programs.sbt = { enable = true; baseConfigPath = "gone"; }; - test.stubs.sbt = { }; - test.asserts.assertions.expected = [ (let offendingFile = toString ./deprecated-options.nix; in '' diff --git a/tests/modules/programs/sbt/plugins.nix b/tests/modules/programs/sbt/plugins.nix index c898ad465..02e46d56e 100644 --- a/tests/modules/programs/sbt/plugins.nix +++ b/tests/modules/programs/sbt/plugins.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: let dependencyGraph = { diff --git a/tests/modules/programs/sbt/user-config-path.nix b/tests/modules/programs/sbt/user-config-path.nix index ef7c2ca8a..799d77dcf 100644 --- a/tests/modules/programs/sbt/user-config-path.nix +++ b/tests/modules/programs/sbt/user-config-path.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: let plugins = [{ diff --git a/tests/modules/programs/scmpuff/bash.nix b/tests/modules/programs/scmpuff/bash.nix index 8f97caa6f..4ec732cbb 100644 --- a/tests/modules/programs/scmpuff/bash.nix +++ b/tests/modules/programs/scmpuff/bash.nix @@ -1,13 +1,9 @@ -{ ... }: - { programs = { scmpuff.enable = true; bash.enable = true; }; - test.stubs.scmpuff = { }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/scmpuff/fish.nix b/tests/modules/programs/scmpuff/fish.nix index a1abbffa3..5f44308d2 100644 --- a/tests/modules/programs/scmpuff/fish.nix +++ b/tests/modules/programs/scmpuff/fish.nix @@ -10,8 +10,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.scmpuff = { }; - nmt.script = '' assertFileExists home-files/.config/fish/config.fish assertFileContains \ diff --git a/tests/modules/programs/scmpuff/no-aliases.nix b/tests/modules/programs/scmpuff/no-aliases.nix index 0636c8791..511e12f54 100644 --- a/tests/modules/programs/scmpuff/no-aliases.nix +++ b/tests/modules/programs/scmpuff/no-aliases.nix @@ -13,8 +13,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.scmpuff = { }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/scmpuff/no-bash.nix b/tests/modules/programs/scmpuff/no-bash.nix index 5594738ae..8a656e5f8 100644 --- a/tests/modules/programs/scmpuff/no-bash.nix +++ b/tests/modules/programs/scmpuff/no-bash.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { scmpuff = { @@ -9,8 +7,6 @@ bash.enable = true; }; - test.stubs.scmpuff = { }; - nmt.script = '' assertFileNotRegex home-files/.bashrc '@scmpuff@' ''; diff --git a/tests/modules/programs/scmpuff/no-fish.nix b/tests/modules/programs/scmpuff/no-fish.nix index 977b8fd3a..f954d1c36 100644 --- a/tests/modules/programs/scmpuff/no-fish.nix +++ b/tests/modules/programs/scmpuff/no-fish.nix @@ -13,8 +13,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.scmpuff = { }; - nmt.script = '' assertFileNotRegex home-files/.config/fish/config.fish '@scmpuff@' ''; diff --git a/tests/modules/programs/scmpuff/no-shell.nix b/tests/modules/programs/scmpuff/no-shell.nix index 8c33a2b27..ed2c7c086 100644 --- a/tests/modules/programs/scmpuff/no-shell.nix +++ b/tests/modules/programs/scmpuff/no-shell.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { scmpuff = { @@ -11,11 +9,6 @@ zsh.enable = true; }; - test.stubs = { - zsh = { }; - scmpuff = { }; - }; - nmt.script = '' assertFileNotRegex home-files/.zshrc '@scmpuff@' assertFileNotRegex home-files/.bashrc '@scmpuff@' diff --git a/tests/modules/programs/scmpuff/no-zsh.nix b/tests/modules/programs/scmpuff/no-zsh.nix index d6ed24490..d8208a16e 100644 --- a/tests/modules/programs/scmpuff/no-zsh.nix +++ b/tests/modules/programs/scmpuff/no-zsh.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { scmpuff = { @@ -9,11 +7,6 @@ zsh.enable = true; }; - test.stubs = { - zsh = { }; - scmpuff = { }; - }; - nmt.script = '' assertFileNotRegex home-files/.zshrc '@scmpuff@ init -s' ''; diff --git a/tests/modules/programs/scmpuff/zsh.nix b/tests/modules/programs/scmpuff/zsh.nix index 8a4e2e54c..0bb0caa8c 100644 --- a/tests/modules/programs/scmpuff/zsh.nix +++ b/tests/modules/programs/scmpuff/zsh.nix @@ -1,16 +1,9 @@ -{ ... }: - { programs = { scmpuff.enable = true; zsh.enable = true; }; - test.stubs = { - zsh = { }; - scmpuff = { }; - }; - nmt.script = '' assertFileExists home-files/.zshrc assertFileContains \ diff --git a/tests/modules/programs/sftpman/assert-on-no-sshkey.nix b/tests/modules/programs/sftpman/assert-on-no-sshkey.nix index 549b68902..990aacacb 100644 --- a/tests/modules/programs/sftpman/assert-on-no-sshkey.nix +++ b/tests/modules/programs/sftpman/assert-on-no-sshkey.nix @@ -1,21 +1,17 @@ { - config = { - programs.sftpman = { - enable = true; + programs.sftpman = { + enable = true; - mounts = { - mount1 = { - host = "host1.example.com"; - mountPoint = "/path/to/somewhere"; - user = "root"; - }; + mounts = { + mount1 = { + host = "host1.example.com"; + mountPoint = "/path/to/somewhere"; + user = "root"; }; }; - - test.stubs.sftpman = { }; - - test.asserts.assertions.expected = ['' - sftpman mounts using authentication type "publickey" but missing 'sshKey': mount1 - '']; }; + + test.asserts.assertions.expected = ['' + sftpman mounts using authentication type "publickey" but missing 'sshKey': mount1 + '']; } diff --git a/tests/modules/programs/sftpman/example-settings.nix b/tests/modules/programs/sftpman/example-settings.nix index 265f35525..b782fea2b 100644 --- a/tests/modules/programs/sftpman/example-settings.nix +++ b/tests/modules/programs/sftpman/example-settings.nix @@ -1,44 +1,40 @@ { - config = { - programs.sftpman = { - enable = true; - defaultSshKey = "/home/user/.ssh/id_ed25519"; + programs.sftpman = { + enable = true; + defaultSshKey = "/home/user/.ssh/id_ed25519"; - mounts = { - mount1 = { - host = "host1.example.com"; - mountPoint = "/path/to/somewhere"; - user = "root"; - mountOptions = [ "idmap=user" ]; - }; - mount2 = { - host = "host2.example.com"; - mountPoint = "/another/path"; - user = "someuser"; - authType = "password"; - sshKey = null; - }; - mount3 = { - host = "host3.example.com"; - mountPoint = "/yet/another/path"; - user = "user"; - sshKey = "/home/user/.ssh/id_rsa"; - }; + mounts = { + mount1 = { + host = "host1.example.com"; + mountPoint = "/path/to/somewhere"; + user = "root"; + mountOptions = [ "idmap=user" ]; + }; + mount2 = { + host = "host2.example.com"; + mountPoint = "/another/path"; + user = "someuser"; + authType = "password"; + sshKey = null; + }; + mount3 = { + host = "host3.example.com"; + mountPoint = "/yet/another/path"; + user = "user"; + sshKey = "/home/user/.ssh/id_rsa"; }; }; - - test.stubs.sftpman = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/sftpman/mounts/mount1.json \ - ${./expected-mount1.json} - assertFileContent \ - home-files/.config/sftpman/mounts/mount2.json \ - ${./expected-mount2.json} - assertFileContent \ - home-files/.config/sftpman/mounts/mount3.json \ - ${./expected-mount3.json} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/sftpman/mounts/mount1.json \ + ${./expected-mount1.json} + assertFileContent \ + home-files/.config/sftpman/mounts/mount2.json \ + ${./expected-mount2.json} + assertFileContent \ + home-files/.config/sftpman/mounts/mount3.json \ + ${./expected-mount3.json} + ''; } diff --git a/tests/modules/programs/sioyek/sioyek-basic-configuration.nix b/tests/modules/programs/sioyek/sioyek-basic-configuration.nix index 42eb13020..5948d3dc5 100644 --- a/tests/modules/programs/sioyek/sioyek-basic-configuration.nix +++ b/tests/modules/programs/sioyek/sioyek-basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { programs.sioyek = { enable = true; @@ -17,8 +15,6 @@ }; }; - test.stubs.sioyek = { }; - nmt = { description = "Sioyek basic setup with sample configuration"; script = '' diff --git a/tests/modules/programs/sm64ex/settings.nix b/tests/modules/programs/sm64ex/settings.nix index 04499f158..da0fc521c 100644 --- a/tests/modules/programs/sm64ex/settings.nix +++ b/tests/modules/programs/sm64ex/settings.nix @@ -1,80 +1,72 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.sm64ex = { - enable = true; + programs.sm64ex = { + enable = true; - settings = { - fullscreen = true; - window_x = 0; - window_y = 0; - window_w = 1920; - window_h = 1080; - vsync = 1; - texture_filtering = 1; - master_volume = 127; - music_volume = 127; - sfx_volume = 127; - env_volume = 127; - key_a = [ "0026" "1000" "1103" ]; - key_b = [ "0033" "1002" "1101" ]; - key_start = [ "0039" "1006" "ffff" ]; - key_l = [ "0034" "1007" "1104" ]; - key_r = [ "0036" "100a" "1105" ]; - key_z = [ "0025" "1009" "1102" ]; - key_cup = [ "100b" "ffff" "ffff" ]; - key_cdown = [ "100c" "ffff" "ffff" ]; - key_cleft = [ "100d" "ffff" "ffff" ]; - key_cright = [ "100e" "ffff" "ffff" ]; - key_stickup = [ "0011" "ffff" "ffff" ]; - key_stickdown = [ "001f" "ffff" "ffff" ]; - key_stickleft = [ "001e" "ffff" "ffff" ]; - key_stickright = [ "0020" "ffff" "ffff" ]; - stick_deadzone = 16; - rumble_strength = 10; - skip_intro = 1; - }; + settings = { + fullscreen = true; + window_x = 0; + window_y = 0; + window_w = 1920; + window_h = 1080; + vsync = 1; + texture_filtering = 1; + master_volume = 127; + music_volume = 127; + sfx_volume = 127; + env_volume = 127; + key_a = [ "0026" "1000" "1103" ]; + key_b = [ "0033" "1002" "1101" ]; + key_start = [ "0039" "1006" "ffff" ]; + key_l = [ "0034" "1007" "1104" ]; + key_r = [ "0036" "100a" "1105" ]; + key_z = [ "0025" "1009" "1102" ]; + key_cup = [ "100b" "ffff" "ffff" ]; + key_cdown = [ "100c" "ffff" "ffff" ]; + key_cleft = [ "100d" "ffff" "ffff" ]; + key_cright = [ "100e" "ffff" "ffff" ]; + key_stickup = [ "0011" "ffff" "ffff" ]; + key_stickdown = [ "001f" "ffff" "ffff" ]; + key_stickleft = [ "001e" "ffff" "ffff" ]; + key_stickright = [ "0020" "ffff" "ffff" ]; + stick_deadzone = 16; + rumble_strength = 10; + skip_intro = 1; }; - - test.stubs.sm64ex = { }; - - nmt.script = '' - assertFileContent \ - home-files/.local/share/sm64pc/sm64config.txt \ - ${ - pkgs.writeText "sm64ex-expected-settings" '' - env_volume 127 - fullscreen true - key_a 0026 1000 1103 - key_b 0033 1002 1101 - key_cdown 100c ffff ffff - key_cleft 100d ffff ffff - key_cright 100e ffff ffff - key_cup 100b ffff ffff - key_l 0034 1007 1104 - key_r 0036 100a 1105 - key_start 0039 1006 ffff - key_stickdown 001f ffff ffff - key_stickleft 001e ffff ffff - key_stickright 0020 ffff ffff - key_stickup 0011 ffff ffff - key_z 0025 1009 1102 - master_volume 127 - music_volume 127 - rumble_strength 10 - sfx_volume 127 - skip_intro 1 - stick_deadzone 16 - texture_filtering 1 - vsync 1 - window_h 1080 - window_w 1920 - window_x 0 - window_y 0'' - } - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.local/share/sm64pc/sm64config.txt \ + ${ + builtins.toFile "sm64ex-expected-settings" '' + env_volume 127 + fullscreen true + key_a 0026 1000 1103 + key_b 0033 1002 1101 + key_cdown 100c ffff ffff + key_cleft 100d ffff ffff + key_cright 100e ffff ffff + key_cup 100b ffff ffff + key_l 0034 1007 1104 + key_r 0036 100a 1105 + key_start 0039 1006 ffff + key_stickdown 001f ffff ffff + key_stickleft 001e ffff ffff + key_stickright 0020 ffff ffff + key_stickup 0011 ffff ffff + key_z 0025 1009 1102 + master_volume 127 + music_volume 127 + rumble_strength 10 + sfx_volume 127 + skip_intro 1 + stick_deadzone 16 + texture_filtering 1 + vsync 1 + window_h 1080 + window_w 1920 + window_x 0 + window_y 0'' + } + ''; } diff --git a/tests/modules/programs/spotify-player/settings.nix b/tests/modules/programs/spotify-player/settings.nix index e0442360b..cf90d1bf9 100644 --- a/tests/modules/programs/spotify-player/settings.nix +++ b/tests/modules/programs/spotify-player/settings.nix @@ -105,8 +105,6 @@ ]; }; - test.stubs.spotify-player = { }; - nmt.script = '' assertFileContent home-files/.config/spotify-player/app.toml ${./app.toml} assertFileContent home-files/.config/spotify-player/theme.toml ${ diff --git a/tests/modules/programs/starship/fish_with_interactive.nix b/tests/modules/programs/starship/fish_with_interactive.nix index 0ffd6fd4b..1fdc3d01c 100644 --- a/tests/modules/programs/starship/fish_with_interactive.nix +++ b/tests/modules/programs/starship/fish_with_interactive.nix @@ -1,27 +1,21 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - fish.enable = true; - starship.enable = true; - }; - - nmt.script = '' - assertFileExists home-files/.config/fish/config.fish - - export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)" - export NOT_EXPECTED=" - if test \"\$TERM\" != dumb - /home/hm-user/.nix-profile/bin/starship init fish | source - - end" - - if [[ "$GOT" == "$NOT_EXPECTED" ]]; then - fail "Expected starship init to be inside the 'is-interactive' block but it wasn't." - fi - ''; + programs = { + fish.enable = true; + starship.enable = true; }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + + export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)" + export NOT_EXPECTED=" + if test \"\$TERM\" != dumb + /home/hm-user/.nix-profile/bin/starship init fish | source + + end" + + if [[ "$GOT" == "$NOT_EXPECTED" ]]; then + fail "Expected starship init to be inside the 'is-interactive' block but it wasn't." + fi + ''; } diff --git a/tests/modules/programs/starship/fish_with_transience.nix b/tests/modules/programs/starship/fish_with_transience.nix index c7a0fbf52..f78e1cfda 100644 --- a/tests/modules/programs/starship/fish_with_transience.nix +++ b/tests/modules/programs/starship/fish_with_transience.nix @@ -1,21 +1,15 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - fish.enable = true; + programs = { + fish.enable = true; - starship = { - enable = true; - enableTransience = true; - }; + starship = { + enable = true; + enableTransience = true; }; - - nmt.script = '' - assertFileExists home-files/.config/fish/config.fish - assertFileRegex home-files/.config/fish/config.fish 'enable_transience' - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileRegex home-files/.config/fish/config.fish 'enable_transience' + ''; } diff --git a/tests/modules/programs/starship/fish_without_interactive.nix b/tests/modules/programs/starship/fish_without_interactive.nix index 0ec8f9646..52150715e 100644 --- a/tests/modules/programs/starship/fish_without_interactive.nix +++ b/tests/modules/programs/starship/fish_without_interactive.nix @@ -1,43 +1,37 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - fish.enable = true; + programs = { + fish.enable = true; - starship = { - enable = true; - enableInteractive = false; - }; + starship = { + enable = true; + enableInteractive = false; }; - - nmt.script = '' - assertFileExists home-files/.config/fish/config.fish - - export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)" - export EXPECTED=" - if test \"\$TERM\" != dumb - /home/hm-user/.nix-profile/bin/starship init fish | source - - end" - - export MESSAGE=" - ========== - Expected - ========== - $EXPECTED - ========== - Got - ========== - $GOT - ========== - " - - if [[ "$GOT" != "$EXPECTED" ]]; then - fail "$MESSAGE" - fi - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + + export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)" + export EXPECTED=" + if test \"\$TERM\" != dumb + /home/hm-user/.nix-profile/bin/starship init fish | source + + end" + + export MESSAGE=" + ========== + Expected + ========== + $EXPECTED + ========== + Got + ========== + $GOT + ========== + " + + if [[ "$GOT" != "$EXPECTED" ]]; then + fail "$MESSAGE" + fi + ''; } diff --git a/tests/modules/programs/starship/fish_without_transience.nix b/tests/modules/programs/starship/fish_without_transience.nix index 7ba8e67fc..a92d9cb20 100644 --- a/tests/modules/programs/starship/fish_without_transience.nix +++ b/tests/modules/programs/starship/fish_without_transience.nix @@ -1,17 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs = { - fish.enable = true; - starship.enable = true; - }; - - nmt.script = '' - assertFileExists home-files/.config/fish/config.fish - assertFileNotRegex home-files/.config/fish/config.fish 'enable_transience' - ''; + programs = { + fish.enable = true; + starship.enable = true; }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileNotRegex home-files/.config/fish/config.fish 'enable_transience' + ''; } diff --git a/tests/modules/programs/starship/settings.nix b/tests/modules/programs/starship/settings.nix index c3517cae7..69845d410 100644 --- a/tests/modules/programs/starship/settings.nix +++ b/tests/modules/programs/starship/settings.nix @@ -1,55 +1,49 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ lib, ... }: { - config = { - programs.starship = { - enable = true; + programs.starship = { + enable = true; - settings = mkMerge [ - { - add_newline = false; - format = concatStrings [ - "$line_break" - "$package" - "$line_break" - "$character" - ]; - scan_timeout = 10; - character = { - success_symbol = "➜"; - error_symbol = "➜"; - }; - package.disabled = true; - memory_usage.threshold = -1; - aws.style = "bold blue"; - battery = { - charging_symbol = "⚡️"; - display = [{ - threshold = 10; - style = "bold red"; - }]; - }; - } - - { - aws.disabled = true; - - battery.display = [{ - threshold = 30; - style = "bold yellow"; + settings = lib.mkMerge [ + { + add_newline = false; + format = lib.concatStrings [ + "$line_break" + "$package" + "$line_break" + "$character" + ]; + scan_timeout = 10; + character = { + success_symbol = "➜"; + error_symbol = "➜"; + }; + package.disabled = true; + memory_usage.threshold = -1; + aws.style = "bold blue"; + battery = { + charging_symbol = "⚡️"; + display = [{ + threshold = 10; + style = "bold red"; }]; - } - ]; - }; + }; + } - test.stubs.starship = { }; + { + aws.disabled = true; - nmt.script = '' - assertFileContent \ - home-files/.config/starship.toml \ - ${./settings-expected.toml} - ''; + battery.display = [{ + threshold = 30; + style = "bold yellow"; + }]; + } + ]; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/starship.toml \ + ${./settings-expected.toml} + ''; } diff --git a/tests/modules/programs/taskwarrior/taskwarrior.nix b/tests/modules/programs/taskwarrior/taskwarrior.nix index 163135a03..d3c91a29f 100644 --- a/tests/modules/programs/taskwarrior/taskwarrior.nix +++ b/tests/modules/programs/taskwarrior/taskwarrior.nix @@ -1,41 +1,32 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - programs.taskwarrior = { - enable = true; - package = pkgs.taskwarrior3; - colorTheme = "dark-violets-256"; - dataLocation = "/some/data/location"; - config = { - urgency.user.tag.next.coefficient = 42.42; - urgency.blocked.coefficient = -42; - }; - extraConfig = '' - include /my/stuff - urgency.user.tag.test.coefficient=-42.42 - ''; + programs.taskwarrior = { + enable = true; + colorTheme = "dark-violets-256"; + dataLocation = "/some/data/location"; + config = { + urgency.user.tag.next.coefficient = 42.42; + urgency.blocked.coefficient = -42; }; - - test.stubs.taskwarrior3 = { }; - - nmt.script = '' - assertFileExists home-files/.config/task/home-manager-taskrc - assertFileContent home-files/.config/task/home-manager-taskrc ${ - pkgs.writeText "taskwarrior.home-conf.expected" '' - data.location=/some/data/location - include dark-violets-256.theme - - urgency.blocked.coefficient=-42 - urgency.user.tag.next.coefficient=42.420000 - - include /my/stuff - urgency.user.tag.test.coefficient=-42.42 - - '' - } + extraConfig = '' + include /my/stuff + urgency.user.tag.test.coefficient=-42.42 ''; }; + + nmt.script = '' + assertFileExists home-files/.config/task/home-manager-taskrc + assertFileContent home-files/.config/task/home-manager-taskrc ${ + builtins.toFile "taskwarrior.home-conf.expected" '' + data.location=/some/data/location + include dark-violets-256.theme + + urgency.blocked.coefficient=-42 + urgency.user.tag.next.coefficient=42.420000 + + include /my/stuff + urgency.user.tag.test.coefficient=-42.42 + + '' + } + ''; } diff --git a/tests/modules/programs/terminator/config-file.nix b/tests/modules/programs/terminator/config-file.nix index 9e4e5d6e6..5cc020630 100644 --- a/tests/modules/programs/terminator/config-file.nix +++ b/tests/modules/programs/terminator/config-file.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - { programs.terminator = { enable = true; @@ -9,11 +7,9 @@ }; }; - test.stubs.terminator = { }; - nmt.script = '' assertFileContent home-files/.config/terminator/config ${ - pkgs.writeText "expected" '' + builtins.toFile "expected" '' [global_config] borderless = True [profiles] diff --git a/tests/modules/programs/thefuck/integration-disabled.nix b/tests/modules/programs/thefuck/integration-disabled.nix index 456963596..b69293578 100644 --- a/tests/modules/programs/thefuck/integration-disabled.nix +++ b/tests/modules/programs/thefuck/integration-disabled.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { thefuck.enable = true; @@ -12,8 +10,6 @@ nushell.enable = true; }; - test.stubs.thefuck = { }; - nmt.script = '' assertFileNotRegex home-files/.bashrc '@thefuck@/bin/thefuck' assertPathNotExists home-files/.config/fish/functions/fuck.fish diff --git a/tests/modules/programs/thefuck/integration-enabled-instant.nix b/tests/modules/programs/thefuck/integration-enabled-instant.nix index 7b89276af..8d007e685 100644 --- a/tests/modules/programs/thefuck/integration-enabled-instant.nix +++ b/tests/modules/programs/thefuck/integration-enabled-instant.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { thefuck = { @@ -10,8 +8,6 @@ zsh.enable = true; }; - test.stubs.thefuck = { }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/thefuck/integration-enabled.nix b/tests/modules/programs/thefuck/integration-enabled.nix index fb220e6cb..dae5cebef 100644 --- a/tests/modules/programs/thefuck/integration-enabled.nix +++ b/tests/modules/programs/thefuck/integration-enabled.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs = { thefuck.enable = true; @@ -9,8 +7,6 @@ nushell.enable = true; }; - test.stubs.thefuck = { }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ diff --git a/tests/modules/programs/thunderbird/thunderbird.nix b/tests/modules/programs/thunderbird/thunderbird.nix index 366f8b045..4526d6686 100644 --- a/tests/modules/programs/thunderbird/thunderbird.nix +++ b/tests/modules/programs/thunderbird/thunderbird.nix @@ -68,8 +68,6 @@ }; }; - test.stubs.thunderbird = { }; - nmt.script = let isDarwin = pkgs.stdenv.hostPlatform.isDarwin; configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird"; diff --git a/tests/modules/programs/tmate/tmate.nix b/tests/modules/programs/tmate/tmate.nix index 4beb84c11..76e07d881 100644 --- a/tests/modules/programs/tmate/tmate.nix +++ b/tests/modules/programs/tmate/tmate.nix @@ -1,5 +1,3 @@ -{ config, lib, pkgs, ... }: - { programs.tmate = { enable = true; @@ -8,8 +6,6 @@ extraConfig = ''set tmate-session-name "session-name"''; }; - test.stubs.tmate = { }; - nmt.script = let expectedConfig = '' set -g tmate-server-port 222 diff --git a/tests/modules/programs/todoman/config.nix b/tests/modules/programs/todoman/config.nix index 7323b7a43..789f32168 100644 --- a/tests/modules/programs/todoman/config.nix +++ b/tests/modules/programs/todoman/config.nix @@ -10,8 +10,6 @@ accounts.calendar.basePath = "base/path/calendar"; - test.stubs = { todoman = { }; }; - nmt.script = '' configFile=home-files/.config/todoman/config.py assertFileExists $configFile diff --git a/tests/modules/programs/tofi/basic-configuration.nix b/tests/modules/programs/tofi/basic-configuration.nix index 28b289969..95da2d254 100644 --- a/tests/modules/programs/tofi/basic-configuration.nix +++ b/tests/modules/programs/tofi/basic-configuration.nix @@ -1,28 +1,23 @@ -{ config, pkgs, ... }: { - config = { - programs.tofi = { - enable = true; - package = pkgs.tofi; - settings = { - background-color = "#000000"; - border-width = 0; - font = "monospace"; - height = "100%"; - num-results = 5; - outline-width = 0; - padding-left = "35%"; - padding-top = "35%"; - result-spacing = 25; - width = "100%"; - }; +{ + programs.tofi = { + enable = true; + settings = { + background-color = "#000000"; + border-width = 0; + font = "monospace"; + height = "100%"; + num-results = 5; + outline-width = 0; + padding-left = "35%"; + padding-top = "35%"; + result-spacing = 25; + width = "100%"; }; - - test.stubs.tofi = { }; - - nmt.script = '' - assertFileExists home-files/.config/tofi/config - assertFileContent home-files/.config/tofi/config \ - ${./basic-configuration.conf} - ''; }; + + nmt.script = '' + assertFileExists home-files/.config/tofi/config + assertFileContent home-files/.config/tofi/config \ + ${./basic-configuration.conf} + ''; } diff --git a/tests/modules/programs/topgrade/settings.nix b/tests/modules/programs/topgrade/settings.nix index 1e893eb47..f9b2b3dee 100644 --- a/tests/modules/programs/topgrade/settings.nix +++ b/tests/modules/programs/topgrade/settings.nix @@ -26,8 +26,6 @@ ]; }; - test.stubs.topgrade = { }; - nmt.script = '' assertFileContent \ home-files/.config/topgrade.toml \ diff --git a/tests/modules/programs/translate-shell/translate-shell.nix b/tests/modules/programs/translate-shell/translate-shell.nix index 3c1d27bdd..2e6f61d9d 100644 --- a/tests/modules/programs/translate-shell/translate-shell.nix +++ b/tests/modules/programs/translate-shell/translate-shell.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.translate-shell = { enable = true; @@ -12,8 +10,6 @@ }; }; - test.stubs.translate-shell = { }; - nmt.script = '' assertFileContent home-files/.config/translate-shell/init.trans \ ${builtins.toFile "translate-shell-expected-settings.trans" '' diff --git a/tests/modules/programs/vifm/empty-settings.nix b/tests/modules/programs/vifm/empty-settings.nix index 4e1df9c18..4231546e7 100644 --- a/tests/modules/programs/vifm/empty-settings.nix +++ b/tests/modules/programs/vifm/empty-settings.nix @@ -1,10 +1,6 @@ -{ ... }: - { programs.vifm.enable = true; - test.stubs.vifm = { }; - nmt.script = '' assertPathNotExists home-files/.config/vifm ''; diff --git a/tests/modules/programs/vim-vint/basic-configuration.nix b/tests/modules/programs/vim-vint/basic-configuration.nix index 2e538f37f..8a17761d8 100644 --- a/tests/modules/programs/vim-vint/basic-configuration.nix +++ b/tests/modules/programs/vim-vint/basic-configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.vim-vint = { enable = true; @@ -19,8 +17,6 @@ }; }; - test.stubs = { vim-vint = { }; }; - nmt.script = '' assertFileContent home-files/.config/.vintrc.yaml ${ ./basic-configuration.yaml diff --git a/tests/modules/programs/wezterm/bash-integration-default.nix b/tests/modules/programs/wezterm/bash-integration-default.nix index 84f34effb..3a63a6848 100644 --- a/tests/modules/programs/wezterm/bash-integration-default.nix +++ b/tests/modules/programs/wezterm/bash-integration-default.nix @@ -1,13 +1,9 @@ -{ ... }: - { programs.bash.enable = true; # Bash integration is enabled by default. programs.wezterm.enable = true; - test.stubs.wezterm = { }; - nmt.script = '' assertFileContains home-files/.bashrc 'source "@wezterm@/etc/profile.d/wezterm.sh"' ''; diff --git a/tests/modules/programs/wezterm/bash-integration-disabled.nix b/tests/modules/programs/wezterm/bash-integration-disabled.nix index 43c5f5fd9..d0c65eb9a 100644 --- a/tests/modules/programs/wezterm/bash-integration-disabled.nix +++ b/tests/modules/programs/wezterm/bash-integration-disabled.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.bash.enable = true; @@ -8,8 +6,6 @@ enableBashIntegration = false; }; - test.stubs.wezterm = { }; - nmt.script = '' assertFileNotRegex home-files/.bashrc 'source "@wezterm@/etc/profile.d/wezterm.sh"' ''; diff --git a/tests/modules/programs/wezterm/bash-integration-enabled.nix b/tests/modules/programs/wezterm/bash-integration-enabled.nix index 007bc0d1a..6371f8c6f 100644 --- a/tests/modules/programs/wezterm/bash-integration-enabled.nix +++ b/tests/modules/programs/wezterm/bash-integration-enabled.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.bash.enable = true; @@ -8,8 +6,6 @@ enableBashIntegration = true; }; - test.stubs.wezterm = { }; - nmt.script = '' assertFileContains home-files/.bashrc 'source "@wezterm@/etc/profile.d/wezterm.sh"' ''; diff --git a/tests/modules/programs/wezterm/empty-setting.nix b/tests/modules/programs/wezterm/empty-setting.nix index 2f2ffa084..fda2eb572 100644 --- a/tests/modules/programs/wezterm/empty-setting.nix +++ b/tests/modules/programs/wezterm/empty-setting.nix @@ -1,10 +1,6 @@ -{ ... }: - { programs.wezterm = { enable = true; }; - test.stubs.wezterm = { }; - nmt.script = let expected = builtins.toFile "wezterm.lua" '' -- Generated by Home Manager. diff --git a/tests/modules/programs/wezterm/example-setting.nix b/tests/modules/programs/wezterm/example-setting.nix index 264953dee..640328060 100644 --- a/tests/modules/programs/wezterm/example-setting.nix +++ b/tests/modules/programs/wezterm/example-setting.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.wezterm = { enable = true; @@ -46,8 +44,6 @@ }; }; - test.stubs.wezterm = { }; - nmt.script = let expectedConfig = builtins.toFile "wezterm.lua" '' -- Generated by Home Manager. diff --git a/tests/modules/programs/wezterm/zsh-integration-default.nix b/tests/modules/programs/wezterm/zsh-integration-default.nix index cc398c9d9..25abddabb 100644 --- a/tests/modules/programs/wezterm/zsh-integration-default.nix +++ b/tests/modules/programs/wezterm/zsh-integration-default.nix @@ -1,14 +1,9 @@ -{ ... }: - { programs.zsh.enable = true; # Zsh integration is enabled by default. programs.wezterm.enable = true; - test.stubs.wezterm = { }; - test.stubs.zsh = { }; - nmt.script = '' assertFileContains home-files/.zshrc 'source "@wezterm@/etc/profile.d/wezterm.sh"' ''; diff --git a/tests/modules/programs/wezterm/zsh-integration-disabled.nix b/tests/modules/programs/wezterm/zsh-integration-disabled.nix index fe7375245..702e2cb7c 100644 --- a/tests/modules/programs/wezterm/zsh-integration-disabled.nix +++ b/tests/modules/programs/wezterm/zsh-integration-disabled.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.zsh.enable = true; @@ -8,9 +6,6 @@ enableZshIntegration = false; }; - test.stubs.wezterm = { }; - test.stubs.zsh = { }; - nmt.script = '' assertFileNotRegex home-files/.zshrc 'source "@wezterm@/etc/profile.d/wezterm.sh"' ''; diff --git a/tests/modules/programs/wezterm/zsh-integration-enabled.nix b/tests/modules/programs/wezterm/zsh-integration-enabled.nix index 4e0928709..13efc53f2 100644 --- a/tests/modules/programs/wezterm/zsh-integration-enabled.nix +++ b/tests/modules/programs/wezterm/zsh-integration-enabled.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.zsh.enable = true; @@ -8,9 +6,6 @@ enableZshIntegration = true; }; - test.stubs.wezterm = { }; - test.stubs.zsh = { }; - nmt.script = '' assertFileContains home-files/.zshrc 'source "@wezterm@/etc/profile.d/wezterm.sh"' ''; diff --git a/tests/modules/programs/wpaperd/wpaperd-example-settings.nix b/tests/modules/programs/wpaperd/wpaperd-example-settings.nix index 8869f68cc..a10a2eac3 100644 --- a/tests/modules/programs/wpaperd/wpaperd-example-settings.nix +++ b/tests/modules/programs/wpaperd/wpaperd-example-settings.nix @@ -1,26 +1,20 @@ -{ ... }: - { - config = { - programs.wpaperd = { - enable = true; - settings = { - eDP-1 = { - path = "/home/foo/Pictures/Wallpaper"; - apply-shadow = true; - }; - DP-2 = { - path = "/home/foo/Pictures/Anime"; - sorting = "descending"; - }; + programs.wpaperd = { + enable = true; + settings = { + eDP-1 = { + path = "/home/foo/Pictures/Wallpaper"; + apply-shadow = true; + }; + DP-2 = { + path = "/home/foo/Pictures/Anime"; + sorting = "descending"; }; }; - - test.stubs.wpaperd = { }; - - nmt.script = '' - assertFileContent home-files/.config/wpaperd/wallpaper.toml \ - ${./wpaperd-expected-settings.toml} - ''; }; + + nmt.script = '' + assertFileContent home-files/.config/wpaperd/wallpaper.toml \ + ${./wpaperd-expected-settings.toml} + ''; } diff --git a/tests/modules/programs/yambar/empty-settings.nix b/tests/modules/programs/yambar/empty-settings.nix index 56cdf27d0..103ce595f 100644 --- a/tests/modules/programs/yambar/empty-settings.nix +++ b/tests/modules/programs/yambar/empty-settings.nix @@ -1,10 +1,6 @@ -{ ... }: - { programs.yambar.enable = true; - test.stubs.yambar = { }; - nmt.script = '' assertPathNotExists home-files/.config/yambar ''; diff --git a/tests/modules/programs/yambar/example-settings.nix b/tests/modules/programs/yambar/example-settings.nix index de572090c..19b3e203b 100644 --- a/tests/modules/programs/yambar/example-settings.nix +++ b/tests/modules/programs/yambar/example-settings.nix @@ -1,10 +1,6 @@ -{ config, ... }: - { programs.yambar = { enable = true; - package = config.lib.test.mkStubPackage { }; - settings = { bar = { location = "top"; diff --git a/tests/modules/programs/yazi/bash-integration-enabled.nix b/tests/modules/programs/yazi/bash-integration-enabled.nix index 474a989f9..3c590ff6d 100644 --- a/tests/modules/programs/yazi/bash-integration-enabled.nix +++ b/tests/modules/programs/yazi/bash-integration-enabled.nix @@ -1,5 +1,3 @@ -{ ... }: - let shellIntegration = '' function yy() { @@ -19,8 +17,6 @@ in { enableBashIntegration = true; }; - test.stubs.yazi = { }; - nmt.script = '' assertFileContains home-files/.bashrc '${shellIntegration}' ''; diff --git a/tests/modules/programs/yazi/fish-integration-enabled.nix b/tests/modules/programs/yazi/fish-integration-enabled.nix index 8e54e5e7a..a07940f4b 100644 --- a/tests/modules/programs/yazi/fish-integration-enabled.nix +++ b/tests/modules/programs/yazi/fish-integration-enabled.nix @@ -9,8 +9,6 @@ enableFishIntegration = true; }; - test.stubs.yazi = { }; - nmt.script = '' assertFileContent home-files/.config/fish/functions/${config.programs.yazi.shellWrapperName}.fish \ ${./fish-integration-expected.fish} diff --git a/tests/modules/programs/yazi/init-lua-string.nix b/tests/modules/programs/yazi/init-lua-string.nix index 999dd6bc6..b28d4a139 100644 --- a/tests/modules/programs/yazi/init-lua-string.nix +++ b/tests/modules/programs/yazi/init-lua-string.nix @@ -1,12 +1,10 @@ -{ ... }: { +{ programs.yazi = { enable = true; initLua = builtins.readFile ./init.lua; }; - test.stubs.yazi = { }; - nmt.script = '' assertFileContent home-files/.config/yazi/init.lua \ ${./init.lua} diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix index a2de2d8b7..6753c74ee 100644 --- a/tests/modules/programs/yazi/nushell-integration-enabled.nix +++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix @@ -20,8 +20,6 @@ in { enableNushellIntegration = true; }; - test.stubs.yazi = { }; - nmt.script = let configPath = if pkgs.stdenv.isDarwin && !config.xdg.enable then "home-files/Library/Application Support/nushell/config.nu" diff --git a/tests/modules/programs/yazi/settings.nix b/tests/modules/programs/yazi/settings.nix index 32b8a9d5f..f2e194f0e 100644 --- a/tests/modules/programs/yazi/settings.nix +++ b/tests/modules/programs/yazi/settings.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.yazi = { enable = true; @@ -88,8 +86,6 @@ }; }; - test.stubs.yazi = { }; - nmt.script = '' assertFileContent home-files/.config/yazi/keymap.toml \ ${./keymap-expected.toml} diff --git a/tests/modules/programs/yazi/zsh-integration-enabled.nix b/tests/modules/programs/yazi/zsh-integration-enabled.nix index 0c0ec217f..669b8a517 100644 --- a/tests/modules/programs/yazi/zsh-integration-enabled.nix +++ b/tests/modules/programs/yazi/zsh-integration-enabled.nix @@ -1,5 +1,3 @@ -{ ... }: - let shellIntegration = '' function yy() { @@ -19,8 +17,6 @@ in { enableBashIntegration = true; }; - test.stubs.yazi = { }; - nmt.script = '' assertFileContains home-files/.zshrc '${shellIntegration}' ''; diff --git a/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix b/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix index c28d44e57..37a0d034f 100644 --- a/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix +++ b/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.yt-dlp = { enable = true; @@ -8,8 +6,6 @@ ''; }; - test.stubs.yt-dlp = { }; - nmt.script = '' assertFileExists home-files/.config/yt-dlp/config assertFileContent home-files/.config/yt-dlp/config ${ diff --git a/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix b/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix index 229f0438c..734a5c10a 100644 --- a/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix +++ b/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.yt-dlp = { enable = true; @@ -16,8 +14,6 @@ ''; }; - test.stubs.yt-dlp = { }; - nmt.script = '' assertFileExists home-files/.config/yt-dlp/config assertFileContent home-files/.config/yt-dlp/config ${ diff --git a/tests/modules/programs/zellij/enable-shells.nix b/tests/modules/programs/zellij/enable-shells.nix index c648cf7dd..63e13facc 100644 --- a/tests/modules/programs/zellij/enable-shells.nix +++ b/tests/modules/programs/zellij/enable-shells.nix @@ -17,25 +17,20 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - zellij = { }; - }; - nmt.script = '' assertFileExists home-files/.bashrc assertFileContains \ home-files/.bashrc \ - 'eval "$(@zellij@/bin/dummy setup --generate-auto-start bash)"' + 'eval "$(@zellij@/bin/zellij setup --generate-auto-start bash)"' assertFileExists home-files/.zshrc assertFileContains \ home-files/.zshrc \ - 'eval "$(@zellij@/bin/dummy setup --generate-auto-start zsh)"' + 'eval "$(@zellij@/bin/zellij setup --generate-auto-start zsh)"' assertFileExists home-files/.config/fish/config.fish assertFileContains \ home-files/.config/fish/config.fish \ - 'eval (@zellij@/bin/dummy setup --generate-auto-start fish | string collect)' + 'eval (@zellij@/bin/zellij setup --generate-auto-start fish | string collect)' ''; } diff --git a/tests/modules/programs/zk/zk.nix b/tests/modules/programs/zk/zk.nix index 8907d1677..b22eb35d9 100644 --- a/tests/modules/programs/zk/zk.nix +++ b/tests/modules/programs/zk/zk.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.zk = { enable = true; @@ -21,8 +19,6 @@ }; }; - test.stubs.zk = { }; - nmt.script = '' assertFileExists home-files/.config/zk/config.toml assertFileContent home-files/.config/zk/config.toml ${./expected.toml} diff --git a/tests/modules/programs/zplug/modules.nix b/tests/modules/programs/zplug/modules.nix index 1256e33c2..ffb81d7c1 100644 --- a/tests/modules/programs/zplug/modules.nix +++ b/tests/modules/programs/zplug/modules.nix @@ -19,11 +19,6 @@ }; }; - test.stubs = { - zplug = { }; - zsh = { }; - }; - nmt.script = '' assertFileContains home-files/.zshrc \ 'source @zplug@/share/zplug/init.zsh' diff --git a/tests/modules/programs/zsh/history-ignore-pattern.nix b/tests/modules/programs/zsh/history-ignore-pattern.nix index 49865e846..2442c32f3 100644 --- a/tests/modules/programs/zsh/history-ignore-pattern.nix +++ b/tests/modules/programs/zsh/history-ignore-pattern.nix @@ -1,17 +1,12 @@ -{ ... }: - { imports = [ - ./zsh-stubs.nix ({ ... }: { config.programs.zsh.history.ignorePatterns = [ "echo *" ]; }) ({ ... }: { config.programs.zsh.history.ignorePatterns = [ "rm *" ]; }) ]; - config = { - programs.zsh.enable = true; + programs.zsh.enable = true; - nmt.script = '' - assertFileContains home-files/.zshrc "HISTORY_IGNORE='(echo *|rm *)'" - ''; - }; + nmt.script = '' + assertFileContains home-files/.zshrc "HISTORY_IGNORE='(echo *|rm *)'" + ''; } diff --git a/tests/modules/programs/zsh/history-path-new-custom.nix b/tests/modules/programs/zsh/history-path-new-custom.nix index ee6deb883..497796186 100644 --- a/tests/modules/programs/zsh/history-path-new-custom.nix +++ b/tests/modules/programs/zsh/history-path-new-custom.nix @@ -1,17 +1,11 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; - - config = { - home.stateVersion = "20.03"; - programs.zsh = { - enable = true; - history.path = "$HOME/some/directory/zsh_history"; - }; - - nmt.script = '' - assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$' - ''; + home.stateVersion = "20.03"; + programs.zsh = { + enable = true; + history.path = "$HOME/some/directory/zsh_history"; }; + + nmt.script = '' + assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$' + ''; } diff --git a/tests/modules/programs/zsh/history-path-new-default.nix b/tests/modules/programs/zsh/history-path-new-default.nix index 3ead97597..4dfca0d06 100644 --- a/tests/modules/programs/zsh/history-path-new-default.nix +++ b/tests/modules/programs/zsh/history-path-new-default.nix @@ -1,14 +1,8 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; + home.stateVersion = "20.03"; + programs.zsh.enable = true; - config = { - home.stateVersion = "20.03"; - programs.zsh.enable = true; - - nmt.script = '' - assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$' - ''; - }; + nmt.script = '' + assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$' + ''; } diff --git a/tests/modules/programs/zsh/history-path-old-custom.nix b/tests/modules/programs/zsh/history-path-old-custom.nix index 25a2babf5..f4f5ac38d 100644 --- a/tests/modules/programs/zsh/history-path-old-custom.nix +++ b/tests/modules/programs/zsh/history-path-old-custom.nix @@ -1,17 +1,11 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; - - config = { - home.stateVersion = "19.09"; - programs.zsh = { - enable = true; - history.path = "some/directory/zsh_history"; - }; - - nmt.script = '' - assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$' - ''; + home.stateVersion = "19.09"; + programs.zsh = { + enable = true; + history.path = "some/directory/zsh_history"; }; + + nmt.script = '' + assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$' + ''; } diff --git a/tests/modules/programs/zsh/history-path-old-default.nix b/tests/modules/programs/zsh/history-path-old-default.nix index b988ddb62..8e4debb32 100644 --- a/tests/modules/programs/zsh/history-path-old-default.nix +++ b/tests/modules/programs/zsh/history-path-old-default.nix @@ -1,14 +1,8 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; + home.stateVersion = "19.03"; + programs.zsh.enable = true; - config = { - home.stateVersion = "19.03"; - programs.zsh.enable = true; - - nmt.script = '' - assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$' - ''; - }; + nmt.script = '' + assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$' + ''; } diff --git a/tests/modules/programs/zsh/history-substring-search.nix b/tests/modules/programs/zsh/history-substring-search.nix index a5f28b724..94c2bae9c 100644 --- a/tests/modules/programs/zsh/history-substring-search.nix +++ b/tests/modules/programs/zsh/history-substring-search.nix @@ -1,23 +1,17 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; - - config = { - programs.zsh = { + programs.zsh = { + enable = true; + historySubstringSearch = { enable = true; - historySubstringSearch = { - enable = true; - searchDownKey = "^[[B"; - searchUpKey = [ "^[[A" "\\eOA" ]; - }; + searchDownKey = "^[[B"; + searchUpKey = [ "^[[A" "\\eOA" ]; }; - - # Written with regex to ensure we don't end up missing newlines in the future - nmt.script = '' - assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[B\" history-substring-search-down$" - assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[A\" history-substring-search-up$" - assertFileRegex home-files/.zshrc "^bindkey \"\\\\eOA\" history-substring-search-up$" - ''; }; + + # Written with regex to ensure we don't end up missing newlines in the future + nmt.script = '' + assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[B\" history-substring-search-down$" + assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[A\" history-substring-search-up$" + assertFileRegex home-files/.zshrc "^bindkey \"\\\\eOA\" history-substring-search-up$" + ''; } diff --git a/tests/modules/programs/zsh/prezto.nix b/tests/modules/programs/zsh/prezto.nix index 7ce609063..ffb5d1835 100644 --- a/tests/modules/programs/zsh/prezto.nix +++ b/tests/modules/programs/zsh/prezto.nix @@ -1,10 +1,19 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; - programs.zsh.prezto.enable = true; + test.stubs = { + zsh-prezto = { + outPath = null; + buildScript = '' + mkdir -p $out/share/zsh-prezto/runcoms + echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile + echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin + echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout + echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv + ''; + }; + }; + nmt.script = '' assertFileExists home-files/.zpreztorc ''; diff --git a/tests/modules/programs/zsh/session-variables.nix b/tests/modules/programs/zsh/session-variables.nix index 45c63d236..0aa20c8c2 100644 --- a/tests/modules/programs/zsh/session-variables.nix +++ b/tests/modules/programs/zsh/session-variables.nix @@ -1,22 +1,18 @@ { config, ... }: { - imports = [ ./zsh-stubs.nix ]; + programs.zsh = { + enable = true; - config = { - programs.zsh = { - enable = true; - - sessionVariables = { - V1 = "v1"; - V2 = "v2-${config.programs.zsh.sessionVariables.V1}"; - }; + sessionVariables = { + V1 = "v1"; + V2 = "v2-${config.programs.zsh.sessionVariables.V1}"; }; - - nmt.script = '' - assertFileExists home-files/.zshenv - assertFileRegex home-files/.zshenv 'export V1="v1"' - assertFileRegex home-files/.zshenv 'export V2="v2-v1"' - ''; }; + + nmt.script = '' + assertFileExists home-files/.zshenv + assertFileRegex home-files/.zshenv 'export V1="v1"' + assertFileRegex home-files/.zshenv 'export V2="v2-v1"' + ''; } diff --git a/tests/modules/programs/zsh/syntax-highlighting.nix b/tests/modules/programs/zsh/syntax-highlighting.nix index 2bd581473..27970a123 100644 --- a/tests/modules/programs/zsh/syntax-highlighting.nix +++ b/tests/modules/programs/zsh/syntax-highlighting.nix @@ -1,24 +1,20 @@ { pkgs, ... }: { - imports = [ ./zsh-stubs.nix ]; - - config = { - programs.zsh = { + programs.zsh = { + enable = true; + syntaxHighlighting = { enable = true; - syntaxHighlighting = { - enable = true; - package = pkgs.hello; - highlighters = [ "brackets" "pattern" "cursor" ]; - styles.comment = "fg=#6c6c6c"; - patterns."rm -rf *" = "fg=white,bold,bg=red"; - }; + package = pkgs.hello; + highlighters = [ "brackets" "pattern" "cursor" ]; + styles.comment = "fg=#6c6c6c"; + patterns."rm -rf *" = "fg=white,bold,bg=red"; }; - - nmt.script = '' - assertFileContains home-files/.zshrc "source ${pkgs.hello}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets pattern cursor)" - assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_STYLES+=(comment 'fg=#6c6c6c')" - ''; }; + + nmt.script = '' + assertFileContains home-files/.zshrc "source ${pkgs.hello}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" + assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets pattern cursor)" + assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_STYLES+=(comment 'fg=#6c6c6c')" + ''; } diff --git a/tests/modules/programs/zsh/zsh-abbr.nix b/tests/modules/programs/zsh/zsh-abbr.nix index f08345e05..5be5e2b03 100644 --- a/tests/modules/programs/zsh/zsh-abbr.nix +++ b/tests/modules/programs/zsh/zsh-abbr.nix @@ -1,8 +1,4 @@ -{ ... }: - { - imports = [ ./zsh-stubs.nix ]; - programs.zsh.zsh-abbr = { enable = true; abbreviations = { ga = "git add"; }; diff --git a/tests/modules/programs/zsh/zsh-stubs.nix b/tests/modules/programs/zsh/zsh-stubs.nix deleted file mode 100644 index d9e275aab..000000000 --- a/tests/modules/programs/zsh/zsh-stubs.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: - -{ - test.stubs = { - hello = { }; - nix-zsh-completions = { }; - zsh = { }; - zsh-abbr = { }; - zsh-history-substring-search = { }; - zsh-prezto = { - outPath = null; - buildScript = '' - mkdir -p $out/share/zsh-prezto/runcoms - echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile - echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin - echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout - echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv - ''; - }; - zsh-syntax-highlighting = { }; - }; -} diff --git a/tests/modules/services/activitywatch/basic-setup.nix b/tests/modules/services/activitywatch/basic-setup.nix index a8ba1cb49..d3a14ae87 100644 --- a/tests/modules/services/activitywatch/basic-setup.nix +++ b/tests/modules/services/activitywatch/basic-setup.nix @@ -5,7 +5,6 @@ let stubPackage = config.lib.test.mkStubPackage { }; in { services.activitywatch = { enable = true; - package = stubPackage; settings = { port = 3012; custom_static = { custom-watcher = stubPackage; }; diff --git a/tests/modules/services/activitywatch/empty-server-settings.nix b/tests/modules/services/activitywatch/empty-server-settings.nix index 89c65b1f0..290c1fb0a 100644 --- a/tests/modules/services/activitywatch/empty-server-settings.nix +++ b/tests/modules/services/activitywatch/empty-server-settings.nix @@ -3,8 +3,6 @@ { services.activitywatch.enable = true; - test.stubs.activitywatch = { }; - nmt.script = '' assertFileExists home-files/.config/systemd/user/activitywatch.service assertFileExists home-files/.config/systemd/user/activitywatch.target diff --git a/tests/modules/services/avizo/with-settings.nix b/tests/modules/services/avizo/with-settings.nix index 4c54f261d..80b219392 100644 --- a/tests/modules/services/avizo/with-settings.nix +++ b/tests/modules/services/avizo/with-settings.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.avizo = { enable = true; @@ -14,8 +12,6 @@ }; }; - test.stubs.avizo = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/avizo.service assertFileExists $serviceFile diff --git a/tests/modules/services/avizo/without-settings.nix b/tests/modules/services/avizo/without-settings.nix index 49a960614..b6bf03cff 100644 --- a/tests/modules/services/avizo/without-settings.nix +++ b/tests/modules/services/avizo/without-settings.nix @@ -1,10 +1,6 @@ -{ ... }: - { services.avizo.enable = true; - test.stubs.avizo = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/avizo.service assertFileExists $serviceFile diff --git a/tests/modules/services/barrier/basic-configuration.nix b/tests/modules/services/barrier/basic-configuration.nix index e7e393184..7a9ad097a 100644 --- a/tests/modules/services/barrier/basic-configuration.nix +++ b/tests/modules/services/barrier/basic-configuration.nix @@ -1,13 +1,9 @@ -{ ... }: - { services.barrier.client = { enable = true; server = "testServer"; }; - test.stubs.barrier = { }; - nmt.script = '' clientServiceFile=home-files/.config/systemd/user/barrierc.service diff --git a/tests/modules/services/blanket/basic-configuration.nix b/tests/modules/services/blanket/basic-configuration.nix index 740c4d08d..f51d5ac0a 100644 --- a/tests/modules/services/blanket/basic-configuration.nix +++ b/tests/modules/services/blanket/basic-configuration.nix @@ -1,9 +1,5 @@ -{ ... }: - { - services.blanket = { enable = true; }; - - test.stubs.blanket = { }; + services.blanket.enable = true; nmt.script = '' clientServiceFile=home-files/.config/systemd/user/blanket.service diff --git a/tests/modules/services/borgmatic/basic-configuration.nix b/tests/modules/services/borgmatic/basic-configuration.nix index 3763b98fa..85c8efd57 100644 --- a/tests/modules/services/borgmatic/basic-configuration.nix +++ b/tests/modules/services/borgmatic/basic-configuration.nix @@ -1,22 +1,16 @@ -{ config, pkgs, ... }: - { - config = { - services.borgmatic = { - enable = true; - frequency = "weekly"; - }; - - test.stubs.borgmatic = { }; - - nmt.script = '' - assertFileContent \ - $(normalizeStorePaths home-files/.config/systemd/user/borgmatic.service) \ - ${./basic-configuration.service} - - assertFileContent \ - home-files/.config/systemd/user/borgmatic.timer \ - ${./basic-configuration.timer} - ''; + services.borgmatic = { + enable = true; + frequency = "weekly"; }; + + nmt.script = '' + assertFileContent \ + $(normalizeStorePaths home-files/.config/systemd/user/borgmatic.service) \ + ${./basic-configuration.service} + + assertFileContent \ + home-files/.config/systemd/user/borgmatic.timer \ + ${./basic-configuration.timer} + ''; } diff --git a/tests/modules/services/borgmatic/basic-configuration.service b/tests/modules/services/borgmatic/basic-configuration.service index 8b760293a..82d4d8363 100644 --- a/tests/modules/services/borgmatic/basic-configuration.service +++ b/tests/modules/services/borgmatic/basic-configuration.service @@ -1,5 +1,5 @@ [Service] -ExecStart=/nix/store/00000000000000000000000000000000-systemd/bin/systemd-inhibit \ +ExecStart=@systemd@/bin/systemd-inhibit \ --who="borgmatic" \ --what="sleep:shutdown" \ --why="Prevent interrupting scheduled backup" \ diff --git a/tests/modules/services/cachix-agent/basic-setup.nix b/tests/modules/services/cachix-agent/basic-setup.nix index 22c088900..9371d8343 100644 --- a/tests/modules/services/cachix-agent/basic-setup.nix +++ b/tests/modules/services/cachix-agent/basic-setup.nix @@ -1,14 +1,9 @@ -{ config, ... }: - { services.cachix-agent = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@cachix-agent@"; }; name = "test-agent"; }; - test.stubs.nix = { }; - nmt.script = '' assertFileContent \ home-files/.config/systemd/user/cachix-agent.service \ @@ -20,7 +15,7 @@ [Service] Environment=PATH=@nix@/bin EnvironmentFile=/home/hm-user/.config/cachix-agent.token - ExecStart=@cachix-agent@/bin/cachix deploy agent test-agent home-manager + ExecStart=@cachix@/bin/cachix deploy agent test-agent home-manager KillMode=process Restart=on-failure diff --git a/tests/modules/services/cliphist/cliphist-extra-options.nix b/tests/modules/services/cliphist/cliphist-extra-options.nix index dcf097c6c..60a3ce7aa 100644 --- a/tests/modules/services/cliphist/cliphist-extra-options.nix +++ b/tests/modules/services/cliphist/cliphist-extra-options.nix @@ -1,15 +1,10 @@ -{ ... }: { +{ services.cliphist = { enable = true; allowImages = true; extraOptions = [ "-max-dedupe-search" "10" "-max-items" "500" ]; }; - test.stubs = { - cliphist = { }; - wl-clipboard = { }; - }; - nmt.script = '' servicePath=home-files/.config/systemd/user diff --git a/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix b/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix index e4c0e828c..64c804723 100644 --- a/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix +++ b/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.cliphist = { enable = true; @@ -7,11 +5,6 @@ systemdTargets = [ "sway-session.target" "hyprland-session.target" ]; }; - test.stubs = { - cliphist = { }; - wl-clipboard = { }; - }; - nmt.script = '' assertFileExists home-files/.config/systemd/user/cliphist.service assertFileExists home-files/.config/systemd/user/sway-session.target.wants/cliphist.service diff --git a/tests/modules/services/cliphist/cliphist-sway-session-target.nix b/tests/modules/services/cliphist/cliphist-sway-session-target.nix index 71171be78..a3d13ad10 100644 --- a/tests/modules/services/cliphist/cliphist-sway-session-target.nix +++ b/tests/modules/services/cliphist/cliphist-sway-session-target.nix @@ -6,11 +6,6 @@ systemdTarget = "sway-session.target"; }; - test.stubs = { - cliphist = { }; - wl-clipboard = { }; - }; - nmt.script = '' assertFileExists home-files/.config/systemd/user/cliphist.service assertFileExists home-files/.config/systemd/user/sway-session.target.wants/cliphist.service diff --git a/tests/modules/services/clipman/clipman-sway-session-target.nix b/tests/modules/services/clipman/clipman-sway-session-target.nix index 129ab554f..aa33a0730 100644 --- a/tests/modules/services/clipman/clipman-sway-session-target.nix +++ b/tests/modules/services/clipman/clipman-sway-session-target.nix @@ -1,5 +1,3 @@ -{ ... }: - { home.stateVersion = "21.11"; @@ -8,11 +6,6 @@ systemdTarget = "sway-session.target"; }; - test.stubs = { - clipman = { }; - wl-clipboard = { }; - }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/clipman.service) assertFileContent "$serviceFile" ${./clipman-sway-session-target.service} diff --git a/tests/modules/services/comodoro/comodoro.nix b/tests/modules/services/comodoro/comodoro.nix index 35974ecd7..3c34951ec 100644 --- a/tests/modules/services/comodoro/comodoro.nix +++ b/tests/modules/services/comodoro/comodoro.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.comodoro = { enable = true; @@ -7,8 +5,6 @@ protocols = [ "tcp" ]; }; - test.stubs.comodoro = { }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/comodoro.service) assertFileContent "$serviceFile" ${./expected.service} diff --git a/tests/modules/services/conky/basic-configuration.nix b/tests/modules/services/conky/basic-configuration.nix index 479a19239..15a0e3d30 100644 --- a/tests/modules/services/conky/basic-configuration.nix +++ b/tests/modules/services/conky/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { services.conky = { enable = true; @@ -14,8 +12,6 @@ ''; }; - test.stubs.conky = { }; - nmt.script = '' serviceFile="$TESTED/home-files/.config/systemd/user/conky.service" diff --git a/tests/modules/services/copyq/basic-configuration.nix b/tests/modules/services/copyq/basic-configuration.nix index f90872815..6394e393f 100644 --- a/tests/modules/services/copyq/basic-configuration.nix +++ b/tests/modules/services/copyq/basic-configuration.nix @@ -1,17 +1,11 @@ -{ ... }: - { - config = { - services.copyq = { - enable = true; - systemdTarget = "sway-session.target"; - }; - - test.stubs.copyq = { }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/copyq.service - assertFileContent $serviceFile ${./basic-expected.service} - ''; + services.copyq = { + enable = true; + systemdTarget = "sway-session.target"; }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/copyq.service + assertFileContent $serviceFile ${./basic-expected.service} + ''; } diff --git a/tests/modules/services/copyq/basic-expected.service b/tests/modules/services/copyq/basic-expected.service index f20c23bbc..28f56356a 100644 --- a/tests/modules/services/copyq/basic-expected.service +++ b/tests/modules/services/copyq/basic-expected.service @@ -3,7 +3,7 @@ WantedBy=sway-session.target [Service] Environment=QT_QPA_PLATFORM=xcb -ExecStart=@copyq@/bin/copyq +ExecStart=@CopyQ@/bin/copyq Restart=on-failure [Unit] diff --git a/tests/modules/services/copyq/dont-force-x-configuration.nix b/tests/modules/services/copyq/dont-force-x-configuration.nix index a233ae264..7948d2409 100644 --- a/tests/modules/services/copyq/dont-force-x-configuration.nix +++ b/tests/modules/services/copyq/dont-force-x-configuration.nix @@ -1,17 +1,11 @@ -{ ... }: - { - config = { - services.copyq = { - enable = true; - forceXWayland = false; - }; - - test.stubs.copyq = { }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/copyq.service - assertFileContent $serviceFile ${./dont-force-x-expected.service} - ''; + services.copyq = { + enable = true; + forceXWayland = false; }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/copyq.service + assertFileContent $serviceFile ${./dont-force-x-expected.service} + ''; } diff --git a/tests/modules/services/copyq/dont-force-x-expected.service b/tests/modules/services/copyq/dont-force-x-expected.service index 7680f1fe5..0ecdbaf50 100644 --- a/tests/modules/services/copyq/dont-force-x-expected.service +++ b/tests/modules/services/copyq/dont-force-x-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@copyq@/bin/copyq +ExecStart=@CopyQ@/bin/copyq Restart=on-failure [Unit] diff --git a/tests/modules/services/darkman/basic-configuration.nix b/tests/modules/services/darkman/basic-configuration.nix index 4c3e85470..8e1a33bc6 100644 --- a/tests/modules/services/darkman/basic-configuration.nix +++ b/tests/modules/services/darkman/basic-configuration.nix @@ -23,8 +23,6 @@ ''; }; - test.stubs.python = { }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/darkman.service) darkModeScriptFile=$(normalizeStorePaths home-files/.local/share/dark-mode.d/color-scheme-dark) diff --git a/tests/modules/services/darkman/no-configuration.nix b/tests/modules/services/darkman/no-configuration.nix index 1ab6346f4..50802eb42 100644 --- a/tests/modules/services/darkman/no-configuration.nix +++ b/tests/modules/services/darkman/no-configuration.nix @@ -1,11 +1,6 @@ { services.darkman.enable = true; - test.stubs = { - python = { }; - darkman = { }; - }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/darkman.service) @@ -17,7 +12,7 @@ [Service] BusName=nl.whynothugo.darkman - ExecStart=@darkman@/bin/dummy run + ExecStart=@darkman@/bin/darkman run Restart=on-failure Slice=background.slice TimeoutStopSec=15 diff --git a/tests/modules/services/devilspie2/configuration.nix b/tests/modules/services/devilspie2/configuration.nix index 14bdc6f0c..a6b819878 100644 --- a/tests/modules/services/devilspie2/configuration.nix +++ b/tests/modules/services/devilspie2/configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.devilspie2 = { enable = true; @@ -19,8 +17,6 @@ ''; }; - test.stubs.devilspie2 = { }; - nmt.script = '' configlua=home-files/.config/devilspie2/config.lua diff --git a/tests/modules/services/dropbox/basic-configuration.nix b/tests/modules/services/dropbox/basic-configuration.nix index 9b8a6d651..8e3096ea0 100644 --- a/tests/modules/services/dropbox/basic-configuration.nix +++ b/tests/modules/services/dropbox/basic-configuration.nix @@ -7,13 +7,10 @@ path = "${config.home.homeDirectory}/dropbox"; }; - test.stubs.dropbox-cli = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/dropbox.service assertFileExists $serviceFile ''; - }; } diff --git a/tests/modules/services/espanso-darwin/basic-configuration.nix b/tests/modules/services/espanso-darwin/basic-configuration.nix index 4a2f2ee77..cd9d2f297 100644 --- a/tests/modules/services/espanso-darwin/basic-configuration.nix +++ b/tests/modules/services/espanso-darwin/basic-configuration.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ services.espanso = { enable = true; configs = { default = { show_notifications = false; }; }; @@ -36,8 +36,6 @@ }; }; - test.stubs.espanso = { }; - nmt.script = '' serviceFile="LaunchAgents/org.nix-community.home.espanso.plist" serviceFileNormalized="$(normalizeStorePaths "$serviceFile")" diff --git a/tests/modules/services/espanso/basic-configuration.nix b/tests/modules/services/espanso/basic-configuration.nix index 6d04c53d2..93c6a5a2d 100644 --- a/tests/modules/services/espanso/basic-configuration.nix +++ b/tests/modules/services/espanso/basic-configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.espanso = { enable = true; @@ -38,8 +36,6 @@ }; }; - test.stubs.espanso = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/espanso.service assertFileExists "$serviceFile" diff --git a/tests/modules/services/flameshot/empty-settings.nix b/tests/modules/services/flameshot/empty-settings.nix index 2c700c49d..14e35d826 100644 --- a/tests/modules/services/flameshot/empty-settings.nix +++ b/tests/modules/services/flameshot/empty-settings.nix @@ -1,9 +1,5 @@ -{ ... }: - { - services.flameshot = { enable = true; }; - - test.stubs.flameshot = { }; + services.flameshot.enable = true; nmt.script = '' assertPathNotExists home-files/.config/flameshot/flameshot.ini diff --git a/tests/modules/services/flameshot/example-settings.nix b/tests/modules/services/flameshot/example-settings.nix index d61b93e93..25aa4f75c 100644 --- a/tests/modules/services/flameshot/example-settings.nix +++ b/tests/modules/services/flameshot/example-settings.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.flameshot = { enable = true; @@ -12,8 +10,6 @@ }; }; - test.stubs.flameshot = { }; - nmt.script = '' assertFileContent \ home-files/.config/flameshot/flameshot.ini \ diff --git a/tests/modules/services/fluidsynth/service.nix b/tests/modules/services/fluidsynth/service.nix index ce0427b83..97ca0a4b4 100644 --- a/tests/modules/services/fluidsynth/service.nix +++ b/tests/modules/services/fluidsynth/service.nix @@ -6,8 +6,6 @@ services.fluidsynth.soundFont = "/path/to/soundFont"; services.fluidsynth.extraOptions = [ "--sample-rate 96000" ]; - test.stubs.fluidsynth = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/fluidsynth.service diff --git a/tests/modules/services/fusuma/fusuma-stubs.nix b/tests/modules/services/fusuma/fusuma-stubs.nix new file mode 100644 index 000000000..b2904b7d0 --- /dev/null +++ b/tests/modules/services/fusuma/fusuma-stubs.nix @@ -0,0 +1,11 @@ +{ realPkgs, ... }: + +{ + nixpkgs.overlays = [ + (_: super: { + inherit (realPkgs) remarshal; + python3Packages = super.python3Packages.overrideScope + (self: super: { inherit (realPkgs.python3Packages) pyyaml; }); + }) + ]; +} diff --git a/tests/modules/services/fusuma/service.nix b/tests/modules/services/fusuma/service.nix index 8041bf7b8..028054e4e 100644 --- a/tests/modules/services/fusuma/service.nix +++ b/tests/modules/services/fusuma/service.nix @@ -1,9 +1,10 @@ { config, ... }: { + imports = [ ./fusuma-stubs.nix ]; + services.fusuma = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@fusuma@"; }; extraPackages = [ (config.lib.test.mkStubPackage { outPath = "@coreutils@"; }) (config.lib.test.mkStubPackage { outPath = "@xdotool@"; }) diff --git a/tests/modules/services/fusuma/settings.nix b/tests/modules/services/fusuma/settings.nix index a1500cb21..da329673d 100644 --- a/tests/modules/services/fusuma/settings.nix +++ b/tests/modules/services/fusuma/settings.nix @@ -1,10 +1,12 @@ -{ config, ... }: +{ config, pkgs, ... }: { + imports = [ ./fusuma-stubs.nix ]; + services.fusuma = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@fusuma@"; }; - extraPackages = [ (config.lib.test.mkStubPackage { }) ]; + extraPackages = [ pkgs.xdotool ]; settings = { threshold = { swipe = 1; }; diff --git a/tests/modules/services/git-sync/basic.nix b/tests/modules/services/git-sync/basic.nix index 0412f93b1..88c180201 100644 --- a/tests/modules/services/git-sync/basic.nix +++ b/tests/modules/services/git-sync/basic.nix @@ -10,21 +10,18 @@ }; }; - test.stubs.openssh = { name = "openssh"; }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/git-sync-test.service assertFileExists $serviceFile - serviceFile=$(normalizeStorePaths $serviceFile) assertFileContent $serviceFile ${ builtins.toFile "expected" '' [Install] WantedBy=default.target [Service] - Environment=PATH=@openssh@/bin:/nix/store/00000000000000000000000000000000-git/bin + Environment=PATH=@openssh@/bin:@git@/bin Environment=GIT_SYNC_DIRECTORY=/a/path Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync Environment=GIT_SYNC_REPOSITORY='git+ssh://user@example.com:/~user/path/to/repo.git' diff --git a/tests/modules/services/git-sync/whitespace.nix b/tests/modules/services/git-sync/whitespace.nix index 871843553..9097b4ff8 100644 --- a/tests/modules/services/git-sync/whitespace.nix +++ b/tests/modules/services/git-sync/whitespace.nix @@ -1,9 +1,6 @@ -{ config, ... }: - { services.git-sync = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; }; repositories = { testWithWhitespace = { path = "/a path"; @@ -12,21 +9,18 @@ }; }; - test.stubs.openssh = { name = "openssh"; }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/git-sync-testWithWhitespace.service assertFileExists $serviceFile - serviceFile=$(normalizeStorePaths $serviceFile) assertFileContent $serviceFile ${ builtins.toFile "expected" '' [Install] WantedBy=default.target [Service] - Environment=PATH=@openssh@/bin:/nix/store/00000000000000000000000000000000-git/bin + Environment=PATH=@openssh@/bin:@git@/bin Environment=GIT_SYNC_DIRECTORY='/a path' Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync Environment=GIT_SYNC_REPOSITORY='git+ssh://user@example.com:/~user/path to/repo.git' diff --git a/tests/modules/services/glance/default-settings.nix b/tests/modules/services/glance/default-settings.nix index 7b35db779..fbd9159cc 100644 --- a/tests/modules/services/glance/default-settings.nix +++ b/tests/modules/services/glance/default-settings.nix @@ -1,10 +1,6 @@ -{ ... }: - { services.glance.enable = true; - test.stubs.glance = { }; - nmt.script = '' configFile=home-files/.config/glance/glance.yml serviceFile=home-files/.config/systemd/user/glance.service diff --git a/tests/modules/services/glance/example-settings.nix b/tests/modules/services/glance/example-settings.nix index 9e2101d2e..6b9dd59f3 100644 --- a/tests/modules/services/glance/example-settings.nix +++ b/tests/modules/services/glance/example-settings.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.glance = { enable = true; @@ -21,8 +19,6 @@ }; }; - test.stubs.glance = { }; - nmt.script = '' configFile=home-files/.config/glance/glance.yml serviceFile=home-files/.config/systemd/user/glance.service diff --git a/tests/modules/services/glance/glance.service b/tests/modules/services/glance/glance.service index 07b82d1d9..2f89ca23a 100644 --- a/tests/modules/services/glance/glance.service +++ b/tests/modules/services/glance/glance.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@glance@/bin/dummy --config /home/hm-user/.config/glance/glance.yml +ExecStart=@glance@/bin/glance --config /home/hm-user/.config/glance/glance.yml [Unit] Description=Glance feed dashboard server diff --git a/tests/modules/services/gpg-agent/default-homedir.nix b/tests/modules/services/gpg-agent/default-homedir.nix index 9c13520ae..ba7178078 100644 --- a/tests/modules/services/gpg-agent/default-homedir.nix +++ b/tests/modules/services/gpg-agent/default-homedir.nix @@ -1,29 +1,19 @@ { config, lib, pkgs, ... }: -with lib; +lib.mkIf pkgs.stdenv.isLinux { + services.gpg-agent.enable = true; + services.gpg-agent.pinentryPackage = pkgs.pinentry-gnome3; + programs.gpg.enable = true; -mkIf pkgs.stdenv.isLinux { - config = { - services.gpg-agent.enable = true; - services.gpg-agent.pinentryPackage = pkgs.pinentry-gnome3; - programs.gpg.enable = true; + nmt.script = '' + in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}" + if [[ $in != "%t/gnupg/S.gpg-agent" ]] + then + echo $in + fail "gpg-agent socket directory not set to default value" + fi - test.stubs = { - gnupg = { }; - systemd = { }; # depends on gnupg.override - pinentry-gnome3 = { }; - }; - - nmt.script = '' - in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}" - if [[ $in != "%t/gnupg/S.gpg-agent" ]] - then - echo $in - fail "gpg-agent socket directory not set to default value" - fi - - configFile=home-files/.gnupg/gpg-agent.conf - assertFileRegex $configFile "pinentry-program @pinentry-gnome3@/bin/dummy" - ''; - }; + configFile=home-files/.gnupg/gpg-agent.conf + assertFileRegex $configFile "pinentry-program @pinentry-gnome3@/bin/pinentry" + ''; } diff --git a/tests/modules/services/gpg-agent/override-homedir.nix b/tests/modules/services/gpg-agent/override-homedir.nix index 82dec0f95..9cebadf3c 100644 --- a/tests/modules/services/gpg-agent/override-homedir.nix +++ b/tests/modules/services/gpg-agent/override-homedir.nix @@ -1,32 +1,25 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, pkgs, ... }: let inherit (pkgs.stdenv) isDarwin; in { - config = { - services.gpg-agent.enable = true; - services.gpg-agent.pinentryPackage = null; # Don't build pinentry package. - programs.gpg = { - enable = true; - homedir = "/path/to/hash"; - package = config.lib.test.mkStubPackage { outPath = "@gpg@"; }; - }; - - test.stubs.gnupg = { }; - test.stubs.systemd = { }; # depends on gnupg.override - - nmt.script = if isDarwin then '' - serviceFile=LaunchAgents/org.nix-community.home.gpg-agent.plist - assertFileExists "$serviceFile" - assertFileContent "$serviceFile" ${./expected-agent.plist} - '' else '' - in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}" - if [[ $in != "%t/gnupg/d.wp4h7ks5zxy4dodqadgpbbpz/S.gpg-agent" ]] - then - echo $in - fail "gpg-agent socket directory is malformed" - fi - ''; + services.gpg-agent.enable = true; + services.gpg-agent.pinentryPackage = null; # Don't build pinentry package. + programs.gpg = { + enable = true; + homedir = "/path/to/hash"; + package = config.lib.test.mkStubPackage { outPath = "@gpg@"; }; }; + + nmt.script = if isDarwin then '' + serviceFile=LaunchAgents/org.nix-community.home.gpg-agent.plist + assertFileExists "$serviceFile" + assertFileContent "$serviceFile" ${./expected-agent.plist} + '' else '' + in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}" + if [[ $in != "%t/gnupg/d.wp4h7ks5zxy4dodqadgpbbpz/S.gpg-agent" ]] + then + echo $in + fail "gpg-agent socket directory is malformed" + fi + ''; } diff --git a/tests/modules/services/hypridle/basic-configuration.nix b/tests/modules/services/hypridle/basic-configuration.nix index 461f70a51..83347bcc7 100644 --- a/tests/modules/services/hypridle/basic-configuration.nix +++ b/tests/modules/services/hypridle/basic-configuration.nix @@ -1,9 +1,6 @@ -{ pkgs, ... }: - { services.hypridle = { enable = true; - package = pkgs.hypridle; settings = { general = { @@ -26,8 +23,6 @@ }; }; - test.stubs.hypridle = { }; - nmt.script = '' config=home-files/.config/hypr/hypridle.conf clientServiceFile=home-files/.config/systemd/user/hypridle.service diff --git a/tests/modules/services/hypridle/no-configuration.nix b/tests/modules/services/hypridle/no-configuration.nix index 805e49561..5b0b23cd5 100644 --- a/tests/modules/services/hypridle/no-configuration.nix +++ b/tests/modules/services/hypridle/no-configuration.nix @@ -1,10 +1,6 @@ -{ pkgs, ... }: - { services.hypridle.enable = true; - test.stubs.hypridle = { }; - nmt.script = '' config=home-files/.config/hypr/hypridle.conf clientServiceFile=home-files/.config/systemd/user/hypridle.service diff --git a/tests/modules/services/hyprpaper/basic-configuration.nix b/tests/modules/services/hyprpaper/basic-configuration.nix index 7bf944fbd..dc583575c 100644 --- a/tests/modules/services/hyprpaper/basic-configuration.nix +++ b/tests/modules/services/hyprpaper/basic-configuration.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - { services.hyprpaper = { enable = true; @@ -18,8 +16,6 @@ }; }; - test.stubs.hyprpaper = { }; - nmt.script = '' config=home-files/.config/hypr/hyprpaper.conf clientServiceFile=home-files/.config/systemd/user/hyprpaper.service diff --git a/tests/modules/services/hyprpaper/no-configuration.nix b/tests/modules/services/hyprpaper/no-configuration.nix index 15775e886..a6ed41a82 100644 --- a/tests/modules/services/hyprpaper/no-configuration.nix +++ b/tests/modules/services/hyprpaper/no-configuration.nix @@ -1,13 +1,9 @@ -{ pkgs, ... }: - { services.hyprpaper = { enable = true; settings = { }; }; - test.stubs.hyprpaper = { }; - nmt.script = '' config=home-files/.config/hypr/hyprpaper.conf clientServiceFile=home-files/.config/systemd/user/hyprpaper.service diff --git a/tests/modules/services/imapnotify-darwin/launchd.nix b/tests/modules/services/imapnotify-darwin/launchd.nix index 5502ebbfc..22630d701 100644 --- a/tests/modules/services/imapnotify-darwin/launchd.nix +++ b/tests/modules/services/imapnotify-darwin/launchd.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, pkgs, ... }: { imports = [ ../../accounts/email-test-accounts.nix ]; @@ -28,8 +26,6 @@ with lib; }); }; - test.stubs.notmuch = { }; - nmt.script = let serviceFileName = "org.nix-community.home.imapnotify-hm-example.com.plist"; in '' diff --git a/tests/modules/services/imapnotify/imapnotify.nix b/tests/modules/services/imapnotify/imapnotify.nix index 5a9e2b003..82d6f433b 100644 --- a/tests/modules/services/imapnotify/imapnotify.nix +++ b/tests/modules/services/imapnotify/imapnotify.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, pkgs, ... }: { imports = [ ../../accounts/email-test-accounts.nix ]; @@ -28,8 +26,6 @@ with lib; }); }; - test.stubs.notmuch = { }; - nmt.script = '' serviceFile="home-files/.config/systemd/user/imapnotify-hm-example.com.service" serviceFileNormalized="$(normalizeStorePaths "$serviceFile")" diff --git a/tests/modules/services/lieer/lieer-service.nix b/tests/modules/services/lieer/lieer-service.nix index 796afc072..cd2cde2e2 100644 --- a/tests/modules/services/lieer/lieer-service.nix +++ b/tests/modules/services/lieer/lieer-service.nix @@ -1,5 +1,3 @@ -{ ... }: - { imports = [ ../../accounts/email-test-accounts.nix ]; @@ -16,8 +14,6 @@ }; }; - test.stubs.lieer = { }; - nmt.script = '' assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.service assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.timer diff --git a/tests/modules/services/linux-wallpaperengine/basic-configuration-expected.service b/tests/modules/services/linux-wallpaperengine/basic-configuration-expected.service index 8aefc0582..b0827a39d 100644 --- a/tests/modules/services/linux-wallpaperengine/basic-configuration-expected.service +++ b/tests/modules/services/linux-wallpaperengine/basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@linux-wallpaperengine@/bin/dummy --assets-dir /some/path/to/assets --clamping border --fps 6 --scaling fit --screen-root HDMI-1 --bg 12345678 --no-audio-processing --noautomute --screen-root DP-1 --silent --scaling fill --fps 12 --bg 87654321 +ExecStart=@linux-wallpaperengine@/bin/linux-wallpaperengine --assets-dir /some/path/to/assets --clamping border --fps 6 --scaling fit --screen-root HDMI-1 --bg 12345678 --no-audio-processing --noautomute --screen-root DP-1 --silent --scaling fill --fps 12 --bg 87654321 Restart=on-failure [Unit] diff --git a/tests/modules/services/linux-wallpaperengine/basic-configuration.nix b/tests/modules/services/linux-wallpaperengine/basic-configuration.nix index 2f51bf5b3..afb2e964d 100644 --- a/tests/modules/services/linux-wallpaperengine/basic-configuration.nix +++ b/tests/modules/services/linux-wallpaperengine/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { services.linux-wallpaperengine = { enable = true; @@ -25,8 +23,6 @@ ]; }; - test.stubs.linux-wallpaperengine = { }; - nmt.script = '' assertFileContent \ home-files/.config/systemd/user/linux-wallpaperengine.service \ diff --git a/tests/modules/services/mopidy/basic-configuration.nix b/tests/modules/services/mopidy/basic-configuration.nix index 99aaeece8..26bc1c846 100644 --- a/tests/modules/services/mopidy/basic-configuration.nix +++ b/tests/modules/services/mopidy/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { services.mopidy = { enable = true; diff --git a/tests/modules/services/mopidy/mopidy-scan.nix b/tests/modules/services/mopidy/mopidy-scan.nix index 16b04292a..be7fe700a 100644 --- a/tests/modules/services/mopidy/mopidy-scan.nix +++ b/tests/modules/services/mopidy/mopidy-scan.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { services.mopidy = { @@ -16,8 +16,6 @@ chmod +x $out/bin/mopidy ''; }; - - mopidy-local = { }; }; nmt.script = '' diff --git a/tests/modules/services/mpd-mpris/configuration-basic.nix b/tests/modules/services/mpd-mpris/configuration-basic.nix index de7c594f3..afe1c3df1 100644 --- a/tests/modules/services/mpd-mpris/configuration-basic.nix +++ b/tests/modules/services/mpd-mpris/configuration-basic.nix @@ -1,10 +1,6 @@ -{ ... }: - { services.mpd-mpris = { enable = true; }; - test.stubs.mpd-mpris = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/mpd-mpris.service assertFileContent "$serviceFile" ${./configuration-basic.service} diff --git a/tests/modules/services/mpd-mpris/configuration-with-local-mpd.nix b/tests/modules/services/mpd-mpris/configuration-with-local-mpd.nix index a3a6b38d9..f1f8c8641 100644 --- a/tests/modules/services/mpd-mpris/configuration-with-local-mpd.nix +++ b/tests/modules/services/mpd-mpris/configuration-with-local-mpd.nix @@ -1,13 +1,9 @@ -{ ... }: - { services.mpd-mpris = { enable = true; mpd.useLocal = true; }; - test.stubs.mpd-mpris = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/mpd-mpris.service assertFileContent "$serviceFile" ${./configuration-with-local-mpd.service} diff --git a/tests/modules/services/mpd-mpris/configuration-with-password.nix b/tests/modules/services/mpd-mpris/configuration-with-password.nix index b10958253..5c5c6a936 100644 --- a/tests/modules/services/mpd-mpris/configuration-with-password.nix +++ b/tests/modules/services/mpd-mpris/configuration-with-password.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.mpd-mpris = { enable = true; @@ -11,8 +9,6 @@ }; }; - test.stubs.mpd-mpris = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/mpd-mpris.service assertFileContent "$serviceFile" ${./configuration-with-password.service} diff --git a/tests/modules/services/mpd/basic-configuration.nix b/tests/modules/services/mpd/basic-configuration.nix index 6ae0e91fc..9254a2cee 100644 --- a/tests/modules/services/mpd/basic-configuration.nix +++ b/tests/modules/services/mpd/basic-configuration.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { services.mpd = { enable = true; @@ -11,8 +7,6 @@ with lib; home.stateVersion = "22.11"; - test.stubs.mpd = { }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) assertFileContent "$serviceFile" ${./basic-configuration.service} diff --git a/tests/modules/services/mpd/basic-configuration.service b/tests/modules/services/mpd/basic-configuration.service index feb155ac4..05ec03846 100644 --- a/tests/modules/services/mpd/basic-configuration.service +++ b/tests/modules/services/mpd/basic-configuration.service @@ -4,7 +4,7 @@ WantedBy=default.target [Service] Environment=PATH=/home/hm-user/.nix-profile/bin ExecStart=@mpd@/bin/mpd --no-daemon /nix/store/00000000000000000000000000000000-mpd.conf --verbose -ExecStartPre=/nix/store/00000000000000000000000000000000-bash/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'" +ExecStartPre=@bash@/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'" Type=notify [Unit] diff --git a/tests/modules/services/mpd/before-state-version-22_11.nix b/tests/modules/services/mpd/before-state-version-22_11.nix index f29859ace..3bc1af4cc 100644 --- a/tests/modules/services/mpd/before-state-version-22_11.nix +++ b/tests/modules/services/mpd/before-state-version-22_11.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { services.mpd = { enable = true; @@ -10,8 +6,6 @@ with lib; home.stateVersion = "18.09"; - test.stubs.mpd = { }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) assertFileContent "$serviceFile" ${./basic-configuration.service} diff --git a/tests/modules/services/mpd/start-when-needed.nix b/tests/modules/services/mpd/start-when-needed.nix index 31017c9e3..ae39c92d8 100644 --- a/tests/modules/services/mpd/start-when-needed.nix +++ b/tests/modules/services/mpd/start-when-needed.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { services.mpd = { enable = true; @@ -12,8 +8,6 @@ with lib; home.stateVersion = "22.11"; - test.stubs.mpd = { }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) assertFileContent "$serviceFile" ${./start-when-needed.service} diff --git a/tests/modules/services/mpd/start-when-needed.service b/tests/modules/services/mpd/start-when-needed.service index ac98a3f97..91ce3890c 100644 --- a/tests/modules/services/mpd/start-when-needed.service +++ b/tests/modules/services/mpd/start-when-needed.service @@ -1,7 +1,7 @@ [Service] Environment=PATH=/home/hm-user/.nix-profile/bin ExecStart=@mpd@/bin/mpd --no-daemon /nix/store/00000000000000000000000000000000-mpd.conf --verbose -ExecStartPre=/nix/store/00000000000000000000000000000000-bash/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'" +ExecStartPre=@bash@/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'" Type=notify [Unit] diff --git a/tests/modules/services/mpd/xdg-music-dir.nix b/tests/modules/services/mpd/xdg-music-dir.nix index 6df2cec46..bcaeeece2 100644 --- a/tests/modules/services/mpd/xdg-music-dir.nix +++ b/tests/modules/services/mpd/xdg-music-dir.nix @@ -1,7 +1,3 @@ -{ config, lib, pkgs, ... }: - -with lib; - { services.mpd = { enable = true; @@ -12,8 +8,6 @@ with lib; home.stateVersion = "22.11"; - test.stubs.mpd = { }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) assertFileContent "$serviceFile" ${./basic-configuration.service} diff --git a/tests/modules/services/mpdris2/basic-configuration.nix b/tests/modules/services/mpdris2/basic-configuration.nix index b8c595be2..f98f61ad8 100644 --- a/tests/modules/services/mpdris2/basic-configuration.nix +++ b/tests/modules/services/mpdris2/basic-configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.mpdris2 = { enable = true; @@ -9,8 +7,6 @@ services.mpd.musicDirectory = "/home/hm-user/music"; - test.stubs.mpdris2 = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/mpdris2.service assertFileContent "$serviceFile" ${./basic-configuration.service} diff --git a/tests/modules/services/mpdris2/basic-configuration.service b/tests/modules/services/mpdris2/basic-configuration.service index 2ea4656c7..9d58a9e51 100644 --- a/tests/modules/services/mpdris2/basic-configuration.service +++ b/tests/modules/services/mpdris2/basic-configuration.service @@ -3,7 +3,7 @@ WantedBy=default.target [Service] BusName=org.mpris.MediaPlayer2.mpd -ExecStart=@mpdris2@/bin/mpDris2 +ExecStart=@mpDris2@/bin/mpDris2 Restart=on-failure RestartSec=5s Type=simple diff --git a/tests/modules/services/mpdris2/with-password.nix b/tests/modules/services/mpdris2/with-password.nix index af4ef33cc..496d26e63 100644 --- a/tests/modules/services/mpdris2/with-password.nix +++ b/tests/modules/services/mpdris2/with-password.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.mpdris2 = { enable = true; @@ -12,8 +10,6 @@ services.mpd.musicDirectory = "/home/hm-user/music"; - test.stubs.mpdris2 = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/mpdris2.service assertFileContent "$serviceFile" ${./basic-configuration.service} diff --git a/tests/modules/services/nix-gc-darwin/basic.nix b/tests/modules/services/nix-gc-darwin/basic.nix index f09309fe0..707ae44e6 100644 --- a/tests/modules/services/nix-gc-darwin/basic.nix +++ b/tests/modules/services/nix-gc-darwin/basic.nix @@ -1,5 +1,3 @@ -{ ... }: - { nix.gc = { automatic = true; @@ -7,8 +5,6 @@ options = "--delete-older-than 30d"; }; - test.stubs.nix = { name = "nix"; }; - nmt.script = '' serviceFile=LaunchAgents/org.nix-community.home.nix-gc.plist diff --git a/tests/modules/services/nix-gc/basic.nix b/tests/modules/services/nix-gc/basic.nix index 1fc019da7..a6b06f246 100644 --- a/tests/modules/services/nix-gc/basic.nix +++ b/tests/modules/services/nix-gc/basic.nix @@ -1,5 +1,3 @@ -{ ... }: - { nix.gc = { automatic = true; @@ -8,8 +6,6 @@ options = "--delete-older-than 30d --max-freed $((64 * 1024**3))"; }; - test.stubs.nix = { name = "nix"; }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/nix-gc.service diff --git a/tests/modules/services/ollama/darwin/basic.nix b/tests/modules/services/ollama/darwin/basic.nix index b9203cc7e..bb072a977 100644 --- a/tests/modules/services/ollama/darwin/basic.nix +++ b/tests/modules/services/ollama/darwin/basic.nix @@ -11,8 +11,6 @@ lib.mkMerge [ HIP_VISIBLE_DEVICES = "0,1"; }; }; - - test.stubs.ollama = { }; } (lib.mkIf pkgs.stdenv.isDarwin { nmt.script = '' diff --git a/tests/modules/services/ollama/linux/basic.nix b/tests/modules/services/ollama/linux/basic.nix index fecee950f..2480d8466 100644 --- a/tests/modules/services/ollama/linux/basic.nix +++ b/tests/modules/services/ollama/linux/basic.nix @@ -1,13 +1,9 @@ { - config = { - services.ollama.enable = true; + services.ollama.enable = true; - test.stubs.ollama = { }; - - nmt.script = '' - serviceFile="home-files/.config/systemd/user/ollama.service" - assertFileRegex "$serviceFile" 'After=network\.target' - assertFileRegex "$serviceFile" 'Environment=OLLAMA_HOST=127.0.0.1:11434' - ''; - }; + nmt.script = '' + serviceFile="home-files/.config/systemd/user/ollama.service" + assertFileRegex "$serviceFile" 'After=network\.target' + assertFileRegex "$serviceFile" 'Environment=OLLAMA_HOST=127.0.0.1:11434' + ''; } diff --git a/tests/modules/services/ollama/linux/set-environment-variables.nix b/tests/modules/services/ollama/linux/set-environment-variables.nix index b9ad280c9..672c6dddd 100644 --- a/tests/modules/services/ollama/linux/set-environment-variables.nix +++ b/tests/modules/services/ollama/linux/set-environment-variables.nix @@ -1,22 +1,18 @@ { - config = { - services.ollama = { - enable = true; - host = "localhost"; - port = 11111; - environmentVariables = { - OLLAMA_LLM_LIBRARY = "cpu"; - HIP_VISIBLE_DEVICES = "0,1"; - }; + services.ollama = { + enable = true; + host = "localhost"; + port = 11111; + environmentVariables = { + OLLAMA_LLM_LIBRARY = "cpu"; + HIP_VISIBLE_DEVICES = "0,1"; }; - - test.stubs.ollama = { }; - - nmt.script = '' - serviceFile="home-files/.config/systemd/user/ollama.service" - assertFileRegex "$serviceFile" 'Environment=OLLAMA_HOST=localhost:11111' - assertFileRegex "$serviceFile" 'Environment=OLLAMA_LLM_LIBRARY=cpu' - assertFileRegex "$serviceFile" 'Environment=HIP_VISIBLE_DEVICES=0,1' - ''; }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/ollama.service" + assertFileRegex "$serviceFile" 'Environment=OLLAMA_HOST=localhost:11111' + assertFileRegex "$serviceFile" 'Environment=OLLAMA_LLM_LIBRARY=cpu' + assertFileRegex "$serviceFile" 'Environment=HIP_VISIBLE_DEVICES=0,1' + ''; } diff --git a/tests/modules/services/pasystray/service.nix b/tests/modules/services/pasystray/service.nix index 5b8548c8b..34b3291bc 100644 --- a/tests/modules/services/pasystray/service.nix +++ b/tests/modules/services/pasystray/service.nix @@ -1,17 +1,9 @@ -{ ... }: - { services.pasystray = { enable = true; extraOptions = [ "-g" ]; }; - test.stubs = { - pasystray = { }; - paprefs = { }; - pavucontrol = { }; - }; - nmt.script = '' serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/pasystray.service) assertFileContent "$serviceFile" ${./expected.service} diff --git a/tests/modules/services/pbgopy/service.nix b/tests/modules/services/pbgopy/service.nix index 465024537..8093eed52 100644 --- a/tests/modules/services/pbgopy/service.nix +++ b/tests/modules/services/pbgopy/service.nix @@ -1,16 +1,12 @@ -{ config, pkgs, ... }: { - config = { - services.pbgopy.enable = true; +{ + services.pbgopy.enable = true; - test.stubs.pbgopy = { }; + nmt.script = '' + serviceFile=home-files/.config/systemd/user/pbgopy.service - nmt.script = '' - serviceFile=home-files/.config/systemd/user/pbgopy.service + assertFileExists $serviceFile - assertFileExists $serviceFile - - assertFileContains $serviceFile \ - 'ExecStart=@pbgopy@/bin/pbgopy serve --port 9090 --ttl 24h' - ''; - }; + assertFileContains $serviceFile \ + 'ExecStart=@pbgopy@/bin/pbgopy serve --port 9090 --ttl 24h' + ''; } diff --git a/tests/modules/services/picom/picom-basic-configuration-expected.service b/tests/modules/services/picom/picom-basic-configuration-expected.service index f5d0efeb0..6aeef2249 100644 --- a/tests/modules/services/picom/picom-basic-configuration-expected.service +++ b/tests/modules/services/picom/picom-basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@picom@/bin/dummy --config /nix/store/00000000000000000000000000000000-hm_picompicom.conf --legacy-backends +ExecStart=@picom@/bin/picom --config /nix/store/00000000000000000000000000000000-hm_picompicom.conf --legacy-backends Restart=always RestartSec=3 diff --git a/tests/modules/services/picom/picom-basic-configuration.nix b/tests/modules/services/picom/picom-basic-configuration.nix index 1c2689799..065c40b52 100644 --- a/tests/modules/services/picom/picom-basic-configuration.nix +++ b/tests/modules/services/picom/picom-basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { services.picom = { enable = true; @@ -22,8 +20,6 @@ extraArgs = [ "--legacy-backends" ]; }; - test.stubs.picom = { }; - nmt.script = '' assertFileContent \ home-files/.config/picom/picom.conf \ diff --git a/tests/modules/services/podman-linux/configuration.nix b/tests/modules/services/podman-linux/configuration.nix index b1c0d596b..a45524f8c 100644 --- a/tests/modules/services/podman-linux/configuration.nix +++ b/tests/modules/services/podman-linux/configuration.nix @@ -1,5 +1,3 @@ -{ ... }: - { services.podman = { enable = true; diff --git a/tests/modules/services/podman-linux/container.nix b/tests/modules/services/podman-linux/container.nix index 102a7fb10..fa9c654d4 100644 --- a/tests/modules/services/podman-linux/container.nix +++ b/tests/modules/services/podman-linux/container.nix @@ -1,6 +1,6 @@ -{ ... }: - { + imports = [ ./podman-stubs.nix ]; + services.podman = { enable = true; containers = { diff --git a/tests/modules/services/podman-linux/integration-network-expected.service b/tests/modules/services/podman-linux/integration-network-expected.service index 49acd4b9f..5af3bccea 100644 --- a/tests/modules/services/podman-linux/integration-network-expected.service +++ b/tests/modules/services/podman-linux/integration-network-expected.service @@ -15,7 +15,7 @@ NetworkName=my-net Subnet=192.168.123.0/24 [Service] -Environment=PATH=/run/wrappers/bin:/usr/bin:/bin:/usr/sbin:/sbin:/nix/store/00000000000000000000000000000000-shadow/bin:/nix/store/00000000000000000000000000000000-coreutils/bin +Environment=PATH=/run/wrappers/bin:/usr/bin:/bin:/usr/sbin:/sbin:@shadow@/bin:/nix/store/00000000000000000000000000000000-coreutils/bin ExecStartPre=/nix/store/00000000000000000000000000000000-await-podman-unshare RemainAfterExit=yes TimeoutStartSec=15 diff --git a/tests/modules/services/podman-linux/integration.nix b/tests/modules/services/podman-linux/integration.nix index de213092d..6b28fcd7a 100644 --- a/tests/modules/services/podman-linux/integration.nix +++ b/tests/modules/services/podman-linux/integration.nix @@ -1,6 +1,6 @@ -{ ... }: - { + imports = [ ./podman-stubs.nix ]; + services.podman = { enable = true; containers."my-container" = { diff --git a/tests/modules/services/podman-linux/manifest.nix b/tests/modules/services/podman-linux/manifest.nix index b692ea7ae..13a0ab387 100644 --- a/tests/modules/services/podman-linux/manifest.nix +++ b/tests/modules/services/podman-linux/manifest.nix @@ -1,6 +1,6 @@ -{ ... }: - { + imports = [ ./podman-stubs.nix ]; + services.podman = { enable = true; containers."my-container-1" = { diff --git a/tests/modules/services/podman-linux/network-expected.service b/tests/modules/services/podman-linux/network-expected.service index 1017a17e7..6d3cf8633 100644 --- a/tests/modules/services/podman-linux/network-expected.service +++ b/tests/modules/services/podman-linux/network-expected.service @@ -19,7 +19,7 @@ PodmanArgs=--log-level=debug Subnet=192.168.1.0/24 [Service] -Environment=PATH=/run/wrappers/bin:/usr/bin:/bin:/usr/sbin:/sbin:/nix/store/00000000000000000000000000000000-shadow/bin:/nix/store/00000000000000000000000000000000-coreutils/bin +Environment=PATH=/run/wrappers/bin:/usr/bin:/bin:/usr/sbin:/sbin:@shadow@/bin:/nix/store/00000000000000000000000000000000-coreutils/bin ExecStartPre=/nix/store/00000000000000000000000000000000-await-podman-unshare RemainAfterExit=yes TimeoutStartSec=15 diff --git a/tests/modules/services/podman-linux/network.nix b/tests/modules/services/podman-linux/network.nix index b6a46eba5..0f53b0d5d 100644 --- a/tests/modules/services/podman-linux/network.nix +++ b/tests/modules/services/podman-linux/network.nix @@ -1,6 +1,6 @@ -{ ... }: - { + imports = [ ./podman-stubs.nix ]; + services.podman = { enable = true; networks = { diff --git a/tests/modules/services/podman-linux/podman-stubs.nix b/tests/modules/services/podman-linux/podman-stubs.nix new file mode 100644 index 000000000..70f3bfbc6 --- /dev/null +++ b/tests/modules/services/podman-linux/podman-stubs.nix @@ -0,0 +1,5 @@ +{ realPkgs, ... }: + +{ + nixpkgs.overlays = [ (self: super: { inherit (realPkgs) podman skopeo; }) ]; +} diff --git a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix index 6f0454bf3..06093154d 100644 --- a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix +++ b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix @@ -1,30 +1,24 @@ -{ config, pkgs, ... }: - { - config = { - services.gammastep = { - enable = true; - provider = "manual"; - dawnTime = "6:00-7:45"; - duskTime = "18:35-20:15"; - settings = { - general = { - adjustment-method = "randr"; - gamma = 0.8; - }; - randr = { screen = 0; }; + services.gammastep = { + enable = true; + provider = "manual"; + dawnTime = "6:00-7:45"; + duskTime = "18:35-20:15"; + settings = { + general = { + adjustment-method = "randr"; + gamma = 0.8; }; + randr = { screen = 0; }; }; - - test.stubs.gammastep = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/gammastep/config.ini \ - ${./gammastep-basic-configuration-file-expected.conf} - assertFileContent \ - home-files/.config/systemd/user/gammastep.service \ - ${./gammastep-basic-configuration-expected.service} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/gammastep/config.ini \ + ${./gammastep-basic-configuration-file-expected.conf} + assertFileContent \ + home-files/.config/systemd/user/gammastep.service \ + ${./gammastep-basic-configuration-expected.service} + ''; } diff --git a/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix b/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix index 691d01e25..0ecb3ec81 100644 --- a/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix +++ b/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix @@ -1,30 +1,24 @@ -{ config, pkgs, ... }: - { - config = { - services.redshift = { - enable = true; - provider = "manual"; - latitude = 0.0; - longitude = "0.0"; - settings = { - redshift = { - adjustment-method = "randr"; - gamma = 0.8; - }; - randr = { screen = 0; }; + services.redshift = { + enable = true; + provider = "manual"; + latitude = 0.0; + longitude = "0.0"; + settings = { + redshift = { + adjustment-method = "randr"; + gamma = 0.8; }; + randr = { screen = 0; }; }; - - test.stubs.redshift = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/redshift/redshift.conf \ - ${./redshift-basic-configuration-file-expected.conf} - assertFileContent \ - home-files/.config/systemd/user/redshift.service \ - ${./redshift-basic-configuration-expected.service} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/redshift/redshift.conf \ + ${./redshift-basic-configuration-file-expected.conf} + assertFileContent \ + home-files/.config/systemd/user/redshift.service \ + ${./redshift-basic-configuration-expected.service} + ''; } diff --git a/tests/modules/services/screen-locker/basic-configuration.nix b/tests/modules/services/screen-locker/basic-configuration.nix index 9eee2a8e2..855370d2b 100644 --- a/tests/modules/services/screen-locker/basic-configuration.nix +++ b/tests/modules/services/screen-locker/basic-configuration.nix @@ -1,30 +1,25 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { - config = { - services.screen-locker = { + services.screen-locker = { + enable = true; + inactiveInterval = 5; + lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; + xss-lock = { extraOptions = [ "-test" ]; }; + xautolock = { enable = true; - inactiveInterval = 5; - lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; - xss-lock = { extraOptions = [ "-test" ]; }; - xautolock = { - enable = true; - detectSleep = true; - extraOptions = [ "-test" ]; - }; + detectSleep = true; + extraOptions = [ "-test" ]; }; - - test.stubs.i3lock = { }; - test.stubs.xss-lock = { }; - - nmt.script = '' - xssService=home-files/.config/systemd/user/xss-lock.service - xautolockService=home-files/.config/systemd/user/xautolock-session.service - - assertFileExists $xssService - assertFileRegex $xssService 'ExecStart=.*/bin/xss-lock.*-test.*i3lock -n -c AA0000' - assertFileExists $xautolockService - assertFileRegex $xautolockService 'ExecStart=.*/bin/xautolock.*-time 5.*-detectsleep.*-test.*' - ''; }; + + nmt.script = '' + xssService=home-files/.config/systemd/user/xss-lock.service + xautolockService=home-files/.config/systemd/user/xautolock-session.service + + assertFileExists $xssService + assertFileRegex $xssService 'ExecStart=.*/bin/xss-lock.*-test.*i3lock -n -c AA0000' + assertFileExists $xautolockService + assertFileRegex $xautolockService 'ExecStart=.*/bin/xautolock.*-time 5.*-detectsleep.*-test.*' + ''; } diff --git a/tests/modules/services/screen-locker/moved-options.nix b/tests/modules/services/screen-locker/moved-options.nix index 4c9cad19e..9e0ca0da4 100644 --- a/tests/modules/services/screen-locker/moved-options.nix +++ b/tests/modules/services/screen-locker/moved-options.nix @@ -1,36 +1,30 @@ { config, pkgs, options, lib, ... }: { - config = { - services.screen-locker = { - enable = true; - inactiveInterval = 5; - lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; - xssLockExtraOptions = [ "-test" ]; - xautolockExtraOptions = [ "-test" ]; - enableDetectSleep = true; - }; - - test.stubs.i3lock = { }; - test.stubs.xss-lock = { }; - - # Use the same verification script as the basic configuration. The result - # with the old options should be identical. - nmt.script = (import ./basic-configuration.nix { - inherit config pkgs; - }).config.nmt.script; - - test.asserts.warnings.expected = with lib; - let - renamed = { - xssLockExtraOptions = "xss-lock.extraOptions"; - xautolockExtraOptions = "xautolock.extraOptions"; - enableDetectSleep = "xautolock.detectSleep"; - }; - in mapAttrsToList (old: new: - builtins.replaceStrings [ "\n" ] [ " " ] '' - The option `services.screen-locker.${old}' defined in - ${showFiles options.services.screen-locker.${old}.files} - has been renamed to `services.screen-locker.${new}'.'') renamed; + services.screen-locker = { + enable = true; + inactiveInterval = 5; + lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; + xssLockExtraOptions = [ "-test" ]; + xautolockExtraOptions = [ "-test" ]; + enableDetectSleep = true; }; + + # Use the same verification script as the basic configuration. The result + # with the old options should be identical. + nmt.script = + (import ./basic-configuration.nix { inherit config pkgs; }).nmt.script; + + test.asserts.warnings.expected = with lib; + let + renamed = { + xssLockExtraOptions = "xss-lock.extraOptions"; + xautolockExtraOptions = "xautolock.extraOptions"; + enableDetectSleep = "xautolock.detectSleep"; + }; + in mapAttrsToList (old: new: + builtins.replaceStrings [ "\n" ] [ " " ] '' + The option `services.screen-locker.${old}' defined in + ${showFiles options.services.screen-locker.${old}.files} + has been renamed to `services.screen-locker.${new}'.'') renamed; } diff --git a/tests/modules/services/screen-locker/no-xautolock.nix b/tests/modules/services/screen-locker/no-xautolock.nix index 7ec5152b0..5883d09b6 100644 --- a/tests/modules/services/screen-locker/no-xautolock.nix +++ b/tests/modules/services/screen-locker/no-xautolock.nix @@ -1,27 +1,22 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { - config = { - services.screen-locker = { - enable = true; - inactiveInterval = 5; - lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; - xss-lock = { - extraOptions = [ "-test" ]; - screensaverCycle = 5; - }; - xautolock = { enable = false; }; + services.screen-locker = { + enable = true; + inactiveInterval = 5; + lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; + xss-lock = { + extraOptions = [ "-test" ]; + screensaverCycle = 5; }; - - test.stubs.i3lock = { }; - test.stubs.xss-lock = { }; - - nmt.script = '' - xssService=home-files/.config/systemd/user/xss-lock.service - - assertFileExists $xssService - assertFileRegex $xssService 'ExecStart=.*/bin/xss-lock.*-test.*i3lock -n -c AA0000' - assertFileRegex $xssService 'ExecStartPre=.*/xset s 300 5' - ''; + xautolock = { enable = false; }; }; + + nmt.script = '' + xssService=home-files/.config/systemd/user/xss-lock.service + + assertFileExists $xssService + assertFileRegex $xssService 'ExecStart=.*/bin/xss-lock.*-test.*i3lock -n -c AA0000' + assertFileRegex $xssService 'ExecStartPre=.*/xset s 300 5' + ''; } diff --git a/tests/modules/services/signaturepdf/basic-configuration.nix b/tests/modules/services/signaturepdf/basic-configuration.nix index 66c1b0834..0cfe0c3e8 100644 --- a/tests/modules/services/signaturepdf/basic-configuration.nix +++ b/tests/modules/services/signaturepdf/basic-configuration.nix @@ -1,5 +1,3 @@ -{ config, pkgs, ... }: - { services.signaturepdf = { enable = true; @@ -7,10 +5,7 @@ extraConfig = { upload_max_filesize = "24M"; }; }; - test.stubs = { - signaturepdf = { outPath = "/signaturepdf"; }; - xdg-utils = { }; - }; + test.stubs.signaturepdf = { outPath = "/signaturepdf"; }; nmt.script = '' assertFileContent \ diff --git a/tests/modules/services/snixembed/basic-configuration.nix b/tests/modules/services/snixembed/basic-configuration.nix index fd8ec4701..3d999dcd6 100644 --- a/tests/modules/services/snixembed/basic-configuration.nix +++ b/tests/modules/services/snixembed/basic-configuration.nix @@ -1,13 +1,9 @@ -{ ... }: - { services.snixembed = { enable = true; beforeUnits = [ "safeeyes.service" ]; }; - test.stubs = { snixembed = { outPath = "/snixembed"; }; }; - nmt.script = '' assertFileContent \ home-files/.config/systemd/user/snixembed.service \ diff --git a/tests/modules/services/snixembed/basic-configuration.service b/tests/modules/services/snixembed/basic-configuration.service index 97e87664b..5bcfc29ec 100644 --- a/tests/modules/services/snixembed/basic-configuration.service +++ b/tests/modules/services/snixembed/basic-configuration.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=/snixembed/bin/dummy +ExecStart=@snixembed@/bin/snixembed Restart=on-failure RestartSec=3 diff --git a/tests/modules/services/swayidle/basic-configuration.nix b/tests/modules/services/swayidle/basic-configuration.nix index c863883bb..697c1de46 100644 --- a/tests/modules/services/swayidle/basic-configuration.nix +++ b/tests/modules/services/swayidle/basic-configuration.nix @@ -44,7 +44,7 @@ WantedBy=graphical-session.target [Service] - Environment=PATH=/nix/store/00000000000000000000000000000000-bash/bin + Environment=PATH=@bash@/bin ExecStart=@swayidle@/bin/dummy -w timeout 50 'notify-send -t 10000 -- "Screen lock in 10 seconds"' timeout 60 'swaylock -fF' timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -fF' lock 'swaylock -fF' Restart=always Type=simple diff --git a/tests/modules/services/syncthing/common/extra-options.nix b/tests/modules/services/syncthing/common/extra-options.nix index f861e2a63..9db9f5940 100644 --- a/tests/modules/services/syncthing/common/extra-options.nix +++ b/tests/modules/services/syncthing/common/extra-options.nix @@ -6,9 +6,8 @@ lib.mkMerge [ enable = true; extraOptions = [ "-foo" ''-bar "baz"'' ]; }; - - test.stubs.syncthing = { }; } + (lib.mkIf pkgs.stdenv.isLinux { nmt.script = '' assertFileExists home-files/.config/systemd/user/syncthing.service @@ -16,6 +15,7 @@ lib.mkMerge [ "ExecStart=@syncthing@/bin/syncthing -no-browser -no-restart -no-upgrade '-gui-address=127.0.0.1:8384' '-logflags=0' -foo '-bar \"baz\"'" ''; }) + (lib.mkIf pkgs.stdenv.isDarwin { nmt.script = '' serviceFile=LaunchAgents/org.nix-community.home.syncthing.plist diff --git a/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix b/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix index ca018c2d8..355da3214 100644 --- a/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix +++ b/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix @@ -1,19 +1,11 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - services.syncthing.tray = true; + services.syncthing.tray = true; - test.asserts.warnings.expected = [ - "Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257." - ]; + test.asserts.warnings.expected = [ + "Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257." + ]; - test.stubs.syncthingtray-minimal = { }; - - nmt.script = '' - assertFileExists home-files/.config/systemd/user/syncthingtray.service - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/systemd/user/syncthingtray.service + ''; } diff --git a/tests/modules/services/syncthing/linux/tray.nix b/tests/modules/services/syncthing/linux/tray.nix index 5ff3c2841..a1a426a12 100644 --- a/tests/modules/services/syncthing/linux/tray.nix +++ b/tests/modules/services/syncthing/linux/tray.nix @@ -1,21 +1,7 @@ -{ config, lib, pkgs, ... }: - -with lib; - { - config = { - services.syncthing.tray.enable = true; + services.syncthing.tray.enable = true; - nixpkgs.overlays = [ - (self: super: { - syncthingtray-minimal = - pkgs.runCommandLocal "syncthingtray" { pname = "syncthingtray"; } - "mkdir $out"; - }) - ]; - - nmt.script = '' - assertFileExists home-files/.config/systemd/user/syncthingtray.service - ''; - }; + nmt.script = '' + assertFileExists home-files/.config/systemd/user/syncthingtray.service + ''; } diff --git a/tests/modules/services/trayscale/hide-window.nix b/tests/modules/services/trayscale/hide-window.nix index 72181e898..fafb00c3d 100644 --- a/tests/modules/services/trayscale/hide-window.nix +++ b/tests/modules/services/trayscale/hide-window.nix @@ -1,11 +1,9 @@ -{ ... }: { +{ services.trayscale = { enable = true; hideWindow = true; }; - test.stubs = { trayscale = { }; }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/trayscale.service assertFileExists $serviceFile diff --git a/tests/modules/services/trayscale/show-window.nix b/tests/modules/services/trayscale/show-window.nix index 62157ab54..7ac11c902 100644 --- a/tests/modules/services/trayscale/show-window.nix +++ b/tests/modules/services/trayscale/show-window.nix @@ -1,11 +1,9 @@ -{ ... }: { +{ services.trayscale = { enable = true; hideWindow = false; }; - test.stubs = { trayscale = { }; }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/trayscale.service assertFileExists $serviceFile diff --git a/tests/modules/services/twmn/basic-configuration.nix b/tests/modules/services/twmn/basic-configuration.nix index 5da926e48..1779f0ae8 100644 --- a/tests/modules/services/twmn/basic-configuration.nix +++ b/tests/modules/services/twmn/basic-configuration.nix @@ -1,51 +1,47 @@ { - config = { - services.twmn = { - enable = true; - duration = 4242; - host = "example.com"; - port = 9006; - screen = 0; - soundCommand = "/path/sound/command"; - icons.critical = "/path/icon/critical"; - icons.info = "/path/icon/info"; - icons.warning = "/path/icon/warning"; - text = { - color = "#FF00FF"; - font.family = "Noto Sans"; - font.size = 16; - font.variant = "italic"; - maxLength = 80; - }; - window = { - alwaysOnTop = true; - color = "black"; - height = 20; - offset.x = 20; - offset.y = -60; - opacity = 80; - position = "center"; - animation = { - easeIn.curve = 27; - easeIn.duration = 314; - easeOut.curve = 13; - easeOut.duration = 168; - bounce.enable = true; - bounce.duration = 271; - }; + services.twmn = { + enable = true; + duration = 4242; + host = "example.com"; + port = 9006; + screen = 0; + soundCommand = "/path/sound/command"; + icons.critical = "/path/icon/critical"; + icons.info = "/path/icon/info"; + icons.warning = "/path/icon/warning"; + text = { + color = "#FF00FF"; + font.family = "Noto Sans"; + font.size = 16; + font.variant = "italic"; + maxLength = 80; + }; + window = { + alwaysOnTop = true; + color = "black"; + height = 20; + offset.x = 20; + offset.y = -60; + opacity = 80; + position = "center"; + animation = { + easeIn.curve = 27; + easeIn.duration = 314; + easeOut.curve = 13; + easeOut.duration = 168; + bounce.enable = true; + bounce.duration = 271; }; }; - - test.stubs.twmn = { }; - - nmt.script = '' - serviceFile="home-files/.config/systemd/user/twmnd.service" - assertFileExists "$serviceFile" - assertFileRegex "$serviceFile" 'X-Restart-Triggers=.*twmn\.conf' - assertFileRegex "$serviceFile" 'ExecStart=@twmn@/bin/twmnd' - assertFileExists "home-files/.config/twmn/twmn.conf" - assertFileContent "home-files/.config/twmn/twmn.conf" \ - ${./basic-configuration.conf} - ''; }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/twmnd.service" + assertFileExists "$serviceFile" + assertFileRegex "$serviceFile" 'X-Restart-Triggers=.*twmn\.conf' + assertFileRegex "$serviceFile" 'ExecStart=@twmn@/bin/twmnd' + assertFileExists "home-files/.config/twmn/twmn.conf" + assertFileContent "home-files/.config/twmn/twmn.conf" \ + ${./basic-configuration.conf} + ''; } diff --git a/tests/modules/services/udiskie/basic.nix b/tests/modules/services/udiskie/basic.nix index 5fa623c3e..0c07276b8 100644 --- a/tests/modules/services/udiskie/basic.nix +++ b/tests/modules/services/udiskie/basic.nix @@ -1,15 +1,11 @@ { - config = { - services.udiskie.enable = true; + services.udiskie.enable = true; - test.stubs.udiskie = { }; - - nmt.script = '' - serviceFile="home-files/.config/systemd/user/udiskie.service" - assertFileRegex "$serviceFile" 'After=tray\.target' - assertFileRegex "$serviceFile" 'Requires=tray\.target' - assertFileContent "home-files/.config/udiskie/config.yml" \ - ${./basic.yml} - ''; - }; + nmt.script = '' + serviceFile="home-files/.config/systemd/user/udiskie.service" + assertFileRegex "$serviceFile" 'After=tray\.target' + assertFileRegex "$serviceFile" 'Requires=tray\.target' + assertFileContent "home-files/.config/udiskie/config.yml" \ + ${./basic.yml} + ''; } diff --git a/tests/modules/services/udiskie/no-tray.nix b/tests/modules/services/udiskie/no-tray.nix index 0c7ede0bd..aa9ca9310 100644 --- a/tests/modules/services/udiskie/no-tray.nix +++ b/tests/modules/services/udiskie/no-tray.nix @@ -1,18 +1,14 @@ { - config = { - services.udiskie = { - enable = true; - tray = "never"; - }; - - test.stubs.udiskie = { }; - - nmt.script = '' - serviceFile="home-files/.config/systemd/user/udiskie.service" - assertFileNotRegex "$serviceFile" 'After=tray\.target' - assertFileNotRegex "$serviceFile" 'Requires=tray\.target' - assertFileContent "home-files/.config/udiskie/config.yml" \ - ${./no-tray.yml} - ''; + services.udiskie = { + enable = true; + tray = "never"; }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/udiskie.service" + assertFileNotRegex "$serviceFile" 'After=tray\.target' + assertFileNotRegex "$serviceFile" 'Requires=tray\.target' + assertFileContent "home-files/.config/udiskie/config.yml" \ + ${./no-tray.yml} + ''; } diff --git a/tests/modules/services/volnoti/package-option.nix b/tests/modules/services/volnoti/package-option.nix index ab403cdb2..c199a3a8f 100644 --- a/tests/modules/services/volnoti/package-option.nix +++ b/tests/modules/services/volnoti/package-option.nix @@ -9,8 +9,6 @@ }; }; - test.stubs.volnoti = { }; - nmt.script = '' serviceFile=home-files/.config/systemd/user/volnoti.service assertFileExists $serviceFile diff --git a/tests/modules/services/window-managers/bspwm/bspwm-stubs.nix b/tests/modules/services/window-managers/bspwm/bspwm-stubs.nix deleted file mode 100644 index 7e9fd5efd..000000000 --- a/tests/modules/services/window-managers/bspwm/bspwm-stubs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { bspwm = { }; }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/bspwm/configuration.nix b/tests/modules/services/window-managers/bspwm/configuration.nix index 5a4dec12e..9d58bb932 100644 --- a/tests/modules/services/window-managers/bspwm/configuration.nix +++ b/tests/modules/services/window-managers/bspwm/configuration.nix @@ -1,8 +1,6 @@ { pkgs, ... }: { - imports = [ ./bspwm-stubs.nix ]; - xsession.windowManager.bspwm = { enable = true; monitors.focused = [ "desktop 1" "d'esk top" ]; # pathological desktop names @@ -31,8 +29,6 @@ startupPrograms = [ "foo" "bar || qux" ]; }; - test.stubs.bspwm = { }; - nmt.script = '' bspwmrc=home-files/.config/bspwm/bspwmrc assertFileExists "$bspwmrc" diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix index 207421652..44ed150b9 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix @@ -1,12 +1,6 @@ -{ lib, pkgs, ... }: - { - imports = [ ./herbstluftwm-stubs.nix ]; - xsession.windowManager.herbstluftwm = { enable = true; }; - test.stubs.herbstluftwm = { }; - nmt.script = '' autostart=home-files/.config/herbstluftwm/autostart assertFileExists "$autostart" diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix index 9a93358cf..23e1a97d3 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix @@ -1,8 +1,4 @@ -{ lib, pkgs, ... }: - { - imports = [ ./herbstluftwm-stubs.nix ]; - xsession.windowManager.herbstluftwm = { enable = true; settings = { @@ -33,8 +29,6 @@ ''; }; - test.stubs.herbstluftwm = { }; - nmt.script = '' autostart=home-files/.config/herbstluftwm/autostart assertFileExists "$autostart" diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-stubs.nix b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-stubs.nix deleted file mode 100644 index 7c24083a2..000000000 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-stubs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { herbstluftwm = { }; }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/hyprland/hyprland-stubs.nix b/tests/modules/services/window-managers/hyprland/hyprland-stubs.nix deleted file mode 100644 index 02d1885bb..000000000 --- a/tests/modules/services/window-managers/hyprland/hyprland-stubs.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { - xdg-desktop-portal = { }; - xwayland = { }; - }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - hyprland = lib.makeOverridable - (attrs: config.lib.test.mkStubPackage { name = "hyprland"; }) { }; - xdg-desktop-portal-hyprland = lib.makeOverridable (_: - config.lib.test.mkStubPackage { name = "xdg-desktop-portal-hyprland"; }) - { }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/hyprland/multiple-devices-config.conf b/tests/modules/services/window-managers/hyprland/multiple-devices-config.conf index 5d9102973..d0e82572d 100644 --- a/tests/modules/services/window-managers/hyprland/multiple-devices-config.conf +++ b/tests/modules/services/window-managers/hyprland/multiple-devices-config.conf @@ -1,4 +1,4 @@ -exec-once = /nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target +exec-once = @dbus@/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target plugin=/path/to/plugin1 plugin=/nix/store/00000000000000000000000000000000-foo/lib/libfoo.so $mod=SUPER diff --git a/tests/modules/services/window-managers/hyprland/multiple-devices-config.nix b/tests/modules/services/window-managers/hyprland/multiple-devices-config.nix index 40f92a911..7e27de042 100644 --- a/tests/modules/services/window-managers/hyprland/multiple-devices-config.nix +++ b/tests/modules/services/window-managers/hyprland/multiple-devices-config.nix @@ -1,6 +1,6 @@ -{ config, ... }: { - imports = [ ./hyprland-stubs.nix ]; +{ config, ... }: +{ wayland.windowManager.hyprland = { enable = true; plugins = diff --git a/tests/modules/services/window-managers/hyprland/null-all-packages-config.nix b/tests/modules/services/window-managers/hyprland/null-all-packages-config.nix index c27bff010..e20b98e83 100644 --- a/tests/modules/services/window-managers/hyprland/null-all-packages-config.nix +++ b/tests/modules/services/window-managers/hyprland/null-all-packages-config.nix @@ -1,6 +1,4 @@ -{ ... }: { - imports = [ ./hyprland-stubs.nix ]; - +{ wayland.windowManager.hyprland = { enable = true; package = null; diff --git a/tests/modules/services/window-managers/hyprland/null-package-config.nix b/tests/modules/services/window-managers/hyprland/null-package-config.nix index 463cbd538..dc89fcda1 100644 --- a/tests/modules/services/window-managers/hyprland/null-package-config.nix +++ b/tests/modules/services/window-managers/hyprland/null-package-config.nix @@ -1,6 +1,4 @@ { - imports = [ ./hyprland-stubs.nix ]; - wayland.windowManager.hyprland = { enable = true; package = null; diff --git a/tests/modules/services/window-managers/hyprland/null-portal-package-config.nix b/tests/modules/services/window-managers/hyprland/null-portal-package-config.nix index c118e23e2..65ae67535 100644 --- a/tests/modules/services/window-managers/hyprland/null-portal-package-config.nix +++ b/tests/modules/services/window-managers/hyprland/null-portal-package-config.nix @@ -1,6 +1,4 @@ { - imports = [ ./hyprland-stubs.nix ]; - wayland.windowManager.hyprland = { enable = true; diff --git a/tests/modules/services/window-managers/hyprland/simple-config.conf b/tests/modules/services/window-managers/hyprland/simple-config.conf index 29dcd7cd8..c076f5382 100644 --- a/tests/modules/services/window-managers/hyprland/simple-config.conf +++ b/tests/modules/services/window-managers/hyprland/simple-config.conf @@ -1,4 +1,4 @@ -exec-once = /nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target +exec-once = @dbus@/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target plugin=/path/to/plugin1 plugin=/nix/store/00000000000000000000000000000000-foo/lib/libfoo.so $mod=SUPER diff --git a/tests/modules/services/window-managers/hyprland/simple-config.nix b/tests/modules/services/window-managers/hyprland/simple-config.nix index 5feaffe0d..820fcc3e2 100644 --- a/tests/modules/services/window-managers/hyprland/simple-config.nix +++ b/tests/modules/services/window-managers/hyprland/simple-config.nix @@ -1,6 +1,6 @@ -{ config, ... }: { - imports = [ ./hyprland-stubs.nix ]; +{ config, ... }: +{ wayland.windowManager.hyprland = { enable = true; plugins = diff --git a/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.conf b/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.conf index 3dc8c39c0..e3d54eff0 100644 --- a/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.conf +++ b/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.conf @@ -1,4 +1,4 @@ -exec-once = /nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target +exec-once = @dbus@/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target bezier=smoothOut, 0.36, 0, 0.66, -0.56 bezier=smoothIn, 0.25, 1, 0.5, 1 bezier=overshot, 0.4,0.8,0.2,1.2 diff --git a/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.nix b/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.nix index 005c7bc41..06cfdf453 100644 --- a/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.nix +++ b/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.nix @@ -1,6 +1,4 @@ { - imports = [ ./hyprland-stubs.nix ]; - wayland.windowManager.hyprland = { enable = true; settings = { diff --git a/tests/modules/services/window-managers/i3/i3-stubs.nix b/tests/modules/services/window-managers/i3/i3-stubs.nix index a104eace0..f0d96944f 100644 --- a/tests/modules/services/window-managers/i3/i3-stubs.nix +++ b/tests/modules/services/window-managers/i3/i3-stubs.nix @@ -1,9 +1,7 @@ -{ config, lib, ... }: { +{ # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., # not containing hashes, version numbers etc. test.stubs = { - dmenu = { }; - i3 = { buildScript = '' mkdir -p $out/bin @@ -11,17 +9,5 @@ chmod 755 $out/bin/i3 ''; }; - - i3-gaps = { }; - - i3status = { }; }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; } diff --git a/tests/modules/services/window-managers/river/configuration.nix b/tests/modules/services/window-managers/river/configuration.nix index a180683b1..10e4d4db7 100644 --- a/tests/modules/services/window-managers/river/configuration.nix +++ b/tests/modules/services/window-managers/river/configuration.nix @@ -1,8 +1,4 @@ -{ ... }: - { - imports = [ ./river-stubs.nix ]; - wayland.windowManager.river = { enable = true; xwayland.enable = true; @@ -80,11 +76,6 @@ ''; }; - test.stubs = { - river = { }; - xwayland = { }; - }; - nmt.script = '' riverInit=home-files/.config/river/init assertFileExists "$riverInit" diff --git a/tests/modules/services/window-managers/river/init b/tests/modules/services/window-managers/river/init index 8662dc910..c266ca9e9 100755 --- a/tests/modules/services/window-managers/river/init +++ b/tests/modules/services/window-managers/river/init @@ -62,6 +62,6 @@ extra config ### SYSTEMD INTEGRATION ### -/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE && systemctl --user stop river-session.target && systemctl --user start river-session.target +@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE && systemctl --user stop river-session.target && systemctl --user start river-session.target diff --git a/tests/modules/services/window-managers/river/river-stubs.nix b/tests/modules/services/window-managers/river/river-stubs.nix deleted file mode 100644 index 21826ac29..000000000 --- a/tests/modules/services/window-managers/river/river-stubs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { river = { }; }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix b/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix index 8c7fd00cf..7145cbc44 100644 --- a/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix +++ b/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix @@ -1,8 +1,4 @@ -{ ... }: - { - imports = [ ./spectrwm-stubs.nix ]; - xsession.windowManager.spectrwm = { enable = true; settings = { @@ -16,8 +12,6 @@ unbindings = [ "MOD+Return" ]; }; - test.stubs.spectrwm = { }; - nmt.script = '' assertFileContent \ home-files/.config/spectrwm/spectrwm.conf ${ diff --git a/tests/modules/services/window-managers/spectrwm/spectrwm-stubs.nix b/tests/modules/services/window-managers/spectrwm/spectrwm-stubs.nix deleted file mode 100644 index 7f64ae083..000000000 --- a/tests/modules/services/window-managers/spectrwm/spectrwm-stubs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { spectrwm = { }; }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 100193192..c1c046620 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -108,4 +108,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix index 9488d00f6..0cda0a661 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; @@ -19,7 +17,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ + assertFileContent home-files/.config/sway/config \ ${./sway-bar-focused-colors.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index 28513fcd5..e913c7d0e 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -107,5 +107,5 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" exec_always pkill flashfocus; flasfocus & diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix index cf316988b..8adf112ba 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; @@ -20,7 +18,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ + assertFileContent home-files/.config/sway/config \ ${./sway-bindkeys-to-code-and-extra-config.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-check-config.nix b/tests/modules/services/window-managers/sway/sway-check-config.nix index e566e4fda..83558ecee 100644 --- a/tests/modules/services/window-managers/sway/sway-check-config.nix +++ b/tests/modules/services/window-managers/sway/sway-check-config.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, realPkgs, ... }: lib.mkIf config.test.enableBig { wayland.windowManager.sway = { @@ -6,6 +6,8 @@ lib.mkIf config.test.enableBig { checkConfig = true; }; + nixpkgs.overlays = [ (self: super: { inherit (realPkgs) xvfb-run; }) ]; + nmt.script = '' assertFileExists home-files/.config/sway/config ''; diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index cefe4e0af..e47db636a 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-default.nix b/tests/modules/services/window-managers/sway/sway-default.nix index c62effbe8..cf21cbafa 100644 --- a/tests/modules/services/window-managers/sway/sway-default.nix +++ b/tests/modules/services/window-managers/sway/sway-default.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf index f4f60ddf0..3ad8c181b 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -83,4 +83,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf index c10dbd90d..50f6a11d7 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -83,4 +83,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix b/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix index 3bce48507..425931b83 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix @@ -1,8 +1,6 @@ { config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-followmouse.nix b/tests/modules/services/window-managers/sway/sway-followmouse.nix index de2e91b39..7b0bcfeb8 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse.nix +++ b/tests/modules/services/window-managers/sway/sway-followmouse.nix @@ -1,8 +1,6 @@ { config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index d36a164ee..85ca8338a 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -117,4 +117,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-modules.nix b/tests/modules/services/window-managers/sway/sway-modules.nix index 287dec176..d9a566c60 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.nix +++ b/tests/modules/services/window-managers/sway/sway-modules.nix @@ -1,8 +1,6 @@ { config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix index 5eded3b88..d754d67d5 100644 --- a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix +++ b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; @@ -16,7 +14,7 @@ assertFileExists home-files/.config/sway/config assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${ - pkgs.writeText "expected" '' + builtins.toFile "expected" '' xwayland disable '' } diff --git a/tests/modules/services/window-managers/sway/sway-null-config.nix b/tests/modules/services/window-managers/sway/sway-null-config.nix index 46e4df23e..38e2082fa 100644 --- a/tests/modules/services/window-managers/sway/sway-null-config.nix +++ b/tests/modules/services/window-managers/sway/sway-null-config.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; @@ -13,7 +11,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ - ${pkgs.writeText "expected" ""} + assertFileContent home-files/.config/sway/config \ + ${builtins.toFile "expected" ""} ''; } diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index 9df934b2f..0cb9d9d40 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-null-package.nix b/tests/modules/services/window-managers/sway/sway-null-package.nix index 042830d18..3ab770813 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.nix +++ b/tests/modules/services/window-managers/sway/sway-null-package.nix @@ -1,8 +1,6 @@ { config, lib, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - # Enables the default bar configuration home.stateVersion = "20.09"; diff --git a/tests/modules/services/window-managers/sway/sway-post-2003.conf b/tests/modules/services/window-managers/sway/sway-post-2003.conf index 9df934b2f..0cb9d9d40 100644 --- a/tests/modules/services/window-managers/sway/sway-post-2003.conf +++ b/tests/modules/services/window-managers/sway/sway-post-2003.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-post-2003.nix b/tests/modules/services/window-managers/sway/sway-post-2003.nix index 3617a3b1c..73934382e 100644 --- a/tests/modules/services/window-managers/sway/sway-post-2003.nix +++ b/tests/modules/services/window-managers/sway/sway-post-2003.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - home.stateVersion = "20.09"; wayland.windowManager.sway = { diff --git a/tests/modules/services/window-managers/sway/sway-stubs.nix b/tests/modules/services/window-managers/sway/sway-stubs.nix deleted file mode 100644 index ddf11730b..000000000 --- a/tests/modules/services/window-managers/sway/sway-stubs.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { - dmenu = { }; - foot = { }; - i3status = { }; - sway = { version = "1"; }; - sway-unwrapped = { version = "1"; }; - swaybg = { }; - xwayland = { }; - }; - - nixpkgs.overlays = [ - (_final: _prev: { - procps = config.lib.test.mkStubPackage { name = "procps"; }; - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/sway/sway-systemd-autostart.nix b/tests/modules/services/window-managers/sway/sway-systemd-autostart.nix index 5c32c19cd..84c41ac57 100644 --- a/tests/modules/services/window-managers/sway/sway-systemd-autostart.nix +++ b/tests/modules/services/window-managers/sway/sway-systemd-autostart.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-systemd-variables.conf b/tests/modules/services/window-managers/sway/sway-systemd-variables.conf index 3710c5392..e0534715b 100644 --- a/tests/modules/services/window-managers/sway/sway-systemd-variables.conf +++ b/tests/modules/services/window-managers/sway/sway-systemd-variables.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-systemd-variables.nix b/tests/modules/services/window-managers/sway/sway-systemd-variables.nix index f0b42ecc1..b8f342210 100644 --- a/tests/modules/services/window-managers/sway/sway-systemd-variables.nix +++ b/tests/modules/services/window-managers/sway/sway-systemd-variables.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index 4fe872821..b70c17515 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -104,4 +104,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default.nix b/tests/modules/services/window-managers/sway/sway-workspace-default.nix index e5637fd94..ef24f38a9 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-default.nix @@ -1,8 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 7148d0030..241866f36 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -110,4 +110,4 @@ workspace "ABC" output "DP" workspace "3: Test" output "HDMI" workspace "!"§$%&/(){}[]=?\*#<>-_.:,;²³" output "DVI" workspace "Multiple" output "DVI" "HDMI" "DP" -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" +exec "@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user reset-failed && systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output.nix b/tests/modules/services/window-managers/sway/sway-workspace-output.nix index dcbff91e1..2f8816bc4 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-output.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: let i3 = { @@ -10,8 +10,6 @@ let }; in { - imports = [ ./sway-stubs.nix ]; - wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; diff --git a/tests/modules/services/window-managers/sway/swaynag-empty-settings.nix b/tests/modules/services/window-managers/sway/swaynag-empty-settings.nix index 56782547f..f6fce496d 100644 --- a/tests/modules/services/window-managers/sway/swaynag-empty-settings.nix +++ b/tests/modules/services/window-managers/sway/swaynag-empty-settings.nix @@ -1,5 +1,3 @@ -{ ... }: - { wayland.windowManager.sway.swaynag = { enable = true; diff --git a/tests/modules/services/window-managers/sway/swaynag-example-settings.nix b/tests/modules/services/window-managers/sway/swaynag-example-settings.nix index 513d185da..63a9f6a1d 100644 --- a/tests/modules/services/window-managers/sway/swaynag-example-settings.nix +++ b/tests/modules/services/window-managers/sway/swaynag-example-settings.nix @@ -1,30 +1,26 @@ -{ config, lib, pkgs, ... }: - { - config = { - wayland.windowManager.sway.swaynag = { - enable = true; + wayland.windowManager.sway.swaynag = { + enable = true; - settings = { - "" = { - edge = "bottom"; - font = "Dina 12"; - }; + settings = { + "" = { + edge = "bottom"; + font = "Dina 12"; + }; - green = { - edge = "top"; - background = "00AA00"; - text = "FFFFFF"; - button-background = "00CC00"; - message-padding = 10; - }; + green = { + edge = "top"; + background = "00AA00"; + text = "FFFFFF"; + button-background = "00CC00"; + message-padding = 10; }; }; - - nmt.script = '' - assertFileContent \ - home-files/.config/swaynag/config \ - ${./swaynag-example-settings-expected.conf} - ''; }; + + nmt.script = '' + assertFileContent \ + home-files/.config/swaynag/config \ + ${./swaynag-example-settings-expected.conf} + ''; } diff --git a/tests/modules/services/window-managers/wayfire/configuration.ini b/tests/modules/services/window-managers/wayfire/configuration.ini index a40480412..1467c269a 100644 --- a/tests/modules/services/window-managers/wayfire/configuration.ini +++ b/tests/modules/services/window-managers/wayfire/configuration.ini @@ -1,5 +1,5 @@ [autostart] -systemdActivation=/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE && systemctl --user stop wayfire-session.target && systemctl --user start wayfire-session.target +systemdActivation=@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE && systemctl --user stop wayfire-session.target && systemctl --user start wayfire-session.target [command] binding_terminal=alacritty diff --git a/tests/modules/services/window-managers/wayfire/configuration.nix b/tests/modules/services/window-managers/wayfire/configuration.nix index d199e9202..940fb76ae 100644 --- a/tests/modules/services/window-managers/wayfire/configuration.nix +++ b/tests/modules/services/window-managers/wayfire/configuration.nix @@ -1,6 +1,4 @@ -{ ... }: { - imports = [ ./wayfire-stubs.nix ]; - +{ wayland.windowManager.wayfire = { enable = true; package = null; @@ -17,8 +15,6 @@ wayfireConfig=home-files/.config/wayfire.ini assertFileExists "$wayfireConfig" - - normalizedConfig=$(normalizeStorePaths "$wayfireConfig") - assertFileContent "$normalizedConfig" "${./configuration.ini}" + assertFileContent "$wayfireConfig" "${./configuration.ini}" ''; } diff --git a/tests/modules/services/window-managers/wayfire/wayfire-stubs.nix b/tests/modules/services/window-managers/wayfire/wayfire-stubs.nix deleted file mode 100644 index 0fd2bf850..000000000 --- a/tests/modules/services/window-managers/wayfire/wayfire-stubs.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, ... }: { - # Avoid unnecessary downloads in CI jobs and/or make out paths constant, i.e., - # not containing hashes, version numbers etc. - test.stubs = { wayfire = { }; }; - - nixpkgs.overlays = [ - (_final: _prev: { - dbus = config.lib.test.mkStubPackage { name = "dbus"; }; - systemd = - lib.makeOverridable (_attrs: config.lib.test.mkStubPackage { }) { }; - }) - ]; -} diff --git a/tests/modules/services/window-managers/wayfire/wf-shell.nix b/tests/modules/services/window-managers/wayfire/wf-shell.nix index f88761db1..f7700ff33 100644 --- a/tests/modules/services/window-managers/wayfire/wf-shell.nix +++ b/tests/modules/services/window-managers/wayfire/wf-shell.nix @@ -1,12 +1,9 @@ -{ pkgs, ... }: { - imports = [ ./wayfire-stubs.nix ]; - +{ wayland.windowManager.wayfire = { enable = true; package = null; wf-shell = { enable = true; - package = pkgs.mkStubPackage { }; settings = { panel = { widgets_left = "menu spacing4 launchers window-list"; @@ -20,8 +17,6 @@ wfShellConfig=home-files/.config/wf-shell.ini assertFileExists "$wfShellConfig" - - normalizedConfig=$(normalizeStorePaths "$wfShellConfig") - assertFileContent "$normalizedConfig" "${./wf-shell.ini}" + assertFileContent "$wfShellConfig" "${./wf-shell.ini}" ''; } diff --git a/tests/stubs.nix b/tests/stubs.nix index b9c933ac8..25863143d 100644 --- a/tests/stubs.nix +++ b/tests/stubs.nix @@ -28,6 +28,11 @@ let type = types.str; default = defaultBuildScript; }; + + extraAttrs = mkOption { + type = types.attrsOf types.anything; + default = { }; + }; }; }); @@ -37,7 +42,7 @@ let defaultBuildScript; mkStubPackage = { name ? "dummy", outPath ? null, version ? null - , buildScript ? defaultBuildScript }: + , buildScript ? defaultBuildScript, extraAttrs ? { } }: let pkg = if name == "dummy" && buildScript == defaultBuildScript then dummyPackage @@ -46,35 +51,50 @@ let pname = name; meta.mainProgram = name; } buildScript; - in pkg // optionalAttrs (outPath != null) { - inherit outPath; - # Prevent getOutput from descending into outputs - outputSpecified = true; + stubbedPkg = pkg // optionalAttrs (outPath != null) { + inherit outPath; - # Allow the original package to be used in derivation inputs - __spliced = { - buildHost = pkg; - hostTarget = pkg; - }; - } // optionalAttrs (version != null) { inherit version; }; + # Prevent getOutput from descending into outputs + outputSpecified = true; + + # Allow the original package to be used in derivation inputs + __spliced = { + buildHost = pkg; + hostTarget = pkg; + }; + } // optionalAttrs (version != null) { inherit version; } // extraAttrs; + in stubbedPkg; in { - options.test.stubs = mkOption { - type = types.attrsOf stubType; - default = { }; - description = - "Package attributes that should be replaced by a stub package."; + options.test = { + stubs = mkOption { + type = types.attrsOf stubType; + default = { }; + description = + "Package attributes that should be replaced by a stub package."; + }; + + stubOverlays = mkOption { + type = types.anything; + default = [ ]; + internal = true; + }; + + unstubs = mkOption { + type = types.listOf types.anything; + default = [ ]; + }; }; config = { lib.test.mkStubPackage = mkStubPackage; - nixpkgs.overlays = [ (self: super: { inherit mkStubPackage; }) ] - ++ optional (config.test.stubs != { }) (self: super: - mapAttrs (n: v: - mkStubPackage (v // optionalAttrs (v.version == null) { + test.stubOverlays = [ ] ++ optional (config.test.stubs != { }) (self: super: + mapAttrs (n: v: + builtins.traceVerbose "${n} - stubbed" (mkStubPackage (v + // optionalAttrs (v.version == null) { version = super.${n}.version or null; - })) config.test.stubs); + }))) config.test.stubs) ++ config.test.unstubs; }; }