From cba2f9ce95c8d10b66cacf05a275e3ad71959638 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Mon, 7 Apr 2025 16:11:29 -0500 Subject: [PATCH] treewide: reformat nixfmt-rfc-style Reformat repository using new nixfmt-rfc-style. --- default.nix | 32 +- docs/default.nix | 232 +-- docs/flake.nix | 35 +- docs/home-manager-manual.nix | 20 +- docs/html-open-tool.nix | 22 +- flake-module.nix | 30 +- flake.nix | 82 +- home-manager/build-news.nix | 66 +- home-manager/default.nix | 121 +- home-manager/home-manager.nix | 31 +- home-manager/install.nix | 23 +- lib/default.nix | 64 +- modules/accounts/calendar.nix | 157 +- modules/accounts/contacts.nix | 98 +- modules/accounts/email.nix | 627 ++++---- modules/config/home-cursor.nix | 280 ++-- modules/config/i18n.nix | 27 +- modules/default.nix | 67 +- modules/files.nix | 311 ++-- modules/home-environment.nix | 294 ++-- modules/i18n/input-method/default.nix | 79 +- modules/i18n/input-method/fcitx5.nix | 31 +- modules/i18n/input-method/hime.nix | 7 +- modules/i18n/input-method/kime.nix | 18 +- modules/i18n/input-method/nabi.nix | 7 +- modules/i18n/input-method/uim.nix | 29 +- modules/launchd/default.nix | 372 ++--- modules/launchd/launchd.nix | 739 ++++----- modules/launchd/types.nix | 199 +-- modules/lib/assertions.nix | 13 +- modules/lib/booleans.nix | 3 +- modules/lib/dag.nix | 57 +- modules/lib/file-type.nix | 222 +-- modules/lib/generators.nix | 367 +++-- modules/lib/gvariant.nix | 122 +- modules/lib/maintainers.nix | 92 +- modules/lib/nushell.nix | 93 +- modules/lib/shell.nix | 26 +- modules/lib/stdlib-extended.nix | 18 +- modules/lib/strings.nix | 31 +- modules/lib/types-dag.nix | 88 +- modules/lib/types.nix | 130 +- modules/lib/zsh.nix | 3 +- modules/manual.nix | 15 +- modules/misc/dconf.nix | 43 +- modules/misc/editorconfig.nix | 32 +- modules/misc/fontconfig.nix | 110 +- modules/misc/gtk.nix | 197 +-- modules/misc/mozilla-messaging-hosts.nix | 105 +- modules/misc/news.nix | 131 +- modules/misc/nix.nix | 280 ++-- modules/misc/nixgl.nix | 386 ++--- modules/misc/nixpkgs-disabled.nix | 39 +- modules/misc/nixpkgs.nix | 49 +- modules/misc/numlock.nix | 21 +- modules/misc/pam.nix | 32 +- modules/misc/qt.nix | 465 +++--- modules/misc/qt/kconfig.nix | 74 +- modules/misc/specialisation.nix | 90 +- modules/misc/tmpfiles.nix | 13 +- modules/misc/uninstall.nix | 34 +- modules/misc/version.nix | 24 +- modules/misc/vte.nix | 35 +- modules/misc/xdg-autostart.nix | 25 +- modules/misc/xdg-desktop-entries.nix | 98 +- modules/misc/xdg-mime-apps.nix | 73 +- modules/misc/xdg-mime.nix | 31 +- modules/misc/xdg-portal.nix | 122 +- modules/misc/xdg-system-dirs.nix | 25 +- modules/misc/xdg-user-dirs.nix | 116 +- modules/misc/xdg.nix | 103 +- modules/misc/xfconf.nix | 133 +- modules/modules.nix | 967 ++++++------ modules/programs/abook.nix | 13 +- modules/programs/aerc-accounts.nix | 307 ++-- modules/programs/aerc.nix | 315 ++-- modules/programs/aerospace.nix | 261 ++-- modules/programs/afew.nix | 13 +- modules/programs/alacritty.nix | 63 +- modules/programs/alot-accounts.nix | 21 +- modules/programs/alot.nix | 178 ++- modules/programs/antidote.nix | 61 +- modules/programs/aria2.nix | 37 +- modules/programs/astroid-accounts.nix | 12 +- modules/programs/astroid.nix | 61 +- modules/programs/atuin.nix | 297 ++-- modules/programs/autojump.nix | 27 +- modules/programs/autorandr.nix | 189 ++- modules/programs/awscli.nix | 26 +- modules/programs/bacon.nix | 27 +- modules/programs/bash.nix | 186 ++- modules/programs/bashmount.nix | 16 +- modules/programs/bat.nix | 219 +-- modules/programs/beets.nix | 34 +- modules/programs/bemenu.nix | 27 +- modules/programs/borgmatic.nix | 397 ++--- modules/programs/bottom.nix | 10 +- modules/programs/boxxy.nix | 22 +- modules/programs/broot.nix | 105 +- modules/programs/browserpass.nix | 197 ++- modules/programs/btop.nix | 91 +- modules/programs/bun.nix | 25 +- modules/programs/carapace.nix | 113 +- modules/programs/cava.nix | 10 +- modules/programs/cavalier.nix | 13 +- modules/programs/chromium.nix | 139 +- modules/programs/cmus.nix | 13 +- .../command-not-found/command-not-found.nix | 18 +- modules/programs/comodoro.nix | 10 +- modules/programs/darcs.nix | 41 +- modules/programs/dircolors.nix | 354 ++--- modules/programs/direnv.nix | 95 +- modules/programs/discocss.nix | 30 +- modules/programs/distrobox.nix | 30 +- modules/programs/earthly.nix | 10 +- modules/programs/eclipse.nix | 20 +- modules/programs/emacs.nix | 33 +- modules/programs/eww.nix | 63 +- modules/programs/eza.nix | 196 ++- modules/programs/fastfetch.nix | 24 +- modules/programs/fd.nix | 57 +- modules/programs/feh.nix | 91 +- modules/programs/firefox.nix | 27 +- modules/programs/firefox/mkFirefoxModule.nix | 1281 +++++++++------- .../firefox/profiles/bookmark-types.nix | 118 +- .../programs/firefox/profiles/bookmarks.nix | 83 +- modules/programs/firefox/profiles/search.nix | 345 +++-- modules/programs/fish.nix | 472 +++--- modules/programs/floorp.nix | 16 +- modules/programs/foot.nix | 20 +- modules/programs/freetube.nix | 43 +- modules/programs/fuzzel.nix | 21 +- modules/programs/fzf.nix | 134 +- modules/programs/gallery-dl.nix | 10 +- modules/programs/getmail-accounts.nix | 11 +- modules/programs/getmail.nix | 60 +- modules/programs/gh-dash.nix | 13 +- modules/programs/gh.nix | 120 +- modules/programs/ghostty.nix | 363 ++--- modules/programs/git-cliff.nix | 10 +- modules/programs/git-credential-oauth.nix | 17 +- modules/programs/git-worktree-switcher.nix | 49 +- modules/programs/git.nix | 806 +++++----- modules/programs/gitui.nix | 13 +- modules/programs/gnome-shell.nix | 93 +- modules/programs/gnome-terminal.nix | 612 ++++---- modules/programs/go.nix | 102 +- modules/programs/gpg.nix | 340 +++-- modules/programs/gradle.nix | 97 +- modules/programs/granted.nix | 19 +- modules/programs/havoc.nix | 13 +- modules/programs/helix.nix | 112 +- modules/programs/hexchat.nix | 97 +- modules/programs/himalaya.nix | 134 +- modules/programs/home-manager.nix | 16 +- modules/programs/hstr.nix | 19 +- modules/programs/htop.nix | 84 +- modules/programs/hyfetch.nix | 10 +- modules/programs/hyprlock.nix | 91 +- modules/programs/i3blocks.nix | 109 +- modules/programs/i3status-rust.nix | 244 +-- modules/programs/i3status.nix | 144 +- modules/programs/iamb.nix | 10 +- modules/programs/imv.nix | 29 +- modules/programs/info.nix | 34 +- modules/programs/ion.nix | 19 +- modules/programs/irssi.nix | 245 +-- modules/programs/java.nix | 10 +- modules/programs/jetbrains-remote.nix | 29 +- modules/programs/joplin-desktop.nix | 96 +- modules/programs/joshuto.nix | 10 +- modules/programs/jq.nix | 22 +- modules/programs/jqp.nix | 14 +- modules/programs/jujutsu.nix | 75 +- modules/programs/just.nix | 24 +- modules/programs/k9s.nix | 162 +- modules/programs/kakoune.nix | 703 +++++---- modules/programs/keychain.nix | 42 +- modules/programs/khal-accounts.nix | 6 +- modules/programs/khal-calendar-accounts.nix | 8 +- modules/programs/khal-contact-accounts.nix | 3 +- modules/programs/khal.nix | 344 +++-- modules/programs/khard.nix | 76 +- modules/programs/kitty.nix | 243 +-- modules/programs/kodi.nix | 141 +- modules/programs/kubecolor.nix | 106 +- modules/programs/lapce.nix | 186 ++- modules/programs/lazydocker.nix | 30 +- modules/programs/lazygit.nix | 32 +- modules/programs/ledger.nix | 34 +- modules/programs/less.nix | 13 +- modules/programs/lesspipe.nix | 13 +- modules/programs/lf.nix | 120 +- modules/programs/librewolf.nix | 30 +- modules/programs/lieer.nix | 181 ++- modules/programs/looking-glass-client.nix | 16 +- modules/programs/lsd.nix | 18 +- modules/programs/man.nix | 59 +- modules/programs/mangohud.nix | 58 +- modules/programs/matplotlib.nix | 22 +- modules/programs/mbsync-accounts.nix | 220 +-- modules/programs/mbsync.nix | 376 +++-- modules/programs/mcfly.nix | 132 +- modules/programs/mercurial.nix | 85 +- modules/programs/mergiraf.nix | 21 +- modules/programs/micro.nix | 13 +- modules/programs/mise.nix | 76 +- modules/programs/mods.nix | 42 +- modules/programs/mpv.nix | 146 +- modules/programs/mr.nix | 17 +- modules/programs/msmtp-accounts.nix | 10 +- modules/programs/msmtp.nix | 55 +- modules/programs/mu.nix | 82 +- modules/programs/mujmap.nix | 120 +- modules/programs/navi.nix | 28 +- modules/programs/ncmpcpp.nix | 104 +- modules/programs/ncspot.nix | 10 +- modules/programs/ne.nix | 37 +- modules/programs/neomutt-accounts.nix | 46 +- modules/programs/neomutt.nix | 533 ++++--- modules/programs/neovide.nix | 13 +- modules/programs/neovim.nix | 302 ++-- modules/programs/newsboat.nix | 127 +- modules/programs/nh.nix | 24 +- modules/programs/nheko.nix | 23 +- modules/programs/nix-index.nix | 73 +- modules/programs/nix-your-shell.nix | 22 +- modules/programs/nnn.nix | 119 +- modules/programs/noti.nix | 13 +- modules/programs/notmuch-virtual-mailbox.nix | 16 +- modules/programs/notmuch.nix | 129 +- modules/programs/nushell.nix | 179 ++- modules/programs/obs-studio.nix | 17 +- modules/programs/octant.nix | 24 +- modules/programs/offlineimap-accounts.nix | 11 +- modules/programs/offlineimap.nix | 153 +- modules/programs/oh-my-posh.nix | 45 +- modules/programs/onlyoffice.nix | 42 +- modules/programs/opam.nix | 22 +- modules/programs/openstackclient.nix | 28 +- modules/programs/pandoc.nix | 30 +- modules/programs/papis.nix | 114 +- modules/programs/password-store.nix | 18 +- modules/programs/pay-respects.nix | 27 +- modules/programs/pazi.nix | 19 +- modules/programs/pet.nix | 50 +- modules/programs/pidgin.nix | 13 +- modules/programs/pistol.nix | 75 +- modules/programs/piston-cli.nix | 10 +- modules/programs/pls.nix | 13 +- modules/programs/poetry.nix | 29 +- modules/programs/powerline-go.nix | 152 +- modules/programs/pqiv.nix | 46 +- modules/programs/pubs.nix | 13 +- modules/programs/pyenv.nix | 19 +- modules/programs/pylint.nix | 13 +- modules/programs/pywal.nix | 27 +- modules/programs/qcal.nix | 55 +- modules/programs/qutebrowser.nix | 142 +- modules/programs/ranger.nix | 168 ++- modules/programs/rbenv.nix | 29 +- modules/programs/rbw.nix | 39 +- modules/programs/rclone.nix | 177 ++- modules/programs/readline.nix | 71 +- modules/programs/rio.nix | 34 +- modules/programs/ripgrep-all.nix | 40 +- modules/programs/ripgrep.nix | 43 +- modules/programs/rofi-pass.nix | 19 +- modules/programs/rofi.nix | 237 +-- modules/programs/rtorrent.nix | 21 +- modules/programs/ruff.nix | 16 +- modules/programs/sagemath.nix | 17 +- modules/programs/sapling.nix | 68 +- modules/programs/sbt.nix | 93 +- modules/programs/scmpuff.nix | 59 +- modules/programs/script-directory.nix | 16 +- modules/programs/senpai.nix | 19 +- modules/programs/sesh.nix | 39 +- modules/programs/sftpman.nix | 152 +- modules/programs/sioyek.nix | 40 +- modules/programs/skim.nix | 36 +- modules/programs/sm64ex.nix | 97 +- modules/programs/smug.nix | 226 +-- modules/programs/spotify-player.nix | 21 +- modules/programs/sqls.nix | 10 +- modules/programs/ssh.nix | 726 ++++----- modules/programs/starship.nix | 28 +- modules/programs/streamlink.nix | 174 ++- modules/programs/swayimg.nix | 13 +- modules/programs/swaylock.nix | 40 +- modules/programs/swayr.nix | 62 +- modules/programs/taskwarrior.nix | 66 +- modules/programs/tealdeer.nix | 70 +- modules/programs/terminator.nix | 47 +- modules/programs/termite.nix | 166 +- modules/programs/tex-fmt.nix | 34 +- modules/programs/texlive.nix | 21 +- modules/programs/thefuck.nix | 97 +- modules/programs/thunderbird.nix | 972 ++++++------ modules/programs/timidity.nix | 10 +- modules/programs/tint2.nix | 16 +- modules/programs/tiny.nix | 19 +- modules/programs/tmate.nix | 48 +- modules/programs/tmux.nix | 133 +- modules/programs/todoman.nix | 29 +- modules/programs/tofi.nix | 40 +- modules/programs/topgrade.nix | 10 +- modules/programs/translate-shell.nix | 37 +- modules/programs/urxvt.nix | 81 +- modules/programs/vdirsyncer-accounts.nix | 67 +- modules/programs/vdirsyncer.nix | 355 +++-- modules/programs/vifm.nix | 13 +- modules/programs/vim-vint.nix | 13 +- modules/programs/vim.nix | 187 ++- modules/programs/vinegar.nix | 35 +- modules/programs/vscode.nix | 433 +++--- modules/programs/vscode/haskell.nix | 29 +- modules/programs/watson.nix | 25 +- modules/programs/waybar.nix | 229 +-- modules/programs/waylogout.nix | 37 +- modules/programs/wezterm.nix | 61 +- modules/programs/wlogout.nix | 71 +- modules/programs/wofi.nix | 23 +- modules/programs/xmobar.nix | 13 +- modules/programs/xplr.nix | 46 +- modules/programs/yambar.nix | 13 +- modules/programs/yazi.nix | 296 ++-- modules/programs/yt-dlp.nix | 35 +- modules/programs/z-lua.nix | 37 +- modules/programs/zathura.nix | 40 +- modules/programs/zed-editor.nix | 84 +- modules/programs/zellij.nix | 127 +- modules/programs/zk.nix | 10 +- modules/programs/zoxide.nix | 36 +- modules/programs/zplug.nix | 55 +- modules/programs/zsh.nix | 1338 +++++++++-------- modules/programs/zsh/prezto.nix | 449 +++--- modules/programs/zsh/zsh-abbr.nix | 52 +- modules/services/activitywatch.nix | 187 ++- modules/services/amberol.nix | 19 +- modules/services/arrpc.nix | 21 +- modules/services/autorandr.nix | 23 +- modules/services/avizo.nix | 17 +- modules/services/barrier.nix | 28 +- modules/services/batsignal.nix | 16 +- modules/services/betterlockscreen.nix | 23 +- modules/services/blanket.nix | 23 +- modules/services/blueman-applet.nix | 23 +- modules/services/borgmatic.nix | 13 +- modules/services/cachix-agent.nix | 36 +- modules/services/caffeine.nix | 25 +- modules/services/cbatticon.nix | 64 +- modules/services/cliphist.nix | 119 +- modules/services/clipman.nix | 23 +- modules/services/clipmenu.nix | 32 +- modules/services/clipse.nix | 78 +- modules/services/comodoro.nix | 25 +- modules/services/conky.nix | 22 +- modules/services/copyq.nix | 20 +- modules/services/darkman.nix | 55 +- modules/services/davmail.nix | 90 +- modules/services/devilspie2.nix | 16 +- modules/services/dropbox.nix | 69 +- modules/services/dunst.nix | 130 +- modules/services/dwm-status.nix | 34 +- modules/services/easyeffects.nix | 74 +- modules/services/emacs.nix | 166 +- modules/services/espanso.nix | 92 +- modules/services/etesync-dav.nix | 36 +- modules/services/flameshot.nix | 22 +- modules/services/fluidsynth.nix | 27 +- modules/services/fnott.nix | 16 +- modules/services/fusuma.nix | 81 +- modules/services/getmail.nix | 41 +- modules/services/git-sync.nix | 119 +- modules/services/glance.nix | 63 +- modules/services/gnome-keyring.nix | 41 +- modules/services/gpg-agent.nix | 283 ++-- modules/services/grobi.nix | 20 +- modules/services/gromit-mpx.nix | 86 +- modules/services/home-manager-auto-expire.nix | 33 +- .../services/home-manager-auto-upgrade.nix | 18 +- modules/services/hound.nix | 38 +- modules/services/hypridle.nix | 57 +- modules/services/hyprpaper.nix | 57 +- modules/services/hyprpolkitagent.nix | 30 +- modules/services/imapnotify-accounts.nix | 20 +- modules/services/imapnotify.nix | 188 ++- modules/services/jankyborders.nix | 39 +- modules/services/kanshi.nix | 122 +- modules/services/kbfs.nix | 41 +- modules/services/kdeconnect.nix | 35 +- modules/services/keybase.nix | 13 +- modules/services/keynav.nix | 21 +- modules/services/librespot.nix | 46 +- modules/services/lieer.nix | 34 +- modules/services/linux-wallpaperengine.nix | 183 ++- modules/services/listenbrainz-mpd.nix | 19 +- modules/services/lorri.nix | 90 +- modules/services/ludusavi.nix | 67 +- modules/services/lxqt-policykit-agent.nix | 26 +- modules/services/macos-remap-keys/default.nix | 43 +- .../services/macos-remap-keys/keytables.nix | 42 +- modules/services/mako.nix | 147 +- modules/services/mbsync.nix | 49 +- modules/services/megasync.nix | 23 +- modules/services/mopidy.nix | 78 +- modules/services/mpd-discord-rpc.nix | 13 +- modules/services/mpd-mpris.nix | 29 +- modules/services/mpd.nix | 176 ++- modules/services/mpdris2.nix | 44 +- modules/services/mpdscribble.nix | 242 +-- modules/services/mpris-proxy.nix | 19 +- modules/services/muchsync.nix | 124 +- modules/services/network-manager-applet.nix | 33 +- modules/services/nextcloud-client.nix | 23 +- modules/services/nix-gc.nix | 118 +- modules/services/notify-osd.nix | 13 +- modules/services/ollama.nix | 42 +- modules/services/opensnitch-ui.nix | 21 +- modules/services/osmscout-server.nix | 31 +- modules/services/owncloud-client.nix | 17 +- modules/services/pantalaimon.nix | 26 +- modules/services/parcellite.nix | 26 +- modules/services/pass-secret-service.nix | 28 +- modules/services/pasystray.nix | 34 +- modules/services/pbgopy.nix | 31 +- modules/services/picom.nix | 188 ++- modules/services/plan9port.nix | 16 +- modules/services/playerctld.nix | 13 +- modules/services/plex-mpv-shim.nix | 21 +- modules/services/podman-linux/builds.nix | 253 ++-- modules/services/podman-linux/containers.nix | 228 +-- modules/services/podman-linux/default.nix | 36 +- modules/services/podman-linux/images.nix | 203 +-- .../services/podman-linux/install-quadlet.nix | 93 +- modules/services/podman-linux/networks.nix | 128 +- modules/services/podman-linux/options.nix | 3 +- modules/services/podman-linux/podman-lib.nix | 166 +- modules/services/podman-linux/services.nix | 42 +- modules/services/podman-linux/volumes.nix | 256 ++-- modules/services/polkit-gnome.nix | 25 +- modules/services/polybar.nix | 131 +- modules/services/poweralertd.nix | 46 +- modules/services/psd.nix | 123 +- modules/services/pueue.nix | 16 +- modules/services/pulseeffects.nix | 30 +- modules/services/random-background.nix | 48 +- modules/services/recoll.nix | 98 +- .../services/redshift-gammastep/gammastep.nix | 10 +- .../redshift-gammastep/lib/options.nix | 134 +- .../services/redshift-gammastep/redshift.nix | 10 +- modules/services/remmina.nix | 29 +- modules/services/rsibreak.nix | 17 +- modules/services/safeeyes.nix | 10 +- modules/services/screen-locker.nix | 99 +- modules/services/sctd.nix | 61 +- modules/services/signaturepdf.nix | 53 +- modules/services/skhd.nix | 37 +- modules/services/snixembed.nix | 16 +- modules/services/spotifyd.nix | 19 +- modules/services/ssh-agent.nix | 14 +- modules/services/stalonetray.nix | 44 +- modules/services/status-notifier-watcher.nix | 26 +- modules/services/swayidle.nix | 201 +-- modules/services/swaync.nix | 36 +- modules/services/swayosd.nix | 29 +- modules/services/swww.nix | 23 +- modules/services/sxhkd.nix | 64 +- modules/services/syncthing.nix | 708 +++++---- modules/services/systembus-notify.nix | 13 +- modules/services/taffybar.nix | 14 +- modules/services/tahoe-lafs.nix | 19 +- modules/services/taskwarrior-sync.nix | 33 +- modules/services/tldr-update.nix | 13 +- modules/services/trayer.nix | 89 +- modules/services/trayscale.nix | 36 +- modules/services/twmn.nix | 118 +- modules/services/udiskie.nix | 47 +- modules/services/unclutter.nix | 25 +- modules/services/unison.nix | 81 +- modules/services/vdirsyncer.nix | 45 +- modules/services/volnoti.nix | 30 +- modules/services/window-managers/awesome.nix | 23 +- .../window-managers/bspwm/default.nix | 92 +- .../window-managers/bspwm/options.nix | 65 +- modules/services/window-managers/fluxbox.nix | 26 +- .../services/window-managers/herbstluftwm.nix | 114 +- modules/services/window-managers/hyprland.nix | 227 +-- .../services/window-managers/i3-sway/i3.nix | 237 +-- .../window-managers/i3-sway/lib/functions.nix | 293 ++-- .../window-managers/i3-sway/lib/options.nix | 934 ++++++------ .../services/window-managers/i3-sway/sway.nix | 319 ++-- .../window-managers/i3-sway/swaynag.nix | 35 +- modules/services/window-managers/river.nix | 140 +- modules/services/window-managers/spectrwm.nix | 41 +- modules/services/window-managers/wayfire.nix | 337 +++-- modules/services/window-managers/xmonad.nix | 137 +- modules/services/wlsunset.nix | 59 +- modules/services/wluma.nix | 19 +- modules/services/wob.nix | 34 +- modules/services/wpaperd.nix | 47 +- modules/services/xcape.nix | 34 +- modules/services/xembed-sni-proxy.nix | 17 +- modules/services/xidlehook.nix | 111 +- modules/services/xscreensaver.nix | 23 +- modules/services/xsettingsd.nix | 45 +- modules/services/xsuspender.nix | 70 +- modules/services/yubikey-agent.nix | 144 +- modules/systemd.nix | 293 ++-- modules/targets/darwin/fonts.nix | 15 +- modules/targets/darwin/keybindings.nix | 27 +- modules/targets/darwin/linkapps.nix | 37 +- modules/targets/darwin/search.nix | 13 +- .../targets/darwin/user-defaults/default.nix | 86 +- .../darwin/user-defaults/opts-allhosts.nix | 108 +- .../darwin/user-defaults/opts-currenthost.nix | 20 +- modules/targets/generic-linux.nix | 65 +- modules/xresources.nix | 68 +- modules/xsession.nix | 67 +- nix-darwin/default.nix | 34 +- nixos/common.nix | 112 +- nixos/default.nix | 108 +- templates/nix-darwin/flake.nix | 39 +- templates/nixos/flake.nix | 34 +- templates/standalone/flake.nix | 6 +- tests/asserts.nix | 9 +- tests/default.nix | 1115 +++++++------- tests/flake.nix | 43 +- tests/integration/default.nix | 15 +- tests/integration/nixos/basics.nix | 36 +- .../standalone/alice-flake-init.nix | 6 +- tests/integration/standalone/flake-basics.nix | 47 +- .../standalone/home-with-symbols.nix | 29 +- tests/integration/standalone/kitty.nix | 31 +- .../mu/config-account-without-mu.nix | 3 +- tests/integration/standalone/mu/default.nix | 23 +- tests/integration/standalone/nh.nix | 46 +- .../integration/standalone/rclone/default.nix | 52 +- .../rclone/secrets-with-whitespace.nix | 3 +- .../rclone/with-secrets-in-store.nix | 3 +- .../standalone/standard-basics.nix | 28 +- tests/lib/generators/tokdl.nix | 30 +- .../generators/toscfg-err-dir-empty-name.nix | 3 +- tests/lib/generators/toscfg-example.nix | 25 +- tests/lib/types/dag-merge.nix | 62 +- tests/lib/types/dag-submodule.nix | 52 +- tests/lib/types/gvariant-merge.nix | 93 +- tests/modules/config/home-cursor/default.nix | 308 ++-- tests/modules/config/i18n/default.nix | 72 +- tests/modules/files/out-of-store-symlink.nix | 3 +- tests/modules/files/source-with-spaces.nix | 10 +- tests/modules/files/target-conflict.nix | 16 +- .../modules/home-environment/session-path.nix | 17 +- .../session-search-variables.nix | 17 +- .../home-environment/session-variables.nix | 6 +- .../input-method/fcitx5-configuration.nix | 7 +- .../i18n/input-method/kime-configuration.nix | 7 +- tests/modules/launchd/agents.nix | 6 +- tests/modules/misc/debug/default.nix | 13 +- .../editorconfig-simple-config.nix | 4 +- .../fontconfig/multiple-font-packages.nix | 8 +- .../misc/fontconfig/single-font-package.nix | 8 +- tests/modules/misc/gtk/default.nix | 1 - tests/modules/misc/nix/empty-settings.nix | 4 +- .../modules/misc/nix/example-channels-xdg.nix | 10 +- tests/modules/misc/nix/example-channels.nix | 3 +- tests/modules/misc/nix/example-settings.nix | 18 +- tests/modules/misc/nix/keep-old-nix-path.nix | 5 +- tests/modules/misc/pam/session-variables.nix | 3 +- tests/modules/misc/pam/yubico-with-ids.nix | 10 +- .../modules/misc/qt/qt-platform-theme-gtk.nix | 16 +- tests/modules/misc/xdg/default-locations.nix | 3 +- tests/modules/misc/xdg/desktop-entries.nix | 29 +- tests/modules/misc/xdg/file-gen.nix | 3 +- tests/modules/misc/xdg/mime-apps-basics.nix | 15 +- tests/modules/misc/xdg/mime-packages.nix | 10 +- tests/modules/misc/xdg/mime.nix | 11 +- tests/modules/misc/xdg/portal.nix | 20 +- tests/modules/misc/xdg/system-dirs.nix | 38 +- tests/modules/misc/xdg/user-dirs-null.nix | 27 +- tests/modules/misc/xsession/basic.nix | 4 +- .../misc/xsession/keyboard-without-layout.nix | 11 +- tests/modules/programs/aerc/assertion.nix | 38 +- tests/modules/programs/aerc/noSettings.nix | 17 +- tests/modules/programs/aerc/oauth.nix | 26 +- tests/modules/programs/aerc/settings.nix | 369 +++-- .../modules/programs/aerospace/aerospace.nix | 16 +- .../programs/alacritty/example-settings.nix | 12 +- .../programs/alacritty/settings-merging.nix | 30 +- .../programs/alacritty/toml-config.nix | 12 +- tests/modules/programs/alot/alot.nix | 5 +- tests/modules/programs/antidote/antidote.nix | 6 +- tests/modules/programs/aria2/settings.nix | 18 +- .../programs/atuin/example-settings.nix | 14 +- tests/modules/programs/atuin/fish.nix | 5 +- tests/modules/programs/atuin/no-shell.nix | 5 +- tests/modules/programs/atuin/nushell.nix | 36 +- tests/modules/programs/atuin/set-flags.nix | 10 +- .../autorandr/basic-configuration.nix | 46 +- tests/modules/programs/autorandr/scale.nix | 8 +- tests/modules/programs/awscli/awscli.nix | 6 +- tests/modules/programs/bacon/bacon.nix | 17 +- tests/modules/programs/bacon/empty-config.nix | 9 +- tests/modules/programs/bash/logout.nix | 8 +- .../programs/bash/session-variables.nix | 12 +- tests/modules/programs/bat/bat.nix | 37 +- .../programs/bat/deprecated-options.nix | 35 +- .../borgmatic/basic-configuration.nix | 81 +- .../both-sourcedirectories-and-patterns.nix | 13 +- tests/modules/programs/borgmatic/default.nix | 9 +- .../borgmatic/exclude-hm-symlinks.nix | 7 +- .../borgmatic/include-hm-symlinks.nix | 7 +- ...neither-sourcedirectories-nor-patterns.nix | 16 +- .../borgmatic/patterns-configuration.nix | 19 +- .../programs/bottom/empty-settings.nix | 3 +- .../programs/bottom/example-settings.nix | 7 +- .../programs/boxxy/example-settings.nix | 25 +- .../programs/browserpass/browserpass.nix | 49 +- tests/modules/programs/carapace/fish.nix | 37 +- tests/modules/programs/carapace/nushell.nix | 31 +- .../cavalier/cavalier-cava-settings.nix | 4 +- .../cavalier/cavalier-general-settings.nix | 14 +- tests/modules/programs/cmus/cmus.nix | 10 +- tests/modules/programs/darcs/boring.nix | 6 +- tests/modules/programs/dircolors/settings.nix | 3 +- .../dircolors/xdg-config-settings.nix | 3 +- tests/modules/programs/direnv/nushell.nix | 21 +- .../programs/direnv/stdlib-and-nix-direnv.nix | 6 +- tests/modules/programs/direnv/stdlib.nix | 6 +- tests/modules/programs/emacs/extra-config.nix | 13 +- tests/modules/programs/eww/null-config.nix | 4 +- .../fastfetch/basic-configuration.nix | 17 +- tests/modules/programs/feh/feh-bindings.nix | 10 +- tests/modules/programs/feh/feh-themes.nix | 30 +- tests/modules/programs/firefox/common.nix | 46 +- .../firefox/deprecated-native-messenger.nix | 30 +- .../programs/firefox/final-package.nix | 34 +- .../modules/programs/firefox/null-package.nix | 6 +- tests/modules/programs/firefox/policies.nix | 64 +- .../firefox/profiles/bookmarks/attrset.nix | 139 +- .../firefox/profiles/bookmarks/default.nix | 157 +- .../firefox/profiles/containers/default.nix | 36 +- .../profiles/containers/duplicate-ids.nix | 52 +- .../profiles/containers/id-out-of-range.nix | 35 +- .../firefox/profiles/duplicate-ids.nix | 36 +- .../firefox/profiles/extensions/default.nix | 50 +- .../firefox/profiles/overwrite/default.nix | 58 +- .../firefox/profiles/search/default.nix | 415 ++--- .../firefox/profiles/settings/default.nix | 56 +- .../programs/firefox/profiles/shared-path.nix | 96 +- .../firefox/setup-firefox-mock-overlay.nix | 59 +- .../programs/firefox/state-version-19_09.nix | 25 +- tests/modules/programs/fish/abbrs.nix | 6 +- .../modules/programs/fish/format-scripts.nix | 3 +- tests/modules/programs/fish/functions.nix | 11 +- tests/modules/programs/fish/manpage.nix | 7 +- tests/modules/programs/fish/no-functions.nix | 11 +- tests/modules/programs/fish/plugins.nix | 21 +- .../programs/foot/example-settings.nix | 4 +- .../programs/fuzzel/example-settings.nix | 4 +- tests/modules/programs/getmail/getmail.nix | 6 +- tests/modules/programs/gh-dash/config.nix | 22 +- tests/modules/programs/gh/config-file.nix | 20 +- .../modules/programs/gh/credential-helper.nix | 5 +- tests/modules/programs/gh/warnings.nix | 28 +- .../programs/ghostty/example-settings.nix | 3 +- .../programs/git-cliff/example-settings.nix | 12 +- .../programs/git-credential-oauth/basic.nix | 8 +- .../git-credential-oauth/extra-flags.nix | 4 +- .../programs/git-worktree-switcher/bash.nix | 4 +- .../programs/git-worktree-switcher/fish.nix | 4 +- .../programs/git-worktree-switcher/zsh.nix | 4 +- tests/modules/programs/git/git-with-email.nix | 7 +- tests/modules/programs/git/git-with-hooks.nix | 4 +- .../git/git-with-signing-key-id-legacy.nix | 11 +- .../programs/git/git-with-signing-key-id.nix | 7 +- .../git/git-with-str-extra-config.nix | 12 +- .../git/git-without-signing-key-id.nix | 4 +- .../programs/git/git-without-signing.nix | 4 +- tests/modules/programs/git/git.nix | 23 +- .../programs/gnome-shell/gnome-shell.nix | 41 +- .../gnome-terminal/bad-profile-name.nix | 16 +- tests/modules/programs/go/go-telemetry.nix | 25 +- .../programs/gpg/immutable-keyfiles.nix | 3 +- .../programs/gpg/override-defaults.nix | 12 +- .../gradle/alternate-home-settings.nix | 11 +- tests/modules/programs/gradle/default.nix | 1 - .../programs/gradle/empty-settings.nix | 3 +- .../programs/gradle/example-settings.nix | 19 +- .../programs/gradle/init-scripts-settings.nix | 15 +- .../programs/helix/example-settings.nix | 213 +-- .../programs/hexchat/basic-configuration.nix | 4 +- tests/modules/programs/himalaya/basic.nix | 8 +- .../programs/htop/example-settings.nix | 61 +- tests/modules/programs/htop/header_layout.nix | 57 +- .../programs/htop/settings-without-fields.nix | 33 +- .../programs/hyprlock/basic-configuration.nix | 42 +- .../hyprlock/complex-configuration.nix | 129 +- .../programs/i3blocks/with-ordered-blocks.nix | 3 +- .../programs/i3status-rust/with-custom.nix | 170 ++- .../programs/i3status-rust/with-default.nix | 77 +- .../i3status-rust/with-extra-settings.nix | 176 ++- .../i3status-rust/with-multiple-bars.nix | 75 +- .../i3status-rust/with-version-02xx.nix | 73 +- .../i3status-rust/with-version-0311.nix | 8 +- .../modules/programs/i3status/with-custom.nix | 44 +- .../programs/i3status/with-default.nix | 86 +- .../programs/irssi/example-settings.nix | 3 +- .../programs/jqp/basic-configuration.nix | 4 +- .../modules/programs/jujutsu/empty-config.nix | 6 +- .../programs/jujutsu/example-config.nix | 18 +- .../programs/k9s/deprecated-options.nix | 4 +- tests/modules/programs/k9s/empty-settings.nix | 15 +- .../modules/programs/k9s/example-settings.nix | 111 +- tests/modules/programs/kakoune/default.nix | 3 +- tests/modules/programs/kakoune/no-plugins.nix | 4 +- tests/modules/programs/khal/config.nix | 13 +- tests/modules/programs/khard/basic_config.nix | 18 +- .../programs/kitty/example-settings.nix | 29 +- .../programs/kitty/theme-to-themeFile.nix | 15 +- .../programs/kodi/example-settings.nix | 4 +- tests/modules/programs/kodi/kodi-stubs.nix | 3 +- .../kubecolor/does-have-openshift.nix | 1 - .../kubecolor/does-not-have-openshift.nix | 1 - .../programs/kubecolor/empty-config.nix | 6 +- .../example-config-default-paths.nix | 24 +- .../kubecolor/example-config-xdg-paths.nix | 17 +- .../programs/lapce/example-keymaps.nix | 10 +- .../programs/lazydocker/custom-settings.nix | 8 +- .../programs/lazydocker/default-settings.nix | 3 +- tests/modules/programs/lazydocker/default.nix | 1 - .../programs/less/less-with-custom-keys.nix | 10 +- tests/modules/programs/lf/all-options.nix | 9 +- tests/modules/programs/lf/minimal-options.nix | 10 +- tests/modules/programs/lf/no-pv-keybind.nix | 7 +- tests/modules/programs/lieer/lieer.nix | 7 +- .../looking-glass-client/empty-settings.nix | 3 +- .../looking-glass-client/example-settings.nix | 3 +- .../modules/programs/lsd/example-settings.nix | 12 +- tests/modules/programs/man/no-manpath.nix | 4 +- .../programs/mangohud/basic-configuration.nix | 11 +- tests/modules/programs/mbsync/mbsync.nix | 25 +- .../programs/mergiraf/basic-configuration.nix | 4 +- .../programs/mise/bash-integration.nix | 4 +- .../modules/programs/mise/custom-settings.nix | 40 +- .../programs/mise/default-settings.nix | 3 +- .../programs/mise/fish-integration.nix | 4 +- .../programs/mise/nushell-integration.nix | 3 +- .../modules/programs/mise/zsh-integration.nix | 4 +- .../programs/mods/basic-configuration.nix | 9 +- .../programs/mpv/mpv-example-settings.nix | 11 +- .../programs/mpv/mpv-invalid-settings.nix | 20 +- .../programs/mu/custom-configuration.nix | 3 +- tests/modules/programs/mujmap/default.nix | 3 +- .../programs/mujmap/mujmap-defaults.nix | 7 +- .../mujmap-fqdn-and-session-url-specified.nix | 7 +- .../ncmpcpp/ncmpcpp-example-settings.nix | 10 +- tests/modules/programs/ne/defprefs.nix | 10 +- tests/modules/programs/ne/passthroughs.nix | 13 +- tests/modules/programs/neomutt/default.nix | 3 +- .../neomutt/neomutt-no-folder-change.nix | 4 +- .../programs/neomutt/neomutt-not-primary.nix | 4 +- .../programs/neomutt/neomutt-unmailboxes.nix | 5 +- .../neomutt-with-binds-invalid-settings.nix | 24 +- .../neomutt-with-binds-with-warning.nix | 18 +- .../programs/neomutt/neomutt-with-binds.nix | 18 +- .../programs/neomutt/neomutt-with-gpg.nix | 8 +- .../neomutt-with-imap-type-mailboxes.nix | 12 +- .../programs/neomutt/neomutt-with-imap.nix | 12 +- .../programs/neomutt/neomutt-with-msmtp.nix | 8 +- .../neomutt/neomutt-with-named-mailboxes.nix | 8 +- .../neomutt-with-signature-command.nix | 8 +- .../neomutt/neomutt-with-signature.nix | 8 +- .../neomutt/neomutt-with-starttls.nix | 8 +- tests/modules/programs/neomutt/neomutt.nix | 8 +- tests/modules/programs/neovim/coc-config.nix | 1 - .../programs/neovim/extra-lua-init.nix | 8 +- tests/modules/programs/neovim/no-init.nix | 7 +- .../modules/programs/neovim/plugin-config.nix | 9 +- tests/modules/programs/neovim/runtime.nix | 48 +- tests/modules/programs/neovim/stubs.nix | 23 +- .../newsboat/newsboat-basics-2003.nix | 9 +- .../newsboat/newsboat-basics-2105.nix | 9 +- .../programs/newsboat/newsboat-basics.nix | 9 +- .../programs/nheko/nheko-empty-settings.nix | 9 +- .../programs/nheko/nheko-example-settings.nix | 21 +- .../nix-index/assert-on-command-not-found.nix | 5 +- .../programs/nix-index/integrations.nix | 8 +- .../programs/nix-your-shell/enable-shells.nix | 49 +- tests/modules/programs/nnn/nnn.nix | 16 +- .../programs/nushell/example-settings.nix | 61 +- tests/modules/programs/oh-my-posh/fish.nix | 5 +- tests/modules/programs/oh-my-posh/nushell.nix | 33 +- .../openstackclient/openstackclient.nix | 4 +- tests/modules/programs/pandoc/csl.nix | 1 - tests/modules/programs/pandoc/defaults.nix | 18 +- tests/modules/programs/pandoc/templates.nix | 5 +- tests/modules/programs/pet/settings_21_05.nix | 14 +- tests/modules/programs/pet/settings_21_11.nix | 24 +- tests/modules/programs/pet/snippets.nix | 15 +- .../modules/programs/pistol/associations.nix | 32 +- tests/modules/programs/pistol/config.nix | 14 +- .../programs/pistol/double-association.nix | 22 +- .../programs/pistol/missing-association.nix | 12 +- tests/modules/programs/pls/fish.nix | 5 +- .../programs/poetry/custom-settings.nix | 25 +- .../programs/poetry/default-settings.nix | 19 +- tests/modules/programs/powerline-go/bash.nix | 9 +- .../powerline-go/bashmodulesright.nix | 9 +- tests/modules/programs/powerline-go/fish.nix | 14 +- tests/modules/programs/powerline-go/zsh.nix | 9 +- .../programs/powerline-go/zshmodulesright.nix | 9 +- tests/modules/programs/pqiv/settings.nix | 16 +- tests/modules/programs/qcal/http-calendar.nix | 8 +- tests/modules/programs/qcal/mixed.nix | 14 +- .../modules/programs/qcal/webdav-calendar.nix | 10 +- .../programs/qutebrowser/greasemonkey.nix | 26 +- .../programs/qutebrowser/keybindings.nix | 31 +- .../programs/qutebrowser/quickmarks.nix | 27 +- .../modules/programs/qutebrowser/settings.nix | 32 +- tests/modules/programs/rbw/empty-settings.nix | 9 +- tests/modules/programs/rbw/settings.nix | 9 +- .../modules/programs/rbw/simple-settings.nix | 13 +- .../programs/readline/prefer-xdg-dirs.nix | 12 +- .../modules/programs/rio/example-settings.nix | 3 +- .../programs/ripgrep-all/custom-arguments.nix | 50 +- .../ripgrep-all/default-arguments.nix | 3 +- .../programs/ripgrep/custom-arguments.nix | 15 +- .../programs/ripgrep/default-arguments.nix | 3 +- .../programs/rofi-pass/rofi-pass-config.nix | 10 +- .../programs/rofi-pass/rofi-pass-root.nix | 8 +- .../rofi/config-with-deprecated-options.nix | 14 +- tests/modules/programs/rofi/custom-theme.nix | 44 +- tests/modules/programs/ruff/ruff.nix | 11 +- .../programs/sapling/sapling-basic.nix | 27 +- .../modules/programs/sapling/sapling-most.nix | 45 +- tests/modules/programs/sbt/credentials.nix | 3 +- .../programs/sbt/deprecated-options.nix | 14 +- tests/modules/programs/sbt/plugins.nix | 8 +- tests/modules/programs/sbt/repositories.nix | 6 +- .../modules/programs/sbt/user-config-path.nix | 29 +- tests/modules/programs/scmpuff/fish.nix | 5 +- tests/modules/programs/scmpuff/no-aliases.nix | 5 +- tests/modules/programs/scmpuff/no-fish.nix | 5 +- .../programs/senpai/example-settings.nix | 20 +- .../programs/sftpman/assert-on-no-sshkey.nix | 8 +- .../sioyek/sioyek-basic-configuration.nix | 18 +- tests/modules/programs/sm64ex/settings.nix | 144 +- tests/modules/programs/smug/settings.nix | 39 +- .../programs/spotify-player/settings.nix | 117 +- tests/modules/programs/ssh/default-config.nix | 12 +- tests/modules/programs/ssh/default.nix | 18 +- ...ds-dynamic-bind-path-with-port-asserts.nix | 12 +- ...forwards-dynamic-valid-bind-no-asserts.nix | 30 +- ...ards-local-bind-path-with-port-asserts.nix | 18 +- ...ards-local-host-path-with-port-asserts.nix | 18 +- ...rds-remote-bind-path-with-port-asserts.nix | 18 +- ...rds-remote-host-path-with-port-asserts.nix | 18 +- tests/modules/programs/ssh/includes.nix | 12 +- .../programs/ssh/match-blocks-attrs.nix | 27 +- .../ssh/match-blocks-match-and-hosts.nix | 16 +- tests/modules/programs/starship/settings.nix | 20 +- .../streamlink/streamlink-custom-plugins.nix | 39 +- .../streamlink/streamlink-settings.nix | 21 +- .../programs/swayimg/example-settings.nix | 8 +- tests/modules/programs/swaylock/disabled.nix | 3 +- tests/modules/programs/swaylock/enabled.nix | 3 +- tests/modules/programs/swaylock/legacy.nix | 13 +- tests/modules/programs/swaylock/settings.nix | 13 +- .../programs/swayr/basic-configuration.nix | 95 +- .../programs/taskwarrior/taskwarrior.nix | 18 +- .../programs/tealdeer/custom-settings.nix | 30 +- .../programs/tealdeer/default-settings.nix | 20 +- .../programs/terminator/config-file.nix | 14 +- .../programs/tex-fmt/custom-settings.nix | 26 +- .../programs/tex-fmt/default-settings.nix | 24 +- .../programs/texlive/texlive-minimal.nix | 6 +- .../thunderbird-native-messaging-host.nix | 35 +- .../programs/thunderbird/thunderbird.nix | 65 +- tests/modules/programs/tmate/tmate.nix | 22 +- tests/modules/programs/tmux/default-shell.nix | 6 +- .../tmux/disable-confirmation-prompt.nix | 4 +- .../programs/tmux/emacs-with-plugins.nix | 7 +- tests/modules/programs/tmux/mouse-enabled.nix | 4 +- tests/modules/programs/tmux/not-enabled.nix | 4 +- tests/modules/programs/tmux/prefix.nix | 4 +- .../programs/tmux/shortcut-without-prefix.nix | 4 +- tests/modules/programs/tmux/vi-all-true.nix | 4 +- tests/modules/programs/todoman/config.nix | 1 - tests/modules/programs/topgrade/settings.nix | 17 +- .../translate-shell/translate-shell.nix | 5 +- .../programs/vifm/example-settings.nix | 8 +- .../programs/vim-vint/basic-configuration.nix | 8 +- .../programs/vinegar/example-settings.nix | 3 +- tests/modules/programs/vscode/keybindings.nix | 29 +- tests/modules/programs/vscode/snippets.nix | 26 +- tests/modules/programs/vscode/tasks.nix | 22 +- .../modules/programs/vscode/update-checks.nix | 12 +- .../programs/watson/empty-settings.nix | 22 +- .../programs/watson/example-settings.nix | 26 +- tests/modules/programs/waybar/default.nix | 3 +- .../waybar/deprecated-modules-option.nix | 44 +- .../programs/waybar/settings-complex.nix | 33 +- .../programs/waybar/settings-with-attrs.nix | 26 +- .../systemd-with-graphical-session-target.nix | 4 +- .../programs/wezterm/empty-setting.nix | 26 +- .../programs/wezterm/example-setting.nix | 102 +- .../programs/wlogout/layout-multiple.nix | 3 +- .../programs/wlogout/layout-single.nix | 17 +- tests/modules/programs/wlogout/styling.nix | 3 +- .../programs/xmobar/basic-configuration.nix | 3 +- .../programs/yambar/example-settings.nix | 26 +- .../yazi/bash-integration-enabled.nix | 3 +- .../yazi/nushell-integration-enabled.nix | 22 +- tests/modules/programs/yazi/settings.nix | 4 +- .../programs/yazi/zsh-integration-enabled.nix | 3 +- .../programs/yt-dlp/yt-dlp-extraConfig.nix | 4 +- .../programs/yt-dlp/yt-dlp-simple-config.nix | 4 +- .../programs/zed-editor/extensions.nix | 32 +- tests/modules/programs/zed-editor/keymap.nix | 52 +- .../modules/programs/zed-editor/settings.nix | 40 +- .../modules/programs/zellij/enable-shells.nix | 5 +- tests/modules/programs/zk/zk.nix | 8 +- tests/modules/programs/zplug/modules.nix | 5 +- tests/modules/programs/zsh/aliases.nix | 58 +- .../programs/zsh/history-ignore-pattern.nix | 14 +- .../programs/zsh/history-substring-search.nix | 5 +- .../programs/zsh/syntax-highlighting.nix | 6 +- tests/modules/programs/zsh/zsh-abbr.nix | 4 +- .../programs/zsh/zshrc-content-priorities.nix | 85 +- .../services/activitywatch/basic-setup.nix | 10 +- .../modules/services/avizo/with-settings.nix | 48 +- .../services/avizo/without-settings.nix | 30 +- .../services/blanket/basic-configuration.nix | 30 +- .../services/cachix-agent/basic-setup.nix | 26 +- .../cliphist/cliphist-extra-options.nix | 7 +- .../cliphist-multiple-session-targets.nix | 5 +- .../cliphist/cliphist-sway-session-target.nix | 4 +- .../services/darkman/basic-configuration.nix | 56 +- .../services/darkman/no-configuration.nix | 35 +- .../services/davmail/custom-settings.nix | 47 +- .../services/davmail/imitateOutlook.nix | 47 +- .../services/easyeffects/example-preset.nix | 4 +- .../modules/services/easyeffects/service.nix | 4 +- tests/modules/services/emacs-darwin/basic.nix | 11 +- tests/modules/services/emacs/default.nix | 6 +- .../services/emacs/emacs-default-editor.nix | 13 +- .../services/emacs/emacs-service-27.nix | 22 +- ...vice-28-after-graphical-session-target.nix | 22 +- .../services/emacs/emacs-service-28.nix | 22 +- .../services/emacs/emacs-socket-27.nix | 22 +- .../services/emacs/emacs-socket-28.nix | 22 +- .../emacs-socket-and-startWithUserSession.nix | 7 +- .../espanso-darwin/basic-configuration.nix | 14 +- .../services/espanso/basic-configuration.nix | 14 +- .../services/flameshot/example-settings.nix | 12 +- .../services/fnott/example-settings.nix | 11 +- .../services/fnott/systemd-user-service.nix | 7 +- .../modules/services/fusuma/fusuma-stubs.nix | 5 +- tests/modules/services/fusuma/settings.nix | 20 +- tests/modules/services/git-sync/basic.nix | 30 +- .../modules/services/git-sync/whitespace.nix | 30 +- .../services/glance/example-settings.nix | 24 +- .../services/gpg-agent/default-homedir.nix | 7 +- .../services/gpg-agent/override-homedir.nix | 34 +- .../hyprpaper/basic-configuration.nix | 6 +- .../hyprpolkitagent/basic-configuration.nix | 22 +- .../services/imapnotify-darwin/launchd.nix | 28 +- .../services/imapnotify/imapnotify.nix | 10 +- .../modules/services/jankyborders/config.nix | 8 +- .../services/kanshi/alias-assertion.nix | 26 +- .../services/kanshi/basic-configuration.nix | 28 +- .../services/kanshi/new-configuration.nix | 28 +- .../basic-configuration.nix | 5 +- .../basic-configuration.nix | 22 +- .../macos-remap-keys/basic-configuration.nix | 4 +- .../services/mopidy/basic-configuration.nix | 33 +- tests/modules/services/mopidy/default.nix | 1 - .../mpd-mpris/configuration-basic.nix | 4 +- .../mpdscribble/basic-configuration.nix | 7 +- .../services/osmscout-server/basic-setup.nix | 36 +- .../picom/picom-basic-configuration.nix | 24 +- tests/modules/services/playerctld/basic.nix | 22 +- tests/modules/services/podman-linux/build.nix | 26 +- .../services/podman-linux/configuration.nix | 17 +- .../services/podman-linux/container.nix | 3 +- tests/modules/services/podman-linux/image.nix | 6 +- .../services/podman-linux/integration.nix | 35 +- .../services/podman-linux/manifest.nix | 20 +- .../modules/services/podman-linux/network.nix | 16 +- .../modules/services/podman-linux/volume.nix | 15 +- .../polkit-gnome/basic-configuration.nix | 22 +- .../services/polybar/basic-configuration.nix | 6 +- .../services/recoll/basic-configuration.nix | 25 +- .../services/recoll/config-format-order.nix | 24 +- .../gammastep-basic-configuration.nix | 4 +- .../gammastep-tray-configuration.nix | 4 +- .../redshift-basic-configuration.nix | 4 +- .../redshift-tray-configuration.nix | 4 +- .../modules/services/remmina/basic-config.nix | 8 +- .../services/remmina/default-config.nix | 3 +- .../screen-locker/basic-configuration.nix | 9 +- .../services/screen-locker/moved-options.nix | 42 +- .../services/screen-locker/no-xautolock.nix | 4 +- .../signaturepdf/basic-configuration.nix | 8 +- .../services/swayidle/basic-configuration.nix | 32 +- tests/modules/services/swaync/swaync.nix | 34 +- tests/modules/services/swayosd/swayosd.nix | 36 +- .../swww/swww-graphical-session-target.nix | 3 +- .../modules/services/sxhkd/configuration.nix | 3 +- .../syncthing/common/extra-options.nix | 5 +- .../services/volnoti/package-option.nix | 18 +- .../window-managers/bspwm/configuration.nix | 19 +- .../herbstluftwm/herbstluftwm-no-tags.nix | 4 +- .../herbstluftwm-simple-config.nix | 10 +- .../hyprland/inconsistent-config.nix | 9 +- .../hyprland/multiple-devices-config.nix | 14 +- .../hyprland/null-package-config.nix | 20 +- .../hyprland/simple-config.nix | 14 +- .../hyprland/sourceFirst-false-config.nix | 4 +- .../i3/i3-bar-focused-colors.nix | 12 +- .../window-managers/i3/i3-followmouse.nix | 16 +- .../i3/i3-fonts-deprecated.nix | 19 +- .../services/window-managers/i3/i3-fonts.nix | 15 +- .../window-managers/i3/i3-keybindings.nix | 6 +- .../i3/i3-workspace-output.nix | 9 +- .../window-managers/river/configuration.nix | 16 +- .../spectrwm/spectrwm-simple-config.nix | 12 +- .../services/window-managers/sway/default.nix | 3 +- .../sway/sway-bar-focused-colors.nix | 12 +- .../sway/sway-check-config.nix | 7 +- .../window-managers/sway/sway-modules.nix | 18 +- .../window-managers/sway/sway-no-xwayland.nix | 8 +- .../sway/sway-null-package.nix | 23 +- .../sway/sway-systemd-variables.nix | 5 +- .../sway/sway-workspace-output.nix | 9 +- tests/modules/services/wob/wob-service.nix | 4 +- .../services/yubikey-agent-darwin/service.nix | 70 +- .../services/yubikey-agent/service.nix | 52 +- .../systemd/services-disabled-for-root.nix | 9 +- tests/modules/systemd/services.nix | 32 +- tests/modules/systemd/session-variables.nix | 20 +- tests/modules/systemd/slices.nix | 20 +- tests/modules/systemd/timers.nix | 12 +- tests/modules/systemd/user-config.nix | 14 +- tests/modules/targets-darwin/darwin.nix | 3 +- .../modules/targets-darwin/user-defaults.nix | 3 +- tests/modules/targets-linux/generic-linux.nix | 3 +- tests/modules/xresources/xresources.nix | 7 +- tests/stubs.nix | 146 +- 1051 files changed, 37028 insertions(+), 26594 deletions(-) diff --git a/default.nix b/default.nix index 4c0857fdd..a972c758c 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,6 @@ -{ pkgs ? import { } }: +{ + pkgs ? import { }, +}: let path = builtins.path { @@ -6,22 +8,26 @@ let name = "home-manager-source"; }; -in rec { - docs = let releaseInfo = pkgs.lib.importJSON ./release.json; - in with import ./docs { - inherit pkgs; - inherit (releaseInfo) release isReleaseBranch; - }; { +in +rec { + docs = + let + releaseInfo = pkgs.lib.importJSON ./release.json; + in + with import ./docs { + inherit pkgs; + inherit (releaseInfo) release isReleaseBranch; + }; + { - inherit manPages jsonModuleMaintainers; - inherit (manual) html htmlOpenTool; - inherit (options) json; - }; + inherit manPages jsonModuleMaintainers; + inherit (manual) html htmlOpenTool; + inherit (options) json; + }; home-manager = pkgs.callPackage ./home-manager { inherit path; }; - install = - pkgs.callPackage ./home-manager/install.nix { inherit home-manager; }; + install = pkgs.callPackage ./home-manager/install.nix { inherit home-manager; }; nixos = import ./nixos; lib = import ./lib { inherit (pkgs) lib; }; diff --git a/docs/default.nix b/docs/default.nix index dd79c4590..6887bd2bf 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -1,9 +1,12 @@ -{ pkgs +{ + pkgs, -# Note, this should be "the standard library" + HM extensions. -, lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib + # Note, this should be "the standard library" + HM extensions. + lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib, -, release, isReleaseBranch }: + release, + isReleaseBranch, +}: let @@ -19,86 +22,124 @@ let # Caveat: even if the package is reached by a different means, the # path above will be shown and not e.g. # `${config.services.foo.package}`. - scrubDerivations = prefixPath: attrs: + scrubDerivations = + prefixPath: attrs: let - scrubDerivation = name: value: - let pkgAttrName = prefixPath + "." + name; - in if lib.isAttrs value then + scrubDerivation = + name: value: + let + pkgAttrName = prefixPath + "." + name; + in + if lib.isAttrs value then scrubDerivations pkgAttrName value // lib.optionalAttrs (lib.isDerivation value) { outPath = "\${${pkgAttrName}}"; } else value; - in lib.mapAttrs scrubDerivation attrs; + in + lib.mapAttrs scrubDerivation attrs; # Make sure the used package is scrubbed to avoid actually # instantiating derivations. scrubbedPkgsModule = { - imports = [{ - _module.args = { - pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs); - pkgs_i686 = lib.mkForce { }; - }; - }]; + imports = [ + { + _module.args = { + pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs); + pkgs_i686 = lib.mkForce { }; + }; + } + ]; }; - dontCheckDefinitions = { _module.check = false; }; + dontCheckDefinitions = { + _module.check = false; + }; - gitHubDeclaration = user: repo: subpath: - let urlRef = if isReleaseBranch then "release-${release}" else "master"; - in { + gitHubDeclaration = + user: repo: subpath: + let + urlRef = if isReleaseBranch then "release-${release}" else "master"; + in + { url = "https://github.com/${user}/${repo}/blob/${urlRef}/${subpath}"; name = "<${repo}/${subpath}>"; }; hmPath = toString ./..; - buildOptionsDocs = args@{ modules, includeModuleSystemOptions ? true, ... }: + buildOptionsDocs = + args@{ + modules, + includeModuleSystemOptions ? true, + ... + }: let - options = (lib.evalModules { - inherit modules; - class = "homeManager"; - }).options; - in pkgs.buildPackages.nixosOptionsDoc ({ - options = if includeModuleSystemOptions then - options - else - builtins.removeAttrs options [ "_module" ]; - transformOptions = opt: - opt // { - # Clean up declaration sites to not refer to the Home Manager - # source tree. - declarations = map (decl: - if lib.hasPrefix hmPath (toString decl) then - gitHubDeclaration "nix-community" "home-manager" - (lib.removePrefix "/" (lib.removePrefix hmPath (toString decl))) - else if decl == "lib/modules.nix" then - # TODO: handle this in a better way (may require upstream - # changes to nixpkgs) - gitHubDeclaration "NixOS" "nixpkgs" decl - else - decl) opt.declarations; - }; - } // builtins.removeAttrs args [ "modules" "includeModuleSystemOptions" ]); + options = + (lib.evalModules { + inherit modules; + class = "homeManager"; + }).options; + in + pkgs.buildPackages.nixosOptionsDoc ( + { + options = + if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ]; + transformOptions = + opt: + opt + // { + # Clean up declaration sites to not refer to the Home Manager + # source tree. + declarations = map ( + decl: + if lib.hasPrefix hmPath (toString decl) then + gitHubDeclaration "nix-community" "home-manager" ( + lib.removePrefix "/" (lib.removePrefix hmPath (toString decl)) + ) + else if decl == "lib/modules.nix" then + # TODO: handle this in a better way (may require upstream + # changes to nixpkgs) + gitHubDeclaration "NixOS" "nixpkgs" decl + else + decl + ) opt.declarations; + }; + } + // builtins.removeAttrs args [ + "modules" + "includeModuleSystemOptions" + ] + ); hmOptionsDocs = buildOptionsDocs { - modules = import ../modules/modules.nix { - inherit lib pkgs; - check = false; - } ++ [ scrubbedPkgsModule ]; + modules = + import ../modules/modules.nix { + inherit lib pkgs; + check = false; + } + ++ [ scrubbedPkgsModule ]; variablelistId = "home-manager-options"; }; nixosOptionsDocs = buildOptionsDocs { - modules = [ ../nixos scrubbedPkgsModule dontCheckDefinitions ]; + modules = [ + ../nixos + scrubbedPkgsModule + dontCheckDefinitions + ]; includeModuleSystemOptions = false; variablelistId = "nixos-options"; optionIdPrefix = "nixos-opt-"; }; nixDarwinOptionsDocs = buildOptionsDocs { - modules = [ ../nix-darwin scrubbedPkgsModule dontCheckDefinitions ]; + modules = [ + ../nix-darwin + scrubbedPkgsModule + dontCheckDefinitions + ]; includeModuleSystemOptions = false; variablelistId = "nix-darwin-options"; optionIdPrefix = "nix-darwin-opt-"; @@ -108,22 +149,26 @@ let revision = "release-${release-config.release}"; # Generate the `man home-configuration.nix` package home-configuration-manual = - pkgs.runCommand "home-configuration-reference-manpage" { - nativeBuildInputs = - [ pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs ]; - allowedReferences = [ "out" ]; - } '' - # Generate manpages. - mkdir -p $out/share/man/man5 - mkdir -p $out/share/man/man1 - nixos-render-docs -j $NIX_BUILD_CORES options manpage \ - --revision ${revision} \ - --header ${./home-configuration-nix-header.5} \ - --footer ${./home-configuration-nix-footer.5} \ - ${hmOptionsDocs.optionsJSON}/share/doc/nixos/options.json \ - $out/share/man/man5/home-configuration.nix.5 - cp ${./home-manager.1} $out/share/man/man1/home-manager.1 - ''; + pkgs.runCommand "home-configuration-reference-manpage" + { + nativeBuildInputs = [ + pkgs.buildPackages.installShellFiles + pkgs.nixos-render-docs + ]; + allowedReferences = [ "out" ]; + } + '' + # Generate manpages. + mkdir -p $out/share/man/man5 + mkdir -p $out/share/man/man1 + nixos-render-docs -j $NIX_BUILD_CORES options manpage \ + --revision ${revision} \ + --header ${./home-configuration-nix-header.5} \ + --footer ${./home-configuration-nix-footer.5} \ + ${hmOptionsDocs.optionsJSON}/share/doc/nixos/options.json \ + $out/share/man/man5/home-configuration.nix.5 + cp ${./home-manager.1} $out/share/man/man1/home-manager.1 + ''; # Generate the HTML manual pages home-manager-manual = pkgs.callPackage ./home-manager-manual.nix { home-manager-options = { @@ -135,22 +180,26 @@ let }; html = home-manager-manual; htmlOpenTool = pkgs.callPackage ./html-open-tool.nix { } { inherit html; }; -in { +in +{ options = { # TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream # `nixosOptionsDoc` is more customizable. - json = pkgs.runCommand "options.json" { - meta.description = "List of Home Manager options in JSON format"; - } '' - mkdir -p $out/{share/doc,nix-support} - cp -a ${hmOptionsDocs.optionsJSON}/share/doc/nixos $out/share/doc/home-manager - substitute \ - ${hmOptionsDocs.optionsJSON}/nix-support/hydra-build-products \ - $out/nix-support/hydra-build-products \ - --replace-fail \ - '${hmOptionsDocs.optionsJSON}/share/doc/nixos' \ - "$out/share/doc/home-manager" - ''; + json = + pkgs.runCommand "options.json" + { + meta.description = "List of Home Manager options in JSON format"; + } + '' + mkdir -p $out/{share/doc,nix-support} + cp -a ${hmOptionsDocs.optionsJSON}/share/doc/nixos $out/share/doc/home-manager + substitute \ + ${hmOptionsDocs.optionsJSON}/nix-support/hydra-build-products \ + $out/nix-support/hydra-build-products \ + --replace-fail \ + '${hmOptionsDocs.optionsJSON}/share/doc/nixos' \ + "$out/share/doc/home-manager" + ''; }; manPages = home-configuration-manual; @@ -158,13 +207,18 @@ in { manual = { inherit html htmlOpenTool; }; # Unstable, mainly for CI. - jsonModuleMaintainers = pkgs.writeText "hm-module-maintainers.json" (let - result = lib.evalModules { - modules = import ../modules/modules.nix { - inherit lib pkgs; - check = false; - } ++ [ scrubbedPkgsModule ]; - class = "homeManager"; - }; - in builtins.toJSON result.config.meta.maintainers); + jsonModuleMaintainers = pkgs.writeText "hm-module-maintainers.json" ( + let + result = lib.evalModules { + modules = + import ../modules/modules.nix { + inherit lib pkgs; + check = false; + } + ++ [ scrubbedPkgsModule ]; + class = "homeManager"; + }; + in + builtins.toJSON result.config.meta.maintainers + ); } diff --git a/docs/flake.nix b/docs/flake.nix index 0abb68152..4e71ce7ed 100644 --- a/docs/flake.nix +++ b/docs/flake.nix @@ -9,7 +9,12 @@ }; }; - outputs = { self, nixpkgs, scss-reset }: + outputs = + { + self, + nixpkgs, + scss-reset, + }: let supportedSystems = [ "aarch64-darwin" @@ -28,7 +33,12 @@ p-build = pkgs.writeShellScriptBin "p-build" '' set -euo pipefail - export PATH=${lib.makeBinPath [ pkgs.coreutils pkgs.rsass ]} + export PATH=${ + lib.makeBinPath [ + pkgs.coreutils + pkgs.rsass + ] + } tmpfile=$(mktemp -d) trap "rm -r $tmpfile" EXIT @@ -42,20 +52,25 @@ }; releaseInfo = lib.importJSON ../release.json; - in { - devShells = forAllSystems (system: + in + { + devShells = forAllSystems ( + system: let pkgs = nixpkgs.legacyPackages.${system}; fpkgs = flakePkgs pkgs; - in { + in + { default = pkgs.mkShell { name = "hm-docs"; packages = [ fpkgs.p-build ]; }; - }); + } + ); # Expose the docs outputs - packages = forAllSystems (system: + packages = forAllSystems ( + system: let pkgs = nixpkgs.legacyPackages.${system}; docs = import ./default.nix { @@ -63,10 +78,12 @@ release = releaseInfo.release; isReleaseBranch = releaseInfo.isReleaseBranch; }; - in { + in + { inherit (docs) manPages jsonModuleMaintainers; inherit (docs.manual) html htmlOpenTool; inherit (docs.options) json; - }); + } + ); }; } diff --git a/docs/home-manager-manual.nix b/docs/home-manager-manual.nix index f87803962..26742e4c0 100644 --- a/docs/home-manager-manual.nix +++ b/docs/home-manager-manual.nix @@ -1,7 +1,15 @@ -{ stdenv, lib, documentation-highlighter, revision, home-manager-options -, nixos-render-docs }: -let outputPath = "share/doc/home-manager"; -in stdenv.mkDerivation { +{ + stdenv, + lib, + documentation-highlighter, + revision, + home-manager-options, + nixos-render-docs, +}: +let + outputPath = "share/doc/home-manager"; +in +stdenv.mkDerivation { name = "home-manager-manual"; nativeBuildInputs = [ nixos-render-docs ]; @@ -61,5 +69,7 @@ in stdenv.mkDerivation { passthru = { inherit home-manager-options; }; - meta = { maintainers = [ lib.maintainers.considerate ]; }; + meta = { + maintainers = [ lib.maintainers.considerate ]; + }; } diff --git a/docs/html-open-tool.nix b/docs/html-open-tool.nix index 077e2a2f6..279a8a06b 100644 --- a/docs/html-open-tool.nix +++ b/docs/html-open-tool.nix @@ -1,6 +1,14 @@ -{ writeShellScriptBin, makeDesktopItem, symlinkJoin }: -{ html, pathName ? "home-manager", projectName ? pathName -, name ? "${pathName}-help" }: +{ + writeShellScriptBin, + makeDesktopItem, + symlinkJoin, +}: +{ + html, + pathName ? "home-manager", + projectName ? pathName, + name ? "${pathName}-help", +}: let helpScript = writeShellScriptBin name '' set -euo pipefail @@ -30,7 +38,11 @@ let exec = "${helpScript}/bin/${name}"; categories = [ "System" ]; }; -in symlinkJoin { +in +symlinkJoin { inherit name; - paths = [ helpScript desktopItem ]; + paths = [ + helpScript + desktopItem + ]; } diff --git a/flake-module.nix b/flake-module.nix index cc5f1551a..6a886ba01 100644 --- a/flake-module.nix +++ b/flake-module.nix @@ -1,6 +1,18 @@ -{ lib, flake-parts-lib, moduleLocation, ... }: -let inherit (lib) toString mapAttrs mkOption types; -in { +{ + lib, + flake-parts-lib, + moduleLocation, + ... +}: +let + inherit (lib) + toString + mapAttrs + mkOption + types + ; +in +{ options = { flake = flake-parts-lib.mkSubmoduleOptions { homeConfigurations = mkOption { @@ -17,11 +29,13 @@ in { homeModules = mkOption { type = types.lazyAttrsOf types.deferredModule; default = { }; - apply = mapAttrs (k: v: { - _class = "homeManager"; - _file = "${toString moduleLocation}#homeModules.${k}"; - imports = [ v ]; - }); + apply = mapAttrs ( + k: v: { + _class = "homeManager"; + _file = "${toString moduleLocation}#homeModules.${k}"; + imports = [ v ]; + } + ); description = '' Home Manager modules. diff --git a/flake.nix b/flake.nix index 493bbe265..722d6c319 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,13 @@ }; }; - outputs = { self, nixpkgs, treefmt-nix, ... }: + outputs = + { + self, + nixpkgs, + treefmt-nix, + ... + }: { nixosModules = rec { home-manager = ./nixos; @@ -44,42 +50,50 @@ }; lib = import ./lib { inherit (nixpkgs) lib; }; - } // (let - forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; + } + // ( + let + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; - treefmtEval = forAllSystems ( - system: - treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} { - # Formatting configuration - programs = { - nixfmt.enable = true; - }; + treefmtEval = forAllSystems ( + system: + treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} { + # Formatting configuration + programs = { + nixfmt.enable = true; + }; + } + ); + in + { + checks = forAllSystems (system: { + formatting = treefmtEval.${system}.config.build.check self; }); - in { - checks = forAllSystems (system: { - formatting = treefmtEval.${system}.config.build.check self; - }); - formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper); + formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper); - packages = forAllSystems (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - releaseInfo = nixpkgs.lib.importJSON ./release.json; - docs = import ./docs { - inherit pkgs; - inherit (releaseInfo) release isReleaseBranch; - }; - hmPkg = pkgs.callPackage ./home-manager { path = "${self}"; }; - in { - default = hmPkg; - home-manager = hmPkg; + packages = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + releaseInfo = nixpkgs.lib.importJSON ./release.json; + docs = import ./docs { + inherit pkgs; + inherit (releaseInfo) release isReleaseBranch; + }; + hmPkg = pkgs.callPackage ./home-manager { path = "${self}"; }; + in + { + default = hmPkg; + home-manager = hmPkg; - docs-html = docs.manual.html; - docs-htmlOpenTool = docs.manual.htmlOpenTool; - docs-json = docs.options.json; - docs-jsonModuleMaintainers = docs.jsonModuleMaintainers; - docs-manpages = docs.manPages; - }); - }); + docs-html = docs.manual.html; + docs-htmlOpenTool = docs.manual.htmlOpenTool; + docs-json = docs.options.json; + docs-jsonModuleMaintainers = docs.jsonModuleMaintainers; + docs-manpages = docs.manPages; + } + ); + } + ); } diff --git a/home-manager/build-news.nix b/home-manager/build-news.nix index 871423bb5..1cb41d764 100644 --- a/home-manager/build-news.nix +++ b/home-manager/build-news.nix @@ -2,46 +2,70 @@ # file is considered internal and the exported fields may change without # warning. -{ newsJsonFile, newsReadIdsFile ? null }: +{ + newsJsonFile, + newsReadIdsFile ? null, +}: let inherit (builtins) - concatStringsSep filter hasAttr isString length readFile replaceStrings sort - split; + concatStringsSep + filter + hasAttr + isString + length + readFile + replaceStrings + sort + split + ; newsJson = builtins.fromJSON (builtins.readFile newsJsonFile); # Sorted and relevant entries. - relevantEntries = - sort (a: b: a.time > b.time) (filter (e: e.condition) newsJson.entries); + relevantEntries = sort (a: b: a.time > b.time) (filter (e: e.condition) newsJson.entries); - newsReadIds = if newsReadIdsFile == null then - { } - else - let ids = filter isString (split "\n" (readFile newsReadIdsFile)); - in builtins.listToAttrs (map (id: { - name = id; - value = null; - }) ids); + newsReadIds = + if newsReadIdsFile == null then + { } + else + let + ids = filter isString (split "\n" (readFile newsReadIdsFile)); + in + builtins.listToAttrs ( + map (id: { + name = id; + value = null; + }) ids + ); newsIsRead = entry: hasAttr entry.id newsReadIds; - newsUnread = let pred = entry: entry.condition && !newsIsRead entry; - in filter pred relevantEntries; + newsUnread = + let + pred = entry: entry.condition && !newsIsRead entry; + in + filter pred relevantEntries; prettyTime = t: replaceStrings [ "T" "+00:00" ] [ " " "" ] t; - layoutNews = entries: + layoutNews = + entries: let - mkTextEntry = entry: - let flag = if newsIsRead entry then "read" else "unread"; - in '' + mkTextEntry = + entry: + let + flag = if newsIsRead entry then "read" else "unread"; + in + '' * ${prettyTime entry.time} [${flag}] ${replaceStrings [ "\n" ] [ "\n " ] entry.message} ''; - in concatStringsSep "\n\n" (map mkTextEntry entries); -in { + in + concatStringsSep "\n\n" (map mkTextEntry entries); +in +{ meta = { numUnread = length newsUnread; display = newsJson.display; diff --git a/home-manager/default.nix b/home-manager/default.nix index 6b594c4fd..1484f1cfa 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,64 +1,79 @@ -{ runCommand, lib, bash, callPackage, coreutils, findutils, gettext, gnused, jq -, less, ncurses, inetutils -# used for pkgs.path for nixos-option -, pkgs +{ + runCommand, + lib, + bash, + callPackage, + coreutils, + findutils, + gettext, + gnused, + jq, + less, + ncurses, + inetutils, + # used for pkgs.path for nixos-option + pkgs, -# Path to use as the Home Manager channel. -, path ? null }: + # Path to use as the Home Manager channel. + path ? null, +}: let pathStr = if path == null then "" else path; - nixos-option = pkgs.nixos-option or (callPackage - (pkgs.path + "/nixos/modules/installer/tools/nixos-option") { }); + nixos-option = + pkgs.nixos-option or (callPackage (pkgs.path + "/nixos/modules/installer/tools/nixos-option") { }); -in runCommand "home-manager" { - preferLocalBuild = true; - nativeBuildInputs = [ gettext ]; - meta = { - mainProgram = "home-manager"; - description = "A user environment configurator"; - maintainers = [ lib.maintainers.rycee ]; - platforms = lib.platforms.unix; - license = lib.licenses.mit; - }; -} '' - install -v -D -m755 ${./home-manager} $out/bin/home-manager +in +runCommand "home-manager" + { + preferLocalBuild = true; + nativeBuildInputs = [ gettext ]; + meta = { + mainProgram = "home-manager"; + description = "A user environment configurator"; + maintainers = [ lib.maintainers.rycee ]; + platforms = lib.platforms.unix; + license = lib.licenses.mit; + }; + } + '' + install -v -D -m755 ${./home-manager} $out/bin/home-manager - substituteInPlace $out/bin/home-manager \ - --subst-var-by bash "${bash}" \ - --subst-var-by DEP_PATH "${ - lib.makeBinPath [ - coreutils - findutils - gettext - gnused - jq - less - ncurses - nixos-option - inetutils # for `hostname` - ] - }" \ - --subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \ - --subst-var-by HOME_MANAGER_PATH '${pathStr}' \ - --subst-var-by OUT "$out" + substituteInPlace $out/bin/home-manager \ + --subst-var-by bash "${bash}" \ + --subst-var-by DEP_PATH "${ + lib.makeBinPath [ + coreutils + findutils + gettext + gnused + jq + less + ncurses + nixos-option + inetutils # for `hostname` + ] + }" \ + --subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \ + --subst-var-by HOME_MANAGER_PATH '${pathStr}' \ + --subst-var-by OUT "$out" - install -D -m755 ${./completion.bash} \ - $out/share/bash-completion/completions/home-manager - install -D -m755 ${./completion.zsh} \ - $out/share/zsh/site-functions/_home-manager - install -D -m755 ${./completion.fish} \ - $out/share/fish/vendor_completions.d/home-manager.fish + install -D -m755 ${./completion.bash} \ + $out/share/bash-completion/completions/home-manager + install -D -m755 ${./completion.zsh} \ + $out/share/zsh/site-functions/_home-manager + install -D -m755 ${./completion.fish} \ + $out/share/fish/vendor_completions.d/home-manager.fish - install -D -m755 ${../lib/bash/home-manager.sh} \ - "$out/share/bash/home-manager.sh" + install -D -m755 ${../lib/bash/home-manager.sh} \ + "$out/share/bash/home-manager.sh" - for path in ${./po}/*.po; do - lang="''${path##*/}" - lang="''${lang%%.*}" - mkdir -p "$out/share/locale/$lang/LC_MESSAGES" - msgfmt -o "$out/share/locale/$lang/LC_MESSAGES/home-manager.mo" "$path" - done -'' + for path in ${./po}/*.po; do + lang="''${path##*/}" + lang="''${lang%%.*}" + mkdir -p "$out/share/locale/$lang/LC_MESSAGES" + msgfmt -o "$out/share/locale/$lang/LC_MESSAGES/home-manager.mo" "$path" + done + '' diff --git a/home-manager/home-manager.nix b/home-manager/home-manager.nix index 13a638fd8..7204a47e3 100644 --- a/home-manager/home-manager.nix +++ b/home-manager/home-manager.nix @@ -1,18 +1,31 @@ -{ pkgs ? import { }, confPath, confAttr ? null, check ? true -, newsReadIdsFile ? null }: +{ + pkgs ? import { }, + confPath, + confAttr ? null, + check ? true, + newsReadIdsFile ? null, +}: let inherit (pkgs.lib) - concatMapStringsSep fileContents filter length optionalString removeSuffix - replaceStrings splitString; + concatMapStringsSep + fileContents + filter + length + optionalString + removeSuffix + replaceStrings + splitString + ; env = import ../modules { - configuration = if confAttr == "" || confAttr == null then - confPath - else - (import confPath).${confAttr}; + configuration = + if confAttr == "" || confAttr == null then confPath else (import confPath).${confAttr}; pkgs = pkgs; check = check; }; -in { inherit (env) activationPackage config; } +in +{ + inherit (env) activationPackage config; +} diff --git a/home-manager/install.nix b/home-manager/install.nix index 2dfef324e..0416a9f85 100644 --- a/home-manager/install.nix +++ b/home-manager/install.nix @@ -8,13 +8,16 @@ let source ${home-manager}/share/bash/home-manager.sh ''; -in runCommand "home-manager-install" { - propagatedBuildInputs = [ home-manager ]; - preferLocalBuild = true; - shellHookOnly = true; - shellHook = "exec ${home-manager}/bin/home-manager init --switch --no-flake"; -} '' - ${hmBashLibInit} - _iError 'This derivation is not buildable, please run it using nix-shell.' - exit 1 -'' +in +runCommand "home-manager-install" + { + propagatedBuildInputs = [ home-manager ]; + preferLocalBuild = true; + shellHookOnly = true; + shellHook = "exec ${home-manager}/bin/home-manager init --switch --no-flake"; + } + '' + ${hmBashLibInit} + _iError 'This derivation is not buildable, please run it using nix-shell.' + exit 1 + '' diff --git a/lib/default.nix b/lib/default.nix index 5d0eb5f41..19eb26754 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,10 +1,21 @@ -{ lib }: { +{ lib }: +{ hm = (import ../modules/lib/stdlib-extended.nix lib).hm; - homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib - , extraSpecialArgs ? { }, check ? true + homeManagerConfiguration = + { + modules ? [ ], + pkgs, + lib ? pkgs.lib, + extraSpecialArgs ? { }, + check ? true, # Deprecated: - , configuration ? null, extraModules ? null, stateVersion ? null - , username ? null, homeDirectory ? null, system ? null }@args: + configuration ? null, + extraModules ? null, + stateVersion ? null, + username ? null, + homeDirectory ? null, + system ? null, + }@args: let msgForRemovedArg = '' The 'homeManagerConfiguration' arguments @@ -20,7 +31,8 @@ 'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.xhtml#sec-release-22.11-highlights ''; - throwForRemovedArgs = v: + throwForRemovedArgs = + v: let used = builtins.filter (n: (args.${n} or null) != null) [ "configuration" @@ -30,20 +42,34 @@ "extraModules" "system" ]; - msg = msgForRemovedArg + '' + msg = + msgForRemovedArg + + '' - Deprecated args passed: '' + builtins.concatStringsSep " " used; - in lib.throwIf (used != [ ]) msg v; + Deprecated args passed: '' + + builtins.concatStringsSep " " used; + in + lib.throwIf (used != [ ]) msg v; - in throwForRemovedArgs (import ../modules { - inherit pkgs lib check extraSpecialArgs; - configuration = { ... }: { - imports = modules ++ [{ programs.home-manager.path = "${../.}"; }]; - nixpkgs = { - config = lib.mkDefault pkgs.config; - inherit (pkgs) overlays; - }; - }; - }); + in + throwForRemovedArgs ( + import ../modules { + inherit + pkgs + lib + check + extraSpecialArgs + ; + configuration = + { ... }: + { + imports = modules ++ [ { programs.home-manager.path = "${../.}"; } ]; + nixpkgs = { + config = lib.mkDefault pkgs.config; + inherit (pkgs) overlays; + }; + }; + } + ); } diff --git a/modules/accounts/calendar.nix b/modules/accounts/calendar.nix index d71d4dff3..0251d5bc1 100644 --- a/modules/accounts/calendar.nix +++ b/modules/accounts/calendar.nix @@ -4,19 +4,22 @@ let cfg = config.accounts.calendar; - localModule = name: + localModule = + name: types.submodule { options = { path = mkOption { type = types.str; default = "${cfg.basePath}/${name}"; - defaultText = - lib.literalExpression "‹accounts.calendar.basePath›/‹name›"; + defaultText = lib.literalExpression "‹accounts.calendar.basePath›/‹name›"; description = "The path of the storage."; }; type = mkOption { - type = types.enum [ "filesystem" "singlefile" ]; + type = types.enum [ + "filesystem" + "singlefile" + ]; default = "filesystem"; description = "The type of the storage."; }; @@ -41,7 +44,11 @@ let remoteModule = types.submodule { options = { type = mkOption { - type = types.enum [ "caldav" "http" "google_calendar" ]; + type = types.enum [ + "caldav" + "http" + "google_calendar" + ]; description = "The type of the storage."; }; @@ -60,7 +67,10 @@ let passwordCommand = mkOption { type = types.nullOr (types.listOf types.str); default = null; - example = [ "pass" "caldav" ]; + example = [ + "pass" + "caldav" + ]; description = '' A command that prints the password to standard output. ''; @@ -68,62 +78,66 @@ let }; }; - calendarOpts = { name, ... }: { - options = { - name = mkOption { - type = types.str; - readOnly = true; - description = '' - Unique identifier of the calendar. This is set to the - attribute name of the calendar configuration. - ''; + calendarOpts = + { name, ... }: + { + options = { + name = mkOption { + type = types.str; + readOnly = true; + description = '' + Unique identifier of the calendar. This is set to the + attribute name of the calendar configuration. + ''; + }; + + primary = mkOption { + type = types.bool; + default = false; + description = '' + Whether this is the primary account. Only one account may be + set as primary. + ''; + }; + + primaryCollection = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The primary collection of the account. Required when an + account has multiple collections. + ''; + }; + + local = mkOption { + type = localModule name; + default = { }; + description = '' + Local configuration for the calendar. + ''; + }; + + remote = mkOption { + type = types.nullOr remoteModule; + default = null; + description = '' + Remote configuration for the calendar. + ''; + }; }; - primary = mkOption { - type = types.bool; - default = false; - description = '' - Whether this is the primary account. Only one account may be - set as primary. - ''; - }; - - primaryCollection = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - The primary collection of the account. Required when an - account has multiple collections. - ''; - }; - - local = mkOption { - type = localModule name; - default = { }; - description = '' - Local configuration for the calendar. - ''; - }; - - remote = mkOption { - type = types.nullOr remoteModule; - default = null; - description = '' - Remote configuration for the calendar. - ''; + config = { + name = name; }; }; - config = { name = name; }; - }; - -in { +in +{ options.accounts.calendar = { basePath = mkOption { type = types.str; example = ".calendar"; - apply = p: - if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; + apply = p: if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; description = '' The base directory in which to save calendars. May be a relative path, in which case it is relative the home @@ -132,25 +146,32 @@ in { }; accounts = mkOption { - type = types.attrsOf (types.submodule [ - calendarOpts - (import ../programs/vdirsyncer-accounts.nix) - (import ../programs/khal-accounts.nix) - (import ../programs/khal-calendar-accounts.nix) - ]); + type = types.attrsOf ( + types.submodule [ + calendarOpts + (import ../programs/vdirsyncer-accounts.nix) + (import ../programs/khal-accounts.nix) + (import ../programs/khal-calendar-accounts.nix) + ] + ); default = { }; description = "List of calendars."; }; }; config = lib.mkIf (cfg.accounts != { }) { - assertions = let - primaries = lib.catAttrs "name" - (lib.filter (a: a.primary) (lib.attrValues cfg.accounts)); - in [{ - assertion = lib.length primaries <= 1; - message = "Must have at most one primary calendar account but found " - + toString (lib.length primaries) + ", namely " - + lib.concatStringsSep ", " primaries; - }]; + assertions = + let + primaries = lib.catAttrs "name" (lib.filter (a: a.primary) (lib.attrValues cfg.accounts)); + in + [ + { + assertion = lib.length primaries <= 1; + message = + "Must have at most one primary calendar account but found " + + toString (lib.length primaries) + + ", namely " + + lib.concatStringsSep ", " primaries; + } + ]; }; } diff --git a/modules/accounts/contacts.nix b/modules/accounts/contacts.nix index b5d93f21f..4f88e15c3 100644 --- a/modules/accounts/contacts.nix +++ b/modules/accounts/contacts.nix @@ -5,19 +5,22 @@ let cfg = config.accounts.contact; - localModule = name: + localModule = + name: types.submodule { options = { path = mkOption { type = types.str; default = "${cfg.basePath}/${name}"; - defaultText = - lib.literalExpression "‹accounts.contact.basePath›/‹name›"; + defaultText = lib.literalExpression "‹accounts.contact.basePath›/‹name›"; description = "The path of the storage."; }; type = mkOption { - type = types.enum [ "filesystem" "singlefile" ]; + type = types.enum [ + "filesystem" + "singlefile" + ]; description = "The type of the storage."; }; @@ -41,7 +44,11 @@ let remoteModule = types.submodule { options = { type = mkOption { - type = types.enum [ "carddav" "http" "google_contacts" ]; + type = types.enum [ + "carddav" + "http" + "google_contacts" + ]; description = "The type of the storage."; }; @@ -69,7 +76,10 @@ let passwordCommand = mkOption { type = types.nullOr (types.listOf types.str); default = null; - example = [ "pass" "caldav" ]; + example = [ + "pass" + "caldav" + ]; description = '' A command that prints the password to standard output. ''; @@ -77,43 +87,47 @@ let }; }; - contactOpts = { name, ... }: { - options = { - name = mkOption { - type = types.str; - readOnly = true; - description = '' - Unique identifier of the contact account. This is set to the - attribute name of the contact configuration. - ''; + contactOpts = + { name, ... }: + { + options = { + name = mkOption { + type = types.str; + readOnly = true; + description = '' + Unique identifier of the contact account. This is set to the + attribute name of the contact configuration. + ''; + }; + + local = mkOption { + type = types.nullOr (localModule name); + default = null; + description = '' + Local configuration for the contacts. + ''; + }; + + remote = mkOption { + type = types.nullOr remoteModule; + default = null; + description = '' + Remote configuration for the contacts. + ''; + }; }; - local = mkOption { - type = types.nullOr (localModule name); - default = null; - description = '' - Local configuration for the contacts. - ''; - }; - - remote = mkOption { - type = types.nullOr remoteModule; - default = null; - description = '' - Remote configuration for the contacts. - ''; + config = { + name = name; }; }; - config = { name = name; }; - }; - -in { +in +{ options.accounts.contact = { basePath = mkOption { type = types.str; - apply = p: - if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; + apply = p: if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; description = '' The base directory in which to save contacts. May be a relative path, in which case it is relative the home @@ -122,12 +136,14 @@ in { }; accounts = mkOption { - type = types.attrsOf (types.submodule [ - contactOpts - (import ../programs/vdirsyncer-accounts.nix) - (import ../programs/khal-accounts.nix) - (import ../programs/khal-contact-accounts.nix) - ]); + type = types.attrsOf ( + types.submodule [ + contactOpts + (import ../programs/vdirsyncer-accounts.nix) + (import ../programs/khal-accounts.nix) + (import ../programs/khal-contact-accounts.nix) + ] + ); default = { }; description = "List of contacts."; }; diff --git a/modules/accounts/email.nix b/modules/accounts/email.nix index 2395f7e39..cd9c30197 100644 --- a/modules/accounts/email.nix +++ b/modules/accounts/email.nix @@ -1,7 +1,12 @@ { config, lib, ... }: let - inherit (lib) mkDefault mkIf mkOption types; + inherit (lib) + mkDefault + mkIf + mkOption + types + ; cfg = config.accounts.email; @@ -66,7 +71,11 @@ let }; showSignature = mkOption { - type = types.enum [ "append" "attach" "none" ]; + type = types.enum [ + "append" + "attach" + "none" + ]; default = "none"; description = "Method to communicate the signature."; }; @@ -195,320 +204,333 @@ let }; }; - maildirModule = types.submodule ({ config, ... }: { - options = { - path = mkOption { - type = types.str; - description = '' - Path to maildir directory where mail for this account is - stored. This is relative to the base maildir path. - ''; + maildirModule = types.submodule ( + { config, ... }: + { + options = { + path = mkOption { + type = types.str; + description = '' + Path to maildir directory where mail for this account is + stored. This is relative to the base maildir path. + ''; + }; + + absPath = mkOption { + type = types.path; + readOnly = true; + internal = true; + default = "${cfg.maildirBasePath}/${config.path}"; + description = '' + A convenience option whose value is the absolute path of + this maildir. + ''; + }; }; + } + ); - absPath = mkOption { - type = types.path; - readOnly = true; - internal = true; - default = "${cfg.maildirBasePath}/${config.path}"; - description = '' - A convenience option whose value is the absolute path of - this maildir. - ''; - }; - }; - }); + mailAccountOpts = + { name, config, ... }: + { + options = { + name = mkOption { + type = types.str; + readOnly = true; + description = '' + Unique identifier of the account. This is set to the + attribute name of the account configuration. + ''; + }; - mailAccountOpts = { name, config, ... }: { - options = { - name = mkOption { - type = types.str; - readOnly = true; - description = '' - Unique identifier of the account. This is set to the - attribute name of the account configuration. - ''; - }; + primary = mkOption { + type = types.bool; + default = false; + description = '' + Whether this is the primary account. Only one account may be + set as primary. + ''; + }; - primary = mkOption { - type = types.bool; - default = false; - description = '' - Whether this is the primary account. Only one account may be - set as primary. - ''; - }; + flavor = mkOption { + type = types.enum [ + "plain" + "gmail.com" + "runbox.com" + "fastmail.com" + "yandex.com" + "outlook.office365.com" + "migadu.com" + ]; + default = "plain"; + description = '' + Some email providers have peculiar behavior that require + special treatment. This option is therefore intended to + indicate the nature of the provider. - flavor = mkOption { - type = types.enum [ - "plain" - "gmail.com" - "runbox.com" - "fastmail.com" - "yandex.com" - "outlook.office365.com" - "migadu.com" - ]; - default = "plain"; - description = '' - Some email providers have peculiar behavior that require - special treatment. This option is therefore intended to - indicate the nature of the provider. + When this indicates a specific provider then, for example, + the IMAP, SMTP, and JMAP server configuration may be set + automatically. + ''; + }; - When this indicates a specific provider then, for example, - the IMAP, SMTP, and JMAP server configuration may be set - automatically. - ''; - }; + address = mkOption { + type = types.strMatching ".*@.*"; + example = "jane.doe@example.org"; + description = "The email address of this account."; + }; - address = mkOption { - type = types.strMatching ".*@.*"; - example = "jane.doe@example.org"; - description = "The email address of this account."; - }; + aliases = mkOption { + description = "Alternative identities of this account."; + default = [ ]; + example = [ + "webmaster@example.org" + "admin@example.org" + ]; + type = types.listOf ( + types.oneOf [ + (types.strMatching ".*@.*") + (types.submodule { + options = { + realName = mkOption { + type = types.str; + example = "Jane Doe"; + description = "Name displayed when sending mails."; + }; + address = mkOption { + type = types.strMatching ".*@.*"; + example = "jane.doe@example.org"; + description = "The email address of this identity."; + }; + }; + }) + ] + ); + }; - aliases = mkOption { - description = "Alternative identities of this account."; - default = [ ]; - example = [ "webmaster@example.org" "admin@example.org" ]; - type = types.listOf (types.oneOf [ - (types.strMatching ".*@.*") - (types.submodule { + realName = mkOption { + type = types.str; + example = "Jane Doe"; + description = "Name displayed when sending mails."; + }; + + userName = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The server username of this account. This will be used as + the SMTP, IMAP, and JMAP user name. + ''; + }; + + passwordCommand = mkOption { + type = types.nullOr (types.either types.str (types.listOf types.str)); + default = null; + apply = p: if lib.isString p then lib.splitString " " p else p; + example = "secret-tool lookup email me@example.org"; + description = '' + A command, which when run writes the account password on + standard output. + ''; + }; + + folders = mkOption { + type = types.submodule { options = { - realName = mkOption { + inbox = mkOption { type = types.str; - example = "Jane Doe"; - description = "Name displayed when sending mails."; + default = "Inbox"; + description = '' + Relative path of the inbox mail. + ''; }; - address = mkOption { - type = types.strMatching ".*@.*"; - example = "jane.doe@example.org"; - description = "The email address of this identity."; + + sent = mkOption { + type = types.nullOr types.str; + default = "Sent"; + description = '' + Relative path of the sent mail folder. + ''; }; - }; - }) - ]); - }; - realName = mkOption { - type = types.str; - example = "Jane Doe"; - description = "Name displayed when sending mails."; - }; + drafts = mkOption { + type = types.nullOr types.str; + default = "Drafts"; + description = '' + Relative path of the drafts mail folder. + ''; + }; - userName = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - The server username of this account. This will be used as - the SMTP, IMAP, and JMAP user name. - ''; - }; - - passwordCommand = mkOption { - type = types.nullOr (types.either types.str (types.listOf types.str)); - default = null; - apply = p: if lib.isString p then lib.splitString " " p else p; - example = "secret-tool lookup email me@example.org"; - description = '' - A command, which when run writes the account password on - standard output. - ''; - }; - - folders = mkOption { - type = types.submodule { - options = { - inbox = mkOption { - type = types.str; - default = "Inbox"; - description = '' - Relative path of the inbox mail. - ''; - }; - - sent = mkOption { - type = types.nullOr types.str; - default = "Sent"; - description = '' - Relative path of the sent mail folder. - ''; - }; - - drafts = mkOption { - type = types.nullOr types.str; - default = "Drafts"; - description = '' - Relative path of the drafts mail folder. - ''; - }; - - trash = mkOption { - type = types.str; - default = "Trash"; - description = '' - Relative path of the deleted mail folder. - ''; + trash = mkOption { + type = types.str; + default = "Trash"; + description = '' + Relative path of the deleted mail folder. + ''; + }; }; }; + default = { }; + description = '' + Standard email folders. + ''; + }; + + imap = mkOption { + type = types.nullOr imapModule; + default = null; + description = '' + The IMAP configuration to use for this account. + ''; + }; + + jmap = mkOption { + type = types.nullOr jmapModule; + default = null; + description = '' + The JMAP configuration to use for this account. + ''; + }; + + signature = mkOption { + type = signatureModule; + default = { }; + description = '' + Signature configuration. + ''; + }; + + gpg = mkOption { + type = types.nullOr gpgModule; + default = null; + description = '' + GPG configuration. + ''; + }; + + smtp = mkOption { + type = types.nullOr smtpModule; + default = null; + description = '' + The SMTP configuration to use for this account. + ''; + }; + + maildir = mkOption { + type = types.nullOr maildirModule; + defaultText = { + path = "\${name}"; + }; + description = '' + Maildir configuration for this account. + ''; }; - default = { }; - description = '' - Standard email folders. - ''; }; - imap = mkOption { - type = types.nullOr imapModule; - default = null; - description = '' - The IMAP configuration to use for this account. - ''; - }; + config = lib.mkMerge [ + { + name = name; + maildir = lib.mkOptionDefault { path = "${name}"; }; + } - jmap = mkOption { - type = types.nullOr jmapModule; - default = null; - description = '' - The JMAP configuration to use for this account. - ''; - }; + (mkIf (config.flavor == "yandex.com") { + userName = mkDefault config.address; - signature = mkOption { - type = signatureModule; - default = { }; - description = '' - Signature configuration. - ''; - }; + imap = { + host = "imap.yandex.com"; + port = 993; + tls.enable = true; + }; - gpg = mkOption { - type = types.nullOr gpgModule; - default = null; - description = '' - GPG configuration. - ''; - }; + smtp = { + host = "smtp.yandex.com"; + port = 465; + tls.enable = true; + }; + }) - smtp = mkOption { - type = types.nullOr smtpModule; - default = null; - description = '' - The SMTP configuration to use for this account. - ''; - }; + (mkIf (config.flavor == "outlook.office365.com") { + userName = mkDefault config.address; - maildir = mkOption { - type = types.nullOr maildirModule; - defaultText = { path = "\${name}"; }; - description = '' - Maildir configuration for this account. - ''; - }; + imap = { + host = "outlook.office365.com"; + port = 993; + tls.enable = true; + }; + + smtp = { + host = "smtp.office365.com"; + port = 587; + tls = { + enable = true; + useStartTls = true; + }; + }; + }) + + (mkIf (config.flavor == "fastmail.com") { + userName = mkDefault config.address; + + imap = { + host = "imap.fastmail.com"; + port = 993; + }; + + smtp = { + host = "smtp.fastmail.com"; + port = if config.smtp.tls.useStartTls then 587 else 465; + }; + + jmap = { + host = "fastmail.com"; + sessionUrl = "https://jmap.fastmail.com/.well-known/jmap"; + }; + }) + + (mkIf (config.flavor == "migadu.com") { + userName = mkDefault config.address; + + imap = { + host = "imap.migadu.com"; + port = 993; + }; + + smtp = { + host = "smtp.migadu.com"; + port = 465; + }; + }) + + (mkIf (config.flavor == "gmail.com") { + userName = mkDefault config.address; + + imap = { + host = "imap.gmail.com"; + port = 993; + }; + + smtp = { + host = "smtp.gmail.com"; + port = if config.smtp.tls.useStartTls then 587 else 465; + }; + }) + + (mkIf (config.flavor == "runbox.com") { + imap = { + host = "mail.runbox.com"; + port = 993; + }; + + smtp = { + host = "mail.runbox.com"; + port = if config.smtp.tls.useStartTls then 587 else 465; + }; + }) + ]; }; - config = lib.mkMerge [ - { - name = name; - maildir = lib.mkOptionDefault { path = "${name}"; }; - } - - (mkIf (config.flavor == "yandex.com") { - userName = mkDefault config.address; - - imap = { - host = "imap.yandex.com"; - port = 993; - tls.enable = true; - }; - - smtp = { - host = "smtp.yandex.com"; - port = 465; - tls.enable = true; - }; - }) - - (mkIf (config.flavor == "outlook.office365.com") { - userName = mkDefault config.address; - - imap = { - host = "outlook.office365.com"; - port = 993; - tls.enable = true; - }; - - smtp = { - host = "smtp.office365.com"; - port = 587; - tls = { - enable = true; - useStartTls = true; - }; - }; - }) - - (mkIf (config.flavor == "fastmail.com") { - userName = mkDefault config.address; - - imap = { - host = "imap.fastmail.com"; - port = 993; - }; - - smtp = { - host = "smtp.fastmail.com"; - port = if config.smtp.tls.useStartTls then 587 else 465; - }; - - jmap = { - host = "fastmail.com"; - sessionUrl = "https://jmap.fastmail.com/.well-known/jmap"; - }; - }) - - (mkIf (config.flavor == "migadu.com") { - userName = mkDefault config.address; - - imap = { - host = "imap.migadu.com"; - port = 993; - }; - - smtp = { - host = "smtp.migadu.com"; - port = 465; - }; - }) - - (mkIf (config.flavor == "gmail.com") { - userName = mkDefault config.address; - - imap = { - host = "imap.gmail.com"; - port = 993; - }; - - smtp = { - host = "smtp.gmail.com"; - port = if config.smtp.tls.useStartTls then 587 else 465; - }; - }) - - (mkIf (config.flavor == "runbox.com") { - imap = { - host = "mail.runbox.com"; - port = 993; - }; - - smtp = { - host = "mail.runbox.com"; - port = if config.smtp.tls.useStartTls then 587 else 465; - }; - }) - ]; - }; - -in { +in +{ options.accounts.email = { certificatesFile = mkOption { type = types.nullOr types.path; @@ -524,8 +546,7 @@ in { type = types.str; default = "${config.home.homeDirectory}/Maildir"; defaultText = "Maildir"; - apply = p: - if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; + apply = p: if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; description = '' The base directory for account maildir directories. May be a relative path (e.g. the user setting this value as "MyMaildir"), @@ -543,16 +564,18 @@ in { config = mkIf (cfg.accounts != { }) { assertions = [ - (let - primaries = lib.catAttrs "name" - (lib.filter (a: a.primary) (lib.attrValues cfg.accounts)); - in { - assertion = lib.length primaries == 1; - message = "Must have exactly one primary mail account but found " - + toString (lib.length primaries) - + lib.optionalString (lib.length primaries > 1) - (", namely " + lib.concatStringsSep ", " primaries); - }) + ( + let + primaries = lib.catAttrs "name" (lib.filter (a: a.primary) (lib.attrValues cfg.accounts)); + in + { + assertion = lib.length primaries == 1; + message = + "Must have exactly one primary mail account but found " + + toString (lib.length primaries) + + lib.optionalString (lib.length primaries > 1) (", namely " + lib.concatStringsSep ", " primaries); + } + ) ]; }; } diff --git a/modules/config/home-cursor.nix b/modules/config/home-cursor.nix index ee8edbbb6..c6c2c0620 100644 --- a/modules/config/home-cursor.nix +++ b/modules/config/home-cursor.nix @@ -1,9 +1,27 @@ -{ config, options, lib, pkgs, ... }: +{ + config, + options, + lib, + pkgs, + ... +}: let inherit (lib) - mkEnableOption mkOption mkIf mkMerge mkDefault mkAliasOptionModule types - literalExpression escapeShellArg hm getAttrFromPath any optional; + mkEnableOption + mkOption + mkIf + mkMerge + mkDefault + mkAliasOptionModule + types + literalExpression + escapeShellArg + hm + getAttrFromPath + any + optional + ; cfg = config.home.pointerCursor; opts = options.home.pointerCursor; @@ -51,11 +69,13 @@ let }; dotIcons = { - enable = mkEnableOption '' - `.icons` config generation for {option}`home.pointerCursor` - '' // { - default = true; - }; + enable = + mkEnableOption '' + `.icons` config generation for {option}`home.pointerCursor` + '' + // { + default = true; + }; }; hyprcursor = { @@ -70,15 +90,12 @@ let }; sway = { - enable = mkEnableOption - "sway config generation for {option}`home.pointerCursor`"; + enable = mkEnableOption "sway config generation for {option}`home.pointerCursor`"; }; }; }; - cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${ - escapeShellArg cfg.x11.defaultCursor - }"; + cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${escapeShellArg cfg.x11.defaultCursor}"; defaultIndexThemePackage = pkgs.writeTextFile { name = "index.theme"; @@ -94,31 +111,44 @@ let ''; }; -in { +in +{ meta.maintainers = [ lib.maintainers.league ]; imports = [ - (mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [ - "home" - "pointerCursor" - "package" - ]) - (mkAliasOptionModule [ "xsession" "pointerCursor" "name" ] [ - "home" - "pointerCursor" - "name" - ]) - (mkAliasOptionModule [ "xsession" "pointerCursor" "size" ] [ - "home" - "pointerCursor" - "size" - ]) - (mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [ - "home" - "pointerCursor" - "x11" - "defaultCursor" - ]) + (mkAliasOptionModule + [ "xsession" "pointerCursor" "package" ] + [ + "home" + "pointerCursor" + "package" + ] + ) + (mkAliasOptionModule + [ "xsession" "pointerCursor" "name" ] + [ + "home" + "pointerCursor" + "name" + ] + ) + (mkAliasOptionModule + [ "xsession" "pointerCursor" "size" ] + [ + "home" + "pointerCursor" + "size" + ] + ) + (mkAliasOptionModule + [ "xsession" "pointerCursor" "defaultCursor" ] + [ + "home" + "pointerCursor" + "x11" + "defaultCursor" + ] + ) ]; options = { @@ -145,107 +175,121 @@ in { }; }; - config = let - # Check if enable option was explicitly defined by the user - enableDefined = any (x: x ? enable) opts.definitions; + config = + let + # Check if enable option was explicitly defined by the user + enableDefined = any (x: x ? enable) opts.definitions; - # Determine if cursor configuration should be enabled - enable = if enableDefined then cfg.enable else cfg != null; - in mkMerge [ - (mkIf enable (mkMerge [ - { - assertions = [ - (hm.assertions.assertPlatform "home.pointerCursor" pkgs - lib.platforms.linux) - ]; + # Determine if cursor configuration should be enabled + enable = if enableDefined then cfg.enable else cfg != null; + in + mkMerge [ + (mkIf enable (mkMerge [ + { + assertions = [ + (hm.assertions.assertPlatform "home.pointerCursor" pkgs lib.platforms.linux) + ]; - home.packages = [ cfg.package defaultIndexThemePackage ]; + home.packages = [ + cfg.package + defaultIndexThemePackage + ]; - home.sessionVariables = { - XCURSOR_SIZE = mkDefault cfg.size; - XCURSOR_THEME = mkDefault cfg.name; - }; + home.sessionVariables = { + XCURSOR_SIZE = mkDefault cfg.size; + XCURSOR_THEME = mkDefault cfg.name; + }; - # Set directory to look for cursors in, needed for some applications - # that are unable to find cursors otherwise. See: - # https://github.com/nix-community/home-manager/issues/2812 - # https://wiki.archlinux.org/title/Cursor_themes#Environment_variable - home.sessionSearchVariables.XCURSOR_PATH = - [ "${config.home.profileDirectory}/share/icons" ]; + # Set directory to look for cursors in, needed for some applications + # that are unable to find cursors otherwise. See: + # https://github.com/nix-community/home-manager/issues/2812 + # https://wiki.archlinux.org/title/Cursor_themes#Environment_variable + home.sessionSearchVariables.XCURSOR_PATH = [ "${config.home.profileDirectory}/share/icons" ]; - # Add cursor icon link to $XDG_DATA_HOME/icons as well for redundancy. - xdg.dataFile."icons/default/index.theme".source = - "${defaultIndexThemePackage}/share/icons/default/index.theme"; - xdg.dataFile."icons/${cfg.name}".source = - "${cfg.package}/share/icons/${cfg.name}"; - } + # Add cursor icon link to $XDG_DATA_HOME/icons as well for redundancy. + xdg.dataFile."icons/default/index.theme".source = + "${defaultIndexThemePackage}/share/icons/default/index.theme"; + xdg.dataFile."icons/${cfg.name}".source = "${cfg.package}/share/icons/${cfg.name}"; + } - (mkIf cfg.dotIcons.enable { - # Add symlink of cursor icon directory to $HOME/.icons, needed for - # backwards compatibility with some applications. See: - # https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html - home.file.".icons/default/index.theme".source = - "${defaultIndexThemePackage}/share/icons/default/index.theme"; - home.file.".icons/${cfg.name}".source = - "${cfg.package}/share/icons/${cfg.name}"; - }) + (mkIf cfg.dotIcons.enable { + # Add symlink of cursor icon directory to $HOME/.icons, needed for + # backwards compatibility with some applications. See: + # https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html + home.file.".icons/default/index.theme".source = + "${defaultIndexThemePackage}/share/icons/default/index.theme"; + home.file.".icons/${cfg.name}".source = "${cfg.package}/share/icons/${cfg.name}"; + }) - (mkIf cfg.x11.enable { - xsession.profileExtra = '' - ${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${ - toString cfg.size - } - ''; + (mkIf cfg.x11.enable { + xsession.profileExtra = '' + ${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${toString cfg.size} + ''; - xresources.properties = { - "Xcursor.theme" = cfg.name; - "Xcursor.size" = cfg.size; - }; - }) + xresources.properties = { + "Xcursor.theme" = cfg.name; + "Xcursor.size" = cfg.size; + }; + }) - (mkIf cfg.gtk.enable { - gtk.cursorTheme = mkDefault { inherit (cfg) package name size; }; - }) + (mkIf cfg.gtk.enable { + gtk.cursorTheme = mkDefault { inherit (cfg) package name size; }; + }) - (mkIf cfg.hyprcursor.enable { - home.sessionVariables = { - HYPRCURSOR_THEME = cfg.name; - HYPRCURSOR_SIZE = if cfg.hyprcursor.size != null then - cfg.hyprcursor.size - else - cfg.size; - }; - }) + (mkIf cfg.hyprcursor.enable { + home.sessionVariables = { + HYPRCURSOR_THEME = cfg.name; + HYPRCURSOR_SIZE = if cfg.hyprcursor.size != null then cfg.hyprcursor.size else cfg.size; + }; + }) - (mkIf cfg.sway.enable { - wayland.windowManager.sway = { - config = { - seat = { - "*" = { - xcursor_theme = - "${cfg.name} ${toString config.gtk.cursorTheme.size}"; + (mkIf cfg.sway.enable { + wayland.windowManager.sway = { + config = { + seat = { + "*" = { + xcursor_theme = "${cfg.name} ${toString config.gtk.cursorTheme.size}"; + }; }; }; }; - }; - }) - ])) + }) + ])) - { - warnings = (optional (any (x: - getAttrFromPath - ([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ]) - options) [ "package" "name" "size" "defaultCursor" ]) '' - The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed - in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable` - to generate x11 specific cursor configurations. You can refer to the documentation for more details. - '') ++ (optional (opts.highestPrio != (lib.mkOptionDefault { }).priority - && cfg == null) '' + { + warnings = + (optional + (any + ( + x: + getAttrFromPath ( + [ + "xsession" + "pointerCursor" + ] + ++ [ x ] + ++ [ "isDefined" ] + ) options + ) + [ + "package" + "name" + "size" + "defaultCursor" + ] + ) + '' + The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed + in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable` + to generate x11 specific cursor configurations. You can refer to the documentation for more details. + '' + ) + ++ (optional (opts.highestPrio != (lib.mkOptionDefault { }).priority && cfg == null) '' Setting home.pointerCursor to null is deprecated. Please update your configuration to explicitly set: home.pointerCursor.enable = false; ''); - } - ]; + } + ]; } diff --git a/modules/config/i18n.nix b/modules/config/i18n.nix index 409227236..e7872c637 100644 --- a/modules/config/i18n.nix +++ b/modules/config/i18n.nix @@ -15,7 +15,12 @@ # below for changes: # https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let inherit (config.i18n) glibcLocales; @@ -25,14 +30,20 @@ let archivePath = "${glibcLocales}/lib/locale/locale-archive"; # lookup the version of glibcLocales and set the appropriate environment vars - localeVars = if lib.versionAtLeast version "2.27" then { - LOCALE_ARCHIVE_2_27 = archivePath; - } else if lib.versionAtLeast version "2.11" then { - LOCALE_ARCHIVE_2_11 = archivePath; - } else - { }; + localeVars = + if lib.versionAtLeast version "2.27" then + { + LOCALE_ARCHIVE_2_27 = archivePath; + } + else if lib.versionAtLeast version "2.11" then + { + LOCALE_ARCHIVE_2_11 = archivePath; + } + else + { }; -in { +in +{ meta.maintainers = with lib.maintainers; [ midchildan ]; options = { diff --git a/modules/default.nix b/modules/default.nix index 05d2a504c..b68e7cf2e 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,18 +1,24 @@ -{ configuration, pkgs, lib ? pkgs.lib +{ + configuration, + pkgs, + lib ? pkgs.lib, # Whether to check that each option has a matching declaration. -, check ? true + check ? true, # Extra arguments passed to specialArgs. -, extraSpecialArgs ? { } }: + extraSpecialArgs ? { }, +}: let - collectFailed = cfg: - map (x: x.message) (lib.filter (x: !x.assertion) cfg.assertions); + collectFailed = cfg: map (x: x.message) (lib.filter (x: !x.assertion) cfg.assertions); - showWarnings = res: - let f = w: x: builtins.trace "warning: ${w}" x; - in lib.fold f res res.config.warnings; + showWarnings = + res: + let + f = w: x: builtins.trace "warning: ${w}" x; + in + lib.fold f res res.config.warnings; extendedLib = import ./lib/stdlib-extended.nix lib; @@ -24,24 +30,33 @@ let rawModule = extendedLib.evalModules { modules = [ configuration ] ++ hmModules; class = "homeManager"; - specialArgs = { modulesPath = builtins.toString ./.; } // extraSpecialArgs; + specialArgs = { + modulesPath = builtins.toString ./.; + } // extraSpecialArgs; }; - moduleChecks = raw: - showWarnings (let - failed = collectFailed raw.config; - failedStr = lib.concatStringsSep "\n" (map (x: "- ${x}") failed); - in if failed == [ ] then - raw - else - throw '' + moduleChecks = + raw: + showWarnings ( + let + failed = collectFailed raw.config; + failedStr = lib.concatStringsSep "\n" (map (x: "- ${x}") failed); + in + if failed == [ ] then + raw + else + throw '' - Failed assertions: - ${failedStr}''); + Failed assertions: + ${failedStr}'' + ); - withExtraAttrs = rawModule: - let module = moduleChecks rawModule; - in { + withExtraAttrs = + rawModule: + let + module = moduleChecks rawModule; + in + { inherit (module) options config; activationPackage = module.config.home.activationPackage; @@ -50,11 +65,13 @@ let activation-script = module.config.home.activationPackage; newsDisplay = rawModule.config.news.display; - newsEntries = lib.sort (a: b: a.time > b.time) - (lib.filter (a: a.condition) rawModule.config.news.entries); + newsEntries = lib.sort (a: b: a.time > b.time) ( + lib.filter (a: a.condition) rawModule.config.news.entries + ); inherit (module._module.args) pkgs; extendModules = args: withExtraAttrs (rawModule.extendModules args); }; -in withExtraAttrs rawModule +in +withExtraAttrs rawModule diff --git a/modules/files.nix b/modules/files.nix index c8791a46f..0d248dce9 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -1,4 +1,9 @@ -{ pkgs, config, lib, ... }: +{ + pkgs, + config, + lib, + ... +}: let @@ -6,18 +11,24 @@ let homeDirectory = config.home.homeDirectory; - fileType = (import lib/file-type.nix { - inherit homeDirectory lib pkgs; - }).fileType; + fileType = + (import lib/file-type.nix { + inherit homeDirectory lib pkgs; + }).fileType; - sourceStorePath = file: + sourceStorePath = + file: let sourcePath = toString file.source; sourceName = config.lib.strings.storeFileName (baseNameOf sourcePath); in - if builtins.hasContext sourcePath - then file.source - else builtins.path { path = file.source; name = sourceName; }; + if builtins.hasContext sourcePath then + file.source + else + builtins.path { + path = file.source; + name = sourceName; + }; in @@ -25,7 +36,7 @@ in options = { home.file = lib.mkOption { description = "Attribute set of files to link into the user home."; - default = {}; + default = { }; type = fileType "home.file" "{env}`HOME`" homeDirectory; }; @@ -37,26 +48,29 @@ in }; config = { - assertions = [( - let - dups = - lib.attrNames - (lib.filterAttrs (n: v: v > 1) - (lib.foldAttrs (acc: v: acc + v) 0 - (lib.mapAttrsToList (n: v: { ${v.target} = 1; }) cfg))); - dupsStr = lib.concatStringsSep ", " dups; - in { - assertion = dups == []; - message = '' - Conflicting managed target files: ${dupsStr} + assertions = [ + ( + let + dups = lib.attrNames ( + lib.filterAttrs (n: v: v > 1) ( + lib.foldAttrs (acc: v: acc + v) 0 (lib.mapAttrsToList (n: v: { ${v.target} = 1; }) cfg) + ) + ); + dupsStr = lib.concatStringsSep ", " dups; + in + { + assertion = dups == [ ]; + message = '' + Conflicting managed target files: ${dupsStr} - This may happen, for example, if you have a configuration similar to + This may happen, for example, if you have a configuration similar to - home.file = { - conflict1 = { source = ./foo.nix; target = "baz"; }; - conflict2 = { source = ./bar.nix; target = "baz"; }; - }''; - }) + home.file = { + conflict1 = { source = ./foo.nix; target = "baz"; }; + conflict2 = { source = ./bar.nix; target = "baz"; }; + }''; + } + ) ]; # Using this function it is possible to make `home.file` create a @@ -67,23 +81,23 @@ in # # would upon activation create a symlink `~/foo` that points to the # absolute path of the `bar` file relative the configuration file. - lib.file.mkOutOfStoreSymlink = path: + lib.file.mkOutOfStoreSymlink = + path: let pathStr = toString path; name = lib.hm.strings.storeFileName (baseNameOf pathStr); in - pkgs.runCommandLocal name {} ''ln -s ${lib.escapeShellArg pathStr} $out''; + pkgs.runCommandLocal name { } ''ln -s ${lib.escapeShellArg pathStr} $out''; # This verifies that the links we are about to create will not # overwrite an existing file. - home.activation.checkLinkTargets = lib.hm.dag.entryBefore ["writeBoundary"] ( + home.activation.checkLinkTargets = lib.hm.dag.entryBefore [ "writeBoundary" ] ( let # Paths that should be forcibly overwritten by Home Manager. # Caveat emptor! - forcedPaths = - lib.concatMapStringsSep " " (p: ''"$HOME"/${lib.escapeShellArg p}'') - (lib.mapAttrsToList (n: v: v.target) - (lib.filterAttrs (n: v: v.force) cfg)); + forcedPaths = lib.concatMapStringsSep " " (p: ''"$HOME"/${lib.escapeShellArg p}'') ( + lib.mapAttrsToList (n: v: v.target) (lib.filterAttrs (n: v: v.force) cfg) + ); storeDir = lib.escapeShellArg builtins.storeDir; @@ -124,7 +138,7 @@ in # and a failure during the intermediate state FA ∩ FB will not # result in lost links because this set of links are in both the # source and target generation. - home.activation.linkGeneration = lib.hm.dag.entryAfter ["writeBoundary"] ( + home.activation.linkGeneration = lib.hm.dag.entryAfter [ "writeBoundary" ] ( let link = pkgs.writeShellScript "link" '' ${config.lib.bash.initHomeManagerLib} @@ -189,43 +203,44 @@ in done ''; in - '' - function linkNewGen() { - _i "Creating home file links in %s" "$HOME" + '' + function linkNewGen() { + _i "Creating home file links in %s" "$HOME" - local newGenFiles - newGenFiles="$(readlink -e "$newGenPath/home-files")" - find "$newGenFiles" \( -type f -or -type l \) \ - -exec bash ${link} "$newGenFiles" {} + - } + local newGenFiles + newGenFiles="$(readlink -e "$newGenPath/home-files")" + find "$newGenFiles" \( -type f -or -type l \) \ + -exec bash ${link} "$newGenFiles" {} + + } - function cleanOldGen() { - if [[ ! -v oldGenPath || ! -e "$oldGenPath/home-files" ]] ; then - return - fi + function cleanOldGen() { + if [[ ! -v oldGenPath || ! -e "$oldGenPath/home-files" ]] ; then + return + fi - _i "Cleaning up orphan links from %s" "$HOME" + _i "Cleaning up orphan links from %s" "$HOME" - local newGenFiles oldGenFiles - newGenFiles="$(readlink -e "$newGenPath/home-files")" - oldGenFiles="$(readlink -e "$oldGenPath/home-files")" + local newGenFiles oldGenFiles + newGenFiles="$(readlink -e "$newGenPath/home-files")" + oldGenFiles="$(readlink -e "$oldGenPath/home-files")" - # Apply the cleanup script on each leaf in the old - # generation. The find command below will print the - # relative path of the entry. - find "$oldGenFiles" '(' -type f -or -type l ')' -printf '%P\0' \ - | xargs -0 bash ${cleanup} "$newGenFiles" - } + # Apply the cleanup script on each leaf in the old + # generation. The find command below will print the + # relative path of the entry. + find "$oldGenFiles" '(' -type f -or -type l ')' -printf '%P\0' \ + | xargs -0 bash ${cleanup} "$newGenFiles" + } - cleanOldGen - linkNewGen - '' + cleanOldGen + linkNewGen + '' ); - home.activation.checkFilesChanged = lib.hm.dag.entryBefore ["linkGeneration"] ( + home.activation.checkFilesChanged = lib.hm.dag.entryBefore [ "linkGeneration" ] ( let homeDirArg = lib.escapeShellArg homeDirectory; - in '' + in + '' function _cmp() { if [[ -d $1 && -d $2 ]]; then diff -rq "$1" "$2" &> /dev/null @@ -234,21 +249,25 @@ in fi } declare -A changedFiles - '' + lib.concatMapStrings (v: + '' + + lib.concatMapStrings ( + v: let sourceArg = lib.escapeShellArg (sourceStorePath v); targetArg = lib.escapeShellArg v.target; - in '' + in + '' _cmp ${sourceArg} ${homeDirArg}/${targetArg} \ && changedFiles[${targetArg}]=0 \ || changedFiles[${targetArg}]=1 - '') (lib.filter (v: v.onChange != "") (lib.attrValues cfg)) + '' + ) (lib.filter (v: v.onChange != "") (lib.attrValues cfg)) + '' unset -f _cmp '' ); - home.activation.onFilesChange = lib.hm.dag.entryAfter ["linkGeneration"] ( + home.activation.onFilesChange = lib.hm.dag.entryAfter [ "linkGeneration" ] ( lib.concatMapStrings (v: '' if (( ''${changedFiles[${lib.escapeShellArg v.target}]} == 1 )); then if [[ -v DRY_RUN || -v VERBOSE ]]; then @@ -263,85 +282,87 @@ in # Symlink directories and files that have the right execute bit. # Copy files that need their execute bit changed. - home-files = pkgs.runCommandLocal - "home-manager-files" - { - nativeBuildInputs = [ pkgs.xorg.lndir ]; - } - ('' - mkdir -p $out - - # Needed in case /nix is a symbolic link. - realOut="$(realpath -m "$out")" - - function insertFile() { - local source="$1" - local relTarget="$2" - local executable="$3" - local recursive="$4" - - # If the target already exists then we have a collision. Note, this - # should not happen due to the assertion found in the 'files' module. - # We therefore simply log the conflict and otherwise ignore it, mainly - # to make the `files-target-config` test work as expected. - if [[ -e "$realOut/$relTarget" ]]; then - echo "File conflict for file '$relTarget'" >&2 - return - fi - - # Figure out the real absolute path to the target. - local target - target="$(realpath -m "$realOut/$relTarget")" - - # Target path must be within $HOME. - if [[ ! $target == $realOut* ]] ; then - echo "Error installing file '$relTarget' outside \$HOME" >&2 - exit 1 - fi - - mkdir -p "$(dirname "$target")" - if [[ -d $source ]]; then - if [[ $recursive ]]; then - mkdir -p "$target" - lndir -silent "$source" "$target" - else - ln -s "$source" "$target" - fi - else - [[ -x $source ]] && isExecutable=1 || isExecutable="" - - # Link the file into the home file directory if possible, - # i.e., if the executable bit of the source is the same we - # expect for the target. Otherwise, we copy the file and - # set the executable bit to the expected value. - if [[ $executable == inherit || $isExecutable == $executable ]]; then - ln -s "$source" "$target" - else - cp "$source" "$target" - - if [[ $executable == inherit ]]; then - # Don't change file mode if it should match the source. - : - elif [[ $executable ]]; then - chmod +x "$target" - else - chmod -x "$target" - fi - fi - fi + home-files = + pkgs.runCommandLocal "home-manager-files" + { + nativeBuildInputs = [ pkgs.xorg.lndir ]; } - '' + lib.concatStrings ( - lib.mapAttrsToList (n: v: '' - insertFile ${ - lib.escapeShellArgs [ - (sourceStorePath v) - v.target - (if v.executable == null - then "inherit" - else toString v.executable) - (toString v.recursive) - ]} - '') cfg - )); + ( + '' + mkdir -p $out + + # Needed in case /nix is a symbolic link. + realOut="$(realpath -m "$out")" + + function insertFile() { + local source="$1" + local relTarget="$2" + local executable="$3" + local recursive="$4" + + # If the target already exists then we have a collision. Note, this + # should not happen due to the assertion found in the 'files' module. + # We therefore simply log the conflict and otherwise ignore it, mainly + # to make the `files-target-config` test work as expected. + if [[ -e "$realOut/$relTarget" ]]; then + echo "File conflict for file '$relTarget'" >&2 + return + fi + + # Figure out the real absolute path to the target. + local target + target="$(realpath -m "$realOut/$relTarget")" + + # Target path must be within $HOME. + if [[ ! $target == $realOut* ]] ; then + echo "Error installing file '$relTarget' outside \$HOME" >&2 + exit 1 + fi + + mkdir -p "$(dirname "$target")" + if [[ -d $source ]]; then + if [[ $recursive ]]; then + mkdir -p "$target" + lndir -silent "$source" "$target" + else + ln -s "$source" "$target" + fi + else + [[ -x $source ]] && isExecutable=1 || isExecutable="" + + # Link the file into the home file directory if possible, + # i.e., if the executable bit of the source is the same we + # expect for the target. Otherwise, we copy the file and + # set the executable bit to the expected value. + if [[ $executable == inherit || $isExecutable == $executable ]]; then + ln -s "$source" "$target" + else + cp "$source" "$target" + + if [[ $executable == inherit ]]; then + # Don't change file mode if it should match the source. + : + elif [[ $executable ]]; then + chmod +x "$target" + else + chmod -x "$target" + fi + fi + fi + } + '' + + lib.concatStrings ( + lib.mapAttrsToList (n: v: '' + insertFile ${ + lib.escapeShellArgs [ + (sourceStorePath v) + v.target + (if v.executable == null then "inherit" else toString v.executable) + (toString v.recursive) + ] + } + '') cfg + ) + ); }; } diff --git a/modules/home-environment.nix b/modules/home-environment.nix index b43ebc40b..d9816dea9 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) literalExpression mkOption types; @@ -112,10 +117,7 @@ let options = { layout = mkOption { type = with types; nullOr str; - default = - if lib.versionAtLeast config.home.stateVersion "19.09" - then null - else "us"; + default = if lib.versionAtLeast config.home.stateVersion "19.09" then null else "us"; defaultText = literalExpression "null"; description = '' Keyboard layout. If `null`, then the system @@ -137,8 +139,11 @@ let options = mkOption { type = types.listOf types.str; - default = []; - example = ["grp:caps_toggle" "grp_led:scroll"]; + default = [ ]; + example = [ + "grp:caps_toggle" + "grp_led:scroll" + ]; description = '' X keyboard options; layout switching goes here. ''; @@ -146,10 +151,7 @@ let variant = mkOption { type = with types; nullOr str; - default = - if lib.versionAtLeast config.home.stateVersion "19.09" - then null - else ""; + default = if lib.versionAtLeast config.home.stateVersion "19.09" then null else ""; defaultText = literalExpression "null"; example = "colemak"; description = '' @@ -216,7 +218,7 @@ in home.language = mkOption { type = languageSubModule; - default = {}; + default = { }; description = "Language configuration."; }; @@ -254,9 +256,19 @@ in }; home.sessionVariables = mkOption { - default = {}; - type = with types; lazyAttrsOf (oneOf [ str path int float ]); - example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; }; + default = { }; + type = + with types; + lazyAttrsOf (oneOf [ + str + path + int + float + ]); + example = { + EDITOR = "emacs"; + GS_OPTIONS = "-sPAPERSIZE=a4"; + }; description = '' Environment variables to always set at login. @@ -352,14 +364,18 @@ in home.packages = mkOption { type = types.listOf types.package; - default = []; + default = [ ]; description = "The set of packages to appear in the user environment."; }; home.extraOutputsToInstall = mkOption { type = types.listOf types.str; - default = []; - example = [ "doc" "info" "devdoc" ]; + default = [ ]; + example = [ + "doc" + "info" + "devdoc" + ]; description = '' List of additional package outputs of the packages {var}`home.packages` that should be installed into @@ -391,7 +407,7 @@ in home.activation = mkOption { type = lib.hm.types.dagOf types.str; - default = {}; + default = { }; example = literalExpression '' { myActivationAction = lib.hm.dag.entryAfter ["writeBoundary"] ''' @@ -518,41 +534,39 @@ in let hmRelease = config.home.version.release; nixpkgsRelease = lib.trivial.release; - releaseMismatch = - config.home.enableNixpkgsReleaseCheck - && hmRelease != nixpkgsRelease; + releaseMismatch = config.home.enableNixpkgsReleaseCheck && hmRelease != nixpkgsRelease; in - lib.optional releaseMismatch '' - You are using + lib.optional releaseMismatch '' + You are using - Home Manager version ${hmRelease} and - Nixpkgs version ${nixpkgsRelease}. + Home Manager version ${hmRelease} and + Nixpkgs version ${nixpkgsRelease}. - Using mismatched versions is likely to cause errors and unexpected - behavior. It is therefore highly recommended to use a release of Home - Manager that corresponds with your chosen release of Nixpkgs. + Using mismatched versions is likely to cause errors and unexpected + behavior. It is therefore highly recommended to use a release of Home + Manager that corresponds with your chosen release of Nixpkgs. - If you insist then you can disable this warning by adding + If you insist then you can disable this warning by adding - home.enableNixpkgsReleaseCheck = false; + home.enableNixpkgsReleaseCheck = false; - to your configuration. - ''; + to your configuration. + ''; - home.username = - lib.mkIf (lib.versionOlder config.home.stateVersion "20.09") - (lib.mkDefault (builtins.getEnv "USER")); - home.homeDirectory = - lib.mkIf (lib.versionOlder config.home.stateVersion "20.09") - (lib.mkDefault (builtins.getEnv "HOME")); + home.username = lib.mkIf (lib.versionOlder config.home.stateVersion "20.09") ( + lib.mkDefault (builtins.getEnv "USER") + ); + home.homeDirectory = lib.mkIf (lib.versionOlder config.home.stateVersion "20.09") ( + lib.mkDefault (builtins.getEnv "HOME") + ); home.profileDirectory = - if config.submoduleSupport.enable - && config.submoduleSupport.externalPackageInstall - then "/etc/profiles/per-user/${cfg.username}" - else if config.nix.enable && (config.nix.settings.use-xdg-base-directories or false) - then "${config.xdg.stateHome}/nix/profile" - else cfg.homeDirectory + "/.nix-profile"; + if config.submoduleSupport.enable && config.submoduleSupport.externalPackageInstall then + "/etc/profiles/per-user/${cfg.username}" + else if config.nix.enable && (config.nix.settings.use-xdg-base-directories or false) then + "${config.xdg.stateHome}/nix/profile" + else + cfg.homeDirectory + "/.nix-profile"; programs.bash.shellAliases = cfg.shellAliases; programs.zsh.shellAliases = cfg.shellAliases; @@ -563,51 +577,41 @@ in let maybeSet = n: v: lib.optionalAttrs (v != null) { ${n} = v; }; in - (maybeSet "LANG" cfg.language.base) - // - (maybeSet "LC_CTYPE" cfg.language.ctype) - // - (maybeSet "LC_NUMERIC" cfg.language.numeric) - // - (maybeSet "LC_TIME" cfg.language.time) - // - (maybeSet "LC_COLLATE" cfg.language.collate) - // - (maybeSet "LC_MONETARY" cfg.language.monetary) - // - (maybeSet "LC_MESSAGES" cfg.language.messages) - // - (maybeSet "LC_PAPER" cfg.language.paper) - // - (maybeSet "LC_NAME" cfg.language.name) - // - (maybeSet "LC_ADDRESS" cfg.language.address) - // - (maybeSet "LC_TELEPHONE" cfg.language.telephone) - // - (maybeSet "LC_MEASUREMENT" cfg.language.measurement); + (maybeSet "LANG" cfg.language.base) + // (maybeSet "LC_CTYPE" cfg.language.ctype) + // (maybeSet "LC_NUMERIC" cfg.language.numeric) + // (maybeSet "LC_TIME" cfg.language.time) + // (maybeSet "LC_COLLATE" cfg.language.collate) + // (maybeSet "LC_MONETARY" cfg.language.monetary) + // (maybeSet "LC_MESSAGES" cfg.language.messages) + // (maybeSet "LC_PAPER" cfg.language.paper) + // (maybeSet "LC_NAME" cfg.language.name) + // (maybeSet "LC_ADDRESS" cfg.language.address) + // (maybeSet "LC_TELEPHONE" cfg.language.telephone) + // (maybeSet "LC_MEASUREMENT" cfg.language.measurement); # Provide a file holding all session variables. home.sessionVariablesPackage = pkgs.writeTextFile { name = "hm-session-vars.sh"; destination = "/etc/profile.d/hm-session-vars.sh"; - text = '' - # Only source this once. - if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi - export __HM_SESS_VARS_SOURCED=1 + text = + '' + # Only source this once. + if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi + export __HM_SESS_VARS_SOURCED=1 - ${config.lib.shell.exportAll cfg.sessionVariables} - '' + lib.concatStringsSep "\n" - (lib.mapAttrsToList - (env: values: config.lib.shell.export - env - (config.lib.shell.prependToVar ":" env values)) - cfg.sessionSearchVariables) + "\n" + ${config.lib.shell.exportAll cfg.sessionVariables} + '' + + lib.concatStringsSep "\n" ( + lib.mapAttrsToList ( + env: values: config.lib.shell.export env (config.lib.shell.prependToVar ":" env values) + ) cfg.sessionSearchVariables + ) + + "\n" + cfg.sessionVariablesExtra; }; - home.sessionSearchVariables.PATH = - lib.mkIf (cfg.sessionPath != [ ]) cfg.sessionPath; + home.sessionSearchVariables.PATH = lib.mkIf (cfg.sessionPath != [ ]) cfg.sessionPath; home.packages = [ config.home.sessionVariablesPackage ]; @@ -638,9 +642,8 @@ in # In case the user has moved from a user-install of Home Manager # to a submodule managed one we attempt to uninstall the # `home-manager-path` package if it is installed. - home.activation.installPackages = lib.hm.dag.entryAfter ["writeBoundary"] ( - if config.submoduleSupport.externalPackageInstall - then + home.activation.installPackages = lib.hm.dag.entryAfter [ "writeBoundary" ] ( + if config.submoduleSupport.externalPackageInstall then '' nixProfileRemove home-manager-path '' @@ -681,62 +684,66 @@ in # in the `hm-modules` text domain. lib.bash.initHomeManagerLib = let - domainDir = pkgs.runCommand "hm-modules-messages" { - nativeBuildInputs = [ pkgs.buildPackages.gettext ]; - } '' - for path in ${./po}/*.po; do - lang="''${path##*/}" - lang="''${lang%%.*}" - mkdir -p "$out/$lang/LC_MESSAGES" - msgfmt -o "$out/$lang/LC_MESSAGES/hm-modules.mo" "$path" - done - ''; + domainDir = + pkgs.runCommand "hm-modules-messages" + { + nativeBuildInputs = [ pkgs.buildPackages.gettext ]; + } + '' + for path in ${./po}/*.po; do + lang="''${path##*/}" + lang="''${lang%%.*}" + mkdir -p "$out/$lang/LC_MESSAGES" + msgfmt -o "$out/$lang/LC_MESSAGES/hm-modules.mo" "$path" + done + ''; in - '' - export TEXTDOMAIN=hm-modules - export TEXTDOMAINDIR=${domainDir} - source ${../lib/bash/home-manager.sh} - ''; + '' + export TEXTDOMAIN=hm-modules + export TEXTDOMAINDIR=${domainDir} + source ${../lib/bash/home-manager.sh} + ''; home.activationPackage = let mkCmd = res: '' - _iNote "Activating %s" "${res.name}" - ${res.data} - ''; + _iNote "Activating %s" "${res.name}" + ${res.data} + ''; sortedCommands = lib.hm.dag.topoSort cfg.activation; activationCmds = if sortedCommands ? result then lib.concatStringsSep "\n" (map mkCmd sortedCommands.result) else - abort ("Dependency cycle in activation script: " - + builtins.toJSON sortedCommands); + abort ("Dependency cycle in activation script: " + builtins.toJSON sortedCommands); # Programs that always should be available on the activation # script's PATH. - activationBinPaths = lib.makeBinPath ( - with pkgs; [ - bash - coreutils - diffutils # For `cmp` and `diff`. - findutils - gettext - gnugrep - gnused - jq - ncurses # For `tput`. - ] - ++ config.home.extraActivationPath - ) - + ( - # Add path of the Nix binaries, if a Nix package is configured, then - # use that one, otherwise grab the path of the nix-env tool. - if config.nix.enable && config.nix.package != null then - ":${config.nix.package}/bin" - else - ":$(${pkgs.coreutils}/bin/dirname $(${pkgs.coreutils}/bin/readlink -m $(type -p nix-env)))" - ) - + lib.optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; + activationBinPaths = + lib.makeBinPath ( + with pkgs; + [ + bash + coreutils + diffutils # For `cmp` and `diff`. + findutils + gettext + gnugrep + gnused + jq + ncurses # For `tput`. + ] + ++ config.home.extraActivationPath + ) + + ( + # Add path of the Nix binaries, if a Nix package is configured, then + # use that one, otherwise grab the path of the nix-env tool. + if config.nix.enable && config.nix.package != null then + ":${config.nix.package}/bin" + else + ":$(${pkgs.coreutils}/bin/dirname $(${pkgs.coreutils}/bin/readlink -m $(type -p nix-env)))" + ) + + lib.optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; activationScript = pkgs.writeShellScript "activation-script" '' set -eu @@ -770,29 +777,28 @@ in ''} ''; in - pkgs.runCommand - "home-manager-generation" - { - preferLocalBuild = true; - } - '' - mkdir -p $out + pkgs.runCommand "home-manager-generation" + { + preferLocalBuild = true; + } + '' + mkdir -p $out - echo "${config.home.version.full}" > $out/hm-version + echo "${config.home.version.full}" > $out/hm-version - cp ${activationScript} $out/activate + cp ${activationScript} $out/activate - mkdir $out/bin - ln -s $out/activate $out/bin/home-manager-generation + mkdir $out/bin + ln -s $out/activate $out/bin/home-manager-generation - substituteInPlace $out/activate \ - --subst-var-by GENERATION_DIR $out + substituteInPlace $out/activate \ + --subst-var-by GENERATION_DIR $out - ln -s ${config.home-files} $out/home-files - ln -s ${cfg.path} $out/home-path + ln -s ${config.home-files} $out/home-files + ln -s ${cfg.path} $out/home-path - ${cfg.extraBuilderCommands} - ''; + ${cfg.extraBuilderCommands} + ''; home.path = pkgs.buildEnv { name = "home-manager-path"; diff --git a/modules/i18n/input-method/default.nix b/modules/i18n/input-method/default.nix index d6a1beb8e..40c011f78 100644 --- a/modules/i18n/input-method/default.nix +++ b/modules/i18n/input-method/default.nix @@ -1,33 +1,65 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.i18n.inputMethod; - gtk2Cache = pkgs.runCommandLocal "gtk2-immodule.cache" { - buildInputs = [ pkgs.gtk2 cfg.package ]; - } '' - mkdir -p $out/etc/gtk-2.0/ - GTK_PATH=${cfg.package}/lib/gtk-2.0/ \ - gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache - ''; + gtk2Cache = + pkgs.runCommandLocal "gtk2-immodule.cache" + { + buildInputs = [ + pkgs.gtk2 + cfg.package + ]; + } + '' + mkdir -p $out/etc/gtk-2.0/ + GTK_PATH=${cfg.package}/lib/gtk-2.0/ \ + gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache + ''; - gtk3Cache = pkgs.runCommandLocal "gtk3-immodule.cache" { - buildInputs = [ pkgs.gtk3 cfg.package ]; - } '' - mkdir -p $out/etc/gtk-3.0/ - GTK_PATH=${cfg.package}/lib/gtk-3.0/ \ - gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache - ''; + gtk3Cache = + pkgs.runCommandLocal "gtk3-immodule.cache" + { + buildInputs = [ + pkgs.gtk3 + cfg.package + ]; + } + '' + mkdir -p $out/etc/gtk-3.0/ + GTK_PATH=${cfg.package}/lib/gtk-3.0/ \ + gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache + ''; -in { - imports = [ ./fcitx5.nix ./hime.nix ./kime.nix ./nabi.nix ./uim.nix ]; +in +{ + imports = [ + ./fcitx5.nix + ./hime.nix + ./kime.nix + ./nabi.nix + ./uim.nix + ]; options.i18n = { inputMethod = { enabled = lib.mkOption { - type = lib.types.nullOr - (lib.types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]); + type = lib.types.nullOr ( + lib.types.enum [ + "fcitx" + "fcitx5" + "nabi" + "uim" + "hime" + "kime" + ] + ); default = null; example = "fcitx5"; description = '' @@ -73,15 +105,18 @@ in { config = lib.mkIf (cfg.enabled != null) { assertions = [ - (lib.hm.assertions.assertPlatform "i18n.inputMethod" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "i18n.inputMethod" pkgs lib.platforms.linux) { assertion = cfg.enabled != "fcitx"; message = "fcitx has been removed, please use fcitx5 instead"; } ]; - home.packages = [ cfg.package gtk2Cache gtk3Cache ]; + home.packages = [ + cfg.package + gtk2Cache + gtk3Cache + ]; }; meta.maintainers = [ lib.hm.maintainers.kranzes ]; diff --git a/modules/i18n/input-method/fcitx5.nix b/modules/i18n/input-method/fcitx5.nix index 2b18967da..f8dacb304 100644 --- a/modules/i18n/input-method/fcitx5.nix +++ b/modules/i18n/input-method/fcitx5.nix @@ -1,9 +1,15 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let im = config.i18n.inputMethod; cfg = im.fcitx5; fcitx5Package = cfg.fcitx5-with-addons.override { inherit (cfg) addons; }; -in { +in +{ options = { i18n.inputMethod.fcitx5 = { fcitx5-with-addons = lib.mkOption { @@ -38,17 +44,18 @@ in { i18n.inputMethod.package = fcitx5Package; home = { - sessionVariables = { - GLFW_IM_MODULE = "ibus"; # IME support in kitty - SDL_IM_MODULE = "fcitx"; - XMODIFIERS = "@im=fcitx"; - } // lib.optionalAttrs (!cfg.waylandFrontend) { - GTK_IM_MODULE = "fcitx"; - QT_IM_MODULE = "fcitx"; - }; + sessionVariables = + { + GLFW_IM_MODULE = "ibus"; # IME support in kitty + SDL_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + } + // lib.optionalAttrs (!cfg.waylandFrontend) { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + }; - sessionSearchVariables.QT_PLUGIN_PATH = - [ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ]; + sessionSearchVariables.QT_PLUGIN_PATH = [ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ]; }; systemd.user.services.fcitx5-daemon = { diff --git a/modules/i18n/input-method/hime.nix b/modules/i18n/input-method/hime.nix index 2d6f4d500..269f68634 100644 --- a/modules/i18n/input-method/hime.nix +++ b/modules/i18n/input-method/hime.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { config = lib.mkIf (config.i18n.inputMethod.enabled == "hime") { diff --git a/modules/i18n/input-method/kime.nix b/modules/i18n/input-method/kime.nix index 0416515f6..7ca7f4786 100644 --- a/modules/i18n/input-method/kime.nix +++ b/modules/i18n/input-method/kime.nix @@ -1,10 +1,22 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let - inherit (lib) literalExpression mkIf mkOption mkRemovedOptionModule types; + inherit (lib) + literalExpression + mkIf + mkOption + mkRemovedOptionModule + types + ; cfg = config.i18n.inputMethod.kime; -in { +in +{ imports = [ (mkRemovedOptionModule [ "i18n" "inputMethod" "kime" "config" ] '' Please use 'i18n.inputMethod.kime.extraConfig' instead. diff --git a/modules/i18n/input-method/nabi.nix b/modules/i18n/input-method/nabi.nix index a060f4800..e0f433997 100644 --- a/modules/i18n/input-method/nabi.nix +++ b/modules/i18n/input-method/nabi.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { config = lib.mkIf (config.i18n.inputMethod.enabled == "nabi") { diff --git a/modules/i18n/input-method/uim.nix b/modules/i18n/input-method/uim.nix index 8dcfe3238..fc870b4a1 100644 --- a/modules/i18n/input-method/uim.nix +++ b/modules/i18n/input-method/uim.nix @@ -1,13 +1,25 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: -let cfg = config.i18n.inputMethod.uim; -in { +let + cfg = config.i18n.inputMethod.uim; +in +{ options = { i18n.inputMethod.uim = { toolbar = lib.mkOption { - type = - lib.types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ]; + type = lib.types.enum [ + "gtk" + "gtk3" + "gtk-systray" + "gtk3-systray" + "qt4" + ]; default = "gtk"; example = "gtk-systray"; description = '' @@ -32,11 +44,12 @@ in { Description = "Uim input method editor"; PartOf = [ "graphical-session.desktop" ]; }; - Service.ExecStart = toString - (pkgs.writeShellScript "start-uim-xim-and-uim-toolbar" '' + Service.ExecStart = toString ( + pkgs.writeShellScript "start-uim-xim-and-uim-toolbar" '' ${pkgs.uim}/bin/uim-xim & ${pkgs.uim}/bin/uim-toolbar-${cfg.toolbar} - ''); + '' + ); Install.WantedBy = [ "graphical-session.target" ]; }; }; diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index 4932bd847..8cb500eda 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (pkgs.stdenv.hostPlatform) isDarwin; @@ -8,45 +13,48 @@ let labelPrefix = "org.nix-community.home."; dstDir = "${config.home.homeDirectory}/Library/LaunchAgents"; - launchdConfig = { config, name, ... }: { - options = { - enable = lib.mkEnableOption name; - config = lib.mkOption { - type = lib.types.submodule (import ./launchd.nix); - default = { }; - example = lib.literalExpression '' - { - ProgramArguments = [ "/usr/bin/say" "Good afternoon" ]; - StartCalendarInterval = [ - { - Hour = 12; - Minute = 0; - } - ]; - } - ''; - description = '' - Define a launchd job. See {manpage}`launchd.plist(5)` for details. - ''; + launchdConfig = + { config, name, ... }: + { + options = { + enable = lib.mkEnableOption name; + config = lib.mkOption { + type = lib.types.submodule (import ./launchd.nix); + default = { }; + example = lib.literalExpression '' + { + ProgramArguments = [ "/usr/bin/say" "Good afternoon" ]; + StartCalendarInterval = [ + { + Hour = 12; + Minute = 0; + } + ]; + } + ''; + description = '' + Define a launchd job. See {manpage}`launchd.plist(5)` for details. + ''; + }; + }; + + config = { + config.Label = lib.mkDefault "${labelPrefix}${name}"; }; }; - config = { config.Label = lib.mkDefault "${labelPrefix}${name}"; }; - }; - toAgent = config: pkgs.writeText "${config.Label}.plist" (toPlist { } config); - agentPlists = lib.mapAttrs' - (n: v: lib.nameValuePair "${v.config.Label}.plist" (toAgent v.config)) - (lib.filterAttrs (n: v: v.enable) cfg.agents); + agentPlists = lib.mapAttrs' (n: v: lib.nameValuePair "${v.config.Label}.plist" (toAgent v.config)) ( + lib.filterAttrs (n: v: v.enable) cfg.agents + ); agentsDrv = pkgs.runCommand "home-manager-agents" { } '' mkdir -p "$out" declare -A plists plists=(${ - lib.concatStringsSep " " - (lib.mapAttrsToList (name: value: "['${name}']='${value}'") agentPlists) + lib.concatStringsSep " " (lib.mapAttrsToList (name: value: "['${name}']='${value}'") agentPlists) }) for dest in "''${!plists[@]}"; do @@ -54,8 +62,12 @@ let ln -s "$src" "$out/$dest" done ''; -in { - meta.maintainers = with lib.maintainers; [ khaneliman midchildan ]; +in +{ + meta.maintainers = with lib.maintainers; [ + khaneliman + midchildan + ]; options.launchd = { enable = lib.mkOption { @@ -77,12 +89,16 @@ in { config = lib.mkMerge [ { - assertions = [{ - assertion = (cfg.enable && agentPlists != { }) -> isDarwin; - message = - let names = lib.concatStringsSep ", " (lib.attrNames agentPlists); - in "Must use Darwin for modules that require Launchd: " + names; - }]; + assertions = [ + { + assertion = (cfg.enable && agentPlists != { }) -> isDarwin; + message = + let + names = lib.concatStringsSep ", " (lib.attrNames agentPlists); + in + "Must use Darwin for modules that require Launchd: " + names; + } + ]; } (lib.mkIf isDarwin { @@ -94,170 +110,170 @@ in { # because it needs to be owned by the user running it. home.activation.setupLaunchAgents = lib.hm.dag.entryAfter [ "writeBoundary" ] # Bash - '' - # Disable errexit to ensure we process all agents even if some fail - set +e + '' + # Disable errexit to ensure we process all agents even if some fail + set +e - # Stop an agent if it's running - bootoutAgent() { - local domain="$1" - local agentName="$2" + # Stop an agent if it's running + bootoutAgent() { + local domain="$1" + local agentName="$2" - verboseEcho "Stopping agent '$domain/$agentName'..." - local bootout_output - bootout_output=$(run /bin/launchctl bootout "$domain/$agentName" 2>&1) || { - # Only show warning if it's not the common "No such process" error - if [[ "$bootout_output" != *"No such process"* ]]; then - warnEcho "Failed to stop agent '$domain/$agentName': $bootout_output" - else - verboseEcho "Agent '$domain/$agentName' was not running" - fi + verboseEcho "Stopping agent '$domain/$agentName'..." + local bootout_output + bootout_output=$(run /bin/launchctl bootout "$domain/$agentName" 2>&1) || { + # Only show warning if it's not the common "No such process" error + if [[ "$bootout_output" != *"No such process"* ]]; then + warnEcho "Failed to stop agent '$domain/$agentName': $bootout_output" + else + verboseEcho "Agent '$domain/$agentName' was not running" + fi + } + + # Give the system a moment to fully unload the agent + sleep 1 } - # Give the system a moment to fully unload the agent - sleep 1 - } + installAndBootstrapAgent() { + local srcPath="$1" + local dstPath="$2" + local domain="$3" + local agentName="$4" - installAndBootstrapAgent() { - local srcPath="$1" - local dstPath="$2" - local domain="$3" - local agentName="$4" - - verboseEcho "Installing agent file to $dstPath" - if ! run install -Dm444 -T "$srcPath" "$dstPath"; then - errorEcho "Failed to install agent file for '$agentName'" - return 1 - fi - - verboseEcho "Starting agent '$domain/$agentName'" - local bootstrap_output - bootstrap_output=$(run /bin/launchctl bootstrap "$domain" "$dstPath" 2>&1) || { - local error_code=$? - - if [[ "$bootstrap_output" == *"Bootstrap failed: 5: Input/output error"* ]]; then - errorEcho "Failed to start agent '$domain/$agentName' with I/O error (code 5)" - errorEcho "This typically happens when the agent wasn't unloaded before attempting to bootstrap the new agent." - else - errorEcho "Failed to start agent '$domain/$agentName' with error: $bootstrap_output" + verboseEcho "Installing agent file to $dstPath" + if ! run install -Dm444 -T "$srcPath" "$dstPath"; then + errorEcho "Failed to install agent file for '$agentName'" + return 1 fi - return 1 - } + verboseEcho "Starting agent '$domain/$agentName'" + local bootstrap_output + bootstrap_output=$(run /bin/launchctl bootstrap "$domain" "$dstPath" 2>&1) || { + local error_code=$? - verboseEcho "Successfully started agent '$domain/$agentName'" - return 0 - } + if [[ "$bootstrap_output" == *"Bootstrap failed: 5: Input/output error"* ]]; then + errorEcho "Failed to start agent '$domain/$agentName' with I/O error (code 5)" + errorEcho "This typically happens when the agent wasn't unloaded before attempting to bootstrap the new agent." + else + errorEcho "Failed to start agent '$domain/$agentName' with error: $bootstrap_output" + fi - processAgent() { - local srcPath="$1" - local dstDir="$2" - local domain="$3" + return 1 + } - local agentFile="''${srcPath##*/}" - local agentName="''${agentFile%.plist}" - local dstPath="$dstDir/$agentFile" - - # Skip if unchanged - if cmp -s "$srcPath" "$dstPath"; then - verboseEcho "Agent '$agentName' is already up-to-date" + verboseEcho "Successfully started agent '$domain/$agentName'" return 0 - fi + } - verboseEcho "Processing agent '$agentName'" + processAgent() { + local srcPath="$1" + local dstDir="$2" + local domain="$3" - # Stop/Unload agent if it's already running - if [[ -f "$dstPath" ]]; then + local agentFile="''${srcPath##*/}" + local agentName="''${agentFile%.plist}" + local dstPath="$dstDir/$agentFile" + + # Skip if unchanged + if cmp -s "$srcPath" "$dstPath"; then + verboseEcho "Agent '$agentName' is already up-to-date" + return 0 + fi + + verboseEcho "Processing agent '$agentName'" + + # Stop/Unload agent if it's already running + if [[ -f "$dstPath" ]]; then + bootoutAgent "$domain" "$agentName" + fi + + installAndBootstrapAgent "$srcPath" "$dstPath" "$domain" "$agentName" + # Note: We continue processing even if this agent fails + return 0 + } + + removeAgent() { + local srcPath="$1" + local dstDir="$2" + local newDir="$3" + local domain="$4" + + local agentFile="''${srcPath##*/}" + local agentName="''${agentFile%.plist}" + local dstPath="$dstDir/$agentFile" + + if [[ -e "$newDir/$agentFile" ]]; then + verboseEcho "Agent '$agentName' still exists in new generation, skipping cleanup" + return 0 + fi + + if [[ ! -e "$dstPath" ]]; then + verboseEcho "Agent file '$dstPath' already removed" + return 0 + fi + + if ! cmp -s "$srcPath" "$dstPath"; then + warnEcho "Skipping deletion of '$dstPath', since its contents have diverged" + return 0 + fi + + # Stop and remove the agent bootoutAgent "$domain" "$agentName" - fi - installAndBootstrapAgent "$srcPath" "$dstPath" "$domain" "$agentName" - # Note: We continue processing even if this agent fails - return 0 - } + verboseEcho "Removing agent file '$dstPath'" + if run rm -f $VERBOSE_ARG "$dstPath"; then + verboseEcho "Successfully removed agent file for '$agentName'" + else + warnEcho "Failed to remove agent file '$dstPath'" + fi - removeAgent() { - local srcPath="$1" - local dstDir="$2" - local newDir="$3" - local domain="$4" - - local agentFile="''${srcPath##*/}" - local agentName="''${agentFile%.plist}" - local dstPath="$dstDir/$agentFile" - - if [[ -e "$newDir/$agentFile" ]]; then - verboseEcho "Agent '$agentName' still exists in new generation, skipping cleanup" return 0 - fi + } - if [[ ! -e "$dstPath" ]]; then - verboseEcho "Agent file '$dstPath' already removed" - return 0 - fi + setupLaunchAgents() { + local oldDir newDir dstDir domain - if ! cmp -s "$srcPath" "$dstPath"; then - warnEcho "Skipping deletion of '$dstPath', since its contents have diverged" - return 0 - fi + newDir="$(readlink -m "$newGenPath/LaunchAgents")" + dstDir=${lib.escapeShellArg dstDir} + domain="gui/$UID" - # Stop and remove the agent - bootoutAgent "$domain" "$agentName" - - verboseEcho "Removing agent file '$dstPath'" - if run rm -f $VERBOSE_ARG "$dstPath"; then - verboseEcho "Successfully removed agent file for '$agentName'" - else - warnEcho "Failed to remove agent file '$dstPath'" - fi - - return 0 - } - - setupLaunchAgents() { - local oldDir newDir dstDir domain - - newDir="$(readlink -m "$newGenPath/LaunchAgents")" - dstDir=${lib.escapeShellArg dstDir} - domain="gui/$UID" - - if [[ -n "''${oldGenPath:-}" ]]; then - oldDir="$(readlink -m "$oldGenPath/LaunchAgents")" - if [[ ! -d "$oldDir" ]]; then - verboseEcho "No previous LaunchAgents directory found" + if [[ -n "''${oldGenPath:-}" ]]; then + oldDir="$(readlink -m "$oldGenPath/LaunchAgents")" + if [[ ! -d "$oldDir" ]]; then + verboseEcho "No previous LaunchAgents directory found" + oldDir="" + fi + else oldDir="" fi - else - oldDir="" + + verboseEcho "Setting up LaunchAgents in $dstDir" + [[ -d "$dstDir" ]] || run mkdir -p "$dstDir" + + verboseEcho "Processing new/updated LaunchAgents..." + find -L "$newDir" -maxdepth 1 -name '*.plist' -type f | while read -r srcPath; do + processAgent "$srcPath" "$dstDir" "$domain" + done + + # Skip cleanup if there's no previous generation + if [[ -z "$oldDir" || ! -d "$oldDir" ]]; then + verboseEcho "LaunchAgents setup complete" + return + fi + + verboseEcho "Cleaning up removed LaunchAgents..." + find -L "$oldDir" -maxdepth 1 -name '*.plist' -type f | while read -r srcPath; do + removeAgent "$srcPath" "$dstDir" "$newDir" "$domain" + done + } + + setupLaunchAgents + + # Restore errexit + if [[ -o errexit ]]; then + set -e fi - - verboseEcho "Setting up LaunchAgents in $dstDir" - [[ -d "$dstDir" ]] || run mkdir -p "$dstDir" - - verboseEcho "Processing new/updated LaunchAgents..." - find -L "$newDir" -maxdepth 1 -name '*.plist' -type f | while read -r srcPath; do - processAgent "$srcPath" "$dstDir" "$domain" - done - - # Skip cleanup if there's no previous generation - if [[ -z "$oldDir" || ! -d "$oldDir" ]]; then - verboseEcho "LaunchAgents setup complete" - return - fi - - verboseEcho "Cleaning up removed LaunchAgents..." - find -L "$oldDir" -maxdepth 1 -name '*.plist' -type f | while read -r srcPath; do - removeAgent "$srcPath" "$dstDir" "$newDir" "$domain" - done - } - - setupLaunchAgents - - # Restore errexit - if [[ -o errexit ]]; then - set -e - fi - ''; + ''; }) ]; } diff --git a/modules/launchd/launchd.nix b/modules/launchd/launchd.nix index 98024c584..907063b8e 100644 --- a/modules/launchd/launchd.nix +++ b/modules/launchd/launchd.nix @@ -29,7 +29,8 @@ let inherit (lib) types mkOption; # added by Home Manager launchdTypes = import ./types.nix { inherit config lib; }; -in { +in +{ freeformType = with types; attrsOf anything; # added by Home Manager options = { @@ -82,23 +83,27 @@ in { inetdCompatibility = mkOption { default = null; - example = { Wait = true; }; + example = { + Wait = true; + }; description = '' The presence of this key specifies that the daemon expects to be run as if it were launched from inetd. ''; - type = types.nullOr (types.submodule { - options = { - Wait = mkOption { - type = types.nullOr (types.either types.bool types.str); - default = null; - description = '' - This flag corresponds to the "wait" or "nowait" option of inetd. If true, then the listening - socket is passed via the standard in/out/error file descriptors. If false, then `accept(2)` is - called on behalf of the job, and the result is passed via the standard in/out/error descriptors. - ''; + type = types.nullOr ( + types.submodule { + options = { + Wait = mkOption { + type = types.nullOr (types.either types.bool types.str); + default = null; + description = '' + This flag corresponds to the "wait" or "nowait" option of inetd. If true, then the listening + socket is passed via the standard in/out/error file descriptors. If false, then `accept(2)` is + called on behalf of the job, and the result is passed via the standard in/out/error descriptors. + ''; + }; }; - }; - }); + } + ); }; LimitLoadToHosts = mkOption { @@ -120,7 +125,12 @@ in { }; LimitLoadToSessionType = mkOption { - type = types.nullOr (types.oneOf [ types.str (types.listOf types.str) ]); + type = types.nullOr ( + types.oneOf [ + types.str + (types.listOf types.str) + ] + ); default = null; description = '' This configuration file only applies to sessions of the type specified. This key is used in concert @@ -177,68 +187,72 @@ in { }; KeepAlive = mkOption { - type = types.nullOr (types.either types.bool (types.submodule { - options = { + type = types.nullOr ( + types.either types.bool ( + types.submodule { + options = { - SuccessfulExit = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - If true, the job will be restarted as long as the program exits and with an exit status of zero. - If false, the job will be restarted in the inverse condition. This key implies that "RunAtLoad" - is set to true, since the job needs to run at least once before we can get an exit status. - ''; - }; + SuccessfulExit = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + If true, the job will be restarted as long as the program exits and with an exit status of zero. + If false, the job will be restarted in the inverse condition. This key implies that "RunAtLoad" + is set to true, since the job needs to run at least once before we can get an exit status. + ''; + }; - NetworkState = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - If true, the job will be kept alive as long as the network is up, where up is defined as at least - one non-loopback interface being up and having IPv4 or IPv6 addresses assigned to them. If - false, the job will be kept alive in the inverse condition. - ''; - }; + NetworkState = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + If true, the job will be kept alive as long as the network is up, where up is defined as at least + one non-loopback interface being up and having IPv4 or IPv6 addresses assigned to them. If + false, the job will be kept alive in the inverse condition. + ''; + }; - PathState = mkOption { - type = types.nullOr (types.attrsOf types.bool); - default = null; - description = '' - Each key in this dictionary is a file-system path. If the value of the key is true, then the job - will be kept alive as long as the path exists. If false, the job will be kept alive in the - inverse condition. The intent of this feature is that two or more jobs may create semaphores in - the file-system namespace. - ''; - }; + PathState = mkOption { + type = types.nullOr (types.attrsOf types.bool); + default = null; + description = '' + Each key in this dictionary is a file-system path. If the value of the key is true, then the job + will be kept alive as long as the path exists. If false, the job will be kept alive in the + inverse condition. The intent of this feature is that two or more jobs may create semaphores in + the file-system namespace. + ''; + }; - OtherJobEnabled = mkOption { - type = types.nullOr (types.attrsOf types.bool); - default = null; - description = '' - Each key in this dictionary is the label of another job. If the value of the key is true, then - this job is kept alive as long as that other job is enabled. Otherwise, if the value is false, - then this job is kept alive as long as the other job is disabled. This feature should not be - considered a substitute for the use of IPC. - ''; - }; + OtherJobEnabled = mkOption { + type = types.nullOr (types.attrsOf types.bool); + default = null; + description = '' + Each key in this dictionary is the label of another job. If the value of the key is true, then + this job is kept alive as long as that other job is enabled. Otherwise, if the value is false, + then this job is kept alive as long as the other job is disabled. This feature should not be + considered a substitute for the use of IPC. + ''; + }; - Crashed = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - If true, the the job will be restarted as long as it exited due to a signal which is typically - associated with a crash (SIGILL, SIGSEGV, etc.). If false, the job will be restarted in the - inverse condition. - ''; - }; + Crashed = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + If true, the the job will be restarted as long as it exited due to a signal which is typically + associated with a crash (SIGILL, SIGSEGV, etc.). If false, the job will be restarted in the + inverse condition. + ''; + }; - AfterInitialDemand = mkOption { - type = types.nullOr types.bool; - default = null; - }; + AfterInitialDemand = mkOption { + type = types.nullOr types.bool; + default = null; + }; - }; - })); + }; + } + ) + ); default = null; description = '' This optional key is used to control whether your job is to be kept continuously running or to let @@ -371,10 +385,12 @@ in { StartCalendarInterval = mkOption { default = null; - example = [{ - Hour = 2; - Minute = 30; - }]; + example = [ + { + Hour = 2; + Minute = 30; + } + ]; description = '' This optional key causes the job to be started every calendar interval as specified. The semantics are much like {manpage}`crontab(5)`: Missing attributes are considered to be wildcard. Unlike cron which skips @@ -442,181 +458,187 @@ in { Resource limits to be imposed on the job. These adjust variables set with `setrlimit(2)`. The following keys apply: ''; - type = types.nullOr (types.submodule { - options = { - Core = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The largest size (in bytes) core file that may be created. - ''; - }; + type = types.nullOr ( + types.submodule { + options = { + Core = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The largest size (in bytes) core file that may be created. + ''; + }; - CPU = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum amount of cpu time (in seconds) to be used by each process. - ''; - }; + CPU = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum amount of cpu time (in seconds) to be used by each process. + ''; + }; - Data = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) of the data segment for a process; this defines how far a program may - extend its break with the `sbrk(2)` system call. - ''; - }; + Data = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) of the data segment for a process; this defines how far a program may + extend its break with the `sbrk(2)` system call. + ''; + }; - FileSize = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The largest size (in bytes) file that may be created. - ''; - }; + FileSize = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The largest size (in bytes) file that may be created. + ''; + }; - MemoryLock = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) which a process may lock into memory using the mlock(2) function. - ''; - }; + MemoryLock = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) which a process may lock into memory using the mlock(2) function. + ''; + }; - NumberOfFiles = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum number of open files for this process. Setting this value in a system wide daemon - will set the `sysctl(3)` kern.maxfiles (SoftResourceLimits) or kern.maxfilesperproc (HardResourceLimits) - value in addition to the `setrlimit(2)` values. - ''; - }; + NumberOfFiles = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum number of open files for this process. Setting this value in a system wide daemon + will set the `sysctl(3)` kern.maxfiles (SoftResourceLimits) or kern.maxfilesperproc (HardResourceLimits) + value in addition to the `setrlimit(2)` values. + ''; + }; - NumberOfProcesses = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum number of simultaneous processes for this user id. Setting this value in a system - wide daemon will set the `sysctl(3)` kern.maxproc (SoftResourceLimits) or kern.maxprocperuid - (HardResourceLimits) value in addition to the `setrlimit(2)` values. - ''; - }; + NumberOfProcesses = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum number of simultaneous processes for this user id. Setting this value in a system + wide daemon will set the `sysctl(3)` kern.maxproc (SoftResourceLimits) or kern.maxprocperuid + (HardResourceLimits) value in addition to the `setrlimit(2)` values. + ''; + }; - ResidentSetSize = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) to which a process's resident set size may grow. This imposes a - limit on the amount of physical memory to be given to a process; if memory is tight, the system - will prefer to take memory from processes that are exceeding their declared resident set size. - ''; - }; + ResidentSetSize = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) to which a process's resident set size may grow. This imposes a + limit on the amount of physical memory to be given to a process; if memory is tight, the system + will prefer to take memory from processes that are exceeding their declared resident set size. + ''; + }; - Stack = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) of the stack segment for a process; this defines how far a program's - stack segment may be extended. Stack extension is performed automatically by the system. - ''; + Stack = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) of the stack segment for a process; this defines how far a program's + stack segment may be extended. Stack extension is performed automatically by the system. + ''; + }; }; - }; - }); + } + ); }; HardResourceLimits = mkOption { default = null; - example = { NumberOfFiles = 4096; }; + example = { + NumberOfFiles = 4096; + }; description = '' Resource limits to be imposed on the job. These adjust variables set with `setrlimit(2)`. The following keys apply: ''; - type = types.nullOr (types.submodule { - options = { - Core = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The largest size (in bytes) core file that may be created. - ''; - }; + type = types.nullOr ( + types.submodule { + options = { + Core = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The largest size (in bytes) core file that may be created. + ''; + }; - CPU = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum amount of cpu time (in seconds) to be used by each process. - ''; - }; + CPU = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum amount of cpu time (in seconds) to be used by each process. + ''; + }; - Data = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) of the data segment for a process; this defines how far a program may - extend its break with the `sbrk(2)` system call. - ''; - }; + Data = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) of the data segment for a process; this defines how far a program may + extend its break with the `sbrk(2)` system call. + ''; + }; - FileSize = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The largest size (in bytes) file that may be created. - ''; - }; + FileSize = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The largest size (in bytes) file that may be created. + ''; + }; - MemoryLock = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) which a process may lock into memory using the `mlock(2)` function. - ''; - }; + MemoryLock = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) which a process may lock into memory using the `mlock(2)` function. + ''; + }; - NumberOfFiles = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum number of open files for this process. Setting this value in a system wide daemon - will set the `sysctl(3)` kern.maxfiles (SoftResourceLimits) or kern.maxfilesperproc (HardResourceLimits) - value in addition to the `setrlimit(2)` values. - ''; - }; + NumberOfFiles = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum number of open files for this process. Setting this value in a system wide daemon + will set the `sysctl(3)` kern.maxfiles (SoftResourceLimits) or kern.maxfilesperproc (HardResourceLimits) + value in addition to the `setrlimit(2)` values. + ''; + }; - NumberOfProcesses = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum number of simultaneous processes for this user id. Setting this value in a system - wide daemon will set the `sysctl(3)` kern.maxproc (SoftResourceLimits) or kern.maxprocperuid - (HardResourceLimits) value in addition to the `setrlimit(2)` values. - ''; - }; + NumberOfProcesses = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum number of simultaneous processes for this user id. Setting this value in a system + wide daemon will set the `sysctl(3)` kern.maxproc (SoftResourceLimits) or kern.maxprocperuid + (HardResourceLimits) value in addition to the `setrlimit(2)` values. + ''; + }; - ResidentSetSize = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) to which a process's resident set size may grow. This imposes a - limit on the amount of physical memory to be given to a process; if memory is tight, the system - will prefer to take memory from processes that are exceeding their declared resident set size. - ''; - }; + ResidentSetSize = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) to which a process's resident set size may grow. This imposes a + limit on the amount of physical memory to be given to a process; if memory is tight, the system + will prefer to take memory from processes that are exceeding their declared resident set size. + ''; + }; - Stack = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - The maximum size (in bytes) of the stack segment for a process; this defines how far a program's - stack segment may be extended. Stack extension is performed automatically by the system. - ''; + Stack = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The maximum size (in bytes) of the stack segment for a process; this defines how far a program's + stack segment may be extended. Stack extension is performed automatically by the system. + ''; + }; }; - }; - }); + } + ); }; Nice = mkOption { @@ -628,8 +650,14 @@ in { }; ProcessType = mkOption { - type = types.nullOr - (types.enum [ "Background" "Standard" "Adaptive" "Interactive" ]); + type = types.nullOr ( + types.enum [ + "Background" + "Standard" + "Adaptive" + "Interactive" + ] + ); default = null; example = "Background"; description = '' @@ -694,7 +722,11 @@ in { MachServices = mkOption { default = null; - example = { "org.nixos.service" = { ResetAtClose = true; }; }; + example = { + "org.nixos.service" = { + ResetAtClose = true; + }; + }; description = '' This optional key is used to specify Mach services to be registered with the Mach bootstrap sub-system. Each key in this dictionary should be the name of service to be advertised. The value of the key must @@ -703,32 +735,37 @@ in { Finally, for the job itself, the values will be replaced with Mach ports at the time of check-in with launchd. ''; - type = types.nullOr (types.attrsOf (types.either types.bool - (types.submodule { - options = { - ResetAtClose = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - If this boolean is false, the port is recycled, thus leaving clients to remain oblivious to the - demand nature of job. If the value is set to true, clients receive port death notifications when - the job lets go of the receive right. The port will be recreated atomically with respect to bootstrap_look_up() - calls, so that clients can trust that after receiving a port death notification, - the new port will have already been recreated. Setting the value to true should be done with - care. Not all clients may be able to handle this behavior. The default value is false. - ''; - }; + type = types.nullOr ( + types.attrsOf ( + types.either types.bool ( + types.submodule { + options = { + ResetAtClose = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + If this boolean is false, the port is recycled, thus leaving clients to remain oblivious to the + demand nature of job. If the value is set to true, clients receive port death notifications when + the job lets go of the receive right. The port will be recreated atomically with respect to bootstrap_look_up() + calls, so that clients can trust that after receiving a port death notification, + the new port will have already been recreated. Setting the value to true should be done with + care. Not all clients may be able to handle this behavior. The default value is false. + ''; + }; - HideUntilCheckIn = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - Reserve the name in the namespace, but cause bootstrap_look_up() to fail until the job has - checked in with launchd. - ''; - }; - }; - }))); + HideUntilCheckIn = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + Reserve the name in the namespace, but cause bootstrap_look_up() to fail until the job has + checked in with launchd. + ''; + }; + }; + } + ) + ) + ); }; LaunchEvents = mkOption { @@ -790,109 +827,123 @@ in { The parameters below are used as inputs to call `getaddrinfo(3)`. ''; - type = types.nullOr (types.attrsOf (types.submodule { - options = { - SockType = mkOption { - type = types.nullOr (types.enum [ "stream" "dgram" "seqpacket" ]); - default = null; - description = '' - This optional key tells launchctl what type of socket to create. The default is "stream" and - other valid values for this key are "dgram" and "seqpacket" respectively. - ''; - }; + type = types.nullOr ( + types.attrsOf ( + types.submodule { + options = { + SockType = mkOption { + type = types.nullOr ( + types.enum [ + "stream" + "dgram" + "seqpacket" + ] + ); + default = null; + description = '' + This optional key tells launchctl what type of socket to create. The default is "stream" and + other valid values for this key are "dgram" and "seqpacket" respectively. + ''; + }; - SockPassive = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - This optional key specifies whether `listen(2)` or `connect(2)` should be called on the created file - descriptor. The default is true ("to listen"). - ''; - }; + SockPassive = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key specifies whether `listen(2)` or `connect(2)` should be called on the created file + descriptor. The default is true ("to listen"). + ''; + }; - SockNodeName = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - This optional key specifies the node to `connect(2)` or `bind(2)` to. - ''; - }; + SockNodeName = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key specifies the node to `connect(2)` or `bind(2)` to. + ''; + }; - SockServiceName = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - This optional key specifies the service on the node to `connect(2)` or `bind(2)` to. - ''; - }; + SockServiceName = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key specifies the service on the node to `connect(2)` or `bind(2)` to. + ''; + }; - SockFamily = mkOption { - type = types.nullOr (types.enum [ "IPv4" "IPv6" ]); - default = null; - description = '' - This optional key can be used to specifically request that "IPv4" or "IPv6" socket(s) be created. - ''; - }; + SockFamily = mkOption { + type = types.nullOr ( + types.enum [ + "IPv4" + "IPv6" + ] + ); + default = null; + description = '' + This optional key can be used to specifically request that "IPv4" or "IPv6" socket(s) be created. + ''; + }; - SockProtocol = mkOption { - type = types.nullOr (types.enum [ "TCP" ]); - default = null; - description = '' - This optional key specifies the protocol to be passed to `socket(2)`. The only value understood by - this key at the moment is "TCP". - ''; - }; + SockProtocol = mkOption { + type = types.nullOr (types.enum [ "TCP" ]); + default = null; + description = '' + This optional key specifies the protocol to be passed to `socket(2)`. The only value understood by + this key at the moment is "TCP". + ''; + }; - SockPathName = mkOption { - type = types.nullOr types.path; - default = null; - description = '' - This optional key implies SockFamily is set to "Unix". It specifies the path to `connect(2)` or - `bind(2)` to. - ''; - }; + SockPathName = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + This optional key implies SockFamily is set to "Unix". It specifies the path to `connect(2)` or + `bind(2)` to. + ''; + }; - SecureSocketWithKey = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - This optional key is a variant of SockPathName. Instead of binding to a known path, a securely - generated socket is created and the path is assigned to the environment variable that is inherited - by all jobs spawned by launchd. - ''; - }; + SecureSocketWithKey = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key is a variant of SockPathName. Instead of binding to a known path, a securely + generated socket is created and the path is assigned to the environment variable that is inherited + by all jobs spawned by launchd. + ''; + }; - SockPathMode = mkOption { - type = types.nullOr types.int; - default = null; - description = '' - This optional key specifies the mode of the socket. Known bug: Property lists don't support - octal, so please convert the value to decimal. - ''; - }; + SockPathMode = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + This optional key specifies the mode of the socket. Known bug: Property lists don't support + octal, so please convert the value to decimal. + ''; + }; - Bonjour = mkOption { - type = - types.nullOr (types.either types.bool (types.listOf types.str)); - default = null; - description = '' - This optional key can be used to request that the service be registered with the - `mDNSResponder(8)`. If the value is boolean, the service name is inferred from the SockServiceName. - ''; - }; + Bonjour = mkOption { + type = types.nullOr (types.either types.bool (types.listOf types.str)); + default = null; + description = '' + This optional key can be used to request that the service be registered with the + `mDNSResponder(8)`. If the value is boolean, the service name is inferred from the SockServiceName. + ''; + }; - MulticastGroup = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - This optional key can be used to request that the datagram socket join a multicast group. If the - value is a hostname, then `getaddrinfo(3)` will be used to join the correct multicast address for a - given socket family. If an explicit IPv4 or IPv6 address is given, it is required that the SockFamily - family also be set, otherwise the results are undefined. - ''; - }; - }; - })); + MulticastGroup = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key can be used to request that the datagram socket join a multicast group. If the + value is a hostname, then `getaddrinfo(3)` will be used to join the correct multicast address for a + given socket family. If an explicit IPv4 or IPv6 address is given, it is required that the SockFamily + family also be set, otherwise the results are undefined. + ''; + }; + }; + } + ) + ); }; }; diff --git a/modules/launchd/types.nix b/modules/launchd/types.nix index fadf46cb5..cefce1980 100644 --- a/modules/launchd/types.nix +++ b/modules/launchd/types.nix @@ -5,117 +5,146 @@ { lib, ... }: let - inherit (lib) imap1 types mkOption showOption mergeDefinitions; - inherit (builtins) map filter length deepSeq throw toString concatLists; + inherit (lib) + imap1 + types + mkOption + showOption + mergeDefinitions + ; + inherit (builtins) + map + filter + length + deepSeq + throw + toString + concatLists + ; inherit (lib.options) showDefs; wildcardText = lib.literalMD "`*`"; - /* * - A type of list which does not allow duplicate elements. The base/inner - list type to use (e.g. `types.listOf` or `types.nonEmptyListOf`) is passed - via argument `listType`, which must be the final type and not a function. + /* + * + A type of list which does not allow duplicate elements. The base/inner + list type to use (e.g. `types.listOf` or `types.nonEmptyListOf`) is passed + via argument `listType`, which must be the final type and not a function. - NOTE: The extra check for duplicates is quadratic and strict, so use this - type sparingly and only: + NOTE: The extra check for duplicates is quadratic and strict, so use this + type sparingly and only: - * when needed, and - * when the list is expected to be recursively short (e.g. < 10 elements) - and shallow (i.e. strict evaluation of the list won't take too long) + * when needed, and + * when the list is expected to be recursively short (e.g. < 10 elements) + and shallow (i.e. strict evaluation of the list won't take too long) - The implementation of this function is similar to that of - `types.nonEmptyListOf`. + The implementation of this function is similar to that of + `types.nonEmptyListOf`. */ - types'.uniqueList = listType: - listType // { - description = "unique ${ - types.optionDescriptionPhrase (class: class == "noun") listType - }"; + types'.uniqueList = + listType: + listType + // { + description = "unique ${types.optionDescriptionPhrase (class: class == "noun") listType}"; substSubModules = m: types'.uniqueList (listType.substSubModules m); # This has been taken from the implementation of `types.listOf`, but has # been modified to throw on duplicates. This check cannot be done in the # `check` fn as this check is deep/strict, and because `check` runs # prior to merging. - merge = loc: defs: + merge = + loc: defs: let # Each element of `dupes` is a list. When there are duplicates, # later lists will be duplicates of earlier lists, so just throw on # the first set of duplicates found so that we don't have duplicate # error msgs. - checked = filter (li: + checked = filter ( + li: if length li > 1 then throw '' - The option `${ - showOption loc - }' contains duplicate entries after merging: + The option `${showOption loc}' contains duplicate entries after merging: ${showDefs li}'' else - false) dupes; - dupes = - map (def: filter (def': def'.value == def.value) merged) merged; - merged = filter (x: x ? value) (concatLists (imap1 (n: def: - imap1 (m: el: - let - inherit (def) file; - loc' = loc - ++ [ "[definition ${toString n}-entry ${toString m}]" ]; - in (mergeDefinitions loc' listType.nestedTypes.elemType [{ - inherit file; - value = el; - }]).optionalValue // { - inherit loc' file; - }) def.value) defs)); - in deepSeq checked (map (x: x.value) merged); + false + ) dupes; + dupes = map (def: filter (def': def'.value == def.value) merged) merged; + merged = filter (x: x ? value) ( + concatLists ( + imap1 ( + n: def: + imap1 ( + m: el: + let + inherit (def) file; + loc' = loc ++ [ "[definition ${toString n}-entry ${toString m}]" ]; + in + (mergeDefinitions loc' listType.nestedTypes.elemType [ + { + inherit file; + value = el; + } + ]).optionalValue + // { + inherit loc' file; + } + ) def.value + ) defs + ) + ); + in + deepSeq checked (map (x: x.value) merged); }; -in { - StartCalendarInterval = let - CalendarIntervalEntry = types.submodule { - options = { - Minute = mkOption { - type = types.nullOr (types.ints.between 0 59); - default = null; - defaultText = wildcardText; - description = '' - The minute on which this job will be run. - ''; - }; +in +{ + StartCalendarInterval = + let + CalendarIntervalEntry = types.submodule { + options = { + Minute = mkOption { + type = types.nullOr (types.ints.between 0 59); + default = null; + defaultText = wildcardText; + description = '' + The minute on which this job will be run. + ''; + }; - Hour = mkOption { - type = types.nullOr (types.ints.between 0 23); - default = null; - defaultText = wildcardText; - description = '' - The hour on which this job will be run. - ''; - }; + Hour = mkOption { + type = types.nullOr (types.ints.between 0 23); + default = null; + defaultText = wildcardText; + description = '' + The hour on which this job will be run. + ''; + }; - Day = mkOption { - type = types.nullOr (types.ints.between 1 31); - default = null; - defaultText = wildcardText; - description = '' - The day on which this job will be run. - ''; - }; + Day = mkOption { + type = types.nullOr (types.ints.between 1 31); + default = null; + defaultText = wildcardText; + description = '' + The day on which this job will be run. + ''; + }; - Weekday = mkOption { - type = types.nullOr (types.ints.between 0 7); - default = null; - defaultText = wildcardText; - description = '' - The weekday on which this job will be run (0 and 7 are Sunday). - ''; - }; + Weekday = mkOption { + type = types.nullOr (types.ints.between 0 7); + default = null; + defaultText = wildcardText; + description = '' + The weekday on which this job will be run (0 and 7 are Sunday). + ''; + }; - Month = mkOption { - type = types.nullOr (types.ints.between 1 12); - default = null; - defaultText = wildcardText; - description = '' - The month on which this job will be run. - ''; + Month = mkOption { + type = types.nullOr (types.ints.between 1 12); + default = null; + defaultText = wildcardText; + description = '' + The month on which this job will be run. + ''; + }; }; }; - }; - in types.either CalendarIntervalEntry - (types'.uniqueList (types.nonEmptyListOf CalendarIntervalEntry)); + in + types.either CalendarIntervalEntry (types'.uniqueList (types.nonEmptyListOf CalendarIntervalEntry)); } diff --git a/modules/lib/assertions.nix b/modules/lib/assertions.nix index 1089c27b8..dc996309f 100644 --- a/modules/lib/assertions.nix +++ b/modules/lib/assertions.nix @@ -3,12 +3,13 @@ { assertPlatform = module: pkgs: platforms: { assertion = lib.elem pkgs.stdenv.hostPlatform.system platforms; - message = let - platformsStr = lib.concatStringsSep "\n" - (map (p: " - ${p}") (lib.sort (a: b: a < b) platforms)); - in '' - The module ${module} does not support your platform. It only supports + message = + let + platformsStr = lib.concatStringsSep "\n" (map (p: " - ${p}") (lib.sort (a: b: a < b) platforms)); + in + '' + The module ${module} does not support your platform. It only supports - ${platformsStr}''; + ${platformsStr}''; }; } diff --git a/modules/lib/booleans.nix b/modules/lib/booleans.nix index f6c2af586..fd3aa3a3e 100644 --- a/modules/lib/booleans.nix +++ b/modules/lib/booleans.nix @@ -1,4 +1,5 @@ -{ lib }: { +{ lib }: +{ # Converts a boolean to a yes/no string. This is used in lots of # configuration formats. yesNo = value: if value then "yes" else "no"; diff --git a/modules/lib/dag.nix b/modules/lib/dag.nix index b9e75e8c8..448df3308 100644 --- a/modules/lib/dag.nix +++ b/modules/lib/dag.nix @@ -9,13 +9,23 @@ { lib }: -let inherit (lib) all filterAttrs head hm mapAttrs length tail toposort; -in { +let + inherit (lib) + all + filterAttrs + head + hm + mapAttrs + length + tail + toposort + ; +in +{ empty = { }; isEntry = e: e ? data && e ? after && e ? before; - isDag = dag: - builtins.isAttrs dag && all hm.dag.isEntry (builtins.attrValues dag); + isDag = dag: builtins.isAttrs dag && all hm.dag.isEntry (builtins.attrValues dag); # Takes an attribute set containing entries built by entryAnywhere, # entryAfter, and entryBefore to a topologically sorted list of @@ -73,11 +83,10 @@ in { # ]; # } # true - topoSort = dag: + topoSort = + dag: let - dagBefore = dag: name: - builtins.attrNames - (filterAttrs (n: v: builtins.elem name v.before) dag); + dagBefore = dag: name: builtins.attrNames (filterAttrs (n: v: builtins.elem name v.before) dag); normalizedDag = mapAttrs (n: v: { name = n; data = v.data; @@ -85,9 +94,12 @@ in { }) dag; before = a: b: builtins.elem a.name b.after; sorted = toposort before (builtins.attrValues normalizedDag); - in if sorted ? result then { - result = map (v: { inherit (v) name data; }) sorted.result; - } else + in + if sorted ? result then + { + result = map (v: { inherit (v) name data; }) sorted.result; + } + else sorted; # Applies a function to each element of the given DAG. @@ -107,21 +119,28 @@ in { # # The entries as a whole can be given a relation to other DAG nodes. All # generated nodes are then placed before or after those dependencies. - entriesBetween = tag: + entriesBetween = + tag: let - go = i: before: after: entries: + go = + i: before: after: entries: let name = "${tag}-${toString i}"; i' = i + 1; - in if entries == [ ] then + in + if entries == [ ] then hm.dag.empty - else if length entries == 1 then { - "${name}" = hm.dag.entryBetween before after (head entries); - } else + else if length entries == 1 then + { + "${name}" = hm.dag.entryBetween before after (head entries); + } + else { "${name}" = hm.dag.entryAfter after (head entries); - } // go (i + 1) before [ name ] (tail entries); - in go 0; + } + // go (i + 1) before [ name ] (tail entries); + in + go 0; entriesAnywhere = tag: hm.dag.entriesBetween tag [ ] [ ]; entriesAfter = tag: hm.dag.entriesBetween tag [ ]; diff --git a/modules/lib/file-type.nix b/modules/lib/file-type.nix index 48ff00f1b..f877c31b2 100644 --- a/modules/lib/file-type.nix +++ b/modules/lib/file-type.nix @@ -1,9 +1,22 @@ -{ homeDirectory, lib, pkgs }: +{ + homeDirectory, + lib, + pkgs, +}: let inherit (lib) - hasPrefix hm literalExpression mkDefault mkIf mkOption removePrefix types; -in { + hasPrefix + hm + literalExpression + mkDefault + mkIf + mkOption + removePrefix + types + ; +in +{ # Constructs a type suitable for a `home.file` like option. The # target path may be either absolute or relative, in which case it # is relative the `basePath` argument (which itself must be an @@ -13,108 +26,121 @@ in { # - opt the name of the option, for self-references # - basePathDesc docbook compatible description of the base path # - basePath the file base path - fileType = opt: basePathDesc: basePath: - types.attrsOf (types.submodule ({ name, config, ... }: { - options = { - enable = mkOption { - type = types.bool; - default = true; - description = '' - Whether this file should be generated. This option allows specific - files to be disabled. - ''; - }; - target = mkOption { - type = types.str; - apply = p: - let absPath = if hasPrefix "/" p then p else "${basePath}/${p}"; - in removePrefix (homeDirectory + "/") absPath; - defaultText = literalExpression "name"; - description = '' - Path to target file relative to ${basePathDesc}. - ''; - }; + fileType = + opt: basePathDesc: basePath: + types.attrsOf ( + types.submodule ( + { name, config, ... }: + { + options = { + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether this file should be generated. This option allows specific + files to be disabled. + ''; + }; + target = mkOption { + type = types.str; + apply = + p: + let + absPath = if hasPrefix "/" p then p else "${basePath}/${p}"; + in + removePrefix (homeDirectory + "/") absPath; + defaultText = literalExpression "name"; + description = '' + Path to target file relative to ${basePathDesc}. + ''; + }; - text = mkOption { - default = null; - type = types.nullOr types.lines; - description = '' - Text of the file. If this option is null then - [](#opt-${opt}._name_.source) - must be set. - ''; - }; + text = mkOption { + default = null; + type = types.nullOr types.lines; + description = '' + Text of the file. If this option is null then + [](#opt-${opt}._name_.source) + must be set. + ''; + }; - source = mkOption { - type = types.path; - description = '' - Path of the source file or directory. If - [](#opt-${opt}._name_.text) - is non-null then this option will automatically point to a file - containing that text. - ''; - }; + source = mkOption { + type = types.path; + description = '' + Path of the source file or directory. If + [](#opt-${opt}._name_.text) + is non-null then this option will automatically point to a file + containing that text. + ''; + }; - executable = mkOption { - type = types.nullOr types.bool; - default = null; - description = '' - Set the execute bit. If `null`, defaults to the mode - of the {var}`source` file or to `false` - for files created through the {var}`text` option. - ''; - }; + executable = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + Set the execute bit. If `null`, defaults to the mode + of the {var}`source` file or to `false` + for files created through the {var}`text` option. + ''; + }; - recursive = mkOption { - type = types.bool; - default = false; - description = '' - If the file source is a directory, then this option - determines whether the directory should be recursively - linked to the target location. This option has no effect - if the source is a file. + recursive = mkOption { + type = types.bool; + default = false; + description = '' + If the file source is a directory, then this option + determines whether the directory should be recursively + linked to the target location. This option has no effect + if the source is a file. - If `false` (the default) then the target - will be a symbolic link to the source directory. If - `true` then the target will be a - directory structure matching the source's but whose leafs - are symbolic links to the files of the source directory. - ''; - }; + If `false` (the default) then the target + will be a symbolic link to the source directory. If + `true` then the target will be a + directory structure matching the source's but whose leafs + are symbolic links to the files of the source directory. + ''; + }; - onChange = mkOption { - type = types.lines; - default = ""; - description = '' - Shell commands to run when file has changed between - generations. The script will be run - *after* the new files have been linked - into place. + onChange = mkOption { + type = types.lines; + default = ""; + description = '' + Shell commands to run when file has changed between + generations. The script will be run + *after* the new files have been linked + into place. - Note, this code is always run when `recursive` is - enabled. - ''; - }; + Note, this code is always run when `recursive` is + enabled. + ''; + }; - force = mkOption { - type = types.bool; - default = false; - description = '' - Whether the target path should be unconditionally replaced - by the managed file source. Warning, this will silently - delete the target regardless of whether it is a file or - link. - ''; - }; - }; + force = mkOption { + type = types.bool; + default = false; + description = '' + Whether the target path should be unconditionally replaced + by the managed file source. Warning, this will silently + delete the target regardless of whether it is a file or + link. + ''; + }; + }; - config = { - target = mkDefault name; - source = mkIf (config.text != null) (mkDefault (pkgs.writeTextFile { - inherit (config) text; - executable = config.executable == true; # can be null - name = hm.strings.storeFileName name; - })); - }; - })); + config = { + target = mkDefault name; + source = mkIf (config.text != null) ( + mkDefault ( + pkgs.writeTextFile { + inherit (config) text; + executable = config.executable == true; # can be null + name = hm.strings.storeFileName name; + } + ) + ); + }; + } + ) + ); } diff --git a/modules/lib/generators.nix b/modules/lib/generators.nix index 2aebd92c9..5fe3d8afb 100644 --- a/modules/lib/generators.nix +++ b/modules/lib/generators.nix @@ -1,114 +1,158 @@ { lib }: { - toHyprconf = { attrs, indentLevel ? 0, importantPrefixes ? [ "$" ], }: + toHyprconf = + { + attrs, + indentLevel ? 0, + importantPrefixes ? [ "$" ], + }: let inherit (lib) - all concatMapStringsSep concatStrings concatStringsSep filterAttrs foldl - generators hasPrefix isAttrs isList mapAttrsToList replicate; + all + concatMapStringsSep + concatStrings + concatStringsSep + filterAttrs + foldl + generators + hasPrefix + isAttrs + isList + mapAttrsToList + replicate + ; initialIndent = concatStrings (replicate indentLevel " "); - toHyprconf' = indent: attrs: + toHyprconf' = + indent: attrs: let - sections = - filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs; + sections = filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs; - mkSection = n: attrs: + mkSection = + n: attrs: if lib.isList attrs then (concatMapStringsSep "\n" (a: mkSection n a) attrs) - else '' - ${indent}${n} { - ${toHyprconf' " ${indent}" attrs}${indent}} - ''; + else + '' + ${indent}${n} { + ${toHyprconf' " ${indent}" attrs}${indent}} + ''; mkFields = generators.toKeyValue { listsAsDuplicateKeys = true; inherit indent; }; - allFields = - filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v))) - attrs; + allFields = filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v))) attrs; - isImportantField = n: _: - foldl (acc: prev: if hasPrefix prev n then true else acc) false - importantPrefixes; + isImportantField = + n: _: foldl (acc: prev: if hasPrefix prev n then true else acc) false importantPrefixes; importantFields = filterAttrs isImportantField allFields; - fields = builtins.removeAttrs allFields - (mapAttrsToList (n: _: n) importantFields); - in mkFields importantFields + fields = builtins.removeAttrs allFields (mapAttrsToList (n: _: n) importantFields); + in + mkFields importantFields + concatStringsSep "\n" (mapAttrsToList mkSection sections) + mkFields fields; - in toHyprconf' initialIndent attrs; + in + toHyprconf' initialIndent attrs; - toKDL = { }: + toKDL = + { }: let - inherit (lib) concatStringsSep splitString mapAttrsToList any; + inherit (lib) + concatStringsSep + splitString + mapAttrsToList + any + ; inherit (builtins) typeOf replaceStrings elem; # ListOf String -> String - indentStrings = let - # Although the input of this function is a list of strings, - # the strings themselves *will* contain newlines, so you need - # to normalize the list by joining and resplitting them. - unlines = lib.splitString "\n"; - lines = lib.concatStringsSep "\n"; - indentAll = lines: concatStringsSep "\n" (map (x: " " + x) lines); - in stringsWithNewlines: indentAll (unlines (lines stringsWithNewlines)); + indentStrings = + let + # Although the input of this function is a list of strings, + # the strings themselves *will* contain newlines, so you need + # to normalize the list by joining and resplitting them. + unlines = lib.splitString "\n"; + lines = lib.concatStringsSep "\n"; + indentAll = lines: concatStringsSep "\n" (map (x: " " + x) lines); + in + stringsWithNewlines: indentAll (unlines (lines stringsWithNewlines)); # String -> String sanitizeString = replaceStrings [ "\n" ''"'' ] [ "\\n" ''\"'' ]; # OneOf [Int Float String Bool Null] -> String - literalValueToString = element: + literalValueToString = + element: lib.throwIfNot - (elem (typeOf element) [ "int" "float" "string" "bool" "null" ]) - "Cannot convert value of type ${typeOf element} to KDL literal." - (if typeOf element == "null" then - "null" - else if element == false then - "false" - else if element == true then - "true" - else if typeOf element == "string" then - ''"${sanitizeString element}"'' - else - toString element); + (elem (typeOf element) [ + "int" + "float" + "string" + "bool" + "null" + ]) + "Cannot convert value of type ${typeOf element} to KDL literal." + ( + if typeOf element == "null" then + "null" + else if element == false then + "false" + else if element == true then + "true" + else if typeOf element == "string" then + ''"${sanitizeString element}"'' + else + toString element + ); # Attrset Conversion # String -> AttrsOf Anything -> String - convertAttrsToKDL = name: attrs: + convertAttrsToKDL = + name: attrs: let - optArgsString = lib.optionalString (attrs ? "_args") - (lib.pipe attrs._args [ + optArgsString = lib.optionalString (attrs ? "_args") ( + lib.pipe attrs._args [ (map literalValueToString) (lib.concatStringsSep " ") (s: s + " ") - ]); + ] + ); - optPropsString = lib.optionalString (attrs ? "_props") - (lib.pipe attrs._props [ - (lib.mapAttrsToList - (name: value: "${name}=${literalValueToString value}")) + optPropsString = lib.optionalString (attrs ? "_props") ( + lib.pipe attrs._props [ + (lib.mapAttrsToList (name: value: "${name}=${literalValueToString value}")) (lib.concatStringsSep " ") (s: s + " ") - ]); + ] + ); - children = - lib.filterAttrs (name: _: !(elem name [ "_args" "_props" ])) attrs; - in '' + children = lib.filterAttrs ( + name: _: + !(elem name [ + "_args" + "_props" + ]) + ) attrs; + in + '' ${name} ${optArgsString}${optPropsString}{ ${indentStrings (mapAttrsToList convertAttributeToKDL children)} }''; # List Conversion # String -> ListOf (OneOf [Int Float String Bool Null]) -> String - convertListOfFlatAttrsToKDL = name: list: - let flatElements = map literalValueToString list; - in "${name} ${concatStringsSep " " flatElements}"; + convertListOfFlatAttrsToKDL = + name: list: + let + flatElements = map literalValueToString list; + in + "${name} ${concatStringsSep " " flatElements}"; # String -> ListOf Anything -> String convertListOfNonFlatAttrsToKDL = name: list: '' @@ -117,18 +161,39 @@ }''; # String -> ListOf Anything -> String - convertListToKDL = name: list: - let elementsAreFlat = !any (el: elem (typeOf el) [ "list" "set" ]) list; - in if elementsAreFlat then + convertListToKDL = + name: list: + let + elementsAreFlat = + !any ( + el: + elem (typeOf el) [ + "list" + "set" + ] + ) list; + in + if elementsAreFlat then convertListOfFlatAttrsToKDL name list else convertListOfNonFlatAttrsToKDL name list; # Combined Conversion # String -> Anything -> String - convertAttributeToKDL = name: value: - let vType = typeOf value; - in if elem vType [ "int" "float" "bool" "null" "string" ] then + convertAttributeToKDL = + name: value: + let + vType = typeOf value; + in + if + elem vType [ + "int" + "float" + "bool" + "null" + "string" + ] + then "${name} ${literalValueToString value}" else if vType == "set" then convertAttrsToKDL name value @@ -139,99 +204,153 @@ Cannot convert type `(${typeOf value})` to KDL: ${name} = ${toString value} ''; - in attrs: '' + in + attrs: '' ${concatStringsSep "\n" (mapAttrsToList convertAttributeToKDL attrs)} ''; - toSCFG = { }: + toSCFG = + { }: let inherit (lib) concatStringsSep mapAttrsToList any; inherit (builtins) typeOf replaceStrings elem; # ListOf String -> String - indentStrings = let - # Although the input of this function is a list of strings, - # the strings themselves *will* contain newlines, so you need - # to normalize the list by joining and resplitting them. - unlines = lib.splitString "\n"; - lines = lib.concatStringsSep "\n"; - indentAll = lines: concatStringsSep "\n" (map (x: " " + x) lines); - in stringsWithNewlines: indentAll (unlines (lines stringsWithNewlines)); + indentStrings = + let + # Although the input of this function is a list of strings, + # the strings themselves *will* contain newlines, so you need + # to normalize the list by joining and resplitting them. + unlines = lib.splitString "\n"; + lines = lib.concatStringsSep "\n"; + indentAll = lines: concatStringsSep "\n" (map (x: " " + x) lines); + in + stringsWithNewlines: indentAll (unlines (lines stringsWithNewlines)); # String -> Bool - specialChars = s: - any (char: elem char (reserved ++ [ " " "'" "{" "}" ])) - (lib.stringToCharacters s); + specialChars = + s: + any ( + char: + elem char ( + reserved + ++ [ + " " + "'" + "{" + "}" + ] + ) + ) (lib.stringToCharacters s); # String -> String - sanitizeString = - replaceStrings reserved [ ''\"'' "\\\\" "\\r" "\\n" "\\t" ]; + sanitizeString = replaceStrings reserved [ + ''\"'' + "\\\\" + "\\r" + "\\n" + "\\t" + ]; - reserved = [ ''"'' "\\" "\r" "\n" " " ]; + reserved = [ + ''"'' + "\\" + "\r" + "\n" + " " + ]; # OneOf [Int Float String Bool] -> String - literalValueToString = element: - lib.throwIfNot (elem (typeOf element) [ "int" "float" "string" "bool" ]) - "Cannot convert value of type ${typeOf element} to SCFG literal." - (if element == false then - "false" - else if element == true then - "true" - else if typeOf element == "string" then - if element == "" || specialChars element then - ''"${sanitizeString element}"'' - else - element - else - toString element); + literalValueToString = + element: + lib.throwIfNot + (elem (typeOf element) [ + "int" + "float" + "string" + "bool" + ]) + "Cannot convert value of type ${typeOf element} to SCFG literal." + ( + if element == false then + "false" + else if element == true then + "true" + else if typeOf element == "string" then + if element == "" || specialChars element then ''"${sanitizeString element}"'' else element + else + toString element + ); # Bool -> ListOf (OneOf [Int Float String Bool]) -> String - toOptParamsString = cond: list: - lib.optionalString (cond) (lib.pipe list [ - (map literalValueToString) - (concatStringsSep " ") - (s: " " + s) - ]); + toOptParamsString = + cond: list: + lib.optionalString (cond) ( + lib.pipe list [ + (map literalValueToString) + (concatStringsSep " ") + (s: " " + s) + ] + ); # Attrset Conversion # String -> AttrsOf Anything -> String - convertAttrsToSCFG = name: attrs: + convertAttrsToSCFG = + name: attrs: let optParamsString = toOptParamsString (attrs ? "_params") attrs._params; - in '' + in + '' ${name}${optParamsString} { ${indentStrings (convertToAttrsSCFG' attrs)} }''; # Attrset Conversion # AttrsOf Anything -> ListOf String - convertToAttrsSCFG' = attrs: - mapAttrsToList convertAttributeToSCFG - (lib.filterAttrs (name: val: !isNull val && name != "_params") attrs); + convertToAttrsSCFG' = + attrs: + mapAttrsToList convertAttributeToSCFG ( + lib.filterAttrs (name: val: !isNull val && name != "_params") attrs + ); # List Conversion # String -> ListOf (OneOf [Int Float String Bool]) -> String - convertListOfFlatAttrsToSCFG = name: list: - let optParamsString = toOptParamsString (list != [ ]) list; - in "${name}${optParamsString}"; + convertListOfFlatAttrsToSCFG = + name: list: + let + optParamsString = toOptParamsString (list != [ ]) list; + in + "${name}${optParamsString}"; # Combined Conversion # String -> Anything -> String - convertAttributeToSCFG = name: value: - lib.throwIf (name == "") "Directive must not be empty" - (let vType = typeOf value; - in if elem vType [ "int" "float" "bool" "string" ] then - "${name} ${literalValueToString value}" - else if vType == "set" then - convertAttrsToSCFG name value - else if vType == "list" then - convertListOfFlatAttrsToSCFG name value - else - throw '' - Cannot convert type `(${typeOf value})` to SCFG: - ${name} = ${toString value} - ''); - in attrs: + convertAttributeToSCFG = + name: value: + lib.throwIf (name == "") "Directive must not be empty" ( + let + vType = typeOf value; + in + if + elem vType [ + "int" + "float" + "bool" + "string" + ] + then + "${name} ${literalValueToString value}" + else if vType == "set" then + convertAttrsToSCFG name value + else if vType == "list" then + convertListOfFlatAttrsToSCFG name value + else + throw '' + Cannot convert type `(${typeOf value})` to SCFG: + ${name} = ${toString value} + '' + ); + in + attrs: lib.optionalString (attrs != { }) '' ${concatStringsSep "\n" (convertToAttrsSCFG' attrs)} ''; diff --git a/modules/lib/gvariant.nix b/modules/lib/gvariant.nix index bbb97c64a..de914a32b 100644 --- a/modules/lib/gvariant.nix +++ b/modules/lib/gvariant.nix @@ -7,7 +7,13 @@ let inherit (lib) - concatMapStringsSep concatStrings escape hasPrefix head replaceStrings; + concatMapStringsSep + concatStrings + escape + hasPrefix + head + replaceStrings + ; mkPrimitive = t: v: { _type = "gvariant"; @@ -36,7 +42,8 @@ let # Returns the GVariant type of a given Nix value. If no type can be # found for the value then the empty string is returned. - typeOf = v: + typeOf = + v: with type; if builtins.isBool v then boolean @@ -47,29 +54,27 @@ let else if builtins.isString v then string else if builtins.isList v then - let elemType = elemTypeOf v; - in if elemType == "" then "" else arrayOf elemType + let + elemType = elemTypeOf v; + in + if elemType == "" then "" else arrayOf elemType else if builtins.isAttrs v && v ? type then v.type else ""; - elemTypeOf = vs: - if builtins.isList vs then - if vs == [ ] then "" else typeOf (head vs) - else - ""; + elemTypeOf = vs: if builtins.isList vs then if vs == [ ] then "" else typeOf (head vs) else ""; - mkMaybe = elemType: elem: - mkPrimitive (type.maybeOf elemType) elem // { - __toString = self: - if self.value == null then - "@${self.type} nothing" - else - "just ${toString self.value}"; + mkMaybe = + elemType: elem: + mkPrimitive (type.maybeOf elemType) elem + // { + __toString = + self: if self.value == null then "@${self.type} nothing" else "just ${toString self.value}"; }; -in rec { +in +rec { inherit type typeOf; @@ -83,7 +88,8 @@ in rec { # Returns the GVariant value that most closely matches the given Nix # value. If no GVariant value can be found then `null` is returned. - mkValue = v: + mkValue = + v: if builtins.isBool v then mkBoolean v else if builtins.isInt v then @@ -99,55 +105,77 @@ in rec { else null; - mkArray = elemType: elems: - mkPrimitive (type.arrayOf elemType) (map mkValue elems) // { - __toString = self: - "@${self.type} [${concatMapStringsSep "," toString self.value}]"; + mkArray = + elemType: elems: + mkPrimitive (type.arrayOf elemType) (map mkValue elems) + // { + __toString = self: "@${self.type} [${concatMapStringsSep "," toString self.value}]"; }; mkEmptyArray = elemType: mkArray elemType [ ]; - mkVariant = elem: - let gvarElem = mkValue elem; - in mkPrimitive type.variant gvarElem // { + mkVariant = + elem: + let + gvarElem = mkValue elem; + in + mkPrimitive type.variant gvarElem + // { __toString = self: "@${self.type} <${toString self.value}>"; }; - mkDictionaryEntry = elems: + mkDictionaryEntry = + elems: let gvarElems = map mkValue elems; dictionaryType = type.dictionaryEntryOf (map (e: e.type) gvarElems); - in mkPrimitive dictionaryType gvarElems // { - __toString = self: - "@${self.type} {${concatMapStringsSep "," toString self.value}}"; + in + mkPrimitive dictionaryType gvarElems + // { + __toString = self: "@${self.type} {${concatMapStringsSep "," toString self.value}}"; }; mkNothing = elemType: mkMaybe elemType null; - mkJust = elem: let gvarElem = mkValue elem; in mkMaybe gvarElem.type gvarElem; + mkJust = + elem: + let + gvarElem = mkValue elem; + in + mkMaybe gvarElem.type gvarElem; - mkTuple = elems: + mkTuple = + elems: let gvarElems = map mkValue elems; tupleType = type.tupleOf (map (e: e.type) gvarElems); - in mkPrimitive tupleType gvarElems // { - __toString = self: - "@${self.type} (${concatMapStringsSep "," toString self.value})"; + in + mkPrimitive tupleType gvarElems + // { + __toString = self: "@${self.type} (${concatMapStringsSep "," toString self.value})"; }; - mkBoolean = v: - mkPrimitive type.boolean v // { + mkBoolean = + v: + mkPrimitive type.boolean v + // { __toString = self: if self.value then "true" else "false"; }; - mkString = v: - let sanitize = s: replaceStrings [ "\n" ] [ "\\n" ] (escape [ "'" "\\" ] s); - in mkPrimitive type.string v // { + mkString = + v: + let + sanitize = s: replaceStrings [ "\n" ] [ "\\n" ] (escape [ "'" "\\" ] s); + in + mkPrimitive type.string v + // { __toString = self: "'${sanitize self.value}'"; }; - mkObjectpath = v: - mkPrimitive type.string v // { + mkObjectpath = + v: + mkPrimitive type.string v + // { __toString = self: "objectpath '${escape [ "'" ] self.value}'"; }; @@ -157,8 +185,10 @@ in rec { mkUint16 = mkPrimitive type.uint16; - mkInt32 = v: - mkPrimitive type.int32 v // { + mkInt32 = + v: + mkPrimitive type.int32 v + // { __toString = self: toString self.value; }; @@ -168,8 +198,10 @@ in rec { mkUint64 = mkPrimitive type.uint64; - mkDouble = v: - mkPrimitive type.double v // { + mkDouble = + v: + mkPrimitive type.double v + // { __toString = self: toString self.value; }; diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 610804878..0a9d8af4f 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -107,10 +107,12 @@ github = "d-dervishi"; githubId = 61125355; name = "David Dervishi"; - keys = [{ - longKeyId = "rsa4096/0xB1C012F0E7697195"; - fingerprint = "4C92 E3B0 21B5 5562 A1E0 CE3D B1C0 12F0 E769 7195"; - }]; + keys = [ + { + longKeyId = "rsa4096/0xB1C012F0E7697195"; + fingerprint = "4C92 E3B0 21B5 5562 A1E0 CE3D B1C0 12F0 E769 7195"; + } + ]; }; Dines97 = { name = "Denis Kaynar"; @@ -147,8 +149,7 @@ email = "yiheng.he@proton.me"; matrix = "@hey2022:matrix.org"; github = "hey2022"; - keys = - [{ fingerprint = "128E 09C0 6F73 D678 6BB5 E551 5EA5 3C75 F7BE 3EDE"; }]; + keys = [ { fingerprint = "128E 09C0 6F73 D678 6BB5 E551 5EA5 3C75 F7BE 3EDE"; } ]; }; jack5079 = { name = "Jack W."; @@ -167,10 +168,12 @@ name = "Jessica"; email = "jess+nix@jessie.cafe"; githubId = 43591752; - keys = [{ - longkeyid = "rsa3072/0xBA3350686C918606"; - fingerprint = "8092 3BD1 ECD0 E436 671D C8E9 BA33 5068 6C91 8606"; - }]; + keys = [ + { + longkeyid = "rsa3072/0xBA3350686C918606"; + fingerprint = "8092 3BD1 ECD0 E436 671D C8E9 BA33 5068 6C91 8606"; + } + ]; }; jkarlson = { email = "jekarlson@gmail.com"; @@ -250,10 +253,12 @@ email = "kamadorueda@gmail.com"; github = "kamadorueda"; githubId = 47480384; - keys = [{ - longkeyid = "rsa4096/0x04D0CEAF916A9A40"; - fingerprint = "2BE3 BAFD 793E A349 ED1F F00F 04D0 CEAF 916A 9A40"; - }]; + keys = [ + { + longkeyid = "rsa4096/0x04D0CEAF916A9A40"; + fingerprint = "2BE3 BAFD 793E A349 ED1F F00F 04D0 CEAF 916A 9A40"; + } + ]; }; katexochen = { name = "Paul Meyer"; @@ -339,20 +344,24 @@ email = "nick@hassan.host"; github = "n-hass"; githubId = 72363381; - keys = [{ - longkeyid = "rsa4096/0xFC95AB946A781EE7"; - fingerprint = "FDEE 6116 DBA7 8840 7323 4466 A371 5973 2728 A6A6"; - }]; + keys = [ + { + longkeyid = "rsa4096/0xFC95AB946A781EE7"; + fingerprint = "FDEE 6116 DBA7 8840 7323 4466 A371 5973 2728 A6A6"; + } + ]; }; seylerius = { email = "sable@seyleri.us"; name = "Sable Seyler"; github = "seylerius"; githubId = 1145981; - keys = [{ - logkeyid = "rsa4096/0x68BF2EAE6D91CAFF"; - fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF"; - }]; + keys = [ + { + logkeyid = "rsa4096/0x68BF2EAE6D91CAFF"; + fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF"; + } + ]; }; silmarp = { name = "Silmar Pereira da Silva Junior"; @@ -394,10 +403,12 @@ github = "msfjarvis"; githubId = "13348378"; name = "Harsh Shandilya"; - keys = [{ - longkeyid = "rsa4096/0xB7843F823355E9B9"; - fingerprint = "8F87 050B 0F9C B841 1515 7399 B784 3F82 3355 E9B9"; - }]; + keys = [ + { + longkeyid = "rsa4096/0xB7843F823355E9B9"; + fingerprint = "8F87 050B 0F9C B841 1515 7399 B784 3F82 3355 E9B9"; + } + ]; }; ambroisie = { email = "bruno.home-manager@belanyi.fr"; @@ -571,10 +582,12 @@ email = "88944439+rcerc@users.noreply.github.com"; github = "rcerc"; githubId = 88944439; - keys = [{ - longkeyid = "ed25519/0x3F98EC7EC2B87ED1"; - fingerprint = "D5D6 FD1F 0D9A 3284 FB9B C26D 3F98 EC7E C2B8 7ED1"; - }]; + keys = [ + { + longkeyid = "ed25519/0x3F98EC7EC2B87ED1"; + fingerprint = "D5D6 FD1F 0D9A 3284 FB9B C26D 3F98 EC7E C2B8 7ED1"; + } + ]; }; mtoohey = { name = "Matthew Toohey"; @@ -594,8 +607,7 @@ matrix = "@soywod:matrix.org"; github = "soywod"; githubId = 10437171; - keys = - [{ fingerprint = "75F0 AB7C FE01 D077 AEE6 CAFD 353E 4A18 EE0F AB72"; }]; + keys = [ { fingerprint = "75F0 AB7C FE01 D077 AEE6 CAFD 353E 4A18 EE0F AB72"; } ]; }; tensor5 = { github = "tensor5"; @@ -615,8 +627,7 @@ github = "toastal"; githubId = 561087; name = "toastal"; - keys = - [{ fingerprint = "7944 74B7 D236 DAB9 C9EF E7F9 5CCE 6F14 66D4 7C9E"; }]; + keys = [ { fingerprint = "7944 74B7 D236 DAB9 C9EF E7F9 5CCE 6F14 66D4 7C9E"; } ]; }; tomodachi94 = { email = "tomodachi94+nixpkgs@protonmail.com"; @@ -683,8 +694,7 @@ email = "git+nix@cleslie.uk"; github = "callumio"; githubId = 16057677; - keys = - [{ fingerprint = "BC82 4BB5 1656 D144 285E A0EC D382 C4AF EECE AA90"; }]; + keys = [ { fingerprint = "BC82 4BB5 1656 D144 285E A0EC D382 C4AF EECE AA90"; } ]; }; ALameLlama = { name = "Nicholas Ciechanowski"; @@ -703,10 +713,12 @@ email = "me@hpsaucii.dev"; github = "HPsaucii"; githubId = 126502193; - keys = [{ - longkeyid = "rsa4096/0xEDB2C634166AE6AD"; - fingerprint = "AD32 73D4 5E0E 9478 E826 543F EDB2 C634 166A E6AD"; - }]; + keys = [ + { + longkeyid = "rsa4096/0xEDB2C634166AE6AD"; + fingerprint = "AD32 73D4 5E0E 9478 E826 543F EDB2 C634 166A E6AD"; + } + ]; }; folliehiyuki = { name = "Hoang Nguyen"; diff --git a/modules/lib/nushell.nix b/modules/lib/nushell.nix index 5ef5ad36d..e5cfe92e0 100644 --- a/modules/lib/nushell.nix +++ b/modules/lib/nushell.nix @@ -1,66 +1,85 @@ -{ lib }: rec { +{ lib }: +rec { mkNushellInline = expr: lib.setType "nushell-inline" { inherit expr; }; isNushellInline = lib.isType "nushell-inline"; - toNushell = { indent ? "", multiline ? true, asBindings ? false, }@args: + toNushell = + { + indent ? "", + multiline ? true, + asBindings ? false, + }@args: v: let innerIndent = "${indent} "; - introSpace = if multiline then '' + introSpace = + if multiline then + '' - ${innerIndent}'' else - " "; - outroSpace = if multiline then '' + ${innerIndent}'' + else + " "; + outroSpace = + if multiline then + '' - ${indent}'' else - " "; + ${indent}'' + else + " "; innerArgs = args // { indent = if asBindings then indent else innerIndent; asBindings = false; }; concatItems = lib.concatStringsSep introSpace; - generatedBindings = assert lib.assertMsg (badVarNames == [ ]) - "Bad Nushell variable names: ${ - lib.generators.toPretty { } badVarNames - }"; - lib.concatStrings (lib.mapAttrsToList (key: value: '' - ${indent}let ${key} = ${toNushell innerArgs value} - '') v); + generatedBindings = + assert lib.assertMsg (badVarNames == [ ]) + "Bad Nushell variable names: ${lib.generators.toPretty { } badVarNames}"; + lib.concatStrings ( + lib.mapAttrsToList (key: value: '' + ${indent}let ${key} = ${toNushell innerArgs value} + '') v + ); - isBadVarName = name: + isBadVarName = + name: # Extracted from https://github.com/nushell/nushell/blob/ebc7b80c23f777f70c5053cca428226b3fe00d30/crates/nu-parser/src/parser.rs#L33 # Variables with numeric or even empty names are allowed. The only requisite is not containing any of the following characters - let invalidVariableCharacters = ".[({+-*^/=!<>&|"; - in lib.match "^[$]?[^${lib.escapeRegex invalidVariableCharacters}]+$" - name == null; + let + invalidVariableCharacters = ".[({+-*^/=!<>&|"; + in + lib.match "^[$]?[^${lib.escapeRegex invalidVariableCharacters}]+$" name == null; badVarNames = lib.filter isBadVarName (builtins.attrNames v); - in if asBindings then + in + if asBindings then generatedBindings else if v == null then "null" else if lib.isInt v || lib.isFloat v || lib.isString v || lib.isBool v then lib.strings.toJSON v else if lib.isList v then - (if v == [ ] then - "[]" - else - "[${introSpace}${ - concatItems (map (value: "${toNushell innerArgs value}") v) - }${outroSpace}]") + ( + if v == [ ] then + "[]" + else + "[${introSpace}${concatItems (map (value: "${toNushell innerArgs value}") v)}${outroSpace}]" + ) else if lib.isAttrs v then - (if isNushellInline v then - "(${v.expr})" - else if v == { } then - "{}" - else if lib.isDerivation v then - toString v - else - "{${introSpace}${ - concatItems (lib.mapAttrsToList (key: value: - "${lib.strings.toJSON key}: ${toNushell innerArgs value}") v) - }${outroSpace}}") + ( + if isNushellInline v then + "(${v.expr})" + else if v == { } then + "{}" + else if lib.isDerivation v then + toString v + else + "{${introSpace}${ + concatItems ( + lib.mapAttrsToList (key: value: "${lib.strings.toJSON key}: ${toNushell innerArgs value}") v + ) + }${outroSpace}}" + ) else abort "nushell.toNushell: type ${lib.typeOf v} is unsupported"; } diff --git a/modules/lib/shell.nix b/modules/lib/shell.nix index 04f9135cf..3ab50111e 100644 --- a/modules/lib/shell.nix +++ b/modules/lib/shell.nix @@ -2,27 +2,35 @@ let - mkShellIntegrationOption = name: - { config, baseName ? name, extraDescription ? "" }: - let attrName = "enable${baseName}Integration"; - in lib.mkOption { + mkShellIntegrationOption = + name: + { + config, + baseName ? name, + extraDescription ? "", + }: + let + attrName = "enable${baseName}Integration"; + in + lib.mkOption { default = config.home.shell.${attrName}; defaultText = lib.literalMD "[](#opt-home.shell.${attrName})"; example = false; description = "Whether to enable ${name} integration.${ - lib.optionalString (extraDescription != "") - ("\n\n" + extraDescription) - }"; + lib.optionalString (extraDescription != "") ("\n\n" + extraDescription) + }"; type = lib.types.bool; }; -in rec { +in +rec { # Produces a Bourne shell like statement that prepend new values to # an possibly existing variable, using sep(arator). # Example: # prependToVar ":" "PATH" [ "$HOME/bin" "$HOME/.local/bin" ] # => "$HOME/bin:$HOME/.local/bin:${PATH:+:}\$PATH" - prependToVar = sep: n: v: + prependToVar = + sep: n: v: "${lib.concatStringsSep sep v}\${${n}:+${sep}}\$${n}"; # Produces a Bourne shell like variable export statement. diff --git a/modules/lib/stdlib-extended.nix b/modules/lib/stdlib-extended.nix index 3c4e032aa..143ddc560 100644 --- a/modules/lib/stdlib-extended.nix +++ b/modules/lib/stdlib-extended.nix @@ -3,11 +3,15 @@ nixpkgsLib: -let mkHmLib = import ./.; -in nixpkgsLib.extend (self: super: { - hm = mkHmLib { lib = self; }; +let + mkHmLib = import ./.; +in +nixpkgsLib.extend ( + self: super: { + hm = mkHmLib { lib = self; }; - # For forward compatibility. - literalExpression = super.literalExpression or super.literalExample; - literalDocBook = super.literalDocBook or super.literalExample; -}) + # For forward compatibility. + literalExpression = super.literalExpression or super.literalExample; + literalDocBook = super.literalDocBook or super.literalExample; + } +) diff --git a/modules/lib/strings.nix b/modules/lib/strings.nix index f59d81508..05d0e7a5d 100644 --- a/modules/lib/strings.nix +++ b/modules/lib/strings.nix @@ -2,22 +2,39 @@ let inherit (lib) - genList length lowerChars replaceStrings stringToCharacters upperChars; -in { + genList + length + lowerChars + replaceStrings + stringToCharacters + upperChars + ; +in +{ # Figures out a valid Nix store name for the given path. - storeFileName = path: + storeFileName = + path: let # All characters that are considered safe. Note "-" is not # included to avoid "-" followed by digit being interpreted as a # version. - safeChars = [ "+" "." "_" "?" "=" ] ++ lowerChars ++ upperChars + safeChars = + [ + "+" + "." + "_" + "?" + "=" + ] + ++ lowerChars + ++ upperChars ++ stringToCharacters "0123456789"; empties = l: genList (x: "") (length l); - unsafeInName = - stringToCharacters (replaceStrings safeChars (empties safeChars) path); + unsafeInName = stringToCharacters (replaceStrings safeChars (empties safeChars) path); safeName = replaceStrings unsafeInName (empties unsafeInName) path; - in "hm_" + safeName; + in + "hm_" + safeName; } diff --git a/modules/lib/types-dag.nix b/modules/lib/types-dag.nix index 5fdd58228..3cea2151a 100644 --- a/modules/lib/types-dag.nix +++ b/modules/lib/types-dag.nix @@ -2,42 +2,65 @@ let inherit (lib) - concatStringsSep defaultFunctor fixedWidthNumber hm imap1 isAttrs isList - length listToAttrs mapAttrs mkIf mkOrder mkOption mkOptionType nameValuePair - stringLength types warn; + concatStringsSep + defaultFunctor + fixedWidthNumber + hm + imap1 + isAttrs + isList + length + listToAttrs + mapAttrs + mkIf + mkOrder + mkOption + mkOptionType + nameValuePair + stringLength + types + warn + ; - dagEntryOf = elemType: + dagEntryOf = + elemType: let - submoduleType = types.submodule ({ name, ... }: { - options = { - data = mkOption { type = elemType; }; - after = mkOption { type = with types; listOf str; }; - before = mkOption { type = with types; listOf str; }; - }; - config = mkIf (elemType.name == "submodule") { - data._module.args.dagName = name; - }; - }); - maybeConvert = def: + submoduleType = types.submodule ( + { name, ... }: + { + options = { + data = mkOption { type = elemType; }; + after = mkOption { type = with types; listOf str; }; + before = mkOption { type = with types; listOf str; }; + }; + config = mkIf (elemType.name == "submodule") { + data._module.args.dagName = name; + }; + } + ); + maybeConvert = + def: if hm.dag.isEntry def.value then def.value else - hm.dag.entryAnywhere (if def ? priority then - mkOrder def.priority def.value - else - def.value); - in mkOptionType { + hm.dag.entryAnywhere (if def ? priority then mkOrder def.priority def.value else def.value); + in + mkOptionType { name = "dagEntryOf"; description = "DAG entry of ${elemType.description}"; # leave the checking to the submodule type - merge = loc: defs: - submoduleType.merge loc (map (def: { - inherit (def) file; - value = maybeConvert def; - }) defs); + merge = + loc: defs: + submoduleType.merge loc ( + map (def: { + inherit (def) file; + value = maybeConvert def; + }) defs + ); }; -in rec { +in +rec { # A directed acyclic graph of some inner type. # # Note, if the element type is a submodule then the `name` argument @@ -45,16 +68,21 @@ in rec { # internal structure of the DAG values. To give access to the # "actual" attribute name a new submodule argument is provided with # the name `dagName`. - dagOf = elemType: - let attrEquivalent = types.attrsOf (dagEntryOf elemType); - in mkOptionType rec { + dagOf = + elemType: + let + attrEquivalent = types.attrsOf (dagEntryOf elemType); + in + mkOptionType rec { name = "dagOf"; description = "DAG of ${elemType.description}"; inherit (attrEquivalent) check merge emptyValue; getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "" ]); getSubModules = elemType.getSubModules; substSubModules = m: dagOf (elemType.substSubModules m); - functor = (defaultFunctor name) // { wrapped = elemType; }; + functor = (defaultFunctor name) // { + wrapped = elemType; + }; nestedTypes.elemType = elemType; }; } diff --git a/modules/lib/types.nix b/modules/lib/types.nix index 14d1c2192..93e9807a6 100644 --- a/modules/lib/types.nix +++ b/modules/lib/types.nix @@ -1,10 +1,28 @@ -{ lib, gvariant ? import ./gvariant.nix { inherit lib; } }: +{ + lib, + gvariant ? import ./gvariant.nix { inherit lib; }, +}: let inherit (lib) - all concatMap foldl' getFiles getValues head isFunction literalExpression - mergeAttrs mergeDefaultOption mergeOneOption mergeOptions mkOption - mkOptionType showFiles showOption types; + all + concatMap + foldl' + getFiles + getValues + head + isFunction + literalExpression + mergeAttrs + mergeDefaultOption + mergeOneOption + mergeOptions + mkOption + mkOptionType + showFiles + showOption + types + ; typesDag = import ./types-dag.nix { inherit lib; }; @@ -12,24 +30,30 @@ let # must refer back to the type. gvar = gvariant; -in rec { +in +rec { inherit (typesDag) dagOf; selectorFunction = mkOptionType { name = "selectorFunction"; - description = "Function that takes an attribute set and returns a list" + description = + "Function that takes an attribute set and returns a list" + " containing a selection of the values of the input set"; check = isFunction; - merge = _loc: defs: as: concatMap (select: select as) (getValues defs); + merge = + _loc: defs: as: + concatMap (select: select as) (getValues defs); }; overlayFunction = mkOptionType { name = "overlayFunction"; - description = "An overlay function, takes self and super and returns" + description = + "An overlay function, takes self and super and returns" + " an attribute set overriding the desired attributes."; check = isFunction; - merge = _loc: defs: self: super: + merge = + _loc: defs: self: super: foldl' (res: def: mergeAttrs res (def.value self super)) { } defs; }; @@ -69,28 +93,34 @@ in rec { name = "gvariant"; description = "GVariant value"; check = v: gvar.mkValue v != null; - merge = loc: defs: + merge = + loc: defs: let - vdefs = map (d: - d // { - value = - if gvar.isGVariant d.value then d.value else gvar.mkValue d.value; - }) defs; + vdefs = map ( + d: + d + // { + value = if gvar.isGVariant d.value then d.value else gvar.mkValue d.value; + } + ) defs; vals = map (d: d.value) vdefs; defTypes = map (x: x.type) vals; sameOrNull = x: y: if x == y then y else null; # A bit naive to just check the first entry… sharedDefType = foldl' sameOrNull (head defTypes) defTypes; allChecked = all (x: check x) vals; - in if sharedDefType == null then - throw ("Cannot merge definitions of `${showOption loc}' with" + in + if sharedDefType == null then + throw ( + "Cannot merge definitions of `${showOption loc}' with" + " mismatched GVariant types given in" - + " ${showFiles (getFiles defs)}.") + + " ${showFiles (getFiles defs)}." + ) else if gvar.isArray sharedDefType && allChecked then - gvar.mkValue ((types.listOf gvariant).merge loc - (map (d: d // { value = d.value.value; }) vdefs)) // { - type = sharedDefType; - } + gvar.mkValue ((types.listOf gvariant).merge loc (map (d: d // { value = d.value.value; }) vdefs)) + // { + type = sharedDefType; + } else if gvar.isTuple sharedDefType && allChecked then mergeOneOption loc defs else if gvar.isMaybe sharedDefType && allChecked then @@ -107,27 +137,37 @@ in rec { mergeDefaultOption loc defs; }; - nushellValue = let - valueType = types.nullOr (types.oneOf [ - (lib.mkOptionType { - name = "nushell"; - description = "Nushell inline value"; - descriptionClass = "name"; - check = lib.isType "nushell-inline"; - }) - types.bool - types.int - types.float - types.str - types.path - (types.attrsOf valueType // { - description = "attribute set of Nushell values"; - descriptionClass = "name"; - }) - (types.listOf valueType // { - description = "list of Nushell values"; - descriptionClass = "name"; - }) - ]); - in valueType; + nushellValue = + let + valueType = types.nullOr ( + types.oneOf [ + (lib.mkOptionType { + name = "nushell"; + description = "Nushell inline value"; + descriptionClass = "name"; + check = lib.isType "nushell-inline"; + }) + types.bool + types.int + types.float + types.str + types.path + ( + types.attrsOf valueType + // { + description = "attribute set of Nushell values"; + descriptionClass = "name"; + } + ) + ( + types.listOf valueType + // { + description = "list of Nushell values"; + descriptionClass = "name"; + } + ) + ] + ); + in + valueType; } diff --git a/modules/lib/zsh.nix b/modules/lib/zsh.nix index c6901350f..651dfada4 100644 --- a/modules/lib/zsh.nix +++ b/modules/lib/zsh.nix @@ -2,7 +2,8 @@ rec { # Produces a Zsh shell like value - toZshValue = v: + toZshValue = + v: if builtins.isBool v then if v then "true" else "false" else if builtins.isString v then diff --git a/modules/manual.nix b/modules/manual.nix index 02a5c2c77..296b803aa 100644 --- a/modules/manual.nix +++ b/modules/manual.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let @@ -9,7 +14,8 @@ let inherit (config.home.version) release isReleaseBranch; }; -in { +in +{ options = { manual.html.enable = lib.mkOption { type = lib.types.bool; @@ -51,7 +57,10 @@ in { config = { home.packages = lib.mkMerge [ - (lib.mkIf cfg.html.enable [ docs.manual.html docs.manual.htmlOpenTool ]) + (lib.mkIf cfg.html.enable [ + docs.manual.html + docs.manual.htmlOpenTool + ]) (lib.mkIf cfg.manpages.enable [ docs.manPages ]) (lib.mkIf cfg.json.enable [ docs.options.json ]) ]; diff --git a/modules/misc/dconf.nix b/modules/misc/dconf.nix index 39eceb42e..035d2ec35 100644 --- a/modules/misc/dconf.nix +++ b/modules/misc/dconf.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) types; @@ -7,18 +12,23 @@ let toDconfIni = lib.generators.toINI { mkKeyValue = mkIniKeyValue; }; - mkIniKeyValue = key: value: - "${key}=${toString (lib.hm.gvariant.mkValue value)}"; + mkIniKeyValue = key: value: "${key}=${toString (lib.hm.gvariant.mkValue value)}"; # The dconf keys managed by this configuration. We store this as part of the # generation state to be able to reset keys that become unmanaged during # switch. - stateDconfKeys = pkgs.writeText "dconf-keys.json" (builtins.toJSON - (lib.concatLists (lib.mapAttrsToList - (dir: entries: lib.mapAttrsToList (key: _: "/${dir}/${key}") entries) - cfg.settings))); + stateDconfKeys = pkgs.writeText "dconf-keys.json" ( + builtins.toJSON ( + lib.concatLists ( + lib.mapAttrsToList ( + dir: entries: lib.mapAttrsToList (key: _: "/${dir}/${key}") entries + ) cfg.settings + ) + ) + ); -in { +in +{ meta.maintainers = [ lib.maintainers.rycee ]; options = { @@ -84,8 +94,8 @@ in { ln -s ${stateDconfKeys} $out/state/${stateDconfKeys.name} ''; - home.activation.dconfSettings = lib.hm.dag.entryAfter [ "installPackages" ] - (let + home.activation.dconfSettings = lib.hm.dag.entryAfter [ "installPackages" ] ( + let iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); statePath = "state/${stateDconfKeys.name}"; @@ -95,7 +105,12 @@ in { ${config.lib.bash.initHomeManagerLib} - PATH=${lib.makeBinPath [ pkgs.dconf pkgs.jq ]}''${PATH:+:}$PATH + PATH=${ + lib.makeBinPath [ + pkgs.dconf + pkgs.jq + ] + }''${PATH:+:}$PATH oldState="$1" newState="$2" @@ -116,7 +131,8 @@ in { run $DCONF_DBUS_RUN_SESSION dconf reset "$key" done ''; - in '' + in + '' if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then export DCONF_DBUS_RUN_SESSION="" else @@ -132,6 +148,7 @@ in { run $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} unset DCONF_DBUS_RUN_SESSION - ''); + '' + ); }; } diff --git a/modules/misc/editorconfig.nix b/modules/misc/editorconfig.nix index 56505850a..c6a52f150 100644 --- a/modules/misc/editorconfig.nix +++ b/modules/misc/editorconfig.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let @@ -6,7 +11,8 @@ let iniFormat = pkgs.formats.ini { }; -in { +in +{ meta.maintainers = with lib.maintainers; [ loicreynier ]; options.editorconfig = { @@ -38,14 +44,18 @@ in { }; config = lib.mkIf (cfg.enable && cfg.settings != { }) { - home.file.".editorconfig".text = let - renderedSettings = lib.generators.toINIWithGlobalSection { } { - globalSection = { root = true; }; - sections = cfg.settings; - }; - in '' - # Generated by Home Manager - ${renderedSettings} - ''; + home.file.".editorconfig".text = + let + renderedSettings = lib.generators.toINIWithGlobalSection { } { + globalSection = { + root = true; + }; + sections = cfg.settings; + }; + in + '' + # Generated by Home Manager + ${renderedSettings} + ''; }; } diff --git a/modules/misc/fontconfig.nix b/modules/misc/fontconfig.nix index 09906a440..2b01046e8 100644 --- a/modules/misc/fontconfig.nix +++ b/modules/misc/fontconfig.nix @@ -2,7 +2,12 @@ # # https://github.com/NixOS/nixpkgs/blob/23.11/nixos/modules/config/fonts/fontconfig.nix -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let @@ -10,15 +15,19 @@ let profileDirectory = config.home.profileDirectory; -in { +in +{ meta.maintainers = [ lib.maintainers.rycee ]; imports = [ - (lib.mkRenamedOptionModule [ "fonts" "fontconfig" "enableProfileFonts" ] [ - "fonts" - "fontconfig" - "enable" - ]) + (lib.mkRenamedOptionModule + [ "fonts" "fontconfig" "enableProfileFonts" ] + [ + "fonts" + "fontconfig" + "enable" + ] + ) ]; options = { @@ -117,53 +126,58 @@ in { fi ''; - xdg.configFile = let - mkFontconfigConf = conf: '' - + xdg.configFile = + let + mkFontconfigConf = conf: '' + - + - - - ${conf} - - ''; - in { - "fontconfig/conf.d/10-hm-fonts.conf".text = mkFontconfigConf '' - Add fonts in the Nix user profile + + + ${conf} + + ''; + in + { + "fontconfig/conf.d/10-hm-fonts.conf".text = mkFontconfigConf '' + Add fonts in the Nix user profile - ${config.home.path}/etc/fonts/conf.d - ${config.home.path}/etc/fonts/fonts.conf + ${config.home.path}/etc/fonts/conf.d + ${config.home.path}/etc/fonts/fonts.conf - ${config.home.path}/lib/X11/fonts - ${config.home.path}/share/fonts - ${profileDirectory}/lib/X11/fonts - ${profileDirectory}/share/fonts + ${config.home.path}/lib/X11/fonts + ${config.home.path}/share/fonts + ${profileDirectory}/lib/X11/fonts + ${profileDirectory}/share/fonts - ${config.home.path}/lib/fontconfig/cache - ''; + ${config.home.path}/lib/fontconfig/cache + ''; - "fontconfig/conf.d/52-hm-default-fonts.conf".text = let - genDefault = fonts: name: - lib.optionalString (fonts != [ ]) '' - - ${name} - - ${ - lib.concatStringsSep "" (map (font: '' - ${font} - '') fonts) - } - - + "fontconfig/conf.d/52-hm-default-fonts.conf".text = + let + genDefault = + fonts: name: + lib.optionalString (fonts != [ ]) '' + + ${name} + + ${lib.concatStringsSep "" ( + map (font: '' + ${font} + '') fonts + )} + + + ''; + in + mkFontconfigConf '' + + ${genDefault cfg.defaultFonts.sansSerif "sans-serif"} + ${genDefault cfg.defaultFonts.serif "serif"} + ${genDefault cfg.defaultFonts.monospace "monospace"} + ${genDefault cfg.defaultFonts.emoji "emoji"} ''; - in mkFontconfigConf '' - - ${genDefault cfg.defaultFonts.sansSerif "sans-serif"} - ${genDefault cfg.defaultFonts.serif "serif"} - ${genDefault cfg.defaultFonts.monospace "monospace"} - ${genDefault cfg.defaultFonts.emoji "emoji"} - ''; - }; + }; }; } diff --git a/modules/misc/gtk.nix b/modules/misc/gtk.nix index f6ee95a19..27d21a523 100644 --- a/modules/misc/gtk.nix +++ b/modules/misc/gtk.nix @@ -1,7 +1,12 @@ { config, lib, ... }: let - inherit (lib) literalExpression mkOption optionalAttrs types; + inherit (lib) + literalExpression + mkOption + optionalAttrs + types + ; cfg = config.gtk; cfg2 = config.gtk.gtk2; @@ -9,22 +14,26 @@ let cfg4 = config.gtk.gtk4; toGtk3Ini = lib.generators.toINI { - mkKeyValue = key: value: + mkKeyValue = + key: value: let - value' = - if lib.isBool value then lib.boolToString value else toString value; - in "${lib.escape [ "=" ] key}=${value'}"; + value' = if lib.isBool value then lib.boolToString value else toString value; + in + "${lib.escape [ "=" ] key}=${value'}"; }; - formatGtk2Option = n: v: + formatGtk2Option = + n: v: let - v' = if lib.isBool v then - lib.boolToString lib.value - else if lib.isString v then - ''"${v}"'' - else - toString v; - in "${lib.escape [ "=" ] n} = ${v'}"; + v' = + if lib.isBool v then + lib.boolToString lib.value + else if lib.isString v then + ''"${v}"'' + else + toString v; + in + "${lib.escape [ "=" ] n} = ${v'}"; themeType = types.submodule { options = { @@ -100,7 +109,8 @@ let }; }; -in { +in +{ meta.maintainers = [ lib.maintainers.rycee ]; imports = [ @@ -153,10 +163,8 @@ in { configLocation = mkOption { type = types.path; default = "${config.home.homeDirectory}/.gtkrc-2.0"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/.gtkrc-2.0"''; - example = - literalExpression ''"''${config.xdg.configHome}/gtk-2.0/gtkrc"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/.gtkrc-2.0"''; + example = literalExpression ''"''${config.xdg.configHome}/gtk-2.0/gtkrc"''; description = '' The location to put the GTK configuration file. ''; @@ -172,7 +180,13 @@ in { }; extraConfig = mkOption { - type = with types; attrsOf (oneOf [ bool int str ]); + type = + with types; + attrsOf (oneOf [ + bool + int + str + ]); default = { }; example = { gtk-cursor-blink = false; @@ -220,75 +234,86 @@ in { }; }; - config = lib.mkIf cfg.enable (let - gtkIni = optionalAttrs (cfg.font != null) { - gtk-font-name = - let fontSize = if cfg.font.size != null then cfg.font.size else 10; - in "${cfg.font.name} ${toString fontSize}"; - } // optionalAttrs (cfg.theme != null) { gtk-theme-name = cfg.theme.name; } - // optionalAttrs (cfg.iconTheme != null) { - gtk-icon-theme-name = cfg.iconTheme.name; - } // optionalAttrs (cfg.cursorTheme != null) { - gtk-cursor-theme-name = cfg.cursorTheme.name; - } // optionalAttrs - (cfg.cursorTheme != null && cfg.cursorTheme.size != null) { - gtk-cursor-theme-size = cfg.cursorTheme.size; + config = lib.mkIf cfg.enable ( + let + gtkIni = + optionalAttrs (cfg.font != null) { + gtk-font-name = + let + fontSize = if cfg.font.size != null then cfg.font.size else 10; + in + "${cfg.font.name} ${toString fontSize}"; + } + // optionalAttrs (cfg.theme != null) { gtk-theme-name = cfg.theme.name; } + // optionalAttrs (cfg.iconTheme != null) { + gtk-icon-theme-name = cfg.iconTheme.name; + } + // optionalAttrs (cfg.cursorTheme != null) { + gtk-cursor-theme-name = cfg.cursorTheme.name; + } + // optionalAttrs (cfg.cursorTheme != null && cfg.cursorTheme.size != null) { + gtk-cursor-theme-size = cfg.cursorTheme.size; + }; + + gtk4Css = + lib.optionalString (cfg.theme != null && cfg.theme.package != null) '' + /** + * GTK 4 reads the theme configured by gtk-theme-name, but ignores it. + * It does however respect user CSS, so import the theme from here. + **/ + @import url("file://${cfg.theme.package}/share/themes/${cfg.theme.name}/gtk-4.0/gtk.css"); + '' + + cfg4.extraCss; + + dconfIni = + optionalAttrs (cfg.font != null) { + font-name = + let + fontSize = if cfg.font.size != null then cfg.font.size else 10; + in + "${cfg.font.name} ${toString fontSize}"; + } + // optionalAttrs (cfg.theme != null) { gtk-theme = cfg.theme.name; } + // optionalAttrs (cfg.iconTheme != null) { + icon-theme = cfg.iconTheme.name; + } + // optionalAttrs (cfg.cursorTheme != null) { + cursor-theme = cfg.cursorTheme.name; + } + // optionalAttrs (cfg.cursorTheme != null && cfg.cursorTheme.size != null) { + cursor-size = cfg.cursorTheme.size; + }; + + optionalPackage = opt: lib.optional (opt != null && opt.package != null) opt.package; + in + { + home.packages = lib.concatMap optionalPackage [ + cfg.font + cfg.theme + cfg.iconTheme + cfg.cursorTheme + ]; + + home.file.${cfg2.configLocation}.text = + lib.concatMapStrings (l: l + "\n") (lib.mapAttrsToList formatGtk2Option gtkIni) + + cfg2.extraConfig + + "\n"; + + home.sessionVariables.GTK2_RC_FILES = cfg2.configLocation; + + xdg.configFile."gtk-3.0/settings.ini".text = toGtk3Ini { Settings = gtkIni // cfg3.extraConfig; }; + + xdg.configFile."gtk-3.0/gtk.css" = lib.mkIf (cfg3.extraCss != "") { text = cfg3.extraCss; }; + + xdg.configFile."gtk-3.0/bookmarks" = lib.mkIf (cfg3.bookmarks != [ ]) { + text = lib.concatMapStrings (l: l + "\n") cfg3.bookmarks; }; - gtk4Css = - lib.optionalString (cfg.theme != null && cfg.theme.package != null) '' - /** - * GTK 4 reads the theme configured by gtk-theme-name, but ignores it. - * It does however respect user CSS, so import the theme from here. - **/ - @import url("file://${cfg.theme.package}/share/themes/${cfg.theme.name}/gtk-4.0/gtk.css"); - '' + cfg4.extraCss; + xdg.configFile."gtk-4.0/settings.ini".text = toGtk3Ini { Settings = gtkIni // cfg4.extraConfig; }; - dconfIni = optionalAttrs (cfg.font != null) { - font-name = - let fontSize = if cfg.font.size != null then cfg.font.size else 10; - in "${cfg.font.name} ${toString fontSize}"; - } // optionalAttrs (cfg.theme != null) { gtk-theme = cfg.theme.name; } - // optionalAttrs (cfg.iconTheme != null) { - icon-theme = cfg.iconTheme.name; - } // optionalAttrs (cfg.cursorTheme != null) { - cursor-theme = cfg.cursorTheme.name; - } // optionalAttrs - (cfg.cursorTheme != null && cfg.cursorTheme.size != null) { - cursor-size = cfg.cursorTheme.size; - }; + xdg.configFile."gtk-4.0/gtk.css" = lib.mkIf (gtk4Css != "") { text = gtk4Css; }; - optionalPackage = opt: - lib.optional (opt != null && opt.package != null) opt.package; - in { - home.packages = lib.concatMap optionalPackage [ - cfg.font - cfg.theme - cfg.iconTheme - cfg.cursorTheme - ]; - - home.file.${cfg2.configLocation}.text = lib.concatMapStrings (l: l + "\n") - (lib.mapAttrsToList formatGtk2Option gtkIni) + cfg2.extraConfig + "\n"; - - home.sessionVariables.GTK2_RC_FILES = cfg2.configLocation; - - xdg.configFile."gtk-3.0/settings.ini".text = - toGtk3Ini { Settings = gtkIni // cfg3.extraConfig; }; - - xdg.configFile."gtk-3.0/gtk.css" = - lib.mkIf (cfg3.extraCss != "") { text = cfg3.extraCss; }; - - xdg.configFile."gtk-3.0/bookmarks" = lib.mkIf (cfg3.bookmarks != [ ]) { - text = lib.concatMapStrings (l: l + "\n") cfg3.bookmarks; - }; - - xdg.configFile."gtk-4.0/settings.ini".text = - toGtk3Ini { Settings = gtkIni // cfg4.extraConfig; }; - - xdg.configFile."gtk-4.0/gtk.css" = - lib.mkIf (gtk4Css != "") { text = gtk4Css; }; - - dconf.settings."org/gnome/desktop/interface" = dconfIni; - }); + dconf.settings."org/gnome/desktop/interface" = dconfIni; + } + ); } diff --git a/modules/misc/mozilla-messaging-hosts.nix b/modules/misc/mozilla-messaging-hosts.nix index 09a4188f1..ec5d05fff 100644 --- a/modules/misc/mozilla-messaging-hosts.nix +++ b/modules/misc/mozilla-messaging-hosts.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (pkgs.stdenv) isDarwin; @@ -10,16 +15,16 @@ let (pkgs.writeTextDir "lib/mozilla/native-messaging-hosts/.keep" "") ]; - thunderbirdNativeMessagingHostsPath = if isDarwin then - "Library/Mozilla/NativeMessagingHosts" - else - ".mozilla/native-messaging-hosts"; + thunderbirdNativeMessagingHostsPath = + if isDarwin then "Library/Mozilla/NativeMessagingHosts" else ".mozilla/native-messaging-hosts"; - firefoxNativeMessagingHostsPath = if isDarwin then - "Library/Application Support/Mozilla/NativeMessagingHosts" - else - ".mozilla/native-messaging-hosts"; -in { + firefoxNativeMessagingHostsPath = + if isDarwin then + "Library/Application Support/Mozilla/NativeMessagingHosts" + else + ".mozilla/native-messaging-hosts"; +in +{ meta.maintainers = with lib.maintainers; [ booxter rycee @@ -46,47 +51,45 @@ in { }; }; - config = lib.mkIf (cfg.firefoxNativeMessagingHosts != [ ] - || cfg.thunderbirdNativeMessagingHosts != [ ]) { - home.file = if isDarwin then - let - firefoxNativeMessagingHostsJoined = pkgs.symlinkJoin { - name = "ff-native-messaging-hosts"; - paths = defaultPaths ++ cfg.firefoxNativeMessagingHosts; - }; - thunderbirdNativeMessagingHostsJoined = pkgs.symlinkJoin { - name = "th-native-messaging-hosts"; - paths = defaultPaths ++ cfg.thunderbirdNativeMessagingHosts; - }; - in { - "${thunderbirdNativeMessagingHostsPath}" = - lib.mkIf (cfg.thunderbirdNativeMessagingHosts != [ ]) { - source = - "${thunderbirdNativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts"; - recursive = true; - }; + config = + lib.mkIf (cfg.firefoxNativeMessagingHosts != [ ] || cfg.thunderbirdNativeMessagingHosts != [ ]) + { + home.file = + if isDarwin then + let + firefoxNativeMessagingHostsJoined = pkgs.symlinkJoin { + name = "ff-native-messaging-hosts"; + paths = defaultPaths ++ cfg.firefoxNativeMessagingHosts; + }; + thunderbirdNativeMessagingHostsJoined = pkgs.symlinkJoin { + name = "th-native-messaging-hosts"; + paths = defaultPaths ++ cfg.thunderbirdNativeMessagingHosts; + }; + in + { + "${thunderbirdNativeMessagingHostsPath}" = lib.mkIf (cfg.thunderbirdNativeMessagingHosts != [ ]) { + source = "${thunderbirdNativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts"; + recursive = true; + }; - "${firefoxNativeMessagingHostsPath}" = - lib.mkIf (cfg.firefoxNativeMessagingHosts != [ ]) { - source = - "${firefoxNativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts"; - recursive = true; + "${firefoxNativeMessagingHostsPath}" = lib.mkIf (cfg.firefoxNativeMessagingHosts != [ ]) { + source = "${firefoxNativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts"; + recursive = true; + }; + } + else + let + nativeMessagingHostsJoined = pkgs.symlinkJoin { + name = "mozilla-native-messaging-hosts"; + # on Linux, the directory is shared between Firefox and Thunderbird; merge both into one + paths = defaultPaths ++ cfg.firefoxNativeMessagingHosts ++ cfg.thunderbirdNativeMessagingHosts; + }; + in + { + "${firefoxNativeMessagingHostsPath}" = { + source = "${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts"; + recursive = true; + }; }; - } - else - let - nativeMessagingHostsJoined = pkgs.symlinkJoin { - name = "mozilla-native-messaging-hosts"; - # on Linux, the directory is shared between Firefox and Thunderbird; merge both into one - paths = defaultPaths ++ cfg.firefoxNativeMessagingHosts - ++ cfg.thunderbirdNativeMessagingHosts; - }; - in { - "${firefoxNativeMessagingHostsPath}" = { - source = - "${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts"; - recursive = true; - }; - }; - }; + }; } diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 62b97ddf3..4faa369d2 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkOption types; @@ -7,58 +12,64 @@ let hostPlatform = pkgs.stdenv.hostPlatform; - entryModule = types.submodule ({ config, ... }: { - options = { - id = mkOption { - internal = true; - type = types.str; - description = '' - A unique entry identifier. By default it is a base16 - formatted hash of the entry message. - ''; + entryModule = types.submodule ( + { config, ... }: + { + options = { + id = mkOption { + internal = true; + type = types.str; + description = '' + A unique entry identifier. By default it is a base16 + formatted hash of the entry message. + ''; + }; + + time = mkOption { + internal = true; + type = types.str; + example = "2017-07-10T21:55:04+00:00"; + description = '' + News entry time stamp in ISO-8601 format. Must be in UTC + (ending in '+00:00'). + ''; + }; + + condition = mkOption { + internal = true; + default = true; + description = "Whether the news entry should be active."; + }; + + message = mkOption { + internal = true; + type = types.str; + description = "The news entry content."; + }; }; - time = mkOption { - internal = true; - type = types.str; - example = "2017-07-10T21:55:04+00:00"; - description = '' - News entry time stamp in ISO-8601 format. Must be in UTC - (ending in '+00:00'). - ''; + config = { + id = lib.mkDefault (builtins.hashString "sha256" config.message); }; - - condition = mkOption { - internal = true; - default = true; - description = "Whether the news entry should be active."; - }; - - message = mkOption { - internal = true; - type = types.str; - description = "The news entry content."; - }; - }; - - config = { - id = lib.mkDefault (builtins.hashString "sha256" config.message); - }; - }); + } + ); isNixFile = n: v: v == "regular" && lib.hasSuffix ".nix" n; # builtins.attrNames return the values in alphabetical order - newsFiles = - builtins.attrNames (lib.filterAttrs isNixFile (builtins.readDir ./news)); - newsEntries = - builtins.map (newsFile: import (./news + "/${newsFile}")) newsFiles; -in { + newsFiles = builtins.attrNames (lib.filterAttrs isNixFile (builtins.readDir ./news)); + newsEntries = builtins.map (newsFile: import (./news + "/${newsFile}")) newsFiles; +in +{ meta.maintainers = [ lib.maintainers.rycee ]; options = { news = { display = mkOption { - type = types.enum [ "silent" "notify" "show" ]; + type = types.enum [ + "silent" + "notify" + "show" + ]; default = "notify"; description = '' How unread and relevant news should be presented when @@ -100,8 +111,9 @@ in { }; config = { - news.json.output = pkgs.writeText "hm-news.json" - (builtins.toJSON { inherit (cfg) display entries; }); + news.json.output = pkgs.writeText "hm-news.json" ( + builtins.toJSON { inherit (cfg) display entries; } + ); # DO NOT define new entries here, instead use the `./create-news-entry.sh` # script and create an individual news file inside `news` sub-directory. @@ -250,8 +262,7 @@ in { { time = "2021-09-23T17:04:48+00:00"; - condition = hostPlatform.isLinux - && config.services.screen-locker.enable; + condition = hostPlatform.isLinux && config.services.screen-locker.enable; message = '' 'xautolock' is now optional in 'services.screen-locker', and the 'services.screen-locker' options have been reorganized for clarity. @@ -1699,9 +1710,12 @@ in { { time = "2024-06-26T07:07:17+00:00"; - condition = with config.programs.yazi; - enable && (enableBashIntegration || enableZshIntegration - || enableFishIntegration || enableNushellIntegration); + condition = + with config.programs.yazi; + enable + && ( + enableBashIntegration || enableZshIntegration || enableFishIntegration || enableNushellIntegration + ); message = '' Yazi's shell integration wrappers have been renamed from 'ya' to 'yy'. @@ -1881,10 +1895,12 @@ in { { time = "2024-12-04T20:00:00+00:00"; - condition = let - sCfg = config.programs.starship; - fCfg = config.programs.fish; - in sCfg.enable && sCfg.enableFishIntegration && fCfg.enable; + condition = + let + sCfg = config.programs.starship; + fCfg = config.programs.fish; + in + sCfg.enable && sCfg.enableFishIntegration && fCfg.enable; message = '' A new option 'programs.starship.enableInteractive' is available for the Fish shell that only enables starship if the shell is interactive. @@ -1894,10 +1910,11 @@ in { } { time = "2024-12-08T17:22:13+00:00"; - condition = let - usingMbsync = lib.any (a: a.mbsync.enable) - (lib.attrValues config.accounts.email.accounts); - in usingMbsync; + condition = + let + usingMbsync = lib.any (a: a.mbsync.enable) (lib.attrValues config.accounts.email.accounts); + in + usingMbsync; message = '' isync/mbsync 1.5.0 has changed several things. diff --git a/modules/misc/nix.nix b/modules/misc/nix.nix index 652d3eb89..10b780ca7 100644 --- a/modules/misc/nix.nix +++ b/modules/misc/nix.nix @@ -1,12 +1,38 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) - boolToString concatStringsSep escape floatToString getVersion isBool - isConvertibleWithToString isDerivation isFloat isInt isList isString - literalExpression maintainers mapAttrsToList mkDefault mkEnableOption mkIf - mkMerge mkOption optionalString toPretty types versionAtLeast; + boolToString + concatStringsSep + escape + floatToString + getVersion + isBool + isConvertibleWithToString + isDerivation + isFloat + isInt + isList + isString + literalExpression + maintainers + mapAttrsToList + mkDefault + mkEnableOption + mkIf + mkMerge + mkOption + optionalString + toPretty + types + versionAtLeast + ; cfg = config.nix; @@ -16,29 +42,33 @@ let nixPath = concatStringsSep ":" cfg.nixPath; - useXdg = config.nix.enable - && (config.nix.settings.use-xdg-base-directories or false); - defexprDir = if useXdg then - "${config.xdg.stateHome}/nix/defexpr" - else - "${config.home.homeDirectory}/.nix-defexpr"; + useXdg = config.nix.enable && (config.nix.settings.use-xdg-base-directories or false); + defexprDir = + if useXdg then + "${config.xdg.stateHome}/nix/defexpr" + else + "${config.home.homeDirectory}/.nix-defexpr"; # The deploy path for declarative channels. The directory name is prefixed # with a number to make it easier for files in defexprDir to control the order # they'll be read relative to each other. channelPath = "${defexprDir}/50-home-manager"; - channelsDrv = let - mkEntry = name: drv: { - inherit name; - path = toString drv; - }; - in pkgs.linkFarm "channels" (lib.mapAttrsToList mkEntry cfg.channels); + channelsDrv = + let + mkEntry = name: drv: { + inherit name; + path = toString drv; + }; + in + pkgs.linkFarm "channels" (lib.mapAttrsToList mkEntry cfg.channels); - nixConf = assert isNixAtLeast "2.2"; + nixConf = + assert isNixAtLeast "2.2"; let - mkValueString = v: + mkValueString = + v: if v == null then "" else if isInt v then @@ -62,10 +92,10 @@ let mkKeyValue = k: v: "${escape [ "=" ] k} = ${mkValueString v}"; - mkKeyValuePairs = attrs: - concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs); + mkKeyValuePairs = attrs: concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs); - in pkgs.writeTextFile { + in + pkgs.writeTextFile { name = "nix.conf"; text = '' # WARNING: this file is generated from the nix.settings option in @@ -75,48 +105,58 @@ let ${cfg.extraOptions} ''; checkPhase = - if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then '' - echo "Ignoring validation for cross-compilation" - '' else + if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then + '' + echo "Ignoring validation for cross-compilation" + '' + else let - showCommand = - if isNixAtLeast "2.20pre" then "config show" else "show-config"; - in '' + showCommand = if isNixAtLeast "2.20pre" then "config show" else "show-config"; + in + '' echo "Validating generated nix.conf" ln -s $out ./nix.conf set -e set +o pipefail NIX_CONF_DIR=$PWD \ - ${cfg.package}/bin/nix ${showCommand} ${ - optionalString (isNixAtLeast "2.3pre") - "--no-net --option experimental-features nix-command" - } \ + ${cfg.package}/bin/nix ${showCommand} ${optionalString (isNixAtLeast "2.3pre") "--no-net --option experimental-features nix-command"} \ |& sed -e 's/^warning:/error:/' \ - | (! grep '${ - if cfg.checkConfig then "^error:" else "^error: unknown setting" - }') + | (! grep '${if cfg.checkConfig then "^error:" else "^error: unknown setting"}') set -o pipefail ''; }; - semanticConfType = with types; + semanticConfType = + with types; let - confAtom = nullOr (oneOf [ bool int float str path package ]) // { - description = - "Nix config atom (null, bool, int, float, str, path or package)"; - }; - in attrsOf (either confAtom (listOf confAtom)); + confAtom = + nullOr (oneOf [ + bool + int + float + str + path + package + ]) + // { + description = "Nix config atom (null, bool, int, float, str, path or package)"; + }; + in + attrsOf (either confAtom (listOf confAtom)); jsonFormat = pkgs.formats.json { }; -in { +in +{ options.nix = { - enable = mkEnableOption '' - the Nix configuration module - '' // { - default = true; - visible = false; - }; + enable = + mkEnableOption '' + the Nix configuration module + '' + // { + default = true; + visible = false; + }; package = mkOption { type = types.nullOr types.package; @@ -169,60 +209,74 @@ in { }; registry = mkOption { - type = types.attrsOf (types.submodule (let - inputAttrs = types.attrsOf - (types.oneOf [ types.str types.int types.bool types.package ]); - in { config, name, ... }: { - options = { - from = mkOption { - type = inputAttrs; - example = { - type = "indirect"; - id = "nixpkgs"; + type = types.attrsOf ( + types.submodule ( + let + inputAttrs = types.attrsOf ( + types.oneOf [ + types.str + types.int + types.bool + types.package + ] + ); + in + { config, name, ... }: + { + options = { + from = mkOption { + type = inputAttrs; + example = { + type = "indirect"; + id = "nixpkgs"; + }; + description = "The flake reference to be rewritten."; + }; + to = mkOption { + type = inputAttrs; + example = { + type = "github"; + owner = "my-org"; + repo = "my-nixpkgs"; + }; + description = "The flake reference to which {option}`from>` is to be rewritten."; + }; + flake = mkOption { + type = types.nullOr types.attrs; + default = null; + example = literalExpression "nixpkgs"; + description = '' + The flake input to which {option}`from>` is to be rewritten. + ''; + }; + exact = mkOption { + type = types.bool; + default = true; + description = '' + Whether the {option}`from` reference needs to match exactly. If set, + a {option}`from` reference like `nixpkgs` does not + match with a reference like `nixpkgs/nixos-20.03`. + ''; + }; }; - description = "The flake reference to be rewritten."; - }; - to = mkOption { - type = inputAttrs; - example = { - type = "github"; - owner = "my-org"; - repo = "my-nixpkgs"; + config = { + from = mkDefault { + type = "indirect"; + id = name; + }; + to = mkIf (config.flake != null) ( + { + type = "path"; + path = config.flake.outPath; + } + // lib.filterAttrs ( + n: v: n == "lastModified" || n == "rev" || n == "revCount" || n == "narHash" + ) config.flake + ); }; - description = - "The flake reference to which {option}`from>` is to be rewritten."; - }; - flake = mkOption { - type = types.nullOr types.attrs; - default = null; - example = literalExpression "nixpkgs"; - description = '' - The flake input to which {option}`from>` is to be rewritten. - ''; - }; - exact = mkOption { - type = types.bool; - default = true; - description = '' - Whether the {option}`from` reference needs to match exactly. If set, - a {option}`from` reference like `nixpkgs` does not - match with a reference like `nixpkgs/nixos-20.03`. - ''; - }; - }; - config = { - from = mkDefault { - type = "indirect"; - id = name; - }; - to = mkIf (config.flake != null) ({ - type = "path"; - path = config.flake.outPath; - } // lib.filterAttrs (n: v: - n == "lastModified" || n == "rev" || n == "revCount" || n - == "narHash") config.flake); - }; - })); + } + ) + ); default = { }; description = '' User level flake registry. @@ -290,22 +344,22 @@ in { }) (mkIf (cfg.registry != { }) { - xdg.configFile."nix/registry.json".source = - jsonFormat.generate "registry.json" { - version = cfg.registryVersion; - flakes = - mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry; - }; + xdg.configFile."nix/registry.json".source = jsonFormat.generate "registry.json" { + version = cfg.registryVersion; + flakes = mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry; + }; }) (mkIf (cfg.settings != { } || cfg.extraOptions != "") { - assertions = [{ - assertion = cfg.package != null; - message = '' - A corresponding Nix package must be specified via `nix.package` for generating - nix.conf. - ''; - }]; + assertions = [ + { + assertion = cfg.package != null; + message = '' + A corresponding Nix package must be specified via `nix.package` for generating + nix.conf. + ''; + } + ]; xdg.configFile."nix/nix.conf".source = nixConf; }) diff --git a/modules/misc/nixgl.nix b/modules/misc/nixgl.nix index 541314723..37308ec5c 100644 --- a/modules/misc/nixgl.nix +++ b/modules/misc/nixgl.nix @@ -1,13 +1,23 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.nixGL; - wrapperListMarkdown = with builtins; - foldl' (list: name: - list + '' + wrapperListMarkdown = + with builtins; + foldl' ( + list: name: + list + + '' - ${name} - '') "" (attrNames config.lib.nixGL.wrappers); -in { + '' + ) "" (attrNames config.lib.nixGL.wrappers); +in +{ meta.maintainers = [ lib.maintainers.smona ]; options.nixGL = { @@ -93,7 +103,12 @@ in { }; prime.installScript = lib.mkOption { - type = with lib.types; nullOr (enum [ "mesa" "nvidia" ]); + type = + with lib.types; + nullOr (enum [ + "mesa" + "nvidia" + ]); default = null; example = "mesa"; description = '' @@ -109,10 +124,12 @@ in { }; installScripts = lib.mkOption { - type = with lib.types; - nullOr (listOf (enum (builtins.attrNames config.lib.nixGL.wrappers))); + type = with lib.types; nullOr (listOf (enum (builtins.attrNames config.lib.nixGL.wrappers))); default = null; - example = [ "mesa" "mesaPrime" ]; + example = [ + "mesa" + "mesaPrime" + ]; description = '' For each wrapper `wrp` named in the provided list, a wrapper script named `nixGLWrp` is installed into the environment. These scripts are @@ -137,168 +154,199 @@ in { }; }; - config = let - findWrapperPackage = packageAttr: - # NixGL has wrapper packages in different places depending on how you - # access it. We want HM configuration to be the same, regardless of how - # NixGL is imported. - # - # First, let's see if we have a flake. - if builtins.hasAttr pkgs.system cfg.packages then - cfg.packages.${pkgs.system}.${packageAttr} - else - # Next, let's see if we have a channel. - if builtins.hasAttr packageAttr cfg.packages then - cfg.packages.${packageAttr} - else - # Lastly, with channels, some wrappers are grouped under "auto". - if builtins.hasAttr "auto" cfg.packages then - cfg.packages.auto.${packageAttr} - else - throw "Incompatible NixGL package layout"; - - getWrapperExe = vendor: - let - glPackage = findWrapperPackage "nixGL${vendor}"; - glExe = lib.getExe glPackage; - vulkanPackage = findWrapperPackage "nixVulkan${vendor}"; - vulkanExe = if cfg.vulkan.enable then lib.getExe vulkanPackage else ""; - in "${glExe} ${vulkanExe}"; - - mesaOffloadEnv = { "DRI_PRIME" = "${cfg.prime.card}"; }; - - nvOffloadEnv = { - "DRI_PRIME" = "${cfg.prime.card}"; - "__NV_PRIME_RENDER_OFFLOAD" = "1"; - "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; - "__VK_LAYER_NV_optimus" = "NVIDIA_only"; - } // (let provider = cfg.prime.nvidiaProvider; - in if !isNull provider then { - "__NV_PRIME_RENDER_OFFLOAD_PROVIDER" = "${provider}"; - } else - { }); - - makePackageWrapper = vendor: environment: pkg: - if builtins.isNull cfg.packages then - pkg - else - # Wrap the package's binaries with nixGL, while preserving the rest of - # the outputs and derivation attributes. - (pkg.overrideAttrs (old: { - name = "nixGL-${pkg.name}"; - - # Make sure this is false for the wrapper derivation, so nix doesn't expect - # a new debug output to be produced. We won't be producing any debug info - # for the original package. - separateDebugInfo = false; - nativeBuildInputs = old.nativeBuildInputs or [ ] - ++ [ pkgs.makeWrapper ]; - buildCommand = let - # We need an intermediate wrapper package because makeWrapper - # requires a single executable as the wrapper. - combinedWrapperPkg = - pkgs.writeShellScriptBin "nixGLCombinedWrapper-${vendor}" '' - exec ${getWrapperExe vendor} "$@" - ''; - in '' - set -eo pipefail - - ${ # Heavily inspired by https://stackoverflow.com/a/68523368/6259505 - lib.concatStringsSep "\n" (map (outputName: '' - echo "Copying output ${outputName}" - set -x - cp -rs --no-preserve=mode "${ - pkg.${outputName} - }" "''$${outputName}" - set +x - '') (old.outputs or [ "out" ]))} - - rm -rf $out/bin/* - shopt -s nullglob # Prevent loop from running if no files - for file in ${pkg.out}/bin/*; do - local prog="$(basename "$file")" - makeWrapper \ - "${lib.getExe combinedWrapperPkg}" \ - "$out/bin/$prog" \ - --argv0 "$prog" \ - --add-flags "$file" \ - ${ - lib.concatStringsSep " " (lib.attrsets.mapAttrsToList - (var: val: "--set '${var}' '${val}'") environment) - } - done - - # If .desktop files refer to the old package, replace the references - for dsk in "$out/share/applications"/*.desktop ; do - if ! grep -q "${pkg.out}" "$dsk"; then - continue - fi - src="$(readlink "$dsk")" - rm "$dsk" - sed "s|${pkg.out}|$out|g" "$src" > "$dsk" - done - - shopt -u nullglob # Revert nullglob back to its normal default state - ''; - })) // { - # When the nixGL-wrapped package is given to a HM module, the module - # might want to override the package arguments, but our wrapper - # wouldn't know what to do with them. So, we rewrite the override - # function to instead forward the arguments to the package's own - # override function. - override = args: - makePackageWrapper vendor environment (pkg.override args); - }; - - wrappers = { - mesa = makePackageWrapper "Intel" { }; - mesaPrime = makePackageWrapper "Intel" mesaOffloadEnv; - nvidia = makePackageWrapper "Nvidia" { }; - nvidiaPrime = makePackageWrapper "Nvidia" nvOffloadEnv; - }; - in { - lib.nixGL.wrap = wrappers.${cfg.defaultWrapper}; - lib.nixGL.wrapOffload = wrappers.${cfg.offloadWrapper}; - lib.nixGL.wrappers = wrappers; - - home.packages = let - wantsPrimeWrapper = (!isNull cfg.prime.installScript); - wantsWrapper = wrapper: - (!isNull cfg.packages) && (!isNull cfg.installScripts) - && (builtins.elem wrapper cfg.installScripts); - envVarsAsScript = environment: - lib.concatStringsSep "\n" - (lib.attrsets.mapAttrsToList (var: val: "export ${var}=${val}") - environment); - in [ - (lib.mkIf wantsPrimeWrapper (pkgs.writeShellScriptBin "prime-offload" '' - ${if cfg.prime.installScript == "mesa" then - (envVarsAsScript mesaOffloadEnv) + config = + let + findWrapperPackage = + packageAttr: + # NixGL has wrapper packages in different places depending on how you + # access it. We want HM configuration to be the same, regardless of how + # NixGL is imported. + # + # First, let's see if we have a flake. + if builtins.hasAttr pkgs.system cfg.packages then + cfg.packages.${pkgs.system}.${packageAttr} else - (envVarsAsScript nvOffloadEnv)} - exec "$@" - '')) + # Next, let's see if we have a channel. + if builtins.hasAttr packageAttr cfg.packages then + cfg.packages.${packageAttr} + else + # Lastly, with channels, some wrappers are grouped under "auto". + if builtins.hasAttr "auto" cfg.packages then + cfg.packages.auto.${packageAttr} + else + throw "Incompatible NixGL package layout"; - (lib.mkIf (wantsWrapper "mesa") (pkgs.writeShellScriptBin "nixGLMesa" '' - exec ${getWrapperExe "Intel"} "$@" - '')) + getWrapperExe = + vendor: + let + glPackage = findWrapperPackage "nixGL${vendor}"; + glExe = lib.getExe glPackage; + vulkanPackage = findWrapperPackage "nixVulkan${vendor}"; + vulkanExe = if cfg.vulkan.enable then lib.getExe vulkanPackage else ""; + in + "${glExe} ${vulkanExe}"; - (lib.mkIf (wantsWrapper "mesaPrime") - (pkgs.writeShellScriptBin "nixGLMesaPrime" '' - ${envVarsAsScript mesaOffloadEnv} - exec ${getWrapperExe "Intel"} "$@" - '')) + mesaOffloadEnv = { + "DRI_PRIME" = "${cfg.prime.card}"; + }; - (lib.mkIf (wantsWrapper "nvidia") - (pkgs.writeShellScriptBin "nixGLNvidia" '' - exec ${getWrapperExe "Nvidia"} "$@" - '')) + nvOffloadEnv = + { + "DRI_PRIME" = "${cfg.prime.card}"; + "__NV_PRIME_RENDER_OFFLOAD" = "1"; + "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + "__VK_LAYER_NV_optimus" = "NVIDIA_only"; + } + // ( + let + provider = cfg.prime.nvidiaProvider; + in + if !isNull provider then + { + "__NV_PRIME_RENDER_OFFLOAD_PROVIDER" = "${provider}"; + } + else + { } + ); - (lib.mkIf (wantsWrapper "nvidia") - (pkgs.writeShellScriptBin "nixGLNvidiaPrime" '' - ${envVarsAsScript nvOffloadEnv} - exec ${getWrapperExe "Nvidia"} "$@" - '')) - ]; - }; + makePackageWrapper = + vendor: environment: pkg: + if builtins.isNull cfg.packages then + pkg + else + # Wrap the package's binaries with nixGL, while preserving the rest of + # the outputs and derivation attributes. + (pkg.overrideAttrs (old: { + name = "nixGL-${pkg.name}"; + + # Make sure this is false for the wrapper derivation, so nix doesn't expect + # a new debug output to be produced. We won't be producing any debug info + # for the original package. + separateDebugInfo = false; + nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ pkgs.makeWrapper ]; + buildCommand = + let + # We need an intermediate wrapper package because makeWrapper + # requires a single executable as the wrapper. + combinedWrapperPkg = pkgs.writeShellScriptBin "nixGLCombinedWrapper-${vendor}" '' + exec ${getWrapperExe vendor} "$@" + ''; + in + '' + set -eo pipefail + + ${ + # Heavily inspired by https://stackoverflow.com/a/68523368/6259505 + lib.concatStringsSep "\n" ( + map (outputName: '' + echo "Copying output ${outputName}" + set -x + cp -rs --no-preserve=mode "${pkg.${outputName}}" "''$${outputName}" + set +x + '') (old.outputs or [ "out" ]) + ) + } + + rm -rf $out/bin/* + shopt -s nullglob # Prevent loop from running if no files + for file in ${pkg.out}/bin/*; do + local prog="$(basename "$file")" + makeWrapper \ + "${lib.getExe combinedWrapperPkg}" \ + "$out/bin/$prog" \ + --argv0 "$prog" \ + --add-flags "$file" \ + ${lib.concatStringsSep " " ( + lib.attrsets.mapAttrsToList (var: val: "--set '${var}' '${val}'") environment + )} + done + + # If .desktop files refer to the old package, replace the references + for dsk in "$out/share/applications"/*.desktop ; do + if ! grep -q "${pkg.out}" "$dsk"; then + continue + fi + src="$(readlink "$dsk")" + rm "$dsk" + sed "s|${pkg.out}|$out|g" "$src" > "$dsk" + done + + shopt -u nullglob # Revert nullglob back to its normal default state + ''; + })) + // { + # When the nixGL-wrapped package is given to a HM module, the module + # might want to override the package arguments, but our wrapper + # wouldn't know what to do with them. So, we rewrite the override + # function to instead forward the arguments to the package's own + # override function. + override = args: makePackageWrapper vendor environment (pkg.override args); + }; + + wrappers = { + mesa = makePackageWrapper "Intel" { }; + mesaPrime = makePackageWrapper "Intel" mesaOffloadEnv; + nvidia = makePackageWrapper "Nvidia" { }; + nvidiaPrime = makePackageWrapper "Nvidia" nvOffloadEnv; + }; + in + { + lib.nixGL.wrap = wrappers.${cfg.defaultWrapper}; + lib.nixGL.wrapOffload = wrappers.${cfg.offloadWrapper}; + lib.nixGL.wrappers = wrappers; + + home.packages = + let + wantsPrimeWrapper = (!isNull cfg.prime.installScript); + wantsWrapper = + wrapper: + (!isNull cfg.packages) + && (!isNull cfg.installScripts) + && (builtins.elem wrapper cfg.installScripts); + envVarsAsScript = + environment: + lib.concatStringsSep "\n" ( + lib.attrsets.mapAttrsToList (var: val: "export ${var}=${val}") environment + ); + in + [ + (lib.mkIf wantsPrimeWrapper ( + pkgs.writeShellScriptBin "prime-offload" '' + ${ + if cfg.prime.installScript == "mesa" then + (envVarsAsScript mesaOffloadEnv) + else + (envVarsAsScript nvOffloadEnv) + } + exec "$@" + '' + )) + + (lib.mkIf (wantsWrapper "mesa") ( + pkgs.writeShellScriptBin "nixGLMesa" '' + exec ${getWrapperExe "Intel"} "$@" + '' + )) + + (lib.mkIf (wantsWrapper "mesaPrime") ( + pkgs.writeShellScriptBin "nixGLMesaPrime" '' + ${envVarsAsScript mesaOffloadEnv} + exec ${getWrapperExe "Intel"} "$@" + '' + )) + + (lib.mkIf (wantsWrapper "nvidia") ( + pkgs.writeShellScriptBin "nixGLNvidia" '' + exec ${getWrapperExe "Nvidia"} "$@" + '' + )) + + (lib.mkIf (wantsWrapper "nvidia") ( + pkgs.writeShellScriptBin "nixGLNvidiaPrime" '' + ${envVarsAsScript nvOffloadEnv} + exec ${getWrapperExe "Nvidia"} "$@" + '' + )) + ]; + }; } diff --git a/modules/misc/nixpkgs-disabled.nix b/modules/misc/nixpkgs-disabled.nix index b7e143d97..5388026ed 100644 --- a/modules/misc/nixpkgs-disabled.nix +++ b/modules/misc/nixpkgs-disabled.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let @@ -11,16 +16,22 @@ let optCall = f: x: if builtins.isFunction f then f x else f; # Copied from nixpkgs.nix. - mergeConfig = lhs_: rhs_: + mergeConfig = + lhs_: rhs_: let lhs = optCall lhs_ { inherit pkgs; }; rhs = optCall rhs_ { inherit pkgs; }; - in lhs // rhs // lib.optionalAttrs (lhs ? packageOverrides) { - packageOverrides = pkgs: - optCall lhs.packageOverrides pkgs - // optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs; - } // lib.optionalAttrs (lhs ? perlPackageOverrides) { - perlPackageOverrides = pkgs: + in + lhs + // rhs + // lib.optionalAttrs (lhs ? packageOverrides) { + packageOverrides = + pkgs: + optCall lhs.packageOverrides pkgs // optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs; + } + // lib.optionalAttrs (lhs ? perlPackageOverrides) { + perlPackageOverrides = + pkgs: optCall lhs.perlPackageOverrides pkgs // optCall (lib.attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs; }; @@ -29,9 +40,12 @@ let configType = lib.mkOptionType { name = "nixpkgs-config"; description = "nixpkgs config"; - check = x: - let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false; - in traceXIfNot isConfig; + check = + x: + let + traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false; + in + traceXIfNot isConfig; merge = args: lib.fold (def: mergeConfig def.value) { }; }; @@ -43,7 +57,8 @@ let merge = lib.mergeOneOption; }; -in { +in +{ meta.maintainers = with lib.maintainers; [ thiagokokada ]; options.nixpkgs = { diff --git a/modules/misc/nixpkgs.nix b/modules/misc/nixpkgs.nix index b21e97db9..d6963610b 100644 --- a/modules/misc/nixpkgs.nix +++ b/modules/misc/nixpkgs.nix @@ -1,6 +1,12 @@ # Adapted from Nixpkgs. -{ config, lib, pkgs, pkgsPath, ... }: +{ + config, + lib, + pkgs, + pkgsPath, + ... +}: let @@ -8,16 +14,22 @@ let optCall = f: x: if builtins.isFunction f then f x else f; - mergeConfig = lhs_: rhs_: + mergeConfig = + lhs_: rhs_: let lhs = optCall lhs_ { inherit pkgs; }; rhs = optCall rhs_ { inherit pkgs; }; - in lhs // rhs // lib.optionalAttrs (lhs ? packageOverrides) { - packageOverrides = pkgs: - optCall lhs.packageOverrides pkgs - // optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs; - } // lib.optionalAttrs (lhs ? perlPackageOverrides) { - perlPackageOverrides = pkgs: + in + lhs + // rhs + // lib.optionalAttrs (lhs ? packageOverrides) { + packageOverrides = + pkgs: + optCall lhs.packageOverrides pkgs // optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs; + } + // lib.optionalAttrs (lhs ? perlPackageOverrides) { + perlPackageOverrides = + pkgs: optCall lhs.perlPackageOverrides pkgs // optCall (lib.attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs; }; @@ -25,9 +37,12 @@ let configType = lib.mkOptionType { name = "nixpkgs-config"; description = "nixpkgs config"; - check = x: - let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false; - in traceXIfNot isConfig; + check = + x: + let + traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false; + in + traceXIfNot isConfig; merge = args: lib.fold (def: mergeConfig def.value) { }; }; @@ -40,11 +55,14 @@ let _pkgs = import pkgsPath (lib.filterAttrs (n: v: v != null) config.nixpkgs); -in { +in +{ options.nixpkgs = { config = lib.mkOption { default = null; - example = { allowBroken = true; }; + example = { + allowBroken = true; + }; type = lib.types.nullOr configType; description = '' The configuration of the Nix Packages collection. (For @@ -123,10 +141,7 @@ in { # `_pkgs`, see https://github.com/nix-community/home-manager/pull/993 pkgs = lib.mkOverride lib.modules.defaultOverridePriority _pkgs; pkgs_i686 = - if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86 then - _pkgs.pkgsi686Linux - else - { }; + if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86 then _pkgs.pkgsi686Linux else { }; }; }; } diff --git a/modules/misc/numlock.nix b/modules/misc/numlock.nix index e453a0951..e5de2c4dc 100644 --- a/modules/misc/numlock.nix +++ b/modules/misc/numlock.nix @@ -1,18 +1,25 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.xsession.numlock; -in { +in +{ meta.maintainers = [ lib.maintainers.evanjs ]; - options = { xsession.numlock.enable = lib.mkEnableOption "Num Lock"; }; + options = { + xsession.numlock.enable = lib.mkEnableOption "Num Lock"; + }; config = lib.mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "xsession.numlock" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "xsession.numlock" pkgs lib.platforms.linux) ]; systemd.user.services.numlockx = { @@ -28,7 +35,9 @@ in { ExecStart = "${pkgs.numlockx}/bin/numlockx"; }; - Install = { WantedBy = [ "graphical-session.target" ]; }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; }; }; } diff --git a/modules/misc/pam.nix b/modules/misc/pam.nix index bf0af355f..0f157b0a3 100644 --- a/modules/misc/pam.nix +++ b/modules/misc/pam.nix @@ -4,14 +4,20 @@ let cfg = config.pam; -in { - meta.maintainers = with lib.maintainers; [ rycee veehaitch ]; +in +{ + meta.maintainers = with lib.maintainers; [ + rycee + veehaitch + ]; options = { pam.sessionVariables = lib.mkOption { default = { }; type = lib.types.attrs; - example = { EDITOR = "vim"; }; + example = { + EDITOR = "vim"; + }; description = '' Environment variables that will be set for the PAM session. The variable values must be as described in @@ -24,13 +30,15 @@ in { pam.yubico.authorizedYubiKeys = { ids = lib.mkOption { - type = with lib.types; + type = + with lib.types; let yubiKeyId = addCheck str (s: lib.stringLength s == 12) // { name = "yubiKeyId"; description = "string of length 12"; }; - in listOf yubiKeyId; + in + listOf yubiKeyId; default = [ ]; description = '' List of authorized YubiKey token IDs. Refer to @@ -52,15 +60,17 @@ in { config = lib.mkMerge [ (lib.mkIf (cfg.sessionVariables != { }) { - home.file.".pam_environment".text = lib.concatStringsSep "\n" - (lib.mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'') - cfg.sessionVariables) + "\n"; + home.file.".pam_environment".text = + lib.concatStringsSep "\n" ( + lib.mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'') cfg.sessionVariables + ) + + "\n"; }) (lib.mkIf (cfg.yubico.authorizedYubiKeys.ids != [ ]) { - home.file.${cfg.yubico.authorizedYubiKeys.path}.text = - lib.concatStringsSep ":" - ([ config.home.username ] ++ cfg.yubico.authorizedYubiKeys.ids); + home.file.${cfg.yubico.authorizedYubiKeys.path}.text = lib.concatStringsSep ":" ( + [ config.home.username ] ++ cfg.yubico.authorizedYubiKeys.ids + ); }) ]; } diff --git a/modules/misc/qt.nix b/modules/misc/qt.nix index 41cd660fc..d93db205d 100644 --- a/modules/misc/qt.nix +++ b/modules/misc/qt.nix @@ -1,13 +1,27 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.qt; # Map platform names to their packages. platformPackages = with pkgs; { - gnome = [ qgnomeplatform qgnomeplatform-qt6 ]; - adwaita = [ qadwaitadecorations qadwaitadecorations-qt6 ]; - gtk = [ libsForQt5.qtstyleplugins qt6Packages.qt6gtk2 ]; + gnome = [ + qgnomeplatform + qgnomeplatform-qt6 + ]; + adwaita = [ + qadwaitadecorations + qadwaitadecorations-qt6 + ]; + gtk = [ + libsForQt5.qtstyleplugins + qt6Packages.qt6gtk2 + ]; kde = [ libsForQt5.kio libsForQt5.plasma-integration @@ -18,8 +32,14 @@ let kdePackages.plasma-integration kdePackages.systemsettings ]; - lxqt = [ lxqt.lxqt-qtplugin lxqt.lxqt-config ]; - qtct = [ libsForQt5.qt5ct qt6Packages.qt6ct ]; + lxqt = [ + lxqt.lxqt-qtplugin + lxqt.lxqt-config + ]; + qtct = [ + libsForQt5.qt5ct + qt6Packages.qt6ct + ]; }; # Maps style names to their QT_QPA_PLATFORMTHEME, if necessary. @@ -34,122 +54,181 @@ let bb10bright = libsForQt5.qtstyleplugins; bb10dark = libsForQt5.qtstyleplugins; cleanlooks = libsForQt5.qtstyleplugins; - gtk2 = [ libsForQt5.qtstyleplugins qt6Packages.qt6gtk2 ]; + gtk2 = [ + libsForQt5.qtstyleplugins + qt6Packages.qt6gtk2 + ]; motif = libsForQt5.qtstyleplugins; cde = libsForQt5.qtstyleplugins; plastique = libsForQt5.qtstyleplugins; - adwaita = [ adwaita-qt adwaita-qt6 ]; - adwaita-dark = [ adwaita-qt adwaita-qt6 ]; - adwaita-highcontrast = [ adwaita-qt adwaita-qt6 ]; - adwaita-highcontrastinverse = [ adwaita-qt adwaita-qt6 ]; + adwaita = [ + adwaita-qt + adwaita-qt6 + ]; + adwaita-dark = [ + adwaita-qt + adwaita-qt6 + ]; + adwaita-highcontrast = [ + adwaita-qt + adwaita-qt6 + ]; + adwaita-highcontrastinverse = [ + adwaita-qt + adwaita-qt6 + ]; breeze = libsForQt5.breeze-qt5; - kvantum = - [ libsForQt5.qtstyleplugin-kvantum qt6Packages.qtstyleplugin-kvantum ]; + kvantum = [ + libsForQt5.qtstyleplugin-kvantum + qt6Packages.qtstyleplugin-kvantum + ]; }; -in { - meta.maintainers = with lib.maintainers; [ rycee thiagokokada ]; +in +{ + meta.maintainers = with lib.maintainers; [ + rycee + thiagokokada + ]; imports = [ - (lib.mkChangedOptionModule [ "qt" "useGtkTheme" ] [ "qt" "platformTheme" ] - (config: - if lib.getAttrFromPath [ "qt" "useGtkTheme" ] config then - "gtk" - else - null)) + (lib.mkChangedOptionModule [ "qt" "useGtkTheme" ] [ "qt" "platformTheme" ] ( + config: if lib.getAttrFromPath [ "qt" "useGtkTheme" ] config then "gtk" else null + )) ]; options = { qt = { enable = lib.mkEnableOption "Qt 5 and 6 configuration"; - platformTheme = let - newOption = { - name = lib.mkOption { - type = with lib.types; nullOr str; - default = null; - example = "adwaita"; - relatedPackages = [ - "qgnomeplatform" - "qgnomeplatform-qt6" - "qadwaitadecorations" - "qadwaitadecorations-qt6" - [ "libsForQt5" "plasma-integration" ] - [ "libsForQt5" "qt5ct" ] - [ "libsForQt5" "qtstyleplugins" ] - [ "libsForQt5" "systemsettings" ] - [ "kdePackages" "plasma-integration" ] - [ "kdePackages" "systemsettings" ] - [ "lxqt" "lxqt-config" ] - [ "lxqt" "lxqt-qtplugin" ] - [ "qt6Packages" "qt6ct" ] - [ "qt6Packages" "qt6gtk2" ] - ]; - description = '' - Platform theme to use for Qt applications. + platformTheme = + let + newOption = { + name = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "adwaita"; + relatedPackages = [ + "qgnomeplatform" + "qgnomeplatform-qt6" + "qadwaitadecorations" + "qadwaitadecorations-qt6" + [ + "libsForQt5" + "plasma-integration" + ] + [ + "libsForQt5" + "qt5ct" + ] + [ + "libsForQt5" + "qtstyleplugins" + ] + [ + "libsForQt5" + "systemsettings" + ] + [ + "kdePackages" + "plasma-integration" + ] + [ + "kdePackages" + "systemsettings" + ] + [ + "lxqt" + "lxqt-config" + ] + [ + "lxqt" + "lxqt-qtplugin" + ] + [ + "qt6Packages" + "qt6ct" + ] + [ + "qt6Packages" + "qt6gtk2" + ] + ]; + description = '' + Platform theme to use for Qt applications. - Some examples are + Some examples are - `gtk` - : Use GTK theme with - [`qtstyleplugins`](https://github.com/qt/qtstyleplugins) + `gtk` + : Use GTK theme with + [`qtstyleplugins`](https://github.com/qt/qtstyleplugins) - `gtk3` - : Use [GTK3 integration](https://github.com/qt/qtbase/tree/dev/src/plugins/platformthemes/gtk3) - for file picker dialogs, font and theme configuration + `gtk3` + : Use [GTK3 integration](https://github.com/qt/qtbase/tree/dev/src/plugins/platformthemes/gtk3) + for file picker dialogs, font and theme configuration - `adwaita` - : Use Adwaita theme with - [`qadwaitadecorations`](https://github.com/FedoraQt/QAdwaitaDecorations) + `adwaita` + : Use Adwaita theme with + [`qadwaitadecorations`](https://github.com/FedoraQt/QAdwaitaDecorations) - `gnome` (deprecated) - : Use GNOME theme with - [`qgnomeplatform`](https://github.com/FedoraQt/QGnomePlatform). - Is no longer maintained so prefer `adwaita`. + `gnome` (deprecated) + : Use GNOME theme with + [`qgnomeplatform`](https://github.com/FedoraQt/QGnomePlatform). + Is no longer maintained so prefer `adwaita`. - `lxqt` - : Use LXQt theme style set using the - [`lxqt-config-appearance`](https://github.com/lxqt/lxqt-config) - application + `lxqt` + : Use LXQt theme style set using the + [`lxqt-config-appearance`](https://github.com/lxqt/lxqt-config) + application - `qtct` - : Use Qt style set using - [`qt5ct`](https://github.com/desktop-app/qt5ct) - and [`qt6ct`](https://github.com/trialuser02/qt6ct) - applications + `qtct` + : Use Qt style set using + [`qt5ct`](https://github.com/desktop-app/qt5ct) + and [`qt6ct`](https://github.com/trialuser02/qt6ct) + applications - `kde` - : Use Qt settings from Plasma 5 + `kde` + : Use Qt settings from Plasma 5 - `kde6` - : Use Qt settings from Plasma 6 - ''; - }; - package = lib.mkOption { - type = with lib.types; nullOr (either package (listOf package)); - default = null; - example = - lib.literalExpression "[pkgs.adwaita-qt pkgs.adwaita-qt6]"; - description = '' - Theme package to be used in Qt5/Qt6 applications. - Auto-detected from {option}`qt.platformTheme.name` if possible. - See its documentation for available options. - ''; + `kde6` + : Use Qt settings from Plasma 6 + ''; + }; + package = lib.mkOption { + type = with lib.types; nullOr (either package (listOf package)); + default = null; + example = lib.literalExpression "[pkgs.adwaita-qt pkgs.adwaita-qt6]"; + description = '' + Theme package to be used in Qt5/Qt6 applications. + Auto-detected from {option}`qt.platformTheme.name` if possible. + See its documentation for available options. + ''; + }; }; + in + lib.mkOption { + type = + with lib.types; + nullOr ( + either (enum [ + "gtk" + "gtk3" + "gnome" + "adwaita" + "lxqt" + "qtct" + "kde" + "kde6" + ]) (lib.types.submodule { options = newOption; }) + ); + default = null; + description = '' + Deprecated. Use {option}`qt.platformTheme.name` instead. + ''; }; - in lib.mkOption { - type = with lib.types; - nullOr (either - (enum [ "gtk" "gtk3" "gnome" "adwaita" "lxqt" "qtct" "kde" "kde6" ]) - (lib.types.submodule { options = newOption; })); - default = null; - description = '' - Deprecated. Use {option}`qt.platformTheme.name` instead. - ''; - }; style = { name = lib.mkOption { type = with lib.types; nullOr str; @@ -158,11 +237,26 @@ in { relatedPackages = [ "adwaita-qt" "adwaita-qt6" - [ "libsForQt5" "breeze-qt5" ] - [ "libsForQt5" "qtstyleplugin-kvantum" ] - [ "libsForQt5" "qtstyleplugins" ] - [ "qt6Packages" "qt6gtk2" ] - [ "qt6Packages" "qtstyleplugin-kvantum" ] + [ + "libsForQt5" + "breeze-qt5" + ] + [ + "libsForQt5" + "qtstyleplugin-kvantum" + ] + [ + "libsForQt5" + "qtstyleplugins" + ] + [ + "qt6Packages" + "qt6gtk2" + ] + [ + "qt6Packages" + "qtstyleplugin-kvantum" + ] ]; description = '' Style to use for Qt5/Qt6 applications. Case-insensitive. @@ -201,80 +295,103 @@ in { }; }; - config = let - platformTheme = if (builtins.isString cfg.platformTheme) then { - option = "qt.platformTheme"; - name = cfg.platformTheme; - package = null; - } else if cfg.platformTheme == null then { - option = null; - name = null; - package = null; - } else { - option = "qt.platformTheme.name"; - name = cfg.platformTheme.name; - package = cfg.platformTheme.package; + config = + let + platformTheme = + if (builtins.isString cfg.platformTheme) then + { + option = "qt.platformTheme"; + name = cfg.platformTheme; + package = null; + } + else if cfg.platformTheme == null then + { + option = null; + name = null; + package = null; + } + else + { + option = "qt.platformTheme.name"; + name = cfg.platformTheme.name; + package = cfg.platformTheme.package; + }; + + # Necessary because home.sessionVariables doesn't support mkIf + envVars = lib.filterAttrs (n: v: v != null) { + QT_QPA_PLATFORMTHEME = + if (platformTheme.name != null) then + styleNames.${platformTheme.name} or platformTheme.name + else + null; + QT_STYLE_OVERRIDE = cfg.style.name; + }; + + envVarsExtra = + let + inherit (config.home) profileDirectory; + qtVersions = with pkgs; [ + qt5 + qt6 + ]; + makeQtPath = prefix: (map (qt: "${profileDirectory}/${qt.qtbase.${prefix}}") qtVersions); + in + { + QT_PLUGIN_PATH = makeQtPath "qtPluginPrefix"; + QML2_IMPORT_PATH = makeQtPath "qtQmlPrefix"; + }; + + in + lib.mkIf cfg.enable { + assertions = [ + { + assertion = platformTheme.name == "gnome" -> cfg.style.name != null && cfg.style.package != null; + message = '' + `qt.platformTheme.name` "gnome" must have `qt.style` set to a theme that + supports both Qt and Gtk, for example "adwaita", "adwaita-dark", or "breeze". + ''; + } + ]; + + warnings = + (lib.lists.optional ( + platformTheme.option == "qt.platformTheme" + ) "The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`.") + ++ (lib.lists.optional ( + platformTheme.name == "gnome" && platformTheme.package == null + ) "The value `gnome` for option `${platformTheme.option}` is deprecated. Use `adwaita` instead."); + + qt.style.package = lib.mkIf (cfg.style.name != null) ( + lib.mkDefault (stylePackages.${lib.toLower cfg.style.name} or null) + ); + + home = { + sessionVariables = envVars; + sessionSearchVariables = envVarsExtra; + }; + + # Apply theming also to apps started by systemd. + systemd.user.sessionVariables = envVars // { + QT_PLUGIN_PATH = lib.concatStringsSep ":" envVarsExtra.QT_PLUGIN_PATH; + QML2_IMPORT_PATH = lib.concatStringsSep ":" envVarsExtra.QML2_IMPORT_PATH; + }; + + home.packages = + (lib.findFirst (x: x != [ ]) + [ ] + [ + (lib.optionals (platformTheme.package != null) (lib.toList platformTheme.package)) + (lib.optionals (platformTheme.name != null) platformPackages.${platformTheme.name} or [ ]) + ] + ) + ++ (lib.optionals (cfg.style.package != null) (lib.toList cfg.style.package)); + + xsession.importedVariables = + [ + "QT_PLUGIN_PATH" + "QML2_IMPORT_PATH" + ] + ++ lib.optionals (platformTheme.name != null) [ "QT_QPA_PLATFORMTHEME" ] + ++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ]; }; - - # Necessary because home.sessionVariables doesn't support mkIf - envVars = lib.filterAttrs (n: v: v != null) { - QT_QPA_PLATFORMTHEME = if (platformTheme.name != null) then - styleNames.${platformTheme.name} or platformTheme.name - else - null; - QT_STYLE_OVERRIDE = cfg.style.name; - }; - - envVarsExtra = let - inherit (config.home) profileDirectory; - qtVersions = with pkgs; [ qt5 qt6 ]; - makeQtPath = prefix: - (map (qt: "${profileDirectory}/${qt.qtbase.${prefix}}") qtVersions); - in { - QT_PLUGIN_PATH = makeQtPath "qtPluginPrefix"; - QML2_IMPORT_PATH = makeQtPath "qtQmlPrefix"; - }; - - in lib.mkIf cfg.enable { - assertions = [{ - assertion = platformTheme.name == "gnome" -> cfg.style.name != null - && cfg.style.package != null; - message = '' - `qt.platformTheme.name` "gnome" must have `qt.style` set to a theme that - supports both Qt and Gtk, for example "adwaita", "adwaita-dark", or "breeze". - ''; - }]; - - warnings = (lib.lists.optional (platformTheme.option == "qt.platformTheme") - "The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`.") - ++ (lib.lists.optional - (platformTheme.name == "gnome" && platformTheme.package == null) - "The value `gnome` for option `${platformTheme.option}` is deprecated. Use `adwaita` instead."); - - qt.style.package = lib.mkIf (cfg.style.name != null) - (lib.mkDefault (stylePackages.${lib.toLower cfg.style.name} or null)); - - home = { - sessionVariables = envVars; - sessionSearchVariables = envVarsExtra; - }; - - # Apply theming also to apps started by systemd. - systemd.user.sessionVariables = envVars // { - QT_PLUGIN_PATH = lib.concatStringsSep ":" envVarsExtra.QT_PLUGIN_PATH; - QML2_IMPORT_PATH = lib.concatStringsSep ":" envVarsExtra.QML2_IMPORT_PATH; - }; - - home.packages = (lib.findFirst (x: x != [ ]) [ ] [ - (lib.optionals (platformTheme.package != null) - (lib.toList platformTheme.package)) - (lib.optionals (platformTheme.name != null) - platformPackages.${platformTheme.name} or [ ]) - ]) ++ (lib.optionals (cfg.style.package != null) - (lib.toList cfg.style.package)); - - xsession.importedVariables = [ "QT_PLUGIN_PATH" "QML2_IMPORT_PATH" ] - ++ lib.optionals (platformTheme.name != null) [ "QT_QPA_PLATFORMTHEME" ] - ++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ]; - }; } diff --git a/modules/misc/qt/kconfig.nix b/modules/misc/qt/kconfig.nix index 76bf7c686..9c8260d85 100644 --- a/modules/misc/qt/kconfig.nix +++ b/modules/misc/qt/kconfig.nix @@ -1,17 +1,33 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.qt.kde.settings; -in { +in +{ options.qt.kde.settings = lib.mkOption { - type = with lib.types; + type = + with lib.types; let valueType = - nullOr (oneOf [ bool int float str path (attrsOf valueType) ]) // { + nullOr (oneOf [ + bool + int + float + str + path + (attrsOf valueType) + ]) + // { description = "KDE option value"; }; - in attrsOf valueType; + in + attrsOf valueType; default = { }; example = { powermanagementprofilesrc.AC.HandleButtonEvents.lidAction = 32; @@ -38,28 +54,32 @@ in { config = lib.mkIf (cfg != { }) { home.activation.kconfig = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - ${let - inherit (config.xdg) configHome; - toValue = v: - let t = builtins.typeOf v; - in if v == null then - "--delete" - else if t == "bool" then - "--type bool ${builtins.toJSON v}" - else - lib.escapeShellArg (toString v); - toLine = file: path: value: - if builtins.isAttrs value then - lib.mapAttrsToList - (group: value: toLine file (path ++ [ group ]) value) value - else - "run ${pkgs.kdePackages.kconfig}/bin/kwriteconfig6 --file '${configHome}/${file}' ${ - lib.concatMapStringsSep " " (x: "--group ${x}") - (lib.lists.init path) - } --key '${lib.lists.last path}' ${toValue value}"; - lines = lib.flatten - (lib.mapAttrsToList (file: attrs: toLine file [ ] attrs) cfg); - in builtins.concatStringsSep "\n" lines} + ${ + let + inherit (config.xdg) configHome; + toValue = + v: + let + t = builtins.typeOf v; + in + if v == null then + "--delete" + else if t == "bool" then + "--type bool ${builtins.toJSON v}" + else + lib.escapeShellArg (toString v); + toLine = + file: path: value: + if builtins.isAttrs value then + lib.mapAttrsToList (group: value: toLine file (path ++ [ group ]) value) value + else + "run ${pkgs.kdePackages.kconfig}/bin/kwriteconfig6 --file '${configHome}/${file}' ${ + lib.concatMapStringsSep " " (x: "--group ${x}") (lib.lists.init path) + } --key '${lib.lists.last path}' ${toValue value}"; + lines = lib.flatten (lib.mapAttrsToList (file: attrs: toLine file [ ] attrs) cfg); + in + builtins.concatStringsSep "\n" lines + } # TODO: some way to only call the dbus calls needed run ${pkgs.kdePackages.qttools}/bin/qdbus org.kde.KWin /KWin reconfigure || echo "KWin reconfigure failed" diff --git a/modules/misc/specialisation.nix b/modules/misc/specialisation.nix index 95adc998f..de07bc1bd 100644 --- a/modules/misc/specialisation.nix +++ b/modules/misc/specialisation.nix @@ -1,36 +1,47 @@ -{ config, name, extendModules, lib, ... }: +{ + config, + name, + extendModules, + lib, + ... +}: { - imports = - [ (lib.mkRenamedOptionModule [ "specialization" ] [ "specialisation" ]) ]; + imports = [ (lib.mkRenamedOptionModule [ "specialization" ] [ "specialisation" ]) ]; options.specialisation = lib.mkOption { - type = lib.types.attrsOf (lib.types.submodule { - options = { - configuration = lib.mkOption { - type = let - extended = extendModules { - modules = [{ - # Prevent infinite recursion - specialisation = lib.mkOverride 0 { }; + type = lib.types.attrsOf ( + lib.types.submodule { + options = { + configuration = lib.mkOption { + type = + let + extended = extendModules { + modules = [ + { + # Prevent infinite recursion + specialisation = lib.mkOverride 0 { }; - # If used inside the NixOS/nix-darwin module, we get conflicting definitions - # of `name` inside the specialisation: one is the user name coming from the - # NixOS module definition and the other is `configuration`, the name of this - # option. Thus we need to explicitly wire the former into the module arguments. - # See discussion at https://github.com/nix-community/home-manager/issues/3716 - _module.args.name = lib.mkForce name; - }]; - }; - in extended.type; - default = { }; - visible = "shallow"; - description = '' - Arbitrary Home Manager configuration settings. - ''; + # If used inside the NixOS/nix-darwin module, we get conflicting definitions + # of `name` inside the specialisation: one is the user name coming from the + # NixOS module definition and the other is `configuration`, the name of this + # option. Thus we need to explicitly wire the former into the module arguments. + # See discussion at https://github.com/nix-community/home-manager/issues/3716 + _module.args.name = lib.mkForce name; + } + ]; + }; + in + extended.type; + default = { }; + visible = "shallow"; + description = '' + Arbitrary Home Manager configuration settings. + ''; + }; }; - }; - }); + } + ); default = { }; description = '' A set of named specialized configurations. These can be used to extend @@ -71,18 +82,21 @@ config = lib.mkIf (config.specialisation != { }) { assertions = map (n: { assertion = !lib.hasInfix "/" n; - message = - " in specialisation. cannot contain a forward slash."; + message = " in specialisation. cannot contain a forward slash."; }) (lib.attrNames config.specialisation); - home.extraBuilderCommands = let - link = n: v: - let pkg = v.configuration.home.activationPackage; - in "ln -s ${pkg} $out/specialisation/${lib.escapeShellArg n}"; - in '' - mkdir $out/specialisation - ${lib.concatStringsSep "\n" - (lib.mapAttrsToList link config.specialisation)} - ''; + home.extraBuilderCommands = + let + link = + n: v: + let + pkg = v.configuration.home.activationPackage; + in + "ln -s ${pkg} $out/specialisation/${lib.escapeShellArg n}"; + in + '' + mkdir $out/specialisation + ${lib.concatStringsSep "\n" (lib.mapAttrsToList link config.specialisation)} + ''; }; } diff --git a/modules/misc/tmpfiles.nix b/modules/misc/tmpfiles.nix index f9debf543..d4cfa98b6 100644 --- a/modules/misc/tmpfiles.nix +++ b/modules/misc/tmpfiles.nix @@ -1,10 +1,16 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.systemd.user.tmpfiles; -in { +in +{ meta.maintainers = [ lib.maintainers.dawidsowa ]; options.systemd.user.tmpfiles.rules = lib.mkOption { @@ -21,8 +27,7 @@ in { config = lib.mkIf (cfg.rules != [ ]) { assertions = [ - (lib.hm.assertions.assertPlatform "systemd.user.tmpfiles" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "systemd.user.tmpfiles" pkgs lib.platforms.linux) ]; xdg.configFile = { diff --git a/modules/misc/uninstall.nix b/modules/misc/uninstall.nix index 4fe26326e..68cb93408 100644 --- a/modules/misc/uninstall.nix +++ b/modules/misc/uninstall.nix @@ -4,7 +4,8 @@ let inherit (lib) mkIf mkOption types; -in { +in +{ options.uninstall = mkOption { type = types.bool; default = false; @@ -26,25 +27,24 @@ in { manual.manpages.enable = lib.mkForce false; news.display = lib.mkForce "silent"; - home.activation.uninstall = - lib.hm.dag.entryAfter [ "installPackages" "linkGeneration" ] '' - nixProfileRemove home-manager-path + home.activation.uninstall = lib.hm.dag.entryAfter [ "installPackages" "linkGeneration" ] '' + nixProfileRemove home-manager-path - if [[ -e $hmDataPath ]]; then - run rm $VERBOSE_ARG -r "$hmDataPath" - fi + if [[ -e $hmDataPath ]]; then + run rm $VERBOSE_ARG -r "$hmDataPath" + fi - if [[ -e $hmStatePath ]]; then - run rm $VERBOSE_ARG -r "$hmStatePath" - fi + if [[ -e $hmStatePath ]]; then + run rm $VERBOSE_ARG -r "$hmStatePath" + fi - if [[ -e $genProfilePath ]]; then - run rm $VERBOSE_ARG "$genProfilePath"* - fi + if [[ -e $genProfilePath ]]; then + run rm $VERBOSE_ARG "$genProfilePath"* + fi - if [[ -e $legacyGenGcPath ]]; then - run rm $VERBOSE_ARG "$legacyGenGcPath" - fi - ''; + if [[ -e $legacyGenGcPath ]]; then + run rm $VERBOSE_ARG "$legacyGenGcPath" + fi + ''; }; } diff --git a/modules/misc/version.nix b/modules/misc/version.nix index 3c7317360..80c5b7097 100644 --- a/modules/misc/version.nix +++ b/modules/misc/version.nix @@ -5,7 +5,8 @@ let releaseInfo = lib.importJSON ../../release.json; -in { +in +{ options = { home.stateVersion = lib.mkOption { type = types.enum [ @@ -44,11 +45,12 @@ in { internal = true; readOnly = true; type = types.str; - default = let - inherit (config.home.version) release revision; - suffix = lib.optionalString (revision != null) - "+${lib.substring 0 8 revision}"; - in "${release}${suffix}"; + default = + let + inherit (config.home.version) release revision; + suffix = lib.optionalString (revision != null) "+${lib.substring 0 8 revision}"; + in + "${release}${suffix}"; example = "22.11+213a0629"; description = "The full Home Manager version."; }; @@ -76,11 +78,11 @@ in { revision = lib.mkOption { internal = true; type = types.nullOr types.str; - default = let gitRepo = "${toString ./../..}/.git"; - in if lib.pathIsGitRepo gitRepo then - lib.commitIdFromGitRepo gitRepo - else - null; + default = + let + gitRepo = "${toString ./../..}/.git"; + in + if lib.pathIsGitRepo gitRepo then lib.commitIdFromGitRepo gitRepo else null; description = '' The Git revision from which this Home Manager configuration was built. ''; diff --git a/modules/misc/vte.nix b/modules/misc/vte.nix index 09862b41b..a4c0b8c90 100644 --- a/modules/misc/vte.nix +++ b/modules/misc/vte.nix @@ -1,23 +1,30 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { meta.maintainers = [ lib.maintainers.rycee ]; - options.programs = let - description = '' - Whether to enable integration with terminals using the VTE - library. This will let the terminal track the current working - directory. - ''; - in { - bash.enableVteIntegration = lib.mkEnableOption "" // { - inherit description; - }; + options.programs = + let + description = '' + Whether to enable integration with terminals using the VTE + library. This will let the terminal track the current working + directory. + ''; + in + { + bash.enableVteIntegration = lib.mkEnableOption "" // { + inherit description; + }; - zsh.enableVteIntegration = lib.mkEnableOption "" // { - inherit description; + zsh.enableVteIntegration = lib.mkEnableOption "" // { + inherit description; + }; }; - }; config = lib.mkMerge [ (lib.mkIf config.programs.bash.enableVteIntegration { diff --git a/modules/misc/xdg-autostart.nix b/modules/misc/xdg-autostart.nix index d99b58a88..72f84bce6 100644 --- a/modules/misc/xdg-autostart.nix +++ b/modules/misc/xdg-autostart.nix @@ -1,7 +1,23 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (builtins) baseNameOf listToAttrs map unsafeDiscardStringContext; - inherit (lib) literalExpression mkEnableOption mkIf mkOption types; + inherit (builtins) + baseNameOf + listToAttrs + map + unsafeDiscardStringContext + ; + inherit (lib) + literalExpression + mkEnableOption + mkIf + mkOption + types + ; cfg = config.xdg.autostart; @@ -10,7 +26,8 @@ let ${lib.concatMapStringsSep "\n" (e: "ln -s ${e} $out") cfg.entries} ''; -in { +in +{ meta.maintainers = with lib.maintainers; [ Scrumplex ]; options.xdg.autostart = { diff --git a/modules/misc/xdg-desktop-entries.nix b/modules/misc/xdg-desktop-entries.nix index 1bc3ef6b5..c3e6d296f 100644 --- a/modules/misc/xdg-desktop-entries.nix +++ b/modules/misc/xdg-desktop-entries.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) literalExpression mkOption types; @@ -6,9 +11,9 @@ let desktopEntry = { imports = [ (lib.mkRemovedOptionModule [ "extraConfig" ] - "The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.") - (lib.mkRemovedOptionModule [ "fileValidation" ] - "Validation of the desktop file is always enabled.") + "The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs." + ) + (lib.mkRemovedOptionModule [ "fileValidation" ] "Validation of the desktop file is always enabled.") ]; options = { # Since this module uses the nixpkgs/pkgs/build-support/make-desktopitem function, @@ -28,7 +33,11 @@ let type = mkOption { description = "The type of the desktop entry."; default = "Application"; - type = types.enum [ "Application" "Link" "Directory" ]; + type = types.enum [ + "Application" + "Link" + "Directory" + ]; }; exec = mkOption { @@ -73,8 +82,7 @@ let }; categories = mkOption { - description = - "Categories in which the entry should be shown in a menu."; + description = "Categories in which the entry should be shown in a menu."; type = types.nullOr (types.listOf types.str); default = null; }; @@ -122,24 +130,29 @@ let }; actions = mkOption { - type = types.attrsOf (types.submodule ({ name, ... }: { - options.name = mkOption { - type = types.str; - default = name; - defaultText = literalExpression ""; - description = "Name of the action."; - }; - options.exec = mkOption { - type = types.nullOr types.str; - description = "Program to execute, possibly with arguments."; - default = null; - }; - options.icon = mkOption { - type = with types; nullOr (either str path); - default = null; - description = "Icon to display in file manager, menus, etc."; - }; - })); + type = types.attrsOf ( + types.submodule ( + { name, ... }: + { + options.name = mkOption { + type = types.str; + default = name; + defaultText = literalExpression ""; + description = "Name of the action."; + }; + options.exec = mkOption { + type = types.nullOr types.str; + description = "Program to execute, possibly with arguments."; + default = null; + }; + options.icon = mkOption { + type = with types; nullOr (either str path); + default = null; + description = "Icon to display in file manager, menus, etc."; + }; + } + ) + ); default = { }; defaultText = literalExpression "{ }"; example = literalExpression '' @@ -149,8 +162,7 @@ let }; } ''; - description = - "The set of actions made available to application launchers."; + description = "The set of actions made available to application launchers."; }; # Required for the assertions @@ -165,18 +177,29 @@ let }; #passes config options to makeDesktopItem in expected format - makeFile = name: config: + makeFile = + name: config: pkgs.makeDesktopItem { inherit name; inherit (config) - type exec icon comment terminal genericName startupNotify noDisplay - prefersNonDefaultGPU actions; + type + exec + icon + comment + terminal + genericName + startupNotify + noDisplay + prefersNonDefaultGPU + actions + ; desktopName = config.name; mimeTypes = lib.optionals (config.mimeType != null) config.mimeType; categories = lib.optionals (config.categories != null) config.categories; extraConfig = config.settings; }; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.cwyc ]; options.xdg.desktopEntries = mkOption { @@ -205,14 +228,13 @@ in { config = lib.mkIf (config.xdg.desktopEntries != { }) { assertions = [ - (lib.hm.assertions.assertPlatform "xdg.desktopEntries" pkgs - lib.platforms.linux) - ] ++ lib.flatten - (lib.catAttrs "assertions" (lib.attrValues config.xdg.desktopEntries)); + (lib.hm.assertions.assertPlatform "xdg.desktopEntries" pkgs lib.platforms.linux) + ] ++ lib.flatten (lib.catAttrs "assertions" (lib.attrValues config.xdg.desktopEntries)); - home.packages = - (map lib.hiPrio # we need hiPrio to override existing entries - (lib.attrsets.mapAttrsToList makeFile config.xdg.desktopEntries)); + home.packages = ( + map lib.hiPrio # we need hiPrio to override existing entries + (lib.attrsets.mapAttrsToList makeFile config.xdg.desktopEntries) + ); }; } diff --git a/modules/misc/xdg-mime-apps.nix b/modules/misc/xdg-mime-apps.nix index 6efa43b11..b35eb1c6f 100644 --- a/modules/misc/xdg-mime-apps.nix +++ b/modules/misc/xdg-mime-apps.nix @@ -1,14 +1,19 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkOption types; cfg = config.xdg.mimeApps; - strListOrSingleton = with types; - coercedTo (either (listOf str) str) lib.toList (listOf str); + strListOrSingleton = with types; coercedTo (either (listOf str) str) lib.toList (listOf str); -in { +in +{ meta.maintainers = with lib.maintainers; [ euxane ]; options.xdg.mimeApps = { @@ -44,7 +49,9 @@ in { associations.removed = mkOption { type = types.attrsOf strListOrSingleton; default = { }; - example = { "mimetype1" = "foo5.desktop"; }; + example = { + "mimetype1" = "foo5.desktop"; + }; description = '' Removes associations of applications with mimetypes, as if the .desktop file was *not* listing this @@ -75,43 +82,47 @@ in { # Given a package that installs .desktop files in the usual location, # return a mapping from mime types to lists of desktop file names. This is # suitable for use with `xdg.mimeApps.defaultApplications`. - lib.xdg.mimeAssociations = let - processLines = str: - lib.zipAttrs (lib.filter (e: e != null) - (map processLine (lib.splitString "\n" str))); + lib.xdg.mimeAssociations = + let + processLines = + str: lib.zipAttrs (lib.filter (e: e != null) (map processLine (lib.splitString "\n" str))); - processLine = str: - let - entry = lib.splitString ";" str; - k = lib.elemAt entry 0; - v = lib.elemAt entry 1; - in if lib.length entry == 2 then { ${k} = v; } else null; + processLine = + str: + let + entry = lib.splitString ";" str; + k = lib.elemAt entry 0; + v = lib.elemAt entry 1; + in + if lib.length entry == 2 then { ${k} = v; } else null; - associations = ps: - pkgs.runCommand "mime-assoc" { inherit ps; } '' - for p in $ps ; do - for path in "$p"/share/applications/*.desktop ; do - name="''${path##*/}" - sed -n -E "/^MimeType=/ { s/.*=//; s/;?$|;/;$name\n/g; p; }" "$path" - done - done > "$out" - ''; - in p: processLines (builtins.readFile (associations p)); + associations = + ps: + pkgs.runCommand "mime-assoc" { inherit ps; } '' + for p in $ps ; do + for path in "$p"/share/applications/*.desktop ; do + name="''${path##*/}" + sed -n -E "/^MimeType=/ { s/.*=//; s/;?$|;/;$name\n/g; p; }" "$path" + done + done > "$out" + ''; + in + p: processLines (builtins.readFile (associations p)); } (lib.mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "xdg.mimeApps" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "xdg.mimeApps" pkgs lib.platforms.linux) ]; # Deprecated but still used by some applications. - xdg.dataFile."applications/mimeapps.list".source = - config.xdg.configFile."mimeapps.list".source; + xdg.dataFile."applications/mimeapps.list".source = config.xdg.configFile."mimeapps.list".source; xdg.configFile."mimeapps.list".text = - let joinValues = lib.mapAttrs (n: lib.concatStringsSep ";"); - in lib.generators.toINI { } { + let + joinValues = lib.mapAttrs (n: lib.concatStringsSep ";"); + in + lib.generators.toINI { } { "Added Associations" = joinValues cfg.associations.added; "Removed Associations" = joinValues cfg.associations.removed; "Default Applications" = joinValues cfg.defaultApplications; diff --git a/modules/misc/xdg-mime.nix b/modules/misc/xdg-mime.nix index fa22f96df..5a5cb600d 100644 --- a/modules/misc/xdg-mime.nix +++ b/modules/misc/xdg-mime.nix @@ -1,19 +1,29 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.xdg.mime; - inherit (lib) getExe getExe' mkOption types; + inherit (lib) + getExe + getExe' + mkOption + types + ; -in { +in +{ options = { xdg.mime = { enable = mkOption { type = types.bool; default = pkgs.stdenv.hostPlatform.isLinux; - defaultText = lib.literalExpression - "true if host platform is Linux, false otherwise"; + defaultText = lib.literalExpression "true if host platform is Linux, false otherwise"; description = '' Whether to install programs and files to support the XDG Shared MIME-info specification and XDG MIME Applications @@ -36,8 +46,7 @@ in { type = types.package; default = pkgs.desktop-file-utils; defaultText = lib.literalExpression "pkgs.desktop-file-utils"; - description = - "The package to use when running update-desktop-database."; + description = "The package to use when running update-desktop-database."; }; }; }; @@ -64,16 +73,14 @@ in { XDG_DATA_DIRS=$out/share \ PKGSYSTEM_ENABLE_FSYNC=0 \ ${ - getExe - (cfg.sharedMimeInfoPackage.__spliced.buildHost or cfg.sharedMimeInfoPackage) + getExe (cfg.sharedMimeInfoPackage.__spliced.buildHost or cfg.sharedMimeInfoPackage) } -V $out/share/mime > /dev/null fi if [[ -w $out/share/applications ]]; then ${ - getExe' - (cfg.desktopFileUtilsPackage.__spliced.buildHost or cfg.desktopFileUtilsPackage) - "update-desktop-database" + getExe' (cfg.desktopFileUtilsPackage.__spliced.buildHost or cfg.desktopFileUtilsPackage + ) "update-desktop-database" } $out/share/applications fi ''; diff --git a/modules/misc/xdg-portal.nix b/modules/misc/xdg-portal.nix index 742b324b7..5b24f251c 100644 --- a/modules/misc/xdg-portal.nix +++ b/modules/misc/xdg-portal.nix @@ -1,14 +1,26 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let - inherit (lib) mkIf mkMerge mkOption optional types; + inherit (lib) + mkIf + mkMerge + mkOption + optional + types + ; - associationOptions = with types; - attrsOf (coercedTo (either (listOf str) str) - (x: lib.concatStringsSep ";" (lib.toList x)) str); + associationOptions = + with types; + attrsOf (coercedTo (either (listOf str) str) (x: lib.concatStringsSep ";" (lib.toList x)) str); -in { +in +{ meta.maintainers = [ lib.maintainers.misterio77 ]; options.xdg.portal = { @@ -63,12 +75,22 @@ in { type = types.attrsOf associationOptions; default = { }; example = { - x-cinnamon = { default = [ "xapp" "gtk" ]; }; + x-cinnamon = { + default = [ + "xapp" + "gtk" + ]; + }; pantheon = { - default = [ "pantheon" "gtk" ]; + default = [ + "pantheon" + "gtk" + ]; "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; }; - common = { default = [ "gtk" ]; }; + common = { + default = [ "gtk" ]; + }; }; description = '' Sets which portal backend should be used to provide the implementation @@ -97,51 +119,53 @@ in { }; }; - config = let - cfg = config.xdg.portal; - packages = [ pkgs.xdg-desktop-portal ] ++ cfg.extraPortals; - portalsDir = - "${config.home.profileDirectory}/share/xdg-desktop-portal/portals"; - in mkIf cfg.enable { - warnings = optional (cfg.configPackages == [ ] && cfg.config == { }) '' - xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you - should either set `xdg.portal.config` or `xdg.portal.configPackages` - to specify which portal backend to use for the requested interface. + config = + let + cfg = config.xdg.portal; + packages = [ pkgs.xdg-desktop-portal ] ++ cfg.extraPortals; + portalsDir = "${config.home.profileDirectory}/share/xdg-desktop-portal/portals"; + in + mkIf cfg.enable { + warnings = optional (cfg.configPackages == [ ] && cfg.config == { }) '' + xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you + should either set `xdg.portal.config` or `xdg.portal.configPackages` + to specify which portal backend to use for the requested interface. - https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in + https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in - If you simply want to keep the behaviour in < 1.17, which uses the first - portal implementation found in lexicographical order, use the following: + If you simply want to keep the behaviour in < 1.17, which uses the first + portal implementation found in lexicographical order, use the following: - xdg.portal.config.common.default = "*"; - ''; + xdg.portal.config.common.default = "*"; + ''; - assertions = [ - (lib.hm.assertions.assertPlatform "xdg.portal" pkgs lib.platforms.linux) + assertions = [ + (lib.hm.assertions.assertPlatform "xdg.portal" pkgs lib.platforms.linux) - { - assertion = cfg.extraPortals != [ ]; - message = - "Setting xdg.portal.enable to true requires a portal implementation in xdg.portal.extraPortals such as xdg-desktop-portal-gtk or xdg-desktop-portal-kde."; - } - ]; - - home = { - packages = packages ++ cfg.configPackages; - sessionVariables = mkMerge [ - (mkIf cfg.xdgOpenUsePortal { NIXOS_XDG_OPEN_USE_PORTAL = "1"; }) - { NIX_XDG_DESKTOP_PORTAL_DIR = portalsDir; } + { + assertion = cfg.extraPortals != [ ]; + message = "Setting xdg.portal.enable to true requires a portal implementation in xdg.portal.extraPortals such as xdg-desktop-portal-gtk or xdg-desktop-portal-kde."; + } ]; - }; - systemd.user.sessionVariables = { - NIX_XDG_DESKTOP_PORTAL_DIR = portalsDir; - }; - xdg.configFile = lib.concatMapAttrs (desktop: conf: - lib.optionalAttrs (conf != { }) { - "xdg-desktop-portal/${ - lib.optionalString (desktop != "common") "${desktop}-" - }portals.conf".text = lib.generators.toINI { } { preferred = conf; }; - }) cfg.config; - }; + home = { + packages = packages ++ cfg.configPackages; + sessionVariables = mkMerge [ + (mkIf cfg.xdgOpenUsePortal { NIXOS_XDG_OPEN_USE_PORTAL = "1"; }) + { NIX_XDG_DESKTOP_PORTAL_DIR = portalsDir; } + ]; + }; + systemd.user.sessionVariables = { + NIX_XDG_DESKTOP_PORTAL_DIR = portalsDir; + }; + + xdg.configFile = lib.concatMapAttrs ( + desktop: conf: + lib.optionalAttrs (conf != { }) { + "xdg-desktop-portal/${lib.optionalString (desktop != "common") "${desktop}-"}portals.conf".text = + lib.generators.toINI { } + { preferred = conf; }; + } + ) cfg.config; + }; } diff --git a/modules/misc/xdg-system-dirs.nix b/modules/misc/xdg-system-dirs.nix index d02cff71d..e24a3ba5a 100644 --- a/modules/misc/xdg-system-dirs.nix +++ b/modules/misc/xdg-system-dirs.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) types; @@ -9,7 +14,8 @@ let dataDirs = lib.concatStringsSep ":" cfg.data; -in { +in +{ meta.maintainers = with lib.maintainers; [ tadfisher ]; options.xdg.systemDirs = { @@ -37,25 +43,20 @@ in { config = lib.mkMerge [ (lib.mkIf (cfg.config != [ ] || cfg.data != [ ]) { assertions = [ - (lib.hm.assertions.assertPlatform "xdg.systemDirs" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "xdg.systemDirs" pkgs lib.platforms.linux) ]; }) (lib.mkIf (cfg.config != [ ]) { - home.sessionVariables.XDG_CONFIG_DIRS = - "${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}"; + home.sessionVariables.XDG_CONFIG_DIRS = "${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}"; - systemd.user.sessionVariables.XDG_CONFIG_DIRS = - "${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}"; + systemd.user.sessionVariables.XDG_CONFIG_DIRS = "${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}"; }) (lib.mkIf (cfg.data != [ ]) { - home.sessionVariables.XDG_DATA_DIRS = - "${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"; + home.sessionVariables.XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"; - systemd.user.sessionVariables.XDG_DATA_DIRS = - "${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"; + systemd.user.sessionVariables.XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"; }) ]; } diff --git a/modules/misc/xdg-user-dirs.nix b/modules/misc/xdg-user-dirs.nix index b693118ad..e3d3db544 100644 --- a/modules/misc/xdg-user-dirs.nix +++ b/modules/misc/xdg-user-dirs.nix @@ -1,19 +1,28 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) literalExpression mkOption types; cfg = config.xdg.userDirs; -in { +in +{ meta.maintainers = with lib.maintainers; [ euxane ]; imports = [ - (lib.mkRenamedOptionModule [ "xdg" "userDirs" "publishShare" ] [ - "xdg" - "userDirs" - "publicShare" - ]) + (lib.mkRenamedOptionModule + [ "xdg" "userDirs" "publishShare" ] + [ + "xdg" + "userDirs" + "publicShare" + ] + ) ]; options.xdg.userDirs = { @@ -33,64 +42,56 @@ in { desktop = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Desktop"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Desktop"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Desktop"''; description = "The Desktop directory."; }; documents = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Documents"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Documents"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Documents"''; description = "The Documents directory."; }; download = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Downloads"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Downloads"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Downloads"''; description = "The Downloads directory."; }; music = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Music"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Music"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Music"''; description = "The Music directory."; }; pictures = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Pictures"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Pictures"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Pictures"''; description = "The Pictures directory."; }; publicShare = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Public"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Public"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Public"''; description = "The Public share directory."; }; templates = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Templates"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Templates"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Templates"''; description = "The Templates directory."; }; videos = mkOption { type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Videos"; - defaultText = - literalExpression ''"''${config.home.homeDirectory}/Videos"''; + defaultText = literalExpression ''"''${config.home.homeDirectory}/Videos"''; description = "The Videos directory."; }; @@ -106,41 +107,48 @@ in { description = "Other user directories."; }; - createDirectories = - lib.mkEnableOption "automatic creation of the XDG user directories"; + createDirectories = lib.mkEnableOption "automatic creation of the XDG user directories"; }; - config = let - directories = (lib.filterAttrs (n: v: !isNull v) { - XDG_DESKTOP_DIR = cfg.desktop; - XDG_DOCUMENTS_DIR = cfg.documents; - XDG_DOWNLOAD_DIR = cfg.download; - XDG_MUSIC_DIR = cfg.music; - XDG_PICTURES_DIR = cfg.pictures; - XDG_PUBLICSHARE_DIR = cfg.publicShare; - XDG_TEMPLATES_DIR = cfg.templates; - XDG_VIDEOS_DIR = cfg.videos; - }) // cfg.extraConfig; - in lib.mkIf cfg.enable { - assertions = [ - (lib.hm.assertions.assertPlatform "xdg.userDirs" pkgs lib.platforms.linux) - ]; + config = + let + directories = + (lib.filterAttrs (n: v: !isNull v) { + XDG_DESKTOP_DIR = cfg.desktop; + XDG_DOCUMENTS_DIR = cfg.documents; + XDG_DOWNLOAD_DIR = cfg.download; + XDG_MUSIC_DIR = cfg.music; + XDG_PICTURES_DIR = cfg.pictures; + XDG_PUBLICSHARE_DIR = cfg.publicShare; + XDG_TEMPLATES_DIR = cfg.templates; + XDG_VIDEOS_DIR = cfg.videos; + }) + // cfg.extraConfig; + in + lib.mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "xdg.userDirs" pkgs lib.platforms.linux) + ]; - xdg.configFile."user-dirs.dirs".text = let - # For some reason, these need to be wrapped with quotes to be valid. - wrapped = lib.mapAttrs (_: value: ''"${value}"'') directories; - in lib.generators.toKeyValue { } wrapped; + xdg.configFile."user-dirs.dirs".text = + let + # For some reason, these need to be wrapped with quotes to be valid. + wrapped = lib.mapAttrs (_: value: ''"${value}"'') directories; + in + lib.generators.toKeyValue { } wrapped; - xdg.configFile."user-dirs.conf".text = "enabled=False"; + xdg.configFile."user-dirs.conf".text = "enabled=False"; - home.sessionVariables = directories; + home.sessionVariables = directories; - home.activation.createXdgUserDirectories = lib.mkIf cfg.createDirectories - (let - directoriesList = lib.attrValues directories; - mkdir = - (dir: ''[[ -L "${dir}" ]] || run mkdir -p $VERBOSE_ARG "${dir}"''); - in lib.hm.dag.entryAfter [ "linkGeneration" ] - (lib.strings.concatMapStringsSep "\n" mkdir directoriesList)); - }; + home.activation.createXdgUserDirectories = lib.mkIf cfg.createDirectories ( + let + directoriesList = lib.attrValues directories; + mkdir = (dir: ''[[ -L "${dir}" ]] || run mkdir -p $VERBOSE_ARG "${dir}"''); + in + lib.hm.dag.entryAfter [ "linkGeneration" ] ( + lib.strings.concatMapStringsSep "\n" mkdir directoriesList + ) + ); + }; } diff --git a/modules/misc/xdg.nix b/modules/misc/xdg.nix index e309462e7..40672c4e8 100644 --- a/modules/misc/xdg.nix +++ b/modules/misc/xdg.nix @@ -1,25 +1,40 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) mkOptionDefault mkIf mkOption types; + inherit (lib) + mkOptionDefault + mkIf + mkOption + types + ; cfg = config.xdg; - fileType = (import ../lib/file-type.nix { - inherit (config.home) homeDirectory; - inherit lib pkgs; - }).fileType; + fileType = + (import ../lib/file-type.nix { + inherit (config.home) homeDirectory; + inherit lib pkgs; + }).fileType; defaultCacheHome = "${config.home.homeDirectory}/.cache"; defaultConfigHome = "${config.home.homeDirectory}/.config"; defaultDataHome = "${config.home.homeDirectory}/.local/share"; defaultStateHome = "${config.home.homeDirectory}/.local/state"; - getEnvFallback = name: fallback: - let value = builtins.getEnv name; - in if value != "" then value else fallback; + getEnvFallback = + name: fallback: + let + value = builtins.getEnv name; + in + if value != "" then value else fallback; -in { +in +{ options.xdg = { enable = lib.mkEnableOption "management of XDG base directories"; @@ -64,8 +79,7 @@ in { }; dataFile = mkOption { - type = - fileType "xdg.dataFile" "xdg.dataHome" cfg.dataHome; + type = fileType "xdg.dataFile" "xdg.dataHome" cfg.dataHome; default = { }; description = '' Attribute set of files to link into the user's XDG @@ -85,8 +99,7 @@ in { }; stateFile = mkOption { - type = fileType "xdg.stateFile" "xdg.stateHome" - cfg.stateHome; + type = fileType "xdg.stateFile" "xdg.stateHome" cfg.stateHome; default = { }; description = '' Attribute set of files to link into the user's XDG @@ -107,34 +120,32 @@ in { }; config = lib.mkMerge [ - (let - variables = { - XDG_CACHE_HOME = cfg.cacheHome; - XDG_CONFIG_HOME = cfg.configHome; - XDG_DATA_HOME = cfg.dataHome; - XDG_STATE_HOME = cfg.stateHome; - }; - in mkIf cfg.enable { - xdg.cacheHome = mkOptionDefault defaultCacheHome; - xdg.configHome = mkOptionDefault defaultConfigHome; - xdg.dataHome = mkOptionDefault defaultDataHome; - xdg.stateHome = mkOptionDefault defaultStateHome; + ( + let + variables = { + XDG_CACHE_HOME = cfg.cacheHome; + XDG_CONFIG_HOME = cfg.configHome; + XDG_DATA_HOME = cfg.dataHome; + XDG_STATE_HOME = cfg.stateHome; + }; + in + mkIf cfg.enable { + xdg.cacheHome = mkOptionDefault defaultCacheHome; + xdg.configHome = mkOptionDefault defaultConfigHome; + xdg.dataHome = mkOptionDefault defaultDataHome; + xdg.stateHome = mkOptionDefault defaultStateHome; - home.sessionVariables = variables; - systemd.user.sessionVariables = - mkIf pkgs.stdenv.hostPlatform.isLinux variables; - }) + home.sessionVariables = variables; + systemd.user.sessionVariables = mkIf pkgs.stdenv.hostPlatform.isLinux variables; + } + ) # Legacy non-deterministic setup. (mkIf (!cfg.enable && lib.versionOlder config.home.stateVersion "20.09") { - xdg.cacheHome = - mkOptionDefault (getEnvFallback "XDG_CACHE_HOME" defaultCacheHome); - xdg.configHome = - mkOptionDefault (getEnvFallback "XDG_CONFIG_HOME" defaultConfigHome); - xdg.dataHome = - mkOptionDefault (getEnvFallback "XDG_DATA_HOME" defaultDataHome); - xdg.stateHome = - mkOptionDefault (getEnvFallback "XDG_STATE_HOME" defaultStateHome); + xdg.cacheHome = mkOptionDefault (getEnvFallback "XDG_CACHE_HOME" defaultCacheHome); + xdg.configHome = mkOptionDefault (getEnvFallback "XDG_CONFIG_HOME" defaultConfigHome); + xdg.dataHome = mkOptionDefault (getEnvFallback "XDG_DATA_HOME" defaultDataHome); + xdg.stateHome = mkOptionDefault (getEnvFallback "XDG_STATE_HOME" defaultStateHome); }) # "Modern" deterministic setup. @@ -147,18 +158,10 @@ in { { home.file = lib.mkMerge [ - (lib.mapAttrs' - (name: file: lib.nameValuePair "${cfg.cacheHome}/${name}" file) - cfg.cacheFile) - (lib.mapAttrs' - (name: file: lib.nameValuePair "${cfg.configHome}/${name}" file) - cfg.configFile) - (lib.mapAttrs' - (name: file: lib.nameValuePair "${cfg.dataHome}/${name}" file) - cfg.dataFile) - (lib.mapAttrs' - (name: file: lib.nameValuePair "${cfg.stateHome}/${name}" file) - cfg.stateFile) + (lib.mapAttrs' (name: file: lib.nameValuePair "${cfg.cacheHome}/${name}" file) cfg.cacheFile) + (lib.mapAttrs' (name: file: lib.nameValuePair "${cfg.configHome}/${name}" file) cfg.configFile) + (lib.mapAttrs' (name: file: lib.nameValuePair "${cfg.dataHome}/${name}" file) cfg.dataFile) + (lib.mapAttrs' (name: file: lib.nameValuePair "${cfg.stateHome}/${name}" file) cfg.stateFile) { "${cfg.cacheHome}/.keep".text = ""; } { "${cfg.stateHome}/.keep".text = ""; } ]; diff --git a/modules/misc/xfconf.nix b/modules/misc/xfconf.nix index b95413676..c67edba75 100644 --- a/modules/misc/xfconf.nix +++ b/modules/misc/xfconf.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkOption types; @@ -8,7 +13,11 @@ let xfIntVariant = types.submodule { options = { type = mkOption { - type = types.enum [ "int" "uint" "uint64" ]; + type = types.enum [ + "int" + "uint" + "uint64" + ]; description = '' To distinguish between int, uint and uint64 in xfconf, you can specify the type in xfconf with this submodule. @@ -23,38 +32,50 @@ let }; }; - withType = v: - if builtins.isAttrs v then [ - "-t" - v.type - "-s" - (toString v.value) - ] else if builtins.isBool v then [ - "-t" - "bool" - "-s" - (if v then "true" else "false") - ] else if builtins.isInt v then [ - "-t" - "int" - "-s" - (toString v) - ] else if builtins.isFloat v then [ - "-t" - "double" - "-s" - (toString v) - ] else if builtins.isString v then [ - "-t" - "string" - "-s" - v - ] else if builtins.isList v then + withType = + v: + if builtins.isAttrs v then + [ + "-t" + v.type + "-s" + (toString v.value) + ] + else if builtins.isBool v then + [ + "-t" + "bool" + "-s" + (if v then "true" else "false") + ] + else if builtins.isInt v then + [ + "-t" + "int" + "-s" + (toString v) + ] + else if builtins.isFloat v then + [ + "-t" + "double" + "-s" + (toString v) + ] + else if builtins.isString v then + [ + "-t" + "string" + "-s" + v + ] + else if builtins.isList v then [ "-a" ] ++ lib.concatMap withType v else throw "unexpected xfconf type: ${builtins.typeOf v}"; -in { +in +{ meta.maintainers = [ lib.maintainers.chuangzhu ]; options.xfconf = { @@ -73,10 +94,20 @@ in { }; settings = mkOption { - type = with types; - # xfIntVariant must come AFTER str; otherwise strings are treated as submodule imports... - let value = nullOr (oneOf [ bool int float str xfIntVariant ]); - in attrsOf (attrsOf (either value (listOf value))) // { + type = + with types; + # xfIntVariant must come AFTER str; otherwise strings are treated as submodule imports... + let + value = nullOr (oneOf [ + bool + int + float + str + xfIntVariant + ]); + in + attrsOf (attrsOf (either value (listOf value))) + // { description = "xfconf settings"; }; default = { }; @@ -99,30 +130,33 @@ in { }; config = lib.mkIf (cfg.enable && cfg.settings != { }) { - assertions = - [ (lib.hm.assertions.assertPlatform "xfconf" pkgs lib.platforms.linux) ]; + assertions = [ (lib.hm.assertions.assertPlatform "xfconf" pkgs lib.platforms.linux) ]; - home.activation.xfconfSettings = lib.hm.dag.entryAfter [ "installPackages" ] - (let + home.activation.xfconfSettings = lib.hm.dag.entryAfter [ "installPackages" ] ( + let mkCommand = channel: property: value: '' run ${pkgs.xfce.xfconf}/bin/xfconf-query \ - ${ - lib.escapeShellArgs ([ "-c" channel "-p" "/${property}" ] - ++ (if value == null then - [ "-r" ] - else - [ "-n" ] ++ withType value)) - } + ${lib.escapeShellArgs ( + [ + "-c" + channel + "-p" + "/${property}" + ] + ++ (if value == null then [ "-r" ] else [ "-n" ] ++ withType value) + )} ''; - commands = lib.mapAttrsToList (channel: properties: - lib.mapAttrsToList (mkCommand channel) properties) cfg.settings; + commands = lib.mapAttrsToList ( + channel: properties: lib.mapAttrsToList (mkCommand channel) properties + ) cfg.settings; load = pkgs.writeShellScript "load-xfconf" '' ${config.lib.bash.initHomeManagerLib} ${lib.concatMapStrings lib.concatStrings commands} ''; - in '' + in + '' if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then export DBUS_RUN_SESSION_CMD="" else @@ -132,6 +166,7 @@ in { run $DBUS_RUN_SESSION_CMD ${load} unset DBUS_RUN_SESSION_CMD - ''); + '' + ); }; } diff --git a/modules/modules.nix b/modules/modules.nix index f38b64c2e..eebcbdbe3 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -1,492 +1,499 @@ -{ pkgs +{ + pkgs, -# Note, this should be "the standard library" + HM extensions. -, lib + # Note, this should be "the standard library" + HM extensions. + lib, -# Whether to enable module type checking. -, check ? true + # Whether to enable module type checking. + check ? true, # If disabled, the pkgs attribute passed to this function is used instead. -, useNixpkgsModule ? true }: + useNixpkgsModule ? true, +}: let - modules = [ - ./accounts/email.nix - ./accounts/calendar.nix - ./accounts/contacts.nix - ./config/home-cursor.nix - ./config/i18n.nix - ./files.nix - ./home-environment.nix - ./i18n/input-method/default.nix - ./launchd/default.nix - ./manual.nix - ./misc/dconf.nix - ./misc/debug.nix - ./misc/editorconfig.nix - ./misc/fontconfig.nix - ./misc/gtk.nix - ./misc/lib.nix - ./misc/mozilla-messaging-hosts.nix - ./misc/news.nix - ./misc/nixgl.nix - ./misc/numlock.nix - ./misc/pam.nix - ./misc/qt.nix - ./misc/qt/kconfig.nix - ./misc/shell.nix - ./misc/specialisation.nix - ./misc/submodule-support.nix - ./misc/tmpfiles.nix - ./misc/uninstall.nix - ./misc/version.nix - ./misc/vte.nix - ./misc/xdg-autostart.nix - ./misc/xdg-desktop-entries.nix - ./misc/xdg-mime-apps.nix - ./misc/xdg-mime.nix - ./misc/xdg-portal.nix - ./misc/xdg-system-dirs.nix - ./misc/xdg-user-dirs.nix - ./misc/xdg.nix - ./misc/xfconf.nix - ./programs/abook.nix - ./programs/aerc.nix - ./programs/aerospace.nix - ./programs/afew.nix - ./programs/alacritty.nix - ./programs/alot.nix - ./programs/antidote.nix - ./programs/aria2.nix - ./programs/astroid.nix - ./programs/atuin.nix - ./programs/autojump.nix - ./programs/autorandr.nix - ./programs/awscli.nix - ./programs/bash.nix - ./programs/bashmount.nix - ./programs/bat.nix - ./programs/bacon.nix - ./programs/beets.nix - ./programs/bemenu.nix - ./programs/borgmatic.nix - ./programs/bottom.nix - ./programs/boxxy.nix - ./programs/broot.nix - ./programs/browserpass.nix - ./programs/btop.nix - ./programs/bun.nix - ./programs/carapace.nix - ./programs/cava.nix - ./programs/cavalier.nix - ./programs/chromium.nix - ./programs/cmus.nix - ./programs/command-not-found/command-not-found.nix - ./programs/comodoro.nix - ./programs/darcs.nix - ./programs/dircolors.nix - ./programs/direnv.nix - ./programs/discocss.nix - ./programs/distrobox.nix - ./programs/earthly.nix - ./programs/eclipse.nix - ./programs/emacs.nix - ./programs/eww.nix - ./programs/eza.nix - ./programs/fastfetch.nix - ./programs/fd.nix - ./programs/feh.nix - ./programs/firefox.nix - ./programs/fish.nix - ./programs/floorp.nix - ./programs/foot.nix - ./programs/freetube.nix - ./programs/fuzzel.nix - ./programs/fzf.nix - ./programs/gallery-dl.nix - ./programs/getmail.nix - ./programs/gh.nix - ./programs/gh-dash.nix - ./programs/ghostty.nix - ./programs/git-cliff.nix - ./programs/git-credential-oauth.nix - ./programs/git-worktree-switcher.nix - ./programs/git.nix - ./programs/gitui.nix - ./programs/gnome-shell.nix - ./programs/gnome-terminal.nix - ./programs/go.nix - ./programs/gpg.nix - ./programs/gradle.nix - ./programs/granted.nix - ./programs/havoc.nix - ./programs/helix.nix - ./programs/hexchat.nix - ./programs/himalaya.nix - ./programs/home-manager.nix - ./programs/hstr.nix - ./programs/htop.nix - ./programs/hyfetch.nix - ./programs/hyprlock.nix - ./programs/i3blocks.nix - ./programs/i3status-rust.nix - ./programs/i3status.nix - ./programs/iamb.nix - ./programs/imv.nix - ./programs/info.nix - ./programs/ion.nix - ./programs/irssi.nix - ./programs/java.nix - ./programs/jetbrains-remote.nix - ./programs/jq.nix - ./programs/jqp.nix - ./programs/jujutsu.nix - ./programs/joshuto.nix - ./programs/joplin-desktop.nix - ./programs/just.nix - ./programs/k9s.nix - ./programs/kakoune.nix - ./programs/keychain.nix - ./programs/khal.nix - ./programs/khard.nix - ./programs/kitty.nix - ./programs/kodi.nix - ./programs/kubecolor.nix - ./programs/lapce.nix - ./programs/lazydocker.nix - ./programs/lazygit.nix - ./programs/ledger.nix - ./programs/less.nix - ./programs/lesspipe.nix - ./programs/lf.nix - ./programs/librewolf.nix - ./programs/lieer.nix - ./programs/looking-glass-client.nix - ./programs/lsd.nix - ./programs/man.nix - ./programs/mangohud.nix - ./programs/matplotlib.nix - ./programs/mbsync.nix - ./programs/mcfly.nix - ./programs/mercurial.nix - ./programs/mergiraf.nix - ./programs/micro.nix - ./programs/mise.nix - ./programs/mods.nix - ./programs/mpv.nix - ./programs/mr.nix - ./programs/msmtp.nix - ./programs/mu.nix - ./programs/mujmap.nix - ./programs/navi.nix - ./programs/ncmpcpp.nix - ./programs/ncspot.nix - ./programs/ne.nix - ./programs/neomutt.nix - ./programs/neovide.nix - ./programs/neovim.nix - ./programs/newsboat.nix - ./programs/nh.nix - ./programs/nheko.nix - ./programs/nix-index.nix - ./programs/nix-your-shell.nix - ./programs/nnn.nix - ./programs/noti.nix - ./programs/notmuch.nix - ./programs/nushell.nix - ./programs/obs-studio.nix - ./programs/octant.nix - ./programs/offlineimap.nix - ./programs/oh-my-posh.nix - ./programs/onlyoffice.nix - ./programs/opam.nix - ./programs/openstackclient.nix - ./programs/pandoc.nix - ./programs/papis.nix - ./programs/password-store.nix - ./programs/pay-respects.nix - ./programs/pazi.nix - ./programs/pet.nix - ./programs/pidgin.nix - ./programs/pistol.nix - ./programs/piston-cli.nix - ./programs/pls.nix - ./programs/poetry.nix - ./programs/powerline-go.nix - ./programs/pqiv.nix - ./programs/pubs.nix - ./programs/pyenv.nix - ./programs/pylint.nix - ./programs/qcal.nix - ./programs/qutebrowser.nix - ./programs/ranger.nix - ./programs/rbw.nix - ./programs/rclone.nix - ./programs/readline.nix - ./programs/rio.nix - ./programs/ripgrep.nix - ./programs/ripgrep-all.nix - ./programs/rofi-pass.nix - ./programs/rofi.nix - ./programs/rtorrent.nix - ./programs/ruff.nix - ./programs/sagemath.nix - ./programs/sapling.nix - ./programs/sbt.nix - ./programs/scmpuff.nix - ./programs/script-directory.nix - ./programs/senpai.nix - ./programs/sesh.nix - ./programs/sftpman.nix - ./programs/sioyek.nix - ./programs/skim.nix - ./programs/sm64ex.nix - ./programs/smug.nix - ./programs/spotify-player.nix - ./programs/sqls.nix - ./programs/ssh.nix - ./programs/starship.nix - ./programs/streamlink.nix - ./programs/swayimg.nix - ./programs/swaylock.nix - ./programs/swayr.nix - ./programs/taskwarrior.nix - ./programs/tealdeer.nix - ./programs/terminator.nix - ./programs/termite.nix - ./programs/tex-fmt.nix - ./programs/texlive.nix - ./programs/thefuck.nix - ./programs/thunderbird.nix - ./programs/timidity.nix - ./programs/tint2.nix - ./programs/tiny.nix - ./programs/tmate.nix - ./programs/tmux.nix - ./programs/tofi.nix - ./programs/todoman.nix - ./programs/topgrade.nix - ./programs/translate-shell.nix - ./programs/urxvt.nix - ./programs/vdirsyncer.nix - ./programs/vifm.nix - ./programs/vim-vint.nix - ./programs/vim.nix - ./programs/vinegar.nix - ./programs/vscode.nix - ./programs/vscode/haskell.nix - ./programs/pywal.nix - ./programs/rbenv.nix - ./programs/watson.nix - ./programs/waylogout.nix - ./programs/waybar.nix - ./programs/wezterm.nix - ./programs/wlogout.nix - ./programs/wofi.nix - ./programs/xmobar.nix - ./programs/xplr.nix - ./programs/yambar.nix - ./programs/yazi.nix - ./programs/yt-dlp.nix - ./programs/z-lua.nix - ./programs/zathura.nix - ./programs/zed-editor.nix - ./programs/zellij.nix - ./programs/zk.nix - ./programs/zoxide.nix - ./programs/zplug.nix - ./programs/zsh.nix - ./programs/zsh/prezto.nix - ./programs/zsh/zsh-abbr.nix - ./services/activitywatch.nix - ./services/amberol.nix - ./services/arrpc.nix - ./services/autorandr.nix - ./services/avizo.nix - ./services/barrier.nix - ./services/batsignal.nix - ./services/betterlockscreen.nix - ./services/blanket.nix - ./services/blueman-applet.nix - ./services/borgmatic.nix - ./services/cachix-agent.nix - ./services/caffeine.nix - ./services/cbatticon.nix - ./services/cliphist.nix - ./services/clipman.nix - ./services/clipmenu.nix - ./services/clipse.nix - ./services/comodoro.nix - ./services/conky.nix - ./services/copyq.nix - ./services/darkman.nix - ./services/davmail.nix - ./services/devilspie2.nix - ./services/dropbox.nix - ./services/dunst.nix - ./services/dwm-status.nix - ./services/easyeffects.nix - ./services/emacs.nix - ./services/etesync-dav.nix - ./services/espanso.nix - ./services/flameshot.nix - ./services/fluidsynth.nix - ./services/fnott.nix - ./services/fusuma.nix - ./services/getmail.nix - ./services/git-sync.nix - ./services/glance.nix - ./services/gnome-keyring.nix - ./services/gpg-agent.nix - ./services/grobi.nix - ./services/gromit-mpx.nix - ./services/home-manager-auto-expire.nix - ./services/home-manager-auto-upgrade.nix - ./services/hound.nix - ./services/hypridle.nix - ./services/hyprpaper.nix - ./services/hyprpolkitagent.nix - ./services/imapnotify.nix - ./services/jankyborders.nix - ./services/kanshi.nix - ./services/kbfs.nix - ./services/kdeconnect.nix - ./services/keybase.nix - ./services/keynav.nix - ./services/librespot.nix - ./services/lieer.nix - ./services/linux-wallpaperengine.nix - ./services/listenbrainz-mpd.nix - ./services/lorri.nix - ./services/lxqt-policykit-agent.nix - ./services/macos-remap-keys - ./services/mako.nix - ./services/mbsync.nix - ./services/megasync.nix - ./services/mopidy.nix - ./services/mpd.nix - ./services/mpdris2.nix - ./services/mpdscribble.nix - ./services/mpd-discord-rpc.nix - ./services/mpd-mpris.nix - ./services/mpris-proxy.nix - ./services/muchsync.nix - ./services/network-manager-applet.nix - ./services/nextcloud-client.nix - ./services/nix-gc.nix - ./services/notify-osd.nix - ./services/ollama.nix - ./services/opensnitch-ui.nix - ./services/osmscout-server.nix - ./services/owncloud-client.nix - ./services/pantalaimon.nix - ./services/parcellite.nix - ./services/pass-secret-service.nix - ./services/pasystray.nix - ./services/pbgopy.nix - ./services/picom.nix - ./services/plan9port.nix - ./services/playerctld.nix - ./services/plex-mpv-shim.nix - ./services/podman-linux - ./services/polkit-gnome.nix - ./services/polybar.nix - ./services/poweralertd.nix - ./services/psd.nix - ./services/pueue.nix - ./services/pulseeffects.nix - ./services/random-background.nix - ./services/recoll.nix - ./services/redshift-gammastep/gammastep.nix - ./services/redshift-gammastep/redshift.nix - ./services/remmina.nix - ./services/rsibreak.nix - ./services/safeeyes.nix - ./services/screen-locker.nix - ./services/sctd.nix - ./services/signaturepdf.nix - ./services/skhd.nix - ./services/snixembed.nix - ./services/spotifyd.nix - ./services/ssh-agent.nix - ./services/stalonetray.nix - ./services/status-notifier-watcher.nix - ./services/swayidle.nix - ./services/swaync.nix - ./services/swayosd.nix - ./services/swww.nix - ./services/sxhkd.nix - ./services/syncthing.nix - ./services/systembus-notify.nix - ./services/taffybar.nix - ./services/tahoe-lafs.nix - ./services/taskwarrior-sync.nix - ./services/tldr-update.nix - ./services/trayer.nix - ./services/trayscale.nix - ./services/twmn.nix - ./services/udiskie.nix - ./services/unclutter.nix - ./services/unison.nix - ./services/vdirsyncer.nix - ./services/volnoti.nix - ./services/window-managers/awesome.nix - ./services/window-managers/bspwm/default.nix - ./services/window-managers/fluxbox.nix - ./services/window-managers/herbstluftwm.nix - ./services/window-managers/hyprland.nix - ./services/window-managers/i3-sway/i3.nix - ./services/window-managers/i3-sway/sway.nix - ./services/window-managers/i3-sway/swaynag.nix - ./services/window-managers/river.nix - ./services/window-managers/spectrwm.nix - ./services/window-managers/wayfire.nix - ./services/window-managers/xmonad.nix - ./services/wlsunset.nix - ./services/wluma.nix - ./services/wob.nix - ./services/wpaperd.nix - ./services/xcape.nix - ./services/xembed-sni-proxy.nix - ./services/xidlehook.nix - ./services/xscreensaver.nix - ./services/xsettingsd.nix - ./services/xsuspender.nix - ./services/yubikey-agent.nix - ./systemd.nix - ./targets/darwin - ./targets/generic-linux.nix - ./wayland.nix - ./xresources.nix - ./xsession.nix - ./misc/nix.nix - (pkgs.path + "/nixos/modules/misc/assertions.nix") - (pkgs.path + "/nixos/modules/misc/meta.nix") + modules = + [ + ./accounts/email.nix + ./accounts/calendar.nix + ./accounts/contacts.nix + ./config/home-cursor.nix + ./config/i18n.nix + ./files.nix + ./home-environment.nix + ./i18n/input-method/default.nix + ./launchd/default.nix + ./manual.nix + ./misc/dconf.nix + ./misc/debug.nix + ./misc/editorconfig.nix + ./misc/fontconfig.nix + ./misc/gtk.nix + ./misc/lib.nix + ./misc/mozilla-messaging-hosts.nix + ./misc/news.nix + ./misc/nixgl.nix + ./misc/numlock.nix + ./misc/pam.nix + ./misc/qt.nix + ./misc/qt/kconfig.nix + ./misc/shell.nix + ./misc/specialisation.nix + ./misc/submodule-support.nix + ./misc/tmpfiles.nix + ./misc/uninstall.nix + ./misc/version.nix + ./misc/vte.nix + ./misc/xdg-autostart.nix + ./misc/xdg-desktop-entries.nix + ./misc/xdg-mime-apps.nix + ./misc/xdg-mime.nix + ./misc/xdg-portal.nix + ./misc/xdg-system-dirs.nix + ./misc/xdg-user-dirs.nix + ./misc/xdg.nix + ./misc/xfconf.nix + ./programs/abook.nix + ./programs/aerc.nix + ./programs/aerospace.nix + ./programs/afew.nix + ./programs/alacritty.nix + ./programs/alot.nix + ./programs/antidote.nix + ./programs/aria2.nix + ./programs/astroid.nix + ./programs/atuin.nix + ./programs/autojump.nix + ./programs/autorandr.nix + ./programs/awscli.nix + ./programs/bash.nix + ./programs/bashmount.nix + ./programs/bat.nix + ./programs/bacon.nix + ./programs/beets.nix + ./programs/bemenu.nix + ./programs/borgmatic.nix + ./programs/bottom.nix + ./programs/boxxy.nix + ./programs/broot.nix + ./programs/browserpass.nix + ./programs/btop.nix + ./programs/bun.nix + ./programs/carapace.nix + ./programs/cava.nix + ./programs/cavalier.nix + ./programs/chromium.nix + ./programs/cmus.nix + ./programs/command-not-found/command-not-found.nix + ./programs/comodoro.nix + ./programs/darcs.nix + ./programs/dircolors.nix + ./programs/direnv.nix + ./programs/discocss.nix + ./programs/distrobox.nix + ./programs/earthly.nix + ./programs/eclipse.nix + ./programs/emacs.nix + ./programs/eww.nix + ./programs/eza.nix + ./programs/fastfetch.nix + ./programs/fd.nix + ./programs/feh.nix + ./programs/firefox.nix + ./programs/fish.nix + ./programs/floorp.nix + ./programs/foot.nix + ./programs/freetube.nix + ./programs/fuzzel.nix + ./programs/fzf.nix + ./programs/gallery-dl.nix + ./programs/getmail.nix + ./programs/gh.nix + ./programs/gh-dash.nix + ./programs/ghostty.nix + ./programs/git-cliff.nix + ./programs/git-credential-oauth.nix + ./programs/git-worktree-switcher.nix + ./programs/git.nix + ./programs/gitui.nix + ./programs/gnome-shell.nix + ./programs/gnome-terminal.nix + ./programs/go.nix + ./programs/gpg.nix + ./programs/gradle.nix + ./programs/granted.nix + ./programs/havoc.nix + ./programs/helix.nix + ./programs/hexchat.nix + ./programs/himalaya.nix + ./programs/home-manager.nix + ./programs/hstr.nix + ./programs/htop.nix + ./programs/hyfetch.nix + ./programs/hyprlock.nix + ./programs/i3blocks.nix + ./programs/i3status-rust.nix + ./programs/i3status.nix + ./programs/iamb.nix + ./programs/imv.nix + ./programs/info.nix + ./programs/ion.nix + ./programs/irssi.nix + ./programs/java.nix + ./programs/jetbrains-remote.nix + ./programs/jq.nix + ./programs/jqp.nix + ./programs/jujutsu.nix + ./programs/joshuto.nix + ./programs/joplin-desktop.nix + ./programs/just.nix + ./programs/k9s.nix + ./programs/kakoune.nix + ./programs/keychain.nix + ./programs/khal.nix + ./programs/khard.nix + ./programs/kitty.nix + ./programs/kodi.nix + ./programs/kubecolor.nix + ./programs/lapce.nix + ./programs/lazydocker.nix + ./programs/lazygit.nix + ./programs/ledger.nix + ./programs/less.nix + ./programs/lesspipe.nix + ./programs/lf.nix + ./programs/librewolf.nix + ./programs/lieer.nix + ./programs/looking-glass-client.nix + ./programs/lsd.nix + ./programs/man.nix + ./programs/mangohud.nix + ./programs/matplotlib.nix + ./programs/mbsync.nix + ./programs/mcfly.nix + ./programs/mercurial.nix + ./programs/mergiraf.nix + ./programs/micro.nix + ./programs/mise.nix + ./programs/mods.nix + ./programs/mpv.nix + ./programs/mr.nix + ./programs/msmtp.nix + ./programs/mu.nix + ./programs/mujmap.nix + ./programs/navi.nix + ./programs/ncmpcpp.nix + ./programs/ncspot.nix + ./programs/ne.nix + ./programs/neomutt.nix + ./programs/neovide.nix + ./programs/neovim.nix + ./programs/newsboat.nix + ./programs/nh.nix + ./programs/nheko.nix + ./programs/nix-index.nix + ./programs/nix-your-shell.nix + ./programs/nnn.nix + ./programs/noti.nix + ./programs/notmuch.nix + ./programs/nushell.nix + ./programs/obs-studio.nix + ./programs/octant.nix + ./programs/offlineimap.nix + ./programs/oh-my-posh.nix + ./programs/onlyoffice.nix + ./programs/opam.nix + ./programs/openstackclient.nix + ./programs/pandoc.nix + ./programs/papis.nix + ./programs/password-store.nix + ./programs/pay-respects.nix + ./programs/pazi.nix + ./programs/pet.nix + ./programs/pidgin.nix + ./programs/pistol.nix + ./programs/piston-cli.nix + ./programs/pls.nix + ./programs/poetry.nix + ./programs/powerline-go.nix + ./programs/pqiv.nix + ./programs/pubs.nix + ./programs/pyenv.nix + ./programs/pylint.nix + ./programs/qcal.nix + ./programs/qutebrowser.nix + ./programs/ranger.nix + ./programs/rbw.nix + ./programs/rclone.nix + ./programs/readline.nix + ./programs/rio.nix + ./programs/ripgrep.nix + ./programs/ripgrep-all.nix + ./programs/rofi-pass.nix + ./programs/rofi.nix + ./programs/rtorrent.nix + ./programs/ruff.nix + ./programs/sagemath.nix + ./programs/sapling.nix + ./programs/sbt.nix + ./programs/scmpuff.nix + ./programs/script-directory.nix + ./programs/senpai.nix + ./programs/sesh.nix + ./programs/sftpman.nix + ./programs/sioyek.nix + ./programs/skim.nix + ./programs/sm64ex.nix + ./programs/smug.nix + ./programs/spotify-player.nix + ./programs/sqls.nix + ./programs/ssh.nix + ./programs/starship.nix + ./programs/streamlink.nix + ./programs/swayimg.nix + ./programs/swaylock.nix + ./programs/swayr.nix + ./programs/taskwarrior.nix + ./programs/tealdeer.nix + ./programs/terminator.nix + ./programs/termite.nix + ./programs/tex-fmt.nix + ./programs/texlive.nix + ./programs/thefuck.nix + ./programs/thunderbird.nix + ./programs/timidity.nix + ./programs/tint2.nix + ./programs/tiny.nix + ./programs/tmate.nix + ./programs/tmux.nix + ./programs/tofi.nix + ./programs/todoman.nix + ./programs/topgrade.nix + ./programs/translate-shell.nix + ./programs/urxvt.nix + ./programs/vdirsyncer.nix + ./programs/vifm.nix + ./programs/vim-vint.nix + ./programs/vim.nix + ./programs/vinegar.nix + ./programs/vscode.nix + ./programs/vscode/haskell.nix + ./programs/pywal.nix + ./programs/rbenv.nix + ./programs/watson.nix + ./programs/waylogout.nix + ./programs/waybar.nix + ./programs/wezterm.nix + ./programs/wlogout.nix + ./programs/wofi.nix + ./programs/xmobar.nix + ./programs/xplr.nix + ./programs/yambar.nix + ./programs/yazi.nix + ./programs/yt-dlp.nix + ./programs/z-lua.nix + ./programs/zathura.nix + ./programs/zed-editor.nix + ./programs/zellij.nix + ./programs/zk.nix + ./programs/zoxide.nix + ./programs/zplug.nix + ./programs/zsh.nix + ./programs/zsh/prezto.nix + ./programs/zsh/zsh-abbr.nix + ./services/activitywatch.nix + ./services/amberol.nix + ./services/arrpc.nix + ./services/autorandr.nix + ./services/avizo.nix + ./services/barrier.nix + ./services/batsignal.nix + ./services/betterlockscreen.nix + ./services/blanket.nix + ./services/blueman-applet.nix + ./services/borgmatic.nix + ./services/cachix-agent.nix + ./services/caffeine.nix + ./services/cbatticon.nix + ./services/cliphist.nix + ./services/clipman.nix + ./services/clipmenu.nix + ./services/clipse.nix + ./services/comodoro.nix + ./services/conky.nix + ./services/copyq.nix + ./services/darkman.nix + ./services/davmail.nix + ./services/devilspie2.nix + ./services/dropbox.nix + ./services/dunst.nix + ./services/dwm-status.nix + ./services/easyeffects.nix + ./services/emacs.nix + ./services/etesync-dav.nix + ./services/espanso.nix + ./services/flameshot.nix + ./services/fluidsynth.nix + ./services/fnott.nix + ./services/fusuma.nix + ./services/getmail.nix + ./services/git-sync.nix + ./services/glance.nix + ./services/gnome-keyring.nix + ./services/gpg-agent.nix + ./services/grobi.nix + ./services/gromit-mpx.nix + ./services/home-manager-auto-expire.nix + ./services/home-manager-auto-upgrade.nix + ./services/hound.nix + ./services/hypridle.nix + ./services/hyprpaper.nix + ./services/hyprpolkitagent.nix + ./services/imapnotify.nix + ./services/jankyborders.nix + ./services/kanshi.nix + ./services/kbfs.nix + ./services/kdeconnect.nix + ./services/keybase.nix + ./services/keynav.nix + ./services/librespot.nix + ./services/lieer.nix + ./services/linux-wallpaperengine.nix + ./services/listenbrainz-mpd.nix + ./services/lorri.nix + ./services/lxqt-policykit-agent.nix + ./services/macos-remap-keys + ./services/mako.nix + ./services/mbsync.nix + ./services/megasync.nix + ./services/mopidy.nix + ./services/mpd.nix + ./services/mpdris2.nix + ./services/mpdscribble.nix + ./services/mpd-discord-rpc.nix + ./services/mpd-mpris.nix + ./services/mpris-proxy.nix + ./services/muchsync.nix + ./services/network-manager-applet.nix + ./services/nextcloud-client.nix + ./services/nix-gc.nix + ./services/notify-osd.nix + ./services/ollama.nix + ./services/opensnitch-ui.nix + ./services/osmscout-server.nix + ./services/owncloud-client.nix + ./services/pantalaimon.nix + ./services/parcellite.nix + ./services/pass-secret-service.nix + ./services/pasystray.nix + ./services/pbgopy.nix + ./services/picom.nix + ./services/plan9port.nix + ./services/playerctld.nix + ./services/plex-mpv-shim.nix + ./services/podman-linux + ./services/polkit-gnome.nix + ./services/polybar.nix + ./services/poweralertd.nix + ./services/psd.nix + ./services/pueue.nix + ./services/pulseeffects.nix + ./services/random-background.nix + ./services/recoll.nix + ./services/redshift-gammastep/gammastep.nix + ./services/redshift-gammastep/redshift.nix + ./services/remmina.nix + ./services/rsibreak.nix + ./services/safeeyes.nix + ./services/screen-locker.nix + ./services/sctd.nix + ./services/signaturepdf.nix + ./services/skhd.nix + ./services/snixembed.nix + ./services/spotifyd.nix + ./services/ssh-agent.nix + ./services/stalonetray.nix + ./services/status-notifier-watcher.nix + ./services/swayidle.nix + ./services/swaync.nix + ./services/swayosd.nix + ./services/swww.nix + ./services/sxhkd.nix + ./services/syncthing.nix + ./services/systembus-notify.nix + ./services/taffybar.nix + ./services/tahoe-lafs.nix + ./services/taskwarrior-sync.nix + ./services/tldr-update.nix + ./services/trayer.nix + ./services/trayscale.nix + ./services/twmn.nix + ./services/udiskie.nix + ./services/unclutter.nix + ./services/unison.nix + ./services/vdirsyncer.nix + ./services/volnoti.nix + ./services/window-managers/awesome.nix + ./services/window-managers/bspwm/default.nix + ./services/window-managers/fluxbox.nix + ./services/window-managers/herbstluftwm.nix + ./services/window-managers/hyprland.nix + ./services/window-managers/i3-sway/i3.nix + ./services/window-managers/i3-sway/sway.nix + ./services/window-managers/i3-sway/swaynag.nix + ./services/window-managers/river.nix + ./services/window-managers/spectrwm.nix + ./services/window-managers/wayfire.nix + ./services/window-managers/xmonad.nix + ./services/wlsunset.nix + ./services/wluma.nix + ./services/wob.nix + ./services/wpaperd.nix + ./services/xcape.nix + ./services/xembed-sni-proxy.nix + ./services/xidlehook.nix + ./services/xscreensaver.nix + ./services/xsettingsd.nix + ./services/xsuspender.nix + ./services/yubikey-agent.nix + ./systemd.nix + ./targets/darwin + ./targets/generic-linux.nix + ./wayland.nix + ./xresources.nix + ./xsession.nix + ./misc/nix.nix + (pkgs.path + "/nixos/modules/misc/assertions.nix") + (pkgs.path + "/nixos/modules/misc/meta.nix") - (lib.mkRemovedOptionModule [ "services" "password-store-sync" ] '' - Use services.git-sync instead. - '') - (lib.mkRemovedOptionModule [ "services" "keepassx" ] '' - KeePassX is no longer maintained. - '') - ] ++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix + (lib.mkRemovedOptionModule [ "services" "password-store-sync" ] '' + Use services.git-sync instead. + '') + (lib.mkRemovedOptionModule [ "services" "keepassx" ] '' + KeePassX is no longer maintained. + '') + ] + ++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix ++ lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix; - pkgsModule = { config, ... }: { - config = { - _module.args.baseModules = modules; - _module.args.pkgsPath = lib.mkDefault - (if lib.versionAtLeast config.home.stateVersion "20.09" then - pkgs.path - else - ); - _module.args.pkgs = lib.mkDefault pkgs; - _module.check = check; - lib = lib.hm; - } // lib.optionalAttrs useNixpkgsModule { - nixpkgs.system = lib.mkDefault pkgs.stdenv.hostPlatform.system; + pkgsModule = + { config, ... }: + { + config = + { + _module.args.baseModules = modules; + _module.args.pkgsPath = lib.mkDefault ( + if lib.versionAtLeast config.home.stateVersion "20.09" then pkgs.path else + ); + _module.args.pkgs = lib.mkDefault pkgs; + _module.check = check; + lib = lib.hm; + } + // lib.optionalAttrs useNixpkgsModule { + nixpkgs.system = lib.mkDefault pkgs.stdenv.hostPlatform.system; + }; }; - }; -in modules ++ [ pkgsModule ] +in +modules ++ [ pkgsModule ] diff --git a/modules/programs/abook.nix b/modules/programs/abook.nix index 0b7312599..ee803378b 100644 --- a/modules/programs/abook.nix +++ b/modules/programs/abook.nix @@ -1,6 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.abook; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.abook; +in +{ options.programs.abook = { enable = lib.mkEnableOption "Abook"; diff --git a/modules/programs/aerc-accounts.nix b/modules/programs/aerc-accounts.nix index 331167ad2..050352ee9 100644 --- a/modules/programs/aerc-accounts.nix +++ b/modules/programs/aerc-accounts.nix @@ -1,17 +1,29 @@ -{ config, lib, confSections, confSection, ... }: +{ + config, + lib, + confSections, + confSection, + ... +}: let inherit (lib) literalExpression mkOption types; - mapAttrNames = f: attr: - lib.listToAttrs (lib.attrValues (lib.mapAttrs (k: v: { - name = f k; - value = v; - }) attr)); + mapAttrNames = + f: attr: + lib.listToAttrs ( + lib.attrValues ( + lib.mapAttrs (k: v: { + name = f k; + value = v; + }) attr + ) + ); addAccountName = name: k: "${k}:account=${name}"; oauth2Params = mkOption { - type = with types; + type = + with types; nullOr (submodule { options = { token_endpoint = mkOption { @@ -37,7 +49,9 @@ let }; }); default = null; - example = { token_endpoint = ""; }; + example = { + token_endpoint = ""; + }; description = '' Sets the oauth2 params if authentication mechanism oauthbearer or xoauth2 is used. @@ -45,157 +59,188 @@ let ''; }; -in { +in +{ type = mkOption { - type = types.attrsOf (types.submodule { - options.aerc = { - enable = lib.mkEnableOption "aerc"; - extraAccounts = mkOption { - type = confSection; - default = { }; - example = - literalExpression ''{ source = "maildir://~/Maildir/example"; }''; - description = '' - Extra config added to the configuration section for this account in - {file}`$HOME/.config/aerc/accounts.conf`. - See {manpage}`aerc-accounts(5)`. - ''; + type = types.attrsOf ( + types.submodule { + options.aerc = { + enable = lib.mkEnableOption "aerc"; + extraAccounts = mkOption { + type = confSection; + default = { }; + example = literalExpression ''{ source = "maildir://~/Maildir/example"; }''; + description = '' + Extra config added to the configuration section for this account in + {file}`$HOME/.config/aerc/accounts.conf`. + See {manpage}`aerc-accounts(5)`. + ''; + }; + + extraBinds = mkOption { + type = confSections; + default = { }; + example = literalExpression ''{ messages = { d = ":move ''${folder.trash}"; }; }''; + description = '' + Extra bindings specific to this account, added to + {file}`$HOME/.config/aerc/binds.conf`. + See {manpage}`aerc-binds(5)`. + ''; + }; + + extraConfig = mkOption { + type = confSections; + default = { }; + example = literalExpression "{ ui = { sidebar-width = 25; }; }"; + description = '' + Config specific to this account, added to {file}`$HOME/.config/aerc/aerc.conf`. + Aerc only supports per-account UI configuration. + For other sections of {file}`$HOME/.config/aerc/aerc.conf`, + use `programs.aerc.extraConfig`. + See {manpage}`aerc-config(5)`. + ''; + }; + + imapAuth = mkOption { + type = + with types; + nullOr (enum [ + "oauthbearer" + "xoauth2" + ]); + default = null; + example = "auth"; + description = '' + Sets the authentication mechanism if imap is used as the incoming + method. + See {manpage}`aerc-imap(5)`. + ''; + }; + + imapOauth2Params = oauth2Params; + + smtpAuth = mkOption { + type = + with types; + nullOr (enum [ + "none" + "plain" + "login" + "oauthbearer" + "xoauth2" + ]); + default = "plain"; + example = "auth"; + description = '' + Sets the authentication mechanism if smtp is used as the outgoing + method. + See {manpage}`aerc-smtp(5)`. + ''; + }; + + smtpOauth2Params = oauth2Params; }; - - extraBinds = mkOption { - type = confSections; - default = { }; - example = literalExpression - ''{ messages = { d = ":move ''${folder.trash}"; }; }''; - description = '' - Extra bindings specific to this account, added to - {file}`$HOME/.config/aerc/binds.conf`. - See {manpage}`aerc-binds(5)`. - ''; - }; - - extraConfig = mkOption { - type = confSections; - default = { }; - example = literalExpression "{ ui = { sidebar-width = 25; }; }"; - description = '' - Config specific to this account, added to {file}`$HOME/.config/aerc/aerc.conf`. - Aerc only supports per-account UI configuration. - For other sections of {file}`$HOME/.config/aerc/aerc.conf`, - use `programs.aerc.extraConfig`. - See {manpage}`aerc-config(5)`. - ''; - }; - - imapAuth = mkOption { - type = with types; nullOr (enum [ "oauthbearer" "xoauth2" ]); - default = null; - example = "auth"; - description = '' - Sets the authentication mechanism if imap is used as the incoming - method. - See {manpage}`aerc-imap(5)`. - ''; - }; - - imapOauth2Params = oauth2Params; - - smtpAuth = mkOption { - type = with types; - nullOr (enum [ "none" "plain" "login" "oauthbearer" "xoauth2" ]); - default = "plain"; - example = "auth"; - description = '' - Sets the authentication mechanism if smtp is used as the outgoing - method. - See {manpage}`aerc-smtp(5)`. - ''; - }; - - smtpOauth2Params = oauth2Params; - }; - }); + } + ); }; - mkAccount = name: account: + mkAccount = + name: account: let nullOrMap = f: v: if v == null then v else f v; optPort = port: if port != null then ":${toString port}" else ""; - optAttr = k: v: - if v != null && v != [ ] && v != "" then { ${k} = v; } else { }; + optAttr = k: v: if v != null && v != [ ] && v != "" then { ${k} = v; } else { }; - optPwCmd = k: p: - optAttr "${k}-cred-cmd" (nullOrMap (lib.concatStringsSep " ") p); + optPwCmd = k: p: optAttr "${k}-cred-cmd" (nullOrMap (lib.concatStringsSep " ") p); - useOauth = auth: builtins.elem auth [ "oauthbearer" "xoauth2" ]; + useOauth = + auth: + builtins.elem auth [ + "oauthbearer" + "xoauth2" + ]; - oauthParams = { auth, params }: + oauthParams = + { auth, params }: if useOauth auth && params != null && params != { } then - "?" + builtins.concatStringsSep "&" - (lib.attrsets.mapAttrsToList (k: v: k + "=" + lib.strings.escapeURL v) - (lib.attrsets.filterAttrs (k: v: v != null) params)) + "?" + + builtins.concatStringsSep "&" ( + lib.attrsets.mapAttrsToList (k: v: k + "=" + lib.strings.escapeURL v) ( + lib.attrsets.filterAttrs (k: v: v != null) params + ) + ) else ""; mkConfig = { maildir = cfg: { - source = - "maildir://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}"; + source = "maildir://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}"; }; maildirpp = cfg: { - source = - "maildirpp://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}/Inbox"; + source = "maildirpp://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}/Inbox"; }; - imap = { userName, imap, passwordCommand, aerc, ... }@cfg: + imap = + { + userName, + imap, + passwordCommand, + aerc, + ... + }@cfg: let - loginMethod' = - if cfg.aerc.imapAuth != null then "+${cfg.aerc.imapAuth}" else ""; + loginMethod' = if cfg.aerc.imapAuth != null then "+${cfg.aerc.imapAuth}" else ""; oauthParams' = oauthParams { auth = cfg.aerc.imapAuth; params = cfg.aerc.imapOauth2Params; }; - protocol = if imap.tls.enable then - if imap.tls.useStartTls then "imap" else "imaps${loginMethod'}" - else - "imap+insecure"; + protocol = + if imap.tls.enable then + if imap.tls.useStartTls then "imap" else "imaps${loginMethod'}" + else + "imap+insecure"; port' = optPort imap.port; - in { - source = - "${protocol}://${userName}@${imap.host}${port'}${oauthParams'}"; - } // optPwCmd "source" passwordCommand; + in + { + source = "${protocol}://${userName}@${imap.host}${port'}${oauthParams'}"; + } + // optPwCmd "source" passwordCommand; - smtp = { userName, smtp, passwordCommand, ... }@cfg: + smtp = + { + userName, + smtp, + passwordCommand, + ... + }@cfg: let - loginMethod' = - if cfg.aerc.smtpAuth != null then "+${cfg.aerc.smtpAuth}" else ""; + loginMethod' = if cfg.aerc.smtpAuth != null then "+${cfg.aerc.smtpAuth}" else ""; oauthParams' = oauthParams { auth = cfg.aerc.smtpAuth; params = cfg.aerc.smtpOauth2Params; }; - protocol = if smtp.tls.enable then - if smtp.tls.useStartTls then - "smtp${loginMethod'}" + protocol = + if smtp.tls.enable then + if smtp.tls.useStartTls then "smtp${loginMethod'}" else "smtps${loginMethod'}" else - "smtps${loginMethod'}" - else - "smtp+insecure${loginMethod'}"; + "smtp+insecure${loginMethod'}"; port' = optPort smtp.port; - in { - outgoing = - "${protocol}://${userName}@${smtp.host}${port'}${oauthParams'}"; - } // optPwCmd "outgoing" passwordCommand; + in + { + outgoing = "${protocol}://${userName}@${smtp.host}${port'}${oauthParams'}"; + } + // optPwCmd "outgoing" passwordCommand; msmtp = cfg: { outgoing = "msmtpq --read-envelope-from --read-recipients"; @@ -203,17 +248,21 @@ in { }; - basicCfg = account: + basicCfg = + account: { from = "${account.realName} <${account.address}>"; - } // (optAttr "copy-to" account.folders.sent) + } + // (optAttr "copy-to" account.folders.sent) // (optAttr "default" account.folders.inbox) // (optAttr "postpone" account.folders.drafts) // (optAttr "aliases" account.aliases); - sourceCfg = account: - if account.mbsync.enable && account.mbsync.flatten == null - && account.mbsync.subFolders == "Maildir++" then + sourceCfg = + account: + if + account.mbsync.enable && account.mbsync.flatten == null && account.mbsync.subFolders == "Maildir++" + then mkConfig.maildirpp account else if account.mbsync.enable || account.offlineimap.enable then mkConfig.maildir account @@ -222,7 +271,8 @@ in { else { }; - outgoingCfg = account: + outgoingCfg = + account: if account.msmtp.enable then mkConfig.msmtp account else if account.smtp != null then @@ -230,19 +280,22 @@ in { else { }; - gpgCfg = account: + gpgCfg = + account: lib.optionalAttrs (account.gpg != null) { pgp-key-id = account.gpg.key; pgp-auto-sign = account.gpg.signByDefault; pgp-opportunistic-encrypt = account.gpg.encryptByDefault; }; - in (basicCfg account) // (sourceCfg account) // (outgoingCfg account) - // (gpgCfg account) // account.aerc.extraAccounts; + in + (basicCfg account) + // (sourceCfg account) + // (outgoingCfg account) + // (gpgCfg account) + // account.aerc.extraAccounts; - mkAccountConfig = name: account: - mapAttrNames (addAccountName name) account.aerc.extraConfig; + mkAccountConfig = name: account: mapAttrNames (addAccountName name) account.aerc.extraConfig; - mkAccountBinds = name: account: - mapAttrNames (addAccountName name) account.aerc.extraBinds; + mkAccountBinds = name: account: mapAttrNames (addAccountName name) account.aerc.extraBinds; } diff --git a/modules/programs/aerc.nix b/modules/programs/aerc.nix index 132b35d91..03ad890d2 100644 --- a/modules/programs/aerc.nix +++ b/modules/programs/aerc.nix @@ -1,15 +1,34 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) - attrsets generators literalExpression mapAttrs mkIf mkOption types; + attrsets + generators + literalExpression + mapAttrs + mkIf + mkOption + types + ; cfg = config.programs.aerc; - primitive = with types; - ((type: either type (listOf type)) (nullOr (oneOf [ str int bool float ]))) + primitive = + with types; + ((type: either type (listOf type)) ( + nullOr (oneOf [ + str + int + bool + float + ]) + )) // { - description = - "values (null, bool, int, string, or float) or a list of values, that will be joined with a comma"; + description = "values (null, bool, int, string, or float) or a list of values, that will be joined with a comma"; }; confSection = types.attrsOf primitive; @@ -19,18 +38,25 @@ let sectionsOrLines = types.either types.lines confSections; accounts = import ./aerc-accounts.nix { - inherit config pkgs lib confSection confSections; + inherit + config + pkgs + lib + confSection + confSections + ; }; - aerc-accounts = - attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts; + aerc-accounts = attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts; - configDir = if (pkgs.stdenv.isDarwin && !config.xdg.enable) then - "Library/Preferences/aerc" - else - "${config.xdg.configHome}/aerc"; + configDir = + if (pkgs.stdenv.isDarwin && !config.xdg.enable) then + "Library/Preferences/aerc" + else + "${config.xdg.configHome}/aerc"; -in { +in +{ meta.maintainers = with lib.hm.maintainers; [ lukasngl ]; options.accounts.email.accounts = accounts.type; @@ -44,8 +70,7 @@ in { extraAccounts = mkOption { type = sectionsOrLines; default = { }; - example = literalExpression - ''{ Work = { source = "maildir://~/Maildir/work"; }; }''; + example = literalExpression ''{ Work = { source = "maildir://~/Maildir/work"; }; }''; description = '' Extra lines added to {file}`$HOME/.config/aerc/accounts.conf`. @@ -103,127 +128,151 @@ in { }; }; - config = let - joinCfg = cfgs: lib.concatStringsSep "\n" (lib.filter (v: v != "") cfgs); + config = + let + joinCfg = cfgs: lib.concatStringsSep "\n" (lib.filter (v: v != "") cfgs); - toINI = conf: # quirk: global section is prepended w/o section heading - let - global = conf.global or { }; - local = removeAttrs conf [ "global" ]; - mkValueString = v: - if lib.isList v then # join with comma - lib.concatStringsSep "," - (map (generators.mkValueStringDefault { }) v) - else - generators.mkValueStringDefault { } v; - mkKeyValue = - generators.mkKeyValueDefault { inherit mkValueString; } " = "; - in joinCfg [ - (generators.toKeyValue { inherit mkKeyValue; } global) - (generators.toINI { inherit mkKeyValue; } local) + toINI = + conf: # quirk: global section is prepended w/o section heading + let + global = conf.global or { }; + local = removeAttrs conf [ "global" ]; + mkValueString = + v: + if lib.isList v then # join with comma + lib.concatStringsSep "," (map (generators.mkValueStringDefault { }) v) + else + generators.mkValueStringDefault { } v; + mkKeyValue = generators.mkKeyValueDefault { inherit mkValueString; } " = "; + in + joinCfg [ + (generators.toKeyValue { inherit mkKeyValue; } global) + (generators.toINI { inherit mkKeyValue; } local) + ]; + + mkINI = conf: if lib.isString conf then conf else toINI conf; + + mkStyleset = attrsets.mapAttrs' ( + k: v: + let + value = if lib.isString v then v else toINI { global = v; }; + in + { + name = "${configDir}/stylesets/${k}"; + value.text = joinCfg [ + header + value + ]; + } + ); + + mkTemplates = attrsets.mapAttrs' ( + k: v: { + name = "${configDir}/templates/${k}"; + value.text = v; + } + ); + + primaryAccount = attrsets.filterAttrs (_: v: v.primary) aerc-accounts; + otherAccounts = attrsets.filterAttrs (_: v: !v.primary) aerc-accounts; + + primaryAccountAccounts = mapAttrs accounts.mkAccount primaryAccount; + + accountsExtraAccounts = mapAttrs accounts.mkAccount otherAccounts; + + accountsExtraConfig = mapAttrs accounts.mkAccountConfig aerc-accounts; + + accountsExtraBinds = mapAttrs accounts.mkAccountBinds aerc-accounts; + + joinContextual = contextual: joinCfg (map mkINI (lib.attrValues contextual)); + + isRecursivelyEmpty = + x: + if lib.isAttrs x then lib.all (x: x == { } || isRecursivelyEmpty x) (lib.attrValues x) else false; + + genAccountsConf = ( + (cfg.extraAccounts != "" && cfg.extraAccounts != { }) + || !(isRecursivelyEmpty accountsExtraAccounts) + || !(isRecursivelyEmpty primaryAccountAccounts) + ); + + genAercConf = ( + (cfg.extraConfig != "" && cfg.extraConfig != { }) || !(isRecursivelyEmpty accountsExtraConfig) + ); + + genBindsConf = ( + (cfg.extraBinds != "" && cfg.extraBinds != { }) || !(isRecursivelyEmpty accountsExtraBinds) + ); + + header = '' + # Generated by Home Manager. + ''; + + in + mkIf cfg.enable { + warnings = + if genAccountsConf && (cfg.extraConfig.general.unsafe-accounts-conf or false) == false then + [ + '' + aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset. + This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5): + > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600). + > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials. + These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444). + Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`. + This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. + '' + ] + else + [ ]; + + assertions = [ + { + assertion = + let + extraConfigSections = ( + lib.unique (lib.flatten (lib.mapAttrsToList (_: v: lib.attrNames v.aerc.extraConfig) aerc-accounts)) + ); + in + extraConfigSections == [ ] || extraConfigSections == [ "ui" ]; + message = '' + Only the ui section of $XDG_CONFIG_HOME/aerc.conf supports contextual (per-account) configuration. + Please configure it with accounts.email.accounts._.aerc.extraConfig.ui and move any other + configuration to programs.aerc.extraConfig. + ''; + } ]; - mkINI = conf: if lib.isString conf then conf else toINI conf; + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - mkStyleset = attrsets.mapAttrs' (k: v: - let value = if lib.isString v then v else toINI { global = v; }; - in { - name = "${configDir}/stylesets/${k}"; - value.text = joinCfg [ header value ]; - }); + home.file = + { + "${configDir}/accounts.conf" = mkIf genAccountsConf { + text = joinCfg [ + header + (mkINI cfg.extraAccounts) + (mkINI primaryAccountAccounts) + (mkINI accountsExtraAccounts) + ]; + }; - mkTemplates = attrsets.mapAttrs' (k: v: { - name = "${configDir}/templates/${k}"; - value.text = v; - }); + "${configDir}/aerc.conf" = mkIf genAercConf { + text = joinCfg [ + header + (mkINI cfg.extraConfig) + (joinContextual accountsExtraConfig) + ]; + }; - primaryAccount = attrsets.filterAttrs (_: v: v.primary) aerc-accounts; - otherAccounts = attrsets.filterAttrs (_: v: !v.primary) aerc-accounts; - - primaryAccountAccounts = mapAttrs accounts.mkAccount primaryAccount; - - accountsExtraAccounts = mapAttrs accounts.mkAccount otherAccounts; - - accountsExtraConfig = mapAttrs accounts.mkAccountConfig aerc-accounts; - - accountsExtraBinds = mapAttrs accounts.mkAccountBinds aerc-accounts; - - joinContextual = contextual: - joinCfg (map mkINI (lib.attrValues contextual)); - - isRecursivelyEmpty = x: - if lib.isAttrs x then - lib.all (x: x == { } || isRecursivelyEmpty x) (lib.attrValues x) - else - false; - - genAccountsConf = ((cfg.extraAccounts != "" && cfg.extraAccounts != { }) - || !(isRecursivelyEmpty accountsExtraAccounts) - || !(isRecursivelyEmpty primaryAccountAccounts)); - - genAercConf = ((cfg.extraConfig != "" && cfg.extraConfig != { }) - || !(isRecursivelyEmpty accountsExtraConfig)); - - genBindsConf = ((cfg.extraBinds != "" && cfg.extraBinds != { }) - || !(isRecursivelyEmpty accountsExtraBinds)); - - header = '' - # Generated by Home Manager. - ''; - - in mkIf cfg.enable { - warnings = if genAccountsConf - && (cfg.extraConfig.general.unsafe-accounts-conf or false) == false then ['' - aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset. - This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5): - > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600). - > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials. - These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444). - Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`. - This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. - ''] else - [ ]; - - assertions = [{ - assertion = let - extraConfigSections = (lib.unique (lib.flatten - (lib.mapAttrsToList (_: v: lib.attrNames v.aerc.extraConfig) - aerc-accounts))); - in extraConfigSections == [ ] || extraConfigSections == [ "ui" ]; - message = '' - Only the ui section of $XDG_CONFIG_HOME/aerc.conf supports contextual (per-account) configuration. - Please configure it with accounts.email.accounts._.aerc.extraConfig.ui and move any other - configuration to programs.aerc.extraConfig. - ''; - }]; - - home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - - home.file = { - "${configDir}/accounts.conf" = mkIf genAccountsConf { - text = joinCfg [ - header - (mkINI cfg.extraAccounts) - (mkINI primaryAccountAccounts) - (mkINI accountsExtraAccounts) - ]; - }; - - "${configDir}/aerc.conf" = mkIf genAercConf { - text = joinCfg [ - header - (mkINI cfg.extraConfig) - (joinContextual accountsExtraConfig) - ]; - }; - - "${configDir}/binds.conf" = mkIf genBindsConf { - text = joinCfg [ - header - (mkINI cfg.extraBinds) - (joinContextual accountsExtraBinds) - ]; - }; - } // (mkStyleset cfg.stylesets) // (mkTemplates cfg.templates); - }; + "${configDir}/binds.conf" = mkIf genBindsConf { + text = joinCfg [ + header + (mkINI cfg.extraBinds) + (joinContextual accountsExtraBinds) + ]; + }; + } + // (mkStyleset cfg.stylesets) + // (mkTemplates cfg.templates); + }; } diff --git a/modules/programs/aerospace.nix b/modules/programs/aerospace.nix index beceb9e51..6d24c2241 100644 --- a/modules/programs/aerospace.nix +++ b/modules/programs/aerospace.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkOption types; cfg = config.programs.aerospace; @@ -6,22 +11,29 @@ let tomlFormat = pkgs.formats.toml { }; # filterAttrsRecursive supporting lists, as well. - filterListAndAttrsRecursive = pred: set: - lib.listToAttrs (lib.concatMap (name: - let v = set.${name}; - in if pred v then - [ - (lib.nameValuePair name (if lib.isAttrs v then - filterListAndAttrsRecursive pred v - else if lib.isList v then - (map (i: - if lib.isAttrs i then filterListAndAttrsRecursive pred i else i) - (lib.filter pred v)) - else - v)) - ] - else - [ ]) (lib.attrNames set)); + filterListAndAttrsRecursive = + pred: set: + lib.listToAttrs ( + lib.concatMap ( + name: + let + v = set.${name}; + in + if pred v then + [ + (lib.nameValuePair name ( + if lib.isAttrs v then + filterListAndAttrsRecursive pred v + else if lib.isList v then + (map (i: if lib.isAttrs i then filterListAndAttrsRecursive pred i else i) (lib.filter pred v)) + else + v + )) + ] + else + [ ] + ) (lib.attrNames set) + ); filterNulls = filterListAndAttrsRecursive (v: v != null); # Turns @@ -30,16 +42,22 @@ let # {"if.foo" = "xxx"; "if.bar" = "yyy"} # so that the correct TOML is generated for the # on-window-detected table. - flattenConditions = attrs: - let conditions = attrs."if" or { }; - in builtins.removeAttrs attrs [ "if" ] - // lib.concatMapAttrs (n: v: { "if.${n}" = v; }) conditions; + flattenConditions = + attrs: + let + conditions = attrs."if" or { }; + in + builtins.removeAttrs attrs [ "if" ] // lib.concatMapAttrs (n: v: { "if.${n}" = v; }) conditions; - flattenOnWindowDetected = cfg: - let owd = cfg.on-window-detected or [ ]; - in cfg // { on-window-detected = map flattenConditions owd; }; + flattenOnWindowDetected = + cfg: + let + owd = cfg.on-window-detected or [ ]; + in + cfg // { on-window-detected = map flattenConditions owd; }; -in { +in +{ meta.maintainers = with lib.hm.maintainers; [ damidoug ]; options.programs.aerospace = { @@ -76,102 +94,122 @@ in { enable-normalization-flatten-containers = mkOption { type = types.bool; default = true; - description = - ''Containers that have only one child are "flattened".''; + description = ''Containers that have only one child are "flattened".''; + }; + enable-normalization-opposite-orientation-for-nested-containers = mkOption { + type = types.bool; + default = true; + description = "Containers that nest into each other must have opposite orientations."; }; - enable-normalization-opposite-orientation-for-nested-containers = - mkOption { - type = types.bool; - default = true; - description = - "Containers that nest into each other must have opposite orientations."; - }; accordion-padding = mkOption { type = types.int; default = 30; description = "Padding between windows in an accordion container."; }; default-root-container-layout = mkOption { - type = types.enum [ "tiles" "accordion" ]; + type = types.enum [ + "tiles" + "accordion" + ]; default = "tiles"; description = "Default layout for the root container."; }; default-root-container-orientation = mkOption { - type = types.enum [ "horizontal" "vertical" "auto" ]; + type = types.enum [ + "horizontal" + "vertical" + "auto" + ]; default = "auto"; description = "Default orientation for the root container."; }; on-window-detected = mkOption { - type = types.listOf (types.submodule { - options = { - "if" = mkOption { - type = types.submodule { - options = { - app-id = mkOption { - type = with types; nullOr str; - default = null; - description = "The application ID to match (optional)."; - }; - workspace = mkOption { - type = with types; nullOr str; - default = null; - description = "The workspace name to match (optional)."; - }; - window-title-regex-substring = mkOption { - type = with types; nullOr str; - default = null; - description = - "Substring to match in the window title (optional)."; - }; - app-name-regex-substring = mkOption { - type = with types; nullOr str; - default = null; - description = - "Regex substring to match the app name (optional)."; - }; - during-aerospace-startup = mkOption { - type = with types; nullOr bool; - default = null; - description = - "Whether to match during aerospace startup (optional)."; + type = types.listOf ( + types.submodule { + options = { + "if" = mkOption { + type = types.submodule { + options = { + app-id = mkOption { + type = with types; nullOr str; + default = null; + description = "The application ID to match (optional)."; + }; + workspace = mkOption { + type = with types; nullOr str; + default = null; + description = "The workspace name to match (optional)."; + }; + window-title-regex-substring = mkOption { + type = with types; nullOr str; + default = null; + description = "Substring to match in the window title (optional)."; + }; + app-name-regex-substring = mkOption { + type = with types; nullOr str; + default = null; + description = "Regex substring to match the app name (optional)."; + }; + during-aerospace-startup = mkOption { + type = with types; nullOr bool; + default = null; + description = "Whether to match during aerospace startup (optional)."; + }; }; }; + default = { }; + description = "Conditions for detecting a window."; + }; + check-further-callbacks = mkOption { + type = with types; nullOr bool; + default = null; + description = "Whether to check further callbacks after this rule (optional)."; + }; + run = mkOption { + type = + with types; + oneOf [ + str + (listOf str) + ]; + example = [ + "move-node-to-workspace m" + "resize-node" + ]; + description = "Commands to execute when the conditions match (required)."; }; - default = { }; - description = "Conditions for detecting a window."; }; - check-further-callbacks = mkOption { - type = with types; nullOr bool; - default = null; - description = - "Whether to check further callbacks after this rule (optional)."; - }; - run = mkOption { - type = with types; oneOf [ str (listOf str) ]; - example = [ "move-node-to-workspace m" "resize-node" ]; - description = - "Commands to execute when the conditions match (required)."; - }; - }; - }); + } + ); default = [ ]; - example = [{ - "if" = { - app-id = "Another.Cool.App"; - workspace = "cool-workspace"; - window-title-regex-substring = "Title"; - app-name-regex-substring = "CoolApp"; - during-aerospace-startup = false; - }; - check-further-callbacks = false; - run = [ "move-node-to-workspace m" "resize-node" ]; - }]; - description = - "Commands to run every time a new window is detected with optional conditions."; + example = [ + { + "if" = { + app-id = "Another.Cool.App"; + workspace = "cool-workspace"; + window-title-regex-substring = "Title"; + app-name-regex-substring = "CoolApp"; + during-aerospace-startup = false; + }; + check-further-callbacks = false; + run = [ + "move-node-to-workspace m" + "resize-node" + ]; + } + ]; + description = "Commands to run every time a new window is detected with optional conditions."; }; workspace-to-monitor-force-assignment = mkOption { - type = with types; - nullOr (attrsOf (oneOf [ int str (listOf str) ])); + type = + with types; + nullOr ( + attrsOf (oneOf [ + int + str + (listOf str) + ]) + ); default = null; description = '' Map workspaces to specific monitors. @@ -182,17 +220,18 @@ in { "2" = "main"; # Main monitor. "3" = "secondary"; # Secondary monitor (non-main). "4" = "built-in"; # Built-in display. - "5" = - "^built-in retina display$"; # Regex for the built-in retina display. - "6" = [ "secondary" "dell" ]; # Match first pattern in the list. + "5" = "^built-in retina display$"; # Regex for the built-in retina display. + "6" = [ + "secondary" + "dell" + ]; # Match first pattern in the list. }; }; on-focus-changed = mkOption { type = with types; listOf str; default = [ ]; example = [ "move-mouse monitor-lazy-center" ]; - description = - "Commands to run every time focused window or workspace changes."; + description = "Commands to run every time focused window or workspace changes."; }; on-focused-monitor-changed = mkOption { type = with types; listOf str; @@ -210,7 +249,10 @@ in { description = "Commands to run every time workspace changes."; }; key-mapping.preset = mkOption { - type = types.enum [ "qwerty" "dvorak" ]; + type = types.enum [ + "qwerty" + "dvorak" + ]; default = "qwerty"; description = "Keymapping preset."; }; @@ -243,15 +285,14 @@ in { config = lib.mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "programs.aerospace" pkgs - lib.platforms.darwin) + (lib.hm.assertions.assertPlatform "programs.aerospace" pkgs lib.platforms.darwin) ]; home = { packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - file.".config/aerospace/aerospace.toml".source = - tomlFormat.generate "aerospace" - (filterNulls (flattenOnWindowDetected cfg.userSettings)); + file.".config/aerospace/aerospace.toml".source = tomlFormat.generate "aerospace" ( + filterNulls (flattenOnWindowDetected cfg.userSettings) + ); }; }; } diff --git a/modules/programs/afew.nix b/modules/programs/afew.nix index f6536918e..780b63998 100644 --- a/modules/programs/afew.nix +++ b/modules/programs/afew.nix @@ -1,6 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.afew; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.afew; +in +{ options.programs.afew = { enable = lib.mkEnableOption "the afew initial tagging script for Notmuch"; diff --git a/modules/programs/alacritty.nix b/modules/programs/alacritty.nix index 1891126c9..25a13f5c5 100644 --- a/modules/programs/alacritty.nix +++ b/modules/programs/alacritty.nix @@ -1,8 +1,14 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.alacritty; tomlFormat = pkgs.formats.toml { }; -in { +in +{ options = { programs.alacritty = { enable = lib.mkEnableOption "Alacritty"; @@ -56,40 +62,45 @@ in { }; config = lib.mkIf cfg.enable { - assertions = [{ - # If using the theme option, ensure that theme exists in the - # alacritty-theme package. - assertion = let - available = lib.pipe "${pkgs.alacritty-theme}/share/alacritty-theme" [ - builtins.readDir - (lib.filterAttrs - (name: type: type == "regular" && lib.hasSuffix ".toml" name)) - lib.attrNames - (lib.map (lib.removeSuffix ".toml")) - ]; - in cfg.theme == null || (builtins.elem cfg.theme available); - message = "The alacritty theme '${cfg.theme}' does not exist."; - }]; + assertions = [ + { + # If using the theme option, ensure that theme exists in the + # alacritty-theme package. + assertion = + let + available = lib.pipe "${pkgs.alacritty-theme}/share/alacritty-theme" [ + builtins.readDir + (lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".toml" name)) + lib.attrNames + (lib.map (lib.removeSuffix ".toml")) + ]; + in + cfg.theme == null || (builtins.elem cfg.theme available); + message = "The alacritty theme '${cfg.theme}' does not exist."; + } + ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - programs.alacritty.settings = let - theme = "${pkgs.alacritty-theme}/share/alacritty-theme/${cfg.theme}.toml"; - in lib.mkIf (cfg.theme != null) { - general.import = - lib.mkIf (lib.versionAtLeast cfg.package.version "0.14") [ theme ]; - import = lib.mkIf (lib.versionOlder cfg.package.version "0.14") [ theme ]; - }; + programs.alacritty.settings = + let + theme = "${pkgs.alacritty-theme}/share/alacritty-theme/${cfg.theme}.toml"; + in + lib.mkIf (cfg.theme != null) { + general.import = lib.mkIf (lib.versionAtLeast cfg.package.version "0.14") [ theme ]; + import = lib.mkIf (lib.versionOlder cfg.package.version "0.14") [ theme ]; + }; xdg.configFile."alacritty/alacritty.toml" = lib.mkIf (cfg.settings != { }) { - source = (tomlFormat.generate "alacritty.toml" cfg.settings).overrideAttrs - (finalAttrs: prevAttrs: { + source = (tomlFormat.generate "alacritty.toml" cfg.settings).overrideAttrs ( + finalAttrs: prevAttrs: { buildCommand = lib.concatStringsSep "\n" [ prevAttrs.buildCommand # TODO: why is this needed? Is there a better way to retain escape sequences? "substituteInPlace $out --replace-quiet '\\\\' '\\'" ]; - }); + } + ); }; }; } diff --git a/modules/programs/alot-accounts.nix b/modules/programs/alot-accounts.nix index d4df3bfc4..663c5374a 100644 --- a/modules/programs/alot-accounts.nix +++ b/modules/programs/alot-accounts.nix @@ -1,7 +1,9 @@ pkgs: { config, lib, ... }: -let inherit (lib) mkOption types; -in { +let + inherit (lib) mkOption types; +in +{ options.alot = { sendMailCommand = mkOption { type = types.nullOr types.str; @@ -16,11 +18,9 @@ in { type = types.attrsOf types.str; default = { type = "shellcommand"; - command = - "'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'"; - regexp = "'\\[?{" + '' - "name": "(?P.*)", "address": "(?P.+)", "name-addr": ".*"'' - + "}[,\\]]?'"; + command = "'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'"; + regexp = + "'\\[?{" + ''"name": "(?P.*)", "address": "(?P.+)", "name-addr": ".*"'' + "}[,\\]]?'"; shellcommand_external_filtering = "False"; }; example = lib.literalExpression '' @@ -48,9 +48,8 @@ in { }; config = lib.mkIf config.notmuch.enable { - alot.sendMailCommand = lib.mkOptionDefault (if config.msmtp.enable then - "msmtpq --read-envelope-from --read-recipients" - else - null); + alot.sendMailCommand = lib.mkOptionDefault ( + if config.msmtp.enable then "msmtpq --read-envelope-from --read-recipients" else null + ); }; } diff --git a/modules/programs/alot.nix b/modules/programs/alot.nix index 7217b77f7..c61784aea 100644 --- a/modules/programs/alot.nix +++ b/modules/programs/alot.nix @@ -1,22 +1,35 @@ # alot config loader is sensitive to leading space ! -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) - concatStringsSep mapAttrsToList mkOption optionalAttrs optionalString types; + concatStringsSep + mapAttrsToList + mkOption + optionalAttrs + optionalString + types + ; cfg = config.programs.alot; - enabledAccounts = lib.filter (a: a.notmuch.enable) - (lib.attrValues config.accounts.email.accounts); + enabledAccounts = lib.filter (a: a.notmuch.enable) (lib.attrValues config.accounts.email.accounts); # sorted: primary first alotAccounts = lib.sort (a: b: !(a.primary -> b.primary)) enabledAccounts; boolStr = v: if v then "True" else "False"; - mkKeyValue = key: value: - let value' = if lib.isBool value then boolStr value else toString value; - in "${key} = ${value'}"; + mkKeyValue = + key: value: + let + value' = if lib.isBool value then boolStr value else toString value; + in + "${key} = ${value'}"; mk2ndLevelSectionName = name: "[" + name + "]"; @@ -59,67 +72,95 @@ let }; }; - accountStr = account: + accountStr = + account: let inherit (account) - alot maildir name address realName folders aliases gpg signature; - in concatStringsSep "\n" ([ "[[${name}]]" ] - ++ mapAttrsToList (n: v: n + "=" + v) ({ - address = address; - realname = realName; - sendmail_command = - optionalString (alot.sendMailCommand != null) alot.sendMailCommand; - } // optionalAttrs (folders.sent != null) { - sent_box = "maildir" + "://" + maildir.absPath + "/" + folders.sent; - } // optionalAttrs (folders.drafts != null) { - draft_box = "maildir" + "://" + maildir.absPath + "/" + folders.drafts; - } // optionalAttrs (aliases != [ ]) { - aliases = concatStringsSep "," aliases; - } // optionalAttrs (gpg != null) { - gpg_key = gpg.key; - encrypt_by_default = if gpg.encryptByDefault then "all" else "none"; - sign_by_default = boolStr gpg.signByDefault; - } // optionalAttrs (signature.showSignature != "none") { - signature = pkgs.writeText "signature.txt" signature.text; - signature_as_attachment = boolStr (signature.showSignature == "attach"); - }) ++ [ alot.extraConfig ] ++ [ "[[[abook]]]" ] - ++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion); + alot + maildir + name + address + realName + folders + aliases + gpg + signature + ; + in + concatStringsSep "\n" ( + [ "[[${name}]]" ] + ++ mapAttrsToList (n: v: n + "=" + v) ( + { + address = address; + realname = realName; + sendmail_command = optionalString (alot.sendMailCommand != null) alot.sendMailCommand; + } + // optionalAttrs (folders.sent != null) { + sent_box = "maildir" + "://" + maildir.absPath + "/" + folders.sent; + } + // optionalAttrs (folders.drafts != null) { + draft_box = "maildir" + "://" + maildir.absPath + "/" + folders.drafts; + } + // optionalAttrs (aliases != [ ]) { + aliases = concatStringsSep "," aliases; + } + // optionalAttrs (gpg != null) { + gpg_key = gpg.key; + encrypt_by_default = if gpg.encryptByDefault then "all" else "none"; + sign_by_default = boolStr gpg.signByDefault; + } + // optionalAttrs (signature.showSignature != "none") { + signature = pkgs.writeText "signature.txt" signature.text; + signature_as_attachment = boolStr (signature.showSignature == "attach"); + } + ) + ++ [ alot.extraConfig ] + ++ [ "[[[abook]]]" ] + ++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion + ); - configFile = let - bindingsToStr = attrSet: - concatStringsSep "\n" (mapAttrsToList (n: v: "${n} = ${v}") attrSet); - in '' - # Generated by Home Manager. - # See http://alot.readthedocs.io/en/latest/configuration/config_options.html + configFile = + let + bindingsToStr = attrSet: concatStringsSep "\n" (mapAttrsToList (n: v: "${n} = ${v}") attrSet); + in + '' + # Generated by Home Manager. + # See http://alot.readthedocs.io/en/latest/configuration/config_options.html - ${lib.generators.toKeyValue { inherit mkKeyValue; } cfg.settings} - ${cfg.extraConfig} - [tags] - '' + (let - submoduleToAttrs = m: - lib.filterAttrs (name: v: name != "_module" && v != null) m; - in lib.generators.toINI { mkSectionName = mk2ndLevelSectionName; } - (lib.mapAttrs (name: x: submoduleToAttrs x) cfg.tags)) + '' - [bindings] - ${bindingsToStr cfg.bindings.global} + ${lib.generators.toKeyValue { inherit mkKeyValue; } cfg.settings} + ${cfg.extraConfig} + [tags] + '' + + ( + let + submoduleToAttrs = m: lib.filterAttrs (name: v: name != "_module" && v != null) m; + in + lib.generators.toINI { mkSectionName = mk2ndLevelSectionName; } ( + lib.mapAttrs (name: x: submoduleToAttrs x) cfg.tags + ) + ) + + '' + [bindings] + ${bindingsToStr cfg.bindings.global} - [[bufferlist]] - ${bindingsToStr cfg.bindings.bufferlist} - [[search]] - ${bindingsToStr cfg.bindings.search} - [[envelope]] - ${bindingsToStr cfg.bindings.envelope} - [[taglist]] - ${bindingsToStr cfg.bindings.taglist} - [[thread]] - ${bindingsToStr cfg.bindings.thread} + [[bufferlist]] + ${bindingsToStr cfg.bindings.bufferlist} + [[search]] + ${bindingsToStr cfg.bindings.search} + [[envelope]] + ${bindingsToStr cfg.bindings.envelope} + [[taglist]] + ${bindingsToStr cfg.bindings.taglist} + [[thread]] + ${bindingsToStr cfg.bindings.thread} - [accounts] + [accounts] - ${lib.concatStringsSep "\n\n" (map accountStr alotAccounts)} - ''; + ${lib.concatStringsSep "\n\n" (map accountStr alotAccounts)} + ''; -in { +in +{ options = { programs.alot = { enable = mkOption { @@ -196,9 +237,12 @@ in { }; settings = mkOption { - type = with types; - let primitive = either (either (either str int) bool) float; - in attrsOf primitive; + type = + with types; + let + primitive = either (either (either str int) bool) float; + in + attrsOf primitive; default = { initial_command = "search tag:inbox AND NOT tag:killed"; auto_remove_unread = true; @@ -237,9 +281,11 @@ in { xdg.configFile."alot/config".text = configFile; xdg.configFile."alot/hooks.py" = lib.mkIf (cfg.hooks != "") { - text = '' - # Generated by Home Manager. - '' + cfg.hooks; + text = + '' + # Generated by Home Manager. + '' + + cfg.hooks; }; }; } diff --git a/modules/programs/antidote.nix b/modules/programs/antidote.nix index 570c4370a..ff7193911 100644 --- a/modules/programs/antidote.nix +++ b/modules/programs/antidote.nix @@ -1,15 +1,25 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.zsh.antidote; - zPluginStr = (pluginNames: - lib.optionalString (pluginNames != [ ]) "${lib.concatStrings (map (name: '' - ${name} - '') pluginNames)}"); + zPluginStr = ( + pluginNames: + lib.optionalString (pluginNames != [ ]) + "${lib.concatStrings ( + map (name: '' + ${name} + '') pluginNames + )}" + ); - parseHashId = path: - lib.elemAt (builtins.match "${builtins.storeDir}/([a-zA-Z0-9]+)-.*" path) 0; -in { + parseHashId = path: lib.elemAt (builtins.match "${builtins.storeDir}/([a-zA-Z0-9]+)-.*" path) 0; +in +{ meta.maintainers = [ lib.maintainers.hitsmaxft ]; options.programs.zsh.antidote = { @@ -30,25 +40,26 @@ in { config = lib.mkIf cfg.enable { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - programs.zsh.initContent = let - configFiles = pkgs.runCommand "hm_antidote-files" { } '' - echo "${zPluginStr cfg.plugins}" > $out - ''; - hashId = parseHashId "${configFiles}"; - in (lib.mkOrder 550 '' - ## home-manager/antidote begin : - source ${cfg.package}/share/antidote/antidote.zsh - ${lib.optionalString cfg.useFriendlyNames - "zstyle ':antidote:bundle' use-friendly-names 'yes'"} + programs.zsh.initContent = + let + configFiles = pkgs.runCommand "hm_antidote-files" { } '' + echo "${zPluginStr cfg.plugins}" > $out + ''; + hashId = parseHashId "${configFiles}"; + in + (lib.mkOrder 550 '' + ## home-manager/antidote begin : + source ${cfg.package}/share/antidote/antidote.zsh + ${lib.optionalString cfg.useFriendlyNames "zstyle ':antidote:bundle' use-friendly-names 'yes'"} - bundlefile=${configFiles} - zstyle ':antidote:bundle' file $bundlefile - staticfile=/tmp/tmp_hm_zsh_plugins.zsh-${hashId} - zstyle ':antidote:static' file $staticfile + bundlefile=${configFiles} + zstyle ':antidote:bundle' file $bundlefile + staticfile=/tmp/tmp_hm_zsh_plugins.zsh-${hashId} + zstyle ':antidote:static' file $staticfile - antidote load $bundlefile $staticfile + antidote load $bundlefile $staticfile - ## home-manager/antidote end - ''); + ## home-manager/antidote end + ''); }; } diff --git a/modules/programs/aria2.nix b/modules/programs/aria2.nix index cbcfa01e1..54e230230 100644 --- a/modules/programs/aria2.nix +++ b/modules/programs/aria2.nix @@ -1,16 +1,20 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.aria2; - formatLine = n: v: + formatLine = + n: v: let - formatValue = v: - if builtins.isBool v then - (if v then "true" else "false") - else - toString v; - in "${n}=${formatValue v}"; -in { + formatValue = v: if builtins.isBool v then (if v then "true" else "false") else toString v; + in + "${n}=${formatValue v}"; +in +{ meta.maintainers = [ lib.hm.maintainers.justinlovinger ]; options.programs.aria2 = { @@ -19,7 +23,14 @@ in { package = lib.mkPackageOption pkgs "aria2" { nullable = true; }; settings = lib.mkOption { - type = with lib.types; attrsOf (oneOf [ bool float int str ]); + type = + with lib.types; + attrsOf (oneOf [ + bool + float + int + str + ]); default = { }; description = '' Options to add to {file}`aria2.conf` file. @@ -50,8 +61,10 @@ in { config = lib.mkIf cfg.enable { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - xdg.configFile."aria2/aria2.conf".text = lib.concatStringsSep "\n" ([ ] + xdg.configFile."aria2/aria2.conf".text = lib.concatStringsSep "\n" ( + [ ] ++ lib.mapAttrsToList formatLine cfg.settings - ++ lib.optional (cfg.extraConfig != "") cfg.extraConfig); + ++ lib.optional (cfg.extraConfig != "") cfg.extraConfig + ); }; } diff --git a/modules/programs/astroid-accounts.nix b/modules/programs/astroid-accounts.nix index 501546085..5a7cf2721 100644 --- a/modules/programs/astroid-accounts.nix +++ b/modules/programs/astroid-accounts.nix @@ -1,4 +1,5 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ options.astroid = { enable = lib.mkEnableOption "Astroid"; @@ -14,7 +15,9 @@ extraConfig = lib.mkOption { type = lib.types.attrsOf lib.types.anything; default = { }; - example = { select_query = ""; }; + example = { + select_query = ""; + }; description = '' Extra settings to add to this astroid account configuration. ''; @@ -22,7 +25,8 @@ }; config = lib.mkIf config.notmuch.enable { - astroid.sendMailCommand = lib.mkIf config.msmtp.enable - (lib.mkOptionDefault "msmtpq --read-envelope-from --read-recipients"); + astroid.sendMailCommand = lib.mkIf config.msmtp.enable ( + lib.mkOptionDefault "msmtpq --read-envelope-from --read-recipients" + ); }; } diff --git a/modules/programs/astroid.nix b/modules/programs/astroid.nix index 0cdba1492..7196fe782 100644 --- a/modules/programs/astroid.nix +++ b/modules/programs/astroid.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkOption types; @@ -6,12 +11,12 @@ let jsonFormat = pkgs.formats.json { }; - astroidAccounts = - lib.filterAttrs (n: v: v.astroid.enable) config.accounts.email.accounts; + astroidAccounts = lib.filterAttrs (n: v: v.astroid.enable) config.accounts.email.accounts; boolOpt = b: if b then "true" else "false"; - accountAttr = account: + accountAttr = + account: with account; { email = address; @@ -23,33 +28,38 @@ let save_sent = "true"; save_sent_to = "${maildir.absPath}/${folders.sent}/cur/"; select_query = ""; - } // lib.optionalAttrs (signature.showSignature != "none") { + } + // lib.optionalAttrs (signature.showSignature != "none") { signature_attach = boolOpt (signature.showSignature == "attach"); signature_default_on = boolOpt (signature.showSignature != "none"); signature_file = pkgs.writeText "signature.txt" signature.text; signature_file_markdown = "false"; signature_separate = "true"; # prepends '--\n' to the signature - } // lib.optionalAttrs (gpg != null) { + } + // lib.optionalAttrs (gpg != null) { always_gpg_sign = boolOpt gpg.signByDefault; gpgkey = gpg.key; - } // astroid.extraConfig; + } + // astroid.extraConfig; # See https://github.com/astroidmail/astroid/wiki/Configuration-Reference - finalConfig = let - template = lib.importJSON ./astroid-config-template.json; - astroidConfig = lib.foldl' lib.recursiveUpdate template [ - { - astroid.notmuch_config = - "${config.xdg.configHome}/notmuch/default/config"; - accounts = lib.mapAttrs (n: accountAttr) astroidAccounts; - crypto.gpg.path = "${pkgs.gnupg}/bin/gpg"; - } - cfg.extraConfig - cfg.externalEditor - ]; - in astroidConfig; + finalConfig = + let + template = lib.importJSON ./astroid-config-template.json; + astroidConfig = lib.foldl' lib.recursiveUpdate template [ + { + astroid.notmuch_config = "${config.xdg.configHome}/notmuch/default/config"; + accounts = lib.mapAttrs (n: accountAttr) astroidAccounts; + crypto.gpg.path = "${pkgs.gnupg}/bin/gpg"; + } + cfg.extraConfig + cfg.externalEditor + ]; + in + astroidConfig; -in { +in +{ options = { programs.astroid = { enable = lib.mkEnableOption "Astroid"; @@ -69,15 +79,15 @@ in { type = types.nullOr types.str; default = null; # Converts it into JSON that can be merged into the configuration. - apply = cmd: + apply = + cmd: lib.optionalAttrs (cmd != null) { editor = { "external_editor" = "true"; "cmd" = cmd; }; }; - example = - "nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1"; + example = "nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1"; description = '' You can use the following variables: @@ -117,8 +127,7 @@ in { config = lib.mkIf cfg.enable { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - xdg.configFile."astroid/config".source = - jsonFormat.generate "astroid-config" finalConfig; + xdg.configFile."astroid/config".source = jsonFormat.generate "astroid-config" finalConfig; xdg.configFile."astroid/poll.sh" = lib.mkIf (cfg.pollScript != "") { executable = true; diff --git a/modules/programs/atuin.nix b/modules/programs/atuin.nix index 3c6c355ef..b9f36a2ca 100644 --- a/modules/programs/atuin.nix +++ b/modules/programs/atuin.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.programs.atuin; daemonCfg = cfg.daemon; @@ -7,8 +12,12 @@ let inherit (lib) mkIf mkOption types; inherit (pkgs.stdenv) isLinux isDarwin; -in { - meta.maintainers = with lib.maintainers; [ hawkw water-sucks ]; +in +{ + meta.maintainers = with lib.maintainers; [ + hawkw + water-sucks + ]; options.programs.atuin = { enable = lib.mkEnableOption "atuin"; @@ -17,18 +26,15 @@ in { enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; - extraDescription = - "If enabled, this will bind `ctrl-r` to open the Atuin history."; + extraDescription = "If enabled, this will bind `ctrl-r` to open the Atuin history."; }; enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; - extraDescription = - "If enabled, this will bind the up-arrow key to open the Atuin history."; + extraDescription = "If enabled, this will bind the up-arrow key to open the Atuin history."; }; - enableNushellIntegration = - lib.hm.shell.mkNushellIntegrationOption { inherit config; }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; }; enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; @@ -41,21 +47,30 @@ in { flags = mkOption { default = [ ]; type = types.listOf types.str; - example = [ "--disable-up-arrow" "--disable-ctrl-r" ]; + example = [ + "--disable-up-arrow" + "--disable-ctrl-r" + ]; description = '' Flags to append to the shell hook. ''; }; settings = mkOption { - type = with types; + type = + with types; let - prim = oneOf [ bool int str ]; + prim = oneOf [ + bool + int + str + ]; primOrPrimAttrs = either prim (attrsOf prim); entry = either prim (listOf primOrPrimAttrs); entryOrAttrsOf = t: either entry (attrsOf t); entries = entryOrAttrsOf (entryOrAttrsOf entry); - in attrsOf entries // { description = "Atuin configuration"; }; + in + attrsOf entries // { description = "Atuin configuration"; }; default = { }; example = lib.literalExpression '' { @@ -79,8 +94,15 @@ in { logLevel = mkOption { default = null; - type = - types.nullOr (types.enum [ "trace" "debug" "info" "warn" "error" ]); + type = types.nullOr ( + types.enum [ + "trace" + "debug" + "info" + "warn" + "error" + ] + ); description = '' Verbosity of Atuin daemon logging. ''; @@ -88,126 +110,145 @@ in { }; }; - config = let flagsStr = lib.escapeShellArgs cfg.flags; - in mkIf cfg.enable (lib.mkMerge [ - { - # Always add the configured `atuin` package. - home.packages = [ cfg.package ]; + config = + let + flagsStr = lib.escapeShellArgs cfg.flags; + in + mkIf cfg.enable ( + lib.mkMerge [ + { + # Always add the configured `atuin` package. + home.packages = [ cfg.package ]; - # If there are user-provided settings, generate the config file. - xdg.configFile."atuin/config.toml" = mkIf (cfg.settings != { }) { - source = tomlFormat.generate "atuin-config" cfg.settings; - }; + # If there are user-provided settings, generate the config file. + xdg.configFile."atuin/config.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "atuin-config" cfg.settings; + }; - programs.bash.initExtra = mkIf cfg.enableBashIntegration '' - if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then - source "${pkgs.bash-preexec}/share/bash/bash-preexec.sh" - eval "$(${lib.getExe cfg.package} init bash ${flagsStr})" - fi - ''; + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then + source "${pkgs.bash-preexec}/share/bash/bash-preexec.sh" + eval "$(${lib.getExe cfg.package} init bash ${flagsStr})" + fi + ''; - programs.zsh.initContent = mkIf cfg.enableZshIntegration '' - if [[ $options[zle] = on ]]; then - eval "$(${lib.getExe cfg.package} init zsh ${flagsStr})" - fi - ''; + programs.zsh.initContent = mkIf cfg.enableZshIntegration '' + if [[ $options[zle] = on ]]; then + eval "$(${lib.getExe cfg.package} init zsh ${flagsStr})" + fi + ''; - programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' - ${lib.getExe cfg.package} init fish ${flagsStr} | source - ''; + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' + ${lib.getExe cfg.package} init fish ${flagsStr} | source + ''; - programs.nushell = mkIf cfg.enableNushellIntegration { - extraConfig = '' - source ${ - pkgs.runCommand "atuin-nushell-config.nu" { - nativeBuildInputs = [ pkgs.writableTmpDirAsHomeHook ]; - } '' - ${lib.getExe cfg.package} init nu ${flagsStr} >> "$out" - '' - } - ''; - }; - } - - (mkIf daemonCfg.enable (lib.mkMerge [ - { - assertions = [ - { - assertion = lib.versionAtLeast cfg.package.version "18.2.0"; - message = '' - The Atuin daemon requires at least version 18.2.0 or later. + programs.nushell = mkIf cfg.enableNushellIntegration { + extraConfig = '' + source ${ + pkgs.runCommand "atuin-nushell-config.nu" + { + nativeBuildInputs = [ pkgs.writableTmpDirAsHomeHook ]; + } + '' + ${lib.getExe cfg.package} init nu ${flagsStr} >> "$out" + '' + } ''; - } - { - assertion = isLinux || isDarwin; - message = - "The Atuin daemon can only be configured on either Linux or macOS."; - } - ]; + }; + } - programs.atuin.settings = { daemon = { enabled = true; }; }; - } - (mkIf isLinux { - programs.atuin.settings = { daemon = { systemd_socket = true; }; }; + (mkIf daemonCfg.enable ( + lib.mkMerge [ + { + assertions = [ + { + assertion = lib.versionAtLeast cfg.package.version "18.2.0"; + message = '' + The Atuin daemon requires at least version 18.2.0 or later. + ''; + } + { + assertion = isLinux || isDarwin; + message = "The Atuin daemon can only be configured on either Linux or macOS."; + } + ]; - systemd.user.services.atuin-daemon = { - Unit = { - Description = "Atuin daemon"; - Requires = [ "atuin-daemon.socket" ]; - }; - Install = { - Also = [ "atuin-daemon.socket" ]; - WantedBy = [ "default.target" ]; - }; - Service = { - ExecStart = "${lib.getExe cfg.package} daemon"; - Environment = lib.optionals (daemonCfg.logLevel != null) - [ "ATUIN_LOG=${daemonCfg.logLevel}" ]; - Restart = "on-failure"; - RestartSteps = 3; - RestartMaxDelaySec = 6; - }; - }; - - systemd.user.sockets.atuin-daemon = let - socket_dir = if lib.versionAtLeast cfg.package.version "18.4.0" then - "%t" - else - "%D/atuin"; - in { - Unit = { Description = "Atuin daemon socket"; }; - Install = { WantedBy = [ "sockets.target" ]; }; - Socket = { - ListenStream = "${socket_dir}/atuin.sock"; - SocketMode = "0600"; - RemoveOnStop = true; - }; - }; - }) - (mkIf isDarwin { - programs.atuin.settings = { - daemon = { - socket_path = - lib.mkDefault "${config.xdg.dataHome}/atuin/daemon.sock"; - }; - }; - - launchd.agents.atuin-daemon = { - enable = true; - config = { - ProgramArguments = [ "${lib.getExe cfg.package}" "daemon" ]; - EnvironmentVariables = - lib.optionalAttrs (daemonCfg.logLevel != null) { - ATUIN_LOG = daemonCfg.logLevel; + programs.atuin.settings = { + daemon = { + enabled = true; + }; }; - KeepAlive = { - Crashed = true; - SuccessfulExit = false; - }; - ProcessType = "Background"; - }; - }; - }) - ])) - ]); + } + (mkIf isLinux { + programs.atuin.settings = { + daemon = { + systemd_socket = true; + }; + }; + + systemd.user.services.atuin-daemon = { + Unit = { + Description = "Atuin daemon"; + Requires = [ "atuin-daemon.socket" ]; + }; + Install = { + Also = [ "atuin-daemon.socket" ]; + WantedBy = [ "default.target" ]; + }; + Service = { + ExecStart = "${lib.getExe cfg.package} daemon"; + Environment = lib.optionals (daemonCfg.logLevel != null) [ "ATUIN_LOG=${daemonCfg.logLevel}" ]; + Restart = "on-failure"; + RestartSteps = 3; + RestartMaxDelaySec = 6; + }; + }; + + systemd.user.sockets.atuin-daemon = + let + socket_dir = if lib.versionAtLeast cfg.package.version "18.4.0" then "%t" else "%D/atuin"; + in + { + Unit = { + Description = "Atuin daemon socket"; + }; + Install = { + WantedBy = [ "sockets.target" ]; + }; + Socket = { + ListenStream = "${socket_dir}/atuin.sock"; + SocketMode = "0600"; + RemoveOnStop = true; + }; + }; + }) + (mkIf isDarwin { + programs.atuin.settings = { + daemon = { + socket_path = lib.mkDefault "${config.xdg.dataHome}/atuin/daemon.sock"; + }; + }; + + launchd.agents.atuin-daemon = { + enable = true; + config = { + ProgramArguments = [ + "${lib.getExe cfg.package}" + "daemon" + ]; + EnvironmentVariables = lib.optionalAttrs (daemonCfg.logLevel != null) { + ATUIN_LOG = daemonCfg.logLevel; + }; + KeepAlive = { + Crashed = true; + SuccessfulExit = false; + }; + ProcessType = "Background"; + }; + }; + }) + ] + )) + ] + ); } diff --git a/modules/programs/autojump.nix b/modules/programs/autojump.nix index 85daab13b..4e6a1fd93 100644 --- a/modules/programs/autojump.nix +++ b/modules/programs/autojump.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.autojump; inherit (lib) mkIf; -in { +in +{ meta.maintainers = [ lib.maintainers.evanjs ]; options.programs.autojump = { @@ -11,22 +17,21 @@ in { package = lib.mkPackageOption pkgs "autojump" { }; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = - lib.hm.shell.mkFishIntegrationOption { inherit config; }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = mkIf cfg.enable { home.packages = [ cfg.package ]; - programs.bash.initExtra = mkIf cfg.enableBashIntegration (lib.mkBefore '' - . ${cfg.package}/share/autojump/autojump.bash - ''); + programs.bash.initExtra = mkIf cfg.enableBashIntegration ( + lib.mkBefore '' + . ${cfg.package}/share/autojump/autojump.bash + '' + ); programs.zsh.initContent = mkIf cfg.enableZshIntegration '' . ${cfg.package}/share/autojump/autojump.zsh diff --git a/modules/programs/autorandr.nix b/modules/programs/autorandr.nix index 0763c61bd..ea2d298cf 100644 --- a/modules/programs/autorandr.nix +++ b/modules/programs/autorandr.nix @@ -1,25 +1,49 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) - literalExpression listToAttrs mapAttrs' mapAttrsToList mkIf mkOption - optional types; + literalExpression + listToAttrs + mapAttrs' + mapAttrsToList + mkIf + mkOption + optional + types + ; cfg = config.programs.autorandr; - matrixOf = n: m: elemType: + matrixOf = + n: m: elemType: lib.mkOptionType rec { name = "matrixOf"; - description = - "${toString n}×${toString m} matrix of ${elemType.description}s"; - check = xss: - let listOfSize = l: xs: lib.isList xs && lib.length xs == l; - in listOfSize n xss - && lib.all (xs: listOfSize m xs && lib.all elemType.check xs) xss; + description = "${toString n}×${toString m} matrix of ${elemType.description}s"; + check = + xss: + let + listOfSize = l: xs: lib.isList xs && lib.length xs == l; + in + listOfSize n xss && lib.all (xs: listOfSize m xs && lib.all elemType.check xs) xss; merge = lib.mergeOneOption; - getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "*" "*" ]); + getSubOptions = + prefix: + elemType.getSubOptions ( + prefix + ++ [ + "*" + "*" + ] + ); getSubModules = elemType.getSubModules; substSubModules = mod: matrixOf n m (elemType.substSubModules mod); - functor = (lib.defaultFunctor name) // { wrapped = elemType; }; + functor = (lib.defaultFunctor name) // { + wrapped = elemType; + }; }; profileModule = types.submodule { @@ -97,7 +121,14 @@ let }; rotate = mkOption { - type = types.nullOr (types.enum [ "normal" "left" "right" "inverted" ]); + type = types.nullOr ( + types.enum [ + "normal" + "left" + "right" + "inverted" + ] + ); description = "Output rotate configuration."; default = null; example = "left"; @@ -128,26 +159,31 @@ let }; scale = mkOption { - type = types.nullOr (types.submodule { - options = { - method = mkOption { - type = types.enum [ "factor" "pixel" ]; - description = "Output scaling method."; - default = "factor"; - example = "pixel"; - }; + type = types.nullOr ( + types.submodule { + options = { + method = mkOption { + type = types.enum [ + "factor" + "pixel" + ]; + description = "Output scaling method."; + default = "factor"; + example = "pixel"; + }; - x = mkOption { - type = types.either types.float types.ints.positive; - description = "Horizontal scaling factor/pixels."; - }; + x = mkOption { + type = types.either types.float types.ints.positive; + description = "Horizontal scaling factor/pixels."; + }; - y = mkOption { - type = types.either types.float types.ints.positive; - description = "Vertical scaling factor/pixels."; + y = mkOption { + type = types.either types.float types.ints.positive; + description = "Vertical scaling factor/pixels."; + }; }; - }; - }); + } + ); description = '' Output scale configuration. @@ -172,7 +208,12 @@ let }; filter = mkOption { - type = types.nullOr (types.enum [ "bilinear" "nearest" ]); + type = types.nullOr ( + types.enum [ + "bilinear" + "nearest" + ] + ); description = "Interpolation method to be used for scaling the output."; default = null; example = "nearest"; @@ -242,30 +283,35 @@ let }; }; - hookToFile = folder: name: hook: + hookToFile = + folder: name: hook: lib.nameValuePair "autorandr/${folder}/${name}" { source = "${pkgs.writeShellScriptBin "hook" hook}/bin/hook"; }; - profileToFiles = name: profile: - let inherit (profile) hooks; - in lib.mkMerge [ + profileToFiles = + name: profile: + let + inherit (profile) hooks; + in + lib.mkMerge [ { - "autorandr/${name}/setup".text = lib.concatStringsSep "\n" - (mapAttrsToList fingerprintToString profile.fingerprint); - "autorandr/${name}/config".text = lib.concatStringsSep "\n" - (mapAttrsToList configToString profile.config); + "autorandr/${name}/setup".text = lib.concatStringsSep "\n" ( + mapAttrsToList fingerprintToString profile.fingerprint + ); + "autorandr/${name}/config".text = lib.concatStringsSep "\n" ( + mapAttrsToList configToString profile.config + ); } - (mkIf (hooks.postswitch != "") - (listToAttrs [ (hookToFile name "postswitch" hooks.postswitch) ])) - (mkIf (hooks.preswitch != "") - (listToAttrs [ (hookToFile name "preswitch" hooks.preswitch) ])) - (mkIf (hooks.predetect != "") - (listToAttrs [ (hookToFile name "predetect" hooks.predetect) ])) + (mkIf (hooks.postswitch != "") (listToAttrs [ (hookToFile name "postswitch" hooks.postswitch) ])) + (mkIf (hooks.preswitch != "") (listToAttrs [ (hookToFile name "preswitch" hooks.preswitch) ])) + (mkIf (hooks.predetect != "") (listToAttrs [ (hookToFile name "predetect" hooks.predetect) ])) ]; fingerprintToString = name: edid: "${name} ${edid}"; - configToString = name: config: + configToString = + name: config: if config.enable then - lib.concatStringsSep "\n" ([ "output ${name}" ] + lib.concatStringsSep "\n" ( + [ "output ${name}" ] ++ optional (config.position != "") "pos ${config.position}" ++ optional (config.crtc != null) "crtc ${toString config.crtc}" ++ optional config.primary "primary" @@ -275,18 +321,23 @@ let ++ optional (config.rate != "") "rate ${config.rate}" ++ optional (config.rotate != null) "rotate ${config.rotate}" ++ optional (config.filter != null) "filter ${config.filter}" - ++ optional (config.transform != null) ("transform " - + lib.concatMapStringsSep "," toString (lib.flatten config.transform)) - ++ optional (config.scale != null) - ((if config.scale.method == "factor" then "scale" else "scale-from") - + " ${toString config.scale.x}x${toString config.scale.y}") - ++ optional (config.extraConfig != "") config.extraConfig) - else '' - output ${name} - off - ''; + ++ optional (config.transform != null) ( + "transform " + lib.concatMapStringsSep "," toString (lib.flatten config.transform) + ) + ++ optional (config.scale != null) ( + (if config.scale.method == "factor" then "scale" else "scale-from") + + " ${toString config.scale.x}x${toString config.scale.y}" + ) + ++ optional (config.extraConfig != "") config.extraConfig + ) + else + '' + output ${name} + off + ''; -in { +in +{ options = { programs.autorandr = { enable = lib.mkEnableOption "Autorandr"; @@ -358,15 +409,19 @@ in { }; config = lib.mkIf cfg.enable { - assertions = lib.flatten (mapAttrsToList (profile: - { config, ... }: - mapAttrsToList (output: opts: { - assertion = opts.scale == null || opts.transform == null; - message = '' - Cannot use the profile output options 'scale' and 'transform' simultaneously. - Check configuration for: programs.autorandr.profiles.${profile}.config.${output} - ''; - }) config) cfg.profiles); + assertions = lib.flatten ( + mapAttrsToList ( + profile: + { config, ... }: + mapAttrsToList (output: opts: { + assertion = opts.scale == null || opts.transform == null; + message = '' + Cannot use the profile output options 'scale' and 'transform' simultaneously. + Check configuration for: programs.autorandr.profiles.${profile}.config.${output} + ''; + }) config + ) cfg.profiles + ); home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; diff --git a/modules/programs/awscli.nix b/modules/programs/awscli.nix index 008f182e9..c379f8a1b 100644 --- a/modules/programs/awscli.nix +++ b/modules/programs/awscli.nix @@ -1,10 +1,16 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.awscli; iniFormat = pkgs.formats.ini { }; -in { +in +{ meta.maintainers = [ lib.maintainers.anthonyroussel ]; options.programs.awscli = { @@ -55,16 +61,12 @@ in { config = lib.mkIf cfg.enable { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - home.file."${config.home.homeDirectory}/.aws/config" = - lib.mkIf (cfg.settings != { }) { - source = - iniFormat.generate "aws-config-${config.home.username}" cfg.settings; - }; + home.file."${config.home.homeDirectory}/.aws/config" = lib.mkIf (cfg.settings != { }) { + source = iniFormat.generate "aws-config-${config.home.username}" cfg.settings; + }; - home.file."${config.home.homeDirectory}/.aws/credentials" = - lib.mkIf (cfg.credentials != { }) { - source = iniFormat.generate "aws-credentials-${config.home.username}" - cfg.credentials; - }; + home.file."${config.home.homeDirectory}/.aws/credentials" = lib.mkIf (cfg.credentials != { }) { + source = iniFormat.generate "aws-credentials-${config.home.username}" cfg.credentials; + }; }; } diff --git a/modules/programs/bacon.nix b/modules/programs/bacon.nix index 47c00c83b..17e89d861 100644 --- a/modules/programs/bacon.nix +++ b/modules/programs/bacon.nix @@ -1,16 +1,23 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.bacon; settingsFormat = pkgs.formats.toml { }; - configDir = if pkgs.stdenv.isDarwin then - "Library/Application Support/org.dystroy.bacon" - else - "${config.xdg.configHome}/bacon"; + configDir = + if pkgs.stdenv.isDarwin then + "Library/Application Support/org.dystroy.bacon" + else + "${config.xdg.configHome}/bacon"; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.shimunn ]; options.programs.bacon = { @@ -23,7 +30,13 @@ in { default = { }; example = { jobs.default = { - command = [ "cargo" "build" "--all-features" "--color" "always" ]; + command = [ + "cargo" + "build" + "--all-features" + "--color" + "always" + ]; need_stdout = true; }; }; diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index ccdf5c114..0d30f27fe 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -1,10 +1,21 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) mkIf mkOption optionalAttrs types; + inherit (lib) + mkIf + mkOption + optionalAttrs + types + ; cfg = config.programs.bash; - writeBashScript = name: text: + writeBashScript = + name: text: pkgs.writeTextFile { inherit name text; checkPhase = '' @@ -12,15 +23,19 @@ let ''; }; -in { +in +{ meta.maintainers = [ lib.maintainers.rycee ]; imports = [ - (lib.mkRenamedOptionModule [ "programs" "bash" "enableAutojump" ] [ - "programs" - "autojump" - "enable" - ]) + (lib.mkRenamedOptionModule + [ "programs" "bash" "enableAutojump" ] + [ + "programs" + "autojump" + "enable" + ] + ) ]; options = { @@ -70,8 +85,14 @@ in { }; historyControl = mkOption { - type = types.listOf - (types.enum [ "erasedups" "ignoredups" "ignorespace" "ignoreboth" ]); + type = types.listOf ( + types.enum [ + "erasedups" + "ignoredups" + "ignorespace" + "ignoreboth" + ] + ); default = [ ]; description = "Controlling how commands are saved on the history list."; }; @@ -79,9 +100,12 @@ in { historyIgnore = mkOption { type = types.listOf types.str; default = [ ]; - example = [ "ls" "cd" "exit" ]; - description = - "List of commands that should not be saved to the history list."; + example = [ + "ls" + "cd" + "exit" + ]; + description = "List of commands that should not be saved to the history list."; }; shellOptions = mkOption { @@ -101,7 +125,10 @@ in { # Warn if closing shell with running jobs. "checkjobs" ]; - example = [ "extglob" "-cdspell" ]; + example = [ + "extglob" + "-cdspell" + ]; description = '' Shell options to set. Prefix an option with "`-`" to unset. @@ -111,7 +138,9 @@ in { sessionVariables = mkOption { default = { }; type = types.attrs; - example = { MAILCHECK = 30; }; + example = { + MAILCHECK = 30; + }; description = '' Environment variables that will be set for the Bash session. ''; @@ -170,77 +199,90 @@ in { }; }; - config = let - aliasesStr = lib.concatStringsSep "\n" - (lib.mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") - cfg.shellAliases); + config = + let + aliasesStr = lib.concatStringsSep "\n" ( + lib.mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") cfg.shellAliases + ); - shoptsStr = let switch = v: if lib.hasPrefix "-" v then "-u" else "-s"; - in lib.concatStringsSep "\n" - (map (v: "shopt ${switch v} ${lib.removePrefix "-" v}") cfg.shellOptions); + shoptsStr = + let + switch = v: if lib.hasPrefix "-" v then "-u" else "-s"; + in + lib.concatStringsSep "\n" (map (v: "shopt ${switch v} ${lib.removePrefix "-" v}") cfg.shellOptions); - sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables; + sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables; - historyControlStr = (lib.concatStringsSep "\n" - (lib.mapAttrsToList (n: v: "${n}=${v}") - (optionalAttrs (cfg.historyFileSize != null) { - HISTFILESIZE = toString cfg.historyFileSize; - } // optionalAttrs (cfg.historySize != null) { - HISTSIZE = toString cfg.historySize; - } // optionalAttrs (cfg.historyFile != null) { - HISTFILE = ''"${cfg.historyFile}"''; - } // optionalAttrs (cfg.historyControl != [ ]) { - HISTCONTROL = lib.concatStringsSep ":" cfg.historyControl; - } // optionalAttrs (cfg.historyIgnore != [ ]) { - HISTIGNORE = - lib.escapeShellArg (lib.concatStringsSep ":" cfg.historyIgnore); - }) ++ lib.optional (cfg.historyFile != null) - ''mkdir -p "$(dirname "$HISTFILE")"'')); - in mkIf cfg.enable { - home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; + historyControlStr = ( + lib.concatStringsSep "\n" ( + lib.mapAttrsToList (n: v: "${n}=${v}") ( + optionalAttrs (cfg.historyFileSize != null) { + HISTFILESIZE = toString cfg.historyFileSize; + } + // optionalAttrs (cfg.historySize != null) { + HISTSIZE = toString cfg.historySize; + } + // optionalAttrs (cfg.historyFile != null) { + HISTFILE = ''"${cfg.historyFile}"''; + } + // optionalAttrs (cfg.historyControl != [ ]) { + HISTCONTROL = lib.concatStringsSep ":" cfg.historyControl; + } + // optionalAttrs (cfg.historyIgnore != [ ]) { + HISTIGNORE = lib.escapeShellArg (lib.concatStringsSep ":" cfg.historyIgnore); + } + ) + ++ lib.optional (cfg.historyFile != null) ''mkdir -p "$(dirname "$HISTFILE")"'' + ) + ); + in + mkIf cfg.enable { + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - home.file.".bash_profile".source = writeBashScript "bash_profile" '' - # include .profile if it exists - [[ -f ~/.profile ]] && . ~/.profile + home.file.".bash_profile".source = writeBashScript "bash_profile" '' + # include .profile if it exists + [[ -f ~/.profile ]] && . ~/.profile - # include .bashrc if it exists - [[ -f ~/.bashrc ]] && . ~/.bashrc - ''; + # include .bashrc if it exists + [[ -f ~/.bashrc ]] && . ~/.bashrc + ''; - # If completion is enabled then make sure it is sourced very early. This - # is to avoid problems if any other initialization code attempts to set up - # completion. - programs.bash.initExtra = mkIf cfg.enableCompletion (lib.mkOrder 100 '' - if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then - . "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" - fi - ''); + # If completion is enabled then make sure it is sourced very early. This + # is to avoid problems if any other initialization code attempts to set up + # completion. + programs.bash.initExtra = mkIf cfg.enableCompletion ( + lib.mkOrder 100 '' + if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then + . "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" + fi + '' + ); - home.file.".profile".source = writeBashScript "profile" '' - . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" + home.file.".profile".source = writeBashScript "profile" '' + . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" - ${sessionVarsStr} + ${sessionVarsStr} - ${cfg.profileExtra} - ''; + ${cfg.profileExtra} + ''; - home.file.".bashrc".source = writeBashScript "bashrc" '' - ${cfg.bashrcExtra} + home.file.".bashrc".source = writeBashScript "bashrc" '' + ${cfg.bashrcExtra} - # Commands that should be applied only for interactive shells. - [[ $- == *i* ]] || return + # Commands that should be applied only for interactive shells. + [[ $- == *i* ]] || return - ${historyControlStr} + ${historyControlStr} - ${shoptsStr} + ${shoptsStr} - ${aliasesStr} + ${aliasesStr} - ${cfg.initExtra} - ''; + ${cfg.initExtra} + ''; - home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") { - source = writeBashScript "bash_logout" cfg.logoutExtra; + home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") { + source = writeBashScript "bash_logout" cfg.logoutExtra; + }; }; - }; } diff --git a/modules/programs/bashmount.nix b/modules/programs/bashmount.nix index 7418a3629..27a005331 100644 --- a/modules/programs/bashmount.nix +++ b/modules/programs/bashmount.nix @@ -1,6 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.bashmount; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.bashmount; +in +{ meta.maintainers = [ lib.maintainers.AndersonTorres ]; options.programs.bashmount = { @@ -24,7 +31,6 @@ in { config = lib.mkIf cfg.enable { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - xdg.configFile."bashmount/config" = - lib.mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + xdg.configFile."bashmount/config" = lib.mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; }; } diff --git a/modules/programs/bat.nix b/modules/programs/bat.nix index fce1f5e63..5db5f3703 100644 --- a/modules/programs/bat.nix +++ b/modules/programs/bat.nix @@ -1,10 +1,22 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) literalExpression mkEnableOption mkOption mkIf types; + inherit (lib) + literalExpression + mkEnableOption + mkOption + mkIf + types + ; cfg = config.programs.bat; - toConfigFile = attrs: + toConfigFile = + attrs: let inherit (builtins) isBool attrNames; nonBoolFlags = lib.filterAttrs (_: v: !(isBool v)) attrs; @@ -17,20 +29,31 @@ let switches = lib.concatMapStrings (k: '' --${k} '') (attrNames enabledBoolFlags); - in keyValuePairs + switches; -in { + in + keyValuePairs + switches; +in +{ meta.maintainers = with lib.maintainers; [ khaneliman ]; options.programs.bat = { enable = mkEnableOption "bat, a cat clone with wings"; config = mkOption { - type = with types; attrsOf (oneOf [ str (listOf str) bool ]); + type = + with types; + attrsOf (oneOf [ + str + (listOf str) + bool + ]); default = { }; example = { theme = "TwoDark"; pager = "less -FR"; - map-syntax = [ "*.jenkinsfile:Groovy" "*.props:Java Properties" ]; + map-syntax = [ + "*.jenkinsfile:Groovy" + "*.props:Java Properties" + ]; }; description = '' Bat configuration. @@ -40,8 +63,7 @@ in { extraPackages = mkOption { type = types.listOf types.package; default = [ ]; - example = literalExpression - "with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];"; + example = literalExpression "with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];"; description = '' Additional bat packages to install. ''; @@ -50,21 +72,24 @@ in { package = lib.mkPackageOption pkgs "bat" { }; themes = mkOption { - type = types.attrsOf (types.either types.lines (types.submodule { - options = { - src = mkOption { - type = types.path; - description = "Path to the theme folder."; - }; + type = types.attrsOf ( + types.either types.lines ( + types.submodule { + options = { + src = mkOption { + type = types.path; + description = "Path to the theme folder."; + }; - file = mkOption { - type = types.nullOr types.str; - default = null; - description = - "Subpath of the theme file within the source, if needed."; - }; - }; - })); + file = mkOption { + type = types.nullOr types.str; + default = null; + description = "Subpath of the theme file within the source, if needed."; + }; + }; + } + ) + ); default = { }; example = literalExpression '' { @@ -85,20 +110,23 @@ in { }; syntaxes = mkOption { - type = types.attrsOf (types.either types.lines (types.submodule { - options = { - src = mkOption { - type = types.path; - description = "Path to the syntax folder."; - }; - file = mkOption { - type = types.nullOr types.str; - default = null; - description = - "Subpath of the syntax file within the source, if needed."; - }; - }; - })); + type = types.attrsOf ( + types.either types.lines ( + types.submodule { + options = { + src = mkOption { + type = types.path; + description = "Path to the syntax folder."; + }; + file = mkOption { + type = types.nullOr types.str; + default = null; + description = "Subpath of the syntax file within the source, if needed."; + }; + }; + } + ) + ); default = { }; example = literalExpression '' { @@ -119,54 +147,75 @@ in { }; }; - config = mkIf cfg.enable (lib.mkMerge [ - (mkIf (lib.any lib.isString (lib.attrValues cfg.themes)) { - warnings = ['' - 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. - '']; - }) - (mkIf (lib.any lib.isString (lib.attrValues cfg.syntaxes)) { - warnings = ['' - 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. - '']; - }) - { - home.packages = [ cfg.package ] ++ cfg.extraPackages; + config = mkIf cfg.enable ( + lib.mkMerge [ + (mkIf (lib.any lib.isString (lib.attrValues cfg.themes)) { + warnings = [ + '' + 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. + '' + ]; + }) + (mkIf (lib.any lib.isString (lib.attrValues cfg.syntaxes)) { + warnings = [ + '' + 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. + '' + ]; + }) + { + home.packages = [ cfg.package ] ++ cfg.extraPackages; - xdg.configFile = lib.mkMerge ([{ - "bat/config" = - mkIf (cfg.config != { }) { text = toConfigFile cfg.config; }; - }] ++ (lib.flip lib.mapAttrsToList cfg.themes (name: val: { - "bat/themes/${name}.tmTheme" = if lib.isString val then { - text = val; - } else { - source = - if isNull val.file then "${val.src}" else "${val.src}/${val.file}"; - }; - })) ++ (lib.flip lib.mapAttrsToList cfg.syntaxes (name: val: { - "bat/syntaxes/${name}.sublime-syntax" = if lib.isString val then { - text = val; - } else { - source = - if isNull val.file then "${val.src}" else "${val.src}/${val.file}"; - }; - }))); + xdg.configFile = lib.mkMerge ( + [ + { + "bat/config" = mkIf (cfg.config != { }) { text = toConfigFile cfg.config; }; + } + ] + ++ (lib.flip lib.mapAttrsToList cfg.themes ( + name: val: { + "bat/themes/${name}.tmTheme" = + if lib.isString val then + { + text = val; + } + else + { + source = if isNull val.file then "${val.src}" else "${val.src}/${val.file}"; + }; + } + )) + ++ (lib.flip lib.mapAttrsToList cfg.syntaxes ( + name: val: { + "bat/syntaxes/${name}.sublime-syntax" = + if lib.isString val then + { + text = val; + } + else + { + source = if isNull val.file then "${val.src}" else "${val.src}/${val.file}"; + }; + } + )) + ); - # NOTE: run `bat cache --build` in an empty directory to work - # around failure when ~/cache exists - # https://github.com/sharkdp/bat/issues/1726 - home.activation.batCache = lib.hm.dag.entryAfter [ "linkGeneration" ] '' - ( - export XDG_CACHE_HOME=${lib.escapeShellArg config.xdg.cacheHome} - verboseEcho "Rebuilding bat theme cache" - cd "${pkgs.emptyDirectory}" - run ${lib.getExe cfg.package} cache --build - ) - ''; - } - ]); + # NOTE: run `bat cache --build` in an empty directory to work + # around failure when ~/cache exists + # https://github.com/sharkdp/bat/issues/1726 + home.activation.batCache = lib.hm.dag.entryAfter [ "linkGeneration" ] '' + ( + export XDG_CACHE_HOME=${lib.escapeShellArg config.xdg.cacheHome} + verboseEcho "Rebuilding bat theme cache" + cd "${pkgs.emptyDirectory}" + run ${lib.getExe cfg.package} cache --build + ) + ''; + } + ] + ); } diff --git a/modules/programs/beets.nix b/modules/programs/beets.nix index be34ce372..a8ed43c24 100644 --- a/modules/programs/beets.nix +++ b/modules/programs/beets.nix @@ -1,22 +1,34 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) literalExpression mkIf mkOption types; + inherit (lib) + literalExpression + mkIf + mkOption + types + ; cfg = config.programs.beets; yamlFormat = pkgs.formats.yaml { }; -in { - meta.maintainers = with lib.maintainers; [ rycee Scrumplex ]; +in +{ + meta.maintainers = with lib.maintainers; [ + rycee + Scrumplex + ]; options = { programs.beets = { enable = mkOption { type = types.bool; - default = if lib.versionAtLeast config.home.stateVersion "19.03" then - false - else - cfg.settings != { }; + default = + if lib.versionAtLeast config.home.stateVersion "19.03" then false else cfg.settings != { }; defaultText = "false"; description = '' Whether to enable the beets music library manager. This @@ -27,8 +39,7 @@ in { }; package = lib.mkPackageOption pkgs "beets" { - example = - "(pkgs.beets.override { pluginOverrides = { beatport.enable = false; }; })"; + example = "(pkgs.beets.override { pluginOverrides = { beatport.enable = false; }; })"; extraDescription = '' Can be used to specify extensions. ''; @@ -70,8 +81,7 @@ in { (mkIf cfg.enable { home.packages = [ cfg.package ]; - xdg.configFile."beets/config.yaml".source = - yamlFormat.generate "beets-config" cfg.settings; + xdg.configFile."beets/config.yaml".source = yamlFormat.generate "beets-config" cfg.settings; }) (mkIf (cfg.mpdIntegration.enableStats || cfg.mpdIntegration.enableUpdate) { diff --git a/modules/programs/bemenu.nix b/modules/programs/bemenu.nix index 959aa49e5..dcbf2e5b8 100644 --- a/modules/programs/bemenu.nix +++ b/modules/programs/bemenu.nix @@ -1,6 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.bemenu; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.bemenu; +in +{ meta.maintainers = [ ]; options.programs.bemenu = { @@ -9,7 +16,13 @@ in { package = lib.mkPackageOption pkgs "bemenu" { nullable = true; }; settings = lib.mkOption { - type = with lib.types; attrsOf (oneOf [ str number bool ]); + type = + with lib.types; + attrsOf (oneOf [ + str + number + bool + ]); default = { }; example = lib.literalExpression '' { @@ -29,15 +42,13 @@ in { width-factor = 0.3; } ''; - description = - "Configuration options for bemenu. See {manpage}`bemenu(1)`."; + description = "Configuration options for bemenu. See {manpage}`bemenu(1)`."; }; }; config = lib.mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "programs.bemenu" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "programs.bemenu" pkgs lib.platforms.linux) ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; diff --git a/modules/programs/borgmatic.nix b/modules/programs/borgmatic.nix index 67d369563..776e59340 100644 --- a/modules/programs/borgmatic.nix +++ b/modules/programs/borgmatic.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) literalExpression mkOption types; @@ -6,24 +11,33 @@ let yamlFormat = pkgs.formats.yaml { }; - mkNullableOption = args: - lib.mkOption (args // { - type = lib.types.nullOr args.type; - default = null; - }); + mkNullableOption = + args: + lib.mkOption ( + args + // { + type = lib.types.nullOr args.type; + default = null; + } + ); - cleanRepositories = repos: - map (repo: - if builtins.isString repo then { - path = repo; - } else - removeNullValues repo) repos; + cleanRepositories = + repos: + map ( + repo: + if builtins.isString repo then + { + path = repo; + } + else + removeNullValues repo + ) repos; - mkRetentionOption = frequency: + mkRetentionOption = + frequency: mkNullableOption { type = types.int; - description = - "Number of ${frequency} archives to keep. Use -1 for no limit."; + description = "Number of ${frequency} archives to keep. Use -1 for no limit."; example = 3; }; @@ -56,7 +70,12 @@ let consistencyCheckModule = types.submodule { options = { name = mkOption { - type = types.enum [ "repository" "archives" "data" "extract" ]; + type = types.enum [ + "repository" + "archives" + "data" + "extract" + ]; description = "Name of consistency check to run."; example = "repository"; }; @@ -69,146 +88,151 @@ let }; }; - configModule = types.submodule ({ config, ... }: { - config.location.extraConfig.exclude_from = - lib.mkIf config.location.excludeHomeManagerSymlinks - (lib.mkAfter [ (toString hmExcludeFile) ]); - options = { - location = { - sourceDirectories = mkNullableOption { - type = types.listOf types.str; - default = null; - description = '' - Directories to backup. + configModule = types.submodule ( + { config, ... }: + { + config.location.extraConfig.exclude_from = lib.mkIf config.location.excludeHomeManagerSymlinks ( + lib.mkAfter [ (toString hmExcludeFile) ] + ); + options = { + location = { + sourceDirectories = mkNullableOption { + type = types.listOf types.str; + default = null; + description = '' + Directories to backup. - Mutually exclusive with [](#opt-programs.borgmatic.backups._name_.location.patterns). - ''; - example = literalExpression "[config.home.homeDirectory]"; + Mutually exclusive with [](#opt-programs.borgmatic.backups._name_.location.patterns). + ''; + example = literalExpression "[config.home.homeDirectory]"; + }; + + patterns = mkNullableOption { + type = types.listOf types.str; + default = null; + description = '' + Patterns to include/exclude. + + See the output of `borg help patterns` for the syntax. Pattern paths + are relative to `/` even when a different recursion root is set. + + Mutually exclusive with [](#opt-programs.borgmatic.backups._name_.location.sourceDirectories). + ''; + example = literalExpression '' + [ + "R /home/user" + "- home/user/.cache" + "- home/user/Downloads" + "+ home/user/Videos/Important Video" + "- home/user/Videos" + ] + ''; + }; + + repositories = mkOption { + type = types.listOf (types.either types.str repositoryOption); + apply = cleanRepositories; + example = literalExpression '' + [ + { + "path" = "ssh://myuser@myrepo.myserver.com/./repo"; + "label" = "server"; + } + { + "path" = "/var/lib/backups/local.borg"; + "label" = "local"; + } + ] + ''; + description = '' + List of local or remote repositories with paths and optional labels. + ''; + }; + + excludeHomeManagerSymlinks = mkOption { + type = types.bool; + description = '' + Whether to exclude Home Manager generated symbolic links from + the backups. This facilitates restoring the whole home + directory when the Nix store doesn't contain the latest + Home Manager generation. + ''; + default = false; + example = true; + }; + + extraConfig = extraConfigOption; }; - patterns = mkNullableOption { - type = types.listOf types.str; - default = null; - description = '' - Patterns to include/exclude. - - See the output of `borg help patterns` for the syntax. Pattern paths - are relative to `/` even when a different recursion root is set. - - Mutually exclusive with [](#opt-programs.borgmatic.backups._name_.location.sourceDirectories). - ''; - example = literalExpression '' - [ - "R /home/user" - "- home/user/.cache" - "- home/user/Downloads" - "+ home/user/Videos/Important Video" - "- home/user/Videos" - ] - ''; + storage = { + encryptionPasscommand = mkNullableOption { + type = types.str; + description = "Command writing the passphrase to standard output."; + example = literalExpression ''"''${pkgs.password-store}/bin/pass borg-repo"''; + }; + extraConfig = extraConfigOption; }; - repositories = mkOption { - type = types.listOf (types.either types.str repositoryOption); - apply = cleanRepositories; - example = literalExpression '' - [ - { - "path" = "ssh://myuser@myrepo.myserver.com/./repo"; - "label" = "server"; - } - { - "path" = "/var/lib/backups/local.borg"; - "label" = "local"; - } - ] - ''; - description = '' - List of local or remote repositories with paths and optional labels. - ''; + retention = { + keepWithin = mkNullableOption { + type = types.strMatching "[[:digit:]]+[Hdwmy]"; + description = "Keep all archives within this time interval."; + example = "2d"; + }; + + keepSecondly = mkRetentionOption "secondly"; + keepMinutely = mkRetentionOption "minutely"; + keepHourly = mkRetentionOption "hourly"; + keepDaily = mkRetentionOption "daily"; + keepWeekly = mkRetentionOption "weekly"; + keepMonthly = mkRetentionOption "monthly"; + keepYearly = mkRetentionOption "yearly"; + + extraConfig = extraConfigOption; }; - excludeHomeManagerSymlinks = mkOption { - type = types.bool; - description = '' - Whether to exclude Home Manager generated symbolic links from - the backups. This facilitates restoring the whole home - directory when the Nix store doesn't contain the latest - Home Manager generation. - ''; - default = false; - example = true; + consistency = { + checks = mkOption { + type = types.listOf consistencyCheckModule; + default = [ ]; + description = "Consistency checks to run"; + example = literalExpression '' + [ + { + name = "repository"; + frequency = "2 weeks"; + } + { + name = "archives"; + frequency = "4 weeks"; + } + { + name = "data"; + frequency = "6 weeks"; + } + { + name = "extract"; + frequency = "6 weeks"; + } + ]; + ''; + }; + + extraConfig = extraConfigOption; }; - extraConfig = extraConfigOption; + output = { + extraConfig = extraConfigOption; + }; + + hooks = { + extraConfig = extraConfigOption; + }; }; + } + ); - storage = { - encryptionPasscommand = mkNullableOption { - type = types.str; - description = "Command writing the passphrase to standard output."; - example = - literalExpression ''"''${pkgs.password-store}/bin/pass borg-repo"''; - }; - extraConfig = extraConfigOption; - }; - - retention = { - keepWithin = mkNullableOption { - type = types.strMatching "[[:digit:]]+[Hdwmy]"; - description = "Keep all archives within this time interval."; - example = "2d"; - }; - - keepSecondly = mkRetentionOption "secondly"; - keepMinutely = mkRetentionOption "minutely"; - keepHourly = mkRetentionOption "hourly"; - keepDaily = mkRetentionOption "daily"; - keepWeekly = mkRetentionOption "weekly"; - keepMonthly = mkRetentionOption "monthly"; - keepYearly = mkRetentionOption "yearly"; - - extraConfig = extraConfigOption; - }; - - consistency = { - checks = mkOption { - type = types.listOf consistencyCheckModule; - default = [ ]; - description = "Consistency checks to run"; - example = literalExpression '' - [ - { - name = "repository"; - frequency = "2 weeks"; - } - { - name = "archives"; - frequency = "4 weeks"; - } - { - name = "data"; - frequency = "6 weeks"; - } - { - name = "extract"; - frequency = "6 weeks"; - } - ]; - ''; - }; - - extraConfig = extraConfigOption; - }; - - output = { extraConfig = extraConfigOption; }; - - hooks = { extraConfig = extraConfigOption; }; - }; - }); - - removeNullValues = attrSet: - lib.filterAttrs (key: value: value != null) attrSet; + removeNullValues = attrSet: lib.filterAttrs (key: value: value != null) attrSet; hmFiles = builtins.attrValues config.home.file; hmSymlinks = (lib.filter (file: !file.recursive) hmFiles); @@ -218,25 +242,35 @@ let hmExcludePatterns = lib.concatMapStrings hmExcludePattern hmSymlinks; hmExcludeFile = pkgs.writeText "hm-symlinks.txt" hmExcludePatterns; - writeConfig = config: - lib.generators.toYAML { } (removeNullValues ({ - source_directories = config.location.sourceDirectories; - patterns = config.location.patterns; - repositories = config.location.repositories; - encryption_passcommand = config.storage.encryptionPasscommand; - keep_within = config.retention.keepWithin; - keep_secondly = config.retention.keepSecondly; - keep_minutely = config.retention.keepMinutely; - keep_hourly = config.retention.keepHourly; - keep_daily = config.retention.keepDaily; - keep_weekly = config.retention.keepWeekly; - keep_monthly = config.retention.keepMonthly; - keep_yearly = config.retention.keepYearly; - checks = config.consistency.checks; - } // config.location.extraConfig // config.storage.extraConfig - // config.retention.extraConfig // config.consistency.extraConfig - // config.output.extraConfig // config.hooks.extraConfig)); -in { + writeConfig = + config: + lib.generators.toYAML { } ( + removeNullValues ( + { + source_directories = config.location.sourceDirectories; + patterns = config.location.patterns; + repositories = config.location.repositories; + encryption_passcommand = config.storage.encryptionPasscommand; + keep_within = config.retention.keepWithin; + keep_secondly = config.retention.keepSecondly; + keep_minutely = config.retention.keepMinutely; + keep_hourly = config.retention.keepHourly; + keep_daily = config.retention.keepDaily; + keep_weekly = config.retention.keepWeekly; + keep_monthly = config.retention.keepMonthly; + keep_yearly = config.retention.keepYearly; + checks = config.consistency.checks; + } + // config.location.extraConfig + // config.storage.extraConfig + // config.retention.extraConfig + // config.consistency.extraConfig + // config.output.extraConfig + // config.hooks.extraConfig + ) + ); +in +{ meta.maintainers = [ lib.maintainers.DamienCassou ]; options = { @@ -272,25 +306,28 @@ in { }; config = lib.mkIf cfg.enable { - assertions = (lib.mapAttrsToList (backup: opts: { - assertion = opts.location.sourceDirectories == null - || opts.location.patterns == null; - message = '' - Borgmatic backup configuration "${backup}" cannot specify both 'location.sourceDirectories' and 'location.patterns'. - ''; - }) cfg.backups) ++ (lib.mapAttrsToList (backup: opts: { - assertion = !(opts.location.sourceDirectories == null - && opts.location.patterns == null); - message = '' - Borgmatic backup configuration "${backup}" must specify one of 'location.sourceDirectories' or 'location.patterns'. - ''; - }) cfg.backups); + assertions = + (lib.mapAttrsToList (backup: opts: { + assertion = opts.location.sourceDirectories == null || opts.location.patterns == null; + message = '' + Borgmatic backup configuration "${backup}" cannot specify both 'location.sourceDirectories' and 'location.patterns'. + ''; + }) cfg.backups) + ++ (lib.mapAttrsToList (backup: opts: { + assertion = !(opts.location.sourceDirectories == null && opts.location.patterns == null); + message = '' + Borgmatic backup configuration "${backup}" must specify one of 'location.sourceDirectories' or 'location.patterns'. + ''; + }) cfg.backups); - xdg.configFile = with lib.attrsets; - mapAttrs' (configName: config: + xdg.configFile = + with lib.attrsets; + mapAttrs' ( + configName: config: nameValuePair ("borgmatic.d/" + configName + ".yaml") { text = writeConfig config; - }) cfg.backups; + } + ) cfg.backups; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; }; diff --git a/modules/programs/bottom.nix b/modules/programs/bottom.nix index b328e1ba7..effd5c25f 100644 --- a/modules/programs/bottom.nix +++ b/modules/programs/bottom.nix @@ -1,11 +1,17 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.bottom; tomlFormat = pkgs.formats.toml { }; -in { +in +{ options = { programs.bottom = { enable = lib.mkEnableOption '' diff --git a/modules/programs/boxxy.nix b/modules/programs/boxxy.nix index 983282c20..a36f29de7 100644 --- a/modules/programs/boxxy.nix +++ b/modules/programs/boxxy.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) literalExpression mkOption types; @@ -37,7 +42,10 @@ let }; mode = mkOption { - type = types.enum [ "file" "directory" ]; + type = types.enum [ + "file" + "directory" + ]; default = "directory"; description = '' Does the current path redirect a file or a directory? @@ -81,7 +89,8 @@ let }; }; }; -in { +in +{ options.programs.boxxy = { enable = lib.mkEnableOption "boxxy: Boxes in badly behaving applications"; @@ -96,13 +105,11 @@ in { config = lib.mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "programs.boxxy" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "programs.boxxy" pkgs lib.platforms.linux) ]; home.file = lib.mkIf (cfg.rules != [ ]) { - "${configPath}".source = - settingsFormat.generate "boxxy-config.yaml" { rules = cfg.rules; }; + "${configPath}".source = settingsFormat.generate "boxxy-config.yaml" { rules = cfg.rules; }; }; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; @@ -110,4 +117,3 @@ in { meta.maintainers = with lib.hm.maintainers; [ nikp123 ]; } - diff --git a/modules/programs/broot.nix b/modules/programs/broot.nix index 301b88945..85ea5a20d 100644 --- a/modules/programs/broot.nix +++ b/modules/programs/broot.nix @@ -1,6 +1,17 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) literalExpression mkIf mkOption mkRenamedOptionModule types; + inherit (lib) + literalExpression + mkIf + mkOption + mkRenamedOptionModule + types + ; cfg = config.programs.broot; @@ -13,7 +24,15 @@ let modal = lib.mkEnableOption "modal (vim) mode"; verbs = mkOption { - type = with types; listOf (attrsOf (oneOf [ bool str (listOf str) ])); + type = + with types; + listOf ( + attrsOf (oneOf [ + bool + str + (listOf str) + ]) + ); default = [ ]; example = literalExpression '' [ @@ -116,53 +135,64 @@ let }; }; - shellInit = shell: + shellInit = + shell: # Using mkAfter to make it more likely to appear after other # manipulations of the prompt. lib.mkAfter '' source ${ - pkgs.runCommand "br.${shell}" { nativeBuildInputs = [ cfg.package ]; } - "broot --print-shell-function ${shell} > $out" + pkgs.runCommand "br.${shell}" { + nativeBuildInputs = [ cfg.package ]; + } "broot --print-shell-function ${shell} > $out" } ''; -in { - meta.maintainers = [ lib.hm.maintainers.aheaume lib.maintainers.dermetfan ]; +in +{ + meta.maintainers = [ + lib.hm.maintainers.aheaume + lib.maintainers.dermetfan + ]; imports = [ - (mkRenamedOptionModule [ "programs" "broot" "modal" ] [ - "programs" - "broot" - "settings" - "modal" - ]) - (mkRenamedOptionModule [ "programs" "broot" "verbs" ] [ - "programs" - "broot" - "settings" - "verbs" - ]) - (mkRenamedOptionModule [ "programs" "broot" "skin" ] [ - "programs" - "broot" - "settings" - "skin" - ]) + (mkRenamedOptionModule + [ "programs" "broot" "modal" ] + [ + "programs" + "broot" + "settings" + "modal" + ] + ) + (mkRenamedOptionModule + [ "programs" "broot" "verbs" ] + [ + "programs" + "broot" + "settings" + "verbs" + ] + ) + (mkRenamedOptionModule + [ "programs" "broot" "skin" ] + [ + "programs" + "broot" + "settings" + "skin" + ] + ) ]; options.programs.broot = { enable = lib.mkEnableOption "Broot, a better way to navigate directories"; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = - lib.hm.shell.mkFishIntegrationOption { inherit config; }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableNushellIntegration = - lib.hm.shell.mkNushellIntegrationOption { inherit config; }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; package = lib.mkPackageOption pkgs "broot" { }; @@ -190,9 +220,7 @@ in { postBuild = '' rm $out/conf.hjson ${lib.getExe pkgs.jq} --slurp add > $out/conf.hjson \ - <(${ - lib.getExe pkgs.hjson-go - } -c ${cfg.package.src}/resources/default-conf/conf.hjson) \ + <(${lib.getExe pkgs.hjson-go} -c ${cfg.package.src}/resources/default-conf/conf.hjson) \ ${jsonFormat.generate "broot-config.json" cfg.settings} ''; }; @@ -205,8 +233,7 @@ in { fish.shellInit = mkIf cfg.enableFishIntegration (shellInit "fish"); - nushell.extraConfig = - mkIf cfg.enableNushellIntegration (shellInit "nushell"); + nushell.extraConfig = mkIf cfg.enableNushellIntegration (shellInit "nushell"); }; }; } diff --git a/modules/programs/browserpass.nix b/modules/programs/browserpass.nix index ea78f0a84..01a49308b 100644 --- a/modules/programs/browserpass.nix +++ b/modules/programs/browserpass.nix @@ -1,8 +1,21 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.browserpass; - browsers = [ "brave" "chrome" "chromium" "firefox" "librewolf" "vivaldi" ]; -in { + browsers = [ + "brave" + "chrome" + "chromium" + "firefox" + "librewolf" + "vivaldi" + ]; +in +{ options = { programs.browserpass = { enable = lib.mkEnableOption "the browserpass extension host application"; @@ -17,82 +30,108 @@ in { }; config = lib.mkIf cfg.enable { - home.file = lib.foldl' (a: b: a // b) { } (lib.concatMap (x: - with pkgs.stdenv; - if x == "brave" then - let - dir = if isDarwin then - "Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts" - else - ".config/BraveSoftware/Brave-Browser/NativeMessagingHosts"; - in [{ - # Policies are read from `/etc/brave/policies` only - # https://github.com/brave/brave-browser/issues/19052 - "${dir}/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; - }] - else if x == "chrome" then - let - dir = if isDarwin then - "Library/Application Support/Google/Chrome/NativeMessagingHosts" - else - ".config/google-chrome/NativeMessagingHosts"; - in [{ - "${dir}/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; - "${dir}/../policies/managed/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; - }] - else if x == "chromium" then - let - dir = if isDarwin then - "Library/Application Support/Chromium/NativeMessagingHosts" - else - ".config/chromium/NativeMessagingHosts"; - in [ - { - "${dir}/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; - } - { - "${dir}/../policies/managed/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; - } - ] - else if x == "firefox" then - let - dir = if isDarwin then - "Library/Application Support/Mozilla/NativeMessagingHosts" - else - ".mozilla/native-messaging-hosts"; - in [{ - "${dir}/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; - }] - else if x == "librewolf" then - let - dir = if isDarwin then - "Library/Application Support/LibreWolf/NativeMessagingHosts" - else - ".librewolf/native-messaging-hosts"; - in [{ - "${dir}/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; - }] + home.file = lib.foldl' (a: b: a // b) { } ( + lib.concatMap ( + x: + with pkgs.stdenv; + if x == "brave" then + let + dir = + if isDarwin then + "Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts" + else + ".config/BraveSoftware/Brave-Browser/NativeMessagingHosts"; + in + [ + { + # Policies are read from `/etc/brave/policies` only + # https://github.com/brave/brave-browser/issues/19052 + "${dir}/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; + } + ] + else if x == "chrome" then + let + dir = + if isDarwin then + "Library/Application Support/Google/Chrome/NativeMessagingHosts" + else + ".config/google-chrome/NativeMessagingHosts"; + in + [ + { + "${dir}/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; + "${dir}/../policies/managed/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; + } + ] + else if x == "chromium" then + let + dir = + if isDarwin then + "Library/Application Support/Chromium/NativeMessagingHosts" + else + ".config/chromium/NativeMessagingHosts"; + in + [ + { + "${dir}/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; + } + { + "${dir}/../policies/managed/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; + } + ] + else if x == "firefox" then + let + dir = + if isDarwin then + "Library/Application Support/Mozilla/NativeMessagingHosts" + else + ".mozilla/native-messaging-hosts"; + in + [ + { + "${dir}/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; + } + ] + else if x == "librewolf" then + let + dir = + if isDarwin then + "Library/Application Support/LibreWolf/NativeMessagingHosts" + else + ".librewolf/native-messaging-hosts"; + in + [ + { + "${dir}/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; + } + ] - else if x == "vivaldi" then - let - dir = if isDarwin then - "Library/Application Support/Vivaldi/NativeMessagingHosts" - else - ".config/vivaldi/NativeMessagingHosts"; - in [{ - "${dir}/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; - "${dir}/../policies/managed/com.github.browserpass.native.json".source = - "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; - }] - else - throw "unknown browser ${x}") cfg.browsers); + else if x == "vivaldi" then + let + dir = + if isDarwin then + "Library/Application Support/Vivaldi/NativeMessagingHosts" + else + ".config/vivaldi/NativeMessagingHosts"; + in + [ + { + "${dir}/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; + "${dir}/../policies/managed/com.github.browserpass.native.json".source = + "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; + } + ] + else + throw "unknown browser ${x}" + ) cfg.browsers + ); }; } diff --git a/modules/programs/btop.nix b/modules/programs/btop.nix index a93716164..f9852fdb1 100644 --- a/modules/programs/btop.nix +++ b/modules/programs/btop.nix @@ -1,26 +1,38 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.btop; - finalConfig = let - toKeyValue = lib.generators.toKeyValue { - mkKeyValue = lib.generators.mkKeyValueDefault { - mkValueString = v: - with builtins; - if isBool v then - (if v then "True" else "False") - else if isString v then - ''"${v}"'' - else - toString v; - } " = "; - }; - in '' - ${toKeyValue cfg.settings} - ${lib.optionalString (cfg.extraConfig != "") cfg.extraConfig} - ''; -in { - meta.maintainers = with lib.maintainers; [ GaetanLepage khaneliman ]; + finalConfig = + let + toKeyValue = lib.generators.toKeyValue { + mkKeyValue = lib.generators.mkKeyValueDefault { + mkValueString = + v: + with builtins; + if isBool v then + (if v then "True" else "False") + else if isString v then + ''"${v}"'' + else + toString v; + } " = "; + }; + in + '' + ${toKeyValue cfg.settings} + ${lib.optionalString (cfg.extraConfig != "") cfg.extraConfig} + ''; +in +{ + meta.maintainers = with lib.maintainers; [ + GaetanLepage + khaneliman + ]; options.programs.btop = { enable = lib.mkEnableOption "btop"; @@ -28,7 +40,14 @@ in { package = lib.mkPackageOption pkgs "btop" { nullable = true; }; settings = lib.mkOption { - type = with lib.types; attrsOf (oneOf [ bool float int str ]); + type = + with lib.types; + attrsOf (oneOf [ + bool + float + int + str + ]); default = { }; example = { color_theme = "Default"; @@ -105,18 +124,24 @@ in { config = lib.mkIf cfg.enable { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - xdg.configFile = let - mkThemeConfig = name: theme: { - name = "btop/themes/${name}.theme"; - value = { - source = (if builtins.isPath theme || lib.isStorePath theme then - theme - else - pkgs.writeText "btop-theme.theme" theme); + xdg.configFile = + let + mkThemeConfig = name: theme: { + name = "btop/themes/${name}.theme"; + value = { + source = ( + if builtins.isPath theme || lib.isStorePath theme then + theme + else + pkgs.writeText "btop-theme.theme" theme + ); + }; }; - }; - in { - "btop/btop.conf" = lib.mkIf (cfg.settings != { }) { text = finalConfig; }; - } // lib.mapAttrs' mkThemeConfig cfg.themes; + in + { + + "btop/btop.conf" = lib.mkIf (cfg.settings != { }) { text = finalConfig; }; + } + // lib.mapAttrs' mkThemeConfig cfg.themes; }; } diff --git a/modules/programs/bun.nix b/modules/programs/bun.nix index ffc9167ef..83daaa85c 100644 --- a/modules/programs/bun.nix +++ b/modules/programs/bun.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.bun; tomlFormat = pkgs.formats.toml { }; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.jack5079 ]; options.programs.bun = { @@ -55,13 +61,12 @@ in { }; # https://bun.sh/docs/install/lockfile#how-do-i-git-diff-bun-s-lockfile - programs.git.attributes = - lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) - [ "*.lockb binary diff=lockb" ]; - programs.git.extraConfig.diff.lockb = - lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) { - textconv = lib.getExe cfg.package; - binary = true; - }; + programs.git.attributes = lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) [ + "*.lockb binary diff=lockb" + ]; + programs.git.extraConfig.diff.lockb = lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) { + textconv = lib.getExe cfg.package; + binary = true; + }; }; } diff --git a/modules/programs/carapace.nix b/modules/programs/carapace.nix index 122f65ce2..ecdc16e3d 100644 --- a/modules/programs/carapace.nix +++ b/modules/programs/carapace.nix @@ -1,28 +1,32 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.programs.carapace; bin = lib.getExe cfg.package; -in { - meta.maintainers = with lib.maintainers; [ weathercold bobvanderlinden ]; +in +{ + meta.maintainers = with lib.maintainers; [ + weathercold + bobvanderlinden + ]; options.programs.carapace = { - enable = lib.mkEnableOption - "carapace, a multi-shell multi-command argument completer"; + enable = lib.mkEnableOption "carapace, a multi-shell multi-command argument completer"; package = lib.mkPackageOption pkgs "carapace" { }; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = - lib.hm.shell.mkFishIntegrationOption { inherit config; }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableNushellIntegration = - lib.hm.shell.mkNushellIntegrationOption { inherit config; }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; config = lib.mkIf cfg.enable { @@ -52,41 +56,52 @@ in { }; }; - xdg.configFile = lib.mkIf (config.programs.fish.enable - && cfg.enableFishIntegration - && lib.versionOlder config.programs.fish.package.version "4.0.0") ( - # Convert the entries from `carapace --list` to empty - # xdg.configFile."fish/completions/NAME.fish" entries. - # - # This is to disable fish builtin completion for each of the - # carapace-supported completions. - # - # This is necessary for carapace to properly work with fish version < 4.0b1. - # - # It is in line with the instructions from - # carapace-bin: - # - # carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish - # - # See https://carapace-sh.github.io/carapace-bin/setup.html#fish - let - carapaceListFile = pkgs.runCommandLocal "carapace-list" { - buildInputs = [ cfg.package ]; - } '' - ${bin} --list > $out - ''; - in lib.pipe carapaceListFile [ - lib.fileContents - (lib.splitString "\n") - (map (builtins.match "^([a-z0-9-]+) .*")) - (builtins.filter - (match: match != null && (builtins.length match) > 0)) - (map (match: builtins.head match)) - (map (name: { - name = "fish/completions/${name}.fish"; - value = { text = ""; }; - })) - builtins.listToAttrs - ]); + xdg.configFile = + lib.mkIf + ( + config.programs.fish.enable + && cfg.enableFishIntegration + && lib.versionOlder config.programs.fish.package.version "4.0.0" + ) + ( + # Convert the entries from `carapace --list` to empty + # xdg.configFile."fish/completions/NAME.fish" entries. + # + # This is to disable fish builtin completion for each of the + # carapace-supported completions. + # + # This is necessary for carapace to properly work with fish version < 4.0b1. + # + # It is in line with the instructions from + # carapace-bin: + # + # carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish + # + # See https://carapace-sh.github.io/carapace-bin/setup.html#fish + let + carapaceListFile = + pkgs.runCommandLocal "carapace-list" + { + buildInputs = [ cfg.package ]; + } + '' + ${bin} --list > $out + ''; + in + lib.pipe carapaceListFile [ + lib.fileContents + (lib.splitString "\n") + (map (builtins.match "^([a-z0-9-]+) .*")) + (builtins.filter (match: match != null && (builtins.length match) > 0)) + (map (match: builtins.head match)) + (map (name: { + name = "fish/completions/${name}.fish"; + value = { + text = ""; + }; + })) + builtins.listToAttrs + ] + ); }; } diff --git a/modules/programs/cava.nix b/modules/programs/cava.nix index f267ac24a..0a3333cbb 100644 --- a/modules/programs/cava.nix +++ b/modules/programs/cava.nix @@ -1,9 +1,15 @@ -{ pkgs, config, lib, ... }: +{ + pkgs, + config, + lib, + ... +}: let cfg = config.programs.cava; iniFmt = pkgs.formats.ini { }; -in { +in +{ meta.maintainers = [ lib.maintainers.bddvlpr ]; options.programs.cava = { diff --git a/modules/programs/cavalier.nix b/modules/programs/cavalier.nix index 6724ca15a..5d5669ba5 100644 --- a/modules/programs/cavalier.nix +++ b/modules/programs/cavalier.nix @@ -1,4 +1,9 @@ -{ pkgs, config, lib, ... }: +{ + pkgs, + config, + lib, + ... +}: let inherit (lib) mkIf mkOption; @@ -8,7 +13,8 @@ let jsonFmt = pkgs.formats.json { }; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.bricked ]; options.programs.cavalier = { @@ -75,8 +81,7 @@ in { config = mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "programs.cavalier" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "programs.cavalier" pkgs lib.platforms.linux) ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index 2ef8571f9..18a10a4f0 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) literalExpression mkOption types; @@ -11,11 +16,13 @@ let "vivaldi" ]; - browserModule = defaultPkg: name: visible: + browserModule = + defaultPkg: name: visible: let browser = (builtins.parseDrvName defaultPkg.name).name; isProprietaryChrome = lib.hasPrefix "Google Chrome" name; - in { + in + { enable = mkOption { inherit visible; type = types.bool; @@ -36,7 +43,10 @@ let inherit visible; type = types.listOf types.str; default = [ ]; - example = [ "--enable-logging=stderr" "--ignore-gpu-blocklist" ]; + example = [ + "--enable-logging=stderr" + "--ignore-gpu-blocklist" + ]; description = '' List of command-line arguments to be passed to ${name}. @@ -47,12 +57,14 @@ let [Chromium codesearch](https://source.chromium.org/search?q=file:switches.cc&ss=chromium%2Fchromium%2Fsrc). ''; }; - } // lib.optionalAttrs (!isProprietaryChrome) { + } + // lib.optionalAttrs (!isProprietaryChrome) { # Extensions do not work with Google Chrome # see https://github.com/nix-community/home-manager/issues/1383 extensions = mkOption { inherit visible; - type = with types; + type = + with types; let extensionType = submodule { options = { @@ -93,7 +105,8 @@ let }; }; }; - in listOf (coercedTo str (v: { id = v; }) extensionType); + in + listOf (coercedTo str (v: { id = v; }) extensionType); default = [ ]; example = literalExpression '' [ @@ -149,7 +162,8 @@ let }; }; - browserConfig = cfg: + browserConfig = + cfg: let drvName = (builtins.parseDrvName cfg.package.name).name; @@ -164,23 +178,33 @@ let brave = "BraveSoftware/Brave-Browser"; }; - linuxDirs = { brave = "BraveSoftware/Brave-Browser"; }; + linuxDirs = { + brave = "BraveSoftware/Brave-Browser"; + }; - configDir = if pkgs.stdenv.isDarwin then - "Library/Application Support/" + (darwinDirs."${browser}" or browser) - else - "${config.xdg.configHome}/" + (linuxDirs."${browser}" or browser); + configDir = + if pkgs.stdenv.isDarwin then + "Library/Application Support/" + (darwinDirs."${browser}" or browser) + else + "${config.xdg.configHome}/" + (linuxDirs."${browser}" or browser); - extensionJson = ext: + extensionJson = + ext: assert ext.crxPath != null -> ext.version != null; - with builtins; { + with builtins; + { name = "${configDir}/External Extensions/${ext.id}.json"; - value.text = toJSON (if ext.crxPath != null then { - external_crx = ext.crxPath; - external_version = ext.version; - } else { - external_update_url = ext.updateUrl; - }); + value.text = toJSON ( + if ext.crxPath != null then + { + external_crx = ext.crxPath; + external_version = ext.version; + } + else + { + external_update_url = ext.updateUrl; + } + ); }; dictionary = pkg: { @@ -193,48 +217,61 @@ let paths = cfg.nativeMessagingHosts; }; - package = if cfg.commandLineArgs != [ ] then - cfg.package.override { - commandLineArgs = lib.concatStringsSep " " cfg.commandLineArgs; - } - else - cfg.package; + package = + if cfg.commandLineArgs != [ ] then + cfg.package.override { + commandLineArgs = lib.concatStringsSep " " cfg.commandLineArgs; + } + else + cfg.package; - in lib.mkIf cfg.enable { + in + lib.mkIf cfg.enable { home.packages = [ package ]; - home.file = lib.optionalAttrs (!isProprietaryChrome) (lib.listToAttrs - ((map extensionJson cfg.extensions) - ++ (map dictionary cfg.dictionaries)) // { - "${configDir}/NativeMessagingHosts" = - lib.mkIf (cfg.nativeMessagingHosts != [ ]) { - source = - "${nativeMessagingHostsJoined}/etc/chromium/native-messaging-hosts"; - recursive = true; - }; - }); + home.file = lib.optionalAttrs (!isProprietaryChrome) ( + lib.listToAttrs ((map extensionJson cfg.extensions) ++ (map dictionary cfg.dictionaries)) + // { + "${configDir}/NativeMessagingHosts" = lib.mkIf (cfg.nativeMessagingHosts != [ ]) { + source = "${nativeMessagingHostsJoined}/etc/chromium/native-messaging-hosts"; + recursive = true; + }; + } + ); }; -in { +in +{ # Extensions do not work with the proprietary Google Chrome version # see https://github.com/nix-community/home-manager/issues/1383 - imports = map (lib.flip lib.mkRemovedOptionModule - "The `extensions` option does not work on Google Chrome anymore.") [ - [ "programs" "google-chrome" "extensions" ] - [ "programs" "google-chrome-beta" "extensions" ] - [ "programs" "google-chrome-dev" "extensions" ] - ]; + imports = + map + (lib.flip lib.mkRemovedOptionModule "The `extensions` option does not work on Google Chrome anymore.") + [ + [ + "programs" + "google-chrome" + "extensions" + ] + [ + "programs" + "google-chrome-beta" + "extensions" + ] + [ + "programs" + "google-chrome-dev" + "extensions" + ] + ]; options.programs = { chromium = browserModule pkgs.chromium "Chromium" true; google-chrome = browserModule pkgs.google-chrome "Google Chrome" false; - google-chrome-beta = - browserModule pkgs.google-chrome-beta "Google Chrome Beta" false; - google-chrome-dev = - browserModule pkgs.google-chrome-dev "Google Chrome Dev" false; + google-chrome-beta = browserModule pkgs.google-chrome-beta "Google Chrome Beta" false; + google-chrome-dev = browserModule pkgs.google-chrome-dev "Google Chrome Dev" false; brave = browserModule pkgs.brave "Brave Browser" false; vivaldi = browserModule pkgs.vivaldi "Vivaldi Browser" false; }; - config = lib.mkMerge - (map (browser: browserConfig config.programs.${browser}) supportedBrowsers); + config = lib.mkMerge (map (browser: browserConfig config.programs.${browser}) supportedBrowsers); } diff --git a/modules/programs/cmus.nix b/modules/programs/cmus.nix index 22bf66088..ea4bd298d 100644 --- a/modules/programs/cmus.nix +++ b/modules/programs/cmus.nix @@ -1,6 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.cmus; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.cmus; +in +{ meta.maintainers = [ lib.hm.maintainers.joygnu ]; options.programs.cmus = { diff --git a/modules/programs/command-not-found/command-not-found.nix b/modules/programs/command-not-found/command-not-found.nix index 735944c94..75eb8609b 100644 --- a/modules/programs/command-not-found/command-not-found.nix +++ b/modules/programs/command-not-found/command-not-found.nix @@ -1,6 +1,11 @@ # Adapted from Nixpkgs. -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.command-not-found; commandNotFound = pkgs.substituteAll { @@ -9,7 +14,10 @@ let src = ./command-not-found.pl; isExecutable = true; inherit (cfg) dbPath; - perl = pkgs.perl.withPackages (p: [ p.DBDSQLite p.StringShellQuote ]); + perl = pkgs.perl.withPackages (p: [ + p.DBDSQLite + p.StringShellQuote + ]); }; shInit = commandNotFoundHandlerName: '' @@ -26,13 +34,13 @@ let } ''; -in { +in +{ options.programs.command-not-found = { enable = lib.mkEnableOption "command-not-found hook for interactive shell"; dbPath = lib.mkOption { - default = - "/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite"; + default = "/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite"; description = '' Absolute path to {file}`programs.sqlite`. By default this file will be provided by your channel diff --git a/modules/programs/comodoro.nix b/modules/programs/comodoro.nix index af59261ef..1959f941c 100644 --- a/modules/programs/comodoro.nix +++ b/modules/programs/comodoro.nix @@ -1,10 +1,16 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.comodoro; tomlFormat = pkgs.formats.toml { }; -in { +in +{ meta.maintainers = with lib.hm.maintainers; [ soywod ]; options.programs.comodoro = { diff --git a/modules/programs/darcs.nix b/modules/programs/darcs.nix index 87917d826..979b44e06 100644 --- a/modules/programs/darcs.nix +++ b/modules/programs/darcs.nix @@ -1,6 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.darcs; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.darcs; +in +{ meta.maintainers = with lib.maintainers; [ chris-martin ]; options = { @@ -23,24 +30,28 @@ in { boring = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ ]; - example = [ "^.idea$" ".iml$" "^.stack-work$" ]; + example = [ + "^.idea$" + ".iml$" + "^.stack-work$" + ]; description = "File patterns to ignore"; }; }; }; - config = lib.mkIf cfg.enable (lib.mkMerge [ - { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; } + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; } - (lib.mkIf (cfg.author != [ ]) { - home.file.".darcs/author".text = - lib.concatMapStrings (x: x + "\n") cfg.author; - }) + (lib.mkIf (cfg.author != [ ]) { + home.file.".darcs/author".text = lib.concatMapStrings (x: x + "\n") cfg.author; + }) - (lib.mkIf (cfg.boring != [ ]) { - home.file.".darcs/boring".text = - lib.concatMapStrings (x: x + "\n") cfg.boring; - }) + (lib.mkIf (cfg.boring != [ ]) { + home.file.".darcs/boring".text = lib.concatMapStrings (x: x + "\n") cfg.boring; + }) - ]); + ] + ); } diff --git a/modules/programs/dircolors.nix b/modules/programs/dircolors.nix index 22828e2f7..3b38e1a73 100644 --- a/modules/programs/dircolors.nix +++ b/modules/programs/dircolors.nix @@ -1,10 +1,21 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) mkDefault mkIf mkOption types; + inherit (lib) + mkDefault + mkIf + mkOption + types + ; cfg = config.programs.dircolors; formatLine = n: v: "${n} ${toString v}"; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.justinlovinger ]; options.programs.dircolors = { @@ -19,14 +30,11 @@ in { package = lib.mkPackageOption pkgs "dircolors" { default = "coreutils"; }; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = - lib.hm.shell.mkFishIntegrationOption { inherit config; }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; settings = mkOption { type = with types; attrsOf str; @@ -54,169 +62,175 @@ in { }; }; - config = let - dircolorsPath = if config.home.preferXdgDirectories then - "${config.xdg.configHome}/dir_colors" - else - "~/.dir_colors"; + config = + let + dircolorsPath = + if config.home.preferXdgDirectories then "${config.xdg.configHome}/dir_colors" else "~/.dir_colors"; - dircolorsConfig = lib.concatStringsSep "\n" ([ ] - ++ lib.mapAttrsToList formatLine cfg.settings ++ [ "" ] - ++ lib.optional (cfg.extraConfig != "") cfg.extraConfig); - in mkIf cfg.enable (lib.mkMerge [ - { - # Add default settings from `dircolors --print-database`. - programs.dircolors.settings = { - RESET = mkDefault "0"; - DIR = mkDefault "01;34"; - LINK = mkDefault "01;36"; - MULTIHARDLINK = mkDefault "00"; - FIFO = mkDefault "40;33"; - SOCK = mkDefault "01;35"; - DOOR = mkDefault "01;35"; - BLK = mkDefault "40;33;01"; - CHR = mkDefault "40;33;01"; - ORPHAN = mkDefault "40;31;01"; - MISSING = mkDefault "00"; - SETUID = mkDefault "37;41"; - SETGID = mkDefault "30;43"; - CAPABILITY = mkDefault "30;41"; - STICKY_OTHER_WRITABLE = mkDefault "30;42"; - OTHER_WRITABLE = mkDefault "34;42"; - STICKY = mkDefault "37;44"; - EXEC = mkDefault "01;32"; - ".tar" = mkDefault "01;31"; - ".tgz" = mkDefault "01;31"; - ".arc" = mkDefault "01;31"; - ".arj" = mkDefault "01;31"; - ".taz" = mkDefault "01;31"; - ".lha" = mkDefault "01;31"; - ".lz4" = mkDefault "01;31"; - ".lzh" = mkDefault "01;31"; - ".lzma" = mkDefault "01;31"; - ".tlz" = mkDefault "01;31"; - ".txz" = mkDefault "01;31"; - ".tzo" = mkDefault "01;31"; - ".t7z" = mkDefault "01;31"; - ".zip" = mkDefault "01;31"; - ".z" = mkDefault "01;31"; - ".dz" = mkDefault "01;31"; - ".gz" = mkDefault "01;31"; - ".lrz" = mkDefault "01;31"; - ".lz" = mkDefault "01;31"; - ".lzo" = mkDefault "01;31"; - ".xz" = mkDefault "01;31"; - ".zst" = mkDefault "01;31"; - ".tzst" = mkDefault "01;31"; - ".bz2" = mkDefault "01;31"; - ".bz" = mkDefault "01;31"; - ".tbz" = mkDefault "01;31"; - ".tbz2" = mkDefault "01;31"; - ".tz" = mkDefault "01;31"; - ".deb" = mkDefault "01;31"; - ".rpm" = mkDefault "01;31"; - ".jar" = mkDefault "01;31"; - ".war" = mkDefault "01;31"; - ".ear" = mkDefault "01;31"; - ".sar" = mkDefault "01;31"; - ".rar" = mkDefault "01;31"; - ".alz" = mkDefault "01;31"; - ".ace" = mkDefault "01;31"; - ".zoo" = mkDefault "01;31"; - ".cpio" = mkDefault "01;31"; - ".7z" = mkDefault "01;31"; - ".rz" = mkDefault "01;31"; - ".cab" = mkDefault "01;31"; - ".wim" = mkDefault "01;31"; - ".swm" = mkDefault "01;31"; - ".dwm" = mkDefault "01;31"; - ".esd" = mkDefault "01;31"; - ".jpg" = mkDefault "01;35"; - ".jpeg" = mkDefault "01;35"; - ".mjpg" = mkDefault "01;35"; - ".mjpeg" = mkDefault "01;35"; - ".gif" = mkDefault "01;35"; - ".bmp" = mkDefault "01;35"; - ".pbm" = mkDefault "01;35"; - ".pgm" = mkDefault "01;35"; - ".ppm" = mkDefault "01;35"; - ".tga" = mkDefault "01;35"; - ".xbm" = mkDefault "01;35"; - ".xpm" = mkDefault "01;35"; - ".tif" = mkDefault "01;35"; - ".tiff" = mkDefault "01;35"; - ".png" = mkDefault "01;35"; - ".svg" = mkDefault "01;35"; - ".svgz" = mkDefault "01;35"; - ".mng" = mkDefault "01;35"; - ".pcx" = mkDefault "01;35"; - ".mov" = mkDefault "01;35"; - ".mpg" = mkDefault "01;35"; - ".mpeg" = mkDefault "01;35"; - ".m2v" = mkDefault "01;35"; - ".mkv" = mkDefault "01;35"; - ".webm" = mkDefault "01;35"; - ".ogm" = mkDefault "01;35"; - ".mp4" = mkDefault "01;35"; - ".m4v" = mkDefault "01;35"; - ".mp4v" = mkDefault "01;35"; - ".vob" = mkDefault "01;35"; - ".qt" = mkDefault "01;35"; - ".nuv" = mkDefault "01;35"; - ".wmv" = mkDefault "01;35"; - ".asf" = mkDefault "01;35"; - ".rm" = mkDefault "01;35"; - ".rmvb" = mkDefault "01;35"; - ".flc" = mkDefault "01;35"; - ".avi" = mkDefault "01;35"; - ".fli" = mkDefault "01;35"; - ".flv" = mkDefault "01;35"; - ".gl" = mkDefault "01;35"; - ".dl" = mkDefault "01;35"; - ".xcf" = mkDefault "01;35"; - ".xwd" = mkDefault "01;35"; - ".yuv" = mkDefault "01;35"; - ".cgm" = mkDefault "01;35"; - ".emf" = mkDefault "01;35"; - ".ogv" = mkDefault "01;35"; - ".ogx" = mkDefault "01;35"; - ".aac" = mkDefault "00;36"; - ".au" = mkDefault "00;36"; - ".flac" = mkDefault "00;36"; - ".m4a" = mkDefault "00;36"; - ".mid" = mkDefault "00;36"; - ".midi" = mkDefault "00;36"; - ".mka" = mkDefault "00;36"; - ".mp3" = mkDefault "00;36"; - ".mpc" = mkDefault "00;36"; - ".ogg" = mkDefault "00;36"; - ".ra" = mkDefault "00;36"; - ".wav" = mkDefault "00;36"; - ".oga" = mkDefault "00;36"; - ".opus" = mkDefault "00;36"; - ".spx" = mkDefault "00;36"; - ".xspf" = mkDefault "00;36"; - }; + dircolorsConfig = lib.concatStringsSep "\n" ( + [ ] + ++ lib.mapAttrsToList formatLine cfg.settings + ++ [ "" ] + ++ lib.optional (cfg.extraConfig != "") cfg.extraConfig + ); + in + mkIf cfg.enable ( + lib.mkMerge [ + { + # Add default settings from `dircolors --print-database`. + programs.dircolors.settings = { + RESET = mkDefault "0"; + DIR = mkDefault "01;34"; + LINK = mkDefault "01;36"; + MULTIHARDLINK = mkDefault "00"; + FIFO = mkDefault "40;33"; + SOCK = mkDefault "01;35"; + DOOR = mkDefault "01;35"; + BLK = mkDefault "40;33;01"; + CHR = mkDefault "40;33;01"; + ORPHAN = mkDefault "40;31;01"; + MISSING = mkDefault "00"; + SETUID = mkDefault "37;41"; + SETGID = mkDefault "30;43"; + CAPABILITY = mkDefault "30;41"; + STICKY_OTHER_WRITABLE = mkDefault "30;42"; + OTHER_WRITABLE = mkDefault "34;42"; + STICKY = mkDefault "37;44"; + EXEC = mkDefault "01;32"; + ".tar" = mkDefault "01;31"; + ".tgz" = mkDefault "01;31"; + ".arc" = mkDefault "01;31"; + ".arj" = mkDefault "01;31"; + ".taz" = mkDefault "01;31"; + ".lha" = mkDefault "01;31"; + ".lz4" = mkDefault "01;31"; + ".lzh" = mkDefault "01;31"; + ".lzma" = mkDefault "01;31"; + ".tlz" = mkDefault "01;31"; + ".txz" = mkDefault "01;31"; + ".tzo" = mkDefault "01;31"; + ".t7z" = mkDefault "01;31"; + ".zip" = mkDefault "01;31"; + ".z" = mkDefault "01;31"; + ".dz" = mkDefault "01;31"; + ".gz" = mkDefault "01;31"; + ".lrz" = mkDefault "01;31"; + ".lz" = mkDefault "01;31"; + ".lzo" = mkDefault "01;31"; + ".xz" = mkDefault "01;31"; + ".zst" = mkDefault "01;31"; + ".tzst" = mkDefault "01;31"; + ".bz2" = mkDefault "01;31"; + ".bz" = mkDefault "01;31"; + ".tbz" = mkDefault "01;31"; + ".tbz2" = mkDefault "01;31"; + ".tz" = mkDefault "01;31"; + ".deb" = mkDefault "01;31"; + ".rpm" = mkDefault "01;31"; + ".jar" = mkDefault "01;31"; + ".war" = mkDefault "01;31"; + ".ear" = mkDefault "01;31"; + ".sar" = mkDefault "01;31"; + ".rar" = mkDefault "01;31"; + ".alz" = mkDefault "01;31"; + ".ace" = mkDefault "01;31"; + ".zoo" = mkDefault "01;31"; + ".cpio" = mkDefault "01;31"; + ".7z" = mkDefault "01;31"; + ".rz" = mkDefault "01;31"; + ".cab" = mkDefault "01;31"; + ".wim" = mkDefault "01;31"; + ".swm" = mkDefault "01;31"; + ".dwm" = mkDefault "01;31"; + ".esd" = mkDefault "01;31"; + ".jpg" = mkDefault "01;35"; + ".jpeg" = mkDefault "01;35"; + ".mjpg" = mkDefault "01;35"; + ".mjpeg" = mkDefault "01;35"; + ".gif" = mkDefault "01;35"; + ".bmp" = mkDefault "01;35"; + ".pbm" = mkDefault "01;35"; + ".pgm" = mkDefault "01;35"; + ".ppm" = mkDefault "01;35"; + ".tga" = mkDefault "01;35"; + ".xbm" = mkDefault "01;35"; + ".xpm" = mkDefault "01;35"; + ".tif" = mkDefault "01;35"; + ".tiff" = mkDefault "01;35"; + ".png" = mkDefault "01;35"; + ".svg" = mkDefault "01;35"; + ".svgz" = mkDefault "01;35"; + ".mng" = mkDefault "01;35"; + ".pcx" = mkDefault "01;35"; + ".mov" = mkDefault "01;35"; + ".mpg" = mkDefault "01;35"; + ".mpeg" = mkDefault "01;35"; + ".m2v" = mkDefault "01;35"; + ".mkv" = mkDefault "01;35"; + ".webm" = mkDefault "01;35"; + ".ogm" = mkDefault "01;35"; + ".mp4" = mkDefault "01;35"; + ".m4v" = mkDefault "01;35"; + ".mp4v" = mkDefault "01;35"; + ".vob" = mkDefault "01;35"; + ".qt" = mkDefault "01;35"; + ".nuv" = mkDefault "01;35"; + ".wmv" = mkDefault "01;35"; + ".asf" = mkDefault "01;35"; + ".rm" = mkDefault "01;35"; + ".rmvb" = mkDefault "01;35"; + ".flc" = mkDefault "01;35"; + ".avi" = mkDefault "01;35"; + ".fli" = mkDefault "01;35"; + ".flv" = mkDefault "01;35"; + ".gl" = mkDefault "01;35"; + ".dl" = mkDefault "01;35"; + ".xcf" = mkDefault "01;35"; + ".xwd" = mkDefault "01;35"; + ".yuv" = mkDefault "01;35"; + ".cgm" = mkDefault "01;35"; + ".emf" = mkDefault "01;35"; + ".ogv" = mkDefault "01;35"; + ".ogx" = mkDefault "01;35"; + ".aac" = mkDefault "00;36"; + ".au" = mkDefault "00;36"; + ".flac" = mkDefault "00;36"; + ".m4a" = mkDefault "00;36"; + ".mid" = mkDefault "00;36"; + ".midi" = mkDefault "00;36"; + ".mka" = mkDefault "00;36"; + ".mp3" = mkDefault "00;36"; + ".mpc" = mkDefault "00;36"; + ".ogg" = mkDefault "00;36"; + ".ra" = mkDefault "00;36"; + ".wav" = mkDefault "00;36"; + ".oga" = mkDefault "00;36"; + ".opus" = mkDefault "00;36"; + ".spx" = mkDefault "00;36"; + ".xspf" = mkDefault "00;36"; + }; - programs.bash.initExtra = mkIf cfg.enableBashIntegration '' - eval $(${lib.getExe' cfg.package "dircolors"} -b ${dircolorsPath}) - ''; + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + eval $(${lib.getExe' cfg.package "dircolors"} -b ${dircolorsPath}) + ''; - programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - eval (${lib.getExe' cfg.package "dircolors"} -c ${dircolorsPath}) - ''; + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + eval (${lib.getExe' cfg.package "dircolors"} -c ${dircolorsPath}) + ''; - # Set `LS_COLORS` before Oh My Zsh and `initExtra`. - programs.zsh.initContent = mkIf cfg.enableZshIntegration - (lib.mkOrder 550 '' - eval $(${lib.getExe' cfg.package "dircolors"} -b ${dircolorsPath}) - ''); - } - (mkIf (!config.home.preferXdgDirectories) { - home.file.".dir_colors".text = dircolorsConfig; - }) - (mkIf config.home.preferXdgDirectories { - xdg.configFile.dir_colors.text = dircolorsConfig; - }) - ]); + # Set `LS_COLORS` before Oh My Zsh and `initExtra`. + programs.zsh.initContent = mkIf cfg.enableZshIntegration ( + lib.mkOrder 550 '' + eval $(${lib.getExe' cfg.package "dircolors"} -b ${dircolorsPath}) + '' + ); + } + (mkIf (!config.home.preferXdgDirectories) { + home.file.".dir_colors".text = dircolorsConfig; + }) + (mkIf config.home.preferXdgDirectories { + xdg.configFile.dir_colors.text = dircolorsConfig; + }) + ] + ); } diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index c588c6b14..bb86531c7 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -1,25 +1,50 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) - mkOption mkRenamedOptionModule mkRemovedOptionModule mkEnableOption types - mkPackageOption mkIf mkAfter getExe; + mkOption + mkRenamedOptionModule + mkRemovedOptionModule + mkEnableOption + types + mkPackageOption + mkIf + mkAfter + getExe + ; cfg = config.programs.direnv; tomlFormat = pkgs.formats.toml { }; -in { +in +{ imports = [ - (mkRenamedOptionModule [ + (mkRenamedOptionModule + [ + "programs" + "direnv" + "enableNixDirenvIntegration" + ] + [ "programs" "direnv" "nix-direnv" "enable" ] + ) + (mkRemovedOptionModule [ "programs" "direnv" - "enableNixDirenvIntegration" - ] [ "programs" "direnv" "nix-direnv" "enable" ]) - (mkRemovedOptionModule [ "programs" "direnv" "nix-direnv" "enableFlakes" ] - "Flake support is now always enabled.") + "nix-direnv" + "enableFlakes" + ] "Flake support is now always enabled.") ]; - meta.maintainers = with lib.maintainers; [ khaneliman rycee shikanime ]; + meta.maintainers = with lib.maintainers; [ + khaneliman + rycee + shikanime + ]; options.programs.direnv = { enable = mkEnableOption "direnv, the environment switcher"; @@ -48,32 +73,31 @@ in { ''; }; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { - inherit config; - extraDescription = '' - Note, enabling the direnv module will always activate its functionality - for Fish since the direnv package automatically gets loaded in Fish. - If this is not the case try adding + enableFishIntegration = + lib.hm.shell.mkFishIntegrationOption { + inherit config; + extraDescription = '' + Note, enabling the direnv module will always activate its functionality + for Fish since the direnv package automatically gets loaded in Fish. + If this is not the case try adding - ```nix - environment.pathsToLink = [ "/share/fish" ]; - ``` + ```nix + environment.pathsToLink = [ "/share/fish" ]; + ``` - to the system configuration. - ''; - } // { - default = true; - readOnly = true; - }; + to the system configuration. + ''; + } + // { + default = true; + readOnly = true; + }; - enableNushellIntegration = - lib.hm.shell.mkNushellIntegrationOption { inherit config; }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; nix-direnv = { enable = mkEnableOption '' @@ -105,8 +129,7 @@ in { source = "${cfg.nix-direnv.package}/share/nix-direnv/direnvrc"; }; - xdg.configFile."direnv/direnvrc" = - lib.mkIf (cfg.stdlib != "") { text = cfg.stdlib; }; + xdg.configFile."direnv/direnvrc" = lib.mkIf (cfg.stdlib != "") { text = cfg.stdlib; }; xdg.configFile."direnv/lib/hm-mise.sh" = mkIf cfg.mise.enable { text = '' @@ -119,7 +142,8 @@ in { # manipulations of the prompt. mkAfter '' eval "$(${getExe cfg.package} hook bash)" - ''); + '' + ); programs.zsh.initContent = mkIf cfg.enableZshIntegration '' eval "$(${getExe cfg.package} hook zsh)" @@ -130,7 +154,8 @@ in { # manipulations of the prompt. mkAfter '' ${getExe cfg.package} hook fish | source - ''); + '' + ); # Using mkAfter to make it more likely to appear after other # manipulations of the prompt. diff --git a/modules/programs/discocss.nix b/modules/programs/discocss.nix index 365d1a885..eb8c3d4a9 100644 --- a/modules/programs/discocss.nix +++ b/modules/programs/discocss.nix @@ -1,12 +1,18 @@ -{ config, lib, pkgs, ... }: -let cfg = config.programs.discocss; -in { +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.discocss; +in +{ meta.maintainers = with lib.maintainers; [ kranzes ]; options = { programs.discocss = { - enable = lib.mkEnableOption - "discocss, a tiny Discord CSS injector for Linux and MacOS"; + enable = lib.mkEnableOption "discocss, a tiny Discord CSS injector for Linux and MacOS"; package = lib.mkPackageOption pkgs "discocss" { nullable = true; }; @@ -27,13 +33,13 @@ in { }; config = lib.mkIf cfg.enable { - assertions = [{ - assertion = cfg.discordAlias - -> !(lib.any (p: p.name == cfg.discordPackage.name) - config.home.packages); - message = - "To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false."; - }]; + assertions = [ + { + assertion = + cfg.discordAlias -> !(lib.any (p: p.name == cfg.discordPackage.name) config.home.packages); + message = "To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false."; + } + ]; home.packages = lib.mkIf (cfg.package != null) [ (cfg.package.override { diff --git a/modules/programs/distrobox.nix b/modules/programs/distrobox.nix index 30e716644..0cf517386 100644 --- a/modules/programs/distrobox.nix +++ b/modules/programs/distrobox.nix @@ -1,11 +1,24 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let - inherit (lib) generators types mkIf mkEnableOption mkPackageOption mkOption; + inherit (lib) + generators + types + mkIf + mkEnableOption + mkPackageOption + mkOption + ; cfg = config.programs.distrobox; formatter = pkgs.formats.ini { listsAsDuplicateKeys = true; }; -in { +in +{ meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ]; options.programs.distrobox = { @@ -57,18 +70,17 @@ in { config = mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "programs.distrobox" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "programs.distrobox" pkgs lib.platforms.linux) ]; home.packages = [ cfg.package ]; - xdg.configFile."distrobox/containers.ini".source = - (formatter.generate "containers.ini" cfg.containers); + xdg.configFile."distrobox/containers.ini".source = ( + formatter.generate "containers.ini" cfg.containers + ); systemd.user.services.distrobox-home-manager = { - Unit.Description = - "Build the containers declared in ~/.config/distrobox/containers.ini"; + Unit.Description = "Build the containers declared in ~/.config/distrobox/containers.ini"; Install.WantedBy = [ "default.target" ]; Service.ExecStart = "${pkgs.writeShellScript "distrobox-home-manager" '' diff --git a/modules/programs/earthly.nix b/modules/programs/earthly.nix index a2b2a44c1..eaf7e63ea 100644 --- a/modules/programs/earthly.nix +++ b/modules/programs/earthly.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let @@ -6,7 +11,8 @@ let yamlFormat = pkgs.formats.yaml { }; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.folliehiyuki ]; options.programs.earthly = { diff --git a/modules/programs/eclipse.nix b/modules/programs/eclipse.nix index 8bc495bea..e2b4ce100 100644 --- a/modules/programs/eclipse.nix +++ b/modules/programs/eclipse.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkIf mkOption types; cfg = config.programs.eclipse; -in { +in +{ meta.maintainers = [ lib.maintainers.rycee ]; options = { @@ -11,7 +17,10 @@ in { enable = lib.mkEnableOption "Eclipse"; package = lib.mkPackageOption pkgs "eclipse" { - default = [ "eclipses" "eclipse-platform" ]; + default = [ + "eclipses" + "eclipse-platform" + ]; example = "pkgs.eclipses.eclipse-java"; }; @@ -43,8 +52,9 @@ in { home.packages = [ (pkgs.eclipses.eclipseWithPlugins { eclipse = cfg.package; - jvmArgs = cfg.jvmArgs ++ lib.optional cfg.enableLombok - "-javaagent:${pkgs.lombok}/share/java/lombok.jar"; + jvmArgs = + cfg.jvmArgs + ++ lib.optional cfg.enableLombok "-javaagent:${pkgs.lombok}/share/java/lombok.jar"; plugins = cfg.plugins; }) ]; diff --git a/modules/programs/emacs.nix b/modules/programs/emacs.nix index 664ebccdb..a4de9c4fc 100644 --- a/modules/programs/emacs.nix +++ b/modules/programs/emacs.nix @@ -1,17 +1,31 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) literalExpression mkIf mkOption types; + inherit (lib) + literalExpression + mkIf + mkOption + types + ; cfg = config.programs.emacs; # Copied from all-packages.nix, with modifications to support # overrides. - emacsPackages = let epkgs = pkgs.emacsPackagesFor cfg.package; - in epkgs.overrideScope cfg.overrides; + emacsPackages = + let + epkgs = pkgs.emacsPackagesFor cfg.package; + in + epkgs.overrideScope cfg.overrides; emacsWithPackages = emacsPackages.emacsWithPackages; - extraPackages = epkgs: + extraPackages = + epkgs: let packages = cfg.extraPackages epkgs; userConfig = epkgs.trivialBuild { @@ -20,17 +34,18 @@ let version = "0.1.0"; packageRequires = packages; }; - in packages ++ lib.optional (cfg.extraConfig != "") userConfig; + in + packages ++ lib.optional (cfg.extraConfig != "") userConfig; -in { +in +{ meta.maintainers = [ lib.maintainers.rycee ]; options = { programs.emacs = { enable = lib.mkEnableOption "Emacs"; - package = - lib.mkPackageOption pkgs "emacs" { example = "pkgs.emacs25-nox"; }; + package = lib.mkPackageOption pkgs "emacs" { example = "pkgs.emacs25-nox"; }; # NOTE: The config is placed in default.el instead of ~/.emacs.d so that # it won't conflict with Emacs configuration frameworks. Users of these diff --git a/modules/programs/eww.nix b/modules/programs/eww.nix index d84644a4e..56b3340e3 100644 --- a/modules/programs/eww.nix +++ b/modules/programs/eww.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkIf; cfg = config.programs.eww; -in { +in +{ meta.maintainers = [ lib.hm.maintainers.mainrs ]; options.programs.eww = { @@ -21,38 +27,37 @@ in { ''; }; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = - lib.hm.shell.mkFishIntegrationOption { inherit config; }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; }; - config = let ewwCmd = lib.getExe cfg.package; - in mkIf cfg.enable { - home.packages = [ cfg.package ]; - xdg = - mkIf (cfg.configDir != null) { configFile."eww".source = cfg.configDir; }; + config = + let + ewwCmd = lib.getExe cfg.package; + in + mkIf cfg.enable { + home.packages = [ cfg.package ]; + xdg = mkIf (cfg.configDir != null) { configFile."eww".source = cfg.configDir; }; - programs.bash.initExtra = mkIf cfg.enableBashIntegration '' - if [[ $TERM != "dumb" ]]; then - eval "$(${ewwCmd} shell-completions --shell bash)" - fi - ''; + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + if [[ $TERM != "dumb" ]]; then + eval "$(${ewwCmd} shell-completions --shell bash)" + fi + ''; - programs.zsh.initContent = mkIf cfg.enableZshIntegration '' - if [[ $TERM != "dumb" ]]; then - eval "$(${ewwCmd} shell-completions --shell zsh)" - fi - ''; + programs.zsh.initContent = mkIf cfg.enableZshIntegration '' + if [[ $TERM != "dumb" ]]; then + eval "$(${ewwCmd} shell-completions --shell zsh)" + fi + ''; - programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' - if test "$TERM" != "dumb" - eval "$(${ewwCmd} shell-completions --shell fish)" - end - ''; - }; + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' + if test "$TERM" != "dumb" + eval "$(${ewwCmd} shell-completions --shell fish)" + end + ''; + }; } diff --git a/modules/programs/eza.nix b/modules/programs/eza.nix index b30710164..849d8abd3 100644 --- a/modules/programs/eza.nix +++ b/modules/programs/eza.nix @@ -1,54 +1,76 @@ -{ config, lib, pkgs, ... }: -let inherit (lib) mkOption optionalAttrs types; -in { - imports = let - msg = '' - 'programs.eza.enableAliases' has been deprecated and replaced with integration - options per shell, for example, 'programs.eza.enableBashIntegration'. +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkOption optionalAttrs types; +in +{ + imports = + let + msg = '' + 'programs.eza.enableAliases' has been deprecated and replaced with integration + options per shell, for example, 'programs.eza.enableBashIntegration'. - Note, the default for these options is 'true' so if you want to enable the - aliases you can simply remove 'programs.eza.enableAliases' from your - configuration.''; - mkRenamed = opt: - lib.mkRenamedOptionModule [ "programs" "exa" opt ] [ - "programs" - "eza" - opt - ]; - in (map mkRenamed [ "enable" "extraOptions" "icons" "git" ]) - ++ [ (lib.mkRemovedOptionModule [ "programs" "eza" "enableAliases" ] msg) ]; + Note, the default for these options is 'true' so if you want to enable the + aliases you can simply remove 'programs.eza.enableAliases' from your + configuration.''; + mkRenamed = + opt: + lib.mkRenamedOptionModule + [ "programs" "exa" opt ] + [ + "programs" + "eza" + opt + ]; + in + (map mkRenamed [ + "enable" + "extraOptions" + "icons" + "git" + ]) + ++ [ (lib.mkRemovedOptionModule [ "programs" "eza" "enableAliases" ] msg) ]; meta.maintainers = [ lib.maintainers.cafkafk ]; options.programs.eza = { enable = lib.mkEnableOption "eza, a modern replacement for {command}`ls`"; - enableBashIntegration = - lib.hm.shell.mkBashIntegrationOption { inherit config; }; + enableBashIntegration = lib.hm.shell.mkBashIntegrationOption { inherit config; }; - enableFishIntegration = - lib.hm.shell.mkFishIntegrationOption { inherit config; }; + enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; }; - enableIonIntegration = - lib.hm.shell.mkIonIntegrationOption { inherit config; }; + enableIonIntegration = lib.hm.shell.mkIonIntegrationOption { inherit config; }; - enableNushellIntegration = - lib.hm.shell.mkNushellIntegrationOption { inherit config; }; + enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; }; - enableZshIntegration = - lib.hm.shell.mkZshIntegrationOption { inherit config; }; + enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; extraOptions = mkOption { type = types.listOf types.str; default = [ ]; - example = [ "--group-directories-first" "--header" ]; + example = [ + "--group-directories-first" + "--header" + ]; description = '' Extra command line options passed to eza. ''; }; icons = mkOption { - type = types.enum [ null true false "auto" "always" "never" ]; + type = types.enum [ + null + true + false + "auto" + "always" + "never" + ]; default = null; description = '' Display icons next to file names ({option}`--icons` argument). @@ -59,7 +81,12 @@ in { }; colors = mkOption { - type = types.enum [ null "auto" "always" "never" ]; + type = types.enum [ + null + "auto" + "always" + "never" + ]; default = null; description = '' Use terminal colors in output ({option}`--color` argument). @@ -77,60 +104,65 @@ in { package = lib.mkPackageOption pkgs "eza" { nullable = true; }; }; - config = let - cfg = config.programs.eza; + config = + let + cfg = config.programs.eza; - iconsOption = let - v = if lib.isBool cfg.icons then - (if cfg.icons then "auto" else null) - else - cfg.icons; - in lib.optionals (v != null) [ "--icons" v ]; + iconsOption = + let + v = if lib.isBool cfg.icons then (if cfg.icons then "auto" else null) else cfg.icons; + in + lib.optionals (v != null) [ + "--icons" + v + ]; - args = lib.escapeShellArgs (iconsOption - ++ lib.optionals (cfg.colors != null) [ "--color" cfg.colors ] - ++ lib.optional cfg.git "--git" ++ cfg.extraOptions); + args = lib.escapeShellArgs ( + iconsOption + ++ lib.optionals (cfg.colors != null) [ + "--color" + cfg.colors + ] + ++ lib.optional cfg.git "--git" + ++ cfg.extraOptions + ); - optionsAlias = optionalAttrs (args != "") { eza = "eza ${args}"; }; + optionsAlias = optionalAttrs (args != "") { eza = "eza ${args}"; }; - aliases = builtins.mapAttrs (_name: value: lib.mkDefault value) { - ls = "eza"; - ll = "eza -l"; - la = "eza -a"; - lt = "eza --tree"; - lla = "eza -la"; + aliases = builtins.mapAttrs (_name: value: lib.mkDefault value) { + ls = "eza"; + ll = "eza -l"; + la = "eza -a"; + lt = "eza --tree"; + lla = "eza -la"; + }; + in + lib.mkIf cfg.enable { + warnings = lib.optional (lib.isBool cfg.icons) '' + Setting programs.eza.icons to a Boolean is deprecated. + Please update your configuration so that + + programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}''; + + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; + + programs.bash.shellAliases = optionsAlias // optionalAttrs cfg.enableBashIntegration aliases; + + programs.zsh.shellAliases = optionsAlias // optionalAttrs cfg.enableZshIntegration aliases; + + programs.fish = lib.mkMerge [ + (lib.mkIf (!config.programs.fish.preferAbbrs) { + shellAliases = optionsAlias // optionalAttrs cfg.enableFishIntegration aliases; + }) + + (lib.mkIf config.programs.fish.preferAbbrs { + shellAliases = optionsAlias; + shellAbbrs = optionalAttrs cfg.enableFishIntegration aliases; + }) + ]; + + programs.ion.shellAliases = optionsAlias // optionalAttrs cfg.enableIonIntegration aliases; + + programs.nushell.shellAliases = optionsAlias // optionalAttrs cfg.enableNushellIntegration aliases; }; - in lib.mkIf cfg.enable { - warnings = lib.optional (lib.isBool cfg.icons) '' - Setting programs.eza.icons to a Boolean is deprecated. - Please update your configuration so that - - programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}''; - - home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - - programs.bash.shellAliases = optionsAlias - // optionalAttrs cfg.enableBashIntegration aliases; - - programs.zsh.shellAliases = optionsAlias - // optionalAttrs cfg.enableZshIntegration aliases; - - programs.fish = lib.mkMerge [ - (lib.mkIf (!config.programs.fish.preferAbbrs) { - shellAliases = optionsAlias - // optionalAttrs cfg.enableFishIntegration aliases; - }) - - (lib.mkIf config.programs.fish.preferAbbrs { - shellAliases = optionsAlias; - shellAbbrs = optionalAttrs cfg.enableFishIntegration aliases; - }) - ]; - - programs.ion.shellAliases = optionsAlias - // optionalAttrs cfg.enableIonIntegration aliases; - - programs.nushell.shellAliases = optionsAlias - // optionalAttrs cfg.enableNushellIntegration aliases; - }; } diff --git a/modules/programs/fastfetch.nix b/modules/programs/fastfetch.nix index abc4d7cda..8f94b8374 100644 --- a/modules/programs/fastfetch.nix +++ b/modules/programs/fastfetch.nix @@ -1,14 +1,28 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let - inherit (lib) mkEnableOption mkPackageOption mkOption mkIf literalExpression; + inherit (lib) + mkEnableOption + mkPackageOption + mkOption + mkIf + literalExpression + ; cfg = config.programs.fastfetch; jsonFormat = pkgs.formats.json { }; -in { - meta.maintainers = - [ lib.hm.maintainers.afresquet lib.maintainers.khaneliman ]; +in +{ + meta.maintainers = [ + lib.hm.maintainers.afresquet + lib.maintainers.khaneliman + ]; options.programs.fastfetch = { enable = mkEnableOption "Fastfetch"; diff --git a/modules/programs/fd.nix b/modules/programs/fd.nix index 603c04051..4f3afaf84 100644 --- a/modules/programs/fd.nix +++ b/modules/programs/fd.nix @@ -1,16 +1,25 @@ -{ config, lib, pkgs, ... }: -let inherit (lib) mkOption types; -in { +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkOption types; +in +{ meta.maintainers = [ lib.maintainers.uncenter ]; options.programs.fd = { - enable = lib.mkEnableOption - "fd, a simple, fast and user-friendly alternative to {command}`find`"; + enable = lib.mkEnableOption "fd, a simple, fast and user-friendly alternative to {command}`find`"; ignores = mkOption { type = types.listOf types.str; default = [ ]; - example = [ ".git/" "*.bak" ]; + example = [ + ".git/" + "*.bak" + ]; description = "List of paths that should be globally ignored."; }; @@ -25,7 +34,10 @@ in { extraOptions = mkOption { type = types.listOf types.str; default = [ ]; - example = [ "--no-ignore" "--absolute-path" ]; + example = [ + "--no-ignore" + "--absolute-path" + ]; description = '' Extra command line options passed to fd. ''; @@ -34,28 +46,29 @@ in { package = lib.mkPackageOption pkgs "fd" { nullable = true; }; }; - config = let - cfg = config.programs.fd; + config = + let + cfg = config.programs.fd; - args = lib.escapeShellArgs - (lib.optional cfg.hidden "--hidden" ++ cfg.extraOptions); + args = lib.escapeShellArgs (lib.optional cfg.hidden "--hidden" ++ cfg.extraOptions); - optionsAlias = lib.optionalAttrs (args != "") { fd = "fd ${args}"; }; - in lib.mkIf cfg.enable { - home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; + optionsAlias = lib.optionalAttrs (args != "") { fd = "fd ${args}"; }; + in + lib.mkIf cfg.enable { + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - programs.bash.shellAliases = optionsAlias; + programs.bash.shellAliases = optionsAlias; - programs.zsh.shellAliases = optionsAlias; + programs.zsh.shellAliases = optionsAlias; - programs.fish.shellAliases = optionsAlias; + programs.fish.shellAliases = optionsAlias; - programs.ion.shellAliases = optionsAlias; + programs.ion.shellAliases = optionsAlias; - programs.nushell.shellAliases = optionsAlias; + programs.nushell.shellAliases = optionsAlias; - xdg.configFile."fd/ignore" = lib.mkIf (cfg.ignores != [ ]) { - text = lib.concatStringsSep "\n" cfg.ignores + "\n"; + xdg.configFile."fd/ignore" = lib.mkIf (cfg.ignores != [ ]) { + text = lib.concatStringsSep "\n" cfg.ignores + "\n"; + }; }; - }; } diff --git a/modules/programs/feh.nix b/modules/programs/feh.nix index 661a2fe9a..26b1a6bc8 100644 --- a/modules/programs/feh.nix +++ b/modules/programs/feh.nix @@ -1,25 +1,39 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) filterAttrs mapAttrsToList mkOption types; + inherit (lib) + filterAttrs + mapAttrsToList + mkOption + types + ; cfg = config.programs.feh; bindingsOf = t: with types; attrsOf (nullOr (either t (listOf t))); - renderThemes = options: + renderThemes = + options: let - render = mapAttrsToList - (theme: options: "${theme} ${lib.escapeShellArgs options}"); - in lib.concatStringsSep "\n" (render options); + render = mapAttrsToList (theme: options: "${theme} ${lib.escapeShellArgs options}"); + in + lib.concatStringsSep "\n" (render options); - renderBindings = bindings: + renderBindings = + bindings: let enabled = filterAttrs (n: v: v != null) bindings; disabled = filterAttrs (n: v: v == null) bindings; render = mapAttrsToList renderBinding; - in lib.concatStringsSep "\n" (render disabled ++ render enabled); + in + lib.concatStringsSep "\n" (render disabled ++ render enabled); - renderBinding = func: key: + renderBinding = + func: key: if key == null then func else if lib.isList key then @@ -27,7 +41,8 @@ let else "${func} ${toString key}"; -in { +in +{ options.programs.feh = { enable = lib.mkEnableOption "feh - a fast and light image viewer"; @@ -39,7 +54,10 @@ in { example = { zoom_in = 4; zoom_out = "C-4"; - prev_img = [ 3 "C-3" ]; + prev_img = [ + 3 + "C-3" + ]; }; description = '' Override feh's default mouse button mapping. If you want to disable an @@ -56,7 +74,10 @@ in { example = { zoom_in = "plus"; zoom_out = "minus"; - prev_img = [ "h" "Left" ]; + prev_img = [ + "h" + "Left" + ]; }; description = '' Override feh's default keybindings. If you want to disable a keybinding @@ -71,10 +92,27 @@ in { default = { }; type = with types; attrsOf (listOf str); example = { - feh = [ "--image-bg" "black" ]; - webcam = [ "--multiwindow" "--reload" "20" ]; - present = [ "--full-screen" "--sort" "name" "--hide-pointer" ]; - booth = [ "--full-screen" "--hide-pointer" "--slideshow-delay" "20" ]; + 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" @@ -84,7 +122,10 @@ in { "--index-info" "%n\\n%wx%h" ]; - example = [ "--info" "foo bar" ]; + example = [ + "--info" + "foo bar" + ]; }; description = '' Define themes for feh. @@ -96,11 +137,12 @@ in { }; config = lib.mkIf cfg.enable { - assertions = [{ - assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { }); - message = - "To disable a keybinding, use `null` instead of an empty string."; - }]; + assertions = [ + { + assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { }); + message = "To disable a keybinding, use `null` instead of an empty string."; + } + ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; @@ -112,7 +154,8 @@ in { text = renderBindings cfg.keybindings + "\n"; }; - xdg.configFile."feh/themes" = - lib.mkIf (cfg.themes != { }) { text = renderThemes cfg.themes + "\n"; }; + xdg.configFile."feh/themes" = lib.mkIf (cfg.themes != { }) { + text = renderThemes cfg.themes + "\n"; + }; }; } diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 0b8a80efb..8d473daa0 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -2,12 +2,16 @@ let inherit (lib) mkRemovedOptionModule; - modulePath = [ "programs" "firefox" ]; + modulePath = [ + "programs" + "firefox" + ]; moduleName = lib.concatStringsSep "." modulePath; mkFirefoxModule = import ./firefox/mkFirefoxModule.nix; -in { +in +{ meta.maintainers = [ lib.maintainers.rycee lib.hm.maintainers.bricked @@ -22,7 +26,9 @@ in { unwrappedPackageName = "firefox-unwrapped"; visible = true; - platforms.linux = { configPath = ".mozilla/firefox"; }; + platforms.linux = { + configPath = ".mozilla/firefox"; + }; platforms.darwin = { configPath = "Library/Application Support/Firefox"; }; @@ -36,11 +42,14 @@ in { to ${moduleName}.profiles.myprofile.extensions.packages = [ foo bar ];'') - (mkRemovedOptionModule (modulePath ++ [ "enableAdobeFlash" ]) - "Support for this option has been removed.") - (mkRemovedOptionModule (modulePath ++ [ "enableGoogleTalk" ]) - "Support for this option has been removed.") - (mkRemovedOptionModule (modulePath ++ [ "enableIcedTea" ]) - "Support for this option has been removed.") + (mkRemovedOptionModule ( + modulePath ++ [ "enableAdobeFlash" ] + ) "Support for this option has been removed.") + (mkRemovedOptionModule ( + modulePath ++ [ "enableGoogleTalk" ] + ) "Support for this option has been removed.") + (mkRemovedOptionModule ( + modulePath ++ [ "enableIcedTea" ] + ) "Support for this option has been removed.") ]; } diff --git a/modules/programs/firefox/mkFirefoxModule.nix b/modules/programs/firefox/mkFirefoxModule.nix index 1d913704d..782ced931 100644 --- a/modules/programs/firefox/mkFirefoxModule.nix +++ b/modules/programs/firefox/mkFirefoxModule.nix @@ -1,11 +1,34 @@ -{ modulePath, name, description ? null, wrappedPackageName ? null -, unwrappedPackageName ? null, platforms, visible ? false -, enableBookmarks ? true, }: -{ config, lib, pkgs, ... }: +{ + modulePath, + name, + description ? null, + wrappedPackageName ? null, + unwrappedPackageName ? null, + platforms, + visible ? false, + enableBookmarks ? true, +}: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) - attrValues concatStringsSep length literalExpression mapAttrsToList mkIf - mkMerge mkOption optionalString optional setAttrByPath types; + attrValues + concatStringsSep + length + literalExpression + mapAttrsToList + mkIf + mkMerge + mkOption + optionalString + optional + setAttrByPath + types + ; inherit (pkgs.stdenv.hostPlatform) isDarwin; appName = name; @@ -16,71 +39,77 @@ let jsonFormat = pkgs.formats.json { }; - supportedPlatforms = - lib.flatten (lib.attrVals (lib.attrNames platforms) lib.platforms); + supportedPlatforms = lib.flatten (lib.attrVals (lib.attrNames platforms) lib.platforms); - isWrapped = lib.versionAtLeast config.home.stateVersion "19.09" - && wrappedPackageName != null; + isWrapped = lib.versionAtLeast config.home.stateVersion "19.09" && wrappedPackageName != null; - defaultPackageName = - if isWrapped then wrappedPackageName else unwrappedPackageName; + defaultPackageName = if isWrapped then wrappedPackageName else unwrappedPackageName; - packageName = if wrappedPackageName != null then - wrappedPackageName - else - unwrappedPackageName; + packageName = if wrappedPackageName != null then wrappedPackageName else unwrappedPackageName; - profilesPath = - if isDarwin then "${cfg.configPath}/Profiles" else cfg.configPath; + profilesPath = if isDarwin then "${cfg.configPath}/Profiles" else cfg.configPath; # The extensions path shared by all profiles; will not be supported # by future browser versions. extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; - profiles = lib.flip lib.mapAttrs' cfg.profiles (_: profile: - lib.nameValuePair "Profile${toString profile.id}" { - Name = profile.name; - Path = if isDarwin then "Profiles/${profile.path}" else profile.path; - IsRelative = 1; - Default = if profile.isDefault then 1 else 0; - }) // { - General = { - StartWithLastProfile = 1; - } // lib.optionalAttrs (cfg.profileVersion != null) { - Version = cfg.profileVersion; - }; + profiles = + lib.flip lib.mapAttrs' cfg.profiles ( + _: profile: + lib.nameValuePair "Profile${toString profile.id}" { + Name = profile.name; + Path = if isDarwin then "Profiles/${profile.path}" else profile.path; + IsRelative = 1; + Default = if profile.isDefault then 1 else 0; + } + ) + // { + General = + { + StartWithLastProfile = 1; + } + // lib.optionalAttrs (cfg.profileVersion != null) { + Version = cfg.profileVersion; + }; }; profilesIni = lib.generators.toINI { } profiles; - userPrefValue = pref: - builtins.toJSON - (if lib.isBool pref || lib.isInt pref || lib.isString pref then - pref - else - builtins.toJSON pref); + userPrefValue = + pref: + builtins.toJSON ( + if lib.isBool pref || lib.isInt pref || lib.isString pref then pref else builtins.toJSON pref + ); - mkUserJs = prePrefs: prefs: extraPrefs: bookmarksFile: extensions: + mkUserJs = + prePrefs: prefs: extraPrefs: bookmarksFile: extensions: let - prefs' = lib.optionalAttrs (bookmarksFile != null) { - "browser.bookmarks.file" = toString bookmarksFile; - "browser.places.importBookmarksHTML" = true; - } // lib.optionalAttrs (extensions != { }) { - "extensions.webextensions.ExtensionStorageIDB.enabled" = false; - } // prefs; - in '' + prefs' = + lib.optionalAttrs (bookmarksFile != null) { + "browser.bookmarks.file" = toString bookmarksFile; + "browser.places.importBookmarksHTML" = true; + } + // lib.optionalAttrs (extensions != { }) { + "extensions.webextensions.ExtensionStorageIDB.enabled" = false; + } + // prefs; + in + '' // Generated by Home Manager. ${prePrefs} - ${lib.concatStrings (mapAttrsToList (name: value: '' - user_pref("${name}", ${userPrefValue value}); - '') prefs')} + ${lib.concatStrings ( + mapAttrsToList (name: value: '' + user_pref("${name}", ${userPrefValue value}); + '') prefs' + )} ${extraPrefs} ''; - mkContainersJson = containers: + mkContainersJson = + containers: let containerToIdentity = _: container: { userContextId = container.id; @@ -89,12 +118,14 @@ let color = container.color; public = true; }; - in '' + in + '' ${builtins.toJSON { version = 5; - lastUserContextId = lib.foldlAttrs - (acc: _: value: if value.id > acc then value.id else acc) 0 - containers; + lastUserContextId = lib.foldlAttrs ( + acc: _: value: + if value.id > acc then value.id else acc + ) 0 containers; identities = mapAttrsToList containerToIdentity containers ++ [ { userContextId = 4294967294; # 2^32 - 2 @@ -116,41 +147,48 @@ let }} ''; - mkNoDuplicateAssertion = entities: entityKind: - (let - # Return an attribute set with entity IDs as keys and a list of - # entity names with corresponding ID as value. An ID is present in - # the result only if more than one entity has it. The argument - # entities is a list of AttrSet of one id/name pair. - findDuplicateIds = entities: - lib.filterAttrs (_entityId: entityNames: length entityNames != 1) - (lib.zipAttrs entities); + mkNoDuplicateAssertion = + entities: entityKind: + ( + let + # Return an attribute set with entity IDs as keys and a list of + # entity names with corresponding ID as value. An ID is present in + # the result only if more than one entity has it. The argument + # entities is a list of AttrSet of one id/name pair. + findDuplicateIds = + entities: lib.filterAttrs (_entityId: entityNames: length entityNames != 1) (lib.zipAttrs entities); - duplicates = findDuplicateIds (mapAttrsToList - (entityName: entity: { "${toString entity.id}" = entityName; }) - entities); + duplicates = findDuplicateIds ( + mapAttrsToList (entityName: entity: { "${toString entity.id}" = entityName; }) entities + ); - mkMsg = entityId: entityNames: - " - ID ${entityId} is used by " + concatStringsSep ", " entityNames; - in { - assertion = duplicates == { }; - message = '' - Must not have a ${appName} ${entityKind} with an existing ID but - '' + concatStringsSep "\n" (mapAttrsToList mkMsg duplicates); - }); + mkMsg = entityId: entityNames: " - ID ${entityId} is used by " + concatStringsSep ", " entityNames; + in + { + assertion = duplicates == { }; + message = + '' + Must not have a ${appName} ${entityKind} with an existing ID but + '' + + concatStringsSep "\n" (mapAttrsToList mkMsg duplicates); + } + ); - wrapPackage = package: + wrapPackage = + package: let # The configuration expected by the Firefox wrapper. - fcfg = { enableGnomeExtensions = cfg.enableGnomeExtensions; }; + fcfg = { + enableGnomeExtensions = cfg.enableGnomeExtensions; + }; # A bit of hackery to force a config into the wrapper. - browserName = - package.browserName or (builtins.parseDrvName package.name).name; + browserName = package.browserName or (builtins.parseDrvName package.name).name; # The configuration expected by the Firefox wrapper builder. bcfg = setAttrByPath [ browserName ] fcfg; - in if package == null then + in + if package == null then null else if isDarwin then package @@ -164,18 +202,16 @@ let (pkgs.wrapFirefox.override { config = bcfg; }) package { }; bookmarkTypes = import ./profiles/bookmark-types.nix { inherit lib; }; -in { +in +{ options = setAttrByPath modulePath { enable = mkOption { type = types.bool; default = false; example = true; description = '' - Whether to enable ${appName}.${ - optionalString (description != null) " ${description}" - } - ${optionalString (!visible) - "See `${moduleName}` for more configuration options."} + Whether to enable ${appName}.${optionalString (description != null) " ${description}"} + ${optionalString (!visible) "See `${moduleName}` for more configuration options."} ''; }; @@ -212,7 +248,10 @@ in { `https://releases.mozilla.org/pub/firefox/releases/''${version}/linux-x86_64/xpi/`, replacing `''${version}` with the version of ${appName} you have. ''; - example = [ "en-GB" "de" ]; + example = [ + "en-GB" + "de" + ]; }; name = mkOption { @@ -235,15 +274,13 @@ in { type = with types; nullOr str; default = null; example = ".mozilla"; - description = - "Directory containing the native messaging hosts directory."; + description = "Directory containing the native messaging hosts directory."; }; configPath = mkOption { internal = true; type = types.str; - default = with platforms; - if isDarwin then darwin.configPath else linux.configPath; + default = with platforms; if isDarwin then darwin.configPath else linux.configPath; example = ".mozilla/firefox"; description = "Directory containing the ${appName} configuration files."; }; @@ -269,8 +306,7 @@ in { inherit visible; type = types.attrsOf jsonFormat.type; default = { }; - description = - "[See list of policies](https://mozilla.github.io/policy-templates/)."; + description = "[See list of policies](https://mozilla.github.io/policy-templates/)."; example = { DefaultDownloadDirectory = "\${home}/Downloads"; BlockAboutConfig = true; @@ -286,389 +322,450 @@ in { profiles = mkOption { inherit visible; - type = types.attrsOf (types.submodule ({ config, name, ... }: { - imports = [ (pkgs.path + "/nixos/modules/misc/assertions.nix") ]; + type = types.attrsOf ( + types.submodule ( + { config, name, ... }: + { + imports = [ (pkgs.path + "/nixos/modules/misc/assertions.nix") ]; - options = { - name = mkOption { - type = types.str; - default = name; - description = "Profile name."; - }; + options = { + name = mkOption { + type = types.str; + default = name; + description = "Profile name."; + }; - id = mkOption { - type = types.ints.unsigned; - default = 0; - description = '' - Profile ID. This should be set to a unique number per profile. - ''; - }; + id = mkOption { + type = types.ints.unsigned; + default = 0; + description = '' + Profile ID. This should be set to a unique number per profile. + ''; + }; - preConfig = mkOption { - type = types.lines; - default = ""; - description = '' - Extra preferences to add to {file}`user.js`, before - [](#opt-programs.firefox.profiles._name_.settings). + preConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra preferences to add to {file}`user.js`, before + [](#opt-programs.firefox.profiles._name_.settings). - Use [](#opt-programs.firefox.profiles._name_.extraConfig), unless - you want to overwrite in - [](#opt-programs.firefox.profiles._name_.settings), then use this - option. - ''; - }; + Use [](#opt-programs.firefox.profiles._name_.extraConfig), unless + you want to overwrite in + [](#opt-programs.firefox.profiles._name_.settings), then use this + option. + ''; + }; - settings = mkOption { - type = types.attrsOf (jsonFormat.type // { - description = - "${appName} preference (int, bool, string, and also attrs, list, float as a JSON string)"; - }); - default = { }; - example = literalExpression '' - { - "browser.startup.homepage" = "https://nixos.org"; - "browser.search.region" = "GB"; - "browser.search.isUS" = false; - "distribution.searchplugins.defaultLocale" = "en-GB"; - "general.useragent.locale" = "en-GB"; - "browser.bookmarks.showMobileBookmarks" = true; - "browser.newtabpage.pinned" = [{ - title = "NixOS"; - url = "https://nixos.org"; - }]; - } - ''; - description = '' - Attribute set of ${appName} preferences. + settings = mkOption { + type = types.attrsOf ( + jsonFormat.type + // { + description = "${appName} preference (int, bool, string, and also attrs, list, float as a JSON string)"; + } + ); + default = { }; + example = literalExpression '' + { + "browser.startup.homepage" = "https://nixos.org"; + "browser.search.region" = "GB"; + "browser.search.isUS" = false; + "distribution.searchplugins.defaultLocale" = "en-GB"; + "general.useragent.locale" = "en-GB"; + "browser.bookmarks.showMobileBookmarks" = true; + "browser.newtabpage.pinned" = [{ + title = "NixOS"; + url = "https://nixos.org"; + }]; + } + ''; + description = '' + Attribute set of ${appName} preferences. - ${appName} only supports int, bool, and string types for - preferences, but home-manager will automatically - convert all other JSON-compatible values into strings. - ''; - }; + ${appName} only supports int, bool, and string types for + preferences, but home-manager will automatically + convert all other JSON-compatible values into strings. + ''; + }; - extraConfig = mkOption { - type = types.lines; - default = ""; - description = '' - Extra preferences to add to {file}`user.js`. - ''; - }; + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra preferences to add to {file}`user.js`. + ''; + }; - userChrome = mkOption { - type = types.oneOf [ types.lines types.path ]; - default = ""; - description = "Custom ${appName} user chrome CSS."; - example = '' - /* Hide tab bar in FF Quantum */ - @-moz-document url(chrome://browser/content/browser.xul), url(chrome://browser/content/browser.xhtml) { - #TabsToolbar { - visibility: collapse !important; - margin-bottom: 21px !important; - } + userChrome = mkOption { + type = types.oneOf [ + types.lines + types.path + ]; + default = ""; + description = "Custom ${appName} user chrome CSS."; + example = '' + /* Hide tab bar in FF Quantum */ + @-moz-document url(chrome://browser/content/browser.xul), url(chrome://browser/content/browser.xhtml) { + #TabsToolbar { + visibility: collapse !important; + margin-bottom: 21px !important; + } - #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { - visibility: collapse !important; - } - } - ''; - }; + #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { + visibility: collapse !important; + } + } + ''; + }; - userContent = mkOption { - type = types.oneOf [ types.lines types.path ]; - default = ""; - description = "Custom ${appName} user content CSS."; - example = '' - /* Hide scrollbar in FF Quantum */ - *{scrollbar-width:none !important} - ''; - }; + userContent = mkOption { + type = types.oneOf [ + types.lines + types.path + ]; + default = ""; + description = "Custom ${appName} user content CSS."; + example = '' + /* Hide scrollbar in FF Quantum */ + *{scrollbar-width:none !important} + ''; + }; - bookmarks = mkOption { - type = (types.coercedTo bookmarkTypes.settingsType (bookmarks: - if bookmarks != { } then - lib.warn '' - ${cfg.name} bookmarks have been refactored into a submodule that now explicitly require a 'force' option to be enabled. + bookmarks = mkOption { + type = ( + types.coercedTo bookmarkTypes.settingsType + ( + bookmarks: + if bookmarks != { } then + lib.warn + '' + ${cfg.name} bookmarks have been refactored into a submodule that now explicitly require a 'force' option to be enabled. - Replace: + Replace: - ${moduleName}.profiles.${name}.bookmarks = [ ... ]; + ${moduleName}.profiles.${name}.bookmarks = [ ... ]; - With: + With: - ${moduleName}.profiles.${name}.bookmarks = { - force = true; - settings = [ ... ]; + ${moduleName}.profiles.${name}.bookmarks = { + force = true; + settings = [ ... ]; + }; + '' + { + force = true; + settings = bookmarks; + } + else + { } + ) + ( + types.submodule ( + { config, ... }: + import ./profiles/bookmarks.nix { + inherit config lib pkgs; + modulePath = modulePath ++ [ + "profiles" + name + "bookmarks" + ]; + } + ) + ) + ); + default = { }; + internal = !enableBookmarks; + description = "Declarative bookmarks."; + }; + + path = mkOption { + type = types.str; + default = name; + description = "Profile path."; + }; + + isDefault = mkOption { + type = types.bool; + default = config.id == 0; + defaultText = "true if profile ID is 0"; + description = "Whether this is a default profile."; + }; + + search = mkOption { + type = types.submodule ( + args: + import ./profiles/search.nix { + inherit (args) config; + inherit lib pkgs appName; + package = cfg.finalPackage; + modulePath = modulePath ++ [ + "profiles" + name + "search" + ]; + profilePath = config.path; + } + ); + default = { }; + description = "Declarative search engine configuration."; + }; + + containersForce = mkOption { + type = types.bool; + default = false; + description = '' + Whether to force replace the existing containers configuration. + This is recommended since ${appName} will replace the symlink on + every launch, but note that you'll lose any existing configuration + by enabling this. + ''; + }; + + containers = mkOption { + type = types.attrsOf ( + types.submodule ( + { name, ... }: + { + options = { + name = mkOption { + type = types.str; + default = name; + description = "Container name, e.g., shopping."; + }; + + id = mkOption { + type = types.ints.unsigned; + default = 0; + description = '' + Container ID. This should be set to a unique number per container in this profile. + ''; + }; + + # List of colors at + # https://searchfox.org/mozilla-central/rev/5ad226c7379b0564c76dc3b54b44985356f94c5a/toolkit/components/extensions/parent/ext-contextualIdentities.js#32 + color = mkOption { + type = types.enum [ + "blue" + "turquoise" + "green" + "yellow" + "orange" + "red" + "pink" + "purple" + "toolbar" + ]; + default = "pink"; + description = "Container color."; + }; + + icon = mkOption { + type = types.enum [ + "briefcase" + "cart" + "circle" + "dollar" + "fence" + "fingerprint" + "gift" + "vacation" + "food" + "fruit" + "pet" + "tree" + "chill" + ]; + default = "fruit"; + description = "Container icon."; + }; + }; + } + ) + ); + default = { }; + example = { + "shopping" = { + id = 1; + color = "blue"; + icon = "cart"; + }; + "dangerous" = { + id = 2; + color = "red"; + icon = "fruit"; }; - '' { - force = true; - settings = bookmarks; - } - else - { }) (types.submodule ({ config, ... }: - import ./profiles/bookmarks.nix { - inherit config lib pkgs; - modulePath = modulePath ++ [ "profiles" name "bookmarks" ]; - }))); - default = { }; - internal = !enableBookmarks; - description = "Declarative bookmarks."; - }; - - path = mkOption { - type = types.str; - default = name; - description = "Profile path."; - }; - - isDefault = mkOption { - type = types.bool; - default = config.id == 0; - defaultText = "true if profile ID is 0"; - description = "Whether this is a default profile."; - }; - - search = mkOption { - type = types.submodule (args: - import ./profiles/search.nix { - inherit (args) config; - inherit lib pkgs appName; - package = cfg.finalPackage; - modulePath = modulePath ++ [ "profiles" name "search" ]; - profilePath = config.path; - }); - default = { }; - description = "Declarative search engine configuration."; - }; - - containersForce = mkOption { - type = types.bool; - default = false; - description = '' - Whether to force replace the existing containers configuration. - This is recommended since ${appName} will replace the symlink on - every launch, but note that you'll lose any existing configuration - by enabling this. - ''; - }; - - containers = mkOption { - type = types.attrsOf (types.submodule ({ name, ... }: { - options = { - name = mkOption { - type = types.str; - default = name; - description = "Container name, e.g., shopping."; - }; - - id = mkOption { - type = types.ints.unsigned; - default = 0; - description = '' - Container ID. This should be set to a unique number per container in this profile. - ''; - }; - - # List of colors at - # https://searchfox.org/mozilla-central/rev/5ad226c7379b0564c76dc3b54b44985356f94c5a/toolkit/components/extensions/parent/ext-contextualIdentities.js#32 - color = mkOption { - type = types.enum [ - "blue" - "turquoise" - "green" - "yellow" - "orange" - "red" - "pink" - "purple" - "toolbar" - ]; - default = "pink"; - description = "Container color."; - }; - - icon = mkOption { - type = types.enum [ - "briefcase" - "cart" - "circle" - "dollar" - "fence" - "fingerprint" - "gift" - "vacation" - "food" - "fruit" - "pet" - "tree" - "chill" - ]; - default = "fruit"; - description = "Container icon."; }; + description = '' + Attribute set of container configurations. See + [Multi-Account + Containers](https://support.mozilla.org/en-US/kb/containers) + for more information. + ''; }; - })); - default = { }; - example = { - "shopping" = { - id = 1; - color = "blue"; - icon = "cart"; - }; - "dangerous" = { - id = 2; - color = "red"; - icon = "fruit"; + extensions = mkOption { + type = + types.coercedTo (types.listOf types.package) + (packages: { + packages = mkIf (builtins.length packages > 0) ( + lib.warn '' + In order to support declarative extension configuration, + extension installation has been moved from + ${moduleName}.profiles..extensions + to + ${moduleName}.profiles..extensions.packages + '' packages + ); + }) + ( + types.submodule { + options = { + packages = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExpression '' + with pkgs.nur.repos.rycee.firefox-addons; [ + privacy-badger + ] + ''; + description = '' + List of ${name} add-on packages to install for this profile. + Some pre-packaged add-ons are accessible from the Nix User Repository. + Once you have NUR installed run + + ```console + $ nix-env -f '' -qaP -A nur.repos.rycee.firefox-addons + ``` + + to list the available ${name} add-ons. + + Note that it is necessary to manually enable these extensions + inside ${name} after the first installation. + + To automatically enable extensions add + `"extensions.autoDisableScopes" = 0;` + to + [{option}`${moduleName}.profiles..settings`](#opt-${moduleName}.profiles._name_.settings) + ''; + }; + + force = mkOption { + description = '' + Whether to override all previous firefox settings. + + This is required when using `settings`. + ''; + default = false; + example = true; + type = types.bool; + }; + + settings = mkOption { + default = { }; + example = literalExpression '' + { + # Example with uBlock origin's extensionID + "uBlock0@raymondhill.net".settings = { + selectedFilterLists = [ + "ublock-filters" + "ublock-badware" + "ublock-privacy" + "ublock-unbreak" + "ublock-quick-fixes" + ]; + }; + + # Example with Stylus' UUID-form extensionID + "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}".settings = { + dbInChromeStorage = true; # required for Stylus + } + } + ''; + description = '' + Attribute set of options for each extension. + The keys of the attribute set consist of the ID of the extension + or its UUID wrapped in curly braces. + ''; + type = types.attrsOf ( + types.submodule { + options = { + settings = mkOption { + type = types.attrsOf jsonFormat.type; + description = "Json formatted options for the specified extensionID"; + }; + force = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Forcibly override any existing configuration for + this extension. + ''; + }; + }; + } + ); + }; + }; + } + ); + default = { }; + description = '' + Submodule for installing and configuring extensions. + ''; + example = literalExpression '' + { + packages = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + ]; + settings."uBlock0@raymondhill.net".settings = { + selectedFilterLists = [ + "ublock-filters" + "ublock-badware" + "ublock-privacy" + "ublock-unbreak" + "ublock-quick-fixes" + ]; + }; + } + ''; }; }; - description = '' - Attribute set of container configurations. See - [Multi-Account - Containers](https://support.mozilla.org/en-US/kb/containers) - for more information. - ''; - }; - extensions = mkOption { - type = types.coercedTo (types.listOf types.package) (packages: { - packages = mkIf (builtins.length packages > 0) (lib.warn '' - In order to support declarative extension configuration, - extension installation has been moved from - ${moduleName}.profiles..extensions - to - ${moduleName}.profiles..extensions.packages - '' packages); - }) (types.submodule { - options = { - packages = mkOption { - type = types.listOf types.package; - default = [ ]; - example = literalExpression '' - with pkgs.nur.repos.rycee.firefox-addons; [ - privacy-badger - ] + + config = { + assertions = [ + (mkNoDuplicateAssertion config.containers "container") + { + assertion = config.extensions.settings == { } || config.extensions.force; + message = '' + Using '${ + lib.showAttrPath ( + modulePath + ++ [ + "profiles" + config.name + "extensions" + "settings" + ] + ) + }' will override all previous extensions settings. + Enable '${ + lib.showAttrPath ( + modulePath + ++ [ + "profiles" + config.name + "extensions" + "force" + ] + ) + }' to acknowledge this. ''; - description = '' - List of ${name} add-on packages to install for this profile. - Some pre-packaged add-ons are accessible from the Nix User Repository. - Once you have NUR installed run - - ```console - $ nix-env -f '' -qaP -A nur.repos.rycee.firefox-addons - ``` - - to list the available ${name} add-ons. - - Note that it is necessary to manually enable these extensions - inside ${name} after the first installation. - - To automatically enable extensions add - `"extensions.autoDisableScopes" = 0;` - to - [{option}`${moduleName}.profiles..settings`](#opt-${moduleName}.profiles._name_.settings) - ''; - }; - - force = mkOption { - description = '' - Whether to override all previous firefox settings. - - This is required when using `settings`. - ''; - default = false; - example = true; - type = types.bool; - }; - - settings = mkOption { - default = { }; - example = literalExpression '' - { - # Example with uBlock origin's extensionID - "uBlock0@raymondhill.net".settings = { - selectedFilterLists = [ - "ublock-filters" - "ublock-badware" - "ublock-privacy" - "ublock-unbreak" - "ublock-quick-fixes" - ]; - }; - - # Example with Stylus' UUID-form extensionID - "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}".settings = { - dbInChromeStorage = true; # required for Stylus - } - } - ''; - description = '' - Attribute set of options for each extension. - The keys of the attribute set consist of the ID of the extension - or its UUID wrapped in curly braces. - ''; - type = types.attrsOf (types.submodule { - options = { - settings = mkOption { - type = types.attrsOf jsonFormat.type; - description = - "Json formatted options for the specified extensionID"; - }; - force = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Forcibly override any existing configuration for - this extension. - ''; - }; - }; - }); - }; - }; - }); - default = { }; - description = '' - Submodule for installing and configuring extensions. - ''; - example = literalExpression '' - { - packages = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - ]; - settings."uBlock0@raymondhill.net".settings = { - selectedFilterLists = [ - "ublock-filters" - "ublock-badware" - "ublock-privacy" - "ublock-unbreak" - "ublock-quick-fixes" - ]; - }; - } - ''; - }; - }; - - config = { - assertions = [ - (mkNoDuplicateAssertion config.containers "container") - { - assertion = config.extensions.settings == { } - || config.extensions.force; - message = '' - Using '${ - lib.showAttrPath (modulePath - ++ [ "profiles" config.name "extensions" "settings" ]) - }' will override all previous extensions settings. - Enable '${ - lib.showAttrPath (modulePath - ++ [ "profiles" config.name "extensions" "force" ]) - }' to acknowledge this. - ''; - } - ] ++ config.bookmarks.assertions; - }; - })); + } + ] ++ config.bookmarks.assertions; + }; + } + ) + ); default = { }; description = "Attribute set of ${appName} profiles."; }; @@ -694,137 +791,171 @@ in { }; }; - config = mkIf cfg.enable ({ - assertions = [ - (lib.hm.assertions.assertPlatform moduleName pkgs supportedPlatforms) + config = mkIf cfg.enable ( + { + assertions = [ + (lib.hm.assertions.assertPlatform moduleName pkgs supportedPlatforms) - (let - defaults = lib.catAttrs "name" - (lib.filter (a: a.isDefault) (attrValues cfg.profiles)); - in { - assertion = cfg.profiles == { } || length defaults == 1; - message = "Must have exactly one default ${appName} profile but found " - + toString (length defaults) + optionalString (length defaults > 1) - (", namely " + concatStringsSep ", " defaults); - }) + ( + let + defaults = lib.catAttrs "name" (lib.filter (a: a.isDefault) (attrValues cfg.profiles)); + in + { + assertion = cfg.profiles == { } || length defaults == 1; + message = + "Must have exactly one default ${appName} profile but found " + + toString (length defaults) + + optionalString (length defaults > 1) (", namely " + concatStringsSep ", " defaults); + } + ) - (let - getContainers = profiles: - lib.flatten - (mapAttrsToList (_: value: (attrValues value.containers)) profiles); + ( + let + getContainers = + profiles: lib.flatten (mapAttrsToList (_: value: (attrValues value.containers)) profiles); - findInvalidContainerIds = profiles: - lib.filter (container: container.id >= 4294967294) - (getContainers profiles); - in { - assertion = cfg.profiles == { } - || length (findInvalidContainerIds cfg.profiles) == 0; - message = "Container id must be smaller than 4294967294 (2^32 - 2)"; - }) + findInvalidContainerIds = + profiles: lib.filter (container: container.id >= 4294967294) (getContainers profiles); + in + { + assertion = cfg.profiles == { } || length (findInvalidContainerIds cfg.profiles) == 0; + message = "Container id must be smaller than 4294967294 (2^32 - 2)"; + } + ) - { - assertion = cfg.languagePacks == [ ] || cfg.package != null; - message = '' - '${moduleName}.languagePacks' requires '${moduleName}.package' - to be set to a non-null value. + { + assertion = cfg.languagePacks == [ ] || cfg.package != null; + message = '' + '${moduleName}.languagePacks' requires '${moduleName}.package' + to be set to a non-null value. + ''; + } + + (mkNoDuplicateAssertion cfg.profiles "profile") + ] ++ (lib.concatMap (profile: profile.assertions) (attrValues cfg.profiles)); + + warnings = + optional (cfg.enableGnomeExtensions or false) '' + Using '${moduleName}.enableGnomeExtensions' has been deprecated and + will be removed in the future. Please change to overriding the package + configuration using '${moduleName}.package' instead. You can refer to + its example for how to do this. + '' + ++ optional (cfg.vendorPath != null) '' + Using '${moduleName}.vendorPath' has been deprecated and + will be removed in the future. Native messaging hosts will function normally without specifying this path. ''; - } - (mkNoDuplicateAssertion cfg.profiles "profile") - ] ++ (lib.concatMap (profile: profile.assertions) - (attrValues cfg.profiles)); + home.packages = lib.optional (cfg.finalPackage != null) cfg.finalPackage; - warnings = optional (cfg.enableGnomeExtensions or false) '' - Using '${moduleName}.enableGnomeExtensions' has been deprecated and - will be removed in the future. Please change to overriding the package - configuration using '${moduleName}.package' instead. You can refer to - its example for how to do this. - '' ++ optional (cfg.vendorPath != null) '' - Using '${moduleName}.vendorPath' has been deprecated and - will be removed in the future. Native messaging hosts will function normally without specifying this path. - ''; + mozilla.firefoxNativeMessagingHosts = + cfg.nativeMessagingHosts + # package configured native messaging hosts (entire browser actually) + ++ (lib.optional (cfg.finalPackage != null) cfg.finalPackage); - home.packages = lib.optional (cfg.finalPackage != null) cfg.finalPackage; - - mozilla.firefoxNativeMessagingHosts = cfg.nativeMessagingHosts - # package configured native messaging hosts (entire browser actually) - ++ (lib.optional (cfg.finalPackage != null) cfg.finalPackage); - - home.file = mkMerge ([{ - "${cfg.configPath}/profiles.ini" = - mkIf (cfg.profiles != { }) { text = profilesIni; }; - }] ++ lib.flip mapAttrsToList cfg.profiles (_: profile: - # Merge the regular profile settings with extension settings - mkMerge ([{ - "${profilesPath}/${profile.path}/.keep".text = ""; - - "${profilesPath}/${profile.path}/chrome/userChrome.css" = - mkIf (profile.userChrome != "") (let - key = - if builtins.isString profile.userChrome then "text" else "source"; - in { "${key}" = profile.userChrome; }); - - "${profilesPath}/${profile.path}/chrome/userContent.css" = - mkIf (profile.userContent != "") (let - key = if builtins.isString profile.userContent then - "text" - else - "source"; - in { "${key}" = profile.userContent; }); - - "${profilesPath}/${profile.path}/user.js" = mkIf (profile.preConfig - != "" || profile.settings != { } || profile.extraConfig != "" - || profile.bookmarks.configFile != null) { - text = - mkUserJs profile.preConfig profile.settings profile.extraConfig - profile.bookmarks.configFile profile.extensions.settings; - }; - - "${profilesPath}/${profile.path}/containers.json" = - mkIf (profile.containers != { }) { - text = mkContainersJson profile.containers; - force = profile.containersForce; - }; - - "${profilesPath}/${profile.path}/search.json.mozlz4" = - mkIf (profile.search.enable) { - enable = profile.search.enable; - force = profile.search.force; - source = profile.search.file; - }; - - "${profilesPath}/${profile.path}/extensions" = - mkIf (profile.extensions.packages != [ ]) { - source = let - extensionsEnvPkg = pkgs.buildEnv { - name = "hm-firefox-extensions"; - paths = profile.extensions.packages; - }; - in "${extensionsEnvPkg}/share/mozilla/${extensionPath}"; - recursive = true; - force = true; - }; - }] ++ - # Add extension settings as separate attributes - optional (profile.extensions.settings != { }) (mkMerge (mapAttrsToList - (name: settingConfig: { - "${profilesPath}/${profile.path}/browser-extension-data/${name}/storage.js" = + home.file = mkMerge ( + [ + { + "${cfg.configPath}/profiles.ini" = mkIf (cfg.profiles != { }) { text = profilesIni; }; + } + ] + ++ lib.flip mapAttrsToList cfg.profiles ( + _: profile: + # Merge the regular profile settings with extension settings + mkMerge ( + [ { - force = settingConfig.force || profile.extensions.force; - text = lib.generators.toJSON { } settingConfig.settings; - }; - }) profile.extensions.settings))))); - } // setAttrByPath modulePath { - finalPackage = wrapPackage cfg.package; + "${profilesPath}/${profile.path}/.keep".text = ""; - policies = { - ExtensionSettings = lib.mkIf (cfg.languagePacks != [ ]) (lib.listToAttrs - (map (lang: - lib.nameValuePair "langpack-${lang}@firefox.mozilla.org" { - installation_mode = "normal_installed"; - install_url = - "https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/${lang}.xpi"; - }) cfg.languagePacks)); - }; - }); + "${profilesPath}/${profile.path}/chrome/userChrome.css" = mkIf (profile.userChrome != "") ( + let + key = if builtins.isString profile.userChrome then "text" else "source"; + in + { + "${key}" = profile.userChrome; + } + ); + + "${profilesPath}/${profile.path}/chrome/userContent.css" = mkIf (profile.userContent != "") ( + let + key = if builtins.isString profile.userContent then "text" else "source"; + in + { + "${key}" = profile.userContent; + } + ); + + "${profilesPath}/${profile.path}/user.js" = + mkIf + ( + profile.preConfig != "" + || profile.settings != { } + || profile.extraConfig != "" + || profile.bookmarks.configFile != null + ) + { + text = + mkUserJs profile.preConfig profile.settings profile.extraConfig profile.bookmarks.configFile + profile.extensions.settings; + }; + + "${profilesPath}/${profile.path}/containers.json" = mkIf (profile.containers != { }) { + text = mkContainersJson profile.containers; + force = profile.containersForce; + }; + + "${profilesPath}/${profile.path}/search.json.mozlz4" = mkIf (profile.search.enable) { + enable = profile.search.enable; + force = profile.search.force; + source = profile.search.file; + }; + + "${profilesPath}/${profile.path}/extensions" = mkIf (profile.extensions.packages != [ ]) { + source = + let + extensionsEnvPkg = pkgs.buildEnv { + name = "hm-firefox-extensions"; + paths = profile.extensions.packages; + }; + in + "${extensionsEnvPkg}/share/mozilla/${extensionPath}"; + recursive = true; + force = true; + }; + } + ] + ++ + # Add extension settings as separate attributes + optional (profile.extensions.settings != { }) ( + mkMerge ( + mapAttrsToList (name: settingConfig: { + "${profilesPath}/${profile.path}/browser-extension-data/${name}/storage.js" = { + force = settingConfig.force || profile.extensions.force; + text = lib.generators.toJSON { } settingConfig.settings; + }; + }) profile.extensions.settings + ) + ) + ) + ) + ); + } + // setAttrByPath modulePath { + finalPackage = wrapPackage cfg.package; + + policies = { + ExtensionSettings = lib.mkIf (cfg.languagePacks != [ ]) ( + lib.listToAttrs ( + map ( + lang: + lib.nameValuePair "langpack-${lang}@firefox.mozilla.org" { + installation_mode = "normal_installed"; + install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/${lang}.xpi"; + } + ) cfg.languagePacks + ) + ); + }; + } + ); } diff --git a/modules/programs/firefox/profiles/bookmark-types.nix b/modules/programs/firefox/profiles/bookmark-types.nix index 64b1032be..43eca5661 100644 --- a/modules/programs/firefox/profiles/bookmark-types.nix +++ b/modules/programs/firefox/profiles/bookmark-types.nix @@ -5,71 +5,83 @@ let inherit (builtins) attrValues; inherit (lib) types mkOption; -in rec { - settingsType = with types; +in +rec { + settingsType = + with types; coercedTo (addCheck (attrsOf nodeType) - # Check whether attribute set is of correct type - (attrs: !(attrs ? settings) || nodeType.check attrs.settings)) attrValues - (listOf nodeType); + # Check whether attribute set is of correct type + (attrs: !(attrs ? settings) || nodeType.check attrs.settings) + ) attrValues (listOf nodeType); - bookmarkSubmodule = types.submodule ({ name, ... }: { - options = { - name = mkOption { - type = types.str; - default = name; - description = "Bookmark name."; - }; + bookmarkSubmodule = + types.submodule ( + { name, ... }: + { + options = { + name = mkOption { + type = types.str; + default = name; + description = "Bookmark name."; + }; - tags = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "Bookmark tags."; - }; + tags = mkOption { + type = types.listOf types.str; + default = [ ]; + description = "Bookmark tags."; + }; - keyword = mkOption { - type = types.nullOr types.str; - default = null; - description = "Bookmark search keyword."; - }; + keyword = mkOption { + type = types.nullOr types.str; + default = null; + description = "Bookmark search keyword."; + }; - url = mkOption { - type = types.str; - description = "Bookmark url, use %s for search terms."; - }; + url = mkOption { + type = types.str; + description = "Bookmark url, use %s for search terms."; + }; + }; + } + ) + // { + description = "bookmark submodule"; }; - }) // { - description = "bookmark submodule"; - }; bookmarkType = types.addCheck bookmarkSubmodule (x: x ? "url"); - directoryType = types.submodule ({ name, ... }: { - options = { - name = mkOption { - type = types.str; - default = name; - description = "Directory name."; - }; + directoryType = + types.submodule ( + { name, ... }: + { + options = { + name = mkOption { + type = types.str; + default = name; + description = "Directory name."; + }; - bookmarks = mkOption { - type = types.listOf nodeType; - default = [ ]; - description = "Bookmarks within directory."; - }; + bookmarks = mkOption { + type = types.listOf nodeType; + default = [ ]; + description = "Bookmarks within directory."; + }; - toolbar = mkOption { - type = types.bool; - default = false; - description = '' - Make this the toolbar directory. Note, this does _not_ - mean that this directory will be added to the toolbar, - this directory _is_ the toolbar. - ''; - }; + toolbar = mkOption { + type = types.bool; + default = false; + description = '' + Make this the toolbar directory. Note, this does _not_ + mean that this directory will be added to the toolbar, + this directory _is_ the toolbar. + ''; + }; + }; + } + ) + // { + description = "directory submodule"; }; - }) // { - description = "directory submodule"; - }; nodeType = types.either bookmarkType directoryType; } diff --git a/modules/programs/firefox/profiles/bookmarks.nix b/modules/programs/firefox/profiles/bookmarks.nix index bfdd43716..a0cfafa72 100644 --- a/modules/programs/firefox/profiles/bookmarks.nix +++ b/modules/programs/firefox/profiles/bookmarks.nix @@ -1,35 +1,43 @@ -{ config, lib, pkgs, modulePath }: +{ + config, + lib, + pkgs, + modulePath, +}: let inherit (lib) - escapeXML concatStringsSep mkOption maintainers types literalExpression; + escapeXML + concatStringsSep + mkOption + maintainers + types + literalExpression + ; inherit (bookmarkTypes) settingsType; bookmarkTypes = import ./bookmark-types.nix { inherit lib; }; - bookmarksFile = bookmarks: + bookmarksFile = + bookmarks: let - indent = level: - lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level)); + indent = level: lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level)); - bookmarkToHTML = indentLevel: bookmark: - '' - ${indent indentLevel}
${escapeXML bookmark.name}''; + bookmarkToHTML = + indentLevel: bookmark: + ''${indent indentLevel}
${escapeXML bookmark.name}''; directoryToHTML = indentLevel: directory: '' ${indent indentLevel}
${ if directory.toolbar then - '' -

Bookmarks Toolbar'' + ''

Bookmarks Toolbar'' else ''

${escapeXML directory.name}'' }

@@ -37,18 +45,16 @@ let ${allItemsToHTML (indentLevel + 1) directory.bookmarks} ${indent indentLevel}

''; - itemToHTMLOrRecurse = indentLevel: item: - if item ? "url" then - bookmarkToHTML indentLevel item - else - directoryToHTML indentLevel item; + itemToHTMLOrRecurse = + indentLevel: item: + if item ? "url" then bookmarkToHTML indentLevel item else directoryToHTML indentLevel item; - allItemsToHTML = indentLevel: bookmarks: - lib.concatStringsSep "\n" - (map (itemToHTMLOrRecurse indentLevel) bookmarks); + allItemsToHTML = + indentLevel: bookmarks: lib.concatStringsSep "\n" (map (itemToHTMLOrRecurse indentLevel) bookmarks); bookmarkEntries = allItemsToHTML 1 bookmarks; - in pkgs.writeText "bookmarks.html" '' + in + pkgs.writeText "bookmarks.html" '' " - header = "Changelog" - trim = true - '' - } + ${builtins.toFile "expected.toml" '' + footer = "" + header = "Changelog" + trim = true + ''} ''; } diff --git a/tests/modules/programs/git-credential-oauth/basic.nix b/tests/modules/programs/git-credential-oauth/basic.nix index 2e82c8303..f1d35eb26 100644 --- a/tests/modules/programs/git-credential-oauth/basic.nix +++ b/tests/modules/programs/git-credential-oauth/basic.nix @@ -1,9 +1,13 @@ { config, ... }: { - programs.git-credential-oauth = { enable = true; }; + programs.git-credential-oauth = { + enable = true; + }; - programs.git = { enable = true; }; + programs.git = { + enable = true; + }; nmt.script = '' assertFileExists home-files/.config/git/config diff --git a/tests/modules/programs/git-credential-oauth/extra-flags.nix b/tests/modules/programs/git-credential-oauth/extra-flags.nix index e258512a7..0b72d7968 100644 --- a/tests/modules/programs/git-credential-oauth/extra-flags.nix +++ b/tests/modules/programs/git-credential-oauth/extra-flags.nix @@ -6,7 +6,9 @@ extraFlags = [ "-device" ]; }; - programs.git = { enable = true; }; + programs.git = { + enable = true; + }; nmt.script = '' assertFileExists home-files/.config/git/config diff --git a/tests/modules/programs/git-worktree-switcher/bash.nix b/tests/modules/programs/git-worktree-switcher/bash.nix index 0e0fb55e2..e3c663201 100644 --- a/tests/modules/programs/git-worktree-switcher/bash.nix +++ b/tests/modules/programs/git-worktree-switcher/bash.nix @@ -6,7 +6,9 @@ git-worktree-switcher.enable = true; }; - test.stubs.git-worktree-switcher = { name = "git-worktree-switcher"; }; + test.stubs.git-worktree-switcher = { + name = "git-worktree-switcher"; + }; nmt.script = '' assertFileExists home-files/.bashrc diff --git a/tests/modules/programs/git-worktree-switcher/fish.nix b/tests/modules/programs/git-worktree-switcher/fish.nix index 946cfa754..e25bfde50 100644 --- a/tests/modules/programs/git-worktree-switcher/fish.nix +++ b/tests/modules/programs/git-worktree-switcher/fish.nix @@ -4,7 +4,9 @@ git-worktree-switcher.enable = true; }; - test.stubs.git-worktree-switcher = { name = "git-worktree-switcher"; }; + test.stubs.git-worktree-switcher = { + name = "git-worktree-switcher"; + }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/git-worktree-switcher/zsh.nix b/tests/modules/programs/git-worktree-switcher/zsh.nix index 31028441d..0dd54a8f0 100644 --- a/tests/modules/programs/git-worktree-switcher/zsh.nix +++ b/tests/modules/programs/git-worktree-switcher/zsh.nix @@ -4,7 +4,9 @@ git-worktree-switcher.enable = true; }; - test.stubs.git-worktree-switcher = { name = "git-worktree-switcher"; }; + test.stubs.git-worktree-switcher = { + name = "git-worktree-switcher"; + }; nmt.script = '' assertFileExists home-files/.zshrc diff --git a/tests/modules/programs/git/git-with-email.nix b/tests/modules/programs/git/git-with-email.nix index db6053a53..3d902cfa4 100644 --- a/tests/modules/programs/git/git-with-email.nix +++ b/tests/modules/programs/git/git-with-email.nix @@ -3,8 +3,7 @@ { imports = [ ../../accounts/email-test-accounts.nix ]; - accounts.email.accounts.hm-account.smtp.tls.certificatesFile = - "/etc/test/certificates.crt"; + accounts.email.accounts.hm-account.smtp.tls.certificatesFile = "/etc/test/certificates.crt"; programs.git = { enable = true; @@ -26,9 +25,7 @@ } assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-with-email-expected.conf - } + 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 6dcf15e21..58fffe61a 100644 --- a/tests/modules/programs/git/git-with-hooks.nix +++ b/tests/modules/programs/git/git-with-hooks.nix @@ -3,7 +3,9 @@ { programs.git = { enable = true; - hooks = { pre-commit = ./git-pre-commit-hook.sh; }; + hooks = { + pre-commit = ./git-pre-commit-hook.sh; + }; }; nmt.script = '' diff --git a/tests/modules/programs/git/git-with-signing-key-id-legacy.nix b/tests/modules/programs/git/git-with-signing-key-id-legacy.nix index 36f092299..fcc03c7b0 100644 --- a/tests/modules/programs/git/git-with-signing-key-id-legacy.nix +++ b/tests/modules/programs/git/git-with-signing-key-id-legacy.nix @@ -1,4 +1,5 @@ -{ lib, options, ... }: { +{ lib, options, ... }: +{ config = { programs.git = { enable = true; @@ -13,16 +14,12 @@ }; test.asserts.warnings.expected = [ - "The option `programs.git.signing.gpgPath' defined in ${ - lib.showFiles options.programs.git.signing.gpgPath.files - } has been renamed to `programs.git.signing.signer'." + "The option `programs.git.signing.gpgPath' defined in ${lib.showFiles options.programs.git.signing.gpgPath.files} has been renamed to `programs.git.signing.signer'." ]; nmt.script = '' assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-with-signing-key-id-legacy-expected.conf - } + assertFileContent home-files/.config/git/config ${./git-with-signing-key-id-legacy-expected.conf} ''; }; } 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 a0aae8b53..53fd1cb28 100644 --- a/tests/modules/programs/git/git-with-signing-key-id.nix +++ b/tests/modules/programs/git/git-with-signing-key-id.nix @@ -7,16 +7,13 @@ signing = { signer = "path-to-ssh"; format = "ssh"; - key = - "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + key = "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; signByDefault = true; }; }; nmt.script = '' assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-with-signing-key-id-expected.conf - } + 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 90ed363b2..94264af73 100644 --- a/tests/modules/programs/git/git-with-str-extra-config.nix +++ b/tests/modules/programs/git/git-with-str-extra-config.nix @@ -9,11 +9,13 @@ 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. - '']; + 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 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 adc7995bf..bcb4b4c73 100644 --- a/tests/modules/programs/git/git-without-signing-key-id.nix +++ b/tests/modules/programs/git/git-without-signing-key-id.nix @@ -13,8 +13,6 @@ nmt.script = '' assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-without-signing-key-id-expected.conf - } + assertFileContent home-files/.config/git/config ${./git-without-signing-key-id-expected.conf} ''; } diff --git a/tests/modules/programs/git/git-without-signing.nix b/tests/modules/programs/git/git-without-signing.nix index 95a70b949..050a6fe43 100644 --- a/tests/modules/programs/git/git-without-signing.nix +++ b/tests/modules/programs/git/git-without-signing.nix @@ -9,8 +9,6 @@ nmt.script = '' assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - ./git-without-signing.conf - } + assertFileContent home-files/.config/git/config ${./git-without-signing.conf} ''; } diff --git a/tests/modules/programs/git/git.nix b/tests/modules/programs/git/git.nix index 2e436bc75..c36f5e1d4 100644 --- a/tests/modules/programs/git/git.nix +++ b/tests/modules/programs/git/git.nix @@ -9,16 +9,18 @@ let }; }; - substituteExpected = path: + substituteExpected = + path: pkgs.substituteAll { src = path; - git_include_path = pkgs.writeText "hm_gitconfig" - (builtins.readFile ./git-expected-include.conf); - git_named_include_path = pkgs.writeText "hm_gitconfigwork" - (builtins.readFile ./git-expected-include.conf); + git_include_path = pkgs.writeText "hm_gitconfig" (builtins.readFile ./git-expected-include.conf); + git_named_include_path = pkgs.writeText "hm_gitconfigwork" ( + builtins.readFile ./git-expected-include.conf + ); }; -in { +in +{ programs.git = lib.mkMerge [ { enable = true; @@ -34,7 +36,10 @@ in { multiple = [ 1 ]; }; }; - ignores = [ "*~" "*.swp" ]; + ignores = [ + "*~" + "*.swp" + ]; includes = [ { path = "~/path/to/config.inc"; } { @@ -86,8 +91,6 @@ in { nmt.script = '' assertFileExists home-files/.config/git/config - assertFileContent home-files/.config/git/config ${ - substituteExpected ./git-expected.conf - } + 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 b6f6c49f6..42a1118df 100644 --- a/tests/modules/programs/gnome-shell/gnome-shell.nix +++ b/tests/modules/programs/gnome-shell/gnome-shell.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let dummy-gnome-shell-extensions = pkgs.runCommand "dummy-package" { } '' mkdir -p $out/share/gnome-shell/extensions/dummy-package @@ -10,12 +15,15 @@ let touch $out/share/gnome-shell/extensions/test-extension/test ''; - test-extension-uuid = pkgs.runCommand "test-extension-uuid" { - passthru.extensionUuid = "test-extension-uuid"; - } '' - mkdir -p $out/share/gnome-shell/extensions/test-extension-uuid - touch $out/share/gnome-shell/extensions/test-extension-uuid/test - ''; + test-extension-uuid = + pkgs.runCommand "test-extension-uuid" + { + passthru.extensionUuid = "test-extension-uuid"; + } + '' + mkdir -p $out/share/gnome-shell/extensions/test-extension-uuid + touch $out/share/gnome-shell/extensions/test-extension-uuid/test + ''; test-theme = pkgs.runCommand "test-theme" { } '' mkdir -p $out/share/themes/Test/gnome-shell @@ -28,10 +36,12 @@ let "test-extension-uuid" ]; - actualEnabledExtensions = lib.catAttrs "value" - config.dconf.settings."org/gnome/shell".enabled-extensions.value; + actualEnabledExtensions = + lib.catAttrs "value" + config.dconf.settings."org/gnome/shell".enabled-extensions.value; -in { +in +{ nixpkgs.overlays = [ (final: prev: { gnome-shell-extensions = dummy-gnome-shell-extensions; }) ]; @@ -53,14 +63,11 @@ in { assertions = [ { - assertion = - config.dconf.settings."org/gnome/shell".disable-user-extensions - == false; + assertion = config.dconf.settings."org/gnome/shell".disable-user-extensions == false; message = "Expected disable-user-extensions to be false."; } { - assertion = lib.all (e: lib.elem e actualEnabledExtensions) - expectedEnabledExtensions; + assertion = lib.all (e: lib.elem e actualEnabledExtensions) expectedEnabledExtensions; message = '' Expected enabled-extensions to contain all of: ${toString expectedEnabledExtensions} @@ -69,9 +76,7 @@ in { ''; } { - assertion = - config.dconf.settings."org/gnome/shell/extensions/user-theme".name - == "Test"; + assertion = config.dconf.settings."org/gnome/shell/extensions/user-theme".name == "Test"; message = "Expected extensions/user-theme/name to be 'Test'."; } ]; diff --git a/tests/modules/programs/gnome-terminal/bad-profile-name.nix b/tests/modules/programs/gnome-terminal/bad-profile-name.nix index 91554909f..7c7b2265b 100644 --- a/tests/modules/programs/gnome-terminal/bad-profile-name.nix +++ b/tests/modules/programs/gnome-terminal/bad-profile-name.nix @@ -2,16 +2,22 @@ programs.gnome-terminal = { enable = true; profile = { - bad-name = { visibleName = "a"; }; + bad-name = { + visibleName = "a"; + }; "e0b782ed-6aca-44eb-8c75-62b3706b6220" = { default = true; visibleName = "b"; }; - another-bad-name = { visibleName = "c"; }; + another-bad-name = { + visibleName = "c"; + }; }; }; - test.asserts.assertions.expected = ['' - The attribute name of a Gnome Terminal profile must be a UUID. - Incorrect profile names: another-bad-name, bad-name'']; + 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/go/go-telemetry.nix b/tests/modules/programs/go/go-telemetry.nix index b5fda3d3a..64b27143b 100644 --- a/tests/modules/programs/go/go-telemetry.nix +++ b/tests/modules/programs/go/go-telemetry.nix @@ -9,15 +9,18 @@ }; }; - nm.script = let - modeFileDir = if !pkgs.stdenv.isDarwin then - ".config/go/telemetry" - else - "Library/Application Support/go/telemetry"; - in '' - assertFileExists "home-files/${modeFileDir}/mode" - assertFileContent \ - "home-files/${modeFileDir}/mode" \ - "on 2006-01-02" - ''; + nm.script = + let + modeFileDir = + if !pkgs.stdenv.isDarwin then + ".config/go/telemetry" + else + "Library/Application Support/go/telemetry"; + in + '' + assertFileExists "home-files/${modeFileDir}/mode" + assertFileContent \ + "home-files/${modeFileDir}/mode" \ + "on 2006-01-02" + ''; } diff --git a/tests/modules/programs/gpg/immutable-keyfiles.nix b/tests/modules/programs/gpg/immutable-keyfiles.nix index 34ef9f0fe..8591238a5 100644 --- a/tests/modules/programs/gpg/immutable-keyfiles.nix +++ b/tests/modules/programs/gpg/immutable-keyfiles.nix @@ -11,8 +11,7 @@ publicKeys = [ { source = realPkgs.fetchurl { - url = - "https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x44CF42371ADF842E12F116EAA9D3F98FCCF5460B"; + url = "https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x44CF42371ADF842E12F116EAA9D3F98FCCF5460B"; hash = "sha256-bSluCZh6ijwppigk8iF2BwWKZgq1WDbIjyYQRK772dM="; }; trust = 1; # "unknown" diff --git a/tests/modules/programs/gpg/override-defaults.nix b/tests/modules/programs/gpg/override-defaults.nix index 5e9275d83..0dc5d3dc6 100644 --- a/tests/modules/programs/gpg/override-defaults.nix +++ b/tests/modules/programs/gpg/override-defaults.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.gpg = { enable = true; @@ -7,7 +8,10 @@ no-comments = false; s2k-cipher-algo = "AES128"; throw-keyids = true; - trusted-key = [ "0xXXXXXXXXXXXXX" "0xYYYYYYYYYYYYY" ]; + trusted-key = [ + "0xXXXXXXXXXXXXX" + "0xYYYYYYYYYYYYY" + ]; }; homedir = "${config.home.homeDirectory}/bar/foopg"; @@ -15,9 +19,7 @@ nmt.script = '' assertFileExists home-files/bar/foopg/gpg.conf - assertFileContent home-files/bar/foopg/gpg.conf ${ - ./override-defaults-expected.conf - } + assertFileContent home-files/bar/foopg/gpg.conf ${./override-defaults-expected.conf} assertFileNotRegex activate "^unset GNUPGHOME keyId importTrust$" ''; diff --git a/tests/modules/programs/gradle/alternate-home-settings.nix b/tests/modules/programs/gradle/alternate-home-settings.nix index c278302ba..8b7861072 100644 --- a/tests/modules/programs/gradle/alternate-home-settings.nix +++ b/tests/modules/programs/gradle/alternate-home-settings.nix @@ -4,12 +4,15 @@ programs.gradle = { enable = true; home = ".gbt"; - settings = { "org.gradle.caching" = true; }; - initScripts = { "some-script.gradle".text = "println 'hello world'"; }; + settings = { + "org.gradle.caching" = true; + }; + initScripts = { + "some-script.gradle".text = "println 'hello world'"; + }; }; - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + programs.java.package = pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; nmt.script = '' assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ diff --git a/tests/modules/programs/gradle/default.nix b/tests/modules/programs/gradle/default.nix index b8a454914..637612566 100644 --- a/tests/modules/programs/gradle/default.nix +++ b/tests/modules/programs/gradle/default.nix @@ -4,4 +4,3 @@ gradle-init-scripts-settings = ./init-scripts-settings.nix; gradle-alternate-home-settings = ./alternate-home-settings.nix; } - diff --git a/tests/modules/programs/gradle/empty-settings.nix b/tests/modules/programs/gradle/empty-settings.nix index 6b9970843..9a027a8a5 100644 --- a/tests/modules/programs/gradle/empty-settings.nix +++ b/tests/modules/programs/gradle/empty-settings.nix @@ -3,8 +3,7 @@ { programs.gradle.enable = true; - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + programs.java.package = pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; nmt.script = '' assertPathNotExists home-files/.gradle diff --git a/tests/modules/programs/gradle/example-settings.nix b/tests/modules/programs/gradle/example-settings.nix index 5944d66c4..61258441e 100644 --- a/tests/modules/programs/gradle/example-settings.nix +++ b/tests/modules/programs/gradle/example-settings.nix @@ -11,8 +11,7 @@ }; }; - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + programs.java.package = pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; test.stubs = { jdk8 = { }; @@ -22,15 +21,13 @@ nmt.script = '' assertFileExists home-files/.gradle/gradle.properties - assertFileContent home-files/.gradle/gradle.properties ${ - builtins.toFile "gradle.expected" '' - # Generated with Nix + 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 - '' - } + 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 680368366..6df373ec5 100644 --- a/tests/modules/programs/gradle/init-scripts-settings.nix +++ b/tests/modules/programs/gradle/init-scripts-settings.nix @@ -12,20 +12,15 @@ }; }; - programs.java.package = - pkgs.runCommandLocal "java" { home = ""; } "mkdir $out"; + 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' - '' - } + 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 - } + assertFileContent home-files/.gradle/init.d/external-init-script.gradle ${./external-init-script.gradle} ''; } diff --git a/tests/modules/programs/helix/example-settings.nix b/tests/modules/programs/helix/example-settings.nix index e345725e4..9ccb4fd32 100644 --- a/tests/modules/programs/helix/example-settings.nix +++ b/tests/modules/programs/helix/example-settings.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs.helix = { enable = true; @@ -12,7 +13,10 @@ space.space = "file_picker"; space.w = ":w"; space.q = ":q"; - esc = [ "collapse_selection" "keep_primary_selection" ]; + esc = [ + "collapse_selection" + "keep_primary_selection" + ]; }; }; @@ -23,105 +27,126 @@ ''; languages = { - language-server.typescript-language-server = let - typescript-language-server = config.lib.test.mkStubPackage { - outPath = "@typescript-language-server@"; + 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" + ]; }; - 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; - }]; + language = [ + { + name = "rust"; + auto-format = false; + } + ]; }; - ignores = [ ".build/" "!.gitignore" ]; + 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; + 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; }; - "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; - }; }; }; diff --git a/tests/modules/programs/hexchat/basic-configuration.nix b/tests/modules/programs/hexchat/basic-configuration.nix index 7fba91da7..cd6cc6407 100644 --- a/tests/modules/programs/hexchat/basic-configuration.nix +++ b/tests/modules/programs/hexchat/basic-configuration.nix @@ -19,7 +19,9 @@ autojoin = [ "#home-manager" ]; }; efnet = { - options = { forceSSL = true; }; + options = { + forceSSL = true; + }; servers = [ "irc.choopa.net" "irc.colosolutions.net" diff --git a/tests/modules/programs/himalaya/basic.nix b/tests/modules/programs/himalaya/basic.nix index 05fdef3f6..cd1f3bcb9 100644 --- a/tests/modules/programs/himalaya/basic.nix +++ b/tests/modules/programs/himalaya/basic.nix @@ -9,12 +9,12 @@ }; }; - programs.himalaya = { enable = true; }; + programs.himalaya = { + enable = true; + }; nmt.script = '' assertFileExists home-files/.config/himalaya/config.toml - assertFileContent home-files/.config/himalaya/config.toml ${ - ./basic-expected.toml - } + assertFileContent home-files/.config/himalaya/config.toml ${./basic-expected.toml} ''; } diff --git a/tests/modules/programs/htop/example-settings.nix b/tests/modules/programs/htop/example-settings.nix index 04c72f434..fd626b13c 100644 --- a/tests/modules/programs/htop/example-settings.nix +++ b/tests/modules/programs/htop/example-settings.nix @@ -3,36 +3,47 @@ { config = { programs.htop.enable = true; - programs.htop.settings = { - color_scheme = 6; - cpu_count_from_one = 0; - delay = 15; - fields = with config.lib.htop.fields; [ - PID - USER - PRIORITY - NICE - M_SIZE - M_RESIDENT - M_SHARE - STATE - PERCENT_CPU - PERCENT_MEM - TIME - COMM - ]; - highlight_base_name = 1; - highlight_megabytes = 1; - highlight_threads = 1; - } // (with config.lib.htop; - leftMeters [ (bar "AllCPUs2") (bar "Memory") (bar "Swap") (text "Zram") ]) - // (with config.lib.htop; + programs.htop.settings = + { + color_scheme = 6; + cpu_count_from_one = 0; + delay = 15; + fields = with config.lib.htop.fields; [ + PID + USER + PRIORITY + NICE + M_SIZE + M_RESIDENT + M_SHARE + STATE + PERCENT_CPU + PERCENT_MEM + TIME + COMM + ]; + highlight_base_name = 1; + highlight_megabytes = 1; + highlight_threads = 1; + } + // ( + with config.lib.htop; + leftMeters [ + (bar "AllCPUs2") + (bar "Memory") + (bar "Swap") + (text "Zram") + ] + ) + // ( + with config.lib.htop; rightMeters [ (text "Tasks") (text "LoadAverage") (text "Uptime") (text "Systemd") - ]); + ] + ); nmt.script = '' htoprc=home-files/.config/htop/htoprc diff --git a/tests/modules/programs/htop/header_layout.nix b/tests/modules/programs/htop/header_layout.nix index e9de2bec9..6df9d5068 100644 --- a/tests/modules/programs/htop/header_layout.nix +++ b/tests/modules/programs/htop/header_layout.nix @@ -5,34 +5,55 @@ programs.htop.enable = true; programs.htop.settings = { header_layout = "two_50_50"; - column_meters_0 = [ "AllCPUs2" "Memory" "Swap" "Zram" ]; - column_meters_modes_0 = [ modes.Bar modes.Bar modes.Bar modes.Text ]; - column_meters_1 = [ "Tasks" "LoadAverage" "Uptime" "Systemd" ]; - column_meters_modes_1 = [ modes.Text modes.Text modes.Text modes.Text ]; + column_meters_0 = [ + "AllCPUs2" + "Memory" + "Swap" + "Zram" + ]; + column_meters_modes_0 = [ + modes.Bar + modes.Bar + modes.Bar + modes.Text + ]; + column_meters_1 = [ + "Tasks" + "LoadAverage" + "Uptime" + "Systemd" + ]; + column_meters_modes_1 = [ + modes.Text + modes.Text + modes.Text + modes.Text + ]; }; # Test that the 'fields' key is written in addition to the customized # settings or htop won't read the options. - nmt.script = let - fields = if pkgs.stdenv.hostPlatform.isDarwin then - "0 48 17 18 38 39 2 46 47 49 1" - else - "0 48 17 18 38 39 40 2 46 47 49 1"; - in '' - htoprc=home-files/.config/htop/htoprc - assertFileExists $htoprc - assertFileContent $htoprc \ - ${ - builtins.toFile "htoprc-expected" '' + nmt.script = + let + fields = + if pkgs.stdenv.hostPlatform.isDarwin then + "0 48 17 18 38 39 2 46 47 49 1" + else + "0 48 17 18 38 39 40 2 46 47 49 1"; + in + '' + htoprc=home-files/.config/htop/htoprc + assertFileExists $htoprc + assertFileContent $htoprc \ + ${builtins.toFile "htoprc-expected" '' header_layout=two_50_50 column_meters_0=AllCPUs2 Memory Swap Zram column_meters_1=Tasks LoadAverage Uptime Systemd column_meters_modes_0=1 1 1 2 column_meters_modes_1=2 2 2 2 fields=${fields} - '' - } - ''; + ''} + ''; }; } diff --git a/tests/modules/programs/htop/settings-without-fields.nix b/tests/modules/programs/htop/settings-without-fields.nix index e538a0756..0221b5ef7 100644 --- a/tests/modules/programs/htop/settings-without-fields.nix +++ b/tests/modules/programs/htop/settings-without-fields.nix @@ -3,26 +3,29 @@ { config = { programs.htop.enable = true; - programs.htop.settings = { color_scheme = 6; }; + programs.htop.settings = { + color_scheme = 6; + }; # Test that the 'fields' key is written in addition to the customized # settings or htop won't read the options. - nmt.script = let - fields = if pkgs.stdenv.hostPlatform.isDarwin then - "0 48 17 18 38 39 2 46 47 49 1" - else - "0 48 17 18 38 39 40 2 46 47 49 1"; - in '' - htoprc=home-files/.config/htop/htoprc - assertFileExists $htoprc - assertFileContent $htoprc \ - ${ - builtins.toFile "htoprc-expected" '' + nmt.script = + let + fields = + if pkgs.stdenv.hostPlatform.isDarwin then + "0 48 17 18 38 39 2 46 47 49 1" + else + "0 48 17 18 38 39 40 2 46 47 49 1"; + in + '' + htoprc=home-files/.config/htop/htoprc + assertFileExists $htoprc + assertFileContent $htoprc \ + ${builtins.toFile "htoprc-expected" '' color_scheme=6 fields=${fields} - '' - } - ''; + ''} + ''; }; } diff --git a/tests/modules/programs/hyprlock/basic-configuration.nix b/tests/modules/programs/hyprlock/basic-configuration.nix index 606c1f75a..bcb940941 100644 --- a/tests/modules/programs/hyprlock/basic-configuration.nix +++ b/tests/modules/programs/hyprlock/basic-configuration.nix @@ -10,26 +10,30 @@ no_fade_in = false; }; - background = [{ - monitor = ""; - path = "screenshot"; - blur_passes = 3; - blur_size = 8; - }]; + background = [ + { + monitor = ""; + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + } + ]; - input-field = [{ - size = "200, 50"; - position = "0, -80"; - monitor = ""; - dots_center = true; - fade_on_empty = false; - font_color = "rgb(202, 211, 245)"; - inner_color = "rgb(91, 96, 120)"; - outer_color = "rgb(24, 25, 38)"; - outline_thickness = 5; - placeholder_text = ''Password...''; - shadow_passes = 2; - }]; + input-field = [ + { + size = "200, 50"; + position = "0, -80"; + monitor = ""; + dots_center = true; + fade_on_empty = false; + font_color = "rgb(202, 211, 245)"; + inner_color = "rgb(91, 96, 120)"; + outer_color = "rgb(24, 25, 38)"; + outline_thickness = 5; + placeholder_text = ''Password...''; + shadow_passes = 2; + } + ]; }; }; diff --git a/tests/modules/programs/hyprlock/complex-configuration.nix b/tests/modules/programs/hyprlock/complex-configuration.nix index b8a9f9817..1abe45810 100644 --- a/tests/modules/programs/hyprlock/complex-configuration.nix +++ b/tests/modules/programs/hyprlock/complex-configuration.nix @@ -12,68 +12,74 @@ no_fade_out = false; }; - background = [{ - monitor = ""; - brightness = "0.817200"; - color = "rgba(25, 20, 20, 1.0)"; - path = "screenshot"; - blur_passes = 3; - blur_size = 8; - contrast = "0.891700"; - noise = "0.011700"; - vibrancy = "0.168600"; - vibrancy_darkness = "0.050000"; - }]; + background = [ + { + monitor = ""; + brightness = "0.817200"; + color = "rgba(25, 20, 20, 1.0)"; + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + contrast = "0.891700"; + noise = "0.011700"; + vibrancy = "0.168600"; + vibrancy_darkness = "0.050000"; + } + ]; - input-field = [{ - monitor = ""; - size = "200, 50"; - position = "0, -80"; - outline_thickness = 5; - dots_center = true; - outer_color = "rgb(24, 25, 38)"; - inner_color = "rgb(91, 96, 120)"; - font_color = "rgb(202, 211, 245)"; - fade_on_empty = false; - placeholder_text = ''Password...''; - shadow_passes = 2; - bothlock_color = -1; - capslock_color = "-1"; - check_color = "rgb(204, 136, 34)"; - dots_rounding = "-1"; - dots_size = "0.330000"; - dots_spacing = "0.150000"; - fade_timeout = "2000"; - fail_color = "rgb(204, 34, 34)"; - fail_text = "$FAIL"; - fail_transition = 300; - halign = "center"; - hide_input = false; - invert_numlock = false; - numlock_color = -1; - rounding = -1; - shadow_boost = "1.200000"; - shadow_color = "rgba(0, 0, 0, 1.0)"; - shadow_size = 3; - swap_font_color = false; - valign = "center"; - }]; + input-field = [ + { + monitor = ""; + size = "200, 50"; + position = "0, -80"; + outline_thickness = 5; + dots_center = true; + outer_color = "rgb(24, 25, 38)"; + inner_color = "rgb(91, 96, 120)"; + font_color = "rgb(202, 211, 245)"; + fade_on_empty = false; + placeholder_text = ''Password...''; + shadow_passes = 2; + bothlock_color = -1; + capslock_color = "-1"; + check_color = "rgb(204, 136, 34)"; + dots_rounding = "-1"; + dots_size = "0.330000"; + dots_spacing = "0.150000"; + fade_timeout = "2000"; + fail_color = "rgb(204, 34, 34)"; + fail_text = "$FAIL"; + fail_transition = 300; + halign = "center"; + hide_input = false; + invert_numlock = false; + numlock_color = -1; + rounding = -1; + shadow_boost = "1.200000"; + shadow_color = "rgba(0, 0, 0, 1.0)"; + shadow_size = 3; + swap_font_color = false; + valign = "center"; + } + ]; - image = [{ - monitor = ""; - size = 120; - position = "0, 45"; - path = "/home/$USER/.face"; - border_color = "rgb(202, 211, 245)"; - border_size = 5; - halign = "center"; - valign = "center"; - shadow_passes = 1; - reload_cmd = ""; - reload_time = -1; - rotate = "0.000000"; - rounding = "-1"; - }]; + image = [ + { + monitor = ""; + size = 120; + position = "0, 45"; + path = "/home/$USER/.face"; + border_color = "rgb(202, 211, 245)"; + border_size = 5; + halign = "center"; + valign = "center"; + shadow_passes = 1; + reload_cmd = ""; + reload_time = -1; + rotate = "0.000000"; + rounding = "-1"; + } + ]; label = [ { @@ -138,8 +144,7 @@ } { monitor = ""; - text = '' - cmd[update:120000] echo "$(date +'%a %d %B')"''; + text = ''cmd[update:120000] echo "$(date +'%a %d %B')"''; color = "rgb(202, 211, 245)"; font_size = 30; font_family = "MonaspiceNe Nerd Font"; diff --git a/tests/modules/programs/i3blocks/with-ordered-blocks.nix b/tests/modules/programs/i3blocks/with-ordered-blocks.nix index f7a81b9c3..5925e595d 100644 --- a/tests/modules/programs/i3blocks/with-ordered-blocks.nix +++ b/tests/modules/programs/i3blocks/with-ordered-blocks.nix @@ -14,7 +14,8 @@ let command=echo third interval=3 ''; -in { +in +{ config = { programs.i3blocks = { enable = true; diff --git a/tests/modules/programs/i3status-rust/with-custom.nix b/tests/modules/programs/i3status-rust/with-custom.nix index 46887a58e..12bc5cc3b 100644 --- a/tests/modules/programs/i3status-rust/with-custom.nix +++ b/tests/modules/programs/i3status-rust/with-custom.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { @@ -48,16 +53,17 @@ } { block = "xrandr"; - interval = - 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 + interval = 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 } { block = "sound"; format = "{output_name} {volume}%"; - click = [{ - button = "left"; - cmd = "pavucontrol --tab=3"; - }]; + click = [ + { + button = "left"; + cmd = "pavucontrol --tab=3"; + } + ]; mappings = { "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; @@ -66,7 +72,11 @@ { block = "music"; player = "spotify"; - buttons = [ "play" "prev" "next" ]; + buttons = [ + "play" + "prev" + "next" + ]; click = [ { button = "play"; @@ -97,100 +107,100 @@ }; }; - test.stubs.i3status-rust = { version = "0.30.0"; }; + test.stubs.i3status-rust = { + version = "0.30.0"; + }; nmt.script = '' assertFileExists home-files/.config/i3status-rust/config-custom.toml assertFileContent home-files/.config/i3status-rust/config-custom.toml \ - ${ - pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 - [[block]] - block = "memory" - display_type = "memory" - format_mem = "{Mug}GB ({Mup}%)" - format_swap = "{SUp}%" + [[block]] + block = "memory" + display_type = "memory" + format_mem = "{Mug}GB ({Mup}%)" + format_swap = "{SUp}%" - [[block]] - block = "cpu" - format = " $icon $barchart " - interval = 1 + [[block]] + block = "cpu" + format = " $icon $barchart " + interval = 1 - [[block]] - block = "load" - format = " $icon $1m $5m " - interval = 1 + [[block]] + block = "load" + format = " $icon $1m $5m " + interval = 1 - [[block]] - block = "temperature" - chip = "*-isa-*" - format = "$icon $min min, $max max, $average avg" - interval = 10 + [[block]] + block = "temperature" + chip = "*-isa-*" + format = "$icon $min min, $max max, $average avg" + interval = 10 - [[block]] - block = "net" - device = "enp9s0u2u1u2c2" - interval = 5 + [[block]] + block = "net" + device = "enp9s0u2u1u2c2" + interval = 5 - [[block]] - block = "speedtest" - format = " ^icon_ping $ping " + [[block]] + block = "speedtest" + format = " ^icon_ping $ping " - [[block]] - block = "xrandr" - interval = 6000 + [[block]] + block = "xrandr" + interval = 6000 - [[block]] - block = "sound" - format = "{output_name} {volume}%" + [[block]] + block = "sound" + format = "{output_name} {volume}%" - [[block.click]] - button = "left" - cmd = "pavucontrol --tab=3" + [[block.click]] + button = "left" + cmd = "pavucontrol --tab=3" - [block.mappings] - "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" - "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" + [block.mappings] + "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" + "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" - [[block]] - block = "music" - buttons = ["play", "prev", "next"] - player = "spotify" + [[block]] + block = "music" + buttons = ["play", "prev", "next"] + player = "spotify" - [[block.click]] - action = "music_play" - button = "play" + [[block.click]] + action = "music_play" + button = "play" - [[block.click]] - action = "music_prev" - button = "prev" + [[block.click]] + action = "music_prev" + button = "prev" - [[block.click]] - action = "music_next" - button = "next" + [[block.click]] + action = "music_next" + button = "next" - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 - [[block]] - block = "battery" + [[block]] + block = "battery" - [icons] - icons = "awesome5" + [icons] + icons = "awesome5" - [theme] - theme = "gruvbox-dark" - '' - } + [theme] + theme = "gruvbox-dark" + ''} ''; }; } diff --git a/tests/modules/programs/i3status-rust/with-default.nix b/tests/modules/programs/i3status-rust/with-default.nix index 3b5b2213a..19a698c74 100644 --- a/tests/modules/programs/i3status-rust/with-default.nix +++ b/tests/modules/programs/i3status-rust/with-default.nix @@ -1,53 +1,60 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { - programs.i3status-rust = { enable = true; }; + programs.i3status-rust = { + enable = true; + }; - test.stubs.i3status-rust = { version = "0.31.2"; }; + test.stubs.i3status-rust = { + version = "0.31.2"; + }; nmt.script = '' assertFileExists home-files/.config/i3status-rust/config-default.toml assertFileContent home-files/.config/i3status-rust/config-default.toml \ - ${ - pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 - [[block]] - block = "memory" - format = " $icon mem_used_percents " - format_alt = " $icon $swap_used_percents " + [[block]] + block = "memory" + format = " $icon mem_used_percents " + format_alt = " $icon $swap_used_percents " - [[block]] - block = "cpu" - interval = 1 + [[block]] + block = "cpu" + interval = 1 - [[block]] - block = "load" - format = " $icon $1m " - interval = 1 + [[block]] + block = "load" + format = " $icon $1m " + interval = 1 - [[block]] - block = "sound" + [[block]] + block = "sound" - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 - [icons] - icons = "none" + [icons] + icons = "none" - [theme] - theme = "plain" - '' - } + [theme] + theme = "plain" + ''} ''; }; } diff --git a/tests/modules/programs/i3status-rust/with-extra-settings.nix b/tests/modules/programs/i3status-rust/with-extra-settings.nix index b0a8ee4ac..ee24fc304 100644 --- a/tests/modules/programs/i3status-rust/with-extra-settings.nix +++ b/tests/modules/programs/i3status-rust/with-extra-settings.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { @@ -48,16 +53,17 @@ } { block = "xrandr"; - interval = - 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 + interval = 6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668 } { block = "sound"; format = "{output_name} {volume}%"; - click = [{ - button = "left"; - cmd = "pavucontrol --tab=3"; - }]; + click = [ + { + button = "left"; + cmd = "pavucontrol --tab=3"; + } + ]; mappings = { "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; @@ -66,7 +72,11 @@ { block = "music"; player = "spotify"; - buttons = [ "play" "prev" "next" ]; + buttons = [ + "play" + "prev" + "next" + ]; click = [ { button = "play"; @@ -107,103 +117,103 @@ }; }; - test.stubs.i3status-rust = { version = "0.30.0"; }; + test.stubs.i3status-rust = { + version = "0.30.0"; + }; nmt.script = '' assertFileExists home-files/.config/i3status-rust/config-extra-settings.toml assertFileContent home-files/.config/i3status-rust/config-extra-settings.toml \ - ${ - pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 - [[block]] - block = "memory" - display_type = "memory" - format_mem = "{Mug}GB ({Mup}%)" - format_swap = "{SUp}%" + [[block]] + block = "memory" + display_type = "memory" + format_mem = "{Mug}GB ({Mup}%)" + format_swap = "{SUp}%" - [[block]] - block = "cpu" - format = " $icon $barchart " - interval = 1 + [[block]] + block = "cpu" + format = " $icon $barchart " + interval = 1 - [[block]] - block = "load" - format = " $icon $1m $5m " - interval = 1 + [[block]] + block = "load" + format = " $icon $1m $5m " + interval = 1 - [[block]] - block = "temperature" - chip = "*-isa-*" - format = "$icon $min min, $max max, $average avg" - interval = 10 + [[block]] + block = "temperature" + chip = "*-isa-*" + format = "$icon $min min, $max max, $average avg" + interval = 10 - [[block]] - block = "net" - device = "enp9s0u2u1u2c2" - interval = 5 + [[block]] + block = "net" + device = "enp9s0u2u1u2c2" + interval = 5 - [[block]] - block = "speedtest" - format = " ^icon_ping $ping " + [[block]] + block = "speedtest" + format = " ^icon_ping $ping " - [[block]] - block = "xrandr" - interval = 6000 + [[block]] + block = "xrandr" + interval = 6000 - [[block]] - block = "sound" - format = "{output_name} {volume}%" + [[block]] + block = "sound" + format = "{output_name} {volume}%" - [[block.click]] - button = "left" - cmd = "pavucontrol --tab=3" + [[block.click]] + button = "left" + cmd = "pavucontrol --tab=3" - [block.mappings] - "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" - "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" + [block.mappings] + "alsa_output.pci-0000_00_1f.3.analog-stereo" = "" + "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "" - [[block]] - block = "music" - buttons = ["play", "prev", "next"] - player = "spotify" + [[block]] + block = "music" + buttons = ["play", "prev", "next"] + player = "spotify" - [[block.click]] - action = "music_play" - button = "play" + [[block.click]] + action = "music_play" + button = "play" - [[block.click]] - action = "music_prev" - button = "prev" + [[block.click]] + action = "music_prev" + button = "prev" - [[block.click]] - action = "music_next" - button = "next" + [[block.click]] + action = "music_next" + button = "next" - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 - [[block]] - block = "battery" + [[block]] + block = "battery" - [icons] - icons = "awesome5" + [icons] + icons = "awesome5" - [theme] - theme = "solarized-dark" - [theme.overrides] - idle_bg = "#123456" - idle_fg = "#abcdef" - '' - } + [theme] + theme = "solarized-dark" + [theme.overrides] + idle_bg = "#123456" + idle_fg = "#abcdef" + ''} ''; }; } diff --git a/tests/modules/programs/i3status-rust/with-multiple-bars.nix b/tests/modules/programs/i3status-rust/with-multiple-bars.nix index 2a56d6a9c..3c6f77c30 100644 --- a/tests/modules/programs/i3status-rust/with-multiple-bars.nix +++ b/tests/modules/programs/i3status-rust/with-multiple-bars.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { @@ -46,55 +51,53 @@ }; - test.stubs.i3status-rust = { version = "0.30.0"; }; + test.stubs.i3status-rust = { + version = "0.30.0"; + }; nmt.script = '' assertFileExists home-files/.config/i3status-rust/config-top.toml assertFileContent home-files/.config/i3status-rust/config-top.toml \ - ${ - pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - warning = 20.0 + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + warning = 20.0 - [[block]] - block = "memory" - format_mem = " $icon $Mug ($Mup) " - format_swap = " $icon $SUp " + [[block]] + block = "memory" + format_mem = " $icon $Mug ($Mup) " + format_swap = " $icon $SUp " - [icons] - icons = "none" + [icons] + icons = "none" - [theme] - theme = "plain" - '' - } + [theme] + theme = "plain" + ''} assertFileExists home-files/.config/i3status-rust/config-bottom.toml assertFileContent \ home-files/.config/i3status-rust/config-bottom.toml \ - ${ - pkgs.writeText "i3status-rust-expected-config" '' - [[block]] - block = "cpu" - format = " $icon $barchart " - interval = 1 + ${pkgs.writeText "i3status-rust-expected-config" '' + [[block]] + block = "cpu" + format = " $icon $barchart " + interval = 1 - [[block]] - block = "load" - format = " $icon $1m $5m " - interval = 1 + [[block]] + block = "load" + format = " $icon $1m $5m " + interval = 1 - [icons] - icons = "awesome5" + [icons] + icons = "awesome5" - [theme] - theme = "gruvbox-dark" - '' - } + [theme] + theme = "gruvbox-dark" + ''} ''; }; } diff --git a/tests/modules/programs/i3status-rust/with-version-02xx.nix b/tests/modules/programs/i3status-rust/with-version-02xx.nix index ec8c2f9a9..56d173147 100644 --- a/tests/modules/programs/i3status-rust/with-version-02xx.nix +++ b/tests/modules/programs/i3status-rust/with-version-02xx.nix @@ -1,49 +1,56 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { - programs.i3status-rust = { enable = true; }; + programs.i3status-rust = { + enable = true; + }; - test.stubs.i3status-rust = { version = "0.29.9"; }; + test.stubs.i3status-rust = { + version = "0.29.9"; + }; nmt.script = '' assertFileExists home-files/.config/i3status-rust/config-default.toml assertFileContent home-files/.config/i3status-rust/config-default.toml \ - ${ - pkgs.writeText "i3status-rust-expected-config" '' - icons = "none" - theme = "plain" - [[block]] - alert = 10.0 - block = "disk_space" - info_type = "available" - interval = 60 - path = "/" - warning = 20.0 + ${pkgs.writeText "i3status-rust-expected-config" '' + icons = "none" + theme = "plain" + [[block]] + alert = 10.0 + block = "disk_space" + info_type = "available" + interval = 60 + path = "/" + warning = 20.0 - [[block]] - block = "memory" - format = " $icon mem_used_percents " - format_alt = " $icon $swap_used_percents " + [[block]] + block = "memory" + format = " $icon mem_used_percents " + format_alt = " $icon $swap_used_percents " - [[block]] - block = "cpu" - interval = 1 + [[block]] + block = "cpu" + interval = 1 - [[block]] - block = "load" - format = " $icon $1m " - interval = 1 + [[block]] + block = "load" + format = " $icon $1m " + interval = 1 - [[block]] - block = "sound" + [[block]] + block = "sound" - [[block]] - block = "time" - format = " $timestamp.datetime(f:'%a %d/%m %R') " - interval = 60 - '' - } + [[block]] + block = "time" + format = " $timestamp.datetime(f:'%a %d/%m %R') " + interval = 60 + ''} ''; }; } diff --git a/tests/modules/programs/i3status-rust/with-version-0311.nix b/tests/modules/programs/i3status-rust/with-version-0311.nix index 3f928c07b..63d7bafbe 100644 --- a/tests/modules/programs/i3status-rust/with-version-0311.nix +++ b/tests/modules/programs/i3status-rust/with-version-0311.nix @@ -1,7 +1,11 @@ { - 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." diff --git a/tests/modules/programs/i3status/with-custom.nix b/tests/modules/programs/i3status/with-custom.nix index fcaa0c632..9e819fb44 100644 --- a/tests/modules/programs/i3status/with-custom.nix +++ b/tests/modules/programs/i3status/with-custom.nix @@ -26,7 +26,9 @@ }; "disk /" = { position = 2; - settings = { format = "/ %avail"; }; + settings = { + format = "/ %avail"; + }; }; }; }; @@ -34,28 +36,26 @@ 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 - } + ${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" - } + order += "volume master" + order += "disk /" + disk / { + format = "/ %avail" + } - volume master { - device = "pulse:1" - format = "♪ %volume" - format_muted = "♪ muted (%volume)" - } - '' - } + 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 735dad1f0..ba9f68af1 100644 --- a/tests/modules/programs/i3status/with-default.nix +++ b/tests/modules/programs/i3status/with-default.nix @@ -7,57 +7,55 @@ nmt.script = '' assertFileContent \ home-files/.config/i3status/config \ - ${ - builtins.toFile "i3status-expected-config" '' - general { - colors = true - interval = 5 - } + ${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" - } + 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" - } + disk / { + format = "%avail" + } - ethernet _first_ { - format_down = "E: down" - format_up = "E: %ip (%speed)" - } + ethernet _first_ { + format_down = "E: down" + format_up = "E: %ip (%speed)" + } - ipv6 { - - } + ipv6 { + + } - load { - format = "%1min" - } + load { + format = "%1min" + } - memory { - format = "%used | %available" - format_degraded = "MEMORY < %available" - threshold_degraded = "1G" - } + memory { + format = "%used | %available" + format_degraded = "MEMORY < %available" + threshold_degraded = "1G" + } - tztime local { - format = "%Y-%m-%d %H:%M:%S" - } + tztime local { + format = "%Y-%m-%d %H:%M:%S" + } - wireless _first_ { - format_down = "W: down" - format_up = "W: (%quality at %essid) %ip" - } - '' - } + 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 bec6699a9..62a485734 100644 --- a/tests/modules/programs/irssi/example-settings.nix +++ b/tests/modules/programs/irssi/example-settings.nix @@ -10,8 +10,7 @@ address = "irc.oftc.net"; port = 6697; autoConnect = true; - ssl.certificateFile = - "${config.home.homeDirectory}/.irssi/certs/nick.pem"; + ssl.certificateFile = "${config.home.homeDirectory}/.irssi/certs/nick.pem"; }; channels.home-manager.autoJoin = true; }; diff --git a/tests/modules/programs/jqp/basic-configuration.nix b/tests/modules/programs/jqp/basic-configuration.nix index 23b79310a..74ff3f961 100644 --- a/tests/modules/programs/jqp/basic-configuration.nix +++ b/tests/modules/programs/jqp/basic-configuration.nix @@ -2,7 +2,9 @@ programs = { jqp = { enable = true; - settings = { theme.name = "catppuccin-frappe"; }; + settings = { + theme.name = "catppuccin-frappe"; + }; }; }; diff --git a/tests/modules/programs/jujutsu/empty-config.nix b/tests/modules/programs/jujutsu/empty-config.nix index 27a1c393e..d3bd44343 100644 --- a/tests/modules/programs/jujutsu/empty-config.nix +++ b/tests/modules/programs/jujutsu/empty-config.nix @@ -1,9 +1,9 @@ { pkgs, ... }: let - configDir = - if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; -in { + configDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; +in +{ programs.jujutsu.enable = true; nmt.script = '' diff --git a/tests/modules/programs/jujutsu/example-config.nix b/tests/modules/programs/jujutsu/example-config.nix index 029187786..38c8de442 100644 --- a/tests/modules/programs/jujutsu/example-config.nix +++ b/tests/modules/programs/jujutsu/example-config.nix @@ -1,9 +1,9 @@ { pkgs, config, ... }: let - configDir = - if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; -in { + configDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; +in +{ programs.jujutsu = { enable = true; package = config.lib.test.mkStubPackage { }; @@ -18,12 +18,10 @@ in { nmt.script = '' assertFileExists 'home-files/${configDir}/jj/config.toml' assertFileContent 'home-files/${configDir}/jj/config.toml' \ - ${ - builtins.toFile "expected.toml" '' - [user] - email = "jdoe@example.org" - name = "John Doe" - '' - } + ${builtins.toFile "expected.toml" '' + [user] + email = "jdoe@example.org" + name = "John Doe" + ''} ''; } diff --git a/tests/modules/programs/k9s/deprecated-options.nix b/tests/modules/programs/k9s/deprecated-options.nix index 97f779c3d..390ab3315 100644 --- a/tests/modules/programs/k9s/deprecated-options.nix +++ b/tests/modules/programs/k9s/deprecated-options.nix @@ -20,9 +20,7 @@ test.asserts.warnings.enable = true; test.asserts.warnings.expected = [ - "The option `programs.k9s.skin' defined in ${ - lib.showFiles options.programs.k9s.skin.files - } has been renamed to `programs.k9s.skins.skin'." + "The option `programs.k9s.skin' defined in ${lib.showFiles options.programs.k9s.skin.files} has been renamed to `programs.k9s.skins.skin'." ]; nmt.script = '' assertFileExists home-files/.config/k9s/skins/skin.yaml diff --git a/tests/modules/programs/k9s/empty-settings.nix b/tests/modules/programs/k9s/empty-settings.nix index 05f859ee2..d9898d467 100644 --- a/tests/modules/programs/k9s/empty-settings.nix +++ b/tests/modules/programs/k9s/empty-settings.nix @@ -5,12 +5,11 @@ xdg.enable = lib.mkIf pkgs.stdenv.isDarwin false; - nmt.script = let - configDir = if !pkgs.stdenv.isDarwin then - ".config/k9s" - else - "Library/Application Support/k9s"; - in '' - assertPathNotExists home-files/${configDir} - ''; + nmt.script = + let + configDir = if !pkgs.stdenv.isDarwin then ".config/k9s" else "Library/Application Support/k9s"; + in + '' + assertPathNotExists home-files/${configDir} + ''; } diff --git a/tests/modules/programs/k9s/example-settings.nix b/tests/modules/programs/k9s/example-settings.nix index 65d624e93..cd3e36e3a 100644 --- a/tests/modules/programs/k9s/example-settings.nix +++ b/tests/modules/programs/k9s/example-settings.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { xdg.enable = lib.mkIf pkgs.stdenv.isDarwin false; @@ -54,7 +59,11 @@ }; }; }; - aliases = { alias = { pp = "v1/pods"; }; }; + aliases = { + alias = { + pp = "v1/pods"; + }; + }; plugin = { plugin = { fred = { @@ -63,8 +72,15 @@ scopes = [ "po" ]; command = "kubectl"; background = false; - args = - [ "logs" "-f" "$NAME" "-n" "$NAMESPACE" "--context" "$CLUSTER" ]; + args = [ + "logs" + "-f" + "$NAME" + "-n" + "$NAMESPACE" + "--context" + "$CLUSTER" + ]; }; }; }; @@ -72,50 +88,57 @@ k9s = { views = { "v1/pods" = { - columns = [ "AGE" "NAMESPACE" "NAME" "IP" "NODE" "STATUS" "READY" ]; + columns = [ + "AGE" + "NAMESPACE" + "NAME" + "IP" + "NODE" + "STATUS" + "READY" + ]; }; }; }; }; }; - nmt.script = let - configDir = if !pkgs.stdenv.isDarwin then - ".config/k9s" - else - "Library/Application Support/k9s"; - in '' - assertFileExists "home-files/${configDir}/config.yaml" - assertFileContent \ - "home-files/${configDir}/config.yaml" \ - ${./example-config-expected.yaml} - assertFileExists "home-files/${configDir}/skins/default.yaml" - assertFileContent \ - "home-files/${configDir}/skins/default.yaml" \ - ${./example-skin-expected.yaml} - assertFileExists "home-files/${configDir}/skins/default2.yaml" - assertFileContent \ - "home-files/${configDir}/skins/default2.yaml" \ - ${./example-skin-expected.yaml} - assertFileExists "home-files/${configDir}/skins/alt-skin.yaml" - assertFileContent \ - "home-files/${configDir}/skins/alt-skin.yaml" \ - ${./example-skin-expected-alt.yaml} - assertFileExists "home-files/${configDir}/hotkeys.yaml" - assertFileContent \ - "home-files/${configDir}/hotkeys.yaml" \ - ${./example-hotkey-expected.yaml} - assertFileExists "home-files/${configDir}/aliases.yaml" - assertFileContent \ - "home-files/${configDir}/aliases.yaml" \ - ${./example-aliases-expected.yaml} - assertFileExists "home-files/${configDir}/plugins.yaml" - assertFileContent \ - "home-files/${configDir}/plugins.yaml" \ - ${./example-plugin-expected.yaml} - assertFileExists "home-files/${configDir}/views.yaml" - assertFileContent \ - "home-files/${configDir}/views.yaml" \ - ${./example-views-expected.yaml} - ''; + nmt.script = + let + configDir = if !pkgs.stdenv.isDarwin then ".config/k9s" else "Library/Application Support/k9s"; + in + '' + assertFileExists "home-files/${configDir}/config.yaml" + assertFileContent \ + "home-files/${configDir}/config.yaml" \ + ${./example-config-expected.yaml} + assertFileExists "home-files/${configDir}/skins/default.yaml" + assertFileContent \ + "home-files/${configDir}/skins/default.yaml" \ + ${./example-skin-expected.yaml} + assertFileExists "home-files/${configDir}/skins/default2.yaml" + assertFileContent \ + "home-files/${configDir}/skins/default2.yaml" \ + ${./example-skin-expected.yaml} + assertFileExists "home-files/${configDir}/skins/alt-skin.yaml" + assertFileContent \ + "home-files/${configDir}/skins/alt-skin.yaml" \ + ${./example-skin-expected-alt.yaml} + assertFileExists "home-files/${configDir}/hotkeys.yaml" + assertFileContent \ + "home-files/${configDir}/hotkeys.yaml" \ + ${./example-hotkey-expected.yaml} + assertFileExists "home-files/${configDir}/aliases.yaml" + assertFileContent \ + "home-files/${configDir}/aliases.yaml" \ + ${./example-aliases-expected.yaml} + assertFileExists "home-files/${configDir}/plugins.yaml" + assertFileContent \ + "home-files/${configDir}/plugins.yaml" \ + ${./example-plugin-expected.yaml} + assertFileExists "home-files/${configDir}/views.yaml" + assertFileContent \ + "home-files/${configDir}/views.yaml" \ + ${./example-views-expected.yaml} + ''; } diff --git a/tests/modules/programs/kakoune/default.nix b/tests/modules/programs/kakoune/default.nix index 1e6e077df..990867933 100644 --- a/tests/modules/programs/kakoune/default.nix +++ b/tests/modules/programs/kakoune/default.nix @@ -2,6 +2,5 @@ kakoune-no-plugins = ./no-plugins.nix; kakoune-use-plugins = ./use-plugins.nix; kakoune-whitespace-highlighter = ./whitespace-highlighter.nix; - kakoune-whitespace-highlighter-corner-cases = - ./whitespace-highlighter-corner-cases.nix; + kakoune-whitespace-highlighter-corner-cases = ./whitespace-highlighter-corner-cases.nix; } diff --git a/tests/modules/programs/kakoune/no-plugins.nix b/tests/modules/programs/kakoune/no-plugins.nix index 372491b1b..e1e6ecc48 100644 --- a/tests/modules/programs/kakoune/no-plugins.nix +++ b/tests/modules/programs/kakoune/no-plugins.nix @@ -1,7 +1,9 @@ { imports = [ ./stubs.nix ]; - programs.kakoune = { enable = true; }; + programs.kakoune = { + enable = true; + }; nmt.script = '' assertPathNotExists home-path/share/kak/autoload/plugins diff --git a/tests/modules/programs/khal/config.nix b/tests/modules/programs/khal/config.nix index 2493e6fc2..3f3b9225b 100644 --- a/tests/modules/programs/khal/config.nix +++ b/tests/modules/programs/khal/config.nix @@ -3,8 +3,7 @@ enable = true; settings = { default.timedelta = "5d"; - view.agenda_event_format = - "{calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{reset}"; + view.agenda_event_format = "{calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{reset}"; }; }; @@ -45,7 +44,10 @@ testWithMultipleAddresss = { khal = { enable = true; - addresses = [ "john.doe@email.com" "another.brick@on.the.wall" ]; + addresses = [ + "john.doe@email.com" + "another.brick@on.the.wall" + ]; }; local = { type = "filesystem"; @@ -65,7 +67,10 @@ testcontacts = { khal = { enable = true; - collections = [ "default" "automaticallyCollected" ]; + collections = [ + "default" + "automaticallyCollected" + ]; }; local.type = "filesystem"; local.fileExt = ".vcf"; diff --git a/tests/modules/programs/khard/basic_config.nix b/tests/modules/programs/khard/basic_config.nix index 41a65dbe9..d465f2b98 100644 --- a/tests/modules/programs/khard/basic_config.nix +++ b/tests/modules/programs/khard/basic_config.nix @@ -12,14 +12,26 @@ settings = { general = { default_action = "list"; - editor = [ "vim" "-i" "NONE" ]; + editor = [ + "vim" + "-i" + "NONE" + ]; }; "contact table" = { group_by_address_book = true; reverse = false; - preferred_phone_number_type = [ "pref" "cell" "home" ]; - preferred_email_address_type = [ "pref" "work" "home" ]; + preferred_phone_number_type = [ + "pref" + "cell" + "home" + ]; + preferred_email_address_type = [ + "pref" + "work" + "home" + ]; }; }; }; diff --git a/tests/modules/programs/kitty/example-settings.nix b/tests/modules/programs/kitty/example-settings.nix index cd7a9a327..d68baa6cd 100644 --- a/tests/modules/programs/kitty/example-settings.nix +++ b/tests/modules/programs/kitty/example-settings.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ config = { programs.kitty = { enable = true; @@ -29,18 +30,22 @@ "launch_window" = "launch --cwd=current --type=os-window"; }; - environment = { LS_COLORS = "1"; }; + environment = { + LS_COLORS = "1"; + }; }; - nmt.script = '' - assertFileExists home-files/.config/kitty/kitty.conf - assertFileContent \ - home-files/.config/kitty/kitty.conf \ - ${./example-settings-expected.conf} - '' + lib.optionalString pkgs.stdenv.hostPlatform.isDarwin '' - assertFileContent \ - home-files/.config/kitty/macos-launch-services-cmdline \ - ${./example-macos-launch-services-cmdline} - ''; + nmt.script = + '' + assertFileExists home-files/.config/kitty/kitty.conf + assertFileContent \ + home-files/.config/kitty/kitty.conf \ + ${./example-settings-expected.conf} + '' + + lib.optionalString pkgs.stdenv.hostPlatform.isDarwin '' + assertFileContent \ + home-files/.config/kitty/macos-launch-services-cmdline \ + ${./example-macos-launch-services-cmdline} + ''; }; } diff --git a/tests/modules/programs/kitty/theme-to-themeFile.nix b/tests/modules/programs/kitty/theme-to-themeFile.nix index 988076670..5506dbdb7 100644 --- a/tests/modules/programs/kitty/theme-to-themeFile.nix +++ b/tests/modules/programs/kitty/theme-to-themeFile.nix @@ -1,4 +1,9 @@ -{ lib, options, realPkgs, ... }: +{ + lib, + options, + realPkgs, + ... +}: { programs.kitty = { @@ -8,11 +13,11 @@ 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" + ( + "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.") + + " update your configuration accordingly." + ) ]; nixpkgs.overlays = [ (self: super: { inherit (realPkgs) kitty-themes; }) ]; diff --git a/tests/modules/programs/kodi/example-settings.nix b/tests/modules/programs/kodi/example-settings.nix index 74dd4a830..f7e8b551c 100644 --- a/tests/modules/programs/kodi/example-settings.nix +++ b/tests/modules/programs/kodi/example-settings.nix @@ -3,7 +3,9 @@ programs.kodi = { enable = true; - settings = { videolibrary.showemptytvshows = "true"; }; + settings = { + videolibrary.showemptytvshows = "true"; + }; }; nmt.script = '' diff --git a/tests/modules/programs/kodi/kodi-stubs.nix b/tests/modules/programs/kodi/kodi-stubs.nix index b45a6e50b..5622e1002 100644 --- a/tests/modules/programs/kodi/kodi-stubs.nix +++ b/tests/modules/programs/kodi/kodi-stubs.nix @@ -3,8 +3,7 @@ { nixpkgs.overlays = [ (_: super: { - buildPackages = - super.buildPackages.extend (_: _: { inherit (realPkgs) libxslt; }); + buildPackages = super.buildPackages.extend (_: _: { inherit (realPkgs) libxslt; }); }) ]; } diff --git a/tests/modules/programs/kubecolor/does-have-openshift.nix b/tests/modules/programs/kubecolor/does-have-openshift.nix index 015468865..8866bc4df 100644 --- a/tests/modules/programs/kubecolor/does-have-openshift.nix +++ b/tests/modules/programs/kubecolor/does-have-openshift.nix @@ -30,4 +30,3 @@ assertFileRegex 'home-files/.zshrc' '^alias.* oc=.*' ''; } - diff --git a/tests/modules/programs/kubecolor/does-not-have-openshift.nix b/tests/modules/programs/kubecolor/does-not-have-openshift.nix index 1f4cb0d7c..d72801484 100644 --- a/tests/modules/programs/kubecolor/does-not-have-openshift.nix +++ b/tests/modules/programs/kubecolor/does-not-have-openshift.nix @@ -21,4 +21,3 @@ assertFileNotRegex 'home-files/.zshrc' '^alias.* oc=.*' ''; } - diff --git a/tests/modules/programs/kubecolor/empty-config.nix b/tests/modules/programs/kubecolor/empty-config.nix index f88d334b0..d634c93b7 100644 --- a/tests/modules/programs/kubecolor/empty-config.nix +++ b/tests/modules/programs/kubecolor/empty-config.nix @@ -1,9 +1,9 @@ { pkgs, config, ... }: let - configDir = - if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; -in { + configDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; +in +{ programs.kubecolor = { enable = true; package = config.lib.test.mkStubPackage { diff --git a/tests/modules/programs/kubecolor/example-config-default-paths.nix b/tests/modules/programs/kubecolor/example-config-default-paths.nix index da3dcf5e1..b8962b8c4 100644 --- a/tests/modules/programs/kubecolor/example-config-default-paths.nix +++ b/tests/modules/programs/kubecolor/example-config-default-paths.nix @@ -1,11 +1,9 @@ { pkgs, config, ... }: let - configDir = if pkgs.stdenv.isDarwin then - "Library/Application Support/kube" - else - ".kube"; -in { + configDir = if pkgs.stdenv.isDarwin then "Library/Application Support/kube" else ".kube"; +in +{ programs.kubecolor = { enable = true; package = config.lib.test.mkStubPackage { @@ -24,14 +22,12 @@ in { nmt.script = '' assertFileExists 'home-files/${configDir}/color.yaml' assertFileContent 'home-files/${configDir}/color.yaml' \ - ${ - builtins.toFile "expected.yaml" '' - kubectl: kubectl - objFreshThreshold: 0 - pager: less - paging: auto - preset: dark - '' - } + ${builtins.toFile "expected.yaml" '' + kubectl: kubectl + objFreshThreshold: 0 + pager: less + paging: auto + preset: dark + ''} ''; } diff --git a/tests/modules/programs/kubecolor/example-config-xdg-paths.nix b/tests/modules/programs/kubecolor/example-config-xdg-paths.nix index 9ac9482c2..641cc9e8d 100644 --- a/tests/modules/programs/kubecolor/example-config-xdg-paths.nix +++ b/tests/modules/programs/kubecolor/example-config-xdg-paths.nix @@ -22,15 +22,12 @@ nmt.script = '' assertFileExists 'home-files/.config/kube/color.yaml' assertFileContent 'home-files/.config/kube/color.yaml' \ - ${ - builtins.toFile "expected.yaml" '' - kubectl: kubectl - objFreshThreshold: 0 - pager: less - paging: auto - preset: dark - '' - } + ${builtins.toFile "expected.yaml" '' + kubectl: kubectl + objFreshThreshold: 0 + pager: less + paging: auto + preset: dark + ''} ''; } - diff --git a/tests/modules/programs/lapce/example-keymaps.nix b/tests/modules/programs/lapce/example-keymaps.nix index bf6f0a76e..f866d8ab7 100644 --- a/tests/modules/programs/lapce/example-keymaps.nix +++ b/tests/modules/programs/lapce/example-keymaps.nix @@ -4,10 +4,12 @@ programs.lapce = { enable = true; package = config.lib.test.mkStubPackage { }; - keymaps = [{ - command = "open_log_file"; - key = "Ctrl+Shift+L"; - }]; + keymaps = [ + { + command = "open_log_file"; + key = "Ctrl+Shift+L"; + } + ]; }; nmt.script = '' diff --git a/tests/modules/programs/lazydocker/custom-settings.nix b/tests/modules/programs/lazydocker/custom-settings.nix index e57b530ba..bf51a5a8f 100644 --- a/tests/modules/programs/lazydocker/custom-settings.nix +++ b/tests/modules/programs/lazydocker/custom-settings.nix @@ -1,10 +1,14 @@ -{ ... }: { +{ ... }: +{ programs.lazydocker = { enable = true; settings = { commandTemplates.dockerCompose = "docker compose"; gui.theme = { - activeBorderColor = [ "red" "bold" ]; + activeBorderColor = [ + "red" + "bold" + ]; inactiveBorderColor = [ "blue" ]; }; }; diff --git a/tests/modules/programs/lazydocker/default-settings.nix b/tests/modules/programs/lazydocker/default-settings.nix index 55dee658a..e16a75456 100644 --- a/tests/modules/programs/lazydocker/default-settings.nix +++ b/tests/modules/programs/lazydocker/default-settings.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.lazydocker.enable = true; test.stubs.lazydocker = { }; nmt.script = '' diff --git a/tests/modules/programs/lazydocker/default.nix b/tests/modules/programs/lazydocker/default.nix index 7478fb9dc..af784b5cd 100644 --- a/tests/modules/programs/lazydocker/default.nix +++ b/tests/modules/programs/lazydocker/default.nix @@ -2,4 +2,3 @@ lazydocker-default-settings = ./default-settings.nix; lazydocker-custom-settings = ./custom-settings.nix; } - diff --git a/tests/modules/programs/less/less-with-custom-keys.nix b/tests/modules/programs/less/less-with-custom-keys.nix index 4e9b4197d..b08b2bbc3 100644 --- a/tests/modules/programs/less/less-with-custom-keys.nix +++ b/tests/modules/programs/less/less-with-custom-keys.nix @@ -10,11 +10,9 @@ nmt.script = '' assertFileExists home-files/.config/lesskey - assertFileContent home-files/.config/lesskey ${ - builtins.toFile "less.expected" '' - s back-line - t forw-line - '' - } + assertFileContent home-files/.config/lesskey ${builtins.toFile "less.expected" '' + s back-line + t forw-line + ''} ''; } diff --git a/tests/modules/programs/lf/all-options.nix b/tests/modules/programs/lf/all-options.nix index 644959b3f..6ccbbcd2e 100644 --- a/tests/modules/programs/lf/all-options.nix +++ b/tests/modules/programs/lf/all-options.nix @@ -28,7 +28,8 @@ let # More config... ''; -in { +in +{ programs.lf = { enable = true; @@ -66,7 +67,11 @@ in { ignorecase = false; icons = true; tabstop = 4; - ratios = [ 2 2 3 ]; + ratios = [ + 2 + 2 + 3 + ]; }; }; diff --git a/tests/modules/programs/lf/minimal-options.nix b/tests/modules/programs/lf/minimal-options.nix index c90382862..5c34067cc 100644 --- a/tests/modules/programs/lf/minimal-options.nix +++ b/tests/modules/programs/lf/minimal-options.nix @@ -1,9 +1,13 @@ { - programs.lf = { enable = true; }; + programs.lf = { + enable = true; + }; nmt.script = - let expected = builtins.toFile "settings-expected" "\n\n\n\n\n\n\n\n\n\n\n"; - in '' + 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 c290f3e6d..0f1bd7f38 100644 --- a/tests/modules/programs/lf/no-pv-keybind.nix +++ b/tests/modules/programs/lf/no-pv-keybind.nix @@ -16,7 +16,8 @@ let # More config... ''; -in { +in +{ programs.lf = { enable = true; @@ -24,7 +25,9 @@ in { # More config... ''; - previewer = { source = pvScript; }; + previewer = { + source = pvScript; + }; }; nmt.script = '' diff --git a/tests/modules/programs/lieer/lieer.nix b/tests/modules/programs/lieer/lieer.nix index e6786c92d..20b407d0d 100644 --- a/tests/modules/programs/lieer/lieer.nix +++ b/tests/modules/programs/lieer/lieer.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ imports = [ ../../accounts/email-test-accounts.nix ]; config = { @@ -13,9 +14,7 @@ nmt.script = '' assertFileExists home-files/Mail/hm@example.com/.gmailieer.json - assertFileContent home-files/Mail/hm@example.com/.gmailieer.json ${ - ./lieer-expected.json - } + assertFileContent home-files/Mail/hm@example.com/.gmailieer.json ${./lieer-expected.json} ''; }; } diff --git a/tests/modules/programs/looking-glass-client/empty-settings.nix b/tests/modules/programs/looking-glass-client/empty-settings.nix index 5b2a8b9c4..0b9a99f21 100644 --- a/tests/modules/programs/looking-glass-client/empty-settings.nix +++ b/tests/modules/programs/looking-glass-client/empty-settings.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.looking-glass-client = { enable = true; diff --git a/tests/modules/programs/looking-glass-client/example-settings.nix b/tests/modules/programs/looking-glass-client/example-settings.nix index c85701580..18dcd6fae 100644 --- a/tests/modules/programs/looking-glass-client/example-settings.nix +++ b/tests/modules/programs/looking-glass-client/example-settings.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.looking-glass-client = { enable = true; diff --git a/tests/modules/programs/lsd/example-settings.nix b/tests/modules/programs/lsd/example-settings.nix index f911e22f8..223928f6f 100644 --- a/tests/modules/programs/lsd/example-settings.nix +++ b/tests/modules/programs/lsd/example-settings.nix @@ -4,10 +4,18 @@ enableAliases = false; settings = { date = "relative"; - blocks = [ "date" "size" "name" ]; + blocks = [ + "date" + "size" + "name" + ]; layout = "oneline"; sorting.dir-grouping = "first"; - ignore-globs = [ ".git" ".hg" ".bsp" ]; + ignore-globs = [ + ".git" + ".hg" + ".bsp" + ]; }; colors = { date = { diff --git a/tests/modules/programs/man/no-manpath.nix b/tests/modules/programs/man/no-manpath.nix index dc3a3a0cb..150b0f8a2 100644 --- a/tests/modules/programs/man/no-manpath.nix +++ b/tests/modules/programs/man/no-manpath.nix @@ -1,6 +1,8 @@ { config = { - programs.man = { enable = true; }; + programs.man = { + enable = true; + }; nmt.script = '' assertPathNotExists home-files/.manpath diff --git a/tests/modules/programs/mangohud/basic-configuration.nix b/tests/modules/programs/mangohud/basic-configuration.nix index 6af57d281..981010965 100644 --- a/tests/modules/programs/mangohud/basic-configuration.nix +++ b/tests/modules/programs/mangohud/basic-configuration.nix @@ -7,7 +7,10 @@ package = config.lib.test.mkStubPackage { }; settings = { output_folder = /home/user/Documents/mangohud; - fps_limit = [ 30 60 ]; + fps_limit = [ + 30 + 60 + ]; vsync = 0; legacy_layout = false; cpu_stats = true; @@ -18,7 +21,11 @@ cpu_load_change = true; cpu_load_value = true; media_player_name = "spotify"; - media_player_order = [ "title" "artist" "album" ]; + media_player_order = [ + "title" + "artist" + "album" + ]; }; settingsPerApplication = { mpv = { diff --git a/tests/modules/programs/mbsync/mbsync.nix b/tests/modules/programs/mbsync/mbsync.nix index 506c0073b..94a51a895 100644 --- a/tests/modules/programs/mbsync/mbsync.nix +++ b/tests/modules/programs/mbsync/mbsync.nix @@ -8,7 +8,10 @@ # same time. # If they are, then the new version will take precedence. groups.inboxes = { - "hm@example.com" = [ "Inbox1" "Inbox2" ]; + "hm@example.com" = [ + "Inbox1" + "Inbox2" + ]; hm-account = [ "Inbox" ]; }; }; @@ -16,7 +19,11 @@ accounts.email.accounts = { "hm@example.com".mbsync = { enable = true; - extraConfig.account.TLSVersions = [ "+1.3" "+1.2" "-1.1" ]; + extraConfig.account.TLSVersions = [ + "+1.3" + "+1.2" + "-1.1" + ]; groups.inboxes = { channels = { inbox1 = { @@ -37,8 +44,11 @@ channels.earlierPatternMatch = { farPattern = "Label"; nearPattern = "SomethingUnderLabel"; - patterns = - [ "ThingUnderLabel" "!NotThisMaildirThough" ''"[Weird] Label?"'' ]; + patterns = [ + "ThingUnderLabel" + "!NotThisMaildirThough" + ''"[Weird] Label?"'' + ]; }; channels.inbox = { farPattern = "Inbox"; @@ -51,8 +61,11 @@ channels.patternMatch = { farPattern = "Label"; nearPattern = "SomethingUnderLabel"; - patterns = - [ "ThingUnderLabel" "!NotThisMaildirThough" ''"[Weird] Label?"'' ]; + patterns = [ + "ThingUnderLabel" + "!NotThisMaildirThough" + ''"[Weird] Label?"'' + ]; }; }; # No group should be printed. diff --git a/tests/modules/programs/mergiraf/basic-configuration.nix b/tests/modules/programs/mergiraf/basic-configuration.nix index 3d8688ad7..78e6e662e 100644 --- a/tests/modules/programs/mergiraf/basic-configuration.nix +++ b/tests/modules/programs/mergiraf/basic-configuration.nix @@ -6,8 +6,6 @@ nmt.script = '' assertFileContent "home-files/.config/git/config" ${./mergiraf-git.conf} - assertFileContent "home-files/.config/git/attributes" ${ - ./mergiraf-git-attributes.conf - } + assertFileContent "home-files/.config/git/attributes" ${./mergiraf-git-attributes.conf} ''; } diff --git a/tests/modules/programs/mise/bash-integration.nix b/tests/modules/programs/mise/bash-integration.nix index 552db2ffa..13a4377cb 100644 --- a/tests/modules/programs/mise/bash-integration.nix +++ b/tests/modules/programs/mise/bash-integration.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs = { mise = { package = config.lib.test.mkStubPackage { name = "mise"; }; @@ -13,4 +14,3 @@ assertFileRegex home-files/.bashrc 'eval "$(/nix/store/.*mise.*/bin/mise activate bash)"' ''; } - diff --git a/tests/modules/programs/mise/custom-settings.nix b/tests/modules/programs/mise/custom-settings.nix index ddc45353c..ddc1585c1 100644 --- a/tests/modules/programs/mise/custom-settings.nix +++ b/tests/modules/programs/mise/custom-settings.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ programs = { mise = { package = config.lib.test.mkStubPackage { name = "mise"; }; @@ -6,10 +7,15 @@ globalConfig = { tools = { node = "lts"; - python = [ "3.10" "3.11" ]; + python = [ + "3.10" + "3.11" + ]; }; - aliases = { my_custom_node = "20"; }; + aliases = { + my_custom_node = "20"; + }; }; settings = { verbose = false; @@ -23,23 +29,19 @@ assertFileExists home-files/.config/mise/config.toml assertFileExists home-files/.config/mise/settings.toml - assertFileContent home-files/.config/mise/config.toml ${ - pkgs.writeText "mise.config.expected" '' - [aliases] - my_custom_node = "20" + assertFileContent home-files/.config/mise/config.toml ${pkgs.writeText "mise.config.expected" '' + [aliases] + my_custom_node = "20" - [tools] - node = "lts" - python = ["3.10", "3.11"] - '' - } + [tools] + node = "lts" + python = ["3.10", "3.11"] + ''} - assertFileContent home-files/.config/mise/settings.toml ${ - pkgs.writeText "mise.settings.expected" '' - disable_tools = ["node"] - experimental = true - verbose = false - '' - } + assertFileContent home-files/.config/mise/settings.toml ${pkgs.writeText "mise.settings.expected" '' + disable_tools = ["node"] + experimental = true + verbose = false + ''} ''; } diff --git a/tests/modules/programs/mise/default-settings.nix b/tests/modules/programs/mise/default-settings.nix index de59e6297..d3729178c 100644 --- a/tests/modules/programs/mise/default-settings.nix +++ b/tests/modules/programs/mise/default-settings.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.mise = { package = config.lib.test.mkStubPackage { name = "mise"; }; diff --git a/tests/modules/programs/mise/fish-integration.nix b/tests/modules/programs/mise/fish-integration.nix index cb5891931..0d3bc4bec 100644 --- a/tests/modules/programs/mise/fish-integration.nix +++ b/tests/modules/programs/mise/fish-integration.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs = { mise = { package = config.lib.test.mkStubPackage { name = "mise"; }; @@ -13,4 +14,3 @@ assertFileRegex home-files/.config/fish/config.fish '/nix/store/.*mise.*/bin/mise activate fish | source' ''; } - diff --git a/tests/modules/programs/mise/nushell-integration.nix b/tests/modules/programs/mise/nushell-integration.nix index 926df987e..761478845 100644 --- a/tests/modules/programs/mise/nushell-integration.nix +++ b/tests/modules/programs/mise/nushell-integration.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs = { mise = { package = config.lib.test.mkStubPackage { name = "mise"; }; diff --git a/tests/modules/programs/mise/zsh-integration.nix b/tests/modules/programs/mise/zsh-integration.nix index d9b2cdd90..46c9c4ceb 100644 --- a/tests/modules/programs/mise/zsh-integration.nix +++ b/tests/modules/programs/mise/zsh-integration.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs = { mise = { package = config.lib.test.mkStubPackage { name = "mise"; }; @@ -13,4 +14,3 @@ assertFileRegex home-files/.zshrc 'eval "$(/nix/store/.*mise.*/bin/mise activate zsh)"' ''; } - diff --git a/tests/modules/programs/mods/basic-configuration.nix b/tests/modules/programs/mods/basic-configuration.nix index 31b97276a..5ed807b78 100644 --- a/tests/modules/programs/mods/basic-configuration.nix +++ b/tests/modules/programs/mods/basic-configuration.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { programs.mods = { enable = true; @@ -8,7 +9,11 @@ apis = { ollama = { base-url = "http://localhost:11434/api"; - models = { "llama3.2" = { max-input-chars = 650000; }; }; + models = { + "llama3.2" = { + max-input-chars = 650000; + }; + }; }; }; }; diff --git a/tests/modules/programs/mpv/mpv-example-settings.nix b/tests/modules/programs/mpv/mpv-example-settings.nix index 972ccfdbc..507606764 100644 --- a/tests/modules/programs/mpv/mpv-example-settings.nix +++ b/tests/modules/programs/mpv/mpv-example-settings.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { programs.mpv = { @@ -31,7 +36,9 @@ }; profiles = { - fast = { vo = "vdpau"; }; + fast = { + vo = "vdpau"; + }; "protocol.dvd" = { profile-desc = "profile for dvd:// streams"; alang = "en"; diff --git a/tests/modules/programs/mpv/mpv-invalid-settings.nix b/tests/modules/programs/mpv/mpv-invalid-settings.nix index 9f661cdd4..3600c97c3 100644 --- a/tests/modules/programs/mpv/mpv-invalid-settings.nix +++ b/tests/modules/programs/mpv/mpv-invalid-settings.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { programs.mpv = { @@ -8,13 +13,18 @@ }; test.stubs = { - mpv = { extraAttrs.override = { ... }: pkgs.emptyDirectory; }; + mpv = { + extraAttrs.override = { ... }: pkgs.emptyDirectory; + }; - mpvScript = { extraAttrs = { scriptName = "something"; }; }; + mpvScript = { + extraAttrs = { + scriptName = "something"; + }; + }; }; test.asserts.assertions.expected = [ - '' - The programs.mpv "package" option is mutually exclusive with "scripts" option.'' + ''The programs.mpv "package" option is mutually exclusive with "scripts" option.'' ]; } diff --git a/tests/modules/programs/mu/custom-configuration.nix b/tests/modules/programs/mu/custom-configuration.nix index dbaf3d18f..439e91553 100644 --- a/tests/modules/programs/mu/custom-configuration.nix +++ b/tests/modules/programs/mu/custom-configuration.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ imports = [ ../../accounts/email-test-accounts.nix ]; accounts.email.accounts = { diff --git a/tests/modules/programs/mujmap/default.nix b/tests/modules/programs/mujmap/default.nix index 8de0e917c..84fd7e14c 100644 --- a/tests/modules/programs/mujmap/default.nix +++ b/tests/modules/programs/mujmap/default.nix @@ -1,5 +1,4 @@ { mujmap-defaults = ./mujmap-defaults.nix; - mujmap-fqdn-and-session-url-specified = - ./mujmap-fqdn-and-session-url-specified.nix; + mujmap-fqdn-and-session-url-specified = ./mujmap-fqdn-and-session-url-specified.nix; } diff --git a/tests/modules/programs/mujmap/mujmap-defaults.nix b/tests/modules/programs/mujmap/mujmap-defaults.nix index d1a71f180..443c60c54 100644 --- a/tests/modules/programs/mujmap/mujmap-defaults.nix +++ b/tests/modules/programs/mujmap/mujmap-defaults.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ imports = [ ../../accounts/email-test-accounts.nix ]; config = { @@ -13,9 +14,7 @@ nmt.script = '' assertFileExists home-files/Mail/hm@example.com/mujmap.toml - assertFileContent home-files/Mail/hm@example.com/mujmap.toml ${ - ./mujmap-defaults-expected.toml - } + assertFileContent home-files/Mail/hm@example.com/mujmap.toml ${./mujmap-defaults-expected.toml} ''; }; } diff --git a/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix b/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix index 6ae87f832..a33db2791 100644 --- a/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix +++ b/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ imports = [ ../../accounts/email-test-accounts.nix ]; config = { @@ -14,9 +15,7 @@ nmt.script = '' assertFileExists home-files/Mail/hm@example.com/mujmap.toml - assertFileContent home-files/Mail/hm@example.com/mujmap.toml ${ - ./mujmap-defaults-expected.toml - } + assertFileContent home-files/Mail/hm@example.com/mujmap.toml ${./mujmap-defaults-expected.toml} ''; }; } diff --git a/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix b/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix index bf916dfbe..411112b81 100644 --- a/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix +++ b/tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix @@ -20,11 +20,17 @@ } { key = "J"; - command = [ "select_item" "scroll_down" ]; + command = [ + "select_item" + "scroll_down" + ]; } { key = "K"; - command = [ "select_item" "scroll_up" ]; + command = [ + "select_item" + "scroll_up" + ]; } { key = "x"; diff --git a/tests/modules/programs/ne/defprefs.nix b/tests/modules/programs/ne/defprefs.nix index 1fd8cd7f5..bb169f1a8 100644 --- a/tests/modules/programs/ne/defprefs.nix +++ b/tests/modules/programs/ne/defprefs.nix @@ -7,7 +7,8 @@ let defined through automaticPreferences ''; -in { +in +{ programs.ne = { enable = true; defaultPreferences = defpref; @@ -15,13 +16,10 @@ in { }; nmt = { - description = - "Check that it gracefully handles the case of both defaultPreferences and automaticPreferences.'.default' being set, defaulting to the former."; + 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 - } + 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 2024b3b6a..5e95f4977 100644 --- a/tests/modules/programs/ne/passthroughs.nix +++ b/tests/modules/programs/ne/passthroughs.nix @@ -36,12 +36,11 @@ let checkFile = filename: contents: '' assertFileExists home-files/.ne/${filename} - assertFileContent home-files/.ne/${filename} ${ - builtins.toFile "checkFile" contents - } + assertFileContent home-files/.ne/${filename} ${builtins.toFile "checkFile" contents} ''; -in { +in +{ programs.ne = { enable = true; inherit keybindings; @@ -58,9 +57,9 @@ in { (checkFile ".menus" menus) # Generates a check command for each entry in automaticPreferences. - (lib.concatStringsSep "\n" (lib.mapAttrsToList - (extension: contents: checkFile "${extension}#ap" contents) - automaticPreferences)) + (lib.concatStringsSep "\n" ( + lib.mapAttrsToList (extension: contents: checkFile "${extension}#ap" contents) automaticPreferences + )) ]; }; } diff --git a/tests/modules/programs/neomutt/default.nix b/tests/modules/programs/neomutt/default.nix index 5666ade09..fc9677ca8 100644 --- a/tests/modules/programs/neomutt/default.nix +++ b/tests/modules/programs/neomutt/default.nix @@ -5,8 +5,7 @@ neomutt-not-primary = ./neomutt-not-primary.nix; neomutt-with-binds = ./neomutt-with-binds.nix; neomutt-with-binds-with-warning = ./neomutt-with-binds-with-warning.nix; - neomutt-with-binds-invalid-settings = - ./neomutt-with-binds-invalid-settings.nix; + neomutt-with-binds-invalid-settings = ./neomutt-with-binds-invalid-settings.nix; neomutt-with-gpg = ./neomutt-with-gpg.nix; neomutt-no-folder-change = ./neomutt-no-folder-change.nix; neomutt-with-named-mailboxes = ./neomutt-with-named-mailboxes.nix; diff --git a/tests/modules/programs/neomutt/neomutt-no-folder-change.nix b/tests/modules/programs/neomutt/neomutt-no-folder-change.nix index 3d6aa86dd..0d5feedbc 100644 --- a/tests/modules/programs/neomutt/neomutt-no-folder-change.nix +++ b/tests/modules/programs/neomutt/neomutt-no-folder-change.nix @@ -14,8 +14,6 @@ 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 - } + 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 8389f9709..30c760325 100644 --- a/tests/modules/programs/neomutt/neomutt-not-primary.nix +++ b/tests/modules/programs/neomutt/neomutt-not-primary.nix @@ -10,8 +10,6 @@ nmt.script = '' assertFileExists home-files/.config/neomutt/neomuttrc - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ - ./neomutt-not-primary-expected.conf - } + assertFileContent $(normalizeStorePaths 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 274fb5db8..3fee22ea9 100644 --- a/tests/modules/programs/neomutt/neomutt-unmailboxes.nix +++ b/tests/modules/programs/neomutt/neomutt-unmailboxes.nix @@ -14,9 +14,6 @@ nmt.script = '' assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-unmailboxes-expected.conf - } + 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 1b420028f..d2f9cbe87 100644 --- a/tests/modules/programs/neomutt/neomutt-with-binds-invalid-settings.nix +++ b/tests/modules/programs/neomutt/neomutt-with-binds-invalid-settings.nix @@ -2,17 +2,21 @@ programs.neomutt = { enable = true; - binds = [{ - action = "complete-query"; - key = ""; - map = [ ]; - }]; + binds = [ + { + action = "complete-query"; + key = ""; + map = [ ]; + } + ]; - macros = [{ - action = "?^K="; - key = "c"; - map = [ ]; - }]; + macros = [ + { + action = "?^K="; + key = "c"; + map = [ ]; + } + ]; }; test.asserts.assertions.expected = [ 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 bb0a0f89b..9471a47a2 100644 --- a/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix +++ b/tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix @@ -27,7 +27,10 @@ { action = "sidebar-prev"; key = "\\Cp"; - map = [ "index" "pager" ]; + map = [ + "index" + "pager" + ]; } ]; @@ -40,7 +43,10 @@ { action = "?^K="; key = "c"; - map = [ "index" "pager" ]; + map = [ + "index" + "pager" + ]; } ]; }; @@ -52,11 +58,7 @@ 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-binds-expected.conf - } - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/hm@example.com) ${ - ./hm-example.com-expected - } + assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${./neomutt-with-binds-expected.conf} + assertFileContent $(normalizeStorePaths 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 6fd8b8ff8..b08bd5419 100644 --- a/tests/modules/programs/neomutt/neomutt-with-binds.nix +++ b/tests/modules/programs/neomutt/neomutt-with-binds.nix @@ -27,7 +27,10 @@ { action = "sidebar-prev"; key = "\\Cp"; - map = [ "index" "pager" ]; + map = [ + "index" + "pager" + ]; } ]; @@ -40,7 +43,10 @@ { action = "?^K="; key = "c"; - map = [ "index" "pager" ]; + map = [ + "index" + "pager" + ]; } ]; }; @@ -48,11 +54,7 @@ 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-binds-expected.conf - } - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/hm@example.com) ${ - ./hm-example.com-expected - } + assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${./neomutt-with-binds-expected.conf} + assertFileContent $(normalizeStorePaths 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 9b43fc703..efa34d924 100644 --- a/tests/modules/programs/neomutt/neomutt-with-gpg.nix +++ b/tests/modules/programs/neomutt/neomutt-with-gpg.nix @@ -17,11 +17,7 @@ nmt.script = '' assertFileExists home-files/.config/neomutt/neomuttrc assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ - ./neomutt-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-gpg-expected.conf - } + assertFileContent $(normalizeStorePaths 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 65ce1f22c..4876ae6be 100644 --- a/tests/modules/programs/neomutt/neomutt-with-imap-type-mailboxes.nix +++ b/tests/modules/programs/neomutt/neomutt-with-imap-type-mailboxes.nix @@ -32,18 +32,12 @@ 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 - } + 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 - } + 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 5d71aed68..cc66f068c 100644 --- a/tests/modules/programs/neomutt/neomutt-with-imap.nix +++ b/tests/modules/programs/neomutt/neomutt-with-imap.nix @@ -19,18 +19,12 @@ 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 - } + 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 - } + 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 b711307b7..6618c1b3d 100644 --- a/tests/modules/programs/neomutt/neomutt-with-msmtp.nix +++ b/tests/modules/programs/neomutt/neomutt-with-msmtp.nix @@ -19,11 +19,7 @@ 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 - } + 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 bbd3afb5a..5899876e9 100644 --- a/tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix +++ b/tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix @@ -31,11 +31,7 @@ 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-named-mailboxes-expected.conf - } - assertFileContent home-files/.config/neomutt/hm@example.com ${ - ./hm-example.com-expected - } + assertFileContent $(normalizeStorePaths 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 3700d0efe..5dce82971 100644 --- a/tests/modules/programs/neomutt/neomutt-with-signature-command.nix +++ b/tests/modules/programs/neomutt/neomutt-with-signature-command.nix @@ -28,12 +28,8 @@ 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/neomuttrc ${./neomutt-expected.conf} expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") - assertFileContent "$expectedSignature" ${ - ./hm-example.com-signature-command-expected - } + 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 347db9a3d..4e98f53b7 100644 --- a/tests/modules/programs/neomutt/neomutt-with-signature.nix +++ b/tests/modules/programs/neomutt/neomutt-with-signature.nix @@ -29,12 +29,8 @@ nmt.script = '' assertFileExists home-files/.config/neomutt/neomuttrc assertFileExists home-files/.config/neomutt/hm@example.com - assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${ - ./neomutt-expected.conf - } + assertFileContent $(normalizeStorePaths home-files/.config/neomutt/neomuttrc) ${./neomutt-expected.conf} expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") - assertFileContent "$expectedSignature" ${ - ./hm-example.com-signature-expected - } + 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 441985cac..e91e4e92f 100644 --- a/tests/modules/programs/neomutt/neomutt-with-starttls.nix +++ b/tests/modules/programs/neomutt/neomutt-with-starttls.nix @@ -23,11 +23,7 @@ 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 - } + 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 65d74a4f9..f75fe208c 100644 --- a/tests/modules/programs/neomutt/neomutt.nix +++ b/tests/modules/programs/neomutt/neomutt.nix @@ -22,11 +22,7 @@ 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 - } + 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/neovim/coc-config.nix b/tests/modules/programs/neovim/coc-config.nix index cdb879a0f..f13104eb3 100644 --- a/tests/modules/programs/neovim/coc-config.nix +++ b/tests/modules/programs/neovim/coc-config.nix @@ -20,4 +20,3 @@ 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 32f02fb70..b939452e7 100644 --- a/tests/modules/programs/neovim/extra-lua-init.nix +++ b/tests/modules/programs/neovim/extra-lua-init.nix @@ -11,10 +11,8 @@ nmt.script = '' nvimFolder="home-files/.config/nvim" - assertFileContent "$nvimFolder/init.lua" ${ - builtins.toFile "init.lua-expected" '' - -- extraLuaConfig - '' - } + 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 69d0d08d3..476aa8d41 100644 --- a/tests/modules/programs/neovim/no-init.nix +++ b/tests/modules/programs/neovim/no-init.nix @@ -10,7 +10,12 @@ withPython3 = true; withRuby = false; - extraPython3Packages = (ps: with ps; [ jedi pynvim ]); + extraPython3Packages = ( + ps: with ps; [ + jedi + pynvim + ] + ); # plugins without associated config should not trigger the creation of init.vim plugins = with pkgs.vimPlugins; [ diff --git a/tests/modules/programs/neovim/plugin-config.nix b/tests/modules/programs/neovim/plugin-config.nix index 4b8c3abdc..51c7ff50a 100644 --- a/tests/modules/programs/neovim/plugin-config.nix +++ b/tests/modules/programs/neovim/plugin-config.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, realPkgs, ... }: +{ + config, + lib, + pkgs, + realPkgs, + ... +}: lib.mkIf config.test.enableBig { programs.neovim = { @@ -29,4 +35,3 @@ lib.mkIf config.test.enableBig { assertFileContains "$vimout" "HM_PLUGINS_CONFIG" ''; } - diff --git a/tests/modules/programs/neovim/runtime.nix b/tests/modules/programs/neovim/runtime.nix index 088f75ace..2cf653023 100644 --- a/tests/modules/programs/neovim/runtime.nix +++ b/tests/modules/programs/neovim/runtime.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, realPkgs, ... }: +{ + config, + lib, + pkgs, + realPkgs, + ... +}: lib.mkIf config.test.enableBig { programs.neovim = lib.mkMerge [ @@ -17,24 +23,38 @@ lib.mkIf config.test.enableBig { }; } ]; - 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}" - ]; + 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 ]; + extraPython3Packages = + ps: with ps; [ + jedi + pynvim + ]; extraLuaPackages = ps: with ps; [ luacheck ]; } { - extraPython3Packages = ps: with ps; [ jedi pynvim ]; + extraPython3Packages = + ps: with ps; [ + jedi + pynvim + ]; extraLuaPackages = ps: with ps; [ luacheck ]; } ]; diff --git a/tests/modules/programs/neovim/stubs.nix b/tests/modules/programs/neovim/stubs.nix index edd5cebf2..fb6a6dd7f 100644 --- a/tests/modules/programs/neovim/stubs.nix +++ b/tests/modules/programs/neovim/stubs.nix @@ -19,16 +19,19 @@ } ''; - meta = let stub = "stub"; - in { - description = stub; - longDescription = stub; - homepage = stub; - mainProgram = stub; - license = [ stub ]; - maintainers = [ stub ]; - platforms = lib.platforms.all; - }; + 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 592d0f8e6..c8c3ca856 100644 --- a/tests/modules/programs/newsboat/newsboat-basics-2003.nix +++ b/tests/modules/programs/newsboat/newsboat-basics-2003.nix @@ -7,14 +7,19 @@ urls = [ { url = "http://example.org/feed.xml"; - tags = [ "tag1" "tag2" ]; + tags = [ + "tag1" + "tag2" + ]; title = "Cool feed"; } { url = "http://example.org/feed2.xml"; } ]; - queries = { "foo" = ''rssurl =~ "example.com"''; }; + queries = { + "foo" = ''rssurl =~ "example.com"''; + }; }; nmt.script = '' diff --git a/tests/modules/programs/newsboat/newsboat-basics-2105.nix b/tests/modules/programs/newsboat/newsboat-basics-2105.nix index 8cc46754b..94c0474bb 100644 --- a/tests/modules/programs/newsboat/newsboat-basics-2105.nix +++ b/tests/modules/programs/newsboat/newsboat-basics-2105.nix @@ -7,14 +7,19 @@ urls = [ { url = "http://example.org/feed.xml"; - tags = [ "tag1" "tag2" ]; + tags = [ + "tag1" + "tag2" + ]; title = "Cool feed"; } { url = "http://example.org/feed2.xml"; } ]; - queries = { "foo" = ''rssurl =~ "example.com"''; }; + queries = { + "foo" = ''rssurl =~ "example.com"''; + }; }; # The format didn't change since 20.03, just the location. diff --git a/tests/modules/programs/newsboat/newsboat-basics.nix b/tests/modules/programs/newsboat/newsboat-basics.nix index fe417a87a..7c44f5542 100644 --- a/tests/modules/programs/newsboat/newsboat-basics.nix +++ b/tests/modules/programs/newsboat/newsboat-basics.nix @@ -5,14 +5,19 @@ urls = [ { url = "http://example.org/feed.xml"; - tags = [ "tag1" "tag2" ]; + tags = [ + "tag1" + "tag2" + ]; title = "Cool feed"; } { url = "http://example.org/feed2.xml"; } ]; - queries = { "foo" = ''rssurl =~ "example.com"''; }; + queries = { + "foo" = ''rssurl =~ "example.com"''; + }; }; nmt.script = '' diff --git a/tests/modules/programs/nheko/nheko-empty-settings.nix b/tests/modules/programs/nheko/nheko-empty-settings.nix index 6979ba1df..16c97c38d 100644 --- a/tests/modules/programs/nheko/nheko-empty-settings.nix +++ b/tests/modules/programs/nheko/nheko-empty-settings.nix @@ -1,11 +1,10 @@ { pkgs, ... }: let - configDir = if pkgs.stdenv.isDarwin then - "home-files/Library/Application Support" - else - "home-files/.config"; -in { + configDir = + if pkgs.stdenv.isDarwin then "home-files/Library/Application Support" else "home-files/.config"; +in +{ programs.nheko.enable = true; nmt.script = '' diff --git a/tests/modules/programs/nheko/nheko-example-settings.nix b/tests/modules/programs/nheko/nheko-example-settings.nix index 4700db2ca..877c2307e 100644 --- a/tests/modules/programs/nheko/nheko-example-settings.nix +++ b/tests/modules/programs/nheko/nheko-example-settings.nix @@ -1,16 +1,17 @@ { pkgs, ... }: let - configDir = if pkgs.stdenv.isDarwin then - "home-files/Library/Application Support" - else - "home-files/.config"; -in { + configDir = + if pkgs.stdenv.isDarwin then "home-files/Library/Application Support" else "home-files/.config"; +in +{ programs.nheko = { enable = true; settings = { - general = { disableCertificateValidation = false; }; + general = { + disableCertificateValidation = false; + }; auth = { accessToken = "MY_ACCESS_TOKEN"; @@ -19,9 +20,13 @@ in { userId = "@@user:matrix.org"; }; - sidebar = { width = 416; }; + sidebar = { + width = 416; + }; - settings = { scaleFactor = 0.7; }; + settings = { + scaleFactor = 0.7; + }; user = { alertOnNotification = true; 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 511dd7d0c..7c6ff5e7e 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 @@ -8,8 +8,9 @@ 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" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); programs.nix-index.enable = true; diff --git a/tests/modules/programs/nix-index/integrations.nix b/tests/modules/programs/nix-index/integrations.nix index 6bcda0502..67b819031 100644 --- a/tests/modules/programs/nix-index/integrations.nix +++ b/tests/modules/programs/nix-index/integrations.nix @@ -6,14 +6,16 @@ let /nix/store/.*command-not-found $argv end ''; -in { +in +{ 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" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); programs.nix-index.enable = true; diff --git a/tests/modules/programs/nix-your-shell/enable-shells.nix b/tests/modules/programs/nix-your-shell/enable-shells.nix index c593fd2b5..a0999e171 100644 --- a/tests/modules/programs/nix-your-shell/enable-shells.nix +++ b/tests/modules/programs/nix-your-shell/enable-shells.nix @@ -1,4 +1,10 @@ -{ lib, pkgs, realPkgs, config, ... }: +{ + lib, + pkgs, + realPkgs, + config, + ... +}: { programs = { @@ -15,25 +21,28 @@ _module.args.pkgs = lib.mkForce realPkgs; - nmt.script = let - nushellConfigDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then - "home-files/Library/Application Support/nushell" - else - "home-files/.config/nushell"; - in '' - assertFileExists home-files/.config/fish/config.fish - assertFileRegex \ - home-files/.config/fish/config.fish \ - '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell fish | source' + nmt.script = + let + nushellConfigDir = + if pkgs.stdenv.isDarwin && !config.xdg.enable then + "home-files/Library/Application Support/nushell" + else + "home-files/.config/nushell"; + in + '' + assertFileExists home-files/.config/fish/config.fish + assertFileRegex \ + home-files/.config/fish/config.fish \ + '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell fish | source' - assertFileExists ${nushellConfigDir}/config.nu - assertFileRegex \ - ${nushellConfigDir}/config.nu \ - 'source /nix/store/[^/]*-nix-your-shell-nushell-config.nu' + assertFileExists ${nushellConfigDir}/config.nu + assertFileRegex \ + ${nushellConfigDir}/config.nu \ + 'source /nix/store/[^/]*-nix-your-shell-nushell-config.nu' - assertFileExists home-files/.zshrc - assertFileRegex \ - home-files/.zshrc \ - '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell zsh | source /dev/stdin' - ''; + assertFileExists home-files/.zshrc + assertFileRegex \ + home-files/.zshrc \ + '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell zsh | source /dev/stdin' + ''; } diff --git a/tests/modules/programs/nnn/nnn.nix b/tests/modules/programs/nnn/nnn.nix index 948317ae7..47d28d0ff 100644 --- a/tests/modules/programs/nnn/nnn.nix +++ b/tests/modules/programs/nnn/nnn.nix @@ -10,7 +10,10 @@ v = "~/Videos"; }; package = pkgs.nnnDummy; - extraPackages = with pkgs; [ foo bar ]; + extraPackages = with pkgs; [ + foo + bar + ]; plugins = { src = ./plugins; mappings = { @@ -31,13 +34,16 @@ runHook postInstall ''; - foo = { name = "foo"; }; - bar = { name = "bar"; }; + foo = { + name = "foo"; + }; + bar = { + name = "bar"; + }; }; nmt = { - description = - "Check if the binary is correctly wrapped and if the symlinks are made"; + description = "Check if the binary is correctly wrapped and if the symlinks are made"; script = '' assertDirectoryExists home-files/.config/nnn/plugins diff --git a/tests/modules/programs/nushell/example-settings.nix b/tests/modules/programs/nushell/example-settings.nix index cc9e8f8ec..0ec457943 100644 --- a/tests/modules/programs/nushell/example-settings.nix +++ b/tests/modules/programs/nushell/example-settings.nix @@ -1,4 +1,10 @@ -{ pkgs, realPkgs, config, lib, ... }: +{ + pkgs, + realPkgs, + config, + lib, + ... +}: { programs.nushell = { @@ -35,39 +41,42 @@ settings = { show_banner = false; display_errors.exit_code = false; - hooks.pre_execution = - [ (lib.hm.nushell.mkNushellInline ''{|| "pre_execution hook"}'') ]; + hooks.pre_execution = [ (lib.hm.nushell.mkNushellInline ''{|| "pre_execution hook"}'') ]; }; environmentVariables = { FOO = "BAR"; - LIST_VALUE = [ "foo" "bar" ]; + LIST_VALUE = [ + "foo" + "bar" + ]; PROMPT_COMMAND = lib.hm.nushell.mkNushellInline ''{|| "> "}''; ENV_CONVERSIONS.PATH = { - from_string = - lib.hm.nushell.mkNushellInline "{|s| $s | split row (char esep) }"; - to_string = - lib.hm.nushell.mkNushellInline "{|v| $v | str join (char esep) }"; + from_string = lib.hm.nushell.mkNushellInline "{|s| $s | split row (char esep) }"; + to_string = lib.hm.nushell.mkNushellInline "{|v| $v | str join (char esep) }"; }; }; }; - nmt.script = let - configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then - "home-files/Library/Application Support/nushell" - else - "home-files/.config/nushell"; - in '' - assertFileContent \ - "${configDir}/config.nu" \ - ${./config-expected.nu} - assertFileContent \ - "${configDir}/env.nu" \ - ${./env-expected.nu} - assertFileContent \ - "${configDir}/login.nu" \ - ${./login-expected.nu} - assertFileExists \ - "${configDir}/plugin.msgpackz" - ''; + nmt.script = + let + configDir = + if pkgs.stdenv.isDarwin && !config.xdg.enable then + "home-files/Library/Application Support/nushell" + else + "home-files/.config/nushell"; + in + '' + assertFileContent \ + "${configDir}/config.nu" \ + ${./config-expected.nu} + assertFileContent \ + "${configDir}/env.nu" \ + ${./env-expected.nu} + assertFileContent \ + "${configDir}/login.nu" \ + ${./login-expected.nu} + assertFileExists \ + "${configDir}/plugin.msgpackz" + ''; } diff --git a/tests/modules/programs/oh-my-posh/fish.nix b/tests/modules/programs/oh-my-posh/fish.nix index 9e890db45..973e0589d 100644 --- a/tests/modules/programs/oh-my-posh/fish.nix +++ b/tests/modules/programs/oh-my-posh/fish.nix @@ -11,8 +11,9 @@ }; # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - lib.mkForce (builtins.toFile "empty" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/oh-my-posh/nushell.nix b/tests/modules/programs/oh-my-posh/nushell.nix index a3fac426a..c23d8ea7d 100644 --- a/tests/modules/programs/oh-my-posh/nushell.nix +++ b/tests/modules/programs/oh-my-posh/nushell.nix @@ -1,4 +1,10 @@ -{ lib, pkgs, realPkgs, config, ... }: +{ + lib, + pkgs, + realPkgs, + config, + ... +}: { programs = { @@ -12,15 +18,18 @@ _module.args.pkgs = lib.mkForce realPkgs; - nmt.script = let - configFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then - "home-files/Library/Application Support/nushell/config.nu" - else - "home-files/.config/nushell/config.nu"; - in '' - assertFileExists "${configFile}" - assertFileRegex \ - "${configFile}" \ - 'source /nix/store/[^/]*-oh-my-posh-nushell-config.nu' - ''; + nmt.script = + let + configFile = + if pkgs.stdenv.isDarwin && !config.xdg.enable then + "home-files/Library/Application Support/nushell/config.nu" + else + "home-files/.config/nushell/config.nu"; + in + '' + assertFileExists "${configFile}" + assertFileRegex \ + "${configFile}" \ + 'source /nix/store/[^/]*-oh-my-posh-nushell-config.nu' + ''; } diff --git a/tests/modules/programs/openstackclient/openstackclient.nix b/tests/modules/programs/openstackclient/openstackclient.nix index 48d3d38f8..f7eaced57 100644 --- a/tests/modules/programs/openstackclient/openstackclient.nix +++ b/tests/modules/programs/openstackclient/openstackclient.nix @@ -14,7 +14,9 @@ }; publicClouds = { example-cloud = { - auth = { auth_url = "https://identity.cloud.example.com/v2.0"; }; + auth = { + auth_url = "https://identity.cloud.example.com/v2.0"; + }; }; }; diff --git a/tests/modules/programs/pandoc/csl.nix b/tests/modules/programs/pandoc/csl.nix index e23c53288..391f86212 100644 --- a/tests/modules/programs/pandoc/csl.nix +++ b/tests/modules/programs/pandoc/csl.nix @@ -13,4 +13,3 @@ ${./example.csl} ''; } - diff --git a/tests/modules/programs/pandoc/defaults.nix b/tests/modules/programs/pandoc/defaults.nix index 8e3fe39aa..272658d20 100644 --- a/tests/modules/programs/pandoc/defaults.nix +++ b/tests/modules/programs/pandoc/defaults.nix @@ -1,13 +1,22 @@ -{ config, lib, realPkgs, ... }: +{ + config, + lib, + realPkgs, + ... +}: -let cfg = config.programs.pandoc; +let + cfg = config.programs.pandoc; -in lib.mkIf config.test.enableBig { +in +lib.mkIf config.test.enableBig { programs.pandoc = { enable = true; defaults = { - metadata = { author = "John Doe"; }; + metadata = { + author = "John Doe"; + }; pdf-engine = "xelatex"; citeproc = true; }; @@ -27,4 +36,3 @@ in lib.mkIf config.test.enableBig { assertFileContent "$output" ${./output-expected} ''; } - diff --git a/tests/modules/programs/pandoc/templates.nix b/tests/modules/programs/pandoc/templates.nix index f72e0b8ae..12ab83050 100644 --- a/tests/modules/programs/pandoc/templates.nix +++ b/tests/modules/programs/pandoc/templates.nix @@ -2,7 +2,9 @@ programs.pandoc = { enable = true; - templates = { "default.latex" = ./template.latex; }; + templates = { + "default.latex" = ./template.latex; + }; }; test.stubs.pandoc = import ./stub.nix; @@ -13,4 +15,3 @@ ${./template.latex} ''; } - diff --git a/tests/modules/programs/pet/settings_21_05.nix b/tests/modules/programs/pet/settings_21_05.nix index 595737600..1cf3c5f36 100644 --- a/tests/modules/programs/pet/settings_21_05.nix +++ b/tests/modules/programs/pet/settings_21_05.nix @@ -7,13 +7,11 @@ nmt.script = '' assertFileContent home-files/.config/pet/config.toml \ - ${ - builtins.toFile "pet-settings.toml" '' - [General] - editor = "nvim" - selectcmd = "fzf" - snippetfile = "/home/hm-user/.config/pet/snippet.toml" - '' - } + ${builtins.toFile "pet-settings.toml" '' + [General] + editor = "nvim" + selectcmd = "fzf" + snippetfile = "/home/hm-user/.config/pet/snippet.toml" + ''} ''; } diff --git a/tests/modules/programs/pet/settings_21_11.nix b/tests/modules/programs/pet/settings_21_11.nix index 05bdc2449..a303e7fef 100644 --- a/tests/modules/programs/pet/settings_21_11.nix +++ b/tests/modules/programs/pet/settings_21_11.nix @@ -17,19 +17,17 @@ nmt.script = '' assertFileContent home-files/.config/pet/config.toml \ - ${ - builtins.toFile "pet-settings.toml" '' - [General] - backend = "Gitlab" - editor = "nvim" - selectcmd = "fzf" - snippetfile = "/home/hm-user/.config/pet/snippet.toml" + ${builtins.toFile "pet-settings.toml" '' + [General] + backend = "Gitlab" + editor = "nvim" + selectcmd = "fzf" + snippetfile = "/home/hm-user/.config/pet/snippet.toml" - [Gitlab] - access_token = "1234" - file_name = "pet-snippets.toml" - visibility = "public" - '' - } + [Gitlab] + access_token = "1234" + file_name = "pet-snippets.toml" + visibility = "public" + ''} ''; } diff --git a/tests/modules/programs/pet/snippets.nix b/tests/modules/programs/pet/snippets.nix index 09dbd17d0..306aa3958 100644 --- a/tests/modules/programs/pet/snippets.nix +++ b/tests/modules/programs/pet/snippets.nix @@ -1,11 +1,16 @@ { programs.pet = { enable = true; - snippets = [{ - description = "git: search full history for regex"; - command = "git log -p -G "; - tag = [ "git" "regex" ]; - }]; + snippets = [ + { + description = "git: search full history for regex"; + command = "git log -p -G "; + tag = [ + "git" + "regex" + ]; + } + ]; }; nmt.script = '' diff --git a/tests/modules/programs/pistol/associations.nix b/tests/modules/programs/pistol/associations.nix index 29158a489..346d2193a 100644 --- a/tests/modules/programs/pistol/associations.nix +++ b/tests/modules/programs/pistol/associations.nix @@ -14,23 +14,25 @@ } { fpath = ".*.md$"; - command = - "sh: bat --paging=never --color=always %pistol-filename% | head -8"; + command = "sh: bat --paging=never --color=always %pistol-filename% | head -8"; } ]; }; - nmt.script = let - expected = builtins.toFile "config-expected" '' - application/json bat %pistol-filename% - application/* hexyl %pistol-filename% - fpath .*.md$ sh: bat --paging=never --color=always %pistol-filename% | head -8''; - path = if pkgs.stdenv.hostPlatform.isDarwin then - "home-files/Library/Application Support/pistol/pistol.conf" - else - "home-files/.config/pistol/pistol.conf"; - in '' - assertFileExists '${path}' - assertFileContent '${path}' '${expected}' - ''; + nmt.script = + let + expected = builtins.toFile "config-expected" '' + application/json bat %pistol-filename% + application/* hexyl %pistol-filename% + fpath .*.md$ sh: bat --paging=never --color=always %pistol-filename% | head -8''; + path = + if pkgs.stdenv.hostPlatform.isDarwin then + "home-files/Library/Application Support/pistol/pistol.conf" + else + "home-files/.config/pistol/pistol.conf"; + in + '' + assertFileExists '${path}' + assertFileContent '${path}' '${expected}' + ''; } diff --git a/tests/modules/programs/pistol/config.nix b/tests/modules/programs/pistol/config.nix index 8df524a3a..02cd3946f 100644 --- a/tests/modules/programs/pistol/config.nix +++ b/tests/modules/programs/pistol/config.nix @@ -10,10 +10,14 @@ }; test.asserts.assertions.expected = [ - (let offendingFile = toString ./config.nix; - in '' - The option definition `programs.pistol.config' in `${offendingFile}' no longer has any effect; please remove it. - Pistol is now configured with programs.pistol.associations. - '') + ( + let + offendingFile = toString ./config.nix; + in + '' + The option definition `programs.pistol.config' in `${offendingFile}' no longer has any effect; please remove it. + Pistol is now configured with programs.pistol.associations. + '' + ) ]; } diff --git a/tests/modules/programs/pistol/double-association.nix b/tests/modules/programs/pistol/double-association.nix index 902c5c4aa..f07649e06 100644 --- a/tests/modules/programs/pistol/double-association.nix +++ b/tests/modules/programs/pistol/double-association.nix @@ -2,15 +2,19 @@ programs.pistol = { enable = true; # contains both fpath and mime - associations = [{ - fpath = ".*.md$"; - mime = "application/json"; - command = "bat %pistol-filename%"; - }]; + associations = [ + { + fpath = ".*.md$"; + mime = "application/json"; + command = "bat %pistol-filename%"; + } + ]; }; - test.asserts.assertions.expected = ['' - Each entry in programs.pistol.associations must contain exactly one - of fpath or mime. - '']; + 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 ff47a2381..536c11e1e 100644 --- a/tests/modules/programs/pistol/missing-association.nix +++ b/tests/modules/programs/pistol/missing-association.nix @@ -2,11 +2,13 @@ programs.pistol = { enable = true; # contains no fpath or mime value - associations = [{ command = "bat %pistol-filename%"; }]; + associations = [ { command = "bat %pistol-filename%"; } ]; }; - test.asserts.assertions.expected = ['' - Each entry in programs.pistol.associations must contain exactly one - of fpath or mime. - '']; + 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/fish.nix b/tests/modules/programs/pls/fish.nix index 869feaf8c..dc49ef283 100644 --- a/tests/modules/programs/pls/fish.nix +++ b/tests/modules/programs/pls/fish.nix @@ -12,8 +12,9 @@ }; # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - lib.mkForce (builtins.toFile "empty" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/poetry/custom-settings.nix b/tests/modules/programs/poetry/custom-settings.nix index 376f8bf1f..ed7f1ba4d 100644 --- a/tests/modules/programs/poetry/custom-settings.nix +++ b/tests/modules/programs/poetry/custom-settings.nix @@ -9,17 +9,18 @@ }; }; - nmt.script = let - expectedConfDir = - if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/pypoetry/config.toml"; - expectedConfigContent = pkgs.writeText "poetry.config-custom.expected" '' - [virtualenvs] - create = true - in-project = true + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/pypoetry/config.toml"; + expectedConfigContent = pkgs.writeText "poetry.config-custom.expected" '' + [virtualenvs] + create = true + in-project = true + ''; + in + '' + assertFileExists "${expectedConfigPath}" + assertFileContent "${expectedConfigPath}" "${expectedConfigContent}" ''; - in '' - assertFileExists "${expectedConfigPath}" - assertFileContent "${expectedConfigPath}" "${expectedConfigContent}" - ''; } diff --git a/tests/modules/programs/poetry/default-settings.nix b/tests/modules/programs/poetry/default-settings.nix index 31d910047..db1fe4d91 100644 --- a/tests/modules/programs/poetry/default-settings.nix +++ b/tests/modules/programs/poetry/default-settings.nix @@ -1,13 +1,16 @@ { pkgs, ... }: { - programs.poetry = { enable = true; }; + programs.poetry = { + enable = true; + }; - nmt.script = let - expectedConfDir = - if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/pypoetry/config.toml"; - in '' - assertPathNotExists "${expectedConfigPath}" - ''; + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/pypoetry/config.toml"; + in + '' + assertPathNotExists "${expectedConfigPath}" + ''; } diff --git a/tests/modules/programs/powerline-go/bash.nix b/tests/modules/programs/powerline-go/bash.nix index bab8b38d3..aead1a180 100644 --- a/tests/modules/programs/powerline-go/bash.nix +++ b/tests/modules/programs/powerline-go/bash.nix @@ -6,9 +6,14 @@ enable = true; newline = true; modules = [ "nix-shell" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; + pathAliases = { + "\\~/project/foo" = "prj-foo"; + }; settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; + 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 6b7c2e3d3..fbf61df34 100644 --- a/tests/modules/programs/powerline-go/bashmodulesright.nix +++ b/tests/modules/programs/powerline-go/bashmodulesright.nix @@ -7,9 +7,14 @@ newline = true; modules = [ "nix-shell" ]; modulesRight = [ "git" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; + pathAliases = { + "\\~/project/foo" = "prj-foo"; + }; settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; + 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 f7749c2aa..b8670f6ec 100644 --- a/tests/modules/programs/powerline-go/fish.nix +++ b/tests/modules/programs/powerline-go/fish.nix @@ -8,16 +8,22 @@ enable = true; newline = true; modules = [ "nix-shell" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; + pathAliases = { + "\\~/project/foo" = "prj-foo"; + }; settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; + 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" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/powerline-go/zsh.nix b/tests/modules/programs/powerline-go/zsh.nix index 66845dd53..d95bf767a 100644 --- a/tests/modules/programs/powerline-go/zsh.nix +++ b/tests/modules/programs/powerline-go/zsh.nix @@ -6,9 +6,14 @@ enable = true; newline = true; modules = [ "nix-shell" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; + pathAliases = { + "\\~/project/foo" = "prj-foo"; + }; settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; + 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 acd43b6fa..7075bb0bc 100644 --- a/tests/modules/programs/powerline-go/zshmodulesright.nix +++ b/tests/modules/programs/powerline-go/zshmodulesright.nix @@ -7,9 +7,14 @@ newline = true; modules = [ "nix-shell" ]; modulesRight = [ "git" ]; - pathAliases = { "\\~/project/foo" = "prj-foo"; }; + pathAliases = { + "\\~/project/foo" = "prj-foo"; + }; settings = { - ignore-repos = [ "/home/me/project1" "/home/me/project2" ]; + ignore-repos = [ + "/home/me/project1" + "/home/me/project2" + ]; }; }; }; diff --git a/tests/modules/programs/pqiv/settings.nix b/tests/modules/programs/pqiv/settings.nix index 117fa6f04..af7acea88 100644 --- a/tests/modules/programs/pqiv/settings.nix +++ b/tests/modules/programs/pqiv/settings.nix @@ -18,16 +18,14 @@ nmt.script = '' assertFileExists home-files/.config/pqivrc - assertFileContent home-files/.config/pqivrc ${ - builtins.toFile "pqiv.expected" '' - [options] - hide-info-box = 1 - thumbnail-size = 256x256 + assertFileContent home-files/.config/pqivrc ${builtins.toFile "pqiv.expected" '' + [options] + hide-info-box = 1 + thumbnail-size = 256x256 - [keybindings] - t { montage_mode_enter() } + [keybindings] + t { montage_mode_enter() } - '' - } + ''} ''; } diff --git a/tests/modules/programs/qcal/http-calendar.nix b/tests/modules/programs/qcal/http-calendar.nix index bc5200ce2..08e1ffb79 100644 --- a/tests/modules/programs/qcal/http-calendar.nix +++ b/tests/modules/programs/qcal/http-calendar.nix @@ -2,13 +2,13 @@ programs.qcal.enable = true; accounts.calendar.accounts.test = { qcal.enable = true; - remote = { url = "https://example.com/events.ical"; }; + remote = { + url = "https://example.com/events.ical"; + }; }; nmt.script = '' assertFileExists home-files/.config/qcal/config.json - assertFileContent home-files/.config/qcal/config.json ${ - ./http-calendar.json-expected - } + assertFileContent home-files/.config/qcal/config.json ${./http-calendar.json-expected} ''; } diff --git a/tests/modules/programs/qcal/mixed.nix b/tests/modules/programs/qcal/mixed.nix index 0083d7945..de06c76ca 100644 --- a/tests/modules/programs/qcal/mixed.nix +++ b/tests/modules/programs/qcal/mixed.nix @@ -2,14 +2,20 @@ programs.qcal.enable = true; accounts.calendar.accounts = { http-test = { - remote = { url = "https://example.com/events.ical"; }; + remote = { + url = "https://example.com/events.ical"; + }; qcal.enable = true; }; webdav-test = { remote = { url = "https://cal.example.com/anton/work"; userName = "anton"; - passwordCommand = [ "pass" "show" "calendar" ]; + passwordCommand = [ + "pass" + "show" + "calendar" + ]; }; qcal.enable = true; }; @@ -17,8 +23,6 @@ nmt.script = '' assertFileExists home-files/.config/qcal/config.json - assertFileContent home-files/.config/qcal/config.json ${ - ./mixed.json-expected - } + assertFileContent home-files/.config/qcal/config.json ${./mixed.json-expected} ''; } diff --git a/tests/modules/programs/qcal/webdav-calendar.nix b/tests/modules/programs/qcal/webdav-calendar.nix index 9cfe5d32a..e7b5c0c6e 100644 --- a/tests/modules/programs/qcal/webdav-calendar.nix +++ b/tests/modules/programs/qcal/webdav-calendar.nix @@ -9,14 +9,16 @@ remote = { url = "https://cal.example.com/anton/work"; userName = "anton"; - passwordCommand = [ "pass" "show" "calendar" ]; + passwordCommand = [ + "pass" + "show" + "calendar" + ]; }; }; nmt.script = '' assertFileExists home-files/.config/qcal/config.json - assertFileContent home-files/.config/qcal/config.json ${ - ./webdav-calendar.json-expected - } + assertFileContent home-files/.config/qcal/config.json ${./webdav-calendar.json-expected} ''; } diff --git a/tests/modules/programs/qutebrowser/greasemonkey.nix b/tests/modules/programs/qutebrowser/greasemonkey.nix index 9377a3951..9ee4c48c8 100644 --- a/tests/modules/programs/qutebrowser/greasemonkey.nix +++ b/tests/modules/programs/qutebrowser/greasemonkey.nix @@ -11,20 +11,24 @@ let // ==/UserScript== ''; -in { +in +{ programs.qutebrowser = { enable = true; greasemonkey = [ greasemonkeyScript ]; }; - nmt.script = let - scriptDir = if pkgs.stdenv.hostPlatform.isDarwin then - ".qutebrowser/greasemonkey" - else - ".config/qutebrowser/greasemonkey"; - in '' - assertFileContent \ - home-files/${scriptDir}/qutebrowser-greasemonkey.js \ - ${greasemonkeyScript} - ''; + nmt.script = + let + scriptDir = + if pkgs.stdenv.hostPlatform.isDarwin then + ".qutebrowser/greasemonkey" + else + ".config/qutebrowser/greasemonkey"; + in + '' + assertFileContent \ + home-files/${scriptDir}/qutebrowser-greasemonkey.js \ + ${greasemonkeyScript} + ''; } diff --git a/tests/modules/programs/qutebrowser/keybindings.nix b/tests/modules/programs/qutebrowser/keybindings.nix index 0e1400fde..f395491fb 100644 --- a/tests/modules/programs/qutebrowser/keybindings.nix +++ b/tests/modules/programs/qutebrowser/keybindings.nix @@ -17,27 +17,30 @@ "config-cycle scrolling.bar never always" ]; }; - prompt = { "" = "prompt-yes"; }; + prompt = { + "" = "prompt-yes"; + }; }; }; - nmt.script = let - qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then - ".qutebrowser/config.py" - else - ".config/qutebrowser/config.py"; - in '' - assertFileContent \ - home-files/${qutebrowserConfig} \ - ${ - builtins.toFile "qutebrowser-expected-config.py" '' + nmt.script = + let + qutebrowserConfig = + if pkgs.stdenv.hostPlatform.isDarwin then + ".qutebrowser/config.py" + else + ".config/qutebrowser/config.py"; + in + '' + assertFileContent \ + home-files/${qutebrowserConfig} \ + ${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") config.unbind(":", mode="normal") config.bind("", "spawn mpv {url}", mode="normal") config.bind("", "config-cycle tabs.show never always ;; config-cycle statusbar.show in-mode always ;; config-cycle scrolling.bar never always", mode="normal") - config.bind("", "prompt-yes", mode="prompt")'' - } - ''; + config.bind("", "prompt-yes", mode="prompt")''} + ''; } diff --git a/tests/modules/programs/qutebrowser/quickmarks.nix b/tests/modules/programs/qutebrowser/quickmarks.nix index 524808c51..78b8a461d 100644 --- a/tests/modules/programs/qutebrowser/quickmarks.nix +++ b/tests/modules/programs/qutebrowser/quickmarks.nix @@ -10,18 +10,19 @@ }; }; - nmt.script = let - quickmarksFile = if pkgs.stdenv.hostPlatform.isDarwin then - ".qutebrowser/quickmarks" - else - ".config/qutebrowser/quickmarks"; - in '' - assertFileContent \ - home-files/${quickmarksFile} \ - ${ - builtins.toFile "qutebrowser-expected-quickmarks" '' + nmt.script = + let + quickmarksFile = + if pkgs.stdenv.hostPlatform.isDarwin then + ".qutebrowser/quickmarks" + else + ".config/qutebrowser/quickmarks"; + in + '' + assertFileContent \ + home-files/${quickmarksFile} \ + ${builtins.toFile "qutebrowser-expected-quickmarks" '' home-manager https://github.com/nix-community/home-manager - nixpkgs https://github.com/NixOS/nixpkgs'' - } - ''; + nixpkgs https://github.com/NixOS/nixpkgs''} + ''; } diff --git a/tests/modules/programs/qutebrowser/settings.nix b/tests/modules/programs/qutebrowser/settings.nix index 91a07132a..86788b52b 100644 --- a/tests/modules/programs/qutebrowser/settings.nix +++ b/tests/modules/programs/qutebrowser/settings.nix @@ -12,7 +12,10 @@ }; tabs.bar.bg = "#000000"; }; - spellcheck.languages = [ "en-US" "sv-SE" ]; + spellcheck.languages = [ + "en-US" + "sv-SE" + ]; tabs.tabs_are_windows = true; }; @@ -21,16 +24,18 @@ ''; }; - nmt.script = let - qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then - ".qutebrowser/config.py" - else - ".config/qutebrowser/config.py"; - in '' - assertFileContent \ - home-files/${qutebrowserConfig} \ - ${ - builtins.toFile "qutebrowser-expected-config.py" '' + nmt.script = + let + qutebrowserConfig = + if pkgs.stdenv.hostPlatform.isDarwin then + ".qutebrowser/config.py" + else + ".config/qutebrowser/config.py"; + in + '' + assertFileContent \ + home-files/${qutebrowserConfig} \ + ${builtins.toFile "qutebrowser-expected-config.py" '' config.load_autoconfig(False) c.colors.hints.bg = "#000000" c.colors.hints.fg = "#ffffff" @@ -38,7 +43,6 @@ c.spellcheck.languages = ["en-US", "sv-SE"] c.tabs.tabs_are_windows = True # Extra qutebrowser configuration. - '' - } - ''; + ''} + ''; } diff --git a/tests/modules/programs/rbw/empty-settings.nix b/tests/modules/programs/rbw/empty-settings.nix index 53b12fd7d..0e3685fb8 100644 --- a/tests/modules/programs/rbw/empty-settings.nix +++ b/tests/modules/programs/rbw/empty-settings.nix @@ -3,11 +3,10 @@ let inherit (pkgs.stdenv.hostPlatform) isDarwin; - path = if isDarwin then - "Library/Application Support/rbw/config.json" - else - ".config/rbw/config.json"; -in { + path = + if isDarwin then "Library/Application Support/rbw/config.json" else ".config/rbw/config.json"; +in +{ programs.rbw.enable = true; nmt.script = '' diff --git a/tests/modules/programs/rbw/settings.nix b/tests/modules/programs/rbw/settings.nix index 5890fd9ac..bfdcd1d7d 100644 --- a/tests/modules/programs/rbw/settings.nix +++ b/tests/modules/programs/rbw/settings.nix @@ -3,10 +3,8 @@ let inherit (pkgs.stdenv.hostPlatform) isDarwin; - path = if isDarwin then - "Library/Application Support/rbw/config.json" - else - ".config/rbw/config.json"; + path = + if isDarwin then "Library/Application Support/rbw/config.json" else ".config/rbw/config.json"; expected = builtins.toFile "rbw-expected.json" '' { @@ -17,7 +15,8 @@ let "pinentry": "@pinentry-gnome3@/bin/pinentry" } ''; -in { +in +{ programs.rbw = { enable = true; settings = { diff --git a/tests/modules/programs/rbw/simple-settings.nix b/tests/modules/programs/rbw/simple-settings.nix index dbd05da24..0897fea91 100644 --- a/tests/modules/programs/rbw/simple-settings.nix +++ b/tests/modules/programs/rbw/simple-settings.nix @@ -3,10 +3,8 @@ let inherit (pkgs.stdenv.hostPlatform) isDarwin; - path = if isDarwin then - "Library/Application Support/rbw/config.json" - else - ".config/rbw/config.json"; + path = + if isDarwin then "Library/Application Support/rbw/config.json" else ".config/rbw/config.json"; expected = builtins.toFile "rbw-expected.json" '' { @@ -17,10 +15,13 @@ let "pinentry": null } ''; -in { +in +{ programs.rbw = { enable = true; - settings = { email = "name@example.com"; }; + settings = { + email = "name@example.com"; + }; }; nmt.script = '' diff --git a/tests/modules/programs/readline/prefer-xdg-dirs.nix b/tests/modules/programs/readline/prefer-xdg-dirs.nix index b825b3bc2..6556a5973 100644 --- a/tests/modules/programs/readline/prefer-xdg-dirs.nix +++ b/tests/modules/programs/readline/prefer-xdg-dirs.nix @@ -9,15 +9,13 @@ nmt.script = '' assertFileContent \ home-files/.config/inputrc \ - ${ - builtins.toFile "readline-expected" '' - # Generated by Home Manager. + ${builtins.toFile "readline-expected" '' + # Generated by Home Manager. - $include /etc/inputrc - set bell-style audible + $include /etc/inputrc + set bell-style audible - '' - } + ''} assertFileContains \ home-path/etc/profile.d/hm-session-vars.sh \ diff --git a/tests/modules/programs/rio/example-settings.nix b/tests/modules/programs/rio/example-settings.nix index 48428556b..a8224a4fd 100644 --- a/tests/modules/programs/rio/example-settings.nix +++ b/tests/modules/programs/rio/example-settings.nix @@ -6,7 +6,8 @@ let padding-x = 0 performance = "Low" ''; -in { +in +{ programs.rio = { enable = true; package = config.lib.test.mkStubPackage { }; diff --git a/tests/modules/programs/ripgrep-all/custom-arguments.nix b/tests/modules/programs/ripgrep-all/custom-arguments.nix index 01ee70db7..b647a66fc 100644 --- a/tests/modules/programs/ripgrep-all/custom-arguments.nix +++ b/tests/modules/programs/ripgrep-all/custom-arguments.nix @@ -1,29 +1,34 @@ -{ pkgs, config, ... }: { +{ pkgs, config, ... }: +{ config = { programs.ripgrep-all = { enable = true; package = config.lib.test.mkStubPackage { name = "ripgrep-all"; }; - custom_adapters = [{ - name = "gron"; - version = 1; - description = "Transform JSON into discrete JS assignments"; - extensions = [ "json" ]; - mimetypes = [ "application/json" ]; - binary = "/bin/gron"; - disabled_by_default = false; - match_only_by_mime = false; - }]; + custom_adapters = [ + { + name = "gron"; + version = 1; + description = "Transform JSON into discrete JS assignments"; + extensions = [ "json" ]; + mimetypes = [ "application/json" ]; + binary = "/bin/gron"; + disabled_by_default = false; + match_only_by_mime = false; + } + ]; }; - nmt.script = let - configPath = if pkgs.stdenv.hostPlatform.isDarwin then - "Library/Application Support/ripgrep-all/config.jsonc" - else - ".config/ripgrep-all/config.jsonc"; - in '' - assertFileExists "home-files/${configPath}" - assertFileContent "home-files/${configPath}" ${ - pkgs.writeText "ripgrep-all.expected" '' + nmt.script = + let + configPath = + if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/ripgrep-all/config.jsonc" + else + ".config/ripgrep-all/config.jsonc"; + in + '' + assertFileExists "home-files/${configPath}" + assertFileContent "home-files/${configPath}" ${pkgs.writeText "ripgrep-all.expected" '' { "$schema": "./config.schema.json", "custom_adapters": [ @@ -44,8 +49,7 @@ } ] } - '' - } - ''; + ''} + ''; }; } diff --git a/tests/modules/programs/ripgrep-all/default-arguments.nix b/tests/modules/programs/ripgrep-all/default-arguments.nix index 61ba46b62..dcbc9f430 100644 --- a/tests/modules/programs/ripgrep-all/default-arguments.nix +++ b/tests/modules/programs/ripgrep-all/default-arguments.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.ripgrep-all = { enable = true; diff --git a/tests/modules/programs/ripgrep/custom-arguments.nix b/tests/modules/programs/ripgrep/custom-arguments.nix index e18efe827..7fe21ec3f 100644 --- a/tests/modules/programs/ripgrep/custom-arguments.nix +++ b/tests/modules/programs/ripgrep/custom-arguments.nix @@ -1,4 +1,5 @@ -{ pkgs, config, ... }: { +{ pkgs, config, ... }: +{ config = { programs.ripgrep = { enable = true; @@ -12,13 +13,11 @@ nmt.script = '' assertFileExists home-files/.config/ripgrep/ripgreprc - assertFileContent home-files/.config/ripgrep/ripgreprc ${ - pkgs.writeText "ripgrep.expected" '' - --max-columns-preview - --colors=line:style:bold - --no-require-git - '' - } + assertFileContent home-files/.config/ripgrep/ripgreprc ${pkgs.writeText "ripgrep.expected" '' + --max-columns-preview + --colors=line:style:bold + --no-require-git + ''} ''; }; } diff --git a/tests/modules/programs/ripgrep/default-arguments.nix b/tests/modules/programs/ripgrep/default-arguments.nix index 43525316e..9e858f669 100644 --- a/tests/modules/programs/ripgrep/default-arguments.nix +++ b/tests/modules/programs/ripgrep/default-arguments.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.ripgrep = { enable = true; diff --git a/tests/modules/programs/rofi-pass/rofi-pass-config.nix b/tests/modules/programs/rofi-pass/rofi-pass-config.nix index 8e5e3592d..365dc6203 100644 --- a/tests/modules/programs/rofi-pass/rofi-pass-config.nix +++ b/tests/modules/programs/rofi-pass/rofi-pass-config.nix @@ -14,12 +14,10 @@ nmt.script = '' assertFileContent \ home-files/.config/rofi-pass/config \ - ${ - builtins.toFile "rofi-pass-expected-config" '' - # Extra config for rofi-pass - xdotool_delay=12 + ${builtins.toFile "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 1455b689c..465e197ed 100644 --- a/tests/modules/programs/rofi-pass/rofi-pass-root.nix +++ b/tests/modules/programs/rofi-pass/rofi-pass-root.nix @@ -11,10 +11,8 @@ nmt.script = '' assertFileContent \ home-files/.config/rofi-pass/config \ - ${ - builtins.toFile "rofi-pass-expected-config" '' - root=~/.local/share/password-store - '' - } + ${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 9cc3f281e..ee98cac5f 100644 --- a/tests/modules/programs/rofi/config-with-deprecated-options.nix +++ b/tests/modules/programs/rofi/config-with-deprecated-options.nix @@ -5,10 +5,14 @@ }; test.asserts.assertions.expected = [ - (let offendingFile = toString ./config-with-deprecated-options.nix; - in '' - The option definition `programs.rofi.colors' in `${offendingFile}' no longer has any effect; please remove it. - Please use a Rofi theme instead. - '') + ( + let + offendingFile = toString ./config-with-deprecated-options.nix; + in + '' + The option definition `programs.rofi.colors' in `${offendingFile}' no longer has any effect; please remove it. + Please use a Rofi theme instead. + '' + ) ]; } diff --git a/tests/modules/programs/rofi/custom-theme.nix b/tests/modules/programs/rofi/custom-theme.nix index 04890078a..632da1db2 100644 --- a/tests/modules/programs/rofi/custom-theme.nix +++ b/tests/modules/programs/rofi/custom-theme.nix @@ -4,26 +4,34 @@ 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" + ]; + }; + + "#textbox-prompt-colon" = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral "@foreground-color"; + }; }; - - "#inputbar" = { children = map mkLiteral [ "prompt" "entry" ]; }; - - "#textbox-prompt-colon" = { - expand = false; - str = ":"; - margin = mkLiteral "0px 0.3em 0em 0em"; - text-color = mkLiteral "@foreground-color"; - }; - }; }; nmt.script = '' diff --git a/tests/modules/programs/ruff/ruff.nix b/tests/modules/programs/ruff/ruff.nix index 895719e84..d3961af81 100644 --- a/tests/modules/programs/ruff/ruff.nix +++ b/tests/modules/programs/ruff/ruff.nix @@ -4,9 +4,16 @@ settings = { line-length = 100; - per-file-ignores = { "__init__.py" = [ "F401" ]; }; + per-file-ignores = { + "__init__.py" = [ "F401" ]; + }; lint = { - select = [ "E4" "E7" "E9" "F" ]; + select = [ + "E4" + "E7" + "E9" + "F" + ]; ignore = [ ]; }; }; diff --git a/tests/modules/programs/sapling/sapling-basic.nix b/tests/modules/programs/sapling/sapling-basic.nix index a893f9a4b..32bc8ed7f 100644 --- a/tests/modules/programs/sapling/sapling-basic.nix +++ b/tests/modules/programs/sapling/sapling-basic.nix @@ -7,18 +7,21 @@ userEmail = "johndoe@example.com"; }; - nmt.script = let - configfile = if pkgs.stdenv.isDarwin then - "Library/Preferences/sapling/sapling.conf" - else - ".config/sapling/sapling.conf"; + nmt.script = + let + configfile = + if pkgs.stdenv.isDarwin then + "Library/Preferences/sapling/sapling.conf" + else + ".config/sapling/sapling.conf"; - expected = builtins.toFile "sapling.conf" '' - [ui] - username=John Doe + expected = builtins.toFile "sapling.conf" '' + [ui] + username=John Doe + ''; + in + '' + assertFileExists home-files/${configfile} + assertFileContent home-files/${configfile} ${expected} ''; - in '' - assertFileExists home-files/${configfile} - assertFileContent home-files/${configfile} ${expected} - ''; } diff --git a/tests/modules/programs/sapling/sapling-most.nix b/tests/modules/programs/sapling/sapling-most.nix index 17916ee93..a6fee660f 100644 --- a/tests/modules/programs/sapling/sapling-most.nix +++ b/tests/modules/programs/sapling/sapling-most.nix @@ -17,30 +17,33 @@ }; }; - nmt.script = let - configfile = if pkgs.stdenv.isDarwin then - "Library/Preferences/sapling/sapling.conf" - else - ".config/sapling/sapling.conf"; + nmt.script = + let + configfile = + if pkgs.stdenv.isDarwin then + "Library/Preferences/sapling/sapling.conf" + else + ".config/sapling/sapling.conf"; - expected = builtins.toFile "sapling.conf" '' - [alias] - cm=commit - d=diff --exclude=*.lock - s=status - view=!$HG config paths.default | xargs open + expected = builtins.toFile "sapling.conf" '' + [alias] + cm=commit + d=diff --exclude=*.lock + s=status + view=!$HG config paths.default | xargs open - [gpg] - key=not-an-actual-key + [gpg] + key=not-an-actual-key - [pager] - pager=delta + [pager] + pager=delta - [ui] - username=John Doe + [ui] + username=John Doe + ''; + in + '' + assertFileExists home-files/${configfile} + assertFileContent home-files/${configfile} ${expected} ''; - in '' - assertFileExists home-files/${configfile} - assertFileContent home-files/${configfile} ${expected} - ''; } diff --git a/tests/modules/programs/sbt/credentials.nix b/tests/modules/programs/sbt/credentials.nix index 78bd3a1f2..d6dc2f21d 100644 --- a/tests/modules/programs/sbt/credentials.nix +++ b/tests/modules/programs/sbt/credentials.nix @@ -23,7 +23,8 @@ let credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", credential_1) ''; credentialsSbtPath = ".sbt/1.0/credentials.sbt"; -in { +in +{ config = { programs.sbt = { enable = true; diff --git a/tests/modules/programs/sbt/deprecated-options.nix b/tests/modules/programs/sbt/deprecated-options.nix index 6a16b52bd..497ad30ab 100644 --- a/tests/modules/programs/sbt/deprecated-options.nix +++ b/tests/modules/programs/sbt/deprecated-options.nix @@ -5,10 +5,14 @@ }; test.asserts.assertions.expected = [ - (let offendingFile = toString ./deprecated-options.nix; - in '' - The option definition `programs.sbt.baseConfigPath' in `${offendingFile}' no longer has any effect; please remove it. - Use programs.sbt.baseUserConfigPath instead, but note that the semantics are slightly different. - '') + ( + let + offendingFile = toString ./deprecated-options.nix; + in + '' + The option definition `programs.sbt.baseConfigPath' in `${offendingFile}' no longer has any effect; please remove it. + Use programs.sbt.baseUserConfigPath instead, but note that the semantics are slightly different. + '' + ) ]; } diff --git a/tests/modules/programs/sbt/plugins.nix b/tests/modules/programs/sbt/plugins.nix index 02e46d56e..c07118c25 100644 --- a/tests/modules/programs/sbt/plugins.nix +++ b/tests/modules/programs/sbt/plugins.nix @@ -12,7 +12,10 @@ let version = "0.4.0"; }; - plugins = [ dependencyGraph projectGraph ]; + plugins = [ + dependencyGraph + projectGraph + ]; pluginsExtra = [ "addDependencyTreePlugin" ]; pluginsSbtPath = ".sbt/1.0/plugins/plugins.sbt"; @@ -23,7 +26,8 @@ let addDependencyTreePlugin ''; -in { +in +{ config = { programs.sbt = { enable = true; diff --git a/tests/modules/programs/sbt/repositories.nix b/tests/modules/programs/sbt/repositories.nix index 0def44f7c..58df66886 100644 --- a/tests/modules/programs/sbt/repositories.nix +++ b/tests/modules/programs/sbt/repositories.nix @@ -6,8 +6,7 @@ let { my-maven-proxy = "http://repo.mavenproxy.io/a/b/c/d"; } "maven-local" { - my-ivy-proxy = - "http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]"; + my-ivy-proxy = "http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]"; } "maven-central" ]; @@ -22,7 +21,8 @@ let ''; repositoriesSbtPath = ".sbt/repositories"; -in { +in +{ config = { programs.sbt = { enable = true; diff --git a/tests/modules/programs/sbt/user-config-path.nix b/tests/modules/programs/sbt/user-config-path.nix index 799d77dcf..ca0de7db3 100644 --- a/tests/modules/programs/sbt/user-config-path.nix +++ b/tests/modules/programs/sbt/user-config-path.nix @@ -1,23 +1,28 @@ { pkgs, ... }: let - plugins = [{ - org = "a"; - artifact = "b"; - version = "c"; - }]; + plugins = [ + { + org = "a"; + artifact = "b"; + version = "c"; + } + ]; - credentials = [{ - realm = "a"; - host = "b"; - user = "c"; - passwordCommand = "d"; - }]; + credentials = [ + { + realm = "a"; + host = "b"; + user = "c"; + passwordCommand = "d"; + } + ]; repositories = [ "local" ]; baseSbtPath = ".config/sbt"; -in { +in +{ config = { programs.sbt = { enable = true; diff --git a/tests/modules/programs/scmpuff/fish.nix b/tests/modules/programs/scmpuff/fish.nix index 5f44308d2..7f432d28c 100644 --- a/tests/modules/programs/scmpuff/fish.nix +++ b/tests/modules/programs/scmpuff/fish.nix @@ -7,8 +7,9 @@ }; # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - lib.mkForce (builtins.toFile "empty" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/scmpuff/no-aliases.nix b/tests/modules/programs/scmpuff/no-aliases.nix index 511e12f54..688337f9f 100644 --- a/tests/modules/programs/scmpuff/no-aliases.nix +++ b/tests/modules/programs/scmpuff/no-aliases.nix @@ -10,8 +10,9 @@ }; # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - lib.mkForce (builtins.toFile "empty" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileExists home-files/.bashrc diff --git a/tests/modules/programs/scmpuff/no-fish.nix b/tests/modules/programs/scmpuff/no-fish.nix index f954d1c36..b9e8494af 100644 --- a/tests/modules/programs/scmpuff/no-fish.nix +++ b/tests/modules/programs/scmpuff/no-fish.nix @@ -10,8 +10,9 @@ }; # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - lib.mkForce (builtins.toFile "empty" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileNotRegex home-files/.config/fish/config.fish '@scmpuff@' diff --git a/tests/modules/programs/senpai/example-settings.nix b/tests/modules/programs/senpai/example-settings.nix index 5b0a5aa26..7922b2598 100644 --- a/tests/modules/programs/senpai/example-settings.nix +++ b/tests/modules/programs/senpai/example-settings.nix @@ -8,13 +8,25 @@ config = { address = "irc.libera.chat"; nickname = "Guest123456"; - password-cmd = [ "gopass" "show" "irc/guest" ]; + password-cmd = [ + "gopass" + "show" + "irc/guest" + ]; username = "senpai"; realname = "Guest von Lenon"; channel = [ "#rahxephon" ]; - highlight = [ "guest" "senpai" "lenon" ]; - pane-widths = { nicknames = 16; }; - colors = { prompt = 2; }; + highlight = [ + "guest" + "senpai" + "lenon" + ]; + pane-widths = { + nicknames = 16; + }; + colors = { + prompt = 2; + }; }; }; diff --git a/tests/modules/programs/sftpman/assert-on-no-sshkey.nix b/tests/modules/programs/sftpman/assert-on-no-sshkey.nix index 990aacacb..1d24628f3 100644 --- a/tests/modules/programs/sftpman/assert-on-no-sshkey.nix +++ b/tests/modules/programs/sftpman/assert-on-no-sshkey.nix @@ -11,7 +11,9 @@ }; }; - 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/sioyek/sioyek-basic-configuration.nix b/tests/modules/programs/sioyek/sioyek-basic-configuration.nix index 5948d3dc5..8e884d5cb 100644 --- a/tests/modules/programs/sioyek/sioyek-basic-configuration.nix +++ b/tests/modules/programs/sioyek/sioyek-basic-configuration.nix @@ -6,8 +6,14 @@ "move_left" = "h"; "move_right" = "l"; "move_up" = "k"; - "screen_down" = [ "d" "" ]; - "screen_up" = [ "u" "" ]; + "screen_down" = [ + "d" + "" + ]; + "screen_up" = [ + "u" + "" + ]; }; config = { "dark_mode_background_color" = "0.0 0.0 0.0"; @@ -19,14 +25,10 @@ description = "Sioyek basic setup with sample configuration"; script = '' assertFileExists home-files/.config/sioyek/prefs_user.config - assertFileContent home-files/.config/sioyek/prefs_user.config ${ - ./test_prefs_user.config - } + assertFileContent home-files/.config/sioyek/prefs_user.config ${./test_prefs_user.config} assertFileExists home-files/.config/sioyek/keys_user.config - assertFileContent home-files/.config/sioyek/keys_user.config ${ - ./test_keys_user.config - } + assertFileContent home-files/.config/sioyek/keys_user.config ${./test_keys_user.config} ''; }; } diff --git a/tests/modules/programs/sm64ex/settings.nix b/tests/modules/programs/sm64ex/settings.nix index da0fc521c..50f00b468 100644 --- a/tests/modules/programs/sm64ex/settings.nix +++ b/tests/modules/programs/sm64ex/settings.nix @@ -14,20 +14,76 @@ 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" ]; + 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; @@ -37,36 +93,34 @@ 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'' - } + ${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/smug/settings.nix b/tests/modules/programs/smug/settings.nix index ec26d88b1..aa958c6a0 100644 --- a/tests/modules/programs/smug/settings.nix +++ b/tests/modules/programs/smug/settings.nix @@ -10,7 +10,9 @@ beforeStart = [ "docker-compose -f my-microservices/docker-compose.yml up -d" # my-microservices/docker-compose.yml is a relative to `root`-al ]; - env = { FOO = "bar"; }; + env = { + FOO = "bar"; + }; stop = [ "docker stop $(docker ps -q)" ]; windows = [ { @@ -19,11 +21,16 @@ manual = true; layout = "main-vertical"; commands = [ "docker-compose start" ]; - panes = [{ - type = "horizontal"; - root = "."; - commands = [ "docker-compose exec php /bin/sh" "clear" ]; - }]; + panes = [ + { + type = "horizontal"; + root = "."; + commands = [ + "docker-compose exec php /bin/sh" + "clear" + ]; + } + ]; } { @@ -31,15 +38,17 @@ root = "~/Developer/blog/my-microservices"; layout = "tiled"; commands = [ "docker-compose start" ]; - panes = [{ - type = "horizontal"; - root = "."; - commands = [ - "docker-compose up -d" - "docker-compose exec php /bin/sh" - "clear" - ]; - }]; + panes = [ + { + type = "horizontal"; + root = "."; + commands = [ + "docker-compose up -d" + "docker-compose exec php /bin/sh" + "clear" + ]; + } + ]; } ]; }; diff --git a/tests/modules/programs/spotify-player/settings.nix b/tests/modules/programs/spotify-player/settings.nix index cf90d1bf9..87f10ecff 100644 --- a/tests/modules/programs/spotify-player/settings.nix +++ b/tests/modules/programs/spotify-player/settings.nix @@ -15,55 +15,70 @@ }; }; - themes = [{ - name = "default2"; - palette = { - black = "black"; - red = "red"; - green = "green"; - yellow = "yellow"; - blue = "blue"; - magenta = "magenta"; - cyan = "cyan"; - white = "white"; - bright_black = "bright_black"; - bright_red = "bright_red"; - bright_green = "bright_green"; - bright_yellow = "bright_yellow"; - bright_blue = "bright_blue"; - bright_magenta = "bright_magenta"; - bright_cyan = "bright_cyan"; - bright_white = "bright_white"; - }; - component_style = { - block_title = { fg = "Magenta"; }; - border = { }; - playback_track = { - fg = "Cyan"; - modifiers = [ "Bold" ]; + themes = [ + { + name = "default2"; + palette = { + black = "black"; + red = "red"; + green = "green"; + yellow = "yellow"; + blue = "blue"; + magenta = "magenta"; + cyan = "cyan"; + white = "white"; + bright_black = "bright_black"; + bright_red = "bright_red"; + bright_green = "bright_green"; + bright_yellow = "bright_yellow"; + bright_blue = "bright_blue"; + bright_magenta = "bright_magenta"; + bright_cyan = "bright_cyan"; + bright_white = "bright_white"; }; - playback_artists = { - fg = "Cyan"; - modifiers = [ "Bold" ]; + component_style = { + block_title = { + fg = "Magenta"; + }; + border = { }; + playback_track = { + fg = "Cyan"; + modifiers = [ "Bold" ]; + }; + playback_artists = { + fg = "Cyan"; + modifiers = [ "Bold" ]; + }; + playback_album = { + fg = "Yellow"; + }; + playback_metadata = { + fg = "BrightBlack"; + }; + playback_progress_bar = { + bg = "BrightBlack"; + fg = "Green"; + }; + current_playing = { + fg = "Green"; + modifiers = [ "Bold" ]; + }; + page_desc = { + fg = "Cyan"; + modifiers = [ "Bold" ]; + }; + table_header = { + fg = "Blue"; + }; + selection = { + modifiers = [ + "Bold" + "Reversed" + ]; + }; }; - playback_album = { fg = "Yellow"; }; - playback_metadata = { fg = "BrightBlack"; }; - playback_progress_bar = { - bg = "BrightBlack"; - fg = "Green"; - }; - current_playing = { - fg = "Green"; - modifiers = [ "Bold" ]; - }; - page_desc = { - fg = "Cyan"; - modifiers = [ "Bold" ]; - }; - table_header = { fg = "Blue"; }; - selection = { modifiers = [ "Bold" "Reversed" ]; }; - }; - }]; + } + ]; keymaps = [ { @@ -107,11 +122,7 @@ nmt.script = '' assertFileContent home-files/.config/spotify-player/app.toml ${./app.toml} - assertFileContent home-files/.config/spotify-player/theme.toml ${ - ./theme.toml - } - assertFileContent home-files/.config/spotify-player/keymap.toml ${ - ./keymap.toml - } + assertFileContent home-files/.config/spotify-player/theme.toml ${./theme.toml} + assertFileContent home-files/.config/spotify-player/keymap.toml ${./keymap.toml} ''; } diff --git a/tests/modules/programs/ssh/default-config.nix b/tests/modules/programs/ssh/default-config.nix index 60a966130..d4f0a6d49 100644 --- a/tests/modules/programs/ssh/default-config.nix +++ b/tests/modules/programs/ssh/default-config.nix @@ -1,9 +1,13 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ config = { - programs.ssh = { enable = true; }; + programs.ssh = { + enable = true; + }; - home.file.assertions.text = builtins.toJSON - (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions)); + home.file.assertions.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); nmt.script = '' assertFileExists home-files/.ssh/config diff --git a/tests/modules/programs/ssh/default.nix b/tests/modules/programs/ssh/default.nix index c5e175995..40e1845fe 100644 --- a/tests/modules/programs/ssh/default.nix +++ b/tests/modules/programs/ssh/default.nix @@ -4,16 +4,10 @@ ssh-match-blocks = ./match-blocks-attrs.nix; ssh-match-blocks-match-and-hosts = ./match-blocks-match-and-hosts.nix; - ssh-forwards-dynamic-valid-bind-no-asserts = - ./forwards-dynamic-valid-bind-no-asserts.nix; - ssh-forwards-dynamic-bind-path-with-port-asserts = - ./forwards-dynamic-bind-path-with-port-asserts.nix; - ssh-forwards-local-bind-path-with-port-asserts = - ./forwards-local-bind-path-with-port-asserts.nix; - ssh-forwards-local-host-path-with-port-asserts = - ./forwards-local-host-path-with-port-asserts.nix; - ssh-forwards-remote-bind-path-with-port-asserts = - ./forwards-remote-bind-path-with-port-asserts.nix; - ssh-forwards-remote-host-path-with-port-asserts = - ./forwards-remote-host-path-with-port-asserts.nix; + ssh-forwards-dynamic-valid-bind-no-asserts = ./forwards-dynamic-valid-bind-no-asserts.nix; + ssh-forwards-dynamic-bind-path-with-port-asserts = ./forwards-dynamic-bind-path-with-port-asserts.nix; + ssh-forwards-local-bind-path-with-port-asserts = ./forwards-local-bind-path-with-port-asserts.nix; + ssh-forwards-local-host-path-with-port-asserts = ./forwards-local-host-path-with-port-asserts.nix; + ssh-forwards-remote-bind-path-with-port-asserts = ./forwards-remote-bind-path-with-port-asserts.nix; + ssh-forwards-remote-host-path-with-port-asserts = ./forwards-remote-host-path-with-port-asserts.nix; } diff --git a/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix index ce83b2c13..693a7aa48 100644 --- a/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-dynamic-bind-path-with-port-asserts.nix @@ -4,11 +4,13 @@ enable = true; matchBlocks = { dynamicBindPathWithPort = { - dynamicForwards = [{ - # Error: - address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - port = 3000; - }]; + dynamicForwards = [ + { + # Error: + address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + port = 3000; + } + ]; }; }; }; diff --git a/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix b/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix index ae5c1fb9e..7e9aec6a1 100644 --- a/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix +++ b/tests/modules/programs/ssh/forwards-dynamic-valid-bind-no-asserts.nix @@ -1,27 +1,33 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ config = { programs.ssh = { enable = true; matchBlocks = { dynamicBindPathNoPort = { - dynamicForwards = [{ - # OK: - address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - }]; + dynamicForwards = [ + { + # OK: + address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + } + ]; }; dynamicBindAddressWithPort = { - dynamicForwards = [{ - # OK: - address = "127.0.0.1"; - port = 3000; - }]; + dynamicForwards = [ + { + # OK: + address = "127.0.0.1"; + port = 3000; + } + ]; }; }; }; - home.file.result.text = builtins.toJSON - (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions)); + home.file.result.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); nmt.script = '' assertFileExists home-files/.ssh/config diff --git a/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix index 0c05bb108..9461517e6 100644 --- a/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-local-bind-path-with-port-asserts.nix @@ -4,15 +4,17 @@ enable = true; matchBlocks = { localBindPathWithPort = { - localForwards = [{ - # OK: - host.address = "127.0.0.1"; - host.port = 3000; + localForwards = [ + { + # OK: + host.address = "127.0.0.1"; + host.port = 3000; - # Error: - bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - bind.port = 3000; - }]; + # Error: + bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + bind.port = 3000; + } + ]; }; }; }; diff --git a/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix index 9dca55abb..db8dfe6f8 100644 --- a/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-local-host-path-with-port-asserts.nix @@ -4,15 +4,17 @@ enable = true; matchBlocks = { localHostPathWithPort = { - localForwards = [{ - # OK: - bind.address = "127.0.0.1"; - bind.port = 3000; + localForwards = [ + { + # OK: + bind.address = "127.0.0.1"; + bind.port = 3000; - # Error: - host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - host.port = 3000; - }]; + # Error: + host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + host.port = 3000; + } + ]; }; }; }; diff --git a/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix index 645876078..a581afa85 100644 --- a/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-remote-bind-path-with-port-asserts.nix @@ -4,15 +4,17 @@ enable = true; matchBlocks = { remoteBindPathWithPort = { - remoteForwards = [{ - # OK: - host.address = "127.0.0.1"; - host.port = 3000; + remoteForwards = [ + { + # OK: + host.address = "127.0.0.1"; + host.port = 3000; - # Error: - bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - bind.port = 3000; - }]; + # Error: + bind.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + bind.port = 3000; + } + ]; }; }; }; diff --git a/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix b/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix index c4f549e21..66f1b0b71 100644 --- a/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix +++ b/tests/modules/programs/ssh/forwards-remote-host-path-with-port-asserts.nix @@ -4,15 +4,17 @@ enable = true; matchBlocks = { remoteHostPathWithPort = { - remoteForwards = [{ - # OK: - bind.address = "127.0.0.1"; - bind.port = 3000; + remoteForwards = [ + { + # OK: + bind.address = "127.0.0.1"; + bind.port = 3000; - # Error: - host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; - host.port = 3000; - }]; + # Error: + host.address = "/run/user/1000/gnupg/S.gpg-agent.extra"; + host.port = 3000; + } + ]; }; }; }; diff --git a/tests/modules/programs/ssh/includes.nix b/tests/modules/programs/ssh/includes.nix index 12e2c6df8..00b80fb42 100644 --- a/tests/modules/programs/ssh/includes.nix +++ b/tests/modules/programs/ssh/includes.nix @@ -1,10 +1,18 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { programs.ssh = { enable = true; - includes = [ "config.d/*" "other/dir" ]; + includes = [ + "config.d/*" + "other/dir" + ]; }; nmt.script = '' diff --git a/tests/modules/programs/ssh/match-blocks-attrs.nix b/tests/modules/programs/ssh/match-blocks-attrs.nix index 21deb7e27..e12bd5d5f 100644 --- a/tests/modules/programs/ssh/match-blocks-attrs.nix +++ b/tests/modules/programs/ssh/match-blocks-attrs.nix @@ -1,4 +1,5 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ config = { programs.ssh = { enable = true; @@ -14,11 +15,13 @@ identityFile = "file"; serverAliveInterval = 60; serverAliveCountMax = 10; - localForwards = [{ - bind.port = 8080; - host.address = "10.0.0.1"; - host.port = 80; - }]; + localForwards = [ + { + bind.port = 8080; + host.address = "10.0.0.1"; + host.port = 80; + } + ]; remoteForwards = [ { bind.port = 8081; @@ -30,7 +33,7 @@ host.address = "/run/user/1000/gnupg/S.gpg-agent"; } ]; - dynamicForwards = [{ port = 2839; }]; + dynamicForwards = [ { port = 2839; } ]; setEnv = { FOO = "foo12"; BAR = "_bar_ 42"; @@ -38,14 +41,18 @@ }; "* !github.com" = { - identityFile = [ "file1" "file2" ]; + identityFile = [ + "file1" + "file2" + ]; port = 516; }; }; }; - home.file.assertions.text = builtins.toJSON - (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions)); + home.file.assertions.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); nmt.script = '' assertFileExists home-files/.ssh/config diff --git a/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix b/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix index 01e91c0b6..5cd70fb03 100644 --- a/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix +++ b/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix @@ -1,21 +1,27 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ config = { programs.ssh = { enable = true; matchBlocks = { - abc = { port = 2222; }; + abc = { + port = 2222; + }; xyz = { match = "host xyz canonical"; port = 2223; }; - "* !github.com" = { port = 516; }; + "* !github.com" = { + port = 516; + }; }; }; - home.file.assertions.text = builtins.toJSON - (map (a: a.message) (lib.filter (a: !a.assertion) config.assertions)); + home.file.assertions.text = builtins.toJSON ( + map (a: a.message) (lib.filter (a: !a.assertion) config.assertions) + ); nmt.script = '' assertFileExists home-files/.ssh/config diff --git a/tests/modules/programs/starship/settings.nix b/tests/modules/programs/starship/settings.nix index 69845d410..29688b099 100644 --- a/tests/modules/programs/starship/settings.nix +++ b/tests/modules/programs/starship/settings.nix @@ -23,20 +23,24 @@ aws.style = "bold blue"; battery = { charging_symbol = "⚡️"; - display = [{ - threshold = 10; - style = "bold red"; - }]; + display = [ + { + threshold = 10; + style = "bold red"; + } + ]; }; } { aws.disabled = true; - battery.display = [{ - threshold = 30; - style = "bold yellow"; - }]; + battery.display = [ + { + threshold = 30; + style = "bold yellow"; + } + ]; } ]; }; diff --git a/tests/modules/programs/streamlink/streamlink-custom-plugins.nix b/tests/modules/programs/streamlink/streamlink-custom-plugins.nix index 715e6b0c5..645545412 100644 --- a/tests/modules/programs/streamlink/streamlink-custom-plugins.nix +++ b/tests/modules/programs/streamlink/streamlink-custom-plugins.nix @@ -17,29 +17,28 @@ test.stubs.streamlink = { }; - nmt.script = let - configDir = if pkgs.stdenv.isDarwin then - "Library/Application Support/streamlink" - else - ".config/streamlink"; + nmt.script = + let + configDir = + if pkgs.stdenv.isDarwin then "Library/Application Support/streamlink" else ".config/streamlink"; - pluginDir = if pkgs.stdenv.isDarwin then - "Library/Application Support/streamlink/plugins" - else - ".local/share/streamlink/plugins"; - in '' - assertFileExists "home-files/${configDir}/config.twitch" - assertFileContent "home-files/${configDir}/config.twitch" ${ - pkgs.writeText "expected" '' + pluginDir = + if pkgs.stdenv.isDarwin then + "Library/Application Support/streamlink/plugins" + else + ".local/share/streamlink/plugins"; + in + '' + assertFileExists "home-files/${configDir}/config.twitch" + assertFileContent "home-files/${configDir}/config.twitch" ${pkgs.writeText "expected" '' player=haruna quiet - '' - } + ''} - assertFileExists "home-files/${pluginDir}/dummy.py" - assertFileContent "home-files/${pluginDir}/dummy.py" ${./dummy.py} + assertFileExists "home-files/${pluginDir}/dummy.py" + assertFileContent "home-files/${pluginDir}/dummy.py" ${./dummy.py} - assertFileExists "home-files/${pluginDir}/dummy2.py" - assertFileContent "home-files/${pluginDir}/dummy2.py" ${./dummy.py} - ''; + assertFileExists "home-files/${pluginDir}/dummy2.py" + assertFileContent "home-files/${pluginDir}/dummy2.py" ${./dummy.py} + ''; } diff --git a/tests/modules/programs/streamlink/streamlink-settings.nix b/tests/modules/programs/streamlink/streamlink-settings.nix index 4d13e49ee..435cb0603 100644 --- a/tests/modules/programs/streamlink/streamlink-settings.nix +++ b/tests/modules/programs/streamlink/streamlink-settings.nix @@ -16,13 +16,16 @@ test.stubs.streamlink = { }; - nmt.script = let - streamlinkConfig = if pkgs.stdenv.hostPlatform.isDarwin then - "Library/Application Support/streamlink/config" - else - ".config/streamlink/config"; - in '' - assertFileExists "home-files/${streamlinkConfig}" - assertFileContent "home-files/${streamlinkConfig}" ${./config} - ''; + nmt.script = + let + streamlinkConfig = + if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/streamlink/config" + else + ".config/streamlink/config"; + in + '' + assertFileExists "home-files/${streamlinkConfig}" + assertFileContent "home-files/${streamlinkConfig}" ${./config} + ''; } diff --git a/tests/modules/programs/swayimg/example-settings.nix b/tests/modules/programs/swayimg/example-settings.nix index a1c4adfd2..1530a8f3a 100644 --- a/tests/modules/programs/swayimg/example-settings.nix +++ b/tests/modules/programs/swayimg/example-settings.nix @@ -10,8 +10,12 @@ window = "#10000010"; scale = "fill"; }; - "info.viewer" = { top_left = "+name,+format"; }; - "keys.viewer" = { "Shift+r" = "rand_file"; }; + "info.viewer" = { + top_left = "+name,+format"; + }; + "keys.viewer" = { + "Shift+r" = "rand_file"; + }; }; }; diff --git a/tests/modules/programs/swaylock/disabled.nix b/tests/modules/programs/swaylock/disabled.nix index 94dd14dc7..f6bdf11cb 100644 --- a/tests/modules/programs/swaylock/disabled.nix +++ b/tests/modules/programs/swaylock/disabled.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.swaylock.settings = { }; nmt.script = '' diff --git a/tests/modules/programs/swaylock/enabled.nix b/tests/modules/programs/swaylock/enabled.nix index 27bea281c..2a2d15878 100644 --- a/tests/modules/programs/swaylock/enabled.nix +++ b/tests/modules/programs/swaylock/enabled.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs.swaylock = { enable = true; package = config.lib.test.mkStubPackage { }; diff --git a/tests/modules/programs/swaylock/legacy.nix b/tests/modules/programs/swaylock/legacy.nix index daee2aa01..609da32cf 100644 --- a/tests/modules/programs/swaylock/legacy.nix +++ b/tests/modules/programs/swaylock/legacy.nix @@ -11,9 +11,12 @@ }; }; - nmt.script = let homeConfig = "home-files/.config/swaylock/config"; - in '' - assertFileExists ${homeConfig} - assertFileContent ${homeConfig} ${./config} - ''; + nmt.script = + let + homeConfig = "home-files/.config/swaylock/config"; + in + '' + assertFileExists ${homeConfig} + assertFileContent ${homeConfig} ${./config} + ''; } diff --git a/tests/modules/programs/swaylock/settings.nix b/tests/modules/programs/swaylock/settings.nix index 3dd9c68d0..210592d2d 100644 --- a/tests/modules/programs/swaylock/settings.nix +++ b/tests/modules/programs/swaylock/settings.nix @@ -11,9 +11,12 @@ }; }; - nmt.script = let homeConfig = "home-files/.config/swaylock/config"; - in '' - assertFileExists ${homeConfig} - assertFileContent ${homeConfig} ${./config} - ''; + nmt.script = + let + homeConfig = "home-files/.config/swaylock/config"; + in + '' + assertFileExists ${homeConfig} + assertFileContent ${homeConfig} ${./config} + ''; } diff --git a/tests/modules/programs/swayr/basic-configuration.nix b/tests/modules/programs/swayr/basic-configuration.nix index 47648e828..ab23fc3c9 100644 --- a/tests/modules/programs/swayr/basic-configuration.nix +++ b/tests/modules/programs/swayr/basic-configuration.nix @@ -22,14 +22,10 @@ }; format = { - output_format = '' - {indent}Output {name} ({id})''; - workspace_format = '' - {indent}Workspace {name} [{layout}] on output {output_name} ({id})''; - container_format = '' - {indent}Container [{layout}] {marks} on workspace {workspace_name} ({id})''; - window_format = '' - img:{app_icon}:text:{indent}{app_name} — {urgency_start}“{title}”{urgency_end} {marks} on workspace {workspace_name} / {output_name} ({id})''; + output_format = ''{indent}Output {name} ({id})''; + workspace_format = ''{indent}Workspace {name} [{layout}] on output {output_name} ({id})''; + container_format = ''{indent}Container [{layout}] {marks} on workspace {workspace_name} ({id})''; + window_format = ''img:{app_icon}:text:{indent}{app_name} — {urgency_start}“{title}”{urgency_end} {marks} on workspace {workspace_name} / {output_name} ({id})''; indent = " "; urgency_start = ''''; urgency_end = ""; @@ -39,27 +35,76 @@ layout = { auto_tile = false; auto_tile_min_window_width_per_output_width = [ - [ 800 400 ] - [ 1024 500 ] - [ 1280 600 ] - [ 1400 680 ] - [ 1440 700 ] - [ 1600 780 ] - [ 1680 780 ] - [ 1920 920 ] - [ 2048 980 ] - [ 2560 1000 ] - [ 3440 1200 ] - [ 3840 1280 ] - [ 4096 1400 ] - [ 4480 1600 ] - [ 7680 2400 ] + [ + 800 + 400 + ] + [ + 1024 + 500 + ] + [ + 1280 + 600 + ] + [ + 1400 + 680 + ] + [ + 1440 + 700 + ] + [ + 1600 + 780 + ] + [ + 1680 + 780 + ] + [ + 1920 + 920 + ] + [ + 2048 + 980 + ] + [ + 2560 + 1000 + ] + [ + 3440 + 1200 + ] + [ + 3840 + 1280 + ] + [ + 4096 + 1400 + ] + [ + 4480 + 1600 + ] + [ + 7680 + 2400 + ] ]; }; - focus = { lockin_delay = 750; }; + focus = { + lockin_delay = 750; + }; - misc = { seq_inhibit = false; }; + misc = { + seq_inhibit = false; + }; }; extraConfig = '' [extra] diff --git a/tests/modules/programs/taskwarrior/taskwarrior.nix b/tests/modules/programs/taskwarrior/taskwarrior.nix index d3c91a29f..7f9d072e8 100644 --- a/tests/modules/programs/taskwarrior/taskwarrior.nix +++ b/tests/modules/programs/taskwarrior/taskwarrior.nix @@ -15,18 +15,16 @@ 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 + 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 + urgency.blocked.coefficient=-42 + urgency.user.tag.next.coefficient=42.420000 - include /my/stuff - urgency.user.tag.test.coefficient=-42.42 + include /my/stuff + urgency.user.tag.test.coefficient=-42.42 - '' - } + ''} ''; } diff --git a/tests/modules/programs/tealdeer/custom-settings.nix b/tests/modules/programs/tealdeer/custom-settings.nix index aa9768cf7..ea7c5deaa 100644 --- a/tests/modules/programs/tealdeer/custom-settings.nix +++ b/tests/modules/programs/tealdeer/custom-settings.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { programs.tealdeer = { package = config.lib.test.mkStubPackage { name = "tldr"; }; @@ -8,28 +9,27 @@ auto_update = true; auto_update_interval_hours = 72; }; - display = { use_pager = false; }; + display = { + use_pager = false; + }; }; }; - nmt.script = let - expectedConfDir = if pkgs.stdenv.isDarwin then - "Library/Application Support" - else - ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; - in '' - assertFileExists "${expectedConfigPath}" - assertFileContent "${expectedConfigPath}" ${ - pkgs.writeText "tealdeer.config-custom.expected" '' + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; + in + '' + assertFileExists "${expectedConfigPath}" + assertFileContent "${expectedConfigPath}" ${pkgs.writeText "tealdeer.config-custom.expected" '' [display] use_pager = false [updates] auto_update = true auto_update_interval_hours = 72 - '' - } - ''; + ''} + ''; }; } diff --git a/tests/modules/programs/tealdeer/default-settings.nix b/tests/modules/programs/tealdeer/default-settings.nix index 438b6edd1..a1638013a 100644 --- a/tests/modules/programs/tealdeer/default-settings.nix +++ b/tests/modules/programs/tealdeer/default-settings.nix @@ -1,18 +1,18 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { programs.tealdeer = { package = config.lib.test.mkStubPackage { name = "tldr"; }; enable = true; }; - nmt.script = let - expectedConfDir = if pkgs.stdenv.isDarwin then - "Library/Application Support" - else - ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; - in '' - assertPathNotExists "${expectedConfigPath}" - ''; + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tealdeer/config.toml"; + in + '' + assertPathNotExists "${expectedConfigPath}" + ''; }; } diff --git a/tests/modules/programs/terminator/config-file.nix b/tests/modules/programs/terminator/config-file.nix index 5cc020630..8df9faca3 100644 --- a/tests/modules/programs/terminator/config-file.nix +++ b/tests/modules/programs/terminator/config-file.nix @@ -8,13 +8,11 @@ }; nmt.script = '' - assertFileContent home-files/.config/terminator/config ${ - builtins.toFile "expected" '' - [global_config] - borderless = True - [profiles] - [[default]] - background_color = "#002b36"'' - } + assertFileContent home-files/.config/terminator/config ${builtins.toFile "expected" '' + [global_config] + borderless = True + [profiles] + [[default]] + background_color = "#002b36"''} ''; } diff --git a/tests/modules/programs/tex-fmt/custom-settings.nix b/tests/modules/programs/tex-fmt/custom-settings.nix index a4123b095..e7e1d9802 100644 --- a/tests/modules/programs/tex-fmt/custom-settings.nix +++ b/tests/modules/programs/tex-fmt/custom-settings.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { programs.tex-fmt = { enable = true; @@ -10,22 +11,19 @@ }; }; - nmt.script = let - expectedConfDir = if pkgs.stdenv.isDarwin then - "Library/Application Support" - else - ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; - in '' - assertFileExists "${expectedConfigPath}" - assertFileContent "${expectedConfigPath}" ${ - pkgs.writeText "tex-fmt.config-custom.expected" '' + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; + in + '' + assertFileExists "${expectedConfigPath}" + assertFileContent "${expectedConfigPath}" ${pkgs.writeText "tex-fmt.config-custom.expected" '' lists = [] tabchar = "space" tabsize = 2 wrap = true - '' - } - ''; + ''} + ''; }; } diff --git a/tests/modules/programs/tex-fmt/default-settings.nix b/tests/modules/programs/tex-fmt/default-settings.nix index 427493946..971e6da2f 100644 --- a/tests/modules/programs/tex-fmt/default-settings.nix +++ b/tests/modules/programs/tex-fmt/default-settings.nix @@ -1,15 +1,17 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { - programs.tex-fmt = { enable = true; }; + programs.tex-fmt = { + enable = true; + }; - nmt.script = let - expectedConfDir = if pkgs.stdenv.isDarwin then - "Library/Application Support" - else - ".config"; - expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; - in '' - assertPathNotExists "${expectedConfigPath}" - ''; + nmt.script = + let + expectedConfDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config"; + expectedConfigPath = "home-files/${expectedConfDir}/tex-fmt/tex-fmt.toml"; + in + '' + assertPathNotExists "${expectedConfigPath}" + ''; }; } diff --git a/tests/modules/programs/texlive/texlive-minimal.nix b/tests/modules/programs/texlive/texlive-minimal.nix index 8db048e58..bf913249c 100644 --- a/tests/modules/programs/texlive/texlive-minimal.nix +++ b/tests/modules/programs/texlive/texlive-minimal.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ config = { programs.texlive.enable = true; @@ -7,7 +8,8 @@ (self: super: { texlive = { collection-basic = pkgs.writeTextDir "collection-basic" ""; - combine = tpkgs: + combine = + tpkgs: pkgs.symlinkJoin { name = "dummy-texlive-combine"; paths = lib.attrValues tpkgs; diff --git a/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix b/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix index 57bef0f13..189ca1efb 100644 --- a/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix +++ b/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix @@ -2,24 +2,23 @@ { lib, realPkgs, ... }: lib.recursiveUpdate (import ./thunderbird.nix { inherit lib realPkgs; }) { programs.thunderbird = { - nativeMessagingHosts = with realPkgs; - [ - # NOTE: this is not a real Thunderbird native host module but Firefox; no - # native hosts are currently packaged for nixpkgs or elsewhere, so we - # have to improvise. Packaging wise, Firefox and Thunderbird native hosts - # are identical though. The test doesn't care if the host was meant for - # either as long as the right paths are present in the package. - browserpass - ]; + nativeMessagingHosts = with realPkgs; [ + # NOTE: this is not a real Thunderbird native host module but Firefox; no + # native hosts are currently packaged for nixpkgs or elsewhere, so we + # have to improvise. Packaging wise, Firefox and Thunderbird native hosts + # are identical though. The test doesn't care if the host was meant for + # either as long as the right paths are present in the package. + browserpass + ]; }; - nmt.script = let - isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; - nativeHostsDir = if isDarwin then - "Library/Mozilla/NativeMessagingHosts" - else - ".mozilla/native-messaging-hosts"; - in '' - assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json - ''; + nmt.script = + let + isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; + nativeHostsDir = + if isDarwin then "Library/Mozilla/NativeMessagingHosts" else ".mozilla/native-messaging-hosts"; + in + '' + assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json + ''; } diff --git a/tests/modules/programs/thunderbird/thunderbird.nix b/tests/modules/programs/thunderbird/thunderbird.nix index 35e87d452..570e88aee 100644 --- a/tests/modules/programs/thunderbird/thunderbird.nix +++ b/tests/modules/programs/thunderbird/thunderbird.nix @@ -1,4 +1,5 @@ -{ lib, realPkgs, ... }: { +{ lib, realPkgs, ... }: +{ imports = [ ../../accounts/email-test-accounts.nix ]; accounts.email.accounts = { @@ -80,7 +81,11 @@ second.settings = { "second.setting" = "some-test-setting"; - second.nested.evenFurtherNested = [ 1 2 3 ]; + second.nested.evenFurtherNested = [ + 1 + 2 + 3 + ]; }; }; @@ -90,38 +95,36 @@ }; }; - nmt.script = let - isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; - configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird"; - profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}"; - platform = if isDarwin then "darwin" else "linux"; - in '' - assertFileExists home-files/${configDir}/profiles.ini - assertFileContent home-files/${configDir}/profiles.ini \ - ${./thunderbird-expected-profiles-${platform}.ini} + nmt.script = + let + isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; + configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird"; + profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}"; + platform = if isDarwin then "darwin" else "linux"; + in + '' + assertFileExists home-files/${configDir}/profiles.ini + assertFileContent home-files/${configDir}/profiles.ini \ + ${./thunderbird-expected-profiles-${platform}.ini} - assertFileExists home-files/${profilesDir}/first/user.js - assertFileContent home-files/${profilesDir}/first/user.js \ - ${./thunderbird-expected-first-${platform}.js} + assertFileExists home-files/${profilesDir}/first/user.js + assertFileContent home-files/${profilesDir}/first/user.js \ + ${./thunderbird-expected-first-${platform}.js} - assertFileExists home-files/${profilesDir}/second/user.js - assertFileContent home-files/${profilesDir}/second/user.js \ - ${./thunderbird-expected-second-${platform}.js} + assertFileExists home-files/${profilesDir}/second/user.js + assertFileContent home-files/${profilesDir}/second/user.js \ + ${./thunderbird-expected-second-${platform}.js} - assertFileExists home-files/${profilesDir}/first/chrome/userChrome.css - assertFileContent home-files/${profilesDir}/first/chrome/userChrome.css \ - <(echo "* { color: blue !important; }") + assertFileExists home-files/${profilesDir}/first/chrome/userChrome.css + assertFileContent home-files/${profilesDir}/first/chrome/userChrome.css \ + <(echo "* { color: blue !important; }") - assertFileExists home-files/${profilesDir}/first/chrome/userContent.css - assertFileContent home-files/${profilesDir}/first/chrome/userContent.css \ - <(echo "* { color: red !important; }") + assertFileExists home-files/${profilesDir}/first/chrome/userContent.css + assertFileContent home-files/${profilesDir}/first/chrome/userContent.css \ + <(echo "* { color: red !important; }") - assertFileExists home-files/${profilesDir}/first/ImapMail/${ - builtins.hashString "sha256" "hm@example.com" - }/msgFilterRules.dat - assertFileContent home-files/${profilesDir}/first/ImapMail/${ - builtins.hashString "sha256" "hm@example.com" - }/msgFilterRules.dat \ - ${./thunderbird-expected-msgFilterRules.dat} - ''; + assertFileExists home-files/${profilesDir}/first/ImapMail/${builtins.hashString "sha256" "hm@example.com"}/msgFilterRules.dat + assertFileContent home-files/${profilesDir}/first/ImapMail/${builtins.hashString "sha256" "hm@example.com"}/msgFilterRules.dat \ + ${./thunderbird-expected-msgFilterRules.dat} + ''; } diff --git a/tests/modules/programs/tmate/tmate.nix b/tests/modules/programs/tmate/tmate.nix index 76e07d881..ab8faf65e 100644 --- a/tests/modules/programs/tmate/tmate.nix +++ b/tests/modules/programs/tmate/tmate.nix @@ -6,16 +6,16 @@ extraConfig = ''set tmate-session-name "session-name"''; }; - nmt.script = let - expectedConfig = '' - set -g tmate-server-port 222 - set -g tmate-server-ed25519-fingerprint "SHA256:1111111111111111111111111111111111111111111" - set tmate-session-name "session-name" + nmt.script = + let + expectedConfig = '' + set -g tmate-server-port 222 + set -g tmate-server-ed25519-fingerprint "SHA256:1111111111111111111111111111111111111111111" + set tmate-session-name "session-name" + ''; + in + '' + assertFileExists home-files/.tmate.conf + assertFileContent home-files/.tmate.conf ${builtins.toFile "config" expectedConfig} ''; - in '' - assertFileExists home-files/.tmate.conf - assertFileContent home-files/.tmate.conf ${ - builtins.toFile "config" expectedConfig - } - ''; } diff --git a/tests/modules/programs/tmux/default-shell.nix b/tests/modules/programs/tmux/default-shell.nix index f0718b8ad..af97f000f 100644 --- a/tests/modules/programs/tmux/default-shell.nix +++ b/tests/modules/programs/tmux/default-shell.nix @@ -1,14 +1,16 @@ { pkgs, ... }: let - substituteExpected = path: + substituteExpected = + path: pkgs.substituteAll { src = path; sensible_rtp = pkgs.tmuxPlugins.sensible.rtp; }; -in { +in +{ config = { programs.tmux = { enable = true; diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix index 7bcc08e16..8860fb76c 100644 --- a/tests/modules/programs/tmux/disable-confirmation-prompt.nix +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix @@ -8,7 +8,9 @@ nixpkgs.overlays = [ (self: super: { tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; }; + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; + }; }; }) ]; diff --git a/tests/modules/programs/tmux/emacs-with-plugins.nix b/tests/modules/programs/tmux/emacs-with-plugins.nix index 146c5fa8e..f8847b879 100644 --- a/tests/modules/programs/tmux/emacs-with-plugins.nix +++ b/tests/modules/programs/tmux/emacs-with-plugins.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ config = { programs.tmux = { aggressiveResize = true; @@ -39,9 +40,7 @@ nmt.script = '' assertFileExists home-files/.config/tmux/tmux.conf - assertFileContent home-files/.config/tmux/tmux.conf ${ - ./emacs-with-plugins.conf - } + assertFileContent home-files/.config/tmux/tmux.conf ${./emacs-with-plugins.conf} ''; }; } diff --git a/tests/modules/programs/tmux/mouse-enabled.nix b/tests/modules/programs/tmux/mouse-enabled.nix index 5e674e21c..49fda0729 100644 --- a/tests/modules/programs/tmux/mouse-enabled.nix +++ b/tests/modules/programs/tmux/mouse-enabled.nix @@ -8,7 +8,9 @@ nixpkgs.overlays = [ (self: super: { tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; }; + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; + }; }; }) ]; diff --git a/tests/modules/programs/tmux/not-enabled.nix b/tests/modules/programs/tmux/not-enabled.nix index 556aaef9e..16c8137a8 100644 --- a/tests/modules/programs/tmux/not-enabled.nix +++ b/tests/modules/programs/tmux/not-enabled.nix @@ -1,6 +1,8 @@ { config = { - programs.tmux = { enable = false; }; + programs.tmux = { + enable = false; + }; nmt.script = '' assertPathNotExists home-files/.config/tmux/tmux.conf diff --git a/tests/modules/programs/tmux/prefix.nix b/tests/modules/programs/tmux/prefix.nix index 7777ad6df..e2336a858 100644 --- a/tests/modules/programs/tmux/prefix.nix +++ b/tests/modules/programs/tmux/prefix.nix @@ -8,7 +8,9 @@ nixpkgs.overlays = [ (self: super: { tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; }; + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; + }; }; }) ]; diff --git a/tests/modules/programs/tmux/shortcut-without-prefix.nix b/tests/modules/programs/tmux/shortcut-without-prefix.nix index 635a9e10b..d9a2bf493 100644 --- a/tests/modules/programs/tmux/shortcut-without-prefix.nix +++ b/tests/modules/programs/tmux/shortcut-without-prefix.nix @@ -9,7 +9,9 @@ nixpkgs.overlays = [ (self: super: { tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; }; + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; + }; }; }) ]; diff --git a/tests/modules/programs/tmux/vi-all-true.nix b/tests/modules/programs/tmux/vi-all-true.nix index e04ea922e..e8d2d187f 100644 --- a/tests/modules/programs/tmux/vi-all-true.nix +++ b/tests/modules/programs/tmux/vi-all-true.nix @@ -12,7 +12,9 @@ nixpkgs.overlays = [ (self: super: { tmuxPlugins = super.tmuxPlugins // { - sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; }; + sensible = super.tmuxPlugins.sensible // { + rtp = "@sensible_rtp@"; + }; }; }) ]; diff --git a/tests/modules/programs/todoman/config.nix b/tests/modules/programs/todoman/config.nix index 789f32168..c28b33e34 100644 --- a/tests/modules/programs/todoman/config.nix +++ b/tests/modules/programs/todoman/config.nix @@ -16,4 +16,3 @@ assertFileContent $configFile ${./todoman-config-expected} ''; } - diff --git a/tests/modules/programs/topgrade/settings.nix b/tests/modules/programs/topgrade/settings.nix index f9b2b3dee..443d43fb2 100644 --- a/tests/modules/programs/topgrade/settings.nix +++ b/tests/modules/programs/topgrade/settings.nix @@ -7,9 +7,18 @@ settings = lib.mkMerge [ { misc = { - disable = [ "sdkman" "flutter" "node" "nix" "home_manager" ]; + disable = [ + "sdkman" + "flutter" + "node" + "nix" + "home_manager" + ]; - remote_topgrades = [ "backup" "ci" ]; + remote_topgrades = [ + "backup" + "ci" + ]; remote_topgrade_path = "bin/topgrade"; }; @@ -21,7 +30,9 @@ cleanup = true; }; - commands = { "Purge unused APT packages" = "sudo apt autoremove"; }; + commands = { + "Purge unused APT packages" = "sudo apt autoremove"; + }; } ]; }; diff --git a/tests/modules/programs/translate-shell/translate-shell.nix b/tests/modules/programs/translate-shell/translate-shell.nix index 2e6f61d9d..103ee991d 100644 --- a/tests/modules/programs/translate-shell/translate-shell.nix +++ b/tests/modules/programs/translate-shell/translate-shell.nix @@ -6,7 +6,10 @@ engine = "bing"; play = true; hl = "en"; - tl = [ "de" "fr" ]; + tl = [ + "de" + "fr" + ]; }; }; diff --git a/tests/modules/programs/vifm/example-settings.nix b/tests/modules/programs/vifm/example-settings.nix index 8f562aa62..97d80810f 100644 --- a/tests/modules/programs/vifm/example-settings.nix +++ b/tests/modules/programs/vifm/example-settings.nix @@ -12,10 +12,8 @@ nmt.script = '' assertFileContent \ home-files/.config/vifm/vifmrc \ - ${ - builtins.toFile "vifm-expected.conf" '' - mark h ~/ - '' - } + ${builtins.toFile "vifm-expected.conf" '' + mark h ~/ + ''} ''; } diff --git a/tests/modules/programs/vim-vint/basic-configuration.nix b/tests/modules/programs/vim-vint/basic-configuration.nix index 8a17761d8..d533b034b 100644 --- a/tests/modules/programs/vim-vint/basic-configuration.nix +++ b/tests/modules/programs/vim-vint/basic-configuration.nix @@ -5,7 +5,9 @@ cmdargs = { severity = "error"; color = true; - env = { neovim = true; }; + env = { + neovim = true; + }; }; policies = { ProhibitEqualTildeOperator.enabled = false; @@ -18,8 +20,6 @@ }; nmt.script = '' - assertFileContent home-files/.config/.vintrc.yaml ${ - ./basic-configuration.yaml - } + assertFileContent home-files/.config/.vintrc.yaml ${./basic-configuration.yaml} ''; } diff --git a/tests/modules/programs/vinegar/example-settings.nix b/tests/modules/programs/vinegar/example-settings.nix index 22ac75df5..200451374 100644 --- a/tests/modules/programs/vinegar/example-settings.nix +++ b/tests/modules/programs/vinegar/example-settings.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs.vinegar = { enable = true; package = config.lib.test.mkStubPackage { }; diff --git a/tests/modules/programs/vscode/keybindings.nix b/tests/modules/programs/vscode/keybindings.nix index a0d3ea93f..a48a7f413 100644 --- a/tests/modules/programs/vscode/keybindings.nix +++ b/tests/modules/programs/vscode/keybindings.nix @@ -21,29 +21,29 @@ let { key = "ctrl+r"; command = "run"; - args = { command = "echo file"; }; + args = { + command = "echo file"; + }; } ]; - keybindingsPath = name: + keybindingsPath = + name: if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support/Code/User/${ lib.optionalString (name != "default") "profiles/${name}/" }keybindings.json" else - ".config/Code/User/${ - lib.optionalString (name != "default") "profiles/${name}/" - }keybindings.json"; + ".config/Code/User/${lib.optionalString (name != "default") "profiles/${name}/"}keybindings.json"; - settingsPath = name: + settingsPath = + name: if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support/Code/User/${ lib.optionalString (name != "default") "profiles/${name}/" }settings.json" else - ".config/Code/User/${ - lib.optionalString (name != "default") "profiles/${name}/" - }settings.json"; + ".config/Code/User/${lib.optionalString (name != "default") "profiles/${name}/"}settings.json"; expectedKeybindings = pkgs.writeText "expected.json" '' [ @@ -72,7 +72,8 @@ let ] ''; -in { +in +{ programs.vscode = { enable = true; profiles = { @@ -87,16 +88,12 @@ in { nmt.script = '' assertFileExists "home-files/${keybindingsPath "default"}" - assertFileContent "home-files/${ - keybindingsPath "default" - }" "${expectedKeybindings}" + assertFileContent "home-files/${keybindingsPath "default"}" "${expectedKeybindings}" assertPathNotExists "home-files/${settingsPath "default"}" assertFileExists "home-files/${keybindingsPath "test"}" - assertFileContent "home-files/${ - keybindingsPath "test" - }" "${expectedKeybindings}" + assertFileContent "home-files/${keybindingsPath "test"}" "${expectedKeybindings}" assertPathNotExists "home-files/${settingsPath "test"}" ''; diff --git a/tests/modules/programs/vscode/snippets.nix b/tests/modules/programs/vscode/snippets.nix index eafa69186..de868dbd3 100644 --- a/tests/modules/programs/vscode/snippets.nix +++ b/tests/modules/programs/vscode/snippets.nix @@ -2,15 +2,14 @@ let - snippetsDir = name: + snippetsDir = + name: if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support/Code/User/${ lib.optionalString (name != "default") "profiles/${name}/" }/snippets" else - ".config/Code/User/${ - lib.optionalString (name != "default") "profiles/${name}/" - }snippets"; + ".config/Code/User/${lib.optionalString (name != "default") "profiles/${name}/"}snippets"; globalSnippetsPath = name: "${snippetsDir name}/global.code-snippets"; @@ -63,7 +62,8 @@ let }; }; -in { +in +{ programs.vscode = { enable = true; package = pkgs.writeScriptBin "vscode" "" // { @@ -78,23 +78,15 @@ in { nmt.script = '' assertFileExists "home-files/${globalSnippetsPath "default"}" - assertFileContent "home-files/${ - globalSnippetsPath "default" - }" "${globalSnippetsExpectedContent}" + assertFileContent "home-files/${globalSnippetsPath "default"}" "${globalSnippetsExpectedContent}" assertFileExists "home-files/${globalSnippetsPath "test"}" - assertFileContent "home-files/${ - globalSnippetsPath "test" - }" "${globalSnippetsExpectedContent}" + assertFileContent "home-files/${globalSnippetsPath "test"}" "${globalSnippetsExpectedContent}" assertFileExists "home-files/${haskellSnippetsPath "default"}" - assertFileContent "home-files/${ - haskellSnippetsPath "default" - }" "${haskellSnippetsExpectedContent}" + assertFileContent "home-files/${haskellSnippetsPath "default"}" "${haskellSnippetsExpectedContent}" assertFileExists "home-files/${haskellSnippetsPath "test"}" - assertFileContent "home-files/${ - haskellSnippetsPath "test" - }" "${haskellSnippetsExpectedContent}" + assertFileContent "home-files/${haskellSnippetsPath "test"}" "${haskellSnippetsExpectedContent}" ''; } diff --git a/tests/modules/programs/vscode/tasks.nix b/tests/modules/programs/vscode/tasks.nix index f7b266a33..ec03350f2 100644 --- a/tests/modules/programs/vscode/tasks.nix +++ b/tests/modules/programs/vscode/tasks.nix @@ -2,23 +2,24 @@ let - tasksFilePath = name: + tasksFilePath = + name: if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support/Code/User/${ lib.optionalString (name != "default") "profiles/${name}/" }tasks.json" else - ".config/Code/User/${ - lib.optionalString (name != "default") "profiles/${name}/" - }tasks.json"; + ".config/Code/User/${lib.optionalString (name != "default") "profiles/${name}/"}tasks.json"; tasks = { version = "2.0.0"; - tasks = [{ - type = "shell"; - label = "Hello task"; - command = "hello"; - }]; + tasks = [ + { + type = "shell"; + label = "Hello task"; + command = "hello"; + } + ]; }; expectedTasks = pkgs.writeText "tasks-expected.json" '' @@ -34,7 +35,8 @@ let } ''; -in { +in +{ programs.vscode = { enable = true; package = pkgs.writeScriptBin "vscode" "" // { diff --git a/tests/modules/programs/vscode/update-checks.nix b/tests/modules/programs/vscode/update-checks.nix index b75cda566..31f04ab9f 100644 --- a/tests/modules/programs/vscode/update-checks.nix +++ b/tests/modules/programs/vscode/update-checks.nix @@ -2,10 +2,11 @@ let - settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then - "Library/Application Support/Code/User/settings.json" - else - ".config/Code/User/settings.json"; + settingsPath = + if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/settings.json" + else + ".config/Code/User/settings.json"; expectedSettings = pkgs.writeText "settings-expected.json" '' { @@ -14,7 +15,8 @@ let } ''; -in { +in +{ programs.vscode = { enable = true; package = pkgs.writeScriptBin "vscode" "" // { diff --git a/tests/modules/programs/watson/empty-settings.nix b/tests/modules/programs/watson/empty-settings.nix index 3dec3b76e..c25d9f4f2 100644 --- a/tests/modules/programs/watson/empty-settings.nix +++ b/tests/modules/programs/watson/empty-settings.nix @@ -1,15 +1,19 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ programs.watson = { enable = true; package = config.lib.test.mkStubPackage { }; }; - nmt.script = let - configDir = if pkgs.stdenv.hostPlatform.isDarwin then - "home-files/Library/Application Support" - else - "home-files/.config"; - in '' - assertPathNotExists ${configDir}/watson/config - ''; + nmt.script = + let + configDir = + if pkgs.stdenv.hostPlatform.isDarwin then + "home-files/Library/Application Support" + else + "home-files/.config"; + in + '' + assertPathNotExists ${configDir}/watson/config + ''; } diff --git a/tests/modules/programs/watson/example-settings.nix b/tests/modules/programs/watson/example-settings.nix index 11fd988aa..31fd69215 100644 --- a/tests/modules/programs/watson/example-settings.nix +++ b/tests/modules/programs/watson/example-settings.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ programs.watson = { enable = true; package = config.lib.test.mkStubPackage { }; @@ -23,14 +24,17 @@ }; }; - nmt.script = let - configDir = if pkgs.stdenv.hostPlatform.isDarwin then - "home-files/Library/Application Support" - else - "home-files/.config"; - in '' - assertFileContent \ - "${configDir}/watson/config" \ - ${./example-settings-expected.ini} - ''; + nmt.script = + let + configDir = + if pkgs.stdenv.hostPlatform.isDarwin then + "home-files/Library/Application Support" + else + "home-files/.config"; + in + '' + assertFileContent \ + "${configDir}/watson/config" \ + ${./example-settings-expected.ini} + ''; } diff --git a/tests/modules/programs/waybar/default.nix b/tests/modules/programs/waybar/default.nix index bcff35bc4..20d4ecad3 100644 --- a/tests/modules/programs/waybar/default.nix +++ b/tests/modules/programs/waybar/default.nix @@ -1,6 +1,5 @@ { - waybar-systemd-with-graphical-session-target = - ./systemd-with-graphical-session-target.nix; + waybar-systemd-with-graphical-session-target = ./systemd-with-graphical-session-target.nix; waybar-styling = ./styling.nix; waybar-settings-complex = ./settings-complex.nix; waybar-settings-with-attrs = ./settings-with-attrs.nix; diff --git a/tests/modules/programs/waybar/deprecated-modules-option.nix b/tests/modules/programs/waybar/deprecated-modules-option.nix index 2c677aac3..eddf949ee 100644 --- a/tests/modules/programs/waybar/deprecated-modules-option.nix +++ b/tests/modules/programs/waybar/deprecated-modules-option.nix @@ -7,33 +7,37 @@ programs.waybar = { package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; enable = true; - settings = [{ - modules-center = [ "test" ]; - modules = { "test" = { }; }; - }]; + settings = [ + { + modules-center = [ "test" ]; + modules = { + "test" = { }; + }; + } + ]; }; - test.asserts.assertions.expected = ['' - The `programs.waybar.settings.[].modules` option has been removed. - It is now possible to declare modules in the configuration without nesting them under the `modules` option. - '']; + test.asserts.assertions.expected = [ + '' + The `programs.waybar.settings.[].modules` option has been removed. + It is now possible to declare modules in the configuration without nesting them under the `modules` option. + '' + ]; nmt.script = '' assertPathNotExists home-files/.config/waybar/style.css assertFileContent \ home-files/.config/waybar/config \ - ${ - builtins.toFile "waybar-deprecated-modules-option.json" '' - [ - { - "modules-center": [ - "test" - ], - "test": {} - } - ] - '' - } + ${builtins.toFile "waybar-deprecated-modules-option.json" '' + [ + { + "modules-center": [ + "test" + ], + "test": {} + } + ] + ''} ''; }; } diff --git a/tests/modules/programs/waybar/settings-complex.nix b/tests/modules/programs/waybar/settings-complex.nix index a54131939..438e0f550 100644 --- a/tests/modules/programs/waybar/settings-complex.nix +++ b/tests/modules/programs/waybar/settings-complex.nix @@ -13,7 +13,11 @@ position = "top"; height = 30; output = [ "DP-1" ]; - modules-left = [ "sway/workspaces" "sway/mode" "custom/my-module" ]; + modules-left = [ + "sway/workspaces" + "sway/mode" + "custom/my-module" + ]; modules-center = [ "sway/window" ]; modules-right = [ "idle_inhibitor" @@ -33,15 +37,22 @@ disable-scroll = true; all-outputs = true; }; - "sway/mode" = { tooltip = false; }; - "sway/window" = { max-length = 120; }; - "idle_inhibitor" = { format = "{icon}"; }; + "sway/mode" = { + tooltip = false; + }; + "sway/window" = { + max-length = 120; + }; + "idle_inhibitor" = { + format = "{icon}"; + }; "custom/my-module" = { format = "hello from {}"; - exec = let - dummyScript = - config.lib.test.mkStubPackage { outPath = "@dummy@"; }; - in "${dummyScript}/bin/dummy"; + exec = + let + dummyScript = config.lib.test.mkStubPackage { outPath = "@dummy@"; }; + in + "${dummyScript}/bin/dummy"; }; }; } @@ -50,7 +61,11 @@ output = [ "!DP-1" ]; modules-left = [ "sway/mode" ]; modules-center = [ "clock" ]; - modules = { "sway/mode" = { tooltip = true; }; }; + modules = { + "sway/mode" = { + tooltip = true; + }; + }; } ]; }; diff --git a/tests/modules/programs/waybar/settings-with-attrs.nix b/tests/modules/programs/waybar/settings-with-attrs.nix index 992e42c66..7b0a68e7f 100644 --- a/tests/modules/programs/waybar/settings-with-attrs.nix +++ b/tests/modules/programs/waybar/settings-with-attrs.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { @@ -7,14 +12,17 @@ programs.waybar = { package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; enable = true; - settings = let - settingsComplex = (import ./settings-complex.nix { - inherit config lib pkgs; - }).config.programs.waybar.settings; - in { - mainBar = builtins.head settingsComplex; - secondaryBar = builtins.elemAt settingsComplex 1; - }; + settings = + let + settingsComplex = + (import ./settings-complex.nix { + inherit config lib pkgs; + }).config.programs.waybar.settings; + in + { + mainBar = builtins.head settingsComplex; + secondaryBar = builtins.elemAt settingsComplex 1; + }; }; nmt.script = '' diff --git a/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix b/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix index e9694e533..4beddf41f 100644 --- a/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix +++ b/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix @@ -16,9 +16,7 @@ assertPathNotExists home-files/.config/waybar/style.css serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/waybar.service) - assertFileContent "$serviceFile" ${ - ./systemd-with-graphical-session-target.service - } + assertFileContent "$serviceFile" ${./systemd-with-graphical-session-target.service} ''; }; } diff --git a/tests/modules/programs/wezterm/empty-setting.nix b/tests/modules/programs/wezterm/empty-setting.nix index fda2eb572..dbb7c7d21 100644 --- a/tests/modules/programs/wezterm/empty-setting.nix +++ b/tests/modules/programs/wezterm/empty-setting.nix @@ -1,18 +1,22 @@ { - programs.wezterm = { enable = true; }; + programs.wezterm = { + enable = true; + }; - nmt.script = let - expected = builtins.toFile "wezterm.lua" '' - -- Generated by Home Manager. - -- See https://wezfurlong.org/wezterm/ + nmt.script = + let + expected = builtins.toFile "wezterm.lua" '' + -- Generated by Home Manager. + -- See https://wezfurlong.org/wezterm/ - local wezterm = require 'wezterm' + local wezterm = require 'wezterm' - return {} + return {} + ''; + in + '' + assertFileExists home-files/.config/wezterm/wezterm.lua + assertFileContent home-files/.config/wezterm/wezterm.lua ${expected} ''; - in '' - assertFileExists home-files/.config/wezterm/wezterm.lua - assertFileContent home-files/.config/wezterm/wezterm.lua ${expected} - ''; } diff --git a/tests/modules/programs/wezterm/example-setting.nix b/tests/modules/programs/wezterm/example-setting.nix index 640328060..2502511d7 100644 --- a/tests/modules/programs/wezterm/example-setting.nix +++ b/tests/modules/programs/wezterm/example-setting.nix @@ -44,59 +44,61 @@ }; }; - nmt.script = let - expectedConfig = builtins.toFile "wezterm.lua" '' - -- Generated by Home Manager. - -- See https://wezfurlong.org/wezterm/ + nmt.script = + let + expectedConfig = builtins.toFile "wezterm.lua" '' + -- Generated by Home Manager. + -- See https://wezfurlong.org/wezterm/ - local wezterm = require 'wezterm' + local wezterm = require 'wezterm' - return { - font = wezterm.font("JetBrains Mono"), - font_size = 16.0, - color_scheme = "Tomorrow Night", - hide_tab_bar_if_only_one_tab = true, - default_prog = { "zsh", "--login", "-c", "tmux attach -t dev || tmux new -s dev" }, - keys = { - {key="n", mods="SHIFT|CTRL", action="ToggleFullScreen"}, + return { + font = wezterm.font("JetBrains Mono"), + font_size = 16.0, + color_scheme = "Tomorrow Night", + hide_tab_bar_if_only_one_tab = true, + default_prog = { "zsh", "--login", "-c", "tmux attach -t dev || tmux new -s dev" }, + keys = { + {key="n", mods="SHIFT|CTRL", action="ToggleFullScreen"}, + } } - } + ''; + expectedColorScheme = builtins.toFile "test.toml" '' + [colors] + ansi = [ + "#222222", + "#D14949", + "#48874F", + "#AFA75A", + "#599797", + "#8F6089", + "#5C9FA8", + "#8C8C8C", + ] + background = "#1B1B1B" + brights = [ + "#444444", + "#FF6D6D", + "#89FF95", + "#FFF484", + "#97DDFF", + "#FDAAF2", + "#85F5DA", + "#E9E9E9", + ] + cursor_bg = "#BEAF8A" + cursor_border = "#BEAF8A" + cursor_fg = "#1B1B1B" + foreground = "#BEAF8A" + selection_bg = "#444444" + selection_fg = "#E9E9E9" + ''; + in + '' + assertFileExists home-files/.config/wezterm/wezterm.lua + assertFileContent home-files/.config/wezterm/wezterm.lua ${expectedConfig} + assertFileExists home-files/.config/wezterm/colors/test.toml + assertFileContent home-files/.config/wezterm/colors/test.toml ${expectedColorScheme} ''; - expectedColorScheme = builtins.toFile "test.toml" '' - [colors] - ansi = [ - "#222222", - "#D14949", - "#48874F", - "#AFA75A", - "#599797", - "#8F6089", - "#5C9FA8", - "#8C8C8C", - ] - background = "#1B1B1B" - brights = [ - "#444444", - "#FF6D6D", - "#89FF95", - "#FFF484", - "#97DDFF", - "#FDAAF2", - "#85F5DA", - "#E9E9E9", - ] - cursor_bg = "#BEAF8A" - cursor_border = "#BEAF8A" - cursor_fg = "#1B1B1B" - foreground = "#BEAF8A" - selection_bg = "#444444" - selection_fg = "#E9E9E9" - ''; - in '' - assertFileExists home-files/.config/wezterm/wezterm.lua - assertFileContent home-files/.config/wezterm/wezterm.lua ${expectedConfig} - assertFileExists home-files/.config/wezterm/colors/test.toml - assertFileContent home-files/.config/wezterm/colors/test.toml ${expectedColorScheme} - ''; } diff --git a/tests/modules/programs/wlogout/layout-multiple.nix b/tests/modules/programs/wlogout/layout-multiple.nix index 8e7e06a80..4d8898eb3 100644 --- a/tests/modules/programs/wlogout/layout-multiple.nix +++ b/tests/modules/programs/wlogout/layout-multiple.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { home.stateVersion = "22.11"; diff --git a/tests/modules/programs/wlogout/layout-single.nix b/tests/modules/programs/wlogout/layout-single.nix index 9bcac8211..1b1788bf5 100644 --- a/tests/modules/programs/wlogout/layout-single.nix +++ b/tests/modules/programs/wlogout/layout-single.nix @@ -1,16 +1,19 @@ -{ config, ... }: { +{ config, ... }: +{ config = { home.stateVersion = "22.11"; programs.wlogout = { package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; enable = true; - layout = [{ - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown"; - keybind = "s"; - }]; + layout = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + ]; }; nmt.script = '' diff --git a/tests/modules/programs/wlogout/styling.nix b/tests/modules/programs/wlogout/styling.nix index 8233d25b6..bca1b024f 100644 --- a/tests/modules/programs/wlogout/styling.nix +++ b/tests/modules/programs/wlogout/styling.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { home.stateVersion = "22.11"; diff --git a/tests/modules/programs/xmobar/basic-configuration.nix b/tests/modules/programs/xmobar/basic-configuration.nix index 897094417..88abf90ca 100644 --- a/tests/modules/programs/xmobar/basic-configuration.nix +++ b/tests/modules/programs/xmobar/basic-configuration.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ config = { programs.xmobar = { enable = true; diff --git a/tests/modules/programs/yambar/example-settings.nix b/tests/modules/programs/yambar/example-settings.nix index 19b3e203b..1b6587d15 100644 --- a/tests/modules/programs/yambar/example-settings.nix +++ b/tests/modules/programs/yambar/example-settings.nix @@ -6,7 +6,7 @@ location = "top"; height = 26; background = "00000066"; - right = [{ clock.content = [{ string.text = "{time}"; }]; }]; + right = [ { clock.content = [ { string.text = "{time}"; } ]; } ]; }; }; }; @@ -14,18 +14,16 @@ nmt.script = '' assertFileContent \ home-files/.config/yambar/config.yml \ - ${ - builtins.toFile "yambar-expected.yml" '' - bar: - background: '00000066' - height: 26 - location: top - right: - - clock: - content: - - string: - text: '{time}' - '' - } + ${builtins.toFile "yambar-expected.yml" '' + bar: + background: '00000066' + height: 26 + location: top + right: + - clock: + content: + - string: + text: '{time}' + ''} ''; } diff --git a/tests/modules/programs/yazi/bash-integration-enabled.nix b/tests/modules/programs/yazi/bash-integration-enabled.nix index 3c590ff6d..1bebbccad 100644 --- a/tests/modules/programs/yazi/bash-integration-enabled.nix +++ b/tests/modules/programs/yazi/bash-integration-enabled.nix @@ -9,7 +9,8 @@ let rm -f -- "$tmp" } ''; -in { +in +{ programs.bash.enable = true; programs.yazi = { diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix index 6753c74ee..cae016274 100644 --- a/tests/modules/programs/yazi/nushell-integration-enabled.nix +++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix @@ -12,7 +12,8 @@ let rm -fp $tmp } ''; -in { +in +{ programs.nushell.enable = true; programs.yazi = { @@ -20,12 +21,15 @@ in { enableNushellIntegration = true; }; - nmt.script = let - configPath = if pkgs.stdenv.isDarwin && !config.xdg.enable then - "home-files/Library/Application Support/nushell/config.nu" - else - "home-files/.config/nushell/config.nu"; - in '' - assertFileContains '${configPath}' '${shellIntegration}' - ''; + nmt.script = + let + configPath = + if pkgs.stdenv.isDarwin && !config.xdg.enable then + "home-files/Library/Application Support/nushell/config.nu" + else + "home-files/.config/nushell/config.nu"; + in + '' + assertFileContains '${configPath}' '${shellIntegration}' + ''; } diff --git a/tests/modules/programs/yazi/settings.nix b/tests/modules/programs/yazi/settings.nix index f2e194f0e..6395a5a7c 100644 --- a/tests/modules/programs/yazi/settings.nix +++ b/tests/modules/programs/yazi/settings.nix @@ -37,7 +37,9 @@ ]; }; settings = { - log = { enabled = false; }; + log = { + enabled = false; + }; manager = { show_hidden = false; sort_by = "mtime"; diff --git a/tests/modules/programs/yazi/zsh-integration-enabled.nix b/tests/modules/programs/yazi/zsh-integration-enabled.nix index 669b8a517..ef8e0ccc8 100644 --- a/tests/modules/programs/yazi/zsh-integration-enabled.nix +++ b/tests/modules/programs/yazi/zsh-integration-enabled.nix @@ -9,7 +9,8 @@ let rm -f -- "$tmp" } ''; -in { +in +{ programs.zsh.enable = true; programs.yazi = { diff --git a/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix b/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix index 37a0d034f..2001e4e2d 100644 --- a/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix +++ b/tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix @@ -8,8 +8,6 @@ nmt.script = '' assertFileExists home-files/.config/yt-dlp/config - assertFileContent home-files/.config/yt-dlp/config ${ - ./yt-dlp-extraConfig-expected - } + assertFileContent home-files/.config/yt-dlp/config ${./yt-dlp-extraConfig-expected} ''; } 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 734a5c10a..b48782c1b 100644 --- a/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix +++ b/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix @@ -16,8 +16,6 @@ nmt.script = '' assertFileExists home-files/.config/yt-dlp/config - assertFileContent home-files/.config/yt-dlp/config ${ - ./yt-dlp-simple-config-expected - } + assertFileContent home-files/.config/yt-dlp/config ${./yt-dlp-simple-config-expected} ''; } diff --git a/tests/modules/programs/zed-editor/extensions.nix b/tests/modules/programs/zed-editor/extensions.nix index 82b79aed8..e3d868725 100644 --- a/tests/modules/programs/zed-editor/extensions.nix +++ b/tests/modules/programs/zed-editor/extensions.nix @@ -4,21 +4,27 @@ programs.zed-editor = { enable = true; package = config.lib.test.mkStubPackage { }; - extensions = [ "swift" "html" "xy-zed" ]; + extensions = [ + "swift" + "html" + "xy-zed" + ]; }; - nmt.script = let - expectedContent = builtins.toFile "expected.json" '' - { - "auto_install_extensions": { - "html": true, - "swift": true, - "xy-zed": true + nmt.script = + let + expectedContent = builtins.toFile "expected.json" '' + { + "auto_install_extensions": { + "html": true, + "swift": true, + "xy-zed": true + } } - } + ''; + in + '' + assertFileExists "home-files/.config/zed/settings.json" + assertFileContent "home-files/.config/zed/settings.json" "${expectedContent}" ''; - in '' - assertFileExists "home-files/.config/zed/settings.json" - assertFileContent "home-files/.config/zed/settings.json" "${expectedContent}" - ''; } diff --git a/tests/modules/programs/zed-editor/keymap.nix b/tests/modules/programs/zed-editor/keymap.nix index df6abebdf..ca70647a1 100644 --- a/tests/modules/programs/zed-editor/keymap.nix +++ b/tests/modules/programs/zed-editor/keymap.nix @@ -6,34 +6,42 @@ enable = true; package = config.lib.test.mkStubPackage { }; userKeymaps = [ - { bindings = { up = "menu::SelectPrev"; }; } + { + bindings = { + up = "menu::SelectPrev"; + }; + } { context = "Editor"; - bindings = { escape = "editor::Cancel"; }; + bindings = { + escape = "editor::Cancel"; + }; } ]; }; - nmt.script = let - expectedContent = builtins.toFile "expected.json" '' - [ - { - "bindings": { - "up": "menu::SelectPrev" - } - }, - { - "bindings": { - "escape": "editor::Cancel" + nmt.script = + let + expectedContent = builtins.toFile "expected.json" '' + [ + { + "bindings": { + "up": "menu::SelectPrev" + } }, - "context": "Editor" - } - ] - ''; + { + "bindings": { + "escape": "editor::Cancel" + }, + "context": "Editor" + } + ] + ''; - keymapPath = ".config/zed/keymap.json"; - in '' - assertFileExists "home-files/${keymapPath}" - assertFileContent "home-files/${keymapPath}" "${expectedContent}" - ''; + keymapPath = ".config/zed/keymap.json"; + in + '' + assertFileExists "home-files/${keymapPath}" + assertFileContent "home-files/${keymapPath}" "${expectedContent}" + ''; } diff --git a/tests/modules/programs/zed-editor/settings.nix b/tests/modules/programs/zed-editor/settings.nix index e6f077423..258d4ceac 100644 --- a/tests/modules/programs/zed-editor/settings.nix +++ b/tests/modules/programs/zed-editor/settings.nix @@ -7,29 +7,33 @@ package = config.lib.test.mkStubPackage { }; userSettings = { theme = "XY-Zed"; - features = { copilot = false; }; + features = { + copilot = false; + }; vim_mode = false; ui_font_size = 16; buffer_font_size = 16; }; }; - nmt.script = let - expectedContent = builtins.toFile "expected.json" '' - { - "buffer_font_size": 16, - "features": { - "copilot": false - }, - "theme": "XY-Zed", - "ui_font_size": 16, - "vim_mode": false - } - ''; + nmt.script = + let + expectedContent = builtins.toFile "expected.json" '' + { + "buffer_font_size": 16, + "features": { + "copilot": false + }, + "theme": "XY-Zed", + "ui_font_size": 16, + "vim_mode": false + } + ''; - settingsPath = ".config/zed/settings.json"; - in '' - assertFileExists "home-files/${settingsPath}" - assertFileContent "home-files/${settingsPath}" "${expectedContent}" - ''; + settingsPath = ".config/zed/settings.json"; + in + '' + assertFileExists "home-files/${settingsPath}" + assertFileContent "home-files/${settingsPath}" "${expectedContent}" + ''; } diff --git a/tests/modules/programs/zellij/enable-shells.nix b/tests/modules/programs/zellij/enable-shells.nix index 4a35df28d..cba42e2ae 100644 --- a/tests/modules/programs/zellij/enable-shells.nix +++ b/tests/modules/programs/zellij/enable-shells.nix @@ -18,8 +18,9 @@ }; # Needed to avoid error with dummy fish package. - xdg.dataFile."fish/home-manager_generated_completions".source = - lib.mkForce (builtins.toFile "empty" ""); + xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce ( + builtins.toFile "empty" "" + ); nmt.script = '' assertFileExists home-files/.bashrc diff --git a/tests/modules/programs/zk/zk.nix b/tests/modules/programs/zk/zk.nix index b22eb35d9..660a77a9a 100644 --- a/tests/modules/programs/zk/zk.nix +++ b/tests/modules/programs/zk/zk.nix @@ -2,7 +2,9 @@ programs.zk = { enable = true; settings = { - extra = { author = "Mickaël"; }; + extra = { + author = "Mickaël"; + }; note = { default-title = "Untitled"; @@ -15,7 +17,9 @@ language = "en"; }; - notebook = { dir = "~/notebook"; }; + notebook = { + dir = "~/notebook"; + }; }; }; diff --git a/tests/modules/programs/zplug/modules.nix b/tests/modules/programs/zplug/modules.nix index ffb81d7c1..4872ec63a 100644 --- a/tests/modules/programs/zplug/modules.nix +++ b/tests/modules/programs/zplug/modules.nix @@ -13,7 +13,10 @@ } { name = "lib/clipboard"; - tags = [ "from:oh-my-zsh" ''if:"[[ $OSTYPE == *darwin* ]]"'' ]; + tags = [ + "from:oh-my-zsh" + ''if:"[[ $OSTYPE == *darwin* ]]"'' + ]; } ]; }; diff --git a/tests/modules/programs/zsh/aliases.nix b/tests/modules/programs/zsh/aliases.nix index a3fa2b360..69a337308 100644 --- a/tests/modules/programs/zsh/aliases.nix +++ b/tests/modules/programs/zsh/aliases.nix @@ -8,45 +8,45 @@ test1 = "alias"; test2 = "alias2"; }; - shellGlobalAliases = { global = "test"; }; + shellGlobalAliases = { + global = "test"; + }; }; nmt.script = '' assertFileExists home-files/.zshrc - assertFileContent home-files/.zshrc ${ - builtins.toFile "expected-.zshrc" '' - typeset -U path cdpath fpath manpath - for profile in ''${(z)NIX_PROFILES}; do - fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) - done + assertFileContent home-files/.zshrc ${builtins.toFile "expected-.zshrc" '' + typeset -U path cdpath fpath manpath + for profile in ''${(z)NIX_PROFILES}; do + fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) + done - HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help" + HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help" - autoload -U compinit && compinit - # History options should be set in .zshrc and after oh-my-zsh sourcing. - # See https://github.com/nix-community/home-manager/issues/177. - HISTSIZE="10000" - SAVEHIST="10000" + autoload -U compinit && compinit + # History options should be set in .zshrc and after oh-my-zsh sourcing. + # See https://github.com/nix-community/home-manager/issues/177. + HISTSIZE="10000" + SAVEHIST="10000" - HISTFILE="$HOME/.zsh_history" - mkdir -p "$(dirname "$HISTFILE")" + HISTFILE="$HOME/.zsh_history" + mkdir -p "$(dirname "$HISTFILE")" - setopt HIST_FCNTL_LOCK - unsetopt APPEND_HISTORY - setopt HIST_IGNORE_DUPS - unsetopt HIST_IGNORE_ALL_DUPS - unsetopt HIST_SAVE_NO_DUPS - unsetopt HIST_FIND_NO_DUPS - setopt HIST_IGNORE_SPACE - unsetopt HIST_EXPIRE_DUPS_FIRST - setopt SHARE_HISTORY - unsetopt EXTENDED_HISTORY + setopt HIST_FCNTL_LOCK + unsetopt APPEND_HISTORY + setopt HIST_IGNORE_DUPS + unsetopt HIST_IGNORE_ALL_DUPS + unsetopt HIST_SAVE_NO_DUPS + unsetopt HIST_FIND_NO_DUPS + setopt HIST_IGNORE_SPACE + unsetopt HIST_EXPIRE_DUPS_FIRST + setopt SHARE_HISTORY + unsetopt EXTENDED_HISTORY - alias -- test1=alias - alias -- test2=alias2 - alias -g -- global=test'' - } + alias -- test1=alias + alias -- test2=alias2 + alias -g -- global=test''} ''; } diff --git a/tests/modules/programs/zsh/history-ignore-pattern.nix b/tests/modules/programs/zsh/history-ignore-pattern.nix index 2442c32f3..7c1ce832b 100644 --- a/tests/modules/programs/zsh/history-ignore-pattern.nix +++ b/tests/modules/programs/zsh/history-ignore-pattern.nix @@ -1,7 +1,17 @@ { imports = [ - ({ ... }: { config.programs.zsh.history.ignorePatterns = [ "echo *" ]; }) - ({ ... }: { config.programs.zsh.history.ignorePatterns = [ "rm *" ]; }) + ( + { ... }: + { + config.programs.zsh.history.ignorePatterns = [ "echo *" ]; + } + ) + ( + { ... }: + { + config.programs.zsh.history.ignorePatterns = [ "rm *" ]; + } + ) ]; programs.zsh.enable = true; diff --git a/tests/modules/programs/zsh/history-substring-search.nix b/tests/modules/programs/zsh/history-substring-search.nix index 94c2bae9c..5fe204c61 100644 --- a/tests/modules/programs/zsh/history-substring-search.nix +++ b/tests/modules/programs/zsh/history-substring-search.nix @@ -4,7 +4,10 @@ historySubstringSearch = { enable = true; searchDownKey = "^[[B"; - searchUpKey = [ "^[[A" "\\eOA" ]; + searchUpKey = [ + "^[[A" + "\\eOA" + ]; }; }; diff --git a/tests/modules/programs/zsh/syntax-highlighting.nix b/tests/modules/programs/zsh/syntax-highlighting.nix index ed7626fcb..d014d85a4 100644 --- a/tests/modules/programs/zsh/syntax-highlighting.nix +++ b/tests/modules/programs/zsh/syntax-highlighting.nix @@ -6,7 +6,11 @@ syntaxHighlighting = { enable = true; package = pkgs.hello; - highlighters = [ "brackets" "pattern" "cursor" ]; + highlighters = [ + "brackets" + "pattern" + "cursor" + ]; styles.comment = "fg=#6c6c6c"; patterns."rm -rf *" = "fg=white,bold,bg=red"; }; diff --git a/tests/modules/programs/zsh/zsh-abbr.nix b/tests/modules/programs/zsh/zsh-abbr.nix index 5be5e2b03..e0e092521 100644 --- a/tests/modules/programs/zsh/zsh-abbr.nix +++ b/tests/modules/programs/zsh/zsh-abbr.nix @@ -1,7 +1,9 @@ { programs.zsh.zsh-abbr = { enable = true; - abbreviations = { ga = "git add"; }; + abbreviations = { + ga = "git add"; + }; }; nmt.script = '' diff --git a/tests/modules/programs/zsh/zshrc-content-priorities.nix b/tests/modules/programs/zsh/zshrc-content-priorities.nix index 76657cc89..aac0daf40 100644 --- a/tests/modules/programs/zsh/zshrc-content-priorities.nix +++ b/tests/modules/programs/zsh/zshrc-content-priorities.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ programs.zsh = { enable = true; @@ -22,53 +23,55 @@ zprof.enable = true; }; - nmt.script = let - expectedFile = pkgs.writeTextFile { - name = ".zshrc"; - text = '' - zmodload zsh/zprof + nmt.script = + let + expectedFile = pkgs.writeTextFile { + name = ".zshrc"; + text = '' + zmodload zsh/zprof - # High priority (mkBefore) - echo "High priority content" + # High priority (mkBefore) + echo "High priority content" - typeset -U path cdpath fpath manpath - for profile in ''${(z)NIX_PROFILES}; do - fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) - done + typeset -U path cdpath fpath manpath + for profile in ''${(z)NIX_PROFILES}; do + fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) + done - HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help" + HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help" - autoload -U compinit && compinit - # History options should be set in .zshrc and after oh-my-zsh sourcing. - # See https://github.com/nix-community/home-manager/issues/177. - HISTSIZE="10000" - SAVEHIST="10000" + autoload -U compinit && compinit + # History options should be set in .zshrc and after oh-my-zsh sourcing. + # See https://github.com/nix-community/home-manager/issues/177. + HISTSIZE="10000" + SAVEHIST="10000" - HISTFILE="$HOME/.zsh_history" - mkdir -p "$(dirname "$HISTFILE")" + HISTFILE="$HOME/.zsh_history" + mkdir -p "$(dirname "$HISTFILE")" - setopt HIST_FCNTL_LOCK - unsetopt APPEND_HISTORY - setopt HIST_IGNORE_DUPS - unsetopt HIST_IGNORE_ALL_DUPS - unsetopt HIST_SAVE_NO_DUPS - unsetopt HIST_FIND_NO_DUPS - setopt HIST_IGNORE_SPACE - unsetopt HIST_EXPIRE_DUPS_FIRST - setopt SHARE_HISTORY - unsetopt EXTENDED_HISTORY + setopt HIST_FCNTL_LOCK + unsetopt APPEND_HISTORY + setopt HIST_IGNORE_DUPS + unsetopt HIST_IGNORE_ALL_DUPS + unsetopt HIST_SAVE_NO_DUPS + unsetopt HIST_FIND_NO_DUPS + setopt HIST_IGNORE_SPACE + unsetopt HIST_EXPIRE_DUPS_FIRST + setopt SHARE_HISTORY + unsetopt EXTENDED_HISTORY - # Default priority - echo "Default priority content" + # Default priority + echo "Default priority content" - zprof - # Low priority (mkAfter) - echo "Low priority content" - ''; - }; - in '' - assertFileExists home-files/.zshrc - assertFileContent home-files/.zshrc ${expectedFile} - ''; + zprof + # Low priority (mkAfter) + echo "Low priority content" + ''; + }; + in + '' + assertFileExists home-files/.zshrc + assertFileContent home-files/.zshrc ${expectedFile} + ''; } diff --git a/tests/modules/services/activitywatch/basic-setup.nix b/tests/modules/services/activitywatch/basic-setup.nix index d3a14ae87..cd72b6778 100644 --- a/tests/modules/services/activitywatch/basic-setup.nix +++ b/tests/modules/services/activitywatch/basic-setup.nix @@ -1,13 +1,17 @@ { config, ... }: -let stubPackage = config.lib.test.mkStubPackage { }; +let + stubPackage = config.lib.test.mkStubPackage { }; -in { +in +{ services.activitywatch = { enable = true; settings = { port = 3012; - custom_static = { custom-watcher = stubPackage; }; + custom_static = { + custom-watcher = stubPackage; + }; }; watchers = { # These are basically examples of a real world usage. diff --git a/tests/modules/services/avizo/with-settings.nix b/tests/modules/services/avizo/with-settings.nix index 80b219392..3086bae65 100644 --- a/tests/modules/services/avizo/with-settings.nix +++ b/tests/modules/services/avizo/with-settings.nix @@ -15,36 +15,32 @@ nmt.script = '' serviceFile=home-files/.config/systemd/user/avizo.service assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $serviceFile ${builtins.toFile "expected" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@avizo@/bin/avizo-service - Restart=always - Type=simple + [Service] + ExecStart=@avizo@/bin/avizo-service + Restart=always + Type=simple - [Unit] - After=graphical-session.target - ConditionEnvironment=WAYLAND_DISPLAY - Description=Volume/backlight OSD indicator - Documentation=man:avizo(1) - PartOf=graphical-session.target - '' - } + [Unit] + After=graphical-session.target + ConditionEnvironment=WAYLAND_DISPLAY + Description=Volume/backlight OSD indicator + Documentation=man:avizo(1) + PartOf=graphical-session.target + ''} configFile=home-files/.config/avizo/config.ini assertFileExists $configFile - assertFileContent $configFile ${ - builtins.toFile "expected" '' - [default] - fade-in=0.100000 - fade-out=0.200000 - padding=10 - time=1.000000 - y-offset=0.500000 - '' - } + assertFileContent $configFile ${builtins.toFile "expected" '' + [default] + fade-in=0.100000 + fade-out=0.200000 + padding=10 + time=1.000000 + y-offset=0.500000 + ''} ''; } diff --git a/tests/modules/services/avizo/without-settings.nix b/tests/modules/services/avizo/without-settings.nix index b6bf03cff..5d5abe763 100644 --- a/tests/modules/services/avizo/without-settings.nix +++ b/tests/modules/services/avizo/without-settings.nix @@ -4,24 +4,22 @@ nmt.script = '' serviceFile=home-files/.config/systemd/user/avizo.service assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $serviceFile ${builtins.toFile "expected" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@avizo@/bin/avizo-service - Restart=always - Type=simple + [Service] + ExecStart=@avizo@/bin/avizo-service + Restart=always + Type=simple - [Unit] - After=graphical-session.target - ConditionEnvironment=WAYLAND_DISPLAY - Description=Volume/backlight OSD indicator - Documentation=man:avizo(1) - PartOf=graphical-session.target - '' - } + [Unit] + After=graphical-session.target + ConditionEnvironment=WAYLAND_DISPLAY + Description=Volume/backlight OSD indicator + Documentation=man:avizo(1) + PartOf=graphical-session.target + ''} configFile=home-files/.config/avizo/config.ini assertPathNotExists $configFile diff --git a/tests/modules/services/blanket/basic-configuration.nix b/tests/modules/services/blanket/basic-configuration.nix index f4ded9e9c..83840564d 100644 --- a/tests/modules/services/blanket/basic-configuration.nix +++ b/tests/modules/services/blanket/basic-configuration.nix @@ -5,23 +5,21 @@ clientServiceFile=home-files/.config/systemd/user/blanket.service assertFileExists $clientServiceFile - assertFileContent $clientServiceFile ${ - builtins.toFile "expected.service" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $clientServiceFile ${builtins.toFile "expected.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@blanket@/bin/blanket --gapplication-service - Restart=on-failure - RestartSec=5 + [Service] + ExecStart=@blanket@/bin/blanket --gapplication-service + Restart=on-failure + RestartSec=5 - [Unit] - After=graphical-session.target - Description=Blanket daemon - PartOf=graphical-session.target - PartOf=pipewire.service - Requires=dbus.service - '' - } + [Unit] + After=graphical-session.target + Description=Blanket daemon + PartOf=graphical-session.target + PartOf=pipewire.service + Requires=dbus.service + ''} ''; } diff --git a/tests/modules/services/cachix-agent/basic-setup.nix b/tests/modules/services/cachix-agent/basic-setup.nix index 9371d8343..693daf976 100644 --- a/tests/modules/services/cachix-agent/basic-setup.nix +++ b/tests/modules/services/cachix-agent/basic-setup.nix @@ -7,21 +7,19 @@ nmt.script = '' assertFileContent \ home-files/.config/systemd/user/cachix-agent.service \ - ${ - builtins.toFile "cachix-agent.service" '' - [Install] - WantedBy=default.target + ${builtins.toFile "cachix-agent.service" '' + [Install] + WantedBy=default.target - [Service] - Environment=PATH=@nix@/bin - EnvironmentFile=/home/hm-user/.config/cachix-agent.token - ExecStart=@cachix@/bin/cachix deploy agent test-agent home-manager - KillMode=process - Restart=on-failure + [Service] + Environment=PATH=@nix@/bin + EnvironmentFile=/home/hm-user/.config/cachix-agent.token + ExecStart=@cachix@/bin/cachix deploy agent test-agent home-manager + KillMode=process + Restart=on-failure - [Unit] - Description=Cachix Deploy Agent - '' - } + [Unit] + Description=Cachix Deploy Agent + ''} ''; } diff --git a/tests/modules/services/cliphist/cliphist-extra-options.nix b/tests/modules/services/cliphist/cliphist-extra-options.nix index 60a3ce7aa..f8298c400 100644 --- a/tests/modules/services/cliphist/cliphist-extra-options.nix +++ b/tests/modules/services/cliphist/cliphist-extra-options.nix @@ -2,7 +2,12 @@ services.cliphist = { enable = true; allowImages = true; - extraOptions = [ "-max-dedupe-search" "10" "-max-items" "500" ]; + extraOptions = [ + "-max-dedupe-search" + "10" + "-max-items" + "500" + ]; }; nmt.script = '' diff --git a/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix b/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix index 64c804723..3419bb696 100644 --- a/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix +++ b/tests/modules/services/cliphist/cliphist-multiple-session-targets.nix @@ -2,7 +2,10 @@ services.cliphist = { enable = true; - systemdTargets = [ "sway-session.target" "hyprland-session.target" ]; + systemdTargets = [ + "sway-session.target" + "hyprland-session.target" + ]; }; nmt.script = '' diff --git a/tests/modules/services/cliphist/cliphist-sway-session-target.nix b/tests/modules/services/cliphist/cliphist-sway-session-target.nix index a3d13ad10..ef9e1df2d 100644 --- a/tests/modules/services/cliphist/cliphist-sway-session-target.nix +++ b/tests/modules/services/cliphist/cliphist-sway-session-target.nix @@ -12,9 +12,7 @@ ''; test.asserts.warnings.expected = [ - "The option `services.cliphist.systemdTarget' defined in ${ - lib.showFiles options.services.cliphist.systemdTarget.files - } has been renamed to `services.cliphist.systemdTargets'." + "The option `services.cliphist.systemdTarget' defined in ${lib.showFiles options.services.cliphist.systemdTarget.files} has been renamed to `services.cliphist.systemdTargets'." ]; } diff --git a/tests/modules/services/darkman/basic-configuration.nix b/tests/modules/services/darkman/basic-configuration.nix index 8e1a33bc6..dbc89ac94 100644 --- a/tests/modules/services/darkman/basic-configuration.nix +++ b/tests/modules/services/darkman/basic-configuration.nix @@ -29,40 +29,34 @@ lightModeScriptFile=$(normalizeStorePaths home-files/.local/share/light-mode.d/color-scheme-light) assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $serviceFile ${builtins.toFile "expected" '' + [Install] + WantedBy=graphical-session.target - [Service] - BusName=nl.whynothugo.darkman - ExecStart=@darkman@/bin/darkman run - Restart=on-failure - Slice=background.slice - TimeoutStopSec=15 - Type=dbus + [Service] + BusName=nl.whynothugo.darkman + ExecStart=@darkman@/bin/darkman run + Restart=on-failure + Slice=background.slice + TimeoutStopSec=15 + Type=dbus - [Unit] - BindsTo=graphical-session.target - Description=Darkman system service - Documentation=man:darkman(1) - PartOf=graphical-session.target - X-Restart-Triggers=/nix/store/00000000000000000000000000000000-darkman-config.yaml - '' - } - assertFileContent $darkModeScriptFile ${ - builtins.toFile "expected" '' - #!/nix/store/00000000000000000000000000000000-bash/bin/bash - dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" + [Unit] + BindsTo=graphical-session.target + Description=Darkman system service + Documentation=man:darkman(1) + PartOf=graphical-session.target + X-Restart-Triggers=/nix/store/00000000000000000000000000000000-darkman-config.yaml + ''} + assertFileContent $darkModeScriptFile ${builtins.toFile "expected" '' + #!/nix/store/00000000000000000000000000000000-bash/bin/bash + dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" - '' - } - assertFileContent $lightModeScriptFile ${ - builtins.toFile "expected" '' - #!@python@/bin/python + ''} + assertFileContent $lightModeScriptFile ${builtins.toFile "expected" '' + #!@python@/bin/python - print('Do something!') - '' - } + print('Do something!') + ''} ''; } diff --git a/tests/modules/services/darkman/no-configuration.nix b/tests/modules/services/darkman/no-configuration.nix index 50802eb42..e80f64116 100644 --- a/tests/modules/services/darkman/no-configuration.nix +++ b/tests/modules/services/darkman/no-configuration.nix @@ -5,28 +5,25 @@ serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/darkman.service) assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $serviceFile ${builtins.toFile "expected" '' + [Install] + WantedBy=graphical-session.target - [Service] - BusName=nl.whynothugo.darkman - ExecStart=@darkman@/bin/darkman run - Restart=on-failure - Slice=background.slice - TimeoutStopSec=15 - Type=dbus + [Service] + BusName=nl.whynothugo.darkman + ExecStart=@darkman@/bin/darkman run + Restart=on-failure + Slice=background.slice + TimeoutStopSec=15 + Type=dbus - [Unit] - BindsTo=graphical-session.target - Description=Darkman system service - Documentation=man:darkman(1) - PartOf=graphical-session.target - '' - } + [Unit] + BindsTo=graphical-session.target + Description=Darkman system service + Documentation=man:darkman(1) + PartOf=graphical-session.target + ''} assertPathNotExists home-files/.local/share/dark-mode.d/color-scheme-dark assertPathNotExists home-files/.local/share/light-mode.d/color-scheme-light ''; } - diff --git a/tests/modules/services/davmail/custom-settings.nix b/tests/modules/services/davmail/custom-settings.nix index 012324adc..00380a620 100644 --- a/tests/modules/services/davmail/custom-settings.nix +++ b/tests/modules/services/davmail/custom-settings.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ services.davmail = { enable = true; settings = { @@ -13,29 +14,27 @@ assertFileExists $serviceFile configFile=$(grep -o '/nix/store/.*-davmail.properties' $TESTED/$serviceFile) assertFileExists $configFile - assertFileContent $configFile ${ - pkgs.writeText "custom-settings.properties" '' - # Generated with Nix + assertFileContent $configFile ${pkgs.writeText "custom-settings.properties" '' + # Generated with Nix - davmail.caldavPort = 1080 - davmail.disableUpdateCheck = true - davmail.imapPort = 4444 - davmail.ldapPort = 1389 - davmail.logFilePath = ${config.xdg.stateHome}/davmail.log - davmail.logFileSize = 1MB - davmail.mode = auto - davmail.oauth.redirectUri = urn:ietf:wg:oauth:2.0:oob - davmail.oauth.tokenFilePath = ${config.xdg.stateHome}/davmail-tokens - davmail.persistToken = true - davmail.popPort = 1110 - davmail.server = true - davmail.smtpPort = 1025 - davmail.url = https://outlook.office365.com/EWS/Exchange.asmx - log4j.logger.davmail = WARN - log4j.logger.httpclient.wire = WARN - log4j.logger.org.apache.commons.httpclient = WARN - log4j.rootLogger = WARN - '' - } + davmail.caldavPort = 1080 + davmail.disableUpdateCheck = true + davmail.imapPort = 4444 + davmail.ldapPort = 1389 + davmail.logFilePath = ${config.xdg.stateHome}/davmail.log + davmail.logFileSize = 1MB + davmail.mode = auto + davmail.oauth.redirectUri = urn:ietf:wg:oauth:2.0:oob + davmail.oauth.tokenFilePath = ${config.xdg.stateHome}/davmail-tokens + davmail.persistToken = true + davmail.popPort = 1110 + davmail.server = true + davmail.smtpPort = 1025 + davmail.url = https://outlook.office365.com/EWS/Exchange.asmx + log4j.logger.davmail = WARN + log4j.logger.httpclient.wire = WARN + log4j.logger.org.apache.commons.httpclient = WARN + log4j.rootLogger = WARN + ''} ''; } diff --git a/tests/modules/services/davmail/imitateOutlook.nix b/tests/modules/services/davmail/imitateOutlook.nix index 1faf1aa56..3da122d27 100644 --- a/tests/modules/services/davmail/imitateOutlook.nix +++ b/tests/modules/services/davmail/imitateOutlook.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ services.davmail = { enable = true; imitateOutlook = true; @@ -9,29 +10,27 @@ assertFileExists $serviceFile configFile=$(grep -o '/nix/store/.*-davmail.properties' $TESTED/$serviceFile) assertFileExists $configFile - assertFileContent $configFile ${ - pkgs.writeText "imitateOutlook.properties" '' - # Generated with Nix + assertFileContent $configFile ${pkgs.writeText "imitateOutlook.properties" '' + # Generated with Nix - davmail.caldavPort = 1080 - davmail.disableUpdateCheck = true - davmail.imapPort = 1143 - davmail.ldapPort = 1389 - davmail.logFilePath = ${config.xdg.stateHome}/davmail.log - davmail.logFileSize = 1MB - davmail.mode = auto - davmail.oauth.clientId = d3590ed6-52b3-4102-aeff-aad2292ab01c - davmail.oauth.redirectUri = urn:ietf:wg:oauth:2.0:oob - davmail.oauth.tokenFilePath = ${config.xdg.stateHome}/davmail-tokens - davmail.popPort = 1110 - davmail.server = true - davmail.smtpPort = 1025 - davmail.url = https://outlook.office365.com/EWS/Exchange.asmx - log4j.logger.davmail = WARN - log4j.logger.httpclient.wire = WARN - log4j.logger.org.apache.commons.httpclient = WARN - log4j.rootLogger = WARN - '' - } + davmail.caldavPort = 1080 + davmail.disableUpdateCheck = true + davmail.imapPort = 1143 + davmail.ldapPort = 1389 + davmail.logFilePath = ${config.xdg.stateHome}/davmail.log + davmail.logFileSize = 1MB + davmail.mode = auto + davmail.oauth.clientId = d3590ed6-52b3-4102-aeff-aad2292ab01c + davmail.oauth.redirectUri = urn:ietf:wg:oauth:2.0:oob + davmail.oauth.tokenFilePath = ${config.xdg.stateHome}/davmail-tokens + davmail.popPort = 1110 + davmail.server = true + davmail.smtpPort = 1025 + davmail.url = https://outlook.office365.com/EWS/Exchange.asmx + log4j.logger.davmail = WARN + log4j.logger.httpclient.wire = WARN + log4j.logger.org.apache.commons.httpclient = WARN + log4j.rootLogger = WARN + ''} ''; } diff --git a/tests/modules/services/easyeffects/example-preset.nix b/tests/modules/services/easyeffects/example-preset.nix index e6906d8f2..69e403be0 100644 --- a/tests/modules/services/easyeffects/example-preset.nix +++ b/tests/modules/services/easyeffects/example-preset.nix @@ -29,8 +29,6 @@ nmt.script = '' assertFileContent \ - home-files/.config/easyeffects/input/example-preset.json "${ - ./example-preset.json - }" + home-files/.config/easyeffects/input/example-preset.json "${./example-preset.json}" ''; } diff --git a/tests/modules/services/easyeffects/service.nix b/tests/modules/services/easyeffects/service.nix index 86c46374e..9111614df 100644 --- a/tests/modules/services/easyeffects/service.nix +++ b/tests/modules/services/easyeffects/service.nix @@ -1,7 +1,9 @@ { ... }: { - services.easyeffects = { enable = true; }; + services.easyeffects = { + enable = true; + }; test.stubs.easyeffects = { }; diff --git a/tests/modules/services/emacs-darwin/basic.nix b/tests/modules/services/emacs-darwin/basic.nix index dac7c2d63..97ac5db74 100644 --- a/tests/modules/services/emacs-darwin/basic.nix +++ b/tests/modules/services/emacs-darwin/basic.nix @@ -6,12 +6,17 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; - services.emacs = { enable = true; }; + services.emacs = { + enable = true; + }; nmt.script = '' serviceFile=LaunchAgents/org.nix-community.home.emacs.plist diff --git a/tests/modules/services/emacs/default.nix b/tests/modules/services/emacs/default.nix index f3647efd6..da2b8748c 100644 --- a/tests/modules/services/emacs/default.nix +++ b/tests/modules/services/emacs/default.nix @@ -1,11 +1,9 @@ { emacs-service-27 = ./emacs-service-27.nix; emacs-service-28 = ./emacs-service-28.nix; - emacs-service-28-after-graphical-session-target = - ./emacs-service-28-after-graphical-session-target.nix; + emacs-service-28-after-graphical-session-target = ./emacs-service-28-after-graphical-session-target.nix; emacs-socket-27 = ./emacs-socket-27.nix; emacs-socket-28 = ./emacs-socket-28.nix; emacs-default-editor = ./emacs-default-editor.nix; - emacs-socket-and-startWithUserSession = - ./emacs-socket-and-startWithUserSession.nix; + emacs-socket-and-startWithUserSession = ./emacs-socket-and-startWithUserSession.nix; } diff --git a/tests/modules/services/emacs/emacs-default-editor.nix b/tests/modules/services/emacs/emacs-default-editor.nix index de91846c9..f20f4d4fe 100644 --- a/tests/modules/services/emacs/emacs-default-editor.nix +++ b/tests/modules/services/emacs/emacs-default-editor.nix @@ -5,8 +5,7 @@ (self: super: { # Use `cat` instead of `echo` to prevent arguments from being # interpreted as an option. - emacs = pkgs.writeShellScriptBin "emacsclient" - ''${pkgs.coreutils}/bin/cat <<< "$*"''; + emacs = pkgs.writeShellScriptBin "emacsclient" ''${pkgs.coreutils}/bin/cat <<< "$*"''; }) ]; @@ -16,9 +15,9 @@ }; nmt.script = "source ${ - pkgs.substituteAll { - inherit (pkgs) coreutils; - src = ./emacs-default-editor.sh; - } - }"; + pkgs.substituteAll { + inherit (pkgs) coreutils; + src = ./emacs-default-editor.sh; + } + }"; } diff --git a/tests/modules/services/emacs/emacs-service-27.nix b/tests/modules/services/emacs/emacs-service-27.nix index 76c33a5e0..33ecd141a 100644 --- a/tests/modules/services/emacs/emacs-service-27.nix +++ b/tests/modules/services/emacs/emacs-service-27.nix @@ -6,15 +6,21 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; programs.emacs.enable = true; services.emacs.enable = true; services.emacs.client.enable = true; - services.emacs.extraOptions = [ "-f" "exwm-enable" ]; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; nmt.script = '' assertPathNotExists home-files/.config/systemd/user/emacs.socket @@ -23,12 +29,10 @@ assertFileContent \ home-files/.config/systemd/user/emacs.service \ - ${ - pkgs.substituteAll { - inherit (pkgs) runtimeShell; - src = ./emacs-service-emacs.service; - } - } + ${pkgs.substituteAll { + inherit (pkgs) runtimeShell; + src = ./emacs-service-emacs.service; + }} assertFileContent \ home-path/share/applications/emacsclient.desktop \ diff --git a/tests/modules/services/emacs/emacs-service-28-after-graphical-session-target.nix b/tests/modules/services/emacs/emacs-service-28-after-graphical-session-target.nix index edd232e44..bc93ca3c9 100644 --- a/tests/modules/services/emacs/emacs-service-28-after-graphical-session-target.nix +++ b/tests/modules/services/emacs/emacs-service-28-after-graphical-session-target.nix @@ -6,15 +6,21 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-28.2" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; programs.emacs.enable = true; services.emacs.enable = true; services.emacs.client.enable = true; - services.emacs.extraOptions = [ "-f" "exwm-enable" ]; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; services.emacs.startWithUserSession = "graphical"; nmt.script = '' @@ -24,12 +30,10 @@ assertFileContent \ home-files/.config/systemd/user/emacs.service \ - ${ - pkgs.substituteAll { - inherit (pkgs) runtimeShell; - src = ./emacs-service-emacs-after-graphical-session-target.service; - } - } + ${pkgs.substituteAll { + inherit (pkgs) runtimeShell; + src = ./emacs-service-emacs-after-graphical-session-target.service; + }} assertFileContent \ home-path/share/applications/emacsclient.desktop \ diff --git a/tests/modules/services/emacs/emacs-service-28.nix b/tests/modules/services/emacs/emacs-service-28.nix index a5d9c87c2..10e8d1a40 100644 --- a/tests/modules/services/emacs/emacs-service-28.nix +++ b/tests/modules/services/emacs/emacs-service-28.nix @@ -7,15 +7,21 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; programs.emacs.enable = true; services.emacs.enable = true; services.emacs.client.enable = true; - services.emacs.extraOptions = [ "-f" "exwm-enable" ]; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; nmt.script = '' assertPathNotExists home-files/.config/systemd/user/emacs.socket @@ -24,12 +30,10 @@ assertFileContent \ home-files/.config/systemd/user/emacs.service \ - ${ - pkgs.substituteAll { - inherit (pkgs) runtimeShell; - src = ./emacs-service-emacs.service; - } - } + ${pkgs.substituteAll { + inherit (pkgs) runtimeShell; + src = ./emacs-service-emacs.service; + }} assertFileContent \ home-path/share/applications/emacsclient.desktop \ diff --git a/tests/modules/services/emacs/emacs-socket-27.nix b/tests/modules/services/emacs/emacs-socket-27.nix index 70e85551b..d9a06842c 100644 --- a/tests/modules/services/emacs/emacs-socket-27.nix +++ b/tests/modules/services/emacs/emacs-socket-27.nix @@ -7,15 +7,21 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; programs.emacs.enable = true; services.emacs.enable = true; services.emacs.client.enable = true; - services.emacs.extraOptions = [ "-f" "exwm-enable" ]; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; services.emacs.socketActivation.enable = true; nmt.script = '' @@ -29,12 +35,10 @@ assertFileContent \ home-files/.config/systemd/user/emacs.service \ - ${ - pkgs.substituteAll { - inherit (pkgs) runtimeShell coreutils; - src = ./emacs-socket-27-emacs.service; - } - } + ${pkgs.substituteAll { + inherit (pkgs) runtimeShell coreutils; + src = ./emacs-socket-27-emacs.service; + }} assertFileContent \ home-path/share/applications/emacsclient.desktop \ diff --git a/tests/modules/services/emacs/emacs-socket-28.nix b/tests/modules/services/emacs/emacs-socket-28.nix index 49887c330..4d8033dd8 100644 --- a/tests/modules/services/emacs/emacs-socket-28.nix +++ b/tests/modules/services/emacs/emacs-socket-28.nix @@ -7,15 +7,21 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; programs.emacs.enable = true; services.emacs.enable = true; services.emacs.client.enable = true; - services.emacs.extraOptions = [ "-f" "exwm-enable" ]; + services.emacs.extraOptions = [ + "-f" + "exwm-enable" + ]; services.emacs.socketActivation.enable = true; nmt.script = '' @@ -29,12 +35,10 @@ assertFileContent \ home-files/.config/systemd/user/emacs.service \ - ${ - pkgs.substituteAll { - inherit (pkgs) runtimeShell coreutils; - src = ./emacs-socket-28-emacs.service; - } - } + ${pkgs.substituteAll { + inherit (pkgs) runtimeShell coreutils; + src = ./emacs-socket-28-emacs.service; + }} assertFileContent \ home-path/share/applications/emacsclient.desktop \ diff --git a/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix b/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix index 1f6d56738..48b42b34c 100644 --- a/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix +++ b/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix @@ -12,8 +12,11 @@ emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { outPath = "@emacs@"; }; - emacsPackagesFor = _: - lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + emacsPackagesFor = + _: + lib.makeScope super.newScope (_: { + emacsWithPackages = _: emacs; + }); }) ]; diff --git a/tests/modules/services/espanso-darwin/basic-configuration.nix b/tests/modules/services/espanso-darwin/basic-configuration.nix index cd9d2f297..0cd55b237 100644 --- a/tests/modules/services/espanso-darwin/basic-configuration.nix +++ b/tests/modules/services/espanso-darwin/basic-configuration.nix @@ -1,7 +1,11 @@ { services.espanso = { enable = true; - configs = { default = { show_notifications = false; }; }; + configs = { + default = { + show_notifications = false; + }; + }; matches = { base = { matches = [ @@ -24,12 +28,16 @@ { name = "currentdate"; type = "date"; - params = { format = "%d/%m/%Y"; }; + params = { + format = "%d/%m/%Y"; + }; } { name = "currenttime"; type = "date"; - params = { format = "%R"; }; + params = { + format = "%R"; + }; } ]; }; diff --git a/tests/modules/services/espanso/basic-configuration.nix b/tests/modules/services/espanso/basic-configuration.nix index 93c6a5a2d..07a72ca8d 100644 --- a/tests/modules/services/espanso/basic-configuration.nix +++ b/tests/modules/services/espanso/basic-configuration.nix @@ -1,7 +1,11 @@ { services.espanso = { enable = true; - configs = { default = { show_notifications = false; }; }; + configs = { + default = { + show_notifications = false; + }; + }; matches = { base = { matches = [ @@ -24,12 +28,16 @@ { name = "currentdate"; type = "date"; - params = { format = "%d/%m/%Y"; }; + params = { + format = "%d/%m/%Y"; + }; } { name = "currenttime"; type = "date"; - params = { format = "%R"; }; + params = { + format = "%R"; + }; } ]; }; diff --git a/tests/modules/services/flameshot/example-settings.nix b/tests/modules/services/flameshot/example-settings.nix index 25aa4f75c..b9961869a 100644 --- a/tests/modules/services/flameshot/example-settings.nix +++ b/tests/modules/services/flameshot/example-settings.nix @@ -13,12 +13,10 @@ nmt.script = '' assertFileContent \ home-files/.config/flameshot/flameshot.ini \ - ${ - builtins.toFile "expected.ini" '' - [General] - disabledTrayIcon=true - showStartupLaunchMessage=false - '' - } + ${builtins.toFile "expected.ini" '' + [General] + disabledTrayIcon=true + showStartupLaunchMessage=false + ''} ''; } diff --git a/tests/modules/services/fnott/example-settings.nix b/tests/modules/services/fnott/example-settings.nix index 16b591ff7..6b7d4aa15 100644 --- a/tests/modules/services/fnott/example-settings.nix +++ b/tests/modules/services/fnott/example-settings.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { @@ -7,7 +12,9 @@ package = config.lib.test.mkStubPackage { }; settings = { - main = { notification-margin = 5; }; + main = { + notification-margin = 5; + }; low = { timeout = 5; diff --git a/tests/modules/services/fnott/systemd-user-service.nix b/tests/modules/services/fnott/systemd-user-service.nix index ebb6bf004..4d955ee2b 100644 --- a/tests/modules/services/fnott/systemd-user-service.nix +++ b/tests/modules/services/fnott/systemd-user-service.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { config = { diff --git a/tests/modules/services/fusuma/fusuma-stubs.nix b/tests/modules/services/fusuma/fusuma-stubs.nix index b2904b7d0..b46a14a16 100644 --- a/tests/modules/services/fusuma/fusuma-stubs.nix +++ b/tests/modules/services/fusuma/fusuma-stubs.nix @@ -4,8 +4,9 @@ nixpkgs.overlays = [ (_: super: { inherit (realPkgs) remarshal; - python3Packages = super.python3Packages.overrideScope - (self: super: { inherit (realPkgs.python3Packages) pyyaml; }); + python3Packages = super.python3Packages.overrideScope ( + self: super: { inherit (realPkgs.python3Packages) pyyaml; } + ); }) ]; } diff --git a/tests/modules/services/fusuma/settings.nix b/tests/modules/services/fusuma/settings.nix index da329673d..c626efa93 100644 --- a/tests/modules/services/fusuma/settings.nix +++ b/tests/modules/services/fusuma/settings.nix @@ -9,11 +9,23 @@ extraPackages = [ pkgs.xdotool ]; settings = { - threshold = { swipe = 1; }; - interval = { swipe = 7; }; + threshold = { + swipe = 1; + }; + interval = { + swipe = 7; + }; swipe = { - "3" = { left = { command = "xdotool key ctrl+alt+Right"; }; }; - "4" = { left = { command = "xdotool key ctrl+shift+alt+Right"; }; }; + "3" = { + left = { + command = "xdotool key ctrl+alt+Right"; + }; + }; + "4" = { + left = { + command = "xdotool key ctrl+shift+alt+Right"; + }; + }; }; }; }; diff --git a/tests/modules/services/git-sync/basic.nix b/tests/modules/services/git-sync/basic.nix index 88c180201..360a3b56c 100644 --- a/tests/modules/services/git-sync/basic.nix +++ b/tests/modules/services/git-sync/basic.nix @@ -15,23 +15,21 @@ assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=default.target + assertFileContent $serviceFile ${builtins.toFile "expected" '' + [Install] + WantedBy=default.target - [Service] - 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' - Environment=GIT_SYNC_INTERVAL=500 - ExecStart=@git-sync@/bin/git-sync-on-inotify - Restart=on-abort + [Service] + 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' + Environment=GIT_SYNC_INTERVAL=500 + ExecStart=@git-sync@/bin/git-sync-on-inotify + Restart=on-abort - [Unit] - Description=Git Sync test - '' - } + [Unit] + Description=Git Sync test + ''} ''; } diff --git a/tests/modules/services/git-sync/whitespace.nix b/tests/modules/services/git-sync/whitespace.nix index 9097b4ff8..b6bf74913 100644 --- a/tests/modules/services/git-sync/whitespace.nix +++ b/tests/modules/services/git-sync/whitespace.nix @@ -14,23 +14,21 @@ assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=default.target + assertFileContent $serviceFile ${builtins.toFile "expected" '' + [Install] + WantedBy=default.target - [Service] - 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' - Environment=GIT_SYNC_INTERVAL=500 - ExecStart=@git-sync@/bin/git-sync-on-inotify - Restart=on-abort + [Service] + 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' + Environment=GIT_SYNC_INTERVAL=500 + ExecStart=@git-sync@/bin/git-sync-on-inotify + Restart=on-abort - [Unit] - Description=Git Sync testWithWhitespace - '' - } + [Unit] + Description=Git Sync testWithWhitespace + ''} ''; } diff --git a/tests/modules/services/glance/example-settings.nix b/tests/modules/services/glance/example-settings.nix index 6b9dd59f3..347095c12 100644 --- a/tests/modules/services/glance/example-settings.nix +++ b/tests/modules/services/glance/example-settings.nix @@ -3,19 +3,23 @@ enable = true; settings = { server.port = 5678; - pages = [{ - name = "Home"; - columns = [{ - size = "full"; - widgets = [ - { type = "calendar"; } + pages = [ + { + name = "Home"; + columns = [ { - type = "weather"; - location = "London, United Kingdom"; + size = "full"; + widgets = [ + { type = "calendar"; } + { + type = "weather"; + location = "London, United Kingdom"; + } + ]; } ]; - }]; - }]; + } + ]; }; }; diff --git a/tests/modules/services/gpg-agent/default-homedir.nix b/tests/modules/services/gpg-agent/default-homedir.nix index ba7178078..82b3f3242 100644 --- a/tests/modules/services/gpg-agent/default-homedir.nix +++ b/tests/modules/services/gpg-agent/default-homedir.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: lib.mkIf pkgs.stdenv.isLinux { services.gpg-agent.enable = true; diff --git a/tests/modules/services/gpg-agent/override-homedir.nix b/tests/modules/services/gpg-agent/override-homedir.nix index 9cebadf3c..ad8ed61fe 100644 --- a/tests/modules/services/gpg-agent/override-homedir.nix +++ b/tests/modules/services/gpg-agent/override-homedir.nix @@ -1,7 +1,9 @@ { config, pkgs, ... }: -let inherit (pkgs.stdenv) isDarwin; -in { +let + inherit (pkgs.stdenv) isDarwin; +in +{ services.gpg-agent.enable = true; services.gpg-agent.pinentryPackage = null; # Don't build pinentry package. programs.gpg = { @@ -10,16 +12,20 @@ in { 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 - ''; + 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/hyprpaper/basic-configuration.nix b/tests/modules/services/hyprpaper/basic-configuration.nix index dc583575c..ca264c3e9 100644 --- a/tests/modules/services/hyprpaper/basic-configuration.nix +++ b/tests/modules/services/hyprpaper/basic-configuration.nix @@ -6,8 +6,10 @@ splash = false; splash_offset = 2.0; - preload = - [ "/share/wallpapers/buttons.png" "/share/wallpapers/cat_pacman.png" ]; + preload = [ + "/share/wallpapers/buttons.png" + "/share/wallpapers/cat_pacman.png" + ]; wallpaper = [ "DP-3,/share/wallpapers/buttons.png" diff --git a/tests/modules/services/hyprpolkitagent/basic-configuration.nix b/tests/modules/services/hyprpolkitagent/basic-configuration.nix index 806d495b9..d4fc85776 100644 --- a/tests/modules/services/hyprpolkitagent/basic-configuration.nix +++ b/tests/modules/services/hyprpolkitagent/basic-configuration.nix @@ -5,19 +5,17 @@ clientServiceFile=home-files/.config/systemd/user/hyprpolkitagent.service assertFileExists $clientServiceFile - assertFileContent $clientServiceFile ${ - builtins.toFile "expected.service" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $clientServiceFile ${builtins.toFile "expected.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@hyprpolkitagent@/libexec/hyprpolkitagent + [Service] + ExecStart=@hyprpolkitagent@/libexec/hyprpolkitagent - [Unit] - After=graphical-session.target - Description=Hyprland PolicyKit Agent - PartOf=graphical-session.target - '' - } + [Unit] + After=graphical-session.target + Description=Hyprland PolicyKit Agent + PartOf=graphical-session.target + ''} ''; } diff --git a/tests/modules/services/imapnotify-darwin/launchd.nix b/tests/modules/services/imapnotify-darwin/launchd.nix index 22630d701..f47ce76e5 100644 --- a/tests/modules/services/imapnotify-darwin/launchd.nix +++ b/tests/modules/services/imapnotify-darwin/launchd.nix @@ -20,18 +20,22 @@ services.imapnotify = { enable = true; - package = (config.lib.test.mkStubPackage { - name = "goimapnotify"; - outPath = "@goimapnotify@"; - }); + package = ( + config.lib.test.mkStubPackage { + name = "goimapnotify"; + outPath = "@goimapnotify@"; + } + ); }; - nmt.script = let - serviceFileName = "org.nix-community.home.imapnotify-hm-example.com.plist"; - in '' - serviceFile="LaunchAgents/${serviceFileName}" - serviceFileNormalized="$(normalizeStorePaths "$serviceFile")" - assertFileExists $serviceFile - assertFileContent $serviceFileNormalized ${./launchd.plist} - ''; + nmt.script = + let + serviceFileName = "org.nix-community.home.imapnotify-hm-example.com.plist"; + in + '' + serviceFile="LaunchAgents/${serviceFileName}" + serviceFileNormalized="$(normalizeStorePaths "$serviceFile")" + assertFileExists $serviceFile + assertFileContent $serviceFileNormalized ${./launchd.plist} + ''; } diff --git a/tests/modules/services/imapnotify/imapnotify.nix b/tests/modules/services/imapnotify/imapnotify.nix index 680405fa5..68ae52eb7 100644 --- a/tests/modules/services/imapnotify/imapnotify.nix +++ b/tests/modules/services/imapnotify/imapnotify.nix @@ -21,10 +21,12 @@ services.imapnotify = { enable = true; - package = (config.lib.test.mkStubPackage { - name = "goimapnotify"; - outPath = "@goimapnotify@"; - }); + package = ( + config.lib.test.mkStubPackage { + name = "goimapnotify"; + outPath = "@goimapnotify@"; + } + ); }; nmt.script = '' diff --git a/tests/modules/services/jankyborders/config.nix b/tests/modules/services/jankyborders/config.nix index f802cd675..a0270a023 100644 --- a/tests/modules/services/jankyborders/config.nix +++ b/tests/modules/services/jankyborders/config.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ services.jankyborders = { enable = true; settings = { @@ -15,10 +16,7 @@ assertFileExists $configFile assertFileIsExecutable "$configFile" # assertFileContent $configFile ${./jankyborders-config-expected} - assertFileContent "$configFile" ${ - pkgs.writeShellScript "bordersrc" - (builtins.readFile ./jankyborders-config-expected) - } + assertFileContent "$configFile" ${pkgs.writeShellScript "bordersrc" (builtins.readFile ./jankyborders-config-expected)} serviceFile=LaunchAgents/org.nix-community.home.jankyborders.plist assertFileExists "$serviceFile" diff --git a/tests/modules/services/kanshi/alias-assertion.nix b/tests/modules/services/kanshi/alias-assertion.nix index 0dc6d7e64..b549a33db 100644 --- a/tests/modules/services/kanshi/alias-assertion.nix +++ b/tests/modules/services/kanshi/alias-assertion.nix @@ -1,18 +1,24 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { services.kanshi = { enable = true; package = config.lib.test.mkStubPackage { }; - settings = [{ - profile.name = "nomad"; - profile.outputs = [{ - criteria = "eDP-1"; - alias = "test"; - }]; - }]; + settings = [ + { + profile.name = "nomad"; + profile.outputs = [ + { + criteria = "eDP-1"; + alias = "test"; + } + ]; + } + ]; }; - test.asserts.assertions.expected = - [ "Output kanshi.*.output.alias can only be defined on global scope" ]; + test.asserts.assertions.expected = [ + "Output kanshi.*.output.alias can only be defined on global scope" + ]; }; } diff --git a/tests/modules/services/kanshi/basic-configuration.nix b/tests/modules/services/kanshi/basic-configuration.nix index ffb6db7b1..07fecfc80 100644 --- a/tests/modules/services/kanshi/basic-configuration.nix +++ b/tests/modules/services/kanshi/basic-configuration.nix @@ -1,17 +1,23 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { services.kanshi = { enable = true; package = config.lib.test.mkStubPackage { }; profiles = { nomad = { - outputs = [{ - criteria = "eDP-1"; - status = "enable"; - }]; + outputs = [ + { + criteria = "eDP-1"; + status = "enable"; + } + ]; }; desktop = { - exec = [ ''echo "1 two 3"'' ''echo "4 five 6"'' ]; + exec = [ + ''echo "1 two 3"'' + ''echo "4 five 6"'' + ]; outputs = [ { criteria = "eDP-1"; @@ -33,10 +39,12 @@ ]; }; backwardsCompat = { - outputs = [{ - criteria = "LVDS-1"; - status = "enable"; - }]; + outputs = [ + { + criteria = "LVDS-1"; + status = "enable"; + } + ]; exec = ''echo "7 eight 9"''; }; }; diff --git a/tests/modules/services/kanshi/new-configuration.nix b/tests/modules/services/kanshi/new-configuration.nix index 2c92c730d..2888f0190 100644 --- a/tests/modules/services/kanshi/new-configuration.nix +++ b/tests/modules/services/kanshi/new-configuration.nix @@ -1,4 +1,5 @@ -{ config, pkgs, ... }: { +{ config, pkgs, ... }: +{ config = { services.kanshi = { enable = true; @@ -13,14 +14,19 @@ } { profile.name = "nomad"; - profile.outputs = [{ - criteria = "eDP-1"; - status = "enable"; - }]; + profile.outputs = [ + { + criteria = "eDP-1"; + status = "enable"; + } + ]; } { profile.name = "desktop"; - profile.exec = [ ''echo "1 two 3"'' ''echo "4 five 6"'' ]; + profile.exec = [ + ''echo "1 two 3"'' + ''echo "4 five 6"'' + ]; profile.outputs = [ { criteria = "eDP-1"; @@ -42,10 +48,12 @@ ]; } { - profile.outputs = [{ - criteria = "LVDS-1"; - status = "enable"; - }]; + profile.outputs = [ + { + criteria = "LVDS-1"; + status = "enable"; + } + ]; profile.exec = ''echo "7 eight 9"''; } ]; diff --git a/tests/modules/services/linux-wallpaperengine/basic-configuration.nix b/tests/modules/services/linux-wallpaperengine/basic-configuration.nix index afb2e964d..9ee3dfe7d 100644 --- a/tests/modules/services/linux-wallpaperengine/basic-configuration.nix +++ b/tests/modules/services/linux-wallpaperengine/basic-configuration.nix @@ -13,7 +13,10 @@ { monitor = "DP-1"; wallpaperId = "87654321"; - extraOptions = [ "--scaling fill" "--fps 12" ]; + extraOptions = [ + "--scaling fill" + "--fps 12" + ]; audio = { silent = true; automute = false; diff --git a/tests/modules/services/lxqt-policykit-agent/basic-configuration.nix b/tests/modules/services/lxqt-policykit-agent/basic-configuration.nix index 8406433a7..6da34f750 100644 --- a/tests/modules/services/lxqt-policykit-agent/basic-configuration.nix +++ b/tests/modules/services/lxqt-policykit-agent/basic-configuration.nix @@ -5,19 +5,17 @@ clientServiceFile=home-files/.config/systemd/user/lxqt-policykit-agent.service assertFileExists $clientServiceFile - assertFileContent $clientServiceFile ${ - builtins.toFile "expected.service" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $clientServiceFile ${builtins.toFile "expected.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@lxqt-policykit@/bin/lxqt-policykit-agent + [Service] + ExecStart=@lxqt-policykit@/bin/lxqt-policykit-agent - [Unit] - After=graphical-session-pre.target - Description=LXQT PolicyKit Agent - PartOf=graphical-session.target - '' - } + [Unit] + After=graphical-session-pre.target + Description=LXQT PolicyKit Agent + PartOf=graphical-session.target + ''} ''; } diff --git a/tests/modules/services/macos-remap-keys/basic-configuration.nix b/tests/modules/services/macos-remap-keys/basic-configuration.nix index 7cc0b9018..71e3b0202 100644 --- a/tests/modules/services/macos-remap-keys/basic-configuration.nix +++ b/tests/modules/services/macos-remap-keys/basic-configuration.nix @@ -1,7 +1,9 @@ { services.macos-remap-keys = { enable = true; - keyboard = { Capslock = "Backspace"; }; + keyboard = { + Capslock = "Backspace"; + }; }; nmt.script = '' diff --git a/tests/modules/services/mopidy/basic-configuration.nix b/tests/modules/services/mopidy/basic-configuration.nix index 26bc1c846..68207c467 100644 --- a/tests/modules/services/mopidy/basic-configuration.nix +++ b/tests/modules/services/mopidy/basic-configuration.nix @@ -5,7 +5,10 @@ settings = { file = { enabled = true; - media_dirs = [ "$XDG_MUSIC_DIR|Music" "~/Downloads|Downloads" ]; + media_dirs = [ + "$XDG_MUSIC_DIR|Music" + "~/Downloads|Downloads" + ]; }; spotify = { @@ -31,23 +34,21 @@ assertFileExists $serviceFile serviceFile=$(normalizeStorePaths $serviceFile) assertFileContent $serviceFile \ - ${ - builtins.toFile "expected-mopidy.service" '' - [Install] - WantedBy=default.target + ${builtins.toFile "expected-mopidy.service" '' + [Install] + WantedBy=default.target - [Service] - ExecStart=/nix/store/00000000000000000000000000000000-mopidy-with-extensions/bin/mopidy --config /home/hm-user/.config/mopidy/mopidy.conf - Restart=on-failure + [Service] + ExecStart=/nix/store/00000000000000000000000000000000-mopidy-with-extensions/bin/mopidy --config /home/hm-user/.config/mopidy/mopidy.conf + Restart=on-failure - [Unit] - After=network.target - After=sound.target - Description=mopidy music player daemon - Documentation=https://mopidy.com/ - X-Restart-Triggers=/nix/store/00000000000000000000000000000000-mopidy-hm-user - '' - } + [Unit] + After=network.target + After=sound.target + Description=mopidy music player daemon + Documentation=https://mopidy.com/ + X-Restart-Triggers=/nix/store/00000000000000000000000000000000-mopidy-hm-user + ''} assertPathNotExists home-files/.config/systemd/user/mopidy-scan.service diff --git a/tests/modules/services/mopidy/default.nix b/tests/modules/services/mopidy/default.nix index 6d71e1f54..6c6a901d4 100644 --- a/tests/modules/services/mopidy/default.nix +++ b/tests/modules/services/mopidy/default.nix @@ -2,4 +2,3 @@ mopidy-basic-configuration = ./basic-configuration.nix; mopidy-scan = ./mopidy-scan.nix; } - diff --git a/tests/modules/services/mpd-mpris/configuration-basic.nix b/tests/modules/services/mpd-mpris/configuration-basic.nix index afe1c3df1..8fb9a0776 100644 --- a/tests/modules/services/mpd-mpris/configuration-basic.nix +++ b/tests/modules/services/mpd-mpris/configuration-basic.nix @@ -1,5 +1,7 @@ { - services.mpd-mpris = { enable = true; }; + services.mpd-mpris = { + enable = true; + }; nmt.script = '' serviceFile=home-files/.config/systemd/user/mpd-mpris.service diff --git a/tests/modules/services/mpdscribble/basic-configuration.nix b/tests/modules/services/mpdscribble/basic-configuration.nix index 18c02585f..05a14a0a5 100644 --- a/tests/modules/services/mpdscribble/basic-configuration.nix +++ b/tests/modules/services/mpdscribble/basic-configuration.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; diff --git a/tests/modules/services/osmscout-server/basic-setup.nix b/tests/modules/services/osmscout-server/basic-setup.nix index 62333fb2b..ca34e39d1 100644 --- a/tests/modules/services/osmscout-server/basic-setup.nix +++ b/tests/modules/services/osmscout-server/basic-setup.nix @@ -14,30 +14,26 @@ nmt.script = '' assertFileContent \ home-files/.config/systemd/user/osmscout-server.service \ - ${ - builtins.toFile "osmscout-server.service" '' - [Service] - ExecStart='@osmscout-server@/bin/osmscout-server' --systemd --quiet + ${builtins.toFile "osmscout-server.service" '' + [Service] + ExecStart='@osmscout-server@/bin/osmscout-server' --systemd --quiet - [Unit] - Description=OSM Scout Server - '' - } + [Unit] + Description=OSM Scout Server + ''} assertFileContent \ home-files/.config/systemd/user/osmscout-server.socket \ - ${ - builtins.toFile "osmscout-server.socket" '' - [Install] - WantedBy=sockets.target + ${builtins.toFile "osmscout-server.socket" '' + [Install] + WantedBy=sockets.target - [Socket] - ListenStream=0.0.0.0:55555 - TriggerLimitBurst=1 - TriggerLimitIntervalSec=60s + [Socket] + ListenStream=0.0.0.0:55555 + TriggerLimitBurst=1 + TriggerLimitIntervalSec=60s - [Unit] - Description=OSM Scout Server Socket - '' - } + [Unit] + Description=OSM Scout Server Socket + ''} ''; } diff --git a/tests/modules/services/picom/picom-basic-configuration.nix b/tests/modules/services/picom/picom-basic-configuration.nix index 065c40b52..4d908209c 100644 --- a/tests/modules/services/picom/picom-basic-configuration.nix +++ b/tests/modules/services/picom/picom-basic-configuration.nix @@ -3,14 +3,26 @@ enable = true; fade = true; fadeDelta = 5; - fadeSteps = [ 4.0e-2 4.0e-2 ]; - fadeExclude = - [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ]; + fadeSteps = [ + 4.0e-2 + 4.0e-2 + ]; + fadeExclude = [ + "window_type *= 'menu'" + "name ~= 'Firefox$'" + "focused = 1" + ]; shadow = true; - shadowOffsets = [ (-10) (-15) ]; + shadowOffsets = [ + (-10) + (-15) + ]; shadowOpacity = 0.8; - shadowExclude = - [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ]; + shadowExclude = [ + "window_type *= 'menu'" + "name ~= 'Firefox$'" + "focused = 1" + ]; backend = "xrender"; vSync = true; settings = { diff --git a/tests/modules/services/playerctld/basic.nix b/tests/modules/services/playerctld/basic.nix index 3c10a99f1..ea492531a 100644 --- a/tests/modules/services/playerctld/basic.nix +++ b/tests/modules/services/playerctld/basic.nix @@ -12,20 +12,18 @@ assertFileExists "$serviceFile" - assertFileContent "$serviceFile" "${ - pkgs.writeText "playerctld-test" '' - [Install] - WantedBy=default.target + assertFileContent "$serviceFile" "${pkgs.writeText "playerctld-test" '' + [Install] + WantedBy=default.target - [Service] - BusName=org.mpris.MediaPlayer2.playerctld - ExecStart=@playerctld@/bin/playerctld - Type=dbus + [Service] + BusName=org.mpris.MediaPlayer2.playerctld + ExecStart=@playerctld@/bin/playerctld + Type=dbus - [Unit] - Description=MPRIS media player daemon - '' - }" + [Unit] + Description=MPRIS media player daemon + ''}" ''; }; } diff --git a/tests/modules/services/podman-linux/build.nix b/tests/modules/services/podman-linux/build.nix index 27052c6a4..f54f7f8b3 100644 --- a/tests/modules/services/podman-linux/build.nix +++ b/tests/modules/services/podman-linux/build.nix @@ -7,28 +7,32 @@ enable = true; builds = { "my-bld" = { - file = let - containerFile = pkgs.writeTextFile { - name = "Containerfile"; - text = '' - FROM docker.io/alpine:latest - ''; - }; - in "${containerFile}"; + file = + let + containerFile = pkgs.writeTextFile { + name = "Containerfile"; + text = '' + FROM docker.io/alpine:latest + ''; + }; + in + "${containerFile}"; }; "my-bld-2" = { file = "https://www.github.com/././Containerfile"; extraConfig = { - Build.ImageTag = [ "locahost/somethingelse" "localhost/anothertag" ]; + Build.ImageTag = [ + "locahost/somethingelse" + "localhost/anothertag" + ]; }; }; }; }; test.asserts.assertions.expected = [ - '' - In 'my-bld-2' config. Build.ImageTag: '[ "locahost/somethingelse" "localhost/anothertag" ]' does not contain 'homemanager/my-bld-2'.'' + ''In 'my-bld-2' config. Build.ImageTag: '[ "locahost/somethingelse" "localhost/anothertag" ]' does not contain 'homemanager/my-bld-2'.'' ]; nmt.script = '' diff --git a/tests/modules/services/podman-linux/configuration.nix b/tests/modules/services/podman-linux/configuration.nix index a45524f8c..8b44f4914 100644 --- a/tests/modules/services/podman-linux/configuration.nix +++ b/tests/modules/services/podman-linux/configuration.nix @@ -24,11 +24,16 @@ }; }; registries = { - block = [ "ghcr.io" "gallery.ecr.aws" ]; + block = [ + "ghcr.io" + "gallery.ecr.aws" + ]; insecure = [ "quay.io" ]; search = [ "docker.io" ]; }; - policy = { default = [{ type = "insecureAcceptAnything"; }]; }; + policy = { + default = [ { type = "insecureAcceptAnything"; } ]; + }; }; }; @@ -49,13 +54,9 @@ registriesFile=$(normalizeStorePaths $registriesFile) storageFile=$(normalizeStorePaths $storageFile) - assertFileContent $containersFile ${ - ./configuration-containers-expected.conf - } + assertFileContent $containersFile ${./configuration-containers-expected.conf} assertFileContent $policyFile ${./configuration-policy-expected.json} - assertFileContent $registriesFile ${ - ./configuration-registries-expected.conf - } + assertFileContent $registriesFile ${./configuration-registries-expected.conf} assertFileContent $storageFile ${./configuration-storage-expected.conf} ''; } diff --git a/tests/modules/services/podman-linux/container.nix b/tests/modules/services/podman-linux/container.nix index fa9c654d4..8f8768903 100644 --- a/tests/modules/services/podman-linux/container.nix +++ b/tests/modules/services/podman-linux/container.nix @@ -43,8 +43,7 @@ }; test.asserts.assertions.expected = [ - '' - In 'my-container-2' config. Container.ContainerName: 'some-other-container-name' does not match expected type: value "my-container-2" (singular enum)'' + ''In 'my-container-2' config. Container.ContainerName: 'some-other-container-name' does not match expected type: value "my-container-2" (singular enum)'' ]; nmt.script = '' diff --git a/tests/modules/services/podman-linux/image.nix b/tests/modules/services/podman-linux/image.nix index 98560e34d..7d3159b7a 100644 --- a/tests/modules/services/podman-linux/image.nix +++ b/tests/modules/services/podman-linux/image.nix @@ -3,7 +3,11 @@ services.podman = { enable = true; - images = { "my-img" = { image = "docker.io/alpine:latest"; }; }; + images = { + "my-img" = { + image = "docker.io/alpine:latest"; + }; + }; }; nmt.script = '' diff --git a/tests/modules/services/podman-linux/integration.nix b/tests/modules/services/podman-linux/integration.nix index 1c73093b4..607e45890 100644 --- a/tests/modules/services/podman-linux/integration.nix +++ b/tests/modules/services/podman-linux/integration.nix @@ -6,24 +6,33 @@ services.podman = { enable = true; builds."my-bld" = { - file = let - containerFile = pkgs.writeTextFile { - name = "Containerfile"; - text = '' - FROM docker.io/alpine:latest - ''; - }; - in "${containerFile}"; + file = + let + containerFile = pkgs.writeTextFile { + name = "Containerfile"; + text = '' + FROM docker.io/alpine:latest + ''; + }; + in + "${containerFile}"; }; containers = { "my-container" = { image = "my-img.image"; - network = [ "my-app.network" "externalnet" ]; + network = [ + "my-app.network" + "externalnet" + ]; volumes = [ "my-app.volume:/data" ]; }; - "my-container-bld" = { image = "my-bld.build"; }; + "my-container-bld" = { + image = "my-bld.build"; + }; + }; + images."my-img" = { + image = "docker.io/alpine:latest"; }; - images."my-img" = { image = "docker.io/alpine:latest"; }; networks."my-app" = { gateway = "192.168.123.1"; subnet = "192.168.123.0/24"; @@ -59,9 +68,7 @@ assertFileContent $buildFile ${./integration-build-expected.service} assertFileContent $containerFile ${./integration-container-expected.service} - assertFileContent $containerBldFile ${ - ./integration-container-bld-expected.service - } + assertFileContent $containerBldFile ${./integration-container-bld-expected.service} assertFileContent $imageFile ${./integration-image-expected.service} assertFileContent $networkFile ${./integration-network-expected.service} assertFileContent $volumeFile ${./integration-volume-expected.service} diff --git a/tests/modules/services/podman-linux/manifest.nix b/tests/modules/services/podman-linux/manifest.nix index 13a0ab387..6ac4ba8ac 100644 --- a/tests/modules/services/podman-linux/manifest.nix +++ b/tests/modules/services/podman-linux/manifest.nix @@ -47,18 +47,14 @@ assertFileExists $containerManifest assertFileExists $networkManifest - assertFileContent $containerManifest ${ - builtins.toFile "containers.expected" '' - my-container-1 - my-container-2 - '' - } + assertFileContent $containerManifest ${builtins.toFile "containers.expected" '' + my-container-1 + my-container-2 + ''} - assertFileContent $networkManifest ${ - builtins.toFile "networks.expected" '' - mynet-1 - mynet-2 - '' - } + assertFileContent $networkManifest ${builtins.toFile "networks.expected" '' + mynet-1 + mynet-2 + ''} ''; } diff --git a/tests/modules/services/podman-linux/network.nix b/tests/modules/services/podman-linux/network.nix index 0f53b0d5d..7e7becc77 100644 --- a/tests/modules/services/podman-linux/network.nix +++ b/tests/modules/services/podman-linux/network.nix @@ -11,8 +11,13 @@ extraConfig = { Network = { NetworkName = "my-net"; - Options = { isolate = "true"; }; - PodmanArgs = [ "--dns=192.168.55.1" "--log-level=debug" ]; + Options = { + isolate = "true"; + }; + PodmanArgs = [ + "--dns=192.168.55.1" + "--log-level=debug" + ]; }; }; }; @@ -21,15 +26,16 @@ subnet = "192.168.2.0/24"; gateway = "192.168.2.1"; extraConfig = { - Network = { NetworkName = "some-other-network-name"; }; + Network = { + NetworkName = "some-other-network-name"; + }; }; }; }; }; test.asserts.assertions.expected = [ - '' - In 'my-net-2' config. Network.NetworkName: 'some-other-network-name' does not match expected type: value "my-net-2" (singular enum)'' + ''In 'my-net-2' config. Network.NetworkName: 'some-other-network-name' does not match expected type: value "my-net-2" (singular enum)'' ]; nmt.script = '' diff --git a/tests/modules/services/podman-linux/volume.nix b/tests/modules/services/podman-linux/volume.nix index 885662b2f..2c07c9a0f 100644 --- a/tests/modules/services/podman-linux/volume.nix +++ b/tests/modules/services/podman-linux/volume.nix @@ -6,21 +6,28 @@ volumes = { "my-vol" = { device = "tmpfs"; - extraConfig = { Volume = { User = 1000; }; }; + extraConfig = { + Volume = { + User = 1000; + }; + }; extraPodmanArgs = [ "--module=/etc/nvd.conf" ]; group = 1000; type = "tmpfs"; }; "my-vol-2" = { - extraConfig = { Volume = { VolumeName = "some-other-volume-name"; }; }; + extraConfig = { + Volume = { + VolumeName = "some-other-volume-name"; + }; + }; }; }; }; test.asserts.assertions.expected = [ - '' - In 'my-vol-2' config. Volume.VolumeName: 'some-other-volume-name' does not match expected type: value "my-vol-2" (singular enum)'' + ''In 'my-vol-2' config. Volume.VolumeName: 'some-other-volume-name' does not match expected type: value "my-vol-2" (singular enum)'' ]; nmt.script = '' diff --git a/tests/modules/services/polkit-gnome/basic-configuration.nix b/tests/modules/services/polkit-gnome/basic-configuration.nix index b297e81be..d722731e7 100644 --- a/tests/modules/services/polkit-gnome/basic-configuration.nix +++ b/tests/modules/services/polkit-gnome/basic-configuration.nix @@ -5,19 +5,17 @@ clientServiceFile=home-files/.config/systemd/user/polkit-gnome.service assertFileExists $clientServiceFile - assertFileContent $clientServiceFile ${ - builtins.toFile "expected.service" '' - [Install] - WantedBy=graphical-session.target + assertFileContent $clientServiceFile ${builtins.toFile "expected.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@polkit-gnome@/libexec/polkit-gnome-authentication-agent-1 + [Service] + ExecStart=@polkit-gnome@/libexec/polkit-gnome-authentication-agent-1 - [Unit] - After=graphical-session-pre.target - Description=GNOME PolicyKit Agent - PartOf=graphical-session.target - '' - } + [Unit] + After=graphical-session-pre.target + Description=GNOME PolicyKit Agent + PartOf=graphical-session.target + ''} ''; } diff --git a/tests/modules/services/polybar/basic-configuration.nix b/tests/modules/services/polybar/basic-configuration.nix index 5d9c8df58..b61b3eb43 100644 --- a/tests/modules/services/polybar/basic-configuration.nix +++ b/tests/modules/services/polybar/basic-configuration.nix @@ -28,7 +28,11 @@ format.volume = " "; label.muted.text = "🔇"; label.muted.foreground = "#666"; - ramp.volume = [ "🔈" "🔉" "🔊" ]; + ramp.volume = [ + "🔈" + "🔉" + "🔊" + ]; click.right = "pavucontrol &"; }; }; diff --git a/tests/modules/services/recoll/basic-configuration.nix b/tests/modules/services/recoll/basic-configuration.nix index 4e6ad03e7..1c1a88a41 100644 --- a/tests/modules/services/recoll/basic-configuration.nix +++ b/tests/modules/services/recoll/basic-configuration.nix @@ -7,21 +7,36 @@ configDir = "${config.xdg.configHome}/recoll"; settings = { dbdir = "~/.cache/recoll/xapiandb"; - topdirs = [ "~/Downloads" "~/Documents" "~/library" ''~/"cool" files'' ]; + topdirs = [ + "~/Downloads" + "~/Documents" + "~/library" + ''~/"cool" files'' + ]; "skippedNames+" = [ "node_modules" ]; underscoresasletter = true; nocjk = false; "~/library/projects" = { - "skippedNames+" = - [ ".editorconfig" ".gitignore" "result" "flake.lock" "go.sum" ]; + "skippedNames+" = [ + ".editorconfig" + ".gitignore" + "result" + "flake.lock" + "go.sum" + ]; }; "~/library/projects/software" = { - "skippedNames+" = [ "target" "result" ]; + "skippedNames+" = [ + "target" + "result" + ]; }; - "~/what-is-this-project" = { "skippedNames+" = [ "whoa-there" ]; }; + "~/what-is-this-project" = { + "skippedNames+" = [ "whoa-there" ]; + }; }; }; diff --git a/tests/modules/services/recoll/config-format-order.nix b/tests/modules/services/recoll/config-format-order.nix index 846627d96..afd39b9f0 100644 --- a/tests/modules/services/recoll/config-format-order.nix +++ b/tests/modules/services/recoll/config-format-order.nix @@ -9,7 +9,9 @@ enable = true; package = config.lib.test.mkStubPackage { }; settings = { - a = { foo = "bar"; }; + a = { + foo = "bar"; + }; b = 10; c = { a = "This should appear as the second section."; @@ -17,20 +19,28 @@ aa = true; }; d = false; - e = - "This should be the second to the last non-attrset value in the config."; + e = "This should be the second to the last non-attrset value in the config."; f = { - a = - "This should be second to the last for the attribute names with an attrset."; + a = "This should be second to the last for the attribute names with an attrset."; b = 3193; c = false; - d = [ "Hello" "there" ]; + d = [ + "Hello" + "there" + ]; }; foo = { bar = "This should be the last attribute with an attrset."; baz = 42; }; - g = [ "This" "is" "coming" "from" "a" "list" ]; + g = [ + "This" + "is" + "coming" + "from" + "a" + "list" + ]; }; }; diff --git a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix index 06093154d..76cf28250 100644 --- a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix +++ b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix @@ -9,7 +9,9 @@ adjustment-method = "randr"; gamma = 0.8; }; - randr = { screen = 0; }; + randr = { + screen = 0; + }; }; }; diff --git a/tests/modules/services/redshift-gammastep/gammastep-tray-configuration.nix b/tests/modules/services/redshift-gammastep/gammastep-tray-configuration.nix index e408f9cc4..662d8d081 100644 --- a/tests/modules/services/redshift-gammastep/gammastep-tray-configuration.nix +++ b/tests/modules/services/redshift-gammastep/gammastep-tray-configuration.nix @@ -9,7 +9,9 @@ adjustment-method = "randr"; gamma = 0.8; }; - randr = { screen = 0; }; + randr = { + screen = 0; + }; }; tray = true; }; diff --git a/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix b/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix index 0ecb3ec81..89786a2f4 100644 --- a/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix +++ b/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix @@ -9,7 +9,9 @@ adjustment-method = "randr"; gamma = 0.8; }; - randr = { screen = 0; }; + randr = { + screen = 0; + }; }; }; diff --git a/tests/modules/services/redshift-gammastep/redshift-tray-configuration.nix b/tests/modules/services/redshift-gammastep/redshift-tray-configuration.nix index 332bb8191..520cee10c 100644 --- a/tests/modules/services/redshift-gammastep/redshift-tray-configuration.nix +++ b/tests/modules/services/redshift-gammastep/redshift-tray-configuration.nix @@ -9,7 +9,9 @@ adjustment-method = "randr"; gamma = 0.8; }; - randr = { screen = 0; }; + randr = { + screen = 0; + }; }; tray = true; }; diff --git a/tests/modules/services/remmina/basic-config.nix b/tests/modules/services/remmina/basic-config.nix index de8d0e08b..1839e55af 100644 --- a/tests/modules/services/remmina/basic-config.nix +++ b/tests/modules/services/remmina/basic-config.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ xdg.mimeApps.enable = true; services.remmina = { @@ -8,7 +9,10 @@ addRdpMimeTypeAssoc = false; systemdService = { enable = true; - startupFlags = [ "--icon" "--enable-extra-hardening" ]; + startupFlags = [ + "--icon" + "--enable-extra-hardening" + ]; }; }; diff --git a/tests/modules/services/remmina/default-config.nix b/tests/modules/services/remmina/default-config.nix index 747623aff..f3e0c6eaf 100644 --- a/tests/modules/services/remmina/default-config.nix +++ b/tests/modules/services/remmina/default-config.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ xdg.mimeApps.enable = true; services.remmina = { diff --git a/tests/modules/services/screen-locker/basic-configuration.nix b/tests/modules/services/screen-locker/basic-configuration.nix index 1cf4fabe2..aff71b10b 100644 --- a/tests/modules/services/screen-locker/basic-configuration.nix +++ b/tests/modules/services/screen-locker/basic-configuration.nix @@ -5,8 +5,13 @@ enable = true; inactiveInterval = 5; lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; - lockCmdEnv = [ "DISPLAY=:0" "XAUTHORITY=/custom/path/.Xauthority" ]; - xss-lock = { extraOptions = [ "-test" ]; }; + lockCmdEnv = [ + "DISPLAY=:0" + "XAUTHORITY=/custom/path/.Xauthority" + ]; + xss-lock = { + extraOptions = [ "-test" ]; + }; xautolock = { enable = true; detectSleep = true; diff --git a/tests/modules/services/screen-locker/moved-options.nix b/tests/modules/services/screen-locker/moved-options.nix index bb49b0489..0037dfc07 100644 --- a/tests/modules/services/screen-locker/moved-options.nix +++ b/tests/modules/services/screen-locker/moved-options.nix @@ -1,11 +1,20 @@ -{ config, pkgs, options, lib, ... }: +{ + config, + pkgs, + options, + lib, + ... +}: { services.screen-locker = { enable = true; inactiveInterval = 5; lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; - lockCmdEnv = [ "DISPLAY=:0" "XAUTHORITY=/custom/path/.Xauthority" ]; + lockCmdEnv = [ + "DISPLAY=:0" + "XAUTHORITY=/custom/path/.Xauthority" + ]; xssLockExtraOptions = [ "-test" ]; xautolockExtraOptions = [ "-test" ]; enableDetectSleep = true; @@ -13,18 +22,21 @@ # 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; + nmt.script = (import ./basic-configuration.nix { inherit config pkgs; }).nmt.script; - test.asserts.warnings.expected = let - renamed = { - xssLockExtraOptions = "xss-lock.extraOptions"; - xautolockExtraOptions = "xautolock.extraOptions"; - enableDetectSleep = "xautolock.detectSleep"; - }; - in lib.mapAttrsToList (old: new: - builtins.replaceStrings [ "\n" ] [ " " ] '' - The option `services.screen-locker.${old}' defined in - ${lib.showFiles options.services.screen-locker.${old}.files} - has been renamed to `services.screen-locker.${new}'.'') renamed; + test.asserts.warnings.expected = + let + renamed = { + xssLockExtraOptions = "xss-lock.extraOptions"; + xautolockExtraOptions = "xautolock.extraOptions"; + enableDetectSleep = "xautolock.detectSleep"; + }; + in + lib.mapAttrsToList ( + old: new: + builtins.replaceStrings [ "\n" ] [ " " ] '' + The option `services.screen-locker.${old}' defined in + ${lib.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 5883d09b6..8ef281ee2 100644 --- a/tests/modules/services/screen-locker/no-xautolock.nix +++ b/tests/modules/services/screen-locker/no-xautolock.nix @@ -9,7 +9,9 @@ extraOptions = [ "-test" ]; screensaverCycle = 5; }; - xautolock = { enable = false; }; + xautolock = { + enable = false; + }; }; nmt.script = '' diff --git a/tests/modules/services/signaturepdf/basic-configuration.nix b/tests/modules/services/signaturepdf/basic-configuration.nix index 0cfe0c3e8..36c084c81 100644 --- a/tests/modules/services/signaturepdf/basic-configuration.nix +++ b/tests/modules/services/signaturepdf/basic-configuration.nix @@ -2,10 +2,14 @@ services.signaturepdf = { enable = true; port = 9494; - extraConfig = { upload_max_filesize = "24M"; }; + extraConfig = { + upload_max_filesize = "24M"; + }; }; - test.stubs.signaturepdf = { outPath = "/signaturepdf"; }; + test.stubs.signaturepdf = { + outPath = "/signaturepdf"; + }; nmt.script = '' assertFileContent \ diff --git a/tests/modules/services/swayidle/basic-configuration.nix b/tests/modules/services/swayidle/basic-configuration.nix index 51a254ff9..b5534c75a 100644 --- a/tests/modules/services/swayidle/basic-configuration.nix +++ b/tests/modules/services/swayidle/basic-configuration.nix @@ -38,24 +38,22 @@ serviceFileNormalized="$(normalizeStorePaths "$serviceFile")" - assertFileContent "$serviceFileNormalized" ${ - builtins.toFile "expected.service" '' - [Install] - WantedBy=graphical-session.target + assertFileContent "$serviceFileNormalized" ${builtins.toFile "expected.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - Environment=PATH=@bash-interactive@/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 + [Service] + Environment=PATH=@bash-interactive@/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 - [Unit] - After=graphical-session.target - ConditionEnvironment=WAYLAND_DISPLAY - Description=Idle manager for Wayland - Documentation=man:swayidle(1) - PartOf=graphical-session.target - '' - } + [Unit] + After=graphical-session.target + ConditionEnvironment=WAYLAND_DISPLAY + Description=Idle manager for Wayland + Documentation=man:swayidle(1) + PartOf=graphical-session.target + ''} ''; } diff --git a/tests/modules/services/swaync/swaync.nix b/tests/modules/services/swaync/swaync.nix index cb752e290..7771a6e60 100644 --- a/tests/modules/services/swaync/swaync.nix +++ b/tests/modules/services/swaync/swaync.nix @@ -15,25 +15,23 @@ assertFileContent \ $serviceFile \ - ${ - builtins.toFile "swaync.service" '' - [Install] - WantedBy=graphical-session.target + ${builtins.toFile "swaync.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - BusName=org.freedesktop.Notifications - ExecStart=@swaync@/bin/swaync - Restart=on-failure - Type=dbus + [Service] + BusName=org.freedesktop.Notifications + ExecStart=@swaync@/bin/swaync + Restart=on-failure + Type=dbus - [Unit] - After=graphical-session.target - ConditionEnvironment=WAYLAND_DISPLAY - Description=Swaync notification daemon - Documentation=https://github.com/ErikReider/SwayNotificationCenter - PartOf=graphical-session.target - X-Restart-Triggers=/nix/store/00000000000000000000000000000000-config.json - '' - } + [Unit] + After=graphical-session.target + ConditionEnvironment=WAYLAND_DISPLAY + Description=Swaync notification daemon + Documentation=https://github.com/ErikReider/SwayNotificationCenter + PartOf=graphical-session.target + X-Restart-Triggers=/nix/store/00000000000000000000000000000000-config.json + ''} ''; } diff --git a/tests/modules/services/swayosd/swayosd.nix b/tests/modules/services/swayosd/swayosd.nix index 7b9b2a806..80547a191 100644 --- a/tests/modules/services/swayosd/swayosd.nix +++ b/tests/modules/services/swayosd/swayosd.nix @@ -15,26 +15,24 @@ nmt.script = '' assertFileContent \ home-files/.config/systemd/user/swayosd.service \ - ${ - builtins.toFile "swayosd.service" '' - [Install] - WantedBy=graphical-session.target + ${builtins.toFile "swayosd.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --style /etc/xdg/swayosd/style.css --top-margin 0.100000 - Restart=always - RestartSec=2s - Type=simple + [Service] + ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --style /etc/xdg/swayosd/style.css --top-margin 0.100000 + Restart=always + RestartSec=2s + Type=simple - [Unit] - After=graphical-session.target - ConditionEnvironment=WAYLAND_DISPLAY - Description=Volume/backlight OSD indicator - Documentation=man:swayosd(1) - PartOf=graphical-session.target - StartLimitBurst=5 - StartLimitIntervalSec=10 - '' - } + [Unit] + After=graphical-session.target + ConditionEnvironment=WAYLAND_DISPLAY + Description=Volume/backlight OSD indicator + Documentation=man:swayosd(1) + PartOf=graphical-session.target + StartLimitBurst=5 + StartLimitIntervalSec=10 + ''} ''; } diff --git a/tests/modules/services/swww/swww-graphical-session-target.nix b/tests/modules/services/swww/swww-graphical-session-target.nix index b21e0b7b4..c55b71531 100644 --- a/tests/modules/services/swww/swww-graphical-session-target.nix +++ b/tests/modules/services/swww/swww-graphical-session-target.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ services.swww = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@swww@"; }; diff --git a/tests/modules/services/sxhkd/configuration.nix b/tests/modules/services/sxhkd/configuration.nix index 7ca7b5307..bbef10f6c 100644 --- a/tests/modules/services/sxhkd/configuration.nix +++ b/tests/modules/services/sxhkd/configuration.nix @@ -4,7 +4,8 @@ let script = pkgs.writeShellScript "script.sh" '' echo "test" ''; -in { +in +{ services.sxhkd = { enable = true; diff --git a/tests/modules/services/syncthing/common/extra-options.nix b/tests/modules/services/syncthing/common/extra-options.nix index 226a5906b..712700113 100644 --- a/tests/modules/services/syncthing/common/extra-options.nix +++ b/tests/modules/services/syncthing/common/extra-options.nix @@ -8,7 +8,10 @@ lib.mkMerge [ services.syncthing = { enable = true; - extraOptions = [ "-foo" ''-bar "baz"'' ]; + extraOptions = [ + "-foo" + ''-bar "baz"'' + ]; }; } diff --git a/tests/modules/services/volnoti/package-option.nix b/tests/modules/services/volnoti/package-option.nix index c199a3a8f..198e914f6 100644 --- a/tests/modules/services/volnoti/package-option.nix +++ b/tests/modules/services/volnoti/package-option.nix @@ -13,17 +13,15 @@ serviceFile=home-files/.config/systemd/user/volnoti.service assertFileExists $serviceFile assertFileContent $serviceFile \ - ${ - builtins.toFile "expected-volnoti.service" '' - [Install] - WantedBy=graphical-session.target + ${builtins.toFile "expected-volnoti.service" '' + [Install] + WantedBy=graphical-session.target - [Service] - ExecStart=@volnoti@/bin/volnoti -v -n + [Service] + ExecStart=@volnoti@/bin/volnoti -v -n - [Unit] - Description=volnoti - '' - } + [Unit] + Description=volnoti + ''} ''; } diff --git a/tests/modules/services/window-managers/bspwm/configuration.nix b/tests/modules/services/window-managers/bspwm/configuration.nix index 9d58bb932..4f6e5a8c0 100644 --- a/tests/modules/services/window-managers/bspwm/configuration.nix +++ b/tests/modules/services/window-managers/bspwm/configuration.nix @@ -3,14 +3,20 @@ { xsession.windowManager.bspwm = { enable = true; - monitors.focused = [ "desktop 1" "d'esk top" ]; # pathological desktop names + monitors.focused = [ + "desktop 1" + "d'esk top" + ]; # pathological desktop names alwaysResetDesktops = false; settings = { border_width = 2; split_ratio = 0.52; gapless_monocle = true; external_rules_command = "/path/to/external rules command"; - ignore_ewmh_fullscreen = [ "enter" "exit" ]; + ignore_ewmh_fullscreen = [ + "enter" + "exit" + ]; }; rules."*" = { sticky = true; @@ -26,15 +32,16 @@ extraConfig = '' extra config ''; - startupPrograms = [ "foo" "bar || qux" ]; + startupPrograms = [ + "foo" + "bar || qux" + ]; }; nmt.script = '' bspwmrc=home-files/.config/bspwm/bspwmrc assertFileExists "$bspwmrc" assertFileIsExecutable "$bspwmrc" - assertFileContent "$bspwmrc" ${ - pkgs.writeShellScript "bspwmrc-expected" (builtins.readFile ./bspwmrc) - } + assertFileContent "$bspwmrc" ${pkgs.writeShellScript "bspwmrc-expected" (builtins.readFile ./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 44ed150b9..653a843c9 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix @@ -1,5 +1,7 @@ { - xsession.windowManager.herbstluftwm = { enable = true; }; + xsession.windowManager.herbstluftwm = { + enable = true; + }; nmt.script = '' autostart=home-files/.config/herbstluftwm/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 23e1a97d3..0ebe2dabf 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix @@ -23,7 +23,11 @@ "windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' focus=on pseudotile=on" "class~'[Pp]inentry' instance=pinentry focus=on floating=on floatplacement=center keys_inactive='.*'" ]; - tags = [ "1" "with space" "wə1rd#ch@rs'" ]; + tags = [ + "1" + "with space" + "wə1rd#ch@rs'" + ]; extraConfig = '' herbstclient use 1 ''; @@ -35,8 +39,6 @@ assertFileIsExecutable "$autostart" normalizedAutostart=$(normalizeStorePaths "$autostart") - assertFileContent "$normalizedAutostart" ${ - ./herbstluftwm-simple-config-autostart - } + assertFileContent "$normalizedAutostart" ${./herbstluftwm-simple-config-autostart} ''; } diff --git a/tests/modules/services/window-managers/hyprland/inconsistent-config.nix b/tests/modules/services/window-managers/hyprland/inconsistent-config.nix index c475d9c86..0c535a66d 100644 --- a/tests/modules/services/window-managers/hyprland/inconsistent-config.nix +++ b/tests/modules/services/window-managers/hyprland/inconsistent-config.nix @@ -1,8 +1,11 @@ -{ config, ... }: { +{ config, ... }: +{ wayland.windowManager.hyprland = { enable = true; - plugins = - [ "/path/to/plugin1" (config.lib.test.mkStubPackage { name = "foo"; }) ]; + plugins = [ + "/path/to/plugin1" + (config.lib.test.mkStubPackage { name = "foo"; }) + ]; }; test.asserts.warnings.expected = [ 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 7e27de042..4848c3194 100644 --- a/tests/modules/services/window-managers/hyprland/multiple-devices-config.nix +++ b/tests/modules/services/window-managers/hyprland/multiple-devices-config.nix @@ -3,8 +3,10 @@ { wayland.windowManager.hyprland = { enable = true; - plugins = - [ "/path/to/plugin1" (config.lib.test.mkStubPackage { name = "foo"; }) ]; + plugins = [ + "/path/to/plugin1" + (config.lib.test.mkStubPackage { name = "foo"; }) + ]; settings = { source = [ "sourced.conf" ]; @@ -34,7 +36,9 @@ kb_layout = "ro"; follow_mouse = 1; accel_profile = "flat"; - touchpad = { scroll_factor = 0.3; }; + touchpad = { + scroll_factor = 0.3; + }; }; bindm = [ @@ -58,7 +62,9 @@ plugin = { plugin1 = { dummy = "plugin setting"; - section = { other = "dummy setting"; }; + section = { + other = "dummy setting"; + }; }; }; }; 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 dc89fcda1..2550b690d 100644 --- a/tests/modules/services/window-managers/hyprland/null-package-config.nix +++ b/tests/modules/services/window-managers/hyprland/null-package-config.nix @@ -10,18 +10,20 @@ }; }; - test.asserts.warnings.expected = ['' - xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you - should either set `xdg.portal.config` or `xdg.portal.configPackages` - to specify which portal backend to use for the requested interface. + test.asserts.warnings.expected = [ + '' + xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you + should either set `xdg.portal.config` or `xdg.portal.configPackages` + to specify which portal backend to use for the requested interface. - https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in + https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in - If you simply want to keep the behaviour in < 1.17, which uses the first - portal implementation found in lexicographical order, use the following: + If you simply want to keep the behaviour in < 1.17, which uses the first + portal implementation found in lexicographical order, use the following: - xdg.portal.config.common.default = "*"; - '']; + xdg.portal.config.common.default = "*"; + '' + ]; test.asserts.warnings.enable = true; nmt.script = '' diff --git a/tests/modules/services/window-managers/hyprland/simple-config.nix b/tests/modules/services/window-managers/hyprland/simple-config.nix index 820fcc3e2..3ee1de013 100644 --- a/tests/modules/services/window-managers/hyprland/simple-config.nix +++ b/tests/modules/services/window-managers/hyprland/simple-config.nix @@ -3,8 +3,10 @@ { wayland.windowManager.hyprland = { enable = true; - plugins = - [ "/path/to/plugin1" (config.lib.test.mkStubPackage { name = "foo"; }) ]; + plugins = [ + "/path/to/plugin1" + (config.lib.test.mkStubPackage { name = "foo"; }) + ]; settings = { source = [ "sourced.conf" ]; @@ -34,7 +36,9 @@ kb_layout = "ro"; follow_mouse = 1; accel_profile = "flat"; - touchpad = { scroll_factor = 0.3; }; + touchpad = { + scroll_factor = 0.3; + }; }; bindm = [ @@ -52,7 +56,9 @@ plugin = { plugin1 = { dummy = "plugin setting"; - section = { other = "dummy setting"; }; + section = { + other = "dummy setting"; + }; }; }; }; 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 06cfdf453..2bb68b712 100644 --- a/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.nix +++ b/tests/modules/services/window-managers/hyprland/sourceFirst-false-config.nix @@ -14,7 +14,9 @@ kb_layout = "ro"; follow_mouse = 1; accel_profile = "flat"; - touchpad = { scroll_factor = 0.3; }; + touchpad = { + scroll_factor = 0.3; + }; }; }; sourceFirst = false; diff --git a/tests/modules/services/window-managers/i3/i3-bar-focused-colors.nix b/tests/modules/services/window-managers/i3/i3-bar-focused-colors.nix index 7524fbee8..5a140e4b4 100644 --- a/tests/modules/services/window-managers/i3/i3-bar-focused-colors.nix +++ b/tests/modules/services/window-managers/i3/i3-bar-focused-colors.nix @@ -4,11 +4,13 @@ xsession.windowManager.i3 = { enable = true; - config.bars = [{ - colors.focusedBackground = "#ffffff"; - colors.focusedStatusline = "#000000"; - colors.focusedSeparator = "#999999"; - }]; + config.bars = [ + { + colors.focusedBackground = "#ffffff"; + colors.focusedStatusline = "#000000"; + colors.focusedSeparator = "#999999"; + } + ]; }; nmt.script = '' diff --git a/tests/modules/services/window-managers/i3/i3-followmouse.nix b/tests/modules/services/window-managers/i3/i3-followmouse.nix index 9477d89d1..021bc4784 100644 --- a/tests/modules/services/window-managers/i3/i3-followmouse.nix +++ b/tests/modules/services/window-managers/i3/i3-followmouse.nix @@ -7,13 +7,21 @@ nixpkgs.overlays = [ (self: super: { - dmenu = super.dmenu // { outPath = "@dmenu@"; }; + dmenu = super.dmenu // { + outPath = "@dmenu@"; + }; - i3 = super.writeScriptBin "i3" "" // { outPath = "@i3@"; }; + i3 = super.writeScriptBin "i3" "" // { + outPath = "@i3@"; + }; - i3-gaps = super.writeScriptBin "i3" "" // { outPath = "@i3-gaps@"; }; + i3-gaps = super.writeScriptBin "i3" "" // { + outPath = "@i3-gaps@"; + }; - i3status = super.i3status // { outPath = "@i3status@"; }; + i3status = super.i3status // { + outPath = "@i3status@"; + }; }) ]; diff --git a/tests/modules/services/window-managers/i3/i3-fonts-deprecated.nix b/tests/modules/services/window-managers/i3/i3-fonts-deprecated.nix index 1aa0c9bcc..a4ca39b61 100644 --- a/tests/modules/services/window-managers/i3/i3-fonts-deprecated.nix +++ b/tests/modules/services/window-managers/i3/i3-fonts-deprecated.nix @@ -6,10 +6,23 @@ config = { bars = [ - { fonts = [ "FontAwesome" "Iosevka 11.500000" ]; } - { fonts = [ "FontAwesome" "Iosevka Bold Semi-Condensed 14px" ]; } + { + fonts = [ + "FontAwesome" + "Iosevka 11.500000" + ]; + } + { + fonts = [ + "FontAwesome" + "Iosevka Bold Semi-Condensed 14px" + ]; + } + ]; + fonts = [ + "DejaVuSansMono" + "Terminus Bold Semi-Condensed 13.500000" ]; - fonts = [ "DejaVuSansMono" "Terminus Bold Semi-Condensed 13.500000" ]; }; }; diff --git a/tests/modules/services/window-managers/i3/i3-fonts.nix b/tests/modules/services/window-managers/i3/i3-fonts.nix index 1f3ae01c1..945d597ef 100644 --- a/tests/modules/services/window-managers/i3/i3-fonts.nix +++ b/tests/modules/services/window-managers/i3/i3-fonts.nix @@ -8,20 +8,29 @@ bars = [ { fonts = { - names = [ "FontAwesome" "Iosevka" ]; + names = [ + "FontAwesome" + "Iosevka" + ]; size = 11.5; }; } { fonts = { - names = [ "FontAwesome" "Iosevka" ]; + names = [ + "FontAwesome" + "Iosevka" + ]; style = "Bold Semi-Condensed"; size = "14px"; }; } ]; fonts = { - names = [ "DejaVuSansMono" "Terminus" ]; + names = [ + "DejaVuSansMono" + "Terminus" + ]; style = "Bold Semi-Condensed"; size = 13.5; }; diff --git a/tests/modules/services/window-managers/i3/i3-keybindings.nix b/tests/modules/services/window-managers/i3/i3-keybindings.nix index 2137c53ed..62da17571 100644 --- a/tests/modules/services/window-managers/i3/i3-keybindings.nix +++ b/tests/modules/services/window-managers/i3/i3-keybindings.nix @@ -7,8 +7,10 @@ enable = true; config.keybindings = - let modifier = config.xsession.windowManager.i3.config.modifier; - in lib.mkOptionDefault { + let + modifier = config.xsession.windowManager.i3.config.modifier; + in + lib.mkOptionDefault { "${modifier}+Left" = "overridden-command"; "${modifier}+Right" = null; "${modifier}+Invented" = "invented-key-command"; diff --git a/tests/modules/services/window-managers/i3/i3-workspace-output.nix b/tests/modules/services/window-managers/i3/i3-workspace-output.nix index 028e891b1..427075432 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-output.nix +++ b/tests/modules/services/window-managers/i3/i3-workspace-output.nix @@ -7,7 +7,8 @@ let ws5 = "Multiple"; }; -in { +in +{ imports = [ ./i3-stubs.nix ]; xsession.windowManager.i3 = { @@ -32,7 +33,11 @@ in { } { workspace = "${i3.ws5}"; - output = [ "DVI" "HDMI" "DP" ]; + output = [ + "DVI" + "HDMI" + "DP" + ]; } ]; }; diff --git a/tests/modules/services/window-managers/river/configuration.nix b/tests/modules/services/window-managers/river/configuration.nix index 10e4d4db7..f627e3256 100644 --- a/tests/modules/services/window-managers/river/configuration.nix +++ b/tests/modules/services/window-managers/river/configuration.nix @@ -15,8 +15,15 @@ border-color-unfocused = "0x586e75"; border-color-urgent = "0xff0000"; border-width = 2; - csd-filter-add.app-id = [ "bar" "foo" ]; - declare-mode = [ "locked" "normal" "passthrough" ]; + csd-filter-add.app-id = [ + "bar" + "foo" + ]; + declare-mode = [ + "locked" + "normal" + "passthrough" + ]; default-layout = "rivertile"; float-filter-add.app-id = "mpd"; float-filter-add.title = "popup title with spaces"; @@ -66,7 +73,10 @@ set-cursor-warp = "on-output-change"; set-repeat = "50 300"; xcursor-theme = "someGreatTheme 12"; - spawn = [ "firefox" "'foot -a terminal'" ]; + spawn = [ + "firefox" + "'foot -a terminal'" + ]; }; extraConfig = '' 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 7145cbc44..245530f67 100644 --- a/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix +++ b/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix @@ -7,15 +7,17 @@ bar_justify = "center"; modkey = "Mod4"; }; - programs = { term = "alacritty"; }; - bindings = { term = "MOD+Shift+Return"; }; + programs = { + term = "alacritty"; + }; + bindings = { + term = "MOD+Shift+Return"; + }; unbindings = [ "MOD+Return" ]; }; nmt.script = '' assertFileContent \ - home-files/.config/spectrwm/spectrwm.conf ${ - ./spectrwm-simple-config-expected-spectrwm.conf - } + home-files/.config/spectrwm/spectrwm.conf ${./spectrwm-simple-config-expected-spectrwm.conf} ''; } diff --git a/tests/modules/services/window-managers/sway/default.nix b/tests/modules/services/window-managers/sway/default.nix index 7627aab04..1212bf589 100644 --- a/tests/modules/services/window-managers/sway/default.nix +++ b/tests/modules/services/window-managers/sway/default.nix @@ -1,7 +1,6 @@ { sway-bar-focused-colors = ./sway-bar-focused-colors.nix; - sway-bindkeys-to-code-and-extra-config = - ./sway-bindkeys-to-code-and-extra-config.nix; + sway-bindkeys-to-code-and-extra-config = ./sway-bindkeys-to-code-and-extra-config.nix; sway-default = ./sway-default.nix; sway-followmouse = ./sway-followmouse.nix; sway-followmouse-legacy = ./sway-followmouse-legacy.nix; 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 0cda0a661..39ea28a3f 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 @@ -8,11 +8,13 @@ # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; - config.bars = [{ - colors.focusedBackground = "#ffffff"; - colors.focusedStatusline = "#000000"; - colors.focusedSeparator = "#999999"; - }]; + config.bars = [ + { + colors.focusedBackground = "#ffffff"; + colors.focusedStatusline = "#000000"; + colors.focusedSeparator = "#999999"; + } + ]; }; nmt.script = '' 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 83558ecee..71611ec89 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,9 @@ -{ config, lib, realPkgs, ... }: +{ + config, + lib, + realPkgs, + ... +}: lib.mkIf config.test.enableBig { wayland.windowManager.sway = { diff --git a/tests/modules/services/window-managers/sway/sway-modules.nix b/tests/modules/services/window-managers/sway/sway-modules.nix index d9a566c60..4cdac1238 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.nix +++ b/tests/modules/services/window-managers/sway/sway-modules.nix @@ -9,9 +9,21 @@ config = { menu = "${pkgs.dmenu}/bin/dmenu_run"; - input = { "*" = { xkb_variant = "dvorak"; }; }; - output = { "HDMI-A-2" = { bg = "~/path/to/background.png fill"; }; }; - seat = { "*" = { hide_cursor = "when-typing enable"; }; }; + input = { + "*" = { + xkb_variant = "dvorak"; + }; + }; + output = { + "HDMI-A-2" = { + bg = "~/path/to/background.png fill"; + }; + }; + seat = { + "*" = { + hide_cursor = "when-typing enable"; + }; + }; }; }; 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 d754d67d5..3a36c6e9f 100644 --- a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix +++ b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -13,10 +13,8 @@ nmt.script = '' assertFileExists home-files/.config/sway/config assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ - ${ - builtins.toFile "expected" '' - xwayland disable - '' - } + ${builtins.toFile "expected" '' + xwayland disable + ''} ''; } 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 3ab770813..a98e25765 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.nix +++ b/tests/modules/services/window-managers/sway/sway-null-package.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { # Enables the default bar configuration @@ -11,12 +16,16 @@ config.menu = "${pkgs.dmenu}/bin/dmenu_run"; }; - assertions = [{ - assertion = - !lib.elem config.wayland.windowManager.sway.config.bars [ [ { } ] [ ] ]; - message = - "The default Sway bars configuration should be set for this test (sway-null-package) to work."; - }]; + assertions = [ + { + assertion = + !lib.elem config.wayland.windowManager.sway.config.bars [ + [ { } ] + [ ] + ]; + message = "The default Sway bars configuration should be set for this test (sway-null-package) to work."; + } + ]; nmt.script = '' assertFileExists home-files/.config/sway/config 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 b8f342210..48b8240b6 100644 --- a/tests/modules/services/window-managers/sway/sway-systemd-variables.nix +++ b/tests/modules/services/window-managers/sway/sway-systemd-variables.nix @@ -8,7 +8,10 @@ # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; - systemd.variables = [ "XCURSOR_THEME" "XCURSOR_SIZE" ]; + systemd.variables = [ + "XCURSOR_THEME" + "XCURSOR_SIZE" + ]; }; nmt.script = '' 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 2f8816bc4..3b5d003e8 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-output.nix @@ -9,7 +9,8 @@ let ws5 = "Multiple"; }; -in { +in +{ wayland.windowManager.sway = { enable = true; package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; @@ -36,7 +37,11 @@ in { } { workspace = "${i3.ws5}"; - output = [ "DVI" "HDMI" "DP" ]; + output = [ + "DVI" + "HDMI" + "DP" + ]; } ]; }; diff --git a/tests/modules/services/wob/wob-service.nix b/tests/modules/services/wob/wob-service.nix index ecef9eee7..01ca46bb3 100644 --- a/tests/modules/services/wob/wob-service.nix +++ b/tests/modules/services/wob/wob-service.nix @@ -20,9 +20,7 @@ assertFileExists $serviceFile assertFileExists $socketFile assertFileExists $configFile - assertFileContent $(normalizeStorePaths $serviceFile) ${ - ./wob-service-expected.service - } + assertFileContent $(normalizeStorePaths $serviceFile) ${./wob-service-expected.service} assertFileContent $socketFile ${./wob-service-expected.socket} assertFileContent $configFile ${./wob-service-expected.ini} ''; diff --git a/tests/modules/services/yubikey-agent-darwin/service.nix b/tests/modules/services/yubikey-agent-darwin/service.nix index 99b68dc6f..8d7074503 100644 --- a/tests/modules/services/yubikey-agent-darwin/service.nix +++ b/tests/modules/services/yubikey-agent-darwin/service.nix @@ -9,41 +9,39 @@ nmt.script = '' serviceFile=LaunchAgents/org.nix-community.home.yubikey-agent.plist assertFileExists "$serviceFile" - assertFileContent "$serviceFile" ${ - builtins.toFile "expected-agent.plist" '' - - - - - KeepAlive - - Crashed - - SuccessfulExit - - - Label - org.nix-community.home.yubikey-agent - ProcessType - Background - ProgramArguments - - @yubikey-agent@/bin/yubikey-agent - -l - /tmp/yubikey-agent.sock - - Sockets - - Listener - - SockPathMode - 384 - SockPathName - /tmp/yubikey-agent.sock - - - - '' - } + assertFileContent "$serviceFile" ${builtins.toFile "expected-agent.plist" '' + + + + + KeepAlive + + Crashed + + SuccessfulExit + + + Label + org.nix-community.home.yubikey-agent + ProcessType + Background + ProgramArguments + + @yubikey-agent@/bin/yubikey-agent + -l + /tmp/yubikey-agent.sock + + Sockets + + Listener + + SockPathMode + 384 + SockPathName + /tmp/yubikey-agent.sock + + + + ''} ''; } diff --git a/tests/modules/services/yubikey-agent/service.nix b/tests/modules/services/yubikey-agent/service.nix index 90ff5cc72..611e3e888 100644 --- a/tests/modules/services/yubikey-agent/service.nix +++ b/tests/modules/services/yubikey-agent/service.nix @@ -13,37 +13,33 @@ assertFileExists $serviceFile assertFileExists $socketFile - assertFileContent $serviceFile ${ - builtins.toFile "expected-service" '' - [Service] - ExecStart=@yubikey-agent@/bin/yubikey-agent -l %t/yubikey-agent/yubikey-agent.sock - ReadWritePaths=%t - Type=simple + assertFileContent $serviceFile ${builtins.toFile "expected-service" '' + [Service] + ExecStart=@yubikey-agent@/bin/yubikey-agent -l %t/yubikey-agent/yubikey-agent.sock + ReadWritePaths=%t + Type=simple - [Unit] - After=yubikey-agent.socket - Description=Seamless ssh-agent for YubiKeys - Documentation=https://github.com/FiloSottile/yubikey-agent - RefuseManualStart=true - Requires=yubikey-agent.socket - '' - } + [Unit] + After=yubikey-agent.socket + Description=Seamless ssh-agent for YubiKeys + Documentation=https://github.com/FiloSottile/yubikey-agent + RefuseManualStart=true + Requires=yubikey-agent.socket + ''} - assertFileContent $socketFile ${ - builtins.toFile "expected-socket" '' - [Install] - WantedBy=sockets.target + assertFileContent $socketFile ${builtins.toFile "expected-socket" '' + [Install] + WantedBy=sockets.target - [Socket] - DirectoryMode=0700 - ListenStream=%t/yubikey-agent/yubikey-agent.sock - RuntimeDirectory=yubikey-agent - SocketMode=0600 + [Socket] + DirectoryMode=0700 + ListenStream=%t/yubikey-agent/yubikey-agent.sock + RuntimeDirectory=yubikey-agent + SocketMode=0600 - [Unit] - Description=Unix domain socket for Yubikey SSH agent - Documentation=https://github.com/FiloSottile/yubikey-agent - '' - } + [Unit] + Description=Unix domain socket for Yubikey SSH agent + Documentation=https://github.com/FiloSottile/yubikey-agent + ''} ''; } diff --git a/tests/modules/systemd/services-disabled-for-root.nix b/tests/modules/systemd/services-disabled-for-root.nix index 38d4f9557..bc0060e5b 100644 --- a/tests/modules/systemd/services-disabled-for-root.nix +++ b/tests/modules/systemd/services-disabled-for-root.nix @@ -4,10 +4,15 @@ home.username = lib.mkForce "root"; systemd.user.services."test-service@" = { - Unit = { Description = "A basic test service"; }; + Unit = { + Description = "A basic test service"; + }; Service = { - Environment = [ "VAR1=1" "VAR2=2" ]; + Environment = [ + "VAR1=1" + "VAR2=2" + ]; ExecStart = ''/some/exec/start/command --with-arguments "%i"''; }; }; diff --git a/tests/modules/systemd/services.nix b/tests/modules/systemd/services.nix index 439a03f2e..85c99b230 100644 --- a/tests/modules/systemd/services.nix +++ b/tests/modules/systemd/services.nix @@ -4,12 +4,18 @@ let drvScript = pkgs.writeShellScript "drv-script.sh" '' echo "Just a test" ''; -in { +in +{ systemd.user.services."test-service@" = { - Unit = { Description = "A basic test service"; }; + Unit = { + Description = "A basic test service"; + }; Service = { - Environment = [ "VAR1=1" "VAR2=2" ]; + Environment = [ + "VAR1=1" + "VAR2=2" + ]; ExecStartPre = drvScript; ExecStart = ''/some/exec/start/command --with-arguments "%i"''; }; @@ -19,17 +25,15 @@ in { serviceFile=home-files/.config/systemd/user/test-service@.service assertFileExists $serviceFile assertFileContent $serviceFile \ - ${ - pkgs.writeText "services-expected.conf" '' - [Service] - Environment=VAR1=1 - Environment=VAR2=2 - ExecStart=/some/exec/start/command --with-arguments "%i" - ExecStartPre=${drvScript} + ${pkgs.writeText "services-expected.conf" '' + [Service] + Environment=VAR1=1 + Environment=VAR2=2 + ExecStart=/some/exec/start/command --with-arguments "%i" + ExecStartPre=${drvScript} - [Unit] - Description=A basic test service - '' - } + [Unit] + Description=A basic test service + ''} ''; } diff --git a/tests/modules/systemd/session-variables.nix b/tests/modules/systemd/session-variables.nix index e427bbeea..583d01695 100644 --- a/tests/modules/systemd/session-variables.nix +++ b/tests/modules/systemd/session-variables.nix @@ -9,16 +9,14 @@ nmt.script = '' envFile=home-files/.config/environment.d/10-home-manager.conf assertFileExists $envFile - assertFileContent $envFile ${ - pkgs.writeText "expected" '' - LOCALE_ARCHIVE_2_27=${config.i18n.glibcLocales}/lib/locale/locale-archive - V_int=1 - V_str=2 - XDG_CACHE_HOME=/home/hm-user/.cache - XDG_CONFIG_HOME=/home/hm-user/.config - XDG_DATA_HOME=/home/hm-user/.local/share - XDG_STATE_HOME=/home/hm-user/.local/state - '' - } + assertFileContent $envFile ${pkgs.writeText "expected" '' + LOCALE_ARCHIVE_2_27=${config.i18n.glibcLocales}/lib/locale/locale-archive + V_int=1 + V_str=2 + XDG_CACHE_HOME=/home/hm-user/.cache + XDG_CONFIG_HOME=/home/hm-user/.config + XDG_DATA_HOME=/home/hm-user/.local/share + XDG_STATE_HOME=/home/hm-user/.local/state + ''} ''; } diff --git a/tests/modules/systemd/slices.nix b/tests/modules/systemd/slices.nix index 68f6c70a7..f8fa8f370 100644 --- a/tests/modules/systemd/slices.nix +++ b/tests/modules/systemd/slices.nix @@ -2,7 +2,9 @@ { systemd.user.slices.app-test = { - Unit = { Description = "Slice for a test app"; }; + Unit = { + Description = "Slice for a test app"; + }; Slice = { MemoryHigh = "30%"; @@ -13,15 +15,13 @@ nmt.script = '' sliceFile=home-files/.config/systemd/user/app-test.slice assertFileExists $sliceFile - assertFileContent $sliceFile ${ - builtins.toFile "app-test-expected.conf" '' - [Slice] - MemoryHigh=30% - MemoryMax=40% + assertFileContent $sliceFile ${builtins.toFile "app-test-expected.conf" '' + [Slice] + MemoryHigh=30% + MemoryMax=40% - [Unit] - Description=Slice for a test app - '' - } + [Unit] + Description=Slice for a test app + ''} ''; } diff --git a/tests/modules/systemd/timers.nix b/tests/modules/systemd/timers.nix index 2d48e9fde..57e4245cd 100644 --- a/tests/modules/systemd/timers.nix +++ b/tests/modules/systemd/timers.nix @@ -1,10 +1,16 @@ { systemd.user.timers.test-timer = { - Unit = { Description = "A basic test timer"; }; + Unit = { + Description = "A basic test timer"; + }; - Timer = { OnUnitActiveSec = "1h 30m"; }; + Timer = { + OnUnitActiveSec = "1h 30m"; + }; - Install = { WantedBy = [ "timers.target" ]; }; + Install = { + WantedBy = [ "timers.target" ]; + }; }; nmt.script = '' diff --git a/tests/modules/systemd/user-config.nix b/tests/modules/systemd/user-config.nix index 3e6a9fcbe..31948ce4e 100644 --- a/tests/modules/systemd/user-config.nix +++ b/tests/modules/systemd/user-config.nix @@ -13,13 +13,11 @@ nmt.script = '' userConf=home-files/.config/systemd/user.conf assertFileExists $userConf - assertFileContent $userConf ${ - pkgs.writeText "expected" '' - [Manager] - DefaultCPUAccounting=true - DefaultEnvironment=PATH='/bin:/sbin:/some where' TEST=abc - LogLevel=debug - '' - } + assertFileContent $userConf ${pkgs.writeText "expected" '' + [Manager] + DefaultCPUAccounting=true + DefaultEnvironment=PATH='/bin:/sbin:/some where' TEST=abc + LogLevel=debug + ''} ''; } diff --git a/tests/modules/targets-darwin/darwin.nix b/tests/modules/targets-darwin/darwin.nix index 640b17783..bf63468b4 100644 --- a/tests/modules/targets-darwin/darwin.nix +++ b/tests/modules/targets-darwin/darwin.nix @@ -4,7 +4,8 @@ let mkdir -p $out/Applications touch $out/Applications/example-app ''; -in { +in +{ config = { home.packages = [ darwinTestApp ]; diff --git a/tests/modules/targets-darwin/user-defaults.nix b/tests/modules/targets-darwin/user-defaults.nix index a99baf6d0..2a11398c5 100644 --- a/tests/modules/targets-darwin/user-defaults.nix +++ b/tests/modules/targets-darwin/user-defaults.nix @@ -2,8 +2,7 @@ config = { targets.darwin = { defaults."com.apple.desktopservices".DSDontWriteNetworkStores = true; - currentHostDefaults."com.apple.controlcenter".BatteryShowPercentage = - true; + currentHostDefaults."com.apple.controlcenter".BatteryShowPercentage = true; }; nmt.script = '' diff --git a/tests/modules/targets-linux/generic-linux.nix b/tests/modules/targets-linux/generic-linux.nix index aba0e39d0..e838cbab7 100644 --- a/tests/modules/targets-linux/generic-linux.nix +++ b/tests/modules/targets-linux/generic-linux.nix @@ -9,7 +9,8 @@ let "/var/lib/snapd/desktop" "/foo" ]; -in { +in +{ config = { targets.genericLinux.enable = true; diff --git a/tests/modules/xresources/xresources.nix b/tests/modules/xresources/xresources.nix index 5fead37da..12ad4dc39 100644 --- a/tests/modules/xresources/xresources.nix +++ b/tests/modules/xresources/xresources.nix @@ -6,7 +6,12 @@ "Test*boolean2" = false; "Test*int" = 10; "Test*float" = 12.3; - "Test*list" = [ "list-str" true false 10 ]; + "Test*list" = [ + "list-str" + true + false + 10 + ]; }; }; diff --git a/tests/stubs.nix b/tests/stubs.nix index 66d7265e6..344b271a9 100644 --- a/tests/stubs.nix +++ b/tests/stubs.nix @@ -1,77 +1,95 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkOption types; - stubType = types.submodule ({ name, ... }: { - options = { - name = mkOption { - type = types.str; - default = "dummy"; - description = "The stub package name."; - }; + stubType = types.submodule ( + { name, ... }: + { + options = { + name = mkOption { + type = types.str; + default = "dummy"; + description = "The stub package name."; + }; - outPath = mkOption { - type = types.nullOr types.str; - default = "@${name}@"; - defaultText = lib.literalExpression ''"@''${name}@"''; - }; + outPath = mkOption { + type = types.nullOr types.str; + default = "@${name}@"; + defaultText = lib.literalExpression ''"@''${name}@"''; + }; - version = mkOption { - type = types.nullOr types.str; - default = null; - defaultText = lib.literalExpression "pkgs.\${name}.version or null"; - }; + version = mkOption { + type = types.nullOr types.str; + default = null; + defaultText = lib.literalExpression "pkgs.\${name}.version or null"; + }; - buildScript = mkOption { - type = types.str; - default = defaultBuildScript; - }; + buildScript = mkOption { + type = types.str; + default = defaultBuildScript; + }; - extraAttrs = mkOption { - type = types.attrsOf types.anything; - default = { }; + extraAttrs = mkOption { + type = types.attrsOf types.anything; + default = { }; + }; }; - }; - }); + } + ); defaultBuildScript = "mkdir $out"; - dummyPackage = pkgs.runCommandLocal "dummy" { meta.mainProgram = "dummy"; } - defaultBuildScript; + dummyPackage = pkgs.runCommandLocal "dummy" { meta.mainProgram = "dummy"; } defaultBuildScript; - mkStubPackage = { name ? "dummy", outPath ? null, version ? null - , buildScript ? defaultBuildScript, extraAttrs ? { } }: + mkStubPackage = + { + name ? "dummy", + outPath ? null, + version ? null, + buildScript ? defaultBuildScript, + extraAttrs ? { }, + }: let - pkg = if name == "dummy" && buildScript == defaultBuildScript then - dummyPackage - else - pkgs.runCommandLocal name { - pname = name; - meta.mainProgram = name; - } buildScript; + pkg = + if name == "dummy" && buildScript == defaultBuildScript then + dummyPackage + else + pkgs.runCommandLocal name { + pname = name; + meta.mainProgram = name; + } buildScript; - stubbedPkg = pkg // lib.optionalAttrs (outPath != null) { - inherit outPath; + stubbedPkg = + pkg + // lib.optionalAttrs (outPath != null) { + inherit outPath; - # Prevent getOutput from descending into outputs - outputSpecified = true; + # Prevent getOutput from descending into outputs + outputSpecified = true; - # Allow the original package to be used in derivation inputs - __spliced = { - buildHost = pkg; - hostTarget = pkg; - }; - } // lib.optionalAttrs (version != null) { inherit version; } + # Allow the original package to be used in derivation inputs + __spliced = { + buildHost = pkg; + hostTarget = pkg; + }; + } + // lib.optionalAttrs (version != null) { inherit version; } // extraAttrs; - in stubbedPkg; + in + stubbedPkg; -in { +in +{ options.test = { stubs = mkOption { type = types.attrsOf stubType; default = { }; - description = - "Package attributes that should be replaced by a stub package."; + description = "Package attributes that should be replaced by a stub package."; }; stubOverlays = mkOption { @@ -89,12 +107,22 @@ in { config = { lib.test.mkStubPackage = mkStubPackage; - test.stubOverlays = [ ] ++ lib.optional (config.test.stubs != { }) - (self: super: - lib.mapAttrs (n: v: - builtins.traceVerbose "${n} - stubbed" (mkStubPackage (v - // lib.optionalAttrs (v.version == null) { - version = super.${n}.version or null; - }))) config.test.stubs) ++ config.test.unstubs; + test.stubOverlays = + [ ] + ++ lib.optional (config.test.stubs != { }) ( + self: super: + lib.mapAttrs ( + n: v: + builtins.traceVerbose "${n} - stubbed" ( + mkStubPackage ( + v + // lib.optionalAttrs (v.version == null) { + version = super.${n}.version or null; + } + ) + ) + ) config.test.stubs + ) + ++ config.test.unstubs; }; }