1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 08:09:45 +01:00
home-manager/tests/default.nix
David Baynard 719de878f7
imapnotify: Add launchd agent (#3291)
* imapnotify: expose package (and exe) options

There are multiple packages that provide an imapnotify interface. Those
packages have differently named executables. This can now be customized.

This change also means test configurations can use stub packages.

* imapnotify: use/create config in configHome

Exposing the configuration file makes testing imapnotify configurations much
easier. It also allows for golden tests in home-manager.

* imapnotify: extend with launchd agent

Now that home-manager supports launchd agents, the imapnotify service
can be configured (and enabled) for darwin. The configuration matches
that of the linux/systemd version. In particular, by not setting a
`UserName`, this runs as the user whose configuration includes the
module.

Due to the launchd `Program` implementation (it must take an absolute
path) it is not possible to use that for the program and stub the path
in tests. Instead, this uses `ProgramArguments` for the program name.

The `ThrottleInterval` is equivalent to `RestartSec`. `KeepAlive` is
equivalent to `Restart`.

The `ExitTimeOut` default is 20 seconds, but goimapnotify should not
time out — this is achieved by setting the `ExitTimeout` to 0.

* imapnotify: add launchd plist test

This only tests the generated plist (which is new), not the original
systemd implementation, nor the json config file.

(Note the lack of a newline at the end of the plist file.)
2023-07-07 11:39:12 +02:00

238 lines
7 KiB
Nix

{ pkgs ? import <nixpkgs> {}, enableBig ? true }:
let
lib = import ../modules/lib/stdlib-extended.nix pkgs.lib;
nmt = fetchTarball {
url =
"https://gitlab.com/api/v4/projects/rycee%2Fnmt/repository/archive.tar.gz?sha=4df00c569b1badfedffecd7ccd60f794550486db";
sha256 = "1cyly1zazgj8z6bazml4js7lqaqvpp8lw045aqchlpvp42bl1lp4";
};
modules = import ../modules/modules.nix {
inherit lib pkgs;
check = false;
} ++ [
{
# Bypass <nixpkgs> reference inside modules/modules.nix to make the test
# suite more pure.
_module.args.pkgsPath = pkgs.path;
# 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 = false;
imports = [ ./asserts.nix ./big-test.nix ./stubs.nix ];
test.enableBig = enableBig;
}
];
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
in
import nmt {
inherit lib pkgs modules;
testedAttrPath = [ "home" "activationPackage" ];
tests = builtins.foldl' (a: b: a // (import b)) { } ([
./lib/generators
./lib/types
./modules/files
./modules/home-environment
./modules/misc/fontconfig
./modules/misc/nix
./modules/misc/specialisation
./modules/programs/aerc
./modules/programs/alacritty
./modules/programs/alot
./modules/programs/antidote
./modules/programs/aria2
./modules/programs/atuin
./modules/programs/autojump
./modules/programs/bash
./modules/programs/bat
./modules/programs/bottom
./modules/programs/broot
./modules/programs/browserpass
./modules/programs/btop
./modules/programs/comodoro
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/emacs
./modules/programs/feh
./modules/programs/fish
./modules/programs/gallery-dl
./modules/programs/gh
./modules/programs/git-cliff
./modules/programs/git
./modules/programs/gpg
./modules/programs/helix
./modules/programs/himalaya
./modules/programs/htop
./modules/programs/hyfetch
./modules/programs/i3status
./modules/programs/irssi
./modules/programs/jujutsu
./modules/programs/k9s
./modules/programs/kakoune
./modules/programs/kitty
./modules/programs/khal
./modules/programs/ledger
./modules/programs/less
./modules/programs/lf
./modules/programs/lieer
./modules/programs/man
./modules/programs/mbsync
./modules/programs/micro
./modules/programs/mpv
./modules/programs/mu
./modules/programs/mujmap
./modules/programs/ncmpcpp
./modules/programs/ne
./modules/programs/neomutt
./modules/programs/neovim
./modules/programs/newsboat
./modules/programs/nheko
./modules/programs/nix-index
./modules/programs/nnn
./modules/programs/nushell
./modules/programs/oh-my-posh
./modules/programs/pandoc
./modules/programs/papis
./modules/programs/pet
./modules/programs/pistol
./modules/programs/pls
./modules/programs/powerline-go
./modules/programs/pubs
./modules/programs/qutebrowser
./modules/programs/readline
./modules/programs/ripgrep
./modules/programs/rtx
./modules/programs/sagemath
./modules/programs/sbt
./modules/programs/scmpuff
./modules/programs/sioyek
./modules/programs/sm64ex
./modules/programs/ssh
./modules/programs/starship
./modules/services/syncthing/common
./modules/programs/taskwarrior
./modules/programs/texlive
./modules/programs/tmate
./modules/programs/tmux
./modules/programs/topgrade
./modules/programs/translate-shell
./modules/programs/vim-vint
./modules/programs/vscode
./modules/programs/watson
./modules/programs/wezterm
./modules/programs/zellij
./modules/programs/zplug
./modules/programs/zsh
./modules/xresources
] ++ lib.optionals isDarwin [
./modules/launchd
./modules/targets-darwin
./modules/programs/goimapnotify
] ++ lib.optionals isLinux [
./modules/config/i18n
./modules/i18n/input-method
./modules/misc/debug
./modules/misc/editorconfig
./modules/misc/gtk
./modules/misc/numlock
./modules/misc/pam
./modules/misc/qt
./modules/misc/xdg
./modules/misc/xsession
./modules/programs/abook
./modules/programs/autorandr
./modules/programs/beets # One test relies on services.mpd
./modules/programs/borgmatic
./modules/programs/boxxy
./modules/programs/firefox
./modules/programs/foot
./modules/programs/fuzzel
./modules/programs/getmail
./modules/programs/gnome-terminal
./modules/programs/hexchat
./modules/programs/i3status-rust
./modules/programs/imv
./modules/programs/kodi
./modules/programs/looking-glass-client
./modules/programs/mangohud
./modules/programs/ncmpcpp-linux
./modules/programs/rbw
./modules/programs/rofi
./modules/programs/rofi-pass
./modules/programs/swaylock
./modules/programs/terminator
./modules/programs/thunderbird
./modules/programs/waybar
./modules/programs/wlogout
./modules/programs/wofi
./modules/programs/xmobar
./modules/programs/yt-dlp
./modules/services/avizo
./modules/services/barrier
./modules/services/borgmatic
./modules/services/cachix-agent
./modules/services/clipman
./modules/services/comodoro
./modules/services/devilspie2
./modules/services/dropbox
./modules/services/emacs
./modules/services/espanso
./modules/services/flameshot
./modules/services/fluidsynth
./modules/services/fnott
./modules/services/fusuma
./modules/services/git-sync
./modules/services/gpg-agent
./modules/services/gromit-mpx
./modules/services/home-manager-auto-upgrade
./modules/services/kanshi
./modules/services/lieer
./modules/services/mopidy
./modules/services/mpd
./modules/services/mpdris2
./modules/services/mpd-mpris
./modules/services/pantalaimon
./modules/services/parcellite
./modules/services/pass-secret-service
./modules/services/pbgopy
./modules/services/picom
./modules/services/playerctld
./modules/services/polybar
./modules/services/recoll
./modules/services/redshift-gammastep
./modules/services/screen-locker
./modules/services/swayidle
./modules/services/sxhkd
./modules/services/syncthing/linux
./modules/services/trayer
./modules/services/twmn
./modules/services/udiskie
./modules/services/window-managers/bspwm
./modules/services/window-managers/herbstluftwm
./modules/services/window-managers/i3
./modules/services/window-managers/spectrwm
./modules/services/window-managers/sway
./modules/services/wlsunset
./modules/services/xsettingsd
./modules/systemd
./modules/targets-linux
]);
}