diff --git a/third_party/home-manager/.github/CODEOWNERS b/third_party/home-manager/.github/CODEOWNERS index 843ce3bb19..9ade1106ac 100644 --- a/third_party/home-manager/.github/CODEOWNERS +++ b/third_party/home-manager/.github/CODEOWNERS @@ -2,23 +2,35 @@ /flake.nix @bqv @kisik21 +Makefile @thiagokokada + +/modules/config/home-cursor.nix @polykernel @league + +/modules/config/i18n.nix @midchildan +/tests/modules/config/i18n @midchildan + /modules/home-environment.nix @rycee /modules/i18n/input-method @Kranzes /tests/modules/i18n/input-method @Kranzes -/modules/misc/dconf.nix @gnidorah @rycee +/modules/launchd @midchildan + +/modules/misc/dconf.nix @rycee + +/modules/misc/editorconfig.nix @loicreynier +/test/modules/misc/editorconfig @loicreynier /modules/misc/fontconfig.nix @rycee /tests/modules/misc/fontconfig @rycee /modules/misc/gtk.nix @rycee -/modules/config/i18n.nix @midchildan -/tests/modules/config/i18n @midchildan - /modules/misc/news.nix @rycee +/modules/misc/nix.nix @polykernel +/tests/modules/misc/nix @polykernel + /modules/misc/nixpkgs-disabled.nix @thiagokokada /modules/misc/numlock.nix @evanjs @@ -47,6 +59,12 @@ /tests/modules/misc/xdg/desktop-full-expected.desktop @cwyc /tests/modules/misc/xdg/desktop-min-expected.desktop @cwyc +/modules/misc/xfconf.nix @chuangzhu + +/modules/programs/aerc.nix @lukasngl +/modules/programs/aerc-accounts.nix @lukasngl +/tests/modules/programs/aerc @lukasngl + /modules/programs/aria2.nix @JustinLovinger /modules/programs/autojump.nix @evanjs @@ -59,6 +77,8 @@ /modules/programs/bash.nix @rycee +/modules/programs/bashmount.nix @AndersonTorres + /modules/programs/bat.nix @marsam /modules/programs/beets.nix @rycee @@ -66,16 +86,23 @@ /modules/programs/bottom.nix @polykernel /tests/modules/programs/bottom @polykernel -/modules/programs/broot.nix @aheaume +/modules/programs/broot.nix @aheaume @dermetfan + +/modules/programs/btop.nix @GaetanLepage +/tests/modules/programs/btop.nix @GaetanLepage /modules/programs/dircolors.nix @JustinLovinger /modules/programs/direnv.nix @rycee +/modules/programs/discocss.nix @Kranzes + /modules/programs/eclipse.nix @rycee /modules/programs/emacs.nix @rycee +/modules/programs/eww.nix @mainrs + /modules/programs/exa.nix @kalhauge /modules/programs/firefox.nix @rycee @@ -83,36 +110,65 @@ /modules/programs/foot.nix @plabadens /tests/modules/programs/foot @plabadens +/modules/services/fusuma.nix @iosmanthus +/tests/modules/services/fusuma @iosmanthus + +/modules/programs/gallery-dl.nix @marsam +/tests/modules/programs/gallery-dl @marsam + /modules/programs/gh.nix @Gerschtli @berbiche /tests/modules/programs/gh @Gerschtli @berbiche /modules/programs/git.nix @rycee +/modules/programs/gitui/gitui.nix @mifom +/modules/programs/gitui/default_key_config.ron @mifom + /modules/programs/gnome-terminal.nix @kamadorueda @rycee /modules/programs/go.nix @rvolosatovs -/modules/programs/hexchat.nix @superherointj @thiagokokada +/modules/programs/havoc.nix @AndersonTorres + +/modules/programs/helix.nix @Philipp-M +/tests/modules/programs/helix @Philipp-M + +/modules/programs/hexchat.nix @thiagokokada /tests/modules/programs/hexchat @thiagokokada -/modules/programs/himalaya.nix @ambroisie -/tests/modules/programs/himalaya @ambroisie +/modules/programs/himalaya.nix @toastal +/tests/modules/programs/himalaya @toastal /modules/programs/home-manager.nix @rycee /modules/programs/htop.nix @bjpbakker /tests/modules/htop @bjpbakker +/modules/programs/hyfetch.nix @lilyinstarlight +/tests/modules/programs/hyfetch @lilyinstarlight + /modules/programs/i3status.nix @JustinLovinger /modules/programs/i3status-rust.nix @workflow +/modules/programs/ion.nix @jo1gi + /modules/programs/java.nix @ShamrockLee +/modules/programs/just.nix @maximsmol + +/modules/programs/k9s.nix @katexochen +/tests/modules/programs/k9s @katexochen + /modules/programs/keychain.nix @marsam +/modules/programs/kodi.nix @dwagenk +/tests/modules/programs/kodi @dwagenk + /modules/programs/lazygit.nix @kalhauge +/modules/programs/ledger.nix @marsam + /modules/programs/less.nix @pamplemousse /tests/modules/programs/less @pamplemousse @@ -121,8 +177,13 @@ /modules/programs/lf.nix @owm111 /tests/modules/programs/lf @owm111 +/modules/programs/librewolf.nix @onny + /modules/programs/lieer.nix @tadfisher +/modules/programs/looking-glass-client.nix @j-brn +/tests/modules/programs/looking-glass-client @j-brn + /modules/programs/lsd.nix @marsam /modules/programs/matplotlib.nix @rprospero @@ -135,11 +196,19 @@ /modules/programs/mcfly.nix @marsam +/modules/programs/micro.nix @MForster +/tests/modules/programs/micro @MForster + /modules/programs/mpv.nix @tadeokondrak @thiagokokada /tests/modules/programs/mpv @thiagokokada /modules/programs/mu.nix @KarlJoad +/modules/programs/mujmap.nix @elizagamedev +/tests/modules/programs/mujmap @elizagamedev + +/modules/programs/navi.nix @marsam + /modules/programs/ncmpcpp.nix @olmokramer /tests/modules/programs/ncmpcpp @olmokramer /tests/modules/programs/ncmpcpp-linux @olmokramer @@ -152,6 +221,9 @@ /modules/programs/newsboat.nix @sumnerevans /tests/modules/programs/newsboat @sumnerevans +/modules/programs/nheko.nix @gvolpe +/tests/modules/programs/nheko @gvolpe + /modules/programs/nix-index.nix @ambroisie /tests/modules/programs/nix-index @ambroisie @@ -167,20 +239,40 @@ /modules/programs/octant.nix @06kellyjac +/modules/programs/oh-my-posh.nix @arjan-s +/tests/modules/programs/oh-my-posh @arjan-s + /modules/programs/opam.nix @marsam /modules/programs/openssh.nix @rycee +/modules/programs/pandoc.nix @kirelagin +/tests/modules/programs/pandoc @kirelagin + /modules/programs/password-store.nix @pacien /modules/programs/pazi.nix @marsam /modules/programs/pidgin.nix @rycee +/modules/programs/pistol.nix @mtoohey31 +/tests/modules/programs/pistol @mtoohey31 + /modules/programs/piston-cli.nix @ethancedwards8 +/modules/programs/pls.nix @arjan-s +/tests/modules/programs/pls @arjan-s + +/modules/programs/polybar.nix @h7x4 +/tests/modules/programs/polybar @h7x4 + /modules/programs/powerline-go.nix @DamienCassou +/modules/programs/pubs.nix @loicreynier +/tests/modules/programs/pubs @loicreynier + +/modules/programs/pylint.nix @florpe + /modules/programs/rbw.nix @ambroisie /tests/modules/programs/rbw @ambroisie @@ -192,6 +284,9 @@ /modules/programs/rtorrent.nix @marsam +/modules/programs/sagemath.nix @kirelagin +/tests/modules/programs/sagemath @kirelagin + /modules/programs/sbt.nix @kubukoz /tests/modules/programs/sbt @kubukoz @@ -200,30 +295,62 @@ /modules/programs/senpai.nix @malte-v +/modules/programs/sioyek.nix @podocarp + /modules/programs/sm64ex.nix @ivarwithoutbones /tests/modules/programs/sm64ex @ivarwithoutbones +/modules/programs/sqls.nix @marsam + /modules/programs/ssh.nix @rycee /modules/programs/starship.nix @marsam +/modules/programs/swaylock.nix @rcerc +/tests/modules/programs/swaylock @rcerc + +/modules/programs/tealdeer.nix @marsam + /modules/programs/terminator.nix @chisui /modules/programs/texlive.nix @rycee +/modules/programs/thunderbird.nix @d-dervishi +/tests/modules/programs/thunderbird @d-dervishi + +/modules/programs/timidity.nix @amesgen + +/modules/programs/tint2.nix @CarlosLoboxyz + +/modules/programs/tiny.nix @kmaasrud + +/modules/programs/tmate.nix @jlesquembre +/tests/modules/programs/tmate @jlesquembre + /modules/programs/topgrade.nix @msfjarvis /tests/modules/programs/topgrade @msfjarvis +/modules/programs/watson.nix @polykernel +/tests/modules/programs/watson @polykernel + /modules/programs/waybar.nix @berbiche /tests/modules/programs/waybar @berbiche +/modules/programs/wezterm.nix @blmhemu +/tests/modules/programs/wezterm @blmhemu + /modules/programs/xmobar.nix @t4ccer /tests/modules/programs/xmobar @t4ccer +/modules/programs/yt-dlp.nix @marsam +/tests/modules/programs/yt-dlp @marsam + /modules/programs/z-lua.nix @marsam /modules/programs/zathura.nix @rprospero +/modules/programs/zellij.nix @mainrs + /modules/programs/zoxide.nix @marsam /modules/programs/zsh/prezto.nix @NickHu @@ -233,10 +360,18 @@ /modules/services/betterlockscreen.nix @SebTM +/modules/programs/borgmatic.nix @DamienCassou +/modules/services/borgmatic.nix @DamienCassou +/tests/modules/programs/borgmatic @DamienCassou +/tests/modules/services/borgmatic @DamienCassou + /modules/services/caffeine.nix @uvNikita /modules/services/cbatticon.nix @pmiddend +/modules/services/clipman.nix @jwygoda +/tests/modules/services/clipman @jwygoda + /modules/services/clipmenu.nix @DamienCassou /modules/services/devilspie2.nix @dawidsowa @@ -253,6 +388,8 @@ /modules/services/etesync-dav.nix @Valodim +/modules/services/espanso.nix @lucasew + /modules/services/flameshot.nix @moredhel /modules/services/fluidsynth.nix @Valodim @@ -260,7 +397,7 @@ /modules/services/fnott.nix @polykernel /tests/modules/services/fnott @polykernel -/modules/services/git-sync.nix @IvanMalison +/modules/services/git-sync.nix @IvanMalison @cab404 /modules/services/gnome-keyring.nix @rycee @@ -268,6 +405,12 @@ /modules/services/grobi.nix @mbrgm +/modules/services/gromit-mpx.nix @pjones +/tests/modules/services/gromit-mpx @pjones + +/modules/services/home-manager-auto-upgrade.nix @pinage404 +/tests/modules/services/home-manager-auto-upgrade @pinage404 + /modules/services/hound.nix @adisbladis /modules/services/imapnotify.nix @nickhu @@ -287,8 +430,15 @@ /modules/services/mbsync.nix @pjones +/modules/services/megasync.nix @GaetanLepage + +/modules/services/mopidy.nix @foo-dogsquared +/tests/modules/services/mopidy @foo-dogsquared + /modules/services/mpdris2.nix @pjones +/modules/services/mpd-discord-rpc.nix @Kranzes + /modules/services/mpris-proxy.nix @ThibautMarty /modules/services/muchsync.nix @pacien @@ -297,6 +447,8 @@ /modules/services/notify-osd.nix @imalison +/modules/services/opensnitch-ui.nix @onny + /modules/services/pantalaimon.nix @jojosch /tests/modules/services/pantalaimon @jojosch @@ -308,6 +460,9 @@ /modules/services/pasystray.nix @pltanton +/modules/services/picom.nix @thiagokokada +/tests/modules/services/picom @thiagokokada + /modules/services/pbgopy.nix @ivarwithoutbones /tests/modules/services/pbgopy @ivarwithoutbones @@ -316,22 +471,38 @@ /modules/services/playerctld.nix @fendse /tests/modules/playerctld @fendse +/modules/services/plex-mpv-shim.nix @starcraft66 + /modules/services/poweralertd.nix @ThibautMarty +/modules/services/pueue.nix @AndersonTorres + /modules/services/pulseeffects.nix @jonringer /modules/services/random-background.nix @rycee +/modules/services/recoll.nix @foo-dogsquared +/tests/modules/recoll @foo-dogsquared + /modules/services/redshift-gammastep @rycee @petabyteboy @thiagokokada /tests/modules/redshift-gammastep @thiagokokada -/modules/services/screen-locker.nix @jrobsonchase -/tests/modules/services/screen-locker @jrobsonchase +/modules/services/safeeyes @Rosuavio + +/modules/services/screen-locker.nix @jrobsonchase @rszamszur +/tests/modules/services/screen-locker @jrobsonchase @rszamszur + +/modules/services/sctd.nix @somasis /modules/services/status-notifier-watcher.nix @pltanton +/modules/services/swayidle.nix @c0deaddict +/tests/modules/services/swayidle @c0deaddict + /modules/services/syncthing.nix @rycee +/modules/services/systembus-notify.nix @asymmetric + /modules/services/taffybar.nix @rycee /modules/services/tahoe-lafs.nix @rycee @@ -341,23 +512,37 @@ /modules/services/trayer.nix @AndreasMager /tests/modules/services/trayer @AndreasMager +/modules/services/twmn.nix @Austreelis +/tests/modules/services/twmn @Austreelis + /modules/services/udiskie.nix @rycee +/tests/modules/services/udiskie @rycee /modules/services/unison.nix @pacien +/modules/services/volnoti.nix @IvanMalison + /modules/services/window-managers/bspwm @ncfavier /tests/modules/services/window-managers/bspwm @ncfavier -/modules/services/window-managers/i3-sway/i3.nix @sumnerevans -/tests/modules/services/window-managers/i3 @sumnerevans +/modules/services/window-managers/fluxbox.nix @AndersonTorres -/modules/services/window-managers/i3-sway/lib @sumnerevans +/modules/services/window-managers/herbstluftwm @olmokramer +/tests/modules/services/window-managers/herbstluftwm @olmokramer -/modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans -/tests/modules/services/window-managers/sway @sumnerevans +/modules/services/window-managers/i3-sway/i3.nix @sumnerevans @sebtm +/tests/modules/services/window-managers/i3 @sumnerevans @sebtm + +/modules/services/window-managers/i3-sway/lib @sumnerevans @sebtm + +/modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans @sebtm +/tests/modules/services/window-managers/sway @sumnerevans @sebtm /modules/services/window-managers/i3-sway/swaynag.nix @polykernel +/modules/services/window-managers/spectrwm @loicreynier +/tests/modules/services/window-managers/spectrwm @loicreynier + /modules/services/wlsunset.nix @matrss /tests/modules/services/wlsunset @matrss @@ -365,7 +550,7 @@ /modules/services/xembed-sni-proxy.nix @rycee -/modules/services/xidlehook.nix @dschrempf +/modules/services/xidlehook.nix @dschrempf @bertof /modules/services/xscreensaver.nix @rycee @@ -373,15 +558,9 @@ /modules/systemd.nix @rycee -/modules/xcursor.nix @league +/modules/targets/darwin @midchildan +/tests/modules/targets-darwin @midchildan /modules/xresources.nix @rycee /modules/xsession.nix @rycee - -/modules/services/volnoti.nix @IvanMalison - -/modules/targets/darwin @midchildan -/tests/modules/targets-darwin @midchildan - -Makefile @thiagokokada diff --git a/third_party/home-manager/.github/ISSUE_TEMPLATE/issue.yaml b/third_party/home-manager/.github/ISSUE_TEMPLATE/issue.yaml index e7a0dc3c03..c474dde0a0 100644 --- a/third_party/home-manager/.github/ISSUE_TEMPLATE/issue.yaml +++ b/third_party/home-manager/.github/ISSUE_TEMPLATE/issue.yaml @@ -8,6 +8,15 @@ labels: [bug, triage] assignees: [rycee, berbiche, sumnerevans] body: +- type: checkboxes + attributes: + label: Are you following the right branch? + description: | + You should follow the branch of Home Manager that corresponds to your + version of Nixpkgs; see [the README](https://github.com/nix-community/home-manager#releases) for details. + options: + - label: My Nixpkgs and Home Manager versions are in sync + required: true - type: checkboxes attributes: label: Is there an existing issue for this? diff --git a/third_party/home-manager/.github/dependabot.yml b/third_party/home-manager/.github/dependabot.yml index db1616ac18..b65c12788b 100644 --- a/third_party/home-manager/.github/dependabot.yml +++ b/third_party/home-manager/.github/dependabot.yml @@ -10,7 +10,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" - target-branch: "release-21.05" + target-branch: "release-22.11" schedule: interval: "weekly" commit-message: diff --git a/third_party/home-manager/.github/labeler.yml b/third_party/home-manager/.github/labeler.yml new file mode 100644 index 0000000000..ba7ecffe0f --- /dev/null +++ b/third_party/home-manager/.github/labeler.yml @@ -0,0 +1,19 @@ +"mail": + - modules/programs/alot*.nix + - tests/modules/programs/alot/* + - modules/programs/mujmap.nix + - tests/modules/programs/mujmap/* + - modules/programs/notmuch.nix + - modules/programs/neomutt* + - tests/modules/programs/neomutt/* + - modules/programs/getmail* + - modules/*/mbsync* + - tests/modules/programs/mbsync/* + - modules/programs/himalaya.nix + - tests/modules/programs/himalaya/* + - modules/programs/thunderbird.nix + - tests/modules/programs/thunderbird/* + +"neovim": + - modules/programs/neovim.nix + - tests/modules/programs/neovim/**/* diff --git a/third_party/home-manager/.github/stale.yml b/third_party/home-manager/.github/stale.yml index 49b9944718..adc74083f6 100644 --- a/third_party/home-manager/.github/stale.yml +++ b/third_party/home-manager/.github/stale.yml @@ -1,14 +1,14 @@ # Configuration for probot-stale - https://github.com/probot/stale daysUntilStale: 90 -daysUntilClose: 7 +daysUntilClose: false staleLabel: "status: stale" -closeComment: false issues: markComment: |

Thank you for your contribution! I marked this issue as stale due to inactivity. - If this remains inactive for another 7 days, I will close this issue. + Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. + We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

@@ -36,11 +36,8 @@ issues:
Memorandum on closing issues

- If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. - Also, don't be afraid to manually close an issue, even if it holds valuable information. -

-

- Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! + Don't be afraid to manually close an issue, even if it holds valuable information. + Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

@@ -49,7 +46,6 @@ pulls:

Thank you for your contribution! I marked this pull request as stale due to inactivity. - If this remains inactive for another 7 days, I will close this PR. Please read the relevant sections below before commenting.

@@ -57,7 +53,7 @@ pulls: If you are the original author of the PR

- * GitHub sometimes doesn't notify people who commented / reviewed a PR previously, when you (force) push commits. *If you have addressed the reviews* you can [officially ask for a review](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/requesting-a-pull-request-review) from those who commented to you or anyone else. + * GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. *If you have addressed the reviews* you can [officially ask for a review](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/requesting-a-pull-request-review) from those who commented to you or anyone else. * If it is unfinished but you plan to finish it, please mark it as a draft. * If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work. * To get things rolling again, rebase the PR against the target branch and address valid comments. @@ -66,7 +62,7 @@ pulls:

- If you are not the original author of the issue + If you are not the original author of the PR

* If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR. diff --git a/third_party/home-manager/.github/workflows/github_pages.yml b/third_party/home-manager/.github/workflows/github_pages.yml index 97e784bda0..b60812aebc 100644 --- a/third_party/home-manager/.github/workflows/github_pages.yml +++ b/third_party/home-manager/.github/workflows/github_pages.yml @@ -10,14 +10,14 @@ jobs: os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: cachix/install-nix-action@v16 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v10 + - uses: cachix/cachix-action@v12 with: name: nix-community - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: | nix-build -A docs.html cp -r result/share/doc/home-manager public diff --git a/third_party/home-manager/.github/workflows/labeler.yml b/third_party/home-manager/.github/workflows/labeler.yml new file mode 100644 index 0000000000..daea610a3a --- /dev/null +++ b/third_party/home-manager/.github/workflows/labeler.yml @@ -0,0 +1,24 @@ +name: "Label PR" + +on: + - pull_request_target + +# WARNING: +# When extending this action, be aware that $GITHUB_TOKEN allows some write +# access to the GitHub API. This means that it should not evaluate user input in +# a way that allows code injection. + +permissions: + contents: read + pull-requests: write + +jobs: + labels: + runs-on: ubuntu-latest + if: github.repository_owner == 'nix-community' + steps: + - uses: actions/labeler@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + sync-labels: true + diff --git a/third_party/home-manager/.github/workflows/test.yml b/third_party/home-manager/.github/workflows/test.yml index 7b1fdbf77c..73ac7a003c 100644 --- a/third_party/home-manager/.github/workflows/test.yml +++ b/third_party/home-manager/.github/workflows/test.yml @@ -11,19 +11,20 @@ jobs: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: cachix/install-nix-action@v16 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v10 + - uses: cachix/cachix-action@v12 with: name: nix-community - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: | if grep -R --exclude stdlib-extended.nix literalExample modules ; then echo "Error: literalExample should be replaced by literalExpression" > /dev/stderr exit 1 fi + - run: nix-build -A docs.jsonModuleMaintainers - run: ./format -c - run: nix-shell . -A install - run: nix-shell --arg enableBig false --pure tests -A run.all diff --git a/third_party/home-manager/.github/workflows/update-flake.yml b/third_party/home-manager/.github/workflows/update-flake.yml new file mode 100644 index 0000000000..b06db161fc --- /dev/null +++ b/third_party/home-manager/.github/workflows/update-flake.yml @@ -0,0 +1,20 @@ +name: Update flake inputs +on: + schedule: + # Update every Sunday and Wednesday + - cron: "51 3 * * 0,3" + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Nix + uses: cachix/install-nix-action@v18 + - name: Update flake.lock + uses: DeterminateSystems/update-flake-lock@v15 + with: + token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} + pr-labels: dependencies diff --git a/third_party/home-manager/.gitignore b/third_party/home-manager/.gitignore index 3526db7189..d6944e3ddc 100644 --- a/third_party/home-manager/.gitignore +++ b/third_party/home-manager/.gitignore @@ -1,2 +1 @@ -/flake.lock /result* diff --git a/third_party/home-manager/.gitlab-ci.yml b/third_party/home-manager/.gitlab-ci.yml index 34085a57e2..a7d63798e5 100644 --- a/third_party/home-manager/.gitlab-ci.yml +++ b/third_party/home-manager/.gitlab-ci.yml @@ -4,25 +4,14 @@ variables: NIX_PATH: "nixpkgs=channel:nixos-unstable" stages: - - test - deploy -Run tests: - stage: test - script: - - nix-shell --pure tests -A run.files-text - rules: - - if: $CI_COMMIT_BRANCH == "master" - when: always - pages: stage: deploy script: - - mkdir -p ~/.config/nixpkgs - - echo '{ manual.html.enable = true; }' > ~/.config/nixpkgs/home.nix - - nix-shell . -A install + - nix-build -A docs.html - mkdir public - - cp -r ~/.nix-profile/share/doc/home-manager/* public/ + - cp -r ./result/share/doc/home-manager/* public/ artifacts: paths: - public diff --git a/third_party/home-manager/.release b/third_party/home-manager/.release index a01c758c18..f8c8609697 100644 --- a/third_party/home-manager/.release +++ b/third_party/home-manager/.release @@ -1 +1 @@ -22.05 +23.05 diff --git a/third_party/home-manager/LICENSE b/third_party/home-manager/LICENSE index 2db3938bbe..97c9352818 100644 --- a/third_party/home-manager/LICENSE +++ b/third_party/home-manager/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2020 Home Manager contributors +Copyright (c) 2017-2022 Home Manager contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/third_party/home-manager/README.md b/third_party/home-manager/README.md index 9cffe4ef35..f792af543e 100644 --- a/third_party/home-manager/README.md +++ b/third_party/home-manager/README.md @@ -6,10 +6,20 @@ using the [Nix][] package manager together with the Nix libraries found in [Nixpkgs][]. It allows declarative configuration of user specific (non global) packages and dotfiles. +Usage +----- + Before attempting to use Home Manager please read the warning below. -For a more systematic overview of Home Manager and its available -options, please see the [Home Manager manual][manual]. +For a systematic overview of Home Manager and its available options, +please see + +- the [Home Manager manual][manual], +- the [Home Manager configuration options][configuration options], and +- the 3rd party [Home Manager option search](https://mipmip.github.io/home-manager-option-search/). + +If you would like to contribute to Home Manager +then please have a look at the [contributing][] chapter of the manual. Words of warning ---------------- @@ -32,14 +42,14 @@ will write to your dconf store and cannot tell whether a configuration that it is about to be overwritten was from a previous Home Manager generation or from manual configuration. -Home Manager targets [NixOS][] unstable and NixOS version 21.11 (the +Home Manager targets [NixOS][] unstable and NixOS version 22.11 (the current stable version), it may or may not work on other Linux distributions and NixOS versions. Also, the `home-manager` tool does not explicitly support rollbacks at the moment so if your home directory gets messed up you'll have to fix -it yourself. See the [rollbacks](#rollbacks) section for instructions -on how to manually perform a rollback. +it yourself. See the [rollbacks][] section for instructions on how to +manually perform a rollback. Now when your expectations have been built up and you are eager to try all this out you can go ahead and read the rest of this text. @@ -47,8 +57,9 @@ all this out you can go ahead and read the rest of this text. Contact ------- -You can chat with us on IRC in the channel [#home-manager][] on -[OFTC][]. +You can chat with us on IRC in the channel [#home-manager][] on [OFTC][]. +There is also a [Matrix room](https://matrix.to/#/#hm:rycee.net), +which is bridged to the IRC channel. Installation ------------ @@ -73,77 +84,21 @@ Home Manager can be used in three primary ways: installation][manual nix-darwin install] in the manual for a description of this setup. -Nix Flakes ----------- +Home Manager provides both the channel-based setup and the flake-based one. +See [Nix Flakes][manual nix flakes] for a description of the flake-based setup. -Home Manager includes a `flake.nix` file for compatibility with [Nix Flakes][] -for those that wish to use it as a module. A bare-minimum `flake.nix` would be -as follows: +Translations +------------ -```nix -{ - description = "NixOS configuration"; +Home Manager has basic support for internationalization through +[gettext](https://www.gnu.org/software/gettext/). The translations are +hosted by [Weblate](https://weblate.org/). If you would like to +contribute to the translation effort then start by going to the +[Home Manager Weblate project](https://hosted.weblate.org/engage/home-manager/). - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - home-manager.url = "github:nix-community/home-manager"; - }; - - outputs = { home-manager, nixpkgs, ... }: { - nixosConfigurations = { - hostname = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.jdoe = import ./home.nix; - - # Optionally, use home-manager.extraSpecialArgs to pass - # arguments to home.nix - } - ]; - }; - }; - }; -} -``` - -If you are not using NixOS you can place the following flake in -`~/.config/nixpkgs/flake.nix` to load your standard Home Manager -configuration: - -```nix -{ - description = "A Home Manager flake"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = inputs: { - homeConfigurations = { - jdoe = inputs.home-manager.lib.homeManagerConfiguration { - system = "x86_64-linux"; - homeDirectory = "/home/jdoe"; - username = "jdoe"; - configuration.imports = [ ./home.nix ]; - }; - }; - }; -} -``` - -Note, the Home Manager library is exported by the flake under -`lib.hm`. - -When using flakes, switch to new configurations as you do for the -whole system (e. g. `nixos-rebuild switch --flake `) instead of -using the `home-manager` command line tool. + +Translation status + Releases -------- @@ -152,7 +107,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which often causes it to contain tweaks for changes/packages not yet released in stable NixOS. To avoid breaking users' configurations, Home Manager is released in branches corresponding to NixOS releases -(e.g. `release-21.11`). These branches get fixes, but usually not new +(e.g. `release-22.11`). These branches get fixes, but usually not new modules. If you need a module to be backported, then feel free to open an issue. @@ -161,17 +116,20 @@ License This project is licensed under the terms of the [MIT license](LICENSE). -[Nix]: https://nixos.org/nix/ +[Nix]: https://nixos.org/explore.html [NixOS]: https://nixos.org/ -[Nixpkgs]: https://nixos.org/nixpkgs/ -[manual]: https://nix-community.github.io/home-manager/ +[Nixpkgs]: https://github.com/NixOS/nixpkgs +[manual]: https://nix-community.github.io/home-manager/index.html +[contributing]: https://nix-community.github.io/home-manager/#ch-contributing [manual usage]: https://nix-community.github.io/home-manager/#ch-usage [configuration options]: https://nix-community.github.io/home-manager/options.html [#home-manager]: https://webchat.oftc.net/?channels=home-manager [OFTC]: https://oftc.net/ -[Nix Pills]: https://nixos.org/nixos/nix-pills/ +[Nix Pills]: https://nixos.org/guides/nix-pills/ [Nix Flakes]: https://nixos.wiki/wiki/Flakes -[nix-darwin]: https://github.com/LnL7/nix-darwin/ +[nix-darwin]: https://github.com/LnL7/nix-darwin [manual standalone install]: https://nix-community.github.io/home-manager/index.html#sec-install-standalone [manual nixos install]: https://nix-community.github.io/home-manager/index.html#sec-install-nixos-module [manual nix-darwin install]: https://nix-community.github.io/home-manager/index.html#sec-install-nix-darwin-module +[manual nix flakes]: https://nix-community.github.io/home-manager/index.html#ch-nix-flakes +[rollbacks]: https://nix-community.github.io/home-manager/index.html#sec-usage-rollbacks diff --git a/third_party/home-manager/default.nix b/third_party/home-manager/default.nix index 4438d827f3..b665b7a66f 100644 --- a/third_party/home-manager/default.nix +++ b/third_party/home-manager/default.nix @@ -5,6 +5,7 @@ rec { html = manual.html; manPages = manPages; json = options.json; + jsonModuleMaintainers = jsonModuleMaintainers; # Unstable, mainly for CI. }; home-manager = pkgs.callPackage ./home-manager { path = toString ./.; }; diff --git a/third_party/home-manager/docs/contributing.adoc b/third_party/home-manager/docs/contributing.adoc index cffa621392..82a07a9a8b 100644 --- a/third_party/home-manager/docs/contributing.adoc +++ b/third_party/home-manager/docs/contributing.adoc @@ -105,7 +105,7 @@ When you have made changes to a module, it is a good idea to check that the man [source,console] $ nix-build -A docs.manPages -$ man ./result/share/man/man5/home-configuration.nix.5 +$ man ./result/share/man/man5/home-configuration.nix.5.gz ==== Add yourself as a module maintainer @@ -155,7 +155,7 @@ A potential gotcha with respect to licensing are option descriptions. Often it i The commits in your pull request should be reasonably self-contained, that is, each commit should make sense in isolation. In particular, you will be asked to amend any commit that introduces syntax errors or similar problems even if they are fixed in a later commit. -The commit messages should follow the {seven-rules}[seven rules]. We also ask you to include the affected code component or module in the first line. That is, a commit message should follow the template +The commit messages should follow the {seven-rules}[seven rules], except for "Capitalize the subject line". We also ask you to include the affected code component or module in the first line. That is, a commit message should follow the template ---- {component}: {description} @@ -256,3 +256,8 @@ and run an individual test, for example `alacritty-empty-settings`, through [source,console] $ nix-shell --pure tests -A run.alacritty-empty-settings + +However, those invocations will impurely source the system’s nixpkgs, and may cause failures. To run against the nixpkgs from the flake.lock, use instead e.g. + +[source,console] +$ nix develop --ignore-environment .#tests.all diff --git a/third_party/home-manager/docs/default.nix b/third_party/home-manager/docs/default.nix index fd038d1a80..83ac2a320d 100644 --- a/third_party/home-manager/docs/default.nix +++ b/third_party/home-manager/docs/default.nix @@ -5,12 +5,10 @@ let - nmdSrc = pkgs.fetchFromGitLab { - name = "nmd"; - owner = "rycee"; - repo = "nmd"; - rev = "527245ff605bde88c2dd2ddae21c6479bb7cf8aa"; - sha256 = "1zi0f9y3wq4bpslx1py3sfgrgd9av41ahpandvs6rvkpisfsqqlp"; + nmdSrc = fetchTarball { + url = + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=06c80103396a1a950586c23da1882c977b24bbda"; + sha256 = "15axmplkl7m7fs4c8m53dawhgwkb64hm2v67m59xdknbjjgfrpqb"; }; nmd = import nmdSrc { inherit lib pkgs; }; @@ -26,6 +24,8 @@ let }]; }; + dontCheckDefinitions = { _module.check = false; }; + buildModulesDocs = args: nmd.buildModulesDocs ({ moduleRootPaths = [ ./.. ]; @@ -43,21 +43,7 @@ let }; nixosModuleDocs = buildModulesDocs { - modules = let - nixosModule = module: pkgs.path + "/nixos/modules" + module; - mockedNixos = with lib; { - options = { - environment.pathsToLink = mkSinkUndeclaredOptions { }; - systemd.services = mkSinkUndeclaredOptions { }; - users.users = mkSinkUndeclaredOptions { }; - }; - }; - in [ - ../nixos/default.nix - mockedNixos - (nixosModule "/misc/assertions.nix") - scrubbedPkgsModule - ]; + modules = [ ../nixos scrubbedPkgsModule dontCheckDefinitions ]; docBook = { id = "nixos-options"; optionIdPrefix = "nixos-opt"; @@ -65,22 +51,7 @@ let }; nixDarwinModuleDocs = buildModulesDocs { - modules = let - nixosModule = module: pkgs.path + "/nixos/modules" + module; - mockedNixDarwin = with lib; { - options = { - environment.pathsToLink = mkSinkUndeclaredOptions { }; - system.activationScripts.postActivation.text = - mkSinkUndeclaredOptions { }; - users.users = mkSinkUndeclaredOptions { }; - }; - }; - in [ - ../nix-darwin/default.nix - mockedNixDarwin - (nixosModule "/misc/assertions.nix") - scrubbedPkgsModule - ]; + modules = [ ../nix-darwin scrubbedPkgsModule dontCheckDefinitions ]; docBook = { id = "nix-darwin-options"; optionIdPrefix = "nix-darwin-opt"; @@ -89,6 +60,7 @@ let docs = nmd.buildDocBookDocs { pathName = "home-manager"; + projectName = "Home Manager"; modulesDocs = [ hmModulesDocs nixDarwinModuleDocs nixosModuleDocs ]; documentsDirectory = ./.; documentType = "book"; @@ -117,4 +89,14 @@ in { manPages = docs.manPages; manual = { inherit (docs) 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 ]; + }; + in builtins.toJSON result.config.meta.maintainers); } diff --git a/third_party/home-manager/docs/faq.adoc b/third_party/home-manager/docs/faq.adoc index c5615fdbfc..6488688059 100644 --- a/third_party/home-manager/docs/faq.adoc +++ b/third_party/home-manager/docs/faq.adoc @@ -45,7 +45,9 @@ You could also opt to unistall _all_ of the packages from your profile with `nix === Why are the session variables not set? :foreign-env: https://github.com/oh-my-fish/plugin-foreign-env -Home Manager is only able to set session variables automatically if it manages your Bash, Z shell, or fish shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding +Home Manager is only able to set session variables automatically if it manages your Bash, Z shell, or fish shell configuration. To enable such management you use <>, <>, or <>. + +If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding [source,bash] ---- @@ -89,14 +91,22 @@ while the `common.nix` file contains configuration shared across the two logins. You can get some inspiration from the {post-your-homenix}[Post your home-manager home.nix file!] Reddit thread. -=== Why do I get an error message about `ca.desrt.dconf`? +=== Why do I get an error message about `ca.desrt.dconf` or `dconf.service`? -You are most likely trying to configure the GTK or Gnome Terminal but the DBus session is not aware of the dconf service. The full error you might get is +You are most likely trying to configure something that uses dconf +but the DBus session is not aware of the dconf service. +The full error you might get is ---- error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files ---- +or + +---- +error: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit dconf.service not found. +---- + The solution on NixOS is to add [source,nix] @@ -133,8 +143,8 @@ You can add the `nixpkgs-unstable` channel by running [source,console] ---- -# nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable -# nix-channel --update +$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable +$ nix-channel --update ---- Note, the package will not be affected by any package overrides, overlays, etc. diff --git a/third_party/home-manager/docs/installation.adoc b/third_party/home-manager/docs/installation.adoc index 19df6fcab3..afdbe35e9a 100644 --- a/third_party/home-manager/docs/installation.adoc +++ b/third_party/home-manager/docs/installation.adoc @@ -41,9 +41,6 @@ root user. For a multi-user install of Nix this means that your user must be covered by the {nix-allowed-users}[`allowed-users`] Nix option. On NixOS you can control this option using the {nixos-allowed-users}[`nix.allowedUsers`] system option. -+ -Note that Nix 2.4 is not yet fully supported. Most significantly, Home -Manager is incompatible with the new `nix profile`. 2. Add the appropriate Home Manager channel. If you are following Nixpkgs master or an unstable channel you can run @@ -54,22 +51,13 @@ $ nix-channel --add https://github.com/nix-community/home-manager/archive/master $ nix-channel --update ---- + -and if you follow a Nixpkgs version 21.11 channel you can run +and if you follow a Nixpkgs version 22.11 channel you can run + [source,console] ---- -$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager +$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager $ nix-channel --update ---- -+ -On NixOS you may need to log out and back in for the channel to become -available. On non-NixOS you may have to add -+ -[source,bash] -export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH -+ -to your shell (see -https://github.com/NixOS/nix/issues/2033[nix#2033]). 3. Run the Home Manager installation command and create the first Home Manager generation: @@ -126,21 +114,21 @@ deployed through NixOps. To make the NixOS module available for use you must `import` it into your system configuration. This is most conveniently done by adding a -Home Manager channel. For example, if you are following Nixpkgs master -or an unstable channel, you can run +Home Manager channel to the root user. For example, if you are +following Nixpkgs master or an unstable channel, you can run [source,console] ---- -# nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager -# nix-channel --update +$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager +$ sudo nix-channel --update ---- -and if you follow a Nixpkgs version 21.11 channel, you can run +and if you follow a Nixpkgs version 22.11 channel, you can run [source,console] ---- -# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager -# nix-channel --update +$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager +$ sudo nix-channel --update ---- It is then possible to add @@ -163,9 +151,18 @@ home-manager.users.eve = { pkgs, ... }: { }; ---- -and after a `nixos-rebuild switch` the user eve's environment should +and after a `sudo nixos-rebuild switch` the user eve's environment should include a basic Bash configuration and the packages atool and httpie. +[NOTE] +==== +If `nixos-rebuild switch` does not result in the environment you expect, +you can take a look at the output of the Home Manager activation script output using + +[source,console] +$ systemctl status "home-manager-$USER.service" +==== + If you do not plan on having Home Manager manage your shell configuration then you must add either @@ -233,16 +230,16 @@ or an unstable channel, you can run [source,console] ---- -# nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager -# nix-channel --update +$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager +$ nix-channel --update ---- -and if you follow a Nixpkgs version 21.11 channel, you can run +and if you follow a Nixpkgs version 22.11 channel, you can run [source,console] ---- -# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager -# nix-channel --update +$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager +$ nix-channel --update ---- It is then possible to add @@ -296,7 +293,7 @@ can be sourced directly by POSIX.2-like shells such as {bash}[Bash] or [NOTE] ==== By default user packages will not be ignored in favor of -`environment.systemPackages`, but they will be intalled to +`environment.systemPackages`, but they will be installed to `/etc/profiles/per-user/$USERNAME` if [source,nix] diff --git a/third_party/home-manager/docs/man-home-manager.xml b/third_party/home-manager/docs/man-home-manager.xml index 9f53745035..513973e98c 100644 --- a/third_party/home-manager/docs/man-home-manager.xml +++ b/third_party/home-manager/docs/man-home-manager.xml @@ -102,6 +102,10 @@ + + --version + + @@ -151,6 +155,18 @@ --keep-going + + + + -L + + + + --print-build-logs + + + + --show-trace @@ -414,7 +430,7 @@ Indicates the path to the Home Manager configuration file. If not given, - ~/.config/nixpkgs/home.nix is used. + $XDG_CONFIG_HOME/nixpkgs/home.nix is used. @@ -431,6 +447,16 @@ + + + + + + + Prints the version number of the home-manager tool. + + + @@ -532,6 +558,22 @@ + + + + + + + + + + Passed on to + nix build + + when building from a flake. + + + @@ -589,7 +631,7 @@ - ~/.local/share/home-manager/news-read-ids + $XDG_DATA_HOME/home-manager/news-read-ids diff --git a/third_party/home-manager/docs/man-pages.xml b/third_party/home-manager/docs/man-pages.xml index bb484ae019..a68b0e60d7 100644 --- a/third_party/home-manager/docs/man-pages.xml +++ b/third_party/home-manager/docs/man-pages.xml @@ -4,7 +4,7 @@ Home Manager Reference Pages Home Manager contributors - 2017–2020Home Manager contributors + 2017–2022Home Manager contributors diff --git a/third_party/home-manager/docs/manual.xml b/third_party/home-manager/docs/manual.xml index 693f0a92f7..b159940c87 100644 --- a/third_party/home-manager/docs/manual.xml +++ b/third_party/home-manager/docs/manual.xml @@ -16,13 +16,15 @@ If you encounter problems then please reach out on the IRC channel #home-manager hosted by OFTC. + There is also a Matrix room, + which is bridged to the IRC channel. If your problem is caused by a bug in Home Manager then it should be reported on the Home Manager issue tracker. - Commands prefixed with # have to be run as root, either + Commands prefixed with $ sudo have to be run as root, either requiring to login as root user or temporarily switching to it using sudo for example. @@ -30,6 +32,7 @@ + diff --git a/third_party/home-manager/docs/nix-flakes.adoc b/third_party/home-manager/docs/nix-flakes.adoc new file mode 100644 index 0000000000..d426e337f1 --- /dev/null +++ b/third_party/home-manager/docs/nix-flakes.adoc @@ -0,0 +1,241 @@ +[[ch-nix-flakes]] +== Nix Flakes + +:nixos-wiki-flakes: https://nixos.wiki/wiki/Flakes + +Home Manager includes a `flake.nix` file for compatibility with {nixos-wiki-flakes}[Nix Flakes]. +The support is still experimental and may change in backwards incompatible ways. + +[[sec-flakes-prerequisties]] +=== Prerequisites + +* Install Nix 2.4 or later, or have it in `nix-shell`. + +* Enable experimental features `nix-command` and `flakes`. ++ +** When using NixOS, add the following to your `configuration.nix` and rebuild your system. ++ +[source,nix] +nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes + ''; +}; ++ +** If you are not using NixOS, add the following to `nix.conf` (located at `~/.config/nix/` or `/etc/nix/nix.conf`). ++ +[source,bash] +experimental-features = nix-command flakes ++ +You may need to restart the Nix daemon with, for example, `sudo systemctl restart nix-daemon.service`. ++ +** Alternatively, you can enable flakes on a per-command basis with the following additional flags to `nix` and `home-manager`: ++ +[source,console] +---- +$ nix --extra-experimental-features "nix-command flakes" +$ home-manager --extra-experimental-features "nix-command flakes" +---- + +* Prepare your Home Manager configuration (`home.nix`). ++ +Unlike the channel-based setup, +`home.nix` will be evaluated when the flake is built, +so it must be present before bootstrap of Home Manager from the flake. +See <> for introduction about +writing a Home Manager configuration. + +[[sec-flakes-standalone]] +=== Standalone setup + +1. Set up a flake with a `flake.nix` as follows: ++ +[source,nix] +---- +{ + description = "Home Manager configuration of Jane Doe"; + + inputs = { + # Specify the source of Home Manager and Nixpkgs. + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, home-manager, ... }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + homeConfigurations.jdoe = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ + ./home.nix + ]; + + # Optionally use extraSpecialArgs + # to pass through arguments to home.nix + }; + }; +} +---- ++ +[NOTE] +==== +* The above example tracks the master branch of Home Manager +and nixos-unstable branch of Nixpkgs. +If you would like to use the `release-22.11` branch, +change the `home-manager` input url to `github:nix-community/home-manager/release-22.11` +and `nixpkgs` url to `github:NixOS/nixpkgs/nixos-22.11`. + +* The Home Manager library is exported by the flake under +`lib.hm`. + +* You can use the above `flake.nix` as a template in `~/.config/nixpkgs` by +[source,console] +$ nix flake new ~/.config/nixpkgs -t github:nix-community/home-manager +==== + +2. Install Home Manager and apply the configuration by ++ +[source,console] +---- +$ nix build --no-link #homeConfigurations.jdoe.activationPackage +$ "$(nix path-info #homeConfigurations.jdoe.activationPackage)"/activate +---- ++ +Substitute `` with the flake URI of the configuration flake. +If `flake.nix` resides in `~/.config/nixpkgs`, +`` may be `~/.config/nixpkgs` +as a Git tree or `path:~/.config/nixpkgs` if not. + +3. Since the release `21.05`, +building a flake-based configuration is as simple as ++ +[source,console] +$ home-manager switch --flake '#jdoe' ++ +once home-manager is installed. ++ +Here, `jdoe` is a configuration specified in the flake file, +and `#jdoe` will be expanded to +`#homeConfigurations.jdoe.activationPackage` +and be built by Nix. + +[NOTE] +==== +The flake inputs are not upgraded automatically when switching. +The analogy to the command `home-manager --update ...` is `nix flake update`. + +If updating more than one input is undesirable, +the command `nix flake lock --update-input ` can be used. + +You can also pass flake-related options +such as `--recreate-lock-file` or `--update-input [input]` +to `home-manager` when building/switching, +and these options will be forwarded to `nix build`. +See the {nixos-wiki-flakes}[NixOS Wiki page] for detail. +==== + +[[sec-flakes-nixos-module]] +=== NixOS module + +To use Home Manager as a NixOS module, +a bare-minimum `flake.nix` would be as follows: + +[source,nix] +---- +{ + description = "NixOS configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ nixpkgs, home-manager, ... }: { + nixosConfigurations = { + hostname = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jdoe = import ./home.nix; + + # Optionally, use home-manager.extraSpecialArgs to pass + # arguments to home.nix + } + ]; + }; + }; + }; +} +---- + +The Home Manager configuration is then part of the NixOS configuration +and is automatically rebuilt with the system when using the appropriate command +for the system, such as `nixos-rebuild switch --flake `. + +You can use the above `flake.nix` as a template in `/etc/nixos` by + +[source,console] +$ nix flake new /etc/nixos -t github:nix-community/home-manager#nixos + +[[sec-flakes-nix-darwin-module]] +=== nix-darwin module + +The flake-based setup of the Home Manager nix-darwin module +is similar to that of NixOS. The `flake.nix` would be: + +[source,nix] +---- +{ + description = "Darwin configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + darwin.url = "github:lnl7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ nixpkgs, home-manager, darwin, ... }: { + darwinConfigurations = { + hostname = darwin.lib.darwinSystem { + system = "x86_64-darwin"; + modules = [ + ./configuration.nix + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jdoe = import ./home.nix; + + # Optionally, use home-manager.extraSpecialArgs to pass + # arguments to home.nix + } + ]; + }; + }; + }; +} +---- + +and it is also rebuilt with the nix-darwin generations. +The rebuild command here may be `darwin-rebuild switch --flake `. + +You can use the above `flake.nix` as a template in `~/.config/darwin` by + +[source,console] +$ nix flake new ~/.config/darwin -t github:nix-community/home-manager#nix-darwin diff --git a/third_party/home-manager/docs/release-notes/release-notes.adoc b/third_party/home-manager/docs/release-notes/release-notes.adoc index 56bfa20b62..d7058ca0cc 100644 --- a/third_party/home-manager/docs/release-notes/release-notes.adoc +++ b/third_party/home-manager/docs/release-notes/release-notes.adoc @@ -6,6 +6,10 @@ This section lists the release notes for stable versions of Home Manager and the :leveloffset: 1 +include::rl-2305.adoc[] + +include::rl-2211.adoc[] + include::rl-2205.adoc[] include::rl-2111.adoc[] diff --git a/third_party/home-manager/docs/release-notes/rl-2105.adoc b/third_party/home-manager/docs/release-notes/rl-2105.adoc index 7fcfb268d3..ed94f8880b 100644 --- a/third_party/home-manager/docs/release-notes/rl-2105.adoc +++ b/third_party/home-manager/docs/release-notes/rl-2105.adoc @@ -8,7 +8,7 @@ The 21.05 release branch became the stable branch in May, 2021. This release has the following notable changes: -* The <> option is now a list rather than an +* The `opt-programs.broot.verbs` option is now a list rather than an attribute set. To migrate, move the keys of the attrset into the list items' `invocation` keys. For example, + diff --git a/third_party/home-manager/docs/release-notes/rl-2205.adoc b/third_party/home-manager/docs/release-notes/rl-2205.adoc index 0684bab61d..f600640e4f 100644 --- a/third_party/home-manager/docs/release-notes/rl-2205.adoc +++ b/third_party/home-manager/docs/release-notes/rl-2205.adoc @@ -1,16 +1,29 @@ [[sec-release-22.05]] == Release 22.05 -This is the current unstable branch and the information in this section is therefore not final. +The 22.05 release branch became the stable branch in May, 2022. [[sec-release-22.05-highlights]] === Highlights +:hm-weblate: https://hosted.weblate.org/projects/home-manager/ + This release has the following notable changes: * The `programs.waybar.settings.modules` option was removed. Waybar modules should now be declared directly under `programs.waybar.settings`. +* Home Manager now partially support translation of texts into different languages. +Note, the support is quite limited at the moment. +Specifically, it only applies to parts of the system written in the Bash language, +such as the `home-manager` command line tool and the activation script. ++ +If you would like to contribute to the translation effort +then you can do so through the {hm-weblate}[Home Manager Weblate project]. + +* A new module, `launchd.agents` was added. +Use this to enable services based on macOS LaunchAgents. + [[sec-release-22.05-state-version-changes]] === State Version Changes diff --git a/third_party/home-manager/docs/release-notes/rl-2211.adoc b/third_party/home-manager/docs/release-notes/rl-2211.adoc new file mode 100644 index 0000000000..046995d527 --- /dev/null +++ b/third_party/home-manager/docs/release-notes/rl-2211.adoc @@ -0,0 +1,113 @@ +[[sec-release-22.11]] +== Release 22.11 + +This is the current unstable branch and the information in this section is therefore not final. + +[[sec-release-22.11-highlights]] +=== Highlights + +This release has the following notable changes: + +* The <> option no longer has a default value. +It used to default to ``18.09'', which was the Home Manager version +that introduced the option. If your configuration does not explicitly +set this option then you need to add ++ +[source,nix] +home.stateVersion = "18.09"; ++ +to your configuration. + +* The Flake function `homeManagerConfiguration` has been simplified. +Specifically, the arguments ++ +-- + - `configuration`, + - `username`, + - `homeDirectory`, + - `stateVersion`, + - `extraModules`, and + - `system` +-- ++ +have been removed. Instead use the new `modules` argument, which +accepts a list of NixOS modules. ++ +Further, the `pkgs` argument is now mandatory and should be set to +`nixpkgs.legacyPackages.${system}` where `nixpkgs` is the Nixpkgs +input of your choice. ++ +For example, if your Flake currently contains ++ +[source,nix] +---- +homeManagerConfiguration { + configuration = import ./home.nix; + system = "x86_64-linux"; + username = "jdoe"; + homeDirectory = "/home/jdoe"; + stateVersion = "22.05"; + extraModules = [ ./some-extra-module.nix ]; +} +---- ++ +then you can change it to ++ +[source,nix] +---- +homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.${system}; + modules = [ + ./home.nix + ./some-extra-module.nix + { + home = { + username = "jdoe"; + homeDirectory = "/home/jdoe"; + stateVersion = "22.05"; + }; + } + ]; +} +---- ++ +Of course, you can move the assignment of <>, +<>, and <> to some +other file or simply place them in your `home.nix`. + +* The `services.picom` module has been refactored to use structural +settings. ++ +As a result `services.picom.extraOptions` has been removed in favor of +<>. Also, `services.picom.blur*` were +removed since upstream changed the blur settings to be more flexible. +You can migrate the blur settings to use +<> instead. + +* The `services.compton` module has been removed. It was deprecated in +release 20.03. Use `services.picom` instead. + +[[sec-release-22.11-state-version-changes]] +=== State Version Changes + +The state version in this release includes the changes below. +These changes are only active if the `home.stateVersion` option is set to "22.11" or later. + +* The <> option now defaults to the +value of <> if <> is +enabled. Otherwise it is undefined and must be specified in the user +configuration. + +* The activation script now resets `PATH` before running. Before, the +user's `PATH` environment variable would be used in the script and +this made it possible for commands in the activation script to run +arbitrary commands accessible to the user. We now restrict the +activation script to commands that are explicitly specified. ++ +There is no official way to restore the old behavior. We attempt to +make the activation script as reproducible as possible and honoring +the user's `PATH` reduces reproducibility. ++ +If you need to run a command in an activation script block then refer +to the command by its absolute command path, such as +`${pkgs.hello}/bin/hello`. diff --git a/third_party/home-manager/docs/release-notes/rl-2305.adoc b/third_party/home-manager/docs/release-notes/rl-2305.adoc new file mode 100644 index 0000000000..6d16e784a3 --- /dev/null +++ b/third_party/home-manager/docs/release-notes/rl-2305.adoc @@ -0,0 +1,23 @@ +[[sec-release-23.05]] +== Release 23.05 + +This is the current unstable branch and the information in this section is therefore not final. + +[[sec-release-23.05-highlights]] +=== Highlights + +This release has the following notable changes: + +* No highlights. + +[[sec-release-23.05-state-version-changes]] +=== State Version Changes + +The state version in this release includes the changes below. +These changes are only active if the `home.stateVersion` option is set to "23.05" or later. + +* The <>, +<>, +<>, +<>, options now default to `true` which +is consistent with the default values for those options used by `i3` and `sway`. diff --git a/third_party/home-manager/docs/usage.adoc b/third_party/home-manager/docs/usage.adoc index 285835b296..adac7b7291 100644 --- a/third_party/home-manager/docs/usage.adoc +++ b/third_party/home-manager/docs/usage.adoc @@ -29,6 +29,7 @@ man home-configuration.nix Once a configuration is successfully built, it can be activated. The activation performs the steps necessary to make the files, programs, and services available in your user environment. The `home-manager switch` command performs a combined build and activation. +[[sec-usage-configuration]] === Configuration Example A fresh install of Home Manager will generate a minimal `~/.config/nixpkgs/home.nix` file containing something like @@ -51,7 +52,7 @@ A fresh install of Home Manager will generate a minimal `~/.config/nixpkgs/home. # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -91,7 +92,7 @@ To satisfy the above setup we should elaborate the `home.nix` file as follows: # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -128,6 +129,7 @@ home-manager build which will create a `result` link to a directory containing an activation script and the generated home directory files. +[[sec-usage-rollbacks]] === Rollbacks While the `home-manager` tool does not explicitly support rollbacks at the moment it is relatively easy to perform one manually. The steps to do so are @@ -162,6 +164,7 @@ Starting home manager activation … ---- +[[sec-usage-dotfiles]] === Keeping your ~ safe from harm To configure programs and services Home Manager must write various things to your home directory. To prevent overwriting any existing files when switching to a new generation, Home Manager will attempt to detect collisions between existing files and generated files. If any such collision is detected the activation will terminate before changing anything on your computer. @@ -194,6 +197,7 @@ Existing file '/home/jdoe/.config/git/config' is in the way Please move the above files and try again ---- +[[sec-usage-graphical]] === Graphical services Home Manager includes a number of services intended to run in a graphical session, for example `xscreensaver` and `dunst`. Unfortunately, such services will not be started automatically unless you let Home Manager start your X session. That is, you have something like @@ -224,3 +228,18 @@ in your system configuration and ---- in your Home Manager configuration. + +[[sec-updating]] +=== Updating + +If you have installed Home Manager using the Nix channel method +then updating Home Manager is done by first updating the channel. +You can then switch to the updated Home Manager environment. + +[source,console] +---- +$ nix-channel --update +… +unpacking channels... +$ home-manager switch +---- diff --git a/third_party/home-manager/docs/writing-modules.adoc b/third_party/home-manager/docs/writing-modules.adoc index 0f3336ff2c..d8d69e828c 100644 --- a/third_party/home-manager/docs/writing-modules.adoc +++ b/third_party/home-manager/docs/writing-modules.adoc @@ -167,9 +167,11 @@ Builds a GVariant array containing the given list of elements, where each elemen - `hm.gvariant.type.int64` - `hm.gvariant.type.uint64` - `hm.gvariant.type.double` +- `hm.gvariant.type.variant` - `hm.gvariant.type.arrayOf type` - `hm.gvariant.type.maybeOf type` - `hm.gvariant.type.tupleOf types` +- `hm.gvariant.type.dictionaryEntryOf types` -- + where `type` and `types` are themselves a type and list of types, respectively. @@ -185,3 +187,9 @@ Builds a GVariant maybe value containing the given GVariant element. + `hm.gvariant.mkTuple elements`::: Builds a GVariant tuple containing the given list of elements, where each element is a GVariant value. ++ +`hm.gvariant.mkVariant element`::: +Builds a GVariant variant which contains the value of a GVariant element. ++ +`hm.gvariant.mkDictionaryEntry elements`::: +Builds a GVariant dictionary entry containing the given list of elements, where each element is a GVariant value. diff --git a/third_party/home-manager/flake.lock b/third_party/home-manager/flake.lock new file mode 100644 index 0000000000..a334b24bbf --- /dev/null +++ b/third_party/home-manager/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1671983799, + "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/third_party/home-manager/flake.nix b/third_party/home-manager/flake.nix index 9382351e6d..512111702d 100644 --- a/third_party/home-manager/flake.nix +++ b/third_party/home-manager/flake.nix @@ -1,60 +1,104 @@ { description = "Home Manager for Nix"; - outputs = { self, nixpkgs }: - let - # List of systems supported by home-manager binary - supportedSystems = nixpkgs.lib.platforms.unix; + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs.utils.url = "github:numtide/flake-utils"; - # Function to generate a set based on supported systems - forAllSystems = f: - nixpkgs.lib.genAttrs supportedSystems (system: f system); + outputs = { self, nixpkgs, utils, ... }: + { + nixosModules = rec { + home-manager = import ./nixos; + default = home-manager; + }; + # deprecated in Nix 2.8 + nixosModule = self.nixosModules.default; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); - in rec { - nixosModules.home-manager = import ./nixos; - nixosModule = self.nixosModules.home-manager; + darwinModules = rec { + home-manager = import ./nix-darwin; + default = home-manager; + }; + # unofficial; deprecated in Nix 2.8 + darwinModule = self.darwinModules.default; - darwinModules.home-manager = import ./nix-darwin; - darwinModule = self.darwinModules.home-manager; + templates = { + standalone = { + path = ./templates/standalone; + description = "Standalone setup"; + }; + nixos = { + path = ./templates/nixos; + description = "Home Manager as a NixOS module,"; + }; + nix-darwin = { + path = ./templates/nix-darwin; + description = "Home Manager as a nix-darwin module,"; + }; + }; - packages = forAllSystems (system: - let docs = import ./docs { pkgs = nixpkgsFor.${system}; }; - in { - home-manager = nixpkgsFor.${system}.callPackage ./home-manager { }; + defaultTemplate = self.templates.standalone; + + lib = { + hm = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).hm; + homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib + , extraSpecialArgs ? { }, check ? true + # Deprecated: + , configuration ? null, extraModules ? null, stateVersion ? null + , username ? null, homeDirectory ? null, system ? null }@args: + let + msgForRemovedArg = '' + The 'homeManagerConfiguration' arguments + + - 'configuration', + - 'username', + - 'homeDirectory' + - 'stateVersion', + - 'extraModules', and + - 'system' + + have been removed. Instead use the arguments 'pkgs' and + 'modules'. See the 22.11 release notes for more. + ''; + + throwForRemovedArgs = v: + let + used = builtins.filter (n: (args.${n} or null) != null) [ + "configuration" + "username" + "homeDirectory" + "stateVersion" + "extraModules" + "system" + ]; + msg = msgForRemovedArg + '' + + + Deprecated args passed: '' + + builtins.concatStringsSep " " used; + in lib.throwIf (used != [ ]) msg v; + + in throwForRemovedArgs (import ./modules { + inherit pkgs lib check extraSpecialArgs; + configuration = { ... }: { + imports = modules; + nixpkgs = { inherit (pkgs) config overlays; }; + }; + }); + }; + } // utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + docs = import ./docs { inherit pkgs; }; + tests = import ./tests { inherit pkgs; }; + in { + devShells.tests = tests.run; + packages = rec { + home-manager = pkgs.callPackage ./home-manager { }; docs-html = docs.manual.html; docs-manpages = docs.manPages; docs-json = docs.options.json; - }); - - defaultPackage = - forAllSystems (system: self.packages.${system}.home-manager); - - apps = forAllSystems (system: { - home-manager = { - type = "app"; - program = "${defaultPackage.${system}}/bin/home-manager"; + default = home-manager; }; + # deprecated in Nix 2.7 + defaultPackage = self.packages.${system}.default; }); - - defaultApp = forAllSystems (system: apps.${system}.home-manager); - - lib = { - hm = import ./modules/lib { lib = nixpkgs.lib; }; - homeManagerConfiguration = { configuration, system, homeDirectory - , username, extraModules ? [ ], extraSpecialArgs ? { } - , pkgs ? builtins.getAttr system nixpkgs.outputs.legacyPackages - , check ? true, stateVersion ? "20.09" }@args: - assert nixpkgs.lib.versionAtLeast stateVersion "20.09"; - - import ./modules { - inherit pkgs check extraSpecialArgs; - configuration = { ... }: { - imports = [ configuration ] ++ extraModules; - home = { inherit homeDirectory stateVersion username; }; - nixpkgs = { inherit (pkgs) config overlays; }; - }; - }; - }; - }; } diff --git a/third_party/home-manager/format b/third_party/home-manager/format index 0fa620c1ac..68751a3f78 100755 --- a/third_party/home-manager/format +++ b/third_party/home-manager/format @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/5edf5b60c3d8f82b5fc5e73e822b6f7460584945.tar.gz -i bash -p findutils nixfmt +#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/6616de389ed55fba6eeba60377fc04732d5a207c.tar.gz -i bash -p findutils nixfmt CHECK_ARG= @@ -15,22 +15,14 @@ esac # The excludes are for files touched by open pull requests and we want # to avoid merge conflicts. find . -name '*.nix' \ - ! -path ./home-manager/home-manager.nix \ ! -path ./modules/default.nix \ ! -path ./modules/files.nix \ ! -path ./modules/home-environment.nix \ ! -path ./modules/lib/default.nix \ ! -path ./modules/lib/file-type.nix \ - ! -path ./modules/manual.nix \ ! -path ./modules/misc/news.nix \ ! -path ./modules/programs/bash.nix \ - ! -path ./modules/programs/gpg.nix \ ! -path ./modules/programs/ssh.nix \ ! -path ./modules/programs/zsh.nix \ - ! -path ./modules/services/gpg-agent.nix \ - ! -path ./modules/services/mpd.nix \ - ! -path ./nix-darwin/default.nix \ ! -path ./tests/default.nix \ - ! -path ./tests/modules/home-environment/session-variables.nix \ - ! -path ./tests/modules/programs/gpg/override-defaults.nix \ -exec nixfmt $CHECK_ARG {} + diff --git a/third_party/home-manager/home-manager/completion.bash b/third_party/home-manager/home-manager/completion.bash index cf471d1293..c551229917 100644 --- a/third_party/home-manager/home-manager/completion.bash +++ b/third_party/home-manager/home-manager/completion.bash @@ -293,7 +293,10 @@ _home-manager_completions () Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" \ "--verbose" "--cores" "--debug" "--impure" "--keep-failed" \ "--keep-going" "-j" "--max-jobs" "--no-substitute" "--no-out-link" \ - "--show-trace" "--substitute" "--builders") + "-L" "--print-build-logs" \ + "--show-trace" "--substitute" "--builders" "--version" \ + "--update-input" "--override-input" "--experimental-features" \ + "--extra-experimental-features" ) # ^ « home-manager »'s options. diff --git a/third_party/home-manager/home-manager/completion.fish b/third_party/home-manager/home-manager/completion.fish index ad38d276c6..58ce386e69 100644 --- a/third_party/home-manager/home-manager/completion.fish +++ b/third_party/home-manager/home-manager/completion.fish @@ -43,11 +43,12 @@ complete -c home-manager -n "__fish_use_subcommand" -x -a "expire-generations" - complete -c home-manager -F -s f -l "file" -d "The home configuration file" complete -c home-manager -x -s A -d "Select an expression in the configuration file" complete -c home-manager -F -s I -d "Add a path to the Nix expression search path" -complete -c home-manager -F -l "flake" -d "Use home-manager configuration at specified flake-uri" +complete -c home-manager -F -l "flake" -d "Use Home Manager configuration at specified flake-uri" complete -c home-manager -F -s b -d "Move existing files to new path rather than fail" complete -c home-manager -f -s v -l "verbose" -d "Verbose output" complete -c home-manager -f -s n -l "dry-run" -d "Do a dry run, only prints what actions would be taken" complete -c home-manager -f -s h -l "help" -d "Print this help" +complete -c home-manager -f -s h -l "version" -d "Print the Home Manager version" complete -c home-manager -x -l "arg" -d "Override inputs passed to home-manager.nix" complete -c home-manager -x -l "argstr" -d "Like --arg but the value is a string" @@ -59,7 +60,12 @@ complete -c home-manager -f -l "keep-going" -d "Keep going in case of failed bui complete -c home-manager -x -s j -l "max-jobs" -d "Max number of build jobs in parallel" complete -c home-manager -x -l "option" -d "Set Nix configuration option" complete -c home-manager -x -l "builders" -d "Remote builders" +complete -c home-manager -f -s L -l "print-build-logs" -d "Print full build logs on standard error" complete -c home-manager -f -l "show-trace" -d "Print stack trace of evaluation errors" complete -c home-manager -f -l "substitute" complete -c home-manager -f -l "no-substitute" complete -c home-manager -f -l "no-out-link" +complete -c home-manager -f -l "update-input" +complete -c home-manager -f -l "override-input" +complete -c home-manager -f -l "experimental-features" +complete -c home-manager -f -l "extra-experimental-features" diff --git a/third_party/home-manager/home-manager/completion.zsh b/third_party/home-manager/home-manager/completion.zsh index d0f0e2591f..3babc1feef 100644 --- a/third_party/home-manager/home-manager/completion.zsh +++ b/third_party/home-manager/home-manager/completion.zsh @@ -11,6 +11,7 @@ _arguments \ '--impure[impure]' \ '--keep-failed[keep failed]' \ '--keep-going[keep going]' \ + '--version[version]' \ '(-h --help)'{--help,-h}'[help]' \ '(-v --verbose)'{--verbose,-v}'[verbose]' \ '(-n --dry-run)'{--dry-run,-n}'[dry run]' \ @@ -18,7 +19,12 @@ _arguments \ '(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \ '--option[option]:NAME VALUE:()' \ '--builders[builders]:SPEC:()' \ + '(-L --print-build-logs)'{--print-build-logs,-L}'[print build logs]' \ '--show-trace[show trace]' \ + '--override-input[override flake input]:NAME VALUE:()' \ + '--update-input[update flake input]:NAME:()' \ + '--experimental-features[set experimental Nix features]:VALUE:()' \ + '--extra-experimental-features:[append to experimental Nix features]:VALUE:()' \ '1: :->cmds' \ '*:: :->args' && ret=0 @@ -56,7 +62,11 @@ case "$state" in '--option[option]:NAME VALUE:()' \ '--show-trace[show trace]' \ '--substitute[substitute]' \ - '--builders[builders]:SPEC:()' + '--builders[builders]:SPEC:()' \ + '--override-input[override flake input]:NAME VALUE:()' \ + '--update-input[update flake input]:NAME:()' \ + '--experimental-features[set experimental Nix features]:VALUE:()' \ + '--extra-experimental-features:[append to experimental Nix features]:VALUE:()' ;; esac esac diff --git a/third_party/home-manager/home-manager/default.nix b/third_party/home-manager/home-manager/default.nix index 47281bc643..3589acb82b 100644 --- a/third_party/home-manager/home-manager/default.nix +++ b/third_party/home-manager/home-manager/default.nix @@ -1,4 +1,5 @@ -{ runCommand, lib, bash, callPackage, coreutils, findutils, gnused, less +{ runCommand, lib, bash, callPackage, coreutils, findutils, gettext, gnused +, less, ncurses, unixtools # used for pkgs.path for nixos-option , pkgs @@ -16,7 +17,9 @@ let in runCommand "home-manager" { preferLocalBuild = true; + nativeBuildInputs = [ gettext ]; meta = with lib; { + mainProgram = "home-manager"; description = "A user environment configurator"; maintainers = [ maintainers.rycee ]; platforms = platforms.unix; @@ -27,12 +30,21 @@ in runCommand "home-manager" { substituteInPlace $out/bin/home-manager \ --subst-var-by bash "${bash}" \ - --subst-var-by coreutils "${coreutils}" \ - --subst-var-by findutils "${findutils}" \ - --subst-var-by gnused "${gnused}" \ - --subst-var-by less "${less}" \ - --subst-var-by nixos-option "${nixos-option}" \ - --subst-var-by HOME_MANAGER_PATH '${pathStr}' + --subst-var-by DEP_PATH "${ + lib.makeBinPath [ + coreutils + findutils + gettext + gnused + less + ncurses + nixos-option + unixtools.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 @@ -40,4 +52,14 @@ in runCommand "home-manager" { $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" + + 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/third_party/home-manager/home-manager/home-manager b/third_party/home-manager/home-manager/home-manager index a5fe62013b..89f58c4d06 100644 --- a/third_party/home-manager/home-manager/home-manager +++ b/third_party/home-manager/home-manager/home-manager @@ -1,13 +1,31 @@ #!@bash@/bin/bash # Prepare to use tools from Nixpkgs. -PATH=@coreutils@/bin:@findutils@/bin:@gnused@/bin:@less@/bin:@nixos-option@/bin${PATH:+:}$PATH +PATH=@DEP_PATH@${PATH:+:}$PATH set -euo pipefail -function errorEcho() { - # shellcheck disable=2048,2086 - echo $* >&2 +export TEXTDOMAIN=home-manager +export TEXTDOMAINDIR=@OUT@/share/locale + +# shellcheck disable=1091 +source @HOME_MANAGER_LIB@ + +function removeByName() { + nix profile list \ + | { grep "$1" || test $? = 1; } \ + | cut -d ' ' -f 4 \ + | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG +} + +function setNixProfileCommands() { + if [[ -e ~/.nix-profile/manifest.json ]] ; then + LIST_OUTPATH_CMD="nix profile list" + REMOVE_CMD="removeByName" + else + LIST_OUTPATH_CMD="nix-env -q --out-path" + REMOVE_CMD="nix-env -q" + fi } function setVerboseAndDryRun() { @@ -39,7 +57,8 @@ function setWorkDir() { function setConfigFile() { if [[ -v HOME_MANAGER_CONFIG ]] ; then if [[ ! -e "$HOME_MANAGER_CONFIG" ]] ; then - errorEcho "No configuration file found at $HOME_MANAGER_CONFIG" + _i "No configuration file found at %s" \ + "$HOME_MANAGER_CONFIG" >&2 exit 1 fi @@ -57,8 +76,8 @@ function setConfigFile() { fi done - errorEcho "No configuration file found." \ - "Please create one at $defaultConfFile" + _i "No configuration file found. Please create one at %s" \ + "$defaultConfFile" >&2 exit 1 } @@ -68,7 +87,7 @@ function setHomeManagerNixPath() { "${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home-manager" \ "$HOME/.nixpkgs/home-manager" ; do if [[ -e "$path" || "$path" =~ ^https?:// ]] ; then - export NIX_PATH="home-manager=$path${NIX_PATH:+:}$NIX_PATH" + EXTRA_NIX_PATH+=("home-manager=$path") return fi done @@ -87,10 +106,17 @@ function setFlakeAttribute() { local name="${FLAKE_ARG#*#}" ;; *) - local name="$USER@$(hostname)" - if [ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$name\"")" = "false" ]; then - name="$USER" - fi + local name="$USER" + # Check both long and short hostnames; long first to preserve + # pre-existing behaviour in case both happen to be defined. + for n in "$USER@$(hostname)" "$USER@$(hostname -s)"; do + if [[ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$n\"")" == "true" ]]; then + name="$n" + if [[ -v VERBOSE ]]; then + echo "Using flake homeConfiguration for $name" + fi + fi + done ;; esac export FLAKE_CONFIG_URI="$flake#homeConfigurations.\"$name\"" @@ -100,11 +126,10 @@ function setFlakeAttribute() { function doInspectOption() { setFlakeAttribute if [[ -v FLAKE_CONFIG_URI ]]; then - errorEcho "Can't inspect options of a flake configuration" + _iError "Can't inspect options of a flake configuration" exit 1 fi setConfigFile - setHomeManagerNixPath local extraArgs=("$@") @@ -140,11 +165,10 @@ function doInspectOption() { function doInstantiate() { setFlakeAttribute if [[ -v FLAKE_CONFIG_URI ]]; then - errorEcho "Can't instantiate a flake configuration" + _i "Can't instantiate a flake configuration" >&2 exit 1 fi setConfigFile - setHomeManagerNixPath local extraArgs=() @@ -166,7 +190,6 @@ function doInstantiate() { function doBuildAttr() { setConfigFile - setHomeManagerNixPath local extraArgs=("$@") @@ -212,20 +235,16 @@ function presentNews() { elif [[ "$newsDisplay" == "silent" ]]; then return elif [[ "$newsDisplay" == "notify" ]]; then - local msg - if [[ $newsNumUnread -eq 1 ]]; then - msg="There is an unread and relevant news item.\n" - msg+="Read it by running the command '$(basename "$0") news'." - else - msg="There are $newsNumUnread unread and relevant news items.\n" - msg+="Read them by running the command '$(basename "$0") news'." - fi + local cmd msg + cmd="$(basename "$0")" + msg="$(_ip \ + $'There is %d unread and relevant news item.\nRead it by running the command "%s news".' \ + $'There are %d unread and relevant news items.\nRead them by running the command "%s news".' \ + "$newsNumUnread" "$newsNumUnread" "$cmd")" # Not actually an error but here stdout is reserved for # nix-build output. - errorEcho - errorEcho -e "$msg" - errorEcho + echo $'\n'"$msg"$'\n' >&2 if [[ -v DISPLAY ]] && type -P notify-send > /dev/null; then notify-send "Home Manager" "$msg" @@ -233,13 +252,14 @@ function presentNews() { elif [[ "$newsDisplay" == "show" ]]; then doShowNews --unread else - errorEcho "Unknown 'news.display' setting '$newsDisplay'." + _i 'Unknown "news.display" setting "%s".' "$newsDisplay" >&2 fi } function doEdit() { if [[ ! -v EDITOR || -z $EDITOR ]]; then - errorEcho "Please set the \$EDITOR environment variable" + # shellcheck disable=2016 + _i 'Please set the $EDITOR environment variable' >&2 return 1 fi @@ -254,7 +274,7 @@ function doEdit() { function doBuild() { if [[ ! -w . ]]; then - errorEcho "Cannot run build in read-only directory"; + _i 'Cannot run build in read-only directory' >&2 return 1 fi @@ -266,6 +286,7 @@ function doBuild() { "$FLAKE_CONFIG_URI.activationPackage" \ ${DRY_RUN+--dry-run} \ ${NO_OUT_LINK+--no-link} \ + ${PRINT_BUILD_LOGS+--print-build-logs} \ || return else doBuildAttr \ @@ -296,6 +317,7 @@ function doSwitch() { doBuildFlake \ "$FLAKE_CONFIG_URI.activationPackage" \ --out-link "$generation" \ + ${PRINT_BUILD_LOGS+--print-build-logs} \ && "$generation/activate" || return else doBuildAttr \ @@ -336,11 +358,11 @@ function doRmGenerations() { local linkName="home-manager-$generationId-link" if [[ ! -e $linkName ]]; then - errorEcho "No generation with ID $generationId" + _i 'No generation with ID %s' "$generationId" >&2 elif [[ $linkName == $(readlink home-manager) ]]; then - errorEcho "Cannot remove the current generation $generationId" + _i 'Cannot remove the current generation %s' "$generationId" >&2 else - echo Removing generation $generationId + _i 'Removing generation %s' "$generationId" $DRY_RUN_CMD rm $VERBOSE_ARG $linkName fi done @@ -366,17 +388,18 @@ function doExpireGenerations() { # shellcheck disable=2086 doRmGenerations $generations elif [[ -v VERBOSE ]]; then - echo "No generations to expire" + _i "No generations to expire" fi } function doListPackages() { + setNixProfileCommands local outPath - outPath="$(nix-env -q --out-path | grep -o '/.*home-manager-path$')" + outPath="$($LIST_OUTPATH_CMD | grep -o '/.*home-manager-path$')" if [[ -n "$outPath" ]] ; then nix-store -q --references "$outPath" | sed 's/[^-]*-//' else - errorEcho "No home-manager packages seem to be installed." + _i 'No home-manager packages seem to be installed.' >&2 fi } @@ -433,7 +456,7 @@ function doShowNews() { ${PAGER:-less} "$newsFileUnread" ;; *) - errorEcho "Unknown argument $1" + _i 'Unknown argument %s' "$1" return 1 esac @@ -447,24 +470,28 @@ function doShowNews() { function doUninstall() { setVerboseAndDryRun + setNixProfileCommands - echo "This will remove Home Manager from your system." + _i 'This will remove Home Manager from your system.' if [[ -v DRY_RUN ]]; then - echo "This is a dry run, nothing will actually be uninstalled." + _i 'This is a dry run, nothing will actually be uninstalled.' fi local confirmation - read -r -n 1 -p "Really uninstall Home Manager? [y/n] " confirmation + read -r -n 1 -p "$(_i 'Really uninstall Home Manager?') [y/n] " confirmation echo case $confirmation in y|Y) - echo "Switching to empty Home Manager configuration..." + _i "Switching to empty Home Manager configuration..." HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)" - echo "{ lib, ... }: { home.file = lib.mkForce {}; }" > "$HOME_MANAGER_CONFIG" + echo "{ lib, ... }: {" > "$HOME_MANAGER_CONFIG" + echo " home.file = lib.mkForce {};" >> "$HOME_MANAGER_CONFIG" + echo " home.stateVersion = \"18.09\";" >> "$HOME_MANAGER_CONFIG" + echo "}" >> "$HOME_MANAGER_CONFIG" doSwitch - $DRY_RUN_CMD nix-env -e home-manager-path || true + $DRY_RUN_CMD $REMOVE_CMD home-manager-path || true rm "$HOME_MANAGER_CONFIG" $DRY_RUN_CMD rm $VERBOSE_ARG -r \ "${XDG_DATA_HOME:-$HOME/.local/share}/home-manager" @@ -472,28 +499,28 @@ function doUninstall() { "$NIX_STATE_DIR/gcroots/per-user/$USER/current-home" ;; *) - echo "Yay!" + _i "Yay!" exit 0 ;; esac local deleteProfiles read -r -n 1 \ - -p 'Remove all Home Manager generations? [y/n] ' \ + -p "$(_i 'Remove all Home Manager generations?') [y/n] " \ deleteProfiles echo case $deleteProfiles in y|Y) doRmAllGenerations - echo "All generations are now eligible for garbage collection." + _i 'All generations are now eligible for garbage collection.' ;; *) - echo "Leaving generations but they may still be garbage collected." + _i 'Leaving generations but they may still be garbage collected.' ;; esac - echo "Home Manager is uninstalled but your home.nix is left untouched." + _i "Home Manager is uninstalled but your home.nix is left untouched." } function doHelp() { @@ -506,11 +533,12 @@ function doHelp() { echo " -A ATTRIBUTE Optional attribute that selects a configuration" echo " expression in the configuration file." echo " -I PATH Add a path to the Nix expression search path." - echo " --flake flake-uri Use home-manager configuration at flake-uri" + echo " --flake flake-uri Use Home Manager configuration at flake-uri" echo " -b EXT Move existing files to new path rather than fail." echo " -v Verbose output" echo " -n Do a dry run, only prints what actions would be taken" echo " -h Print this help" + echo " --version Print the Home Manager version" echo echo "Options passed on to nix-build(1)" echo @@ -522,6 +550,7 @@ function doHelp() { echo " --keep-going" echo " -j, --max-jobs NUM" echo " --option NAME VALUE" + echo " -L, --print-build-logs" echo " --show-trace" echo " --(no-)substitute" echo " --no-out-link Do not create a symlink to the output path" @@ -570,6 +599,8 @@ COMMAND="" COMMAND_ARGS=() FLAKE_ARG="" +setHomeManagerNixPath + while [[ $# -gt 0 ]]; do opt="$1" shift @@ -608,9 +639,20 @@ while [[ $# -gt 0 ]]; do PASSTHROUGH_OPTS+=("$opt" "$1" "$2") shift 2 ;; + --experimental-features) + PASSTHROUGH_OPTS+=("$opt" "$1") + shift + ;; + --extra-experimental-features) + PASSTHROUGH_OPTS+=("$opt" "$1") + shift + ;; --no-out-link) NO_OUT_LINK=1 ;; + -L|--print-build-logs) + PRINT_BUILD_LOGS=1 + ;; -h|--help) doHelp exit 0 @@ -634,7 +676,7 @@ while [[ $# -gt 0 ]]; do export VERBOSE=1 ;; --version) - echo 22.05 + echo 22.11 exit 0 ;; *) @@ -643,8 +685,8 @@ while [[ $# -gt 0 ]]; do COMMAND_ARGS+=("$opt") ;; *) - errorEcho "$0: unknown option '$opt'" - errorEcho "Run '$0 --help' for usage help" + _iError "%s: unknown option '%s'" "$0" "$opt" >&2 + _i "Run '%s --help' for usage help" "$0" >&2 exit 1 ;; esac @@ -678,7 +720,7 @@ case $COMMAND in ;; expire-generations) if [[ ${#COMMAND_ARGS[@]} != 1 ]]; then - errorEcho "expire-generations expects one argument, got ${#COMMAND_ARGS[@]}." + _i 'expire-generations expects one argument, got %d.' "${#COMMAND_ARGS[@]}" >&2 exit 1 else doExpireGenerations "${COMMAND_ARGS[@]}" @@ -700,7 +742,7 @@ case $COMMAND in doHelp ;; *) - errorEcho "Unknown command: $COMMAND" + _iError 'Unknown command: %s' "$COMMAND" >&2 doHelp >&2 exit 1 ;; diff --git a/third_party/home-manager/home-manager/home-manager.nix b/third_party/home-manager/home-manager/home-manager.nix index a113d1d820..6f2f4b6675 100644 --- a/third_party/home-manager/home-manager/home-manager.nix +++ b/third_party/home-manager/home-manager/home-manager.nix @@ -1,9 +1,5 @@ -{ pkgs ? import {} -, confPath -, confAttr ? null -, check ? true -, newsReadIdsFile ? null -}: +{ pkgs ? import { }, confPath, confAttr ? null, check ? true +, newsReadIdsFile ? null }: let inherit (pkgs.lib) @@ -11,68 +7,58 @@ let 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; }; - newsReadIds = - if newsReadIdsFile == null - then {} - else - let - ids = splitString "\n" (fileContents newsReadIdsFile); - in - builtins.listToAttrs (map (id: { name = id; value = null; }) ids); + newsReadIds = if newsReadIdsFile == null then + { } + else + let ids = splitString "\n" (fileContents newsReadIdsFile); + in builtins.listToAttrs (map (id: { + name = id; + value = null; + }) ids); newsIsRead = entry: builtins.hasAttr entry.id newsReadIds; - newsFiltered = - let - pred = entry: entry.condition && ! newsIsRead entry; - in - filter pred env.newsEntries; + newsFiltered = let pred = entry: entry.condition && !newsIsRead entry; + in filter pred env.newsEntries; newsNumUnread = length newsFiltered; - newsFileUnread = pkgs.writeText "news-unread.txt" ( - concatMapStringsSep "\n\n" (entry: + newsFileUnread = pkgs.writeText "news-unread.txt" (concatMapStringsSep "\n\n" + (entry: let - time = replaceStrings ["T"] [" "] (removeSuffix "+00:00" entry.time); - in - '' - * ${time} + time = + replaceStrings [ "T" ] [ " " ] (removeSuffix "+00:00" entry.time); + in '' + * ${time} - ${replaceStrings ["\n"] ["\n "] entry.message} - '' - ) newsFiltered - ); + ${replaceStrings [ "\n" ] [ "\n " ] entry.message} + '') newsFiltered); - newsFileAll = pkgs.writeText "news-all.txt" ( - concatMapStringsSep "\n\n" (entry: + newsFileAll = pkgs.writeText "news-all.txt" (concatMapStringsSep "\n\n" + (entry: let flag = if newsIsRead entry then "read" else "unread"; - time = replaceStrings ["T"] [" "] (removeSuffix "+00:00" entry.time); - in - '' - * ${time} [${flag}] + time = + replaceStrings [ "T" ] [ " " ] (removeSuffix "+00:00" entry.time); + in '' + * ${time} [${flag}] - ${replaceStrings ["\n"] ["\n "] entry.message} - '' - ) env.newsEntries - ); + ${replaceStrings [ "\n" ] [ "\n " ] entry.message} + '') env.newsEntries); # File where each line corresponds to an unread news entry # identifier. If non-empty then the file ends in "\n". - newsUnreadIdsFile = pkgs.writeText "news-unread-ids" ( - let - text = concatMapStringsSep "\n" (entry: entry.id) newsFiltered; - in - text + optionalString (text != "") "\n" - ); + newsUnreadIdsFile = pkgs.writeText "news-unread-ids" + (let text = concatMapStringsSep "\n" (entry: entry.id) newsFiltered; + in text + optionalString (text != "") "\n"); newsInfo = pkgs.writeText "news-info.sh" '' local newsNumUnread=${toString newsNumUnread} @@ -82,8 +68,7 @@ let local newsUnreadIdsFile="${newsUnreadIdsFile}" ''; -in - { - inherit (env) activationPackage; - inherit newsInfo; - } +in { + inherit (env) activationPackage; + inherit newsInfo; +} diff --git a/third_party/home-manager/home-manager/install.nix b/third_party/home-manager/home-manager/install.nix index cf45f14dcc..f4bcbb3f6e 100644 --- a/third_party/home-manager/home-manager/install.nix +++ b/third_party/home-manager/home-manager/install.nix @@ -1,15 +1,25 @@ -{ home-manager, runCommand }: +{ home-manager, gettext, runCommand, ncurses }: -runCommand "home-manager-install" { - propagatedBuildInputs = [ home-manager ]; +let + + hmBashLibInit = '' + export TEXTDOMAIN=home-manager + export TEXTDOMAINDIR=${home-manager}/share/locale + source ${home-manager}/share/bash/home-manager.sh + ''; + +in runCommand "home-manager-install" { + propagatedBuildInputs = [ home-manager gettext ncurses ]; preferLocalBuild = true; shellHookOnly = true; shellHook = '' + ${hmBashLibInit} + confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix" if [[ ! -e $confFile ]]; then echo - echo "Creating initial Home Manager configuration..." + _i "Creating initial Home Manager configuration..." nl=$'\n' xdgVars="" @@ -44,7 +54,7 @@ runCommand "home-manager-install" { # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -53,34 +63,23 @@ runCommand "home-manager-install" { fi echo - echo "Creating initial Home Manager generation..." + _i "Creating initial Home Manager generation..." echo - if home-manager switch; then - cat <, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-06-09 11:16+0000\n" +"Last-Translator: Leix b \n" +"Language-Team: Catalan \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.13-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "No s'ha trobat cap fitxer de configuració a %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "No s'ha trobat cap fitxer de configuració. Si us plau, creeu un a %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "No s'han pogut inspeccionar les opcions de configuració de flake" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "No es pot instanciar una configuració flake" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Hi ha %d notícia rellevant no llegida.\n" +"Llegeix-la executant la comanda \"%s news\"." +msgstr[1] "" +"Hi han %d notícies rellevants no llegides.\n" +"Llegeix-les executant la comanda \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Configuració \"news.display\" no reconeguda \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Si us plau, defineix la variable d'entorn $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Impossible executar la compilació en un directori només lectura" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "No existeix la generació amb ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Impossible eliminar la generació actual %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Eliminant la generació %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "No s'han trobat generacions a expirar" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Cap paquet home-manager sembla estar instal·lat." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Argument desconegut %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Home Manager serà esborrat del sistema." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Això és un simulacre, res serà realment desinstal·lat." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Estàs segur que vols desinstal·lar Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Canviant a configuració buida de Home Manager..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Visca!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Eliminar totes les generacions de Home Manager?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" +"Totes les generacions són ara candidates per a la recol·lecció de brossa." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Deixant generacions, però aquestes encara poden ser esborrades pel recol·" +"lector de brossa." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" +"Home Manager ha estat desinstal·lat però el vostre home.nix es manté intacte." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%: opció desconeguda '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Executa '%s --help' per veure l'ajuda d'ús" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations espera un argument, obtinguts %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Comanda desconeguda: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Creant configuració inicial de Home Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Creant generació inicial de Home Manager..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Tot fet! L'eina home-manager hauria de estar instal·lada i pots editar\n" +"\n" +" %s\n" +"\n" +"per a configurar Home Manager. Executa 'man home-configuration.nix' per\n" +"a veure totes les opcions disponibles." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Uh oh, la instal·lació ha fallat! Si us plau, notifica-ho a\n" +"\n" +" %s\n" +"\n" +"si l'error sembla culpa de Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Aquesta derivació no es pot construir, si us plau executa-la utilitzant nix-" +"shell." diff --git a/third_party/home-manager/home-manager/po/da.po b/third_party/home-manager/home-manager/po/da.po new file mode 100644 index 0000000000..aeda9100f0 --- /dev/null +++ b/third_party/home-manager/home-manager/po/da.po @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-09-19 18:22+0000\n" +"Last-Translator: cafkafk \n" +"Language-Team: Danish \n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Ingen konfigurationsfiler fundet ved %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Ingen konfigurationsfiler fundet. Venligst lav en ved %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Kan ikke inspicere indstillinger af en flake konfiguration" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Kan ikke instantiere en flake konfiguration" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Der er %d ulæst og relavante nyheder.\n" +"Læs den ved at køre \"%s news\"." +msgstr[1] "" +"Der er %d ulæste og relavante nyheder.\n" +"Læs dem ved at køre \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Ubekændt \"news.display\" indstilling \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Venligst sæt $EDITOR miljøvariablen" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Kan ikke bygge i en læs-kun folder" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Ingen generation med ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Kan ikke fjerne den nuværende generation %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Fjern generation %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Ingen generationer som skal udløbes" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "" +"Det virker ikke som om der er nogle home-manager pakker der er installeret." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Ubekendt argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Dette vil fjerne Home Manager fra dit system." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Dette er en tør kørsel, intet vil rent faktisk blive uinstalleret." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Virkelig uinstaller Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Skifter til tom Home Manager konfiguration..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Juhuu!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Fjern alle Home Manager generationer?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Alle generationer kan nu blive tjekket for overflødige filer." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Forlad generationer, men de kan stadig bliver fjernet som overflødige filer." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" +"Home Manager bliver uinstalleret, men din home.nix bliver forladt uberørt." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: ukendt indstilling '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Kør '%s --help' for brugsvejledning" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations forventer et argument, fik %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Ubekendt kommando: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Laver initial Home Manager konfiguration..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Laver initial Home Manager generation..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Alt er færdigt! Home-manager værktøjet burde nu være installeret, og du kan " +"ændre\n" +"\n" +" %s\n" +" \n" +"For at konfigurere Home Manager. Kør 'man home-configuration.nix' for at \n" +"se alle de mulige indstillinger." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Åh nej, installationen fejlede! Venligst opret en fejlrapport ved\n" +"\n" +" %s\n" +" \n" +"hvis fejlen fremstår som forskyldt af Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "Denne derivation er ikke bygbar, venligst kør den gennem nix-shell." diff --git a/third_party/home-manager/home-manager/po/de.po b/third_party/home-manager/home-manager/po/de.po new file mode 100644 index 0000000000..79e1820ab7 --- /dev/null +++ b/third_party/home-manager/home-manager/po/de.po @@ -0,0 +1,188 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-07-12 19:40+0000\n" +"Last-Translator: Frederik Engels \n" +"Language-Team: German \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Keine Konfigurationsdatei unter %s gefunden" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Keine Konfigurationsdatei gefunden. Bitte erstellen Sie eine unter %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Die Optionen einer Flake-Konfiguration können nicht inspiziert werden" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Kann eine Flake-Konfiguration nicht instanziieren" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Es gibt eine ungelesene und relevante Nachricht.\n" +"Lesen Sie sie, indem Sie den Befehl \"%s news\" ausführen." +msgstr[1] "" +"Es gibt %d ungelesene und relevante Nachrichten.\n" +"Lesen Sie sie, indem Sie den Befehl \"%s news\" ausführen." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Unbekannte \"news.display\" Einstellung \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Bitte legen Sie die $EDITOR Variable fest" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Build kann nicht im schreibgeschützten Ordner ausgeführt werden" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Keine Generation mit ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Die jetzige Generation %s kann nicht entfernt werden" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Entferne Generation %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Keine ablaufenden Generationen" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Es scheint, als ob keine Home Manager Pakete installiert sind." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Unbekannte Argumente %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Dies wird Home Manager von Ihrem System entfernen." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Dies ist ein Probelauf, es wird nichts vom System deinstalliert." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Möchten Sie wirklich Home Manager deinstallieren?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Wechsle zu einer leeren Home Manager Konfiguration..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Juhu!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Entferne alle Home Manager Generationen?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Alle Generationen kommen nun für die Garbage Collection in Frage." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Ignoriere Generationen, aber diese könnten immer noch mittels des Garbage " +"Collectors aufgeräumt werden." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" +"Home Manager ist installiert, aber Ihre home.nix Datei bleibt unberührt." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: unbekannte Option '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Führe '%s --help' aus, um Hilfe zur Verwendung zu erhalten" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations erwartet ein Argument, hat aber %d erhalten." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Unbekannter Befehl: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Erstelle initiale Home Manager Konfiguration..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Erstelle initiale Home Manager Generation..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Alles fertig! Das Home Manager Tool sollte nun installiert sein. Sie können\n" +"\n" +" %s\n" +"\n" +"bearbeiten um Home Manager zu konfigurieren. Führen Sie\n" +"'man home-configuration.nix' aus, um alle verfügbaren Optionen zu\n" +"sehen." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Ups, die Installation schlug fehl. Bitte erstellen Sie ein Issue unter\n" +"\n" +" %s\n" +"\n" +"falls der Fehler auf Home Manager zurückzuführen ist." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Diese Derivation ist nicht kompilierbar. Bitte führen Sie nix-shell aus." diff --git a/third_party/home-manager/home-manager/po/es.po b/third_party/home-manager/home-manager/po/es.po new file mode 100644 index 0000000000..95f2fea382 --- /dev/null +++ b/third_party/home-manager/home-manager/po/es.po @@ -0,0 +1,185 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-01-11 21:45+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Spanish \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.10.1\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Archivo de configuración no encontrado en %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Archivo de configuración no encontrado. Por favor cree uno en %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "No se pudo inspeccionar las opciones de la configuración flake" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "No se pudo instanciar una configuración flake" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Hay %d noticia relevante no leída.\n" +"Léala ejecutando el comando \"%s news\"." +msgstr[1] "" +"Hay %d noticias relevantes no leídas.\n" +"Léalas ejecutando el comando \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Configuración \"news.display\" no reconocida \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Defina la variable de ambiente $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "No se puede ejecutar en un directorio de sólo lectura" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "No existe la generación con ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "No se pudo borrar la generación actual %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Borrando generación %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "No se encontraron generaciones para expirar" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "No se encontró ningún paquete home-manager instalado." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Argumento desconocido %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Home Manager será borrado del sistema." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Este es un simulacro, nada será realmente desinstalado." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Desinstalar Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Cambiando a configuración vacía de Home Manager..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Bien!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Borrar todas las generaciones de Home Manager?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Ahora todas las generaciones son aptas para recolección de basura." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Dejando generaciones aunque podrían aún ser borradas por el recolector de " +"basura." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager desinstalado pero no se ha modificado home.nix." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: opción desconocida '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Ejecute '%s --help' para ver ayuda" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations espera un argumento pero se dieron %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Comando desconocido %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Creando configuración inicial de Home Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Creando generación inicial de Home Manager..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Listo! home-manager ha sido instalado y ahora puede editar\n" +"\n" +" %s\n" +"\n" +"para configurar Home Manager. Ejecute 'man home-configuration.nix' para\n" +"ver todas las opciones disponibles." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"La instalación ha fallado. Por favor notifíquelo en\n" +"\n" +" %s\n" +"\n" +"si el error parecer ser culpa de Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "Esta derivación no se puede construir, ejecute con nix-shell." diff --git a/third_party/home-manager/home-manager/po/fa.po b/third_party/home-manager/home-manager/po/fa.po new file mode 100644 index 0000000000..d7791d649a --- /dev/null +++ b/third_party/home-manager/home-manager/po/fa.po @@ -0,0 +1,169 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-04-09 18:11+0000\n" +"Last-Translator: Artin Mobasher \n" +"Language-Team: Persian \n" +"Language: fa\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "هیچ فایل تنظیماتی در %s پیدا نشد" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "هیچ فایل تنظیماتی پیدا نشد. لطفا یک فایل در %s بسازید" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +msgstr[1] "" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "" + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "" + +#: home-manager/home-manager:493 +#, fuzzy +msgid "Yay!" +msgstr "آره!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "دستور ناشناخته: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "ایجاد تنظیمات اولیه Home-Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" diff --git a/third_party/home-manager/home-manager/po/fi.po b/third_party/home-manager/home-manager/po/fi.po new file mode 100644 index 0000000000..be0ae0a6f5 --- /dev/null +++ b/third_party/home-manager/home-manager/po/fi.po @@ -0,0 +1,166 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: fi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +msgstr[1] "" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "" + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "" + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "" + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" diff --git a/third_party/home-manager/home-manager/po/fr.po b/third_party/home-manager/home-manager/po/fr.po new file mode 100644 index 0000000000..5a129e9d24 --- /dev/null +++ b/third_party/home-manager/home-manager/po/fr.po @@ -0,0 +1,191 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2021-12-19 16:51+0000\n" +"Last-Translator: TheBlackBeans \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.10\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Aucun fichier de configuration trouvé à l'emplacement %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "" +"Aucun fichier de configuration trouvé. Veuillez en créer un à l'emplacement " +"%s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Impossible d'inspecter les options d'une configuration en flocons" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Impossible d'instancier une configuration flake" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Il y a %d nouvel élément non lu et pertinent.\n" +"Vous pouvez le lire en exécutant la commande \"%s news\"." +msgstr[1] "" +"Il y a %d nouveaux éléments non lus et pertinents.\n" +"Vous pouvez les lire en exécutant la commande \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Configuration \"news.display\" iconnue \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Veuillez définir la variable d'environnement $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Impossible de lancer une compilation dans un dossier en écriture seule" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Aucune génération avec l'identifiant %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Impossible de supprimer la génération courante %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Suppression de la génération %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Aucune génération expirée" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Aucun paquet home-manager ne semble être installé." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Aucun argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Cela va supprimer Home Manager de votre système." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "C'est un essai, rien ne sera réellement désinstallé." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Voulez-vous vraiment désinstaller Home Manager ?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Changement vers une configuration vierge de Home Manager..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Yay !" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Supprimer toutes les générations de Home Manager ?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" +"Toutes les générations sont maintenant éligibles pour la collecte des " +"ordures." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Les générations sortantes mais elles peuvent encore être collectées par les " +"ordures." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager est désinstallé mais votre home.nix reste intact." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s : option inconnue « %s »" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Exécuter « %s --help » pour de l'aide sur l'utilisation" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations attend un argument, a obtenu %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Commande inconnue : %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Création de la configuration initiale de Home Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Création de la génération initiale de Home Manager..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Tout est fait! Home Manager devrait désormais être installé et vous pouvez " +"éditer\n" +"\n" +" %s\n" +"\n" +"pour configurer Home Manager. Pour avoir une liste des options disponibles,\n" +"essayez 'man home-configuration.nix'." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Uh oh, l'installation n'a pas réussi! Veuillez signaler cette erreur à " +"l'adresse suivante\n" +"\n" +" %s\n" +"\n" +"si l'erreur semble être liée à Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "Cette dérivation ne peut être construite, essayez avec nix-shell." diff --git a/third_party/home-manager/home-manager/po/home-manager.pot b/third_party/home-manager/home-manager/po/home-manager.pot new file mode 100644 index 0000000000..003a344b0e --- /dev/null +++ b/third_party/home-manager/home-manager/po/home-manager.pot @@ -0,0 +1,167 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +msgstr[1] "" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "" + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "" + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "" + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" diff --git a/third_party/home-manager/home-manager/po/it.po b/third_party/home-manager/home-manager/po/it.po new file mode 100644 index 0000000000..610762624c --- /dev/null +++ b/third_party/home-manager/home-manager/po/it.po @@ -0,0 +1,185 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-04-20 18:18+0000\n" +"Last-Translator: Frankie McEyes \n" +"Language-Team: Italian \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Nessun file di configurazione trovato in %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Nessun file di configurazione trovato. Per favore crearne uno in %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Impossibile ispezionare le opzioni di configurazione flake" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Impossibile istanziare una configurazione flake" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"C'è %d novità di elementi non letta.\n" +"Leggila con il comando \"%s news\"." +msgstr[1] "" +"Ci sono %d novità di elementi non letti\n" +"Leggile con il comando \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Opzione \"news.display\" sconosciuta \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Per favore impostare la variabile d'ambient $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Impossibile eseguire la build in una cartella in sola lettura" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Nessuna generazione con ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Impossibile rimuovere la generazione corrente %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Rimuovo la generazione %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Nessuna generazione in scadenza" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Nessun pacchetto home-manager sembra essere installato." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Argomento sconosciuto: %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Questo rimuoverà Home Manger dal tuo sistema." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Questo è un avvio a secco, nulla verrà realmente disinstallato." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Vuoi davvero disinstallare Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Cambio ad una configurazione Home Manager vuota..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Urrà!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Rimuovere tutte le generazioni Home Manager?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Tutte le generazioni sono ora pronte per essere cestinate." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "Abbandono le generazioni, ma possono essere ancora cestinate." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager è disinstallato ma la tua home.Nix non è stata toccata." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: opzione sconosciuta '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Esegui '%s --help' per ottenere aiuto" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations si aspetta un solo argomento, invece di %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Comando sconosciuto: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Creando la configurazione iniziale di Home Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Creando la generazione iniziale di Home Manager..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Tutto fatto! Home-manager dovrebbe essere installato e puoi modificare\n" +"\n" +"%s\n" +"\n" +"per configurare Home Manager. Esegui 'man home-configurazion.nix' per\n" +"consultare tutte le opzioni disponibili." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Oh no, l'installazione non è andata a buon fine! Per favore aprire un ticket " +"issue a\n" +"\n" +"%s\n" +"\n" +"se l'errore sembra essere causato da Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Questa derivazione non è compilabile, prova ad eseguila usando nix-shell." diff --git a/third_party/home-manager/home-manager/po/ja.po b/third_party/home-manager/home-manager/po/ja.po new file mode 100644 index 0000000000..869b629492 --- /dev/null +++ b/third_party/home-manager/home-manager/po/ja.po @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-07-02 02:18+0000\n" +"Last-Translator: OKA, NETSURFER AND OBSERVER, FRONTEND, DEVELOPER " +"(DOTFILES,OSINT,OSS), KEYBASE: (3B0E8E0895DAC8B8) \n" +"Language-Team: Japanese \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.13.1-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "%s に設定ファイルが見つかりません" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "設定ファイルがありません。ファイルを %s に作ってください" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "flake設定のオプションを検査できません" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "flake設定をインスタンス化できません" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"未読のお知らせが%d件あります。\n" +"\"%s news\"コマンドで確認できます。" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "知らない\"news.display\"設定\"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "$EDITOR環境変数を設定してください" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "読み込み専用ディレクトリ内ではbuild(作成)できません" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "ID %s を持つ世代はありません" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "現在使用中の世代 %s は削除できません" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "世代 %s を削除中です" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "期限切れで削除する世代はありません" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "home-managerパッケージはインストールされていないようです。" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "不明な引数 %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "これはシステムからHome Managerを削除します。" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "これはdry run (予行練習)で、実際にはアンインストールは行われません。" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "本当にHome Managerをアンインストールしますか?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "空のHome Managerの設定に切り替え中です..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "イェイ!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Home-managerの全ての世代を削除しますか?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "全ての世代がガベージコレクションの対象になりました。" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"世代を残していますが、それらはガベージコレクションで回収されるかもしれませ" +"ん。" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" +"Home Managerはアンインストールされましたが、home.nixはそのまま残してありま" +"す。" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: 不明なオプション '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "利用方法のヘルプは'%s --help' を実行してください" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations は一つの引数を期待しますが、%d が与えられました。" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "不明なコマンド: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Home Managerの初期設定を生成しています..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Home Managerの最初の世代を生成しています..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"全て実行しました! 現在Home-managerツールはインストールされているはずで、\n" +"\n" +" %s\n" +"\n" +"でHome Managerの設定を編集することができます。利用可能なオプションを見るに" +"は\n" +"'man home-configuration.nix' を実行してください。" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"うあ、インストールに失敗しました!もしこのエラーがHome Managerの欠陥のせいで" +"生じたようなら、\n" +"\n" +" %s\n" +"\n" +"というissueを立ててください。" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "この派生はビルドできませんので、nix-shellを使って実行してください。" diff --git a/third_party/home-manager/home-manager/po/ko.po b/third_party/home-manager/home-manager/po/ko.po new file mode 100644 index 0000000000..2dfe7e49aa --- /dev/null +++ b/third_party/home-manager/home-manager/po/ko.po @@ -0,0 +1,186 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-01-30 21:50+0000\n" +"Last-Translator: 박수원 \n" +"Language-Team: Korean \n" +"Language: ko\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.11-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "%s에서 설정 파일을 찾을 수 없음" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "설정 파일을 찾을 수 없음. %s에 설정 파일을 생성하십시오" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "flake 설정의 옵션들을 검사할 수 없음" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "flake 설정을 인스턴스화 할 수 없음" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"읽지 않은 관련된 뉴스 항목들이 %d 개 있습니다.\n" +"\"%s news\" 명령어를 실행해 읽어보십시오." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "알 수 없는 \"news.display\"의 설정 \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "환경변수 $EDITOR를 설정하십시오" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "읽기전용 폴더에서 빌드를 실행할 수 없습니다" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "ID %s를 갖는 세대가 존재하지 않음" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "현재 세대인 %s를 삭제할 수 없음" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "%s 세대를 삭제하는 중" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "유효 기간이 지난 세대가 없음" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "홈 매니저 패키지들이 설치되지 않은 것으로 보입니다." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "알 수 없는 매개변수 %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "시스템에서 홈 매니저를 삭제할 것입니다." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "모의 실행 중으로, 아무것도 실제로 설치되지 않습니다." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "정말로 홈 매니저를 삭제할까요?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "빈 홈 매니저 설정으로 바꾸는 중..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "야호!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "모든 홈 매니저 세대를 지울까요?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "이제 모든 세대가 쓰레기 수집(가비지 컬렉션)의 대상이 됩니다." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"세대들을 그대로 놔두지만 그들은 여전히 쓰레기 수집(가비지 컬렉션) 될 수 있습" +"니다." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "홈 매니저는 삭제되지만 home.nix 파일은 남겨집니다." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: 알 수 없는 옵션 '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "도움말을 보려면 '%s --help'를 실행하십시오" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "" +"expire-generations 명령어는 매개변수가 한 개 필요한데, %d 개가 입력되었습니" +"다." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "알 수 없는 명령어: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "최초의 홈 매니저 설정을 생성하는 중..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "최초의 홈 매니저 세대를 생성하는 중..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"완료! 홈 매니저 도구들이 설치 되었고 이제 \n" +"\n" +" %s\n" +"\n" +"파일을 수정해서 홈 매니저를 설정할 수 있습니다. 'man home-configuration." +"nix'를\n" +"실행해서 가능한 모든 옵션을 살펴보십시오." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"이런, 설치가 실패했습니다! 만약 에러가 홈 매니저의 문제라고 생각된다면\n" +"\n" +" %s\n" +"\n" +"위 사이트에서 이슈를 생성하십시오." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"이 derivation은 빌드 할 수 없습니다. nix-shell을 이용해서 실행해 주십시오." diff --git a/third_party/home-manager/home-manager/po/lt.po b/third_party/home-manager/home-manager/po/lt.po new file mode 100644 index 0000000000..52b3cab63b --- /dev/null +++ b/third_party/home-manager/home-manager/po/lt.po @@ -0,0 +1,186 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2023-01-09 11:33+0000\n" +"Last-Translator: Kornelijus Tvarijanavičius \n" +"Language-Team: Lithuanian \n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n % 10 == 1 && (n % 100 < 11 || n % 100 > " +"19)) ? 0 : ((n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) ? " +"1 : 2);\n" +"X-Generator: Weblate 4.15.1-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Nerastas konfigūracijos failas %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Nerastas konfigūracijos failas. Sukurkite jį adresu %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Negalima patikrinti flake konfigūracijos pasirinkimų" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Negalima sukurti pradinės flake konfigūracijos" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Yra %d neperskaityta ir aktuali naujiena.\n" +"Perskaitykite ją paleidus komandą \"%s news\"." +msgstr[1] "" +"Yra %d neperskaitytos ir aktualios naujienos.\n" +"Perskaitykite jas paleidus komandą \"%s news\"." +msgstr[2] "" +"Yra %d neperskaitytų ir aktualių naujienų.\n" +"Perskaitykite jas paleidus komandą \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Nežinomas \"news.display\" nustatymas \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Prašome nustatyti $EDITOR aplinkos kintamąjį" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Nėra generacijos su ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Negalima pašalinti esamos generacijos %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Pašalinama generacija %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Nėra instaliuotų home-manager paketų." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Nežinomas argumentas %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Tai pašalins Home Manager iš jūsų sistemos." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Tai bandomasis paleidimas, niekas nebus ištrinta." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Tikrai išdiegti Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Perjungiama į tuščią Home Manager konfigūraciją..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Valio!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Pašalinti visas Home Manager generacijas?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" +"Visos generacijos jau tinkamos šiukšlių surinkimui (garbage collection)." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager yra išdiegtas, bet jūsų home.nix liko nepaliestas." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: nežinomas pasirinkimas „%s“" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Paleiskite „%s --help“, kad gautumėte naudojimosi instrukcijas" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations tikisi vieno argumento, gauta %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Nežinoma komanda: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Kuriama pradinė Home Manager konfigūracija..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Kuriama pradinė Home Manager generacija..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Viskas baigta! Įrankis home-manager turėtų būti įdiegtas ir dabar galite " +"redaguoti\n" +"\n" +". . . .%s\n" +"\n" +", kad konfigūruotumėte Home Manager. Paleiskite „man home-configuration.nix“," +"\n" +"jei norite pamatyti visus pasirinkimus." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" diff --git a/third_party/home-manager/home-manager/po/nb_NO.po b/third_party/home-manager/home-manager/po/nb_NO.po new file mode 100644 index 0000000000..4ab763af56 --- /dev/null +++ b/third_party/home-manager/home-manager/po/nb_NO.po @@ -0,0 +1,173 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2023-01-08 11:50+0000\n" +"Last-Translator: Petter K \n" +"Language-Team: Norwegian Bokmål \n" +"Language: nb_NO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.15.1-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Fant ingen oppsettsfil i %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Fant ikke noenoppsettsfil. Opprett en i %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Kan ikke inspisere alternativer for et flake-oppsett" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Kan ikke igangsette flak-oppsett" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Det er %d ulest og relevant nyhetselement.\n" +"Les det ved å kjøre kommandoen «%s news»." +msgstr[1] "" +"Det er %d uleste og relevant nyhetselementer.\n" +"Les det ved å kjøre kommandoen «%s news»." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Ukjent «news.display»-innstilling «%s»." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Sett «$EDITOR»-miljøvariabelen" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Kan ikke kjøre bygg i skrivebeskyttet mappe" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Ingen generering med ID-en %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Kan ikke fjerne nåværende generering %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Fjerner generering %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Ingen genereringer til utløp" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Ingen «home-manager»-pakker ser ut til å være installert." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Ukjent argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Dette vil fjerne Home Manager fra systemet ditt." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Dette er en testkjøring. Ingenting vil bli avinstallert." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Vil du avinstallere Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Bytter til tomt Home Manager-oppsett …" + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Hurra." + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Fjern alle Home Manager-genereringer?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Alle genereringer kan nå hentes av søppelinnsamling." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "Levner genereringer, men de kan fremdeles hentes av søppelinnsamling." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager er avinstallert, men din home.nix er levnet uforandret." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: ukjent alternativ «%s»" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Kjør «%s --help» for brukshjelp" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "«expire-generations» forventet ett argument, mottok %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Ukjent kommando: %s" + +#: home-manager/install.nix:22 +#, fuzzy +msgid "Creating initial Home Manager configuration..." +msgstr "Oppretter ny Home Manager-konfigurasjon..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Oppretter ny Home Manager-generasjon..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" diff --git a/third_party/home-manager/home-manager/po/nl.po b/third_party/home-manager/home-manager/po/nl.po new file mode 100644 index 0000000000..58c90c2608 --- /dev/null +++ b/third_party/home-manager/home-manager/po/nl.po @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-11-16 13:47+0000\n" +"Last-Translator: Pablo Bollansee \n" +"Language-Team: Dutch \n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.15-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Geen configuratiebestand gevonden op %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Geen configuratiebestand gevonden, maak er alstublieft een aan op %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Kan de opties van een flake configuratie niet inspecteren" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Het is niet gelukt om de vlok-configuratie te creëren" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Er is %d ongelezen and relevant nieuws artikel.\n" +"Lees het door het commando \"%s news\" uit te voeren." +msgstr[1] "" +"Er zijn %d ongelezen and relevante nieuws artikelen.\n" +"Lees ze door het commando \"%s news\" uit te voeren." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Onbekende \"new.display\" instelling \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Gelieve de $EDITOR omgevingsvariabele in te stellen" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Het is niet mogelijk om te bouwen in een read-only map" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Geen generatie met de ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Het is niet mogelijk om de huidige generatie %s te verwijderen" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Generatie %s aan het verwijderen" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Geen generatie om te beëindigen" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Er lijkt geen home-manager pakket geïnstalleerd te zijn." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Onbekend argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Dit zal Home Manager van jouw systeem verwijderen." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Dit is een oefening, niets wordt werkelijk geïnstalleerd." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Wilt u zeker Home Manager verwijderen?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Naar een lege Home Manager configuratie aan het veranderen..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Joepie!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Alle Home Manager generaties verwijderen?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Alle generaties zijn nu in aanmerking voor afvalinzameling." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "Generaties blijven momenteel bestaan maar worden later opgekuist." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager is verwijdert maar jouw home.nix is onaangeraakt." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: onbekende keuze '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Voer '%s --help' in om gebruiksinfo te zien" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations verwacht één argument, maar kreeg er %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Onbekende opdracht: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Initiële Home Manager configuratie aan het maken..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Initiële Home Manager generatie aan het maken..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Helemaal klaar! De home-manager tool zou nu geïnstalleerd moeten zijn en je " +"kan\n" +"\n" +" %s\n" +"\n" +"aanpassen om Home Manager te configureren. Draai 'man home-" +"configuration.nix' om\n" +"alle opties te zien." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Oh nee, de installatie is mislukt. Gelieve een ticket aan te maken in\n" +"\n" +" %s\n" +"\n" +"als de error de schuld van Home Manager lijkt te zijn." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Deze afleiding kan niet gebouwd worden, voer het alstublieft uit met nix-" +"shell." diff --git a/third_party/home-manager/home-manager/po/pl.po b/third_party/home-manager/home-manager/po/pl.po new file mode 100644 index 0000000000..4835b505e9 --- /dev/null +++ b/third_party/home-manager/home-manager/po/pl.po @@ -0,0 +1,191 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2021-12-29 08:48+0000\n" +"Last-Translator: Tomasz Czyż \n" +"Language-Team: Polish \n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.10.1\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Nie znaleziono pliku konfiguracyjnego %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Nie znaleziono pliku konfiguracyjnego. Proszę utworzyć plik %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Nie mogę sprawdzić konfiguracji flake'a" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Nie mogę zinstancjować konfiguracji flake'a" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Jest %d nieodczytana wiadomość.\n" +"Możesz ją odczytać uruchamiając „%s news”." +msgstr[1] "" +"Jest %d nieodczytanych wiadomości.\n" +"Możesz je odczytać uruchamiając „%s news”." +msgstr[2] "" +"Jest %d nieodczytanych wiadomości.\n" +"Możesz je odczytać uruchamiając „%s news”." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Nieznane ustawienie „%s” „news.display”." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Proszę ustawić zmienną środowiskową $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Nie mogę uruchomić budowania w katalogu tylko-do-odczytu" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Brak generacji z ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Nie mogę usunąć bieżącej generacji %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Usuwanie generacji %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Brak wygasających generacji" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Pakiety home-manager nie wydają się być zainstalowane." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Nieznany argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "To usunie Home Managera z twojego systemu." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "To jest próba, faktycznie nic nie będzie usunięte." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Jesteś pewien usunięcia Home Managera?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Przełączanie do pustej konfiguracji Home Managera..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Jej!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Usunąć wszystkie generacje Home Managera?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" +"Wszystkie generacje są uwzględnione przy oczyszczaniu (garbage collection)." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Zostawiam generacje ale wciąż mogą zostać usunięte (garbage collection)." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" +"Home Manager jest usunięty ale twój home.nix jest pozostawiony nietknięty." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: nieznana opcja „%s”" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Uruchom „%s --help” by otrzymać pomoc" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations oczekuje jednego argumentu, otrzymane %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Nieznana komenda: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Tworzenie pierwotnej konfiguracji Home Managera..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Tworzenie pierwotnej generacji Home Managera..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Skończone! Narzędzie home-manager powinno być zainstalowane i może edytować\n" +"\n" +" %s\n" +"\n" +"by skonfigurować Home Managera. Uruchom „man home-configuration.nix” aby\n" +"sprawdzić wszystkie możliwe opcje konfiguracyjne." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Ojoj, instalacja nie powiodła się! Proszę opisz problem na\n" +"\n" +" %s\n" +"\n" +"jeśli myślisz, że problem spowodowany jest przez błąd Home Managera." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Ta paczka (derivation) nie da się budować, proszę uruchom używając nix-shell." diff --git a/third_party/home-manager/home-manager/po/pt_BR.po b/third_party/home-manager/home-manager/po/pt_BR.po new file mode 100644 index 0000000000..de2fb70567 --- /dev/null +++ b/third_party/home-manager/home-manager/po/pt_BR.po @@ -0,0 +1,188 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-04-04 11:11+0000\n" +"Last-Translator: Alex Miranda \n" +"Language-Team: Portuguese (Brazil) \n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Nenhum arquivo de configuração encontrado no %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Arquivo de configuração não encontrado. Por favor crie um em %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Não é possivel inspecionar a opção de configuração do flake" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Não foi possível instanciar a configuração de flake" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Há %d novo item relevante não lido\n" +"Leia executando o comando \"%s news\"." +msgstr[1] "" +"Há %d novos itens relevants não lidos\n" +"Leia executando o comando \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Valor \"%s\" para configuração \"news.display\" não reconhecido." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Por favor defina a variável de ambiente $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Não é possível fazer o build em um diretório somente leitura" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Nenhuma geração com ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Não foi possível remover a geração atual %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Removendo geração %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Nenhuma geração a expirar" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Nenhum pacote parece instalado com home-manager." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Argumento desconhecido %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Isso irá remover o Home Manager do seu sistema." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Essa é uma execução de teste, nada de fato será desinstalado." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Confirma a desinstalação do Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Trocando para configuração vazia do Home Manager..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Boa!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Remover todas as gerações do Home Manager?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Todas gerações agora são elegíveis para coleta do garbage collector." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Deixando gerações, entretanto elas ainda poderão ser limpas pelo garbage " +"collector." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager foi desinstalado, mas o seu home.nix foi deixado intacto." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: opção não reconhecida '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Execute '%s --help' para instruções de uso" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations espera um argumento, recebeu %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Comando não reconhecido: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Criando a configuração inicial do Home Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Criando a geração inicial do Home Manager..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Pronto! O home-manager deve ser instalado agora e você poderá editar o " +"arquivo\n" +"\n" +" %s\n" +"\n" +"para configurar o Home Manager. Execute 'man home-configuration.nix' para\n" +"ver todas as opções disponíveis." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Ixi, a instalação falhou! Por favor crie um issue no\n" +"\n" +" %s\n" +"\n" +"se o erro lhe parecer ser um problema do Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"O build dessa derivation não pode ser feito, por favor rode usando o nix-" +"shell." diff --git a/third_party/home-manager/home-manager/po/ru.po b/third_party/home-manager/home-manager/po/ru.po new file mode 100644 index 0000000000..05378c0fe5 --- /dev/null +++ b/third_party/home-manager/home-manager/po/ru.po @@ -0,0 +1,188 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2021-12-21 19:55+0000\n" +"Last-Translator: Mikhail Chekan \n" +"Language-Team: Russian \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.10\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Не найден файл конфигурации в %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Не найден файл конфигурации. Пожалуйста, создайте его в %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Не могу получить опции для flake-конфигурации" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Не могу создать экземляр для flake-конфигурации" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"У вас есть %d непрочитанная и релевантная новость.\n" +"Прочтите её, выполнив команду \"%s news\"." +msgstr[1] "" +"У вас есть %d непрочитанные и релевантные новости.\n" +"Прочтите их, выполнив команду \"%s news\"." +msgstr[2] "" +"У вас есть %d непрочитанных и релевантных новостей.\n" +"Прочтите их, выполнив команду \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Неизвестное значение \"news.display\": \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Пожалуйста, определите переменную среды $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Не могу начать сборку в директории, защищённой от записи" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Поколение под номером %s не существует" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Не могу удалить текущее поколение %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Удаляю поколение %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Нет поколений, которые можно просрочить" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Не обнаружено пакетов, установленных через home-manager." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Неизвестный аргумент %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Это удалит Home Manager из вашей системы." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Это пробный запуск, на самом деле ничего не удаляется." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Действительно хотите удалить Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Переключаюсь на пустую конфигурацию Home Manager..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Ура!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Удалить все поколения Home Manager?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Теперь все поколения готовы к удалению сборщиком мусора." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "Поколения остаются, но их ещё можно удалить сборщиком мусора." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager удалён, но ваш home.nix остался нетронутым." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: неизвестная опция '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Выполните '%s --help', чтобы получить справку" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations требует один аргумент, но передано %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Неизвестная команда: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Создаю начальную конфигурацию Home Manager..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Создаю начальное поколение Home Manager..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Готово! Теперь вам должна быть доступна утилита home-manager,\n" +"и вы можете отредактировать настройки в файле\n" +"\n" +" %s\n" +"\n" +"Выполните 'man home-configuration.nix', чтобы увидеть доступные опции." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Ой, установка не удалась! Пожалуйста, создайте тему в багтрекере\n" +"\n" +" %s\n" +"\n" +"если считаете, что в ошибке виноват Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Это определение нельзя собрать. Пожалуйста, запустите его через nix-shell." diff --git a/third_party/home-manager/home-manager/po/sv.po b/third_party/home-manager/home-manager/po/sv.po new file mode 100644 index 0000000000..6ca1fc7f94 --- /dev/null +++ b/third_party/home-manager/home-manager/po/sv.po @@ -0,0 +1,183 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2021-12-17 20:50+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Swedish \n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.10\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Det finns ingen konfigurationsfil i %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Hittade ingen konfigurationsfil. Skapa en i %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Kan inte granska alternativ i en flake-konfiguration" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Kan inte instansera en flake-konfiguration" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Det finns %d oläst och relevant nyhet.\n" +"Läs den genom att köra kommandot \"%s news\"." +msgstr[1] "" +"Det finns %d olästa och relevanta nyheter.\n" +"Läs dem genom att köra kommandot \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Okänt \"news.display\"-värde \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Vänligen tilldela miljövariablen $EDITOR" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Kan inte bygga i katalog med bara läsrättigheter" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Ingen generation med ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Kan inte ta bort nuvarande generation %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Tar bort generation %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Ingen generation att förfalla" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Paketet home-manager verkar inte vara installerat." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Okänt argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Detta kommer att ta bort Home Manager från ditt system." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Detta är en testkörning, inget kommer att bli avinstallerat." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Verkligen avinstallera Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Byter till tom Home Manager-konfiguration..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Hurra!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Ta bort alla Home Manager-generationer?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Alla generationer kan nu skräpsamlas." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "Låter generationer vara kvar men de kan fortfarande skräpsamlas." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager är avinstallerad men din home.nix är orörd." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: okänt val '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Kör '%s --help' för användarhjälp" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expect-generations förväntar sig ett argument, fick %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Okänt kommando: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Skapar initial Home Manager-konfiguration..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Skapar initial Home Manager-generation..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Färdig! Verktyget home-manager borde nu vara installerat och du kan editera\n" +"\n" +" %s\n" +"\n" +"för att konfigurera Home Manager. Kör 'man home-configuration.nix' för\n" +"att se alla tillgängliga alternativ." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Ajdå, installationen misslyckades! Skapa gärna en rapport på\n" +"\n" +" %s\n" +"\n" +"om problemet verkar bero på något Home Manager gör fel." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "Denna derivation är inte byggbar, kör den med nix-shell istället." diff --git a/third_party/home-manager/home-manager/po/tr.po b/third_party/home-manager/home-manager/po/tr.po new file mode 100644 index 0000000000..fade64173d --- /dev/null +++ b/third_party/home-manager/home-manager/po/tr.po @@ -0,0 +1,186 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Oğuz Ersen \n" +"Language-Team: Turkish \n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "%s konumunda yapılandırma dosyası bulunamadı" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "" +"Yapılandırma dosyası bulunamadı. Lütfen %s konumunda bir tane oluşturun" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Flake yapılandırmasının ayarları incelenemiyor" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Flake yapılandırması örneklendirilemiyor" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"%d tane okunmamış ilgili haber bulunmakta.\n" +"Okumak için \"%s news\"." +msgstr[1] "" +"%d tane okunmamış ilgili haberler bulunmakta.\n" +"Okumak için \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Bilinmeyen \"news.display\" seçeneği \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Lütfen $EDITOR ortam değişkenini tanımlayın" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "İnşa, sadece okunabilir bir klasörde çalıştırılamaz" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "%s ID'sine sahip inşa bulunamadı" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Kullanımda olan %s inşası silinemez" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "İnşa siliniyor %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Süresi dolacak inşa yok" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "Galiba home-manager paketi kurulu değil." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Bilinmeyen argüman %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Bu, sisteminizden Home Manager'ı kaldıracak." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Bu sadece bir inşa denemesi, hiçbir şey silinmeyecek." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Home Manager'ı silmek istediğinize emin misiniz?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Boş Home Manager yapılandırmasına geçiliyor..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Güzel!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Tüm Home Manager inşaları kaldırılsın mı?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Artık tüm inşalar çöp olarak toplanabilir." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "İnşalar yine de çöp olarak toplanabilir." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager kaldırıldı ama home.nix dosyasına dokunulmadı." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: Bilinmeyen komut '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Yardım için '%s --help'" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations bir argüman istiyor, %d tane girildi." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Bilinmeyen komut: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "İlk Home Manager yapılandırması oluşturuluyor..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "İlk Home Manager inşası oluşturuluyor..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Herşey tamam! home-manager aracı kuruldu. Home Manager'ı yapılandırmak için\n" +"\n" +" %s\n" +"\n" +"dosyasını düzenleyin. Kullanılabilir seçenekleri görmek için:\n" +"'man home-configuration.nix'." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Eyvah, kurulum başarısız! Eğer hatanın Home Manager'dan kaynaklandığını " +"düşünüyorsanız\n" +"\n" +" %s\n" +"\n" +"adresinden bildirin." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" +"Bu türetim inşa edilebilir değil, lütfen onu nix-shell kullanarak çalıştırın." diff --git a/third_party/home-manager/home-manager/po/zh_Hans.po b/third_party/home-manager/home-manager/po/zh_Hans.po new file mode 100644 index 0000000000..b3de7b2b73 --- /dev/null +++ b/third_party/home-manager/home-manager/po/zh_Hans.po @@ -0,0 +1,180 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2021-12-28 12:41+0000\n" +"Last-Translator: WhiredPlanck \n" +"Language-Team: Chinese (Simplified) \n" +"Language: zh_Hans\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.10.1\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "未在 %s 找到配置文件" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "未找到配置文件。请在 %s 处创建一份" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "无法检查 flake 配置中的选项" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "无法创建 flake 配置实例" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"有 %d 条未读的相关新闻或消息。\n" +"可运行 “%s news” 命令进行阅读。" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "未知的 “news.display” 设置项 “%s”。" + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "请设定 $EDITOR 环境变量" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "无法在只读目录中运行构建" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "没有 ID 为 %s 的世代" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "无法移除当前世代 %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "正在移除世代 %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "没有即将过期的世代" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "似乎没有安装 home-manager 软件包。" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "未知参数 %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "这将会从系统中移除 Home Manager。" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "这是试运行结果,没有实际卸载任何软件包。" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "确定要卸载 Home Manager 吗?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "正在切换至空的 Home Manager 配置 ..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "好耶!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "要移除所有 Home Manager 配置世代吗?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "所有世代现在均符合垃圾回收的条件。" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "保留世代,但它们仍然可能被垃圾回收。" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager 已卸载,但未改动您的 home.nix 配置文件。" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s:未知选项 ‘%s’" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "运行 ‘%s --help’ 获取用法帮助" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations 须要一个参数,但获取到了 %d 个。" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "未知命令:%s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "正在创建初始 Home Manager 配置 ..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "正在创建初始 Home Manager 世代 ..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"全部工作完成了!home-manager 工具现应已安装,您可以编辑\n" +"\n" +" %s\n" +"\n" +"来配置 Home Manager。运行 ‘man home-configuration.nix’\n" +"来查看所有可用选项。" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"啊哦,安装失败了!如果感觉是 Home Manager 造成的错误,请在下方\n" +"\n" +" %s\n" +"\n" +"处创建 Issue 告知我们。" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "此配置文件/变体不可构建,请在 nix-shell 中运行它。" diff --git a/third_party/home-manager/home-manager/po/zh_Hant.po b/third_party/home-manager/home-manager/po/zh_Hant.po new file mode 100644 index 0000000000..917f053e9c --- /dev/null +++ b/third_party/home-manager/home-manager/po/zh_Hant.po @@ -0,0 +1,180 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2021-12-29 08:48+0000\n" +"Last-Translator: WhiredPlanck \n" +"Language-Team: Chinese (Traditional) \n" +"Language: zh_Hant\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.10.1\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "未在 %s 處找到配置檔案" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "未找到配置檔案。請在 %s 處建立一份" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "無法檢查 flake 配置中的選項" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "無法建立 flake 配置例項" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"有 %d 條未讀的相關新聞或訊息。\n" +"可執行 “%s news” 命令進行閱讀。" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "未知的 “news.display” 設定項 “%s”。" + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "請設定 $EDITOR 環境變數" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "無法在只讀目錄中執行構建" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "沒有 ID 為 %s 的世代" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "無法移除當前世代 %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "正在移除世代 %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "沒有即將過期的世代" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "似乎沒有安裝 home-manager 軟體包。" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "未知引數 %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "這將會從系統中移除 Home Manager。" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "這是試執行結果,沒有實際解除安裝任何軟體包。" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "確定要解除安裝 Home Manager 嗎?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "正在切換至空的 Home Manager 配置 ..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "好耶!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "要移除所有 Home Manager 配置世代嗎?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "所有世代現在均符合垃圾回收的條件。" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "保留世代,但它們仍然可能被垃圾回收。" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "Home Manager 已解除安裝,但未改動您的 home.nix 配置檔案。" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s:未知選項 ‘%s’" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "執行 ‘%s --help’ 獲取用法幫助" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations 須要一個引數,但獲取到了 %d 個。" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "未知命令:%s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "正在建立初始 Home Manager 配置 ..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "正在建立初始 Home Manager 世代 ..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"全部工作完成了!home-manager 工具現應已安裝,您可以編輯\n" +"\n" +" %s\n" +"\n" +"來配置 Home Manager。執行 ‘man home-configuration.nix’\n" +"來檢視所有可用選項。" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"啊哦,安裝失敗了!如果感覺是 Home Manager 造成的錯誤,請在下方\n" +"\n" +" %s\n" +"\n" +"處建立 Issue 告知我們。" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "此配置檔案/變體不可構建,請在 nix-shell 中執行它。" diff --git a/third_party/home-manager/lib/bash/home-manager.sh b/third_party/home-manager/lib/bash/home-manager.sh new file mode 100644 index 0000000000..b7f3f42b28 --- /dev/null +++ b/third_party/home-manager/lib/bash/home-manager.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# +# This file contains a number of utilities for use by the home-manager tool and +# the generated Home Manager activation scripts. No guarantee is made about +# backwards or forward compatibility. +# + +# Sets up colors suitable for the `errorEcho`, `warnEcho`, and `noteEcho` +# functions. +# +# The check for terminal output and color support is heavily inspired by +# https://unix.stackexchange.com/a/10065. +# +# The setup respects the `NO_COLOR` environment variable. +function setupColors() { + normalColor="" + errorColor="" + warnColor="" + noteColor="" + + # Enable colors for terminals, and allow opting out. + if [[ ! -v NO_COLOR && -t 1 ]]; then + # See if it supports colors. + local ncolors + ncolors=$(tput colors 2> /dev/null || echo 0) + + if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then + normalColor="$(tput sgr0)" + errorColor="$(tput bold)$(tput setaf 1)" + warnColor="$(tput setaf 3)" + noteColor="$(tput bold)$(tput setaf 6)" + fi + fi +} + +setupColors + +function errorEcho() { + echo "${errorColor}$*${normalColor}" +} + +function warnEcho() { + echo "${warnColor}$*${normalColor}" +} + +function noteEcho() { + echo "${noteColor}$*${normalColor}" +} + +function _i() { + local msgid="$1" + shift + + # shellcheck disable=2059 + printf "$(gettext "$msgid")\n" "$@" +} + +function _ip() { + local msgid="$1" + local msgidPlural="$2" + local count="$3" + shift 3 + + # shellcheck disable=2059 + printf "$(ngettext "$msgid" "$msgidPlural" "$count")\n" "$@" +} + +function _iError() { + echo -n "${errorColor}" + _i "$@" + echo -n "${normalColor}" +} + +function _iWarn() { + echo -n "${warnColor}" + _i "$@" + echo -n "${normalColor}" +} + +function _iNote() { + echo -n "${noteColor}" + _i "$@" + echo -n "${normalColor}" +} diff --git a/third_party/home-manager/modules/accounts/email.nix b/third_party/home-manager/modules/accounts/email.nix index e48024e023..2d158a212a 100644 --- a/third_party/home-manager/modules/accounts/email.nix +++ b/third_party/home-manager/modules/accounts/email.nix @@ -44,6 +44,28 @@ let ''; }; + delimiter = mkOption { + type = types.str; + default = '' + -- + ''; + example = literalExpression '' + ~*~*~*~*~*~*~*~*~*~*~*~ + ''; + description = '' + The delimiter used between the document and the signature. + ''; + }; + + command = mkOption { + type = with types; nullOr path; + default = null; + example = literalExpression '' + pkgs.writeScript "signature" "echo This is my signature" + ''; + description = "A command that generates a signature."; + }; + showSignature = mkOption { type = types.enum [ "append" "attach" "none" ]; default = "none"; @@ -114,6 +136,38 @@ let }; }; + jmapModule = types.submodule { + options = { + host = mkOption { + type = types.nullOr types.str; + default = null; + example = "jmap.example.org"; + description = '' + Hostname of JMAP server. + + If both this option and are specified, + host is preferred by applications when establishing a + session. + ''; + }; + + sessionUrl = mkOption { + type = types.nullOr types.str; + default = null; + example = "https://jmap.example.org:443/.well-known/jmap"; + description = '' + URL for the JMAP Session resource. + + If both this option and are specified, + host is preferred by applications when establishing a + session. + ''; + }; + }; + }; + smtpModule = types.submodule { options = { host = mkOption { @@ -188,7 +242,14 @@ let }; flavor = mkOption { - type = types.enum [ "plain" "gmail.com" "runbox.com" "fastmail.com" ]; + type = types.enum [ + "plain" + "gmail.com" + "runbox.com" + "fastmail.com" + "yandex.com" + "outlook.office365.com" + ]; default = "plain"; description = '' Some email providers have peculiar behavior that require @@ -196,7 +257,7 @@ let indicate the nature of the provider. When this indicates a specific provider then, for example, - the IMAP and SMTP server configuration may be set + the IMAP, SMTP, and JMAP server configuration may be set automatically. ''; }; @@ -225,7 +286,7 @@ let default = null; description = '' The server username of this account. This will be used as - the SMTP and IMAP user name. + the SMTP, IMAP, and JMAP user name. ''; }; @@ -290,6 +351,14 @@ let ''; }; + jmap = mkOption { + type = types.nullOr jmapModule; + default = null; + description = '' + The JMAP configuration to use for this account. + ''; + }; + signature = mkOption { type = signatureModule; default = { }; @@ -328,17 +397,61 @@ let name = name; maildir = 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; - smtp = { - host = "smtp.fastmail.com"; - port = if config.smtp.tls.useStartTls then 587 else 465; - }; + 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 == "gmail.com") { userName = mkDefault config.address; diff --git a/third_party/home-manager/modules/config/home-cursor.nix b/third_party/home-manager/modules/config/home-cursor.nix new file mode 100644 index 0000000000..a246773693 --- /dev/null +++ b/third_party/home-manager/modules/config/home-cursor.nix @@ -0,0 +1,156 @@ +{ config, options, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.home.pointerCursor; + + pointerCursorModule = types.submodule { + options = { + package = mkOption { + type = types.package; + example = literalExpression "pkgs.vanilla-dmz"; + description = "Package providing the cursor theme."; + }; + + name = mkOption { + type = types.str; + example = "Vanilla-DMZ"; + description = "The cursor name within the package."; + }; + + size = mkOption { + type = types.int; + default = 32; + example = 64; + description = "The cursor size."; + }; + + x11 = { + enable = mkEnableOption '' + x11 config generation for + ''; + + defaultCursor = mkOption { + type = types.str; + default = "left_ptr"; + example = "X_cursor"; + description = "The default cursor file to use within the package."; + }; + }; + + gtk = { + enable = mkEnableOption '' + gtk config generation for + ''; + }; + }; + }; + + cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${ + escapeShellArg cfg.x11.defaultCursor + }"; + +in { + meta.maintainers = [ maintainers.polykernel 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" + ]) + + ({ ... }: { + 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. + ''; + }) + ]; + + options = { + home.pointerCursor = mkOption { + type = types.nullOr pointerCursorModule; + default = null; + description = '' + Cursor configuration. Set to null to disable. + + Top-level options declared under this submodule are backend indepedent + options. Options declared under namespaces such as x11 + are backend specific options. By default, only backend independent cursor + configurations are generated. If you need configurations for specific + backends, you can toggle them via the enable option. For example, + + will enable x11 cursor configurations. + ''; + }; + }; + + config = mkIf (cfg != null) (mkMerge [ + { + assertions = [ + (hm.assertions.assertPlatform "home.pointerCursor" pkgs platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + # Set name in icons theme, for compatibility with AwesomeWM etc. See: + # https://github.com/nix-community/home-manager/issues/2081 + # https://wiki.archlinux.org/title/Cursor_themes#XDG_specification + home.file.".icons/default/index.theme".text = '' + [icon theme] + Name=Default + Comment=Default Cursor Theme + Inherits=${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.sessionVariables = { + XCURSOR_PATH = mkDefault ("$XCURSOR_PATH\${XCURSOR_PATH:+:}" + + "${config.home.profileDirectory}/share/icons"); + }; + } + + (mkIf cfg.x11.enable { + xsession.initExtra = '' + ${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${ + toString cfg.size + } + ''; + + xresources.properties = { + "Xcursor.theme" = cfg.name; + "Xcursor.size" = cfg.size; + }; + }) + + (mkIf cfg.gtk.enable { + gtk.cursorTheme = mkDefault { inherit (cfg) package name size; }; + }) + ]); +} diff --git a/third_party/home-manager/modules/default.nix b/third_party/home-manager/modules/default.nix index a138dc2c94..02be152fdd 100644 --- a/third_party/home-manager/modules/default.nix +++ b/third_party/home-manager/modules/default.nix @@ -21,7 +21,7 @@ let in fold f res res.config.warnings; - extendedLib = import ./lib/stdlib-extended.nix pkgs.lib; + extendedLib = import ./lib/stdlib-extended.nix lib; hmModules = import ./modules.nix { @@ -61,4 +61,6 @@ in sort (a: b: a.time > b.time) ( filter (a: a.condition) rawModule.config.news.entries ); + + inherit (module._module.args) pkgs; } diff --git a/third_party/home-manager/modules/files.nix b/third_party/home-manager/modules/files.nix index d6b5eb6433..daeeb0b1f9 100644 --- a/third_party/home-manager/modules/files.nix +++ b/third_party/home-manager/modules/files.nix @@ -80,7 +80,7 @@ in (filterAttrs (n: v: v.force) cfg)); check = pkgs.writeText "check" '' - . ${./lib-bash/color-echo.sh} + ${config.lib.bash.initHomeManagerLib} # A symbolic link whose target path matches this pattern will be # considered part of a Home Manager generation. @@ -185,14 +185,15 @@ in $VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'" else # Place that symlink, --force + # This can still fail if the target is a directory, in which case we bail out. $DRY_RUN_CMD mkdir -p $VERBOSE_ARG "$(dirname "$targetPath")" - $DRY_RUN_CMD ln -nsf $VERBOSE_ARG "$sourcePath" "$targetPath" + $DRY_RUN_CMD ln -Tsf $VERBOSE_ARG "$sourcePath" "$targetPath" || exit 1 fi done ''; cleanup = pkgs.writeShellScript "cleanup" '' - . ${./lib-bash/color-echo.sh} + ${config.lib.bash.initHomeManagerLib} # A symbolic link whose target path matches this pattern will be # considered part of a Home Manager generation. @@ -230,7 +231,7 @@ in in '' function linkNewGen() { - echo "Creating home file links in $HOME" + _i "Creating home file links in %s" "$HOME" local newGenFiles newGenFiles="$(readlink -e "$newGenPath/home-files")" @@ -239,11 +240,11 @@ in } function cleanOldGen() { - if [[ ! -v oldGenPath ]] ; then + if [[ ! -v oldGenPath || ! -e "$oldGenPath/home-files" ]] ; then return fi - echo "Cleaning up orphan links from $HOME" + _i "Cleaning up orphan links from %s" "$HOME" local newGenFiles oldGenFiles newGenFiles="$(readlink -e "$newGenPath/home-files")" @@ -259,11 +260,21 @@ in cleanOldGen if [[ ! -v oldGenPath || "$oldGenPath" != "$newGenPath" ]] ; then - echo "Creating profile generation $newGenNum" - $DRY_RUN_CMD nix-env $VERBOSE_ARG --profile "$genProfilePath" --set "$newGenPath" + _i "Creating profile generation %s" $newGenNum + if [[ -e "$genProfilePath"/manifest.json ]] ; then + # Remove all packages from "$genProfilePath" + # `nix profile remove '.*' --profile "$genProfilePath"` was not working, so here is a workaround: + nix profile list --profile "$genProfilePath" \ + | cut -d ' ' -f 4 \ + | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG --profile "$genProfilePath" + $DRY_RUN_CMD nix profile install $VERBOSE_ARG --profile "$genProfilePath" "$newGenPath" + else + $DRY_RUN_CMD nix-env $VERBOSE_ARG --profile "$genProfilePath" --set "$newGenPath" + fi + $DRY_RUN_CMD ln -Tsf $VERBOSE_ARG "$newGenPath" "$newGenGcPath" else - echo "No change so reusing latest profile generation $oldGenNum" + _i "No change so reusing latest profile generation %s" "$oldGenNum" fi linkNewGen diff --git a/third_party/home-manager/modules/home-environment.nix b/third_party/home-manager/modules/home-environment.nix index dd8b9817f1..098e10b21c 100644 --- a/third_party/home-manager/modules/home-environment.nix +++ b/third_party/home-manager/modules/home-environment.nix @@ -256,7 +256,7 @@ in home.sessionVariables = mkOption { default = {}; - type = types.attrs; + type = with types; lazyAttrsOf (oneOf [ str path int float ]); example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; }; description = '' Environment variables to always set at login. @@ -346,12 +346,18 @@ in home.emptyActivationPath = mkOption { internal = true; - default = false; type = types.bool; + default = versionAtLeast stateVersion "22.11"; + defaultText = literalExpression '' + false for state version < 22.11, + true for state version ≥ 22.11 + ''; description = '' Whether the activation script should start with an empty - PATH variable. When false - then the user's PATH will be used. + PATH variable. When false then the + user's PATH will be accessible in the script. It is + recommended to keep this at true to avoid + uncontrolled use of tools found in PATH. ''; }; @@ -383,7 +389,7 @@ in unexpected state is found. For example, the checkLinkTargets script block checks for collisions between non-managed files and files defined in - home.file. + . @@ -578,37 +584,78 @@ in if config.submoduleSupport.externalPackageInstall then '' - if nix-env -q | grep '^home-manager-path$'; then - $DRY_RUN_CMD nix-env -e home-manager-path + if [[ -e "$nixProfilePath"/manifest.json ]] ; then + nix profile list \ + | { grep 'home-manager-path$' || test $? = 1; } \ + | cut -d ' ' -f 4 \ + | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG + else + if nix-env -q | grep '^home-manager-path$'; then + $DRY_RUN_CMD nix-env -e home-manager-path + fi fi '' else '' - if ! $DRY_RUN_CMD nix-env -i ${cfg.path} ; then - cat < $out/hm-version + cp ${activationScript} $out/activate mkdir $out/bin diff --git a/third_party/home-manager/modules/i18n/input-method/fcitx5.nix b/third_party/home-manager/modules/i18n/input-method/fcitx5.nix index 9211d0b7ef..78eb970838 100644 --- a/third_party/home-manager/modules/i18n/input-method/fcitx5.nix +++ b/third_party/home-manager/modules/i18n/input-method/fcitx5.nix @@ -24,6 +24,7 @@ in { i18n.inputMethod.package = fcitx5Package; home.sessionVariables = { + GLFW_IM_MODULE = "ibus"; # IME support in kitty GTK_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx"; XMODIFIERS = "@im=fcitx"; diff --git a/third_party/home-manager/modules/i18n/input-method/kime.nix b/third_party/home-manager/modules/i18n/input-method/kime.nix index 4a84768e72..70f3219001 100644 --- a/third_party/home-manager/modules/i18n/input-method/kime.nix +++ b/third_party/home-manager/modules/i18n/input-method/kime.nix @@ -48,11 +48,12 @@ in { replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config); systemd.user.services.kime-daemon = { - Unit = { Description = "Kime input method editor"; }; - PartOf = [ "graphical-session.target" ]; + Unit = { + Description = "Kime input method editor"; + PartOf = [ "graphical-session.target" ]; + }; Service.ExecStart = "${pkgs.kime}/bin/kime"; Install.WantedBy = [ "graphical-session.target" ]; }; }; - } diff --git a/third_party/home-manager/modules/launchd/default.nix b/third_party/home-manager/modules/launchd/default.nix new file mode 100644 index 0000000000..34fefc1751 --- /dev/null +++ b/third_party/home-manager/modules/launchd/default.nix @@ -0,0 +1,213 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + inherit (pkgs.stdenv.hostPlatform) isDarwin; + inherit (lib.generators) toPlist; + + cfg = config.launchd; + labelPrefix = "org.nix-community.home."; + dstDir = "${config.home.homeDirectory}/Library/LaunchAgents"; + + launchdConfig = { config, name, ... }: { + options = { + enable = mkEnableOption name; + config = mkOption { + type = types.submodule (import ./launchd.nix); + default = { }; + example = literalExpression '' + { + ProgramArguments = [ "/usr/bin/say" "Good afternoon" ]; + StartCalendarInterval = { + Hour = 12; + Minute = 0; + }; + } + ''; + description = '' + Define a launchd job. See + launchd.plist5 + for details. + ''; + }; + }; + + config = { config.Label = mkDefault "${labelPrefix}${name}"; }; + }; + + toAgent = config: pkgs.writeText "${config.Label}.plist" (toPlist { } config); + + agentPlists = + mapAttrs' (n: v: nameValuePair "${v.config.Label}.plist" (toAgent v.config)) + (filterAttrs (n: v: v.enable) cfg.agents); + + agentsDrv = pkgs.runCommand "home-manager-agents" { } '' + mkdir -p "$out" + + declare -A plists + plists=(${ + concatStringsSep " " + (mapAttrsToList (name: value: "['${name}']='${value}'") agentPlists) + }) + + for dest in "''${!plists[@]}"; do + src="''${plists[$dest]}" + ln -s "$src" "$out/$dest" + done + ''; +in { + meta.maintainers = with maintainers; [ midchildan ]; + + options.launchd = { + enable = mkOption { + type = types.bool; + default = isDarwin; + defaultText = literalExpression "pkgs.stdenv.hostPlatform.isDarwin"; + description = '' + Whether to enable Home Manager to define per-user daemons by making use + of launchd's LaunchAgents. + ''; + }; + + agents = mkOption { + type = with types; attrsOf (submodule launchdConfig); + default = { }; + description = "Define LaunchAgents."; + }; + }; + + config = mkMerge [ + { + assertions = [{ + assertion = (cfg.enable && agentPlists != { }) -> isDarwin; + message = let names = lib.concatStringsSep ", " (attrNames agentPlists); + in "Must use Darwin for modules that require Launchd: " + names; + }]; + } + + (mkIf isDarwin { + home.extraBuilderCommands = '' + ln -s "${agentsDrv}" $out/LaunchAgents + ''; + + home.activation.checkLaunchAgents = + hm.dag.entryBefore [ "writeBoundary" ] '' + checkLaunchAgents() { + local oldDir newDir dstDir err + oldDir="" + err=0 + if [[ -n "''${oldGenPath:-}" ]]; then + oldDir="$(readlink -m "$oldGenPath/LaunchAgents")" || err=$? + if (( err )); then + oldDir="" + fi + fi + newDir=${escapeShellArg agentsDrv} + dstDir=${escapeShellArg dstDir} + + local oldSrcPath newSrcPath dstPath agentFile agentName + + find -L "$newDir" -maxdepth 1 -name '*.plist' -type f -print0 \ + | while IFS= read -rd "" newSrcPath; do + agentFile="''${newSrcPath##*/}" + agentName="''${agentFile%.plist}" + dstPath="$dstDir/$agentFile" + oldSrcPath="$oldDir/$agentFile" + + if [[ ! -e "$dstPath" ]]; then + continue + fi + + if ! cmp --quiet "$oldSrcPath" "$dstPath"; then + errorEcho "Existing file '$dstPath' is in the way of '$newSrcPath'" + exit 1 + fi + done + } + + checkLaunchAgents + ''; + + # NOTE: Launch Agent configurations can't be symlinked from the Nix store + # because it needs to be owned by the user running it. + home.activation.setupLaunchAgents = + hm.dag.entryAfter [ "writeBoundary" ] '' + setupLaunchAgents() { + local oldDir newDir dstDir domain err + oldDir="" + err=0 + if [[ -n "''${oldGenPath:-}" ]]; then + oldDir="$(readlink -m "$oldGenPath/LaunchAgents")" || err=$? + if (( err )); then + oldDir="" + fi + fi + newDir="$(readlink -m "$newGenPath/LaunchAgents")" + dstDir=${escapeShellArg dstDir} + domain="gui/$UID" + err=0 + + local srcPath dstPath agentFile agentName i bootout_retries + bootout_retries=10 + + find -L "$newDir" -maxdepth 1 -name '*.plist' -type f -print0 \ + | while IFS= read -rd "" srcPath; do + agentFile="''${srcPath##*/}" + agentName="''${agentFile%.plist}" + dstPath="$dstDir/$agentFile" + + if cmp --quiet "$srcPath" "$dstPath"; then + continue + fi + if [[ -f "$dstPath" ]]; then + for (( i = 0; i < bootout_retries; i++ )); do + $DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || err=$? + if [[ -v DRY_RUN ]]; then + break + fi + if (( err != 9216 )) && + ! /bin/launchctl print "$domain/$agentName" &> /dev/null; then + break + fi + sleep 1 + done + if (( i == bootout_retries )); then + warnEcho "Failed to stop '$domain/$agentName'" + return 1 + fi + fi + $DRY_RUN_CMD install -Dm444 -T "$srcPath" "$dstPath" + $DRY_RUN_CMD /bin/launchctl bootstrap "$domain" "$dstPath" + done + + if [[ ! -e "$oldDir" ]]; then + return + fi + + find -L "$oldDir" -maxdepth 1 -name '*.plist' -type f -print0 \ + | while IFS= read -rd "" srcPath; do + agentFile="''${srcPath##*/}" + agentName="''${agentFile%.plist}" + dstPath="$dstDir/$agentFile" + if [[ -e "$newDir/$agentFile" ]]; then + continue + fi + + $DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || : + if [[ ! -e "$dstPath" ]]; then + continue + fi + if ! cmp --quiet "$srcPath" "$dstPath"; then + warnEcho "Skipping deletion of '$dstPath', since its contents have diverged" + continue + fi + $DRY_RUN_CMD rm -f $VERBOSE_ARG "$dstPath" + done + } + + setupLaunchAgents + ''; + }) + ]; +} diff --git a/third_party/home-manager/modules/launchd/launchd.nix b/third_party/home-manager/modules/launchd/launchd.nix new file mode 100644 index 0000000000..2e0e65859d --- /dev/null +++ b/third_party/home-manager/modules/launchd/launchd.nix @@ -0,0 +1,872 @@ +# launchd option type from nix-darwin +# +# Original Source: +# https://github.com/LnL7/nix-darwin/blob/a34dea2/modules/launchd/launchd.nix + +# Copyright 2017 Daiderd Jordan +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +{ config, lib, ... }: + +with lib; + +{ + options = { + Label = mkOption { + type = types.str; + description = "This required key uniquely identifies the job to launchd."; + }; + + Disabled = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key is used as a hint to launchctl(1) that it should not submit this job to launchd when + loading a job or jobs. The value of this key does NOT reflect the current state of the job on the running + system. If you wish to know whether a job is loaded in launchd, reading this key from a configuration + file yourself is not a sufficient test. You should query launchd for the presence of the job using + the launchctl(1) list subcommand or use the ServiceManagement framework's + SMJobCopyDictionary() method. + + Note that as of Mac OS X v10.6, this key's value in a configuration file conveys a default value, which + is changed with the [-w] option of the launchctl(1) load and unload subcommands. These subcommands no + longer modify the configuration file, so the value displayed in the configuration file is not necessarily + the value that launchctl(1) will apply. See launchctl(1) for more information. + + Please also be mindful that you should only use this key if the provided on-demand and KeepAlive criteria + are insufficient to describe the conditions under which your job needs to run. The cost to have a + job loaded in launchd is negligible, so there is no harm in loading a job which only runs once or very + rarely. + ''; + }; + + UserName = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key specifies the user to run the job as. This key is only applicable when launchd is + running as root. + ''; + }; + + GroupName = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key specifies the group to run the job as. This key is only applicable when launchd is + running as root. If UserName is set and GroupName is not, the the group will be set to the default + group of the user. + ''; + }; + + inetdCompatibility = mkOption { + default = null; + 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. + ''; + }; + }; + }); + }; + + LimitLoadToHosts = mkOption { + type = types.nullOr (types.listOf types.str); + default = null; + description = '' + This configuration file only applies to the hosts listed with this key. Note: One should set kern.host-name kern.hostname + name in sysctl.conf(5) for this feature to work reliably. + ''; + }; + + LimitLoadFromHosts = mkOption { + type = types.nullOr (types.listOf types.str); + default = null; + description = '' + This configuration file only applies to hosts NOT listed with this key. Note: One should set kern.host-name kern.hostname + name in sysctl.conf(5) for this feature to work reliably. + ''; + }; + + LimitLoadToSessionType = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This configuration file only applies to sessions of the type specified. This key is used in concert + with the -S flag to launchctl. + ''; + }; + + Program = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + This key maps to the first argument of execvp(3). If this key is missing, then the first element of + the array of strings provided to the ProgramArguments will be used instead. This key is required in + the absence of the ProgramArguments key. + ''; + }; + + ProgramArguments = mkOption { + type = types.nullOr (types.listOf types.str); + default = null; + description = '' + This key maps to the second argument of execvp(3). This key is required in the absence of the Program + key. Please note: many people are confused by this key. Please read execvp(3) very carefully! + ''; + }; + + EnableGlobbing = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This flag causes launchd to use the glob(3) mechanism to update the program arguments before invocation. + ''; + }; + + EnableTransactions = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This flag instructs launchd that the job promises to use vproc_transaction_begin(3) and + vproc_transaction_end(3) to track outstanding transactions that need to be reconciled before the + process can safely terminate. If no outstanding transactions are in progress, then launchd is free to + send the SIGKILL signal. + ''; + }; + + OnDemand = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This key was used in Mac OS X 10.4 to control whether a job was kept alive or not. The default was + true. This key has been deprecated and replaced in Mac OS X 10.5 and later with the more powerful + KeepAlive option. + ''; + }; + + KeepAlive = mkOption { + 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. + ''; + }; + + 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. + ''; + }; + + 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. + ''; + }; + + # NOTE: this was missing in the original source at the time of writing + 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. + ''; + }; + + }; + })); + default = null; + description = '' + This optional key is used to control whether your job is to be kept continuously running or to let + demand and conditions control the invocation. The default is false and therefore only demand will start + the job. The value may be set to true to unconditionally keep the job alive. Alternatively, a dictionary + of conditions may be specified to selectively control whether launchd keeps a job alive or not. If + multiple keys are provided, launchd ORs them, thus providing maximum flexibility to the job to refine + the logic and stall if necessary. If launchd finds no reason to restart the job, it falls back on + demand based invocation. Jobs that exit quickly and frequently when configured to be kept alive will + be throttled to conserve system resources. + ''; + }; + + RunAtLoad = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key is used to control whether your job is launched once at the time the job is loaded. + The default is false. + ''; + }; + + RootDirectory = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key is used to specify a directory to chroot(2) to before running the job. + ''; + }; + + WorkingDirectory = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + This optional key is used to specify a directory to chdir(2) to before running the job. + ''; + }; + + EnvironmentVariables = mkOption { + type = types.nullOr (types.attrsOf types.str); + default = null; + description = '' + This optional key is used to specify additional environment variables to be set before running the + job. + ''; + }; + + Umask = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + This optional key specifies what value should be passed to umask(2) before running the job. Known bug: + Property lists don't support octal, so please convert the value to decimal. + ''; + }; + + TimeOut = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The recommended idle time out (in seconds) to pass to the job. If no value is specified, a default time + out will be supplied by launchd for use by the job at check in time. + ''; + }; + + ExitTimeOut = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The amount of time launchd waits before sending a SIGKILL signal. The default value is 20 seconds. The + value zero is interpreted as infinity. + ''; + }; + + ThrottleInterval = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + This key lets one override the default throttling policy imposed on jobs by launchd. The value is in + seconds, and by default, jobs will not be spawned more than once every 10 seconds. The principle + behind this is that jobs should linger around just in case they are needed again in the near future. + This not only reduces the latency of responses, but it encourages developers to amortize the cost of + program invocation. + ''; + }; + + InitGroups = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key specifies whether initgroups(3) should be called before running the job. The default + is true in 10.5 and false in 10.4. This key will be ignored if the UserName key is not set. + ''; + }; + + WatchPaths = mkOption { + type = types.nullOr (types.listOf types.path); + default = null; + description = '' + This optional key causes the job to be started if any one of the listed paths are modified. + ''; + }; + + QueueDirectories = mkOption { + type = types.nullOr (types.listOf types.str); + default = null; + description = '' + Much like the WatchPaths option, this key will watch the paths for modifications. The difference being + that the job will only be started if the path is a directory and the directory is not empty. + ''; + }; + + StartOnMount = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key causes the job to be started every time a filesystem is mounted. + ''; + }; + + StartInterval = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + This optional key causes the job to be started every N seconds. If the system is asleep, the job will + be started the next time the computer wakes up. If multiple intervals transpire before the computer is + woken, those events will be coalesced into one event upon wake from sleep. + ''; + }; + + StartCalendarInterval = mkOption { + default = null; + example = { + Hour = 2; + Minute = 30; + }; + description = '' + This optional key causes the job to be started every calendar interval as specified. Missing arguments + are considered to be wildcard. The semantics are much like crontab(5). Unlike cron which skips job + invocations when the computer is asleep, launchd will start the job the next time the computer wakes + up. If multiple intervals transpire before the computer is woken, those events will be coalesced into + one event upon wake from sleep. + ''; + type = types.nullOr (types.listOf (types.submodule { + options = { + Minute = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The minute on which this job will be run. + ''; + }; + + Hour = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The hour on which this job will be run. + ''; + }; + + Day = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The day on which this job will be run. + ''; + }; + + Weekday = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The weekday on which this job will be run (0 and 7 are Sunday). + ''; + }; + + Month = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + The month on which this job will be run. + ''; + }; + }; + })); + }; + + StandardInPath = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + This optional key specifies what file should be used for data being supplied to stdin when using + stdio(3). + ''; + }; + + StandardOutPath = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + This optional key specifies what file should be used for data being sent to stdout when using stdio(3). + ''; + }; + + StandardErrorPath = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + This optional key specifies what file should be used for data being sent to stderr when using stdio(3). + ''; + }; + + Debug = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key specifies that launchd should adjust its log mask temporarily to LOG_DEBUG while + dealing with this job. + ''; + }; + + WaitForDebugger = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key specifies that launchd should instruct the kernel to have the job wait for a debugger + to attach before any code in the job is executed. + ''; + }; + + SoftResourceLimits = mkOption { + default = null; + 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. + ''; + }; + + 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. + ''; + }; + + 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. + ''; + }; + + 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 (HardResource-Limits) (HardResourceLimits) + Limits) 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. + ''; + }; + + 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; }; + 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. + ''; + }; + + 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. + ''; + }; + + 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. + ''; + }; + + 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 (HardResource-Limits) (HardResourceLimits) + Limits) 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. + ''; + }; + + 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 { + type = types.nullOr types.int; + default = null; + description = '' + This optional key specifies what nice(3) value should be applied to the daemon. + ''; + }; + + ProcessType = mkOption { + type = types.nullOr + (types.enum [ "Background" "Standard" "Adaptive" "Interactive" ]); + default = null; + example = "Background"; + description = '' + This optional key describes, at a high level, the intended purpose of the job. The system will apply + resource limits based on what kind of job it is. If left unspecified, the system will apply light + resource limits to the job, throttling its CPU usage and I/O bandwidth. The following are valid values: + + Background + Background jobs are generally processes that do work that was not directly requested by the user. + The resource limits applied to Background jobs are intended to prevent them from disrupting the + user experience. + + Standard + Standard jobs are equivalent to no ProcessType being set. + + Adaptive + Adaptive jobs move between the Background and Interactive classifications based on activity over + XPC connections. See xpc_transaction_begin(3) for details. + + Interactive + Interactive jobs run with the same resource limitations as apps, that is to say, none. Interactive + jobs are critical to maintaining a responsive user experience, and this key should only be + used if an app's ability to be responsive depends on it, and cannot be made Adaptive. + ''; + }; + + AbandonProcessGroup = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + When a job dies, launchd kills any remaining processes with the same process group ID as the job. Setting + this key to true disables that behavior. + ''; + }; + + LowPriorityIO = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key specifies whether the kernel should consider this daemon to be low priority when + doing file system I/O. + ''; + }; + + LaunchOnlyOnce = mkOption { + type = types.nullOr types.bool; + default = null; + description = '' + This optional key specifies whether the job can only be run once and only once. In other words, if the + job cannot be safely respawned without a full machine reboot, then set this key to be true. + ''; + }; + + MachServices = mkOption { + default = null; + example = { 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 + be a boolean and set to true. Alternatively, a dictionary can be used instead of a simple true value. + + 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.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 boot-strap_look_up() bootstrap_look_up() + strap_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. + ''; + }; + }; + }); + }; + + Sockets = mkOption { + default = null; + description = '' + This optional key is used to specify launch on demand sockets that can be used to let launchd know when + to run the job. The job must check-in to get a copy of the file descriptors using APIs outlined in + launch(3). The keys of the top level Sockets dictionary can be anything. They are meant for the application + developer to use to differentiate which descriptors correspond to which application level protocols + (e.g. http vs. ftp vs. DNS...). At check-in time, the value of each Sockets dictionary key will + be an array of descriptors. Daemon/Agent writers should consider all descriptors of a given key to be + to be effectively equivalent, even though each file descriptor likely represents a different networking + protocol which conforms to the criteria specified in the job configuration file. + + 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. + ''; + }; + + 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. + ''; + }; + + 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. + ''; + }; + + 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. + ''; + }; + + 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. + ''; + }; + + 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 SockService-Name. SockServiceName. + Name. + ''; + }; + + 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 Sock-Family SockFamily + Family family also be set, otherwise the results are undefined. + ''; + }; + }; + })); + }; + }; + + config = { }; +} diff --git a/third_party/home-manager/modules/lib-bash/activation-init.sh b/third_party/home-manager/modules/lib-bash/activation-init.sh index eb2dc1ec97..aadc88dd35 100755 --- a/third_party/home-manager/modules/lib-bash/activation-init.sh +++ b/third_party/home-manager/modules/lib-bash/activation-init.sh @@ -5,6 +5,7 @@ function setupVars() { local profilesPath="$nixStateDir/profiles/per-user/$USER" local gcPath="$nixStateDir/gcroots/per-user/$USER" + declare -gr nixProfilePath="$profilesPath/profile" declare -gr genProfilePath="$profilesPath/home-manager" declare -gr newGenPath="@GENERATION_DIR@"; declare -gr newGenGcPath="$gcPath/current-home" @@ -27,17 +28,12 @@ function setupVars() { declare -gr oldGenPath fi - $VERBOSE_ECHO "Sanity checking oldGenNum and oldGenPath" + $VERBOSE_RUN _i "Sanity checking oldGenNum and oldGenPath" if [[ -v oldGenNum && ! -v oldGenPath || ! -v oldGenNum && -v oldGenPath ]]; then - errorEcho "Invalid profile number and current profile values! These" - errorEcho "must be either both empty or both set but are now set to" - errorEcho " '${oldGenNum:-}' and '${oldGenPath:-}'" - errorEcho "If you don't mind losing previous profile generations then" - errorEcho "the easiest solution is probably to run" - errorEcho " rm $profilesPath/home-manager*" - errorEcho " rm $gcPath/current-home" - errorEcho "and trying home-manager switch again. Good luck!" + _i $'The previous generation number and path are in conflict! These\nmust be either both empty or both set but are now set to\n\n \'%s\' and \'%s\'\n\nIf you don\'t mind losing previous profile generations then\nthe easiest solution is probably to run\n\n rm %s/home-manager*\n rm %s/current-home\n\nand trying home-manager switch again. Good luck!' \ + "${oldGenNum:-}" "${oldGenPath:-}" \ + "$profilesPath" "$gcPath" exit 1 fi } @@ -45,34 +41,35 @@ function setupVars() { if [[ -v VERBOSE ]]; then export VERBOSE_ECHO=echo export VERBOSE_ARG="--verbose" + export VERBOSE_RUN="" else export VERBOSE_ECHO=true export VERBOSE_ARG="" + export VERBOSE_RUN=true fi -echo "Starting home manager activation" +_i "Starting Home Manager activation" # Verify that we can connect to the Nix store and/or daemon. This will # also create the necessary directories in profiles and gcroots. -$VERBOSE_ECHO "Sanity checking Nix" +$VERBOSE_RUN _i "Sanity checking Nix" nix-build --expr '{}' --no-out-link setupVars if [[ -v DRY_RUN ]] ; then - echo "This is a dry run" + _i "This is a dry run" export DRY_RUN_CMD=echo else - $VERBOSE_ECHO "This is a live run" + $VERBOSE_RUN _i "This is a live run" export DRY_RUN_CMD="" fi if [[ -v VERBOSE ]]; then - echo -n "Using Nix version: " - nix-env --version + _i 'Using Nix version: %s' "$(nix-env --version)" fi -$VERBOSE_ECHO "Activation variables:" +$VERBOSE_RUN _i "Activation variables:" if [[ -v oldGenNum ]] ; then $VERBOSE_ECHO " oldGenNum=$oldGenNum" $VERBOSE_ECHO " oldGenPath=$oldGenPath" diff --git a/third_party/home-manager/modules/lib-bash/color-echo.sh b/third_party/home-manager/modules/lib-bash/color-echo.sh deleted file mode 100644 index ac36cedc6e..0000000000 --- a/third_party/home-manager/modules/lib-bash/color-echo.sh +++ /dev/null @@ -1,39 +0,0 @@ -# The check for terminal output and color support is heavily inspired -# by https://unix.stackexchange.com/a/10065. -# -# Allow opt out by respecting the `NO_COLOR` environment variable. - -function setupColors() { - normalColor="" - errorColor="" - warnColor="" - noteColor="" - - # Enable colors for terminals, and allow opting out. - if [[ ! -v NO_COLOR && -t 1 ]]; then - # See if it supports colors. - local ncolors - ncolors=$(tput colors) - - if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then - normalColor="$(tput sgr0)" - errorColor="$(tput bold)$(tput setaf 1)" - warnColor="$(tput setaf 3)" - noteColor="$(tput bold)$(tput setaf 6)" - fi - fi -} - -setupColors - -function errorEcho() { - echo "${errorColor}$*${normalColor}" -} - -function warnEcho() { - echo "${warnColor}$*${normalColor}" -} - -function noteEcho() { - echo "${noteColor}$*${normalColor}" -} diff --git a/third_party/home-manager/modules/lib/booleans.nix b/third_party/home-manager/modules/lib/booleans.nix new file mode 100644 index 0000000000..f6c2af586e --- /dev/null +++ b/third_party/home-manager/modules/lib/booleans.nix @@ -0,0 +1,5 @@ +{ 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/third_party/home-manager/modules/lib/dag.nix b/third_party/home-manager/modules/lib/dag.nix index 0c0e33ee76..50044a0b73 100644 --- a/third_party/home-manager/modules/lib/dag.nix +++ b/third_party/home-manager/modules/lib/dag.nix @@ -4,39 +4,38 @@ # # - not specific to strings, i.e., any payload is OK, # -# - the addition of the function `dagEntryBefore` indicating a -# "wanted by" relationship. +# - the addition of the function `entryBefore` indicating a "wanted +# by" relationship. { lib }: -let inherit (lib) all any filterAttrs mapAttrs mapAttrsToList toposort; -in rec { - - emptyDag = { }; +let inherit (lib) all filterAttrs hm mapAttrs toposort; +in { + empty = { }; + isEntry = e: e ? data && e ? after && e ? before; isDag = dag: - let isEntry = e: (e ? data) && (e ? after) && (e ? before); - in builtins.isAttrs dag && all (x: x) (mapAttrsToList (n: isEntry) dag); + builtins.isAttrs dag && all hm.dag.isEntry (builtins.attrValues dag); - # Takes an attribute set containing entries built by - # dagEntryAnywhere, dagEntryAfter, and dagEntryBefore to a - # topologically sorted list of entries. + # Takes an attribute set containing entries built by entryAnywhere, + # entryAfter, and entryBefore to a topologically sorted list of + # entries. # # Internally this function uses the `toposort` function in # `` and its value is accordingly. # # Specifically, the result on success is # - # { result = [{name = ?; data = ?;} …] } + # { result = [ { name = ?; data = ?; } … ] } # # For example # - # nix-repl> dagTopoSort { - # a = dagEntryAnywhere "1"; - # b = dagEntryAfter ["a" "c"] "2"; - # c = dagEntryBefore ["d"] "3"; - # d = dagEntryBefore ["e"] "4"; - # e = dagEntryAnywhere "5"; + # nix-repl> topoSort { + # a = entryAnywhere "1"; + # b = entryAfter [ "a" "c" ] "2"; + # c = entryBefore [ "d" ] "3"; + # d = entryBefore [ "e" ] "4"; + # e = entryAnywhere "5"; # } == { # result = [ # { data = "1"; name = "a"; } @@ -51,66 +50,54 @@ in rec { # And the result on error is # # { - # cycle = [ {after = ?; name = ?; data = ?} … ]; - # loops = [ {after = ?; name = ?; data = ?} … ]; + # cycle = [ { after = ?; name = ?; data = ? } … ]; + # loops = [ { after = ?; name = ?; data = ? } … ]; # } # # For example # - # nix-repl> dagTopoSort { - # a = dagEntryAnywhere "1"; - # b = dagEntryAfter ["a" "c"] "2"; - # c = dagEntryAfter ["d"] "3"; - # d = dagEntryAfter ["b"] "4"; - # e = dagEntryAnywhere "5"; + # nix-repl> topoSort { + # a = entryAnywhere "1"; + # b = entryAfter [ "a" "c" ] "2"; + # c = entryAfter [ "d" ] "3"; + # d = entryAfter [ "b" ] "4"; + # e = entryAnywhere "5"; # } == { # cycle = [ - # { after = ["a" "c"]; data = "2"; name = "b"; } - # { after = ["d"]; data = "3"; name = "c"; } - # { after = ["b"]; data = "4"; name = "d"; } + # { after = [ "a" "c" ]; data = "2"; name = "b"; } + # { after = [ "d" ]; data = "3"; name = "c"; } + # { after = [ "b" ]; data = "4"; name = "d"; } # ]; # loops = [ - # { after = ["a" "c"]; data = "2"; name = "b"; } + # { after = [ "a" "c" ]; data = "2"; name = "b"; } # ]; - # } == {} + # } # true - dagTopoSort = dag: + topoSort = dag: let dagBefore = dag: name: - mapAttrsToList (n: v: n) - (filterAttrs (n: v: any (a: a == name) v.before) dag); + builtins.attrNames + (filterAttrs (n: v: builtins.elem name v.before) dag); normalizedDag = mapAttrs (n: v: { name = n; data = v.data; after = v.after ++ dagBefore dag n; }) dag; - before = a: b: any (c: a.name == c) b.after; - sorted = toposort before (mapAttrsToList (n: v: v) normalizedDag); + 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 sorted; # Applies a function to each element of the given DAG. - dagMap = f: dag: mapAttrs (n: v: v // { data = f n v.data; }) dag; + map = f: mapAttrs (n: v: v // { data = f n v.data; }); + + entryBetween = before: after: data: { inherit data before after; }; # Create a DAG entry with no particular dependency information. - dagEntryAnywhere = data: { - inherit data; - before = [ ]; - after = [ ]; - }; - - dagEntryBetween = before: after: data: { inherit data before after; }; - - dagEntryAfter = after: data: { - inherit data after; - before = [ ]; - }; - - dagEntryBefore = before: data: { - inherit data before; - after = [ ]; - }; + entryAnywhere = hm.dag.entryBetween [ ] [ ]; + entryAfter = hm.dag.entryBetween [ ]; + entryBefore = before: hm.dag.entryBetween before [ ]; } diff --git a/third_party/home-manager/modules/lib/default.nix b/third_party/home-manager/modules/lib/default.nix index c087c81097..59f707c4ea 100644 --- a/third_party/home-manager/modules/lib/default.nix +++ b/third_party/home-manager/modules/lib/default.nix @@ -1,27 +1,15 @@ { lib }: rec { - dag = - let - d = import ./dag.nix { inherit lib; }; - in - { - empty = d.emptyDag; - isDag = d.isDag; - topoSort = d.dagTopoSort; - map = d.dagMap; - entryAnywhere = d.dagEntryAnywhere; - entryBetween = d.dagEntryBetween; - entryAfter = d.dagEntryAfter; - entryBefore = d.dagEntryBefore; - }; + dag = import ./dag.nix { inherit lib; }; assertions = import ./assertions.nix { inherit lib; }; + booleans = import ./booleans.nix { inherit lib; }; gvariant = import ./gvariant.nix { inherit lib; }; maintainers = import ./maintainers.nix; strings = import ./strings.nix { inherit lib; }; - types = import ./types.nix { inherit dag gvariant lib; }; + types = import ./types.nix { inherit gvariant lib; }; shell = import ./shell.nix { inherit lib; }; zsh = import ./zsh.nix { inherit lib; }; diff --git a/third_party/home-manager/modules/lib/file-type.nix b/third_party/home-manager/modules/lib/file-type.nix index 0b30cb1b69..cc23292ba0 100644 --- a/third_party/home-manager/modules/lib/file-type.nix +++ b/third_party/home-manager/modules/lib/file-type.nix @@ -33,7 +33,7 @@ in type = types.nullOr types.lines; description = '' Text of the file. If this option is null then - home.file.<name?>.source + must be set. ''; }; @@ -42,7 +42,7 @@ in type = types.path; description = '' Path of the source file or directory. If - home.file.<name?>.text + is non-null then this option will automatically point to a file containing that text. ''; diff --git a/third_party/home-manager/modules/lib/gvariant.nix b/third_party/home-manager/modules/lib/gvariant.nix index 7c4ca5b08c..bbb97c64ab 100644 --- a/third_party/home-manager/modules/lib/gvariant.nix +++ b/third_party/home-manager/modules/lib/gvariant.nix @@ -20,6 +20,7 @@ let arrayOf = t: "a${t}"; maybeOf = t: "m${t}"; tupleOf = ts: "(${concatStrings ts})"; + dictionaryEntryOf = ts: "{${concatStrings ts}}"; string = "s"; boolean = "b"; uchar = "y"; @@ -30,6 +31,7 @@ let int64 = "x"; uint64 = "t"; double = "d"; + variant = "v"; }; # Returns the GVariant type of a given Nix value. If no type can be @@ -74,13 +76,13 @@ in rec { isGVariant = v: v._type or "" == "gvariant"; isArray = hasPrefix "a"; + isDictionaryEntry = hasPrefix "{"; isMaybe = hasPrefix "m"; isTuple = hasPrefix "("; # Returns the GVariant value that most closely matches the given Nix # value. If no GVariant value can be found then `null` is returned. - # - # No support for dictionaries, maybe types, or variants. + mkValue = v: if builtins.isBool v then mkBoolean v @@ -105,6 +107,21 @@ in rec { mkEmptyArray = elemType: mkArray elemType [ ]; + mkVariant = elem: + let gvarElem = mkValue elem; + in mkPrimitive type.variant gvarElem // { + __toString = self: "@${self.type} <${toString self.value}>"; + }; + + 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}}"; + }; + mkNothing = elemType: mkMaybe elemType null; mkJust = elem: let gvarElem = mkValue elem; in mkMaybe gvarElem.type gvarElem; diff --git a/third_party/home-manager/modules/lib/maintainers.nix b/third_party/home-manager/modules/lib/maintainers.nix index 0a88c66457..7aa1842af1 100644 --- a/third_party/home-manager/modules/lib/maintainers.nix +++ b/third_party/home-manager/modules/lib/maintainers.nix @@ -7,6 +7,58 @@ # [1] https://github.com/NixOS/nixpkgs/blob/fca0d6e093c82b31103dc0dacc48da2a9b06e24b/maintainers/maintainer-list.nix#LC1 { + amesgen = { + name = "amesgen"; + email = "amesgen@amesgen.de"; + github = "amesgen"; + githubId = 15369874; + }; + austreelis = { + email = "github@accounts.austreelis.net"; + github = "Austreelis"; + githubId = 56743515; + name = "Morgane Austreelis"; + }; + blmhemu = { + name = "blmhemu"; + email = "19410501+blmhemu@users.noreply.github.com"; + github = "blmhemu"; + githubId = 19410501; + }; + bertof = { + name = "bertof"; + email = "berto.f@protonmail.com"; + github = "bertof"; + githubId = 9915675; + }; + CarlosLoboxyz = { + name = "Carlos Lobo"; + email = "86011416+CarlosLoboxyz@users.noreply.github.com"; + github = "CarlosLoboxyz"; + githubId = 86011416; + }; + d-dervishi = { + email = "david.dervishi@epfl.ch"; + github = "d-dervishi"; + githubId = 61125355; + name = "David Dervishi"; + keys = [{ + longKeyId = "rsa4096/0xB1C012F0E7697195"; + fingerprint = "4C92 E3B0 21B5 5562 A1E0 CE3D B1C0 12F0 E769 7195"; + }]; + }; + dwagenk = { + email = "dwagenk@mailbox.org"; + github = "dwagenk"; + githubId = 32838899; + name = "Daniel Wagenknecht"; + }; + jkarlson = { + email = "jekarlson@gmail.com"; + github = "jkarlson"; + githubId = 1204734; + name = "Emil Karlson"; + }; justinlovinger = { name = "Justin Lovinger"; email = "git@justinlovinger.com"; @@ -31,12 +83,24 @@ github = "chisui"; githubId = 4526429; }; + foo-dogsquared = { + name = "Gabriel Arazas"; + email = "foo.dogsquared@gmail.com"; + github = "foo-dogsquared"; + githubId = 34962634; + }; olmokramer = { name = "Olmo Kramer"; email = "olmokramer@users.noreply.github.com"; github = "olmokramer"; githubId = 3612514; }; + iosmanthus = { + name = "iosmanthus"; + email = "myosmanthustree@gmail.com"; + github = "iosmanthus"; + githubId = 16307070; + }; kalhauge = { name = "Christian Gram Kalhauge"; email = "kalhauge@users.noreply.github.com"; @@ -53,18 +117,42 @@ fingerprint = "2BE3 BAFD 793E A349 ED1F F00F 04D0 CEAF 916A 9A40"; }]; }; + katexochen = { + name = "Paul Meyer"; + email = "49727155+katexochen@users.noreply.github.com"; + github = "katexochen"; + githubId = 49727155; + }; kubukoz = { name = "Jakub Kozłowski"; email = "kubukoz@users.noreply.github.com"; github = "kubukoz"; githubId = 894884; }; + loicreynier = { + name = "Loïc Reynier"; + email = "loic@loireynier.fr"; + github = "loicreynier"; + githubId = 88983487; + }; matrss = { name = "Matthias Riße"; email = "matrss@users.noreply.github.com"; github = "matrss"; githubId = 9308656; }; + mforster = { + name = "Michael Forster"; + email = "email@michael-forster.de"; + github = "MForster"; + githubId = 4067975; + }; + mifom = { + name = "mifom"; + email = "mifom@users.noreply.github.com"; + github = "mifom"; + githubId = 23462908; + }; seylerius = { email = "sable@seyleri.us"; name = "Sable Seyler"; @@ -81,6 +169,24 @@ githubId = 46252070; name = "Sara Johnsson"; }; + florpe = { + email = "jens.krewald@gmail.com"; + github = "florpe"; + githubId = 53856373; + name = "Jens Krewald"; + }; + GaetanLepage = { + email = "gaetan@glepage.com"; + github = "GaetanLepage"; + githubId = 33058747; + name = "Gaetan Lepage"; + }; + maximsmol = { + email = "maximsmol@gmail.com"; + github = "maximsmol"; + githubId = 1472826; + name = "Max Smolin"; + }; msfjarvis = { email = "me@msfjarvis.dev"; github = "msfjarvis"; @@ -127,17 +233,131 @@ githubId = 1553581; name = "Josh Robson Chase"; }; + jwygoda = { + name = "Jarosław Wygoda"; + email = "jaroslaw@wygoda.me"; + github = "jwygoda"; + githubId = 20658981; + }; hawkw = { name = "Eliza Weisman"; email = "eliza@elizas.website"; github = "hawkw"; githubId = 2796466; }; - pamplemousse = { name = "Xavier Maso"; email = "xav.maso@gmail.com"; github = "pamplemousse"; githubId = 2647236; }; + onny = { + name = "onny"; + email = "onny@project-insanity.org"; + github = "onny"; + githubId = 757752; + }; + aheaume = { + name = "aheaume"; + email = "aheaume@users.noreply.github.com"; + github = "aheaume"; + githubId = 13830042; + }; + t4ccer = { + name = "t4ccer"; + email = "t4ccer@users.noreply.github.com"; + github = "t4ccer"; + githubId = 64430288; + }; + nurelin = { + name = "nurelin"; + email = "nurelin@users.noreply.github.com"; + github = "nurelin"; + githubId = 5276274; + }; + pltanton = { + name = "pltanton"; + email = "plotnikovanton@gmail.com"; + github = "pltanton"; + githubId = 4561823; + }; + Philipp-M = { + email = "philipp@mildenberger.me"; + github = "Philipp-M"; + githubId = 9267430; + name = "Philipp Mildenberger"; + }; + pinage404 = { + name = "pinage404"; + email = "pinage404@gmail.com"; + github = "pinage404"; + githubId = 6325757; + }; + podocarp = { + name = "Jia Xiaodong"; + email = "xdjiaxd@gmail.com"; + github = "podocarp"; + githubId = 10473184; + }; + mainrs = { + name = "mainrs"; + email = "5113257+mainrs@users.noreply.github.com"; + github = "mainrs"; + githubId = 5113257; + }; + kmaasrud = { + name = "Knut Magnus Aasrud"; + email = "km@aasrud.com"; + github = "kmaasrud"; + githubId = 54394333; + }; + sebtm = { + name = "Sebastian Sellmeier"; + email = "sebtm@users.noreply.github.com"; + github = "sebtm"; + githubId = 17243347; + }; + rosuavio = { + name = "Rosario Pulella"; + email = "RosarioPulella@gmail.com"; + github = "Rosuavio"; + githubId = 7164552; + }; + rszamszur = { + name = "Radosław Szamszur"; + email = "radoslawszamszur@gmail.com"; + github = "rszamszur"; + githubId = 10353018; + }; + rcerc = { + name = "rcerc"; + 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"; + }]; + }; + mtoohey = { + name = "Matthew Toohey"; + email = "contact@mtoohey.com"; + github = "mtoohey31"; + githubId = 36740602; + }; + lukasngl = { + name = "Lukas Nagel"; + email = "69244516+lukasngl@users.noreply.github.com"; + github = "lukasngl"; + githubId = 69244516; + }; + toastal = { + email = "toastal+nix@posteo.net"; + matrix = "@toastal:matrix.org"; + github = "toastal"; + githubId = 561087; + name = "toastal"; + keys = + [{ fingerprint = "7944 74B7 D236 DAB9 C9EF E7F9 5CCE 6F14 66D4 7C9E"; }]; + }; } diff --git a/third_party/home-manager/modules/lib/types-dag.nix b/third_party/home-manager/modules/lib/types-dag.nix index 68a5826fec..46694f2ae5 100644 --- a/third_party/home-manager/modules/lib/types-dag.nix +++ b/third_party/home-manager/modules/lib/types-dag.nix @@ -1,24 +1,41 @@ -{ dag, lib }: +{ lib }: let inherit (lib) - concatStringsSep defaultFunctor fixedWidthNumber imap1 isAttrs isList length - listToAttrs mapAttrs mkIf mkOption mkOptionType nameValuePair stringLength - types warn; + concatStringsSep defaultFunctor fixedWidthNumber hm imap1 isAttrs isList + length listToAttrs mapAttrs mkIf mkOrder mkOption mkOptionType nameValuePair + stringLength types warn; - isDagEntry = e: isAttrs e && (e ? data) && (e ? after) && (e ? before); - - dagContentType = elemType: - types.submodule ({ name, ... }: { - options = { - data = mkOption { type = elemType; }; - after = mkOption { type = with types; uniq (listOf str); }; - before = mkOption { type = with types; uniq (listOf str); }; - }; - config = mkIf (elemType.name == "submodule") { - data._module.args.dagName = name; - }; - }); + 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: + 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 { + 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); + }; in rec { # A directed acyclic graph of some inner type. @@ -29,21 +46,16 @@ in rec { # "actual" attribute name a new submodule argument is provided with # the name `dagName`. dagOf = elemType: - let - convertAllToDags = let - maybeConvert = n: v: if isDagEntry v then v else dag.entryAnywhere v; - in map (def: def // { value = mapAttrs maybeConvert def.value; }); - - attrEquivalent = types.attrsOf (dagContentType elemType); + let attrEquivalent = types.attrsOf (dagEntryOf elemType); in mkOptionType rec { name = "dagOf"; - description = "DAG of ${elemType.description}s"; - check = isAttrs; - merge = loc: defs: attrEquivalent.merge loc (convertAllToDags defs); + 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; }; + nestedTypes.elemType = elemType; }; # A directed acyclic graph of some inner type OR a list of that diff --git a/third_party/home-manager/modules/lib/types.nix b/third_party/home-manager/modules/lib/types.nix index 71ec587f1a..0195bbfc8a 100644 --- a/third_party/home-manager/modules/lib/types.nix +++ b/third_party/home-manager/modules/lib/types.nix @@ -1,5 +1,4 @@ -{ lib, dag ? import ./dag.nix { inherit lib; } -, gvariant ? import ./gvariant.nix { inherit lib; } }: +{ lib, gvariant ? import ./gvariant.nix { inherit lib; } }: let inherit (lib) @@ -7,7 +6,7 @@ let mergeAttrs mergeDefaultOption mergeOneOption mergeOptions mkOption mkOptionType showFiles showOption types; - typesDag = import ./types-dag.nix { inherit dag lib; }; + typesDag = import ./types-dag.nix { inherit lib; }; # Needed since the type is called gvariant and its merge attribute # must refer back to the type. @@ -56,7 +55,7 @@ in rec { }; size = mkOption { - type = types.nullOr types.int; + type = types.nullOr types.number; default = null; example = "8"; description = '' @@ -96,6 +95,10 @@ in rec { mergeOneOption loc defs else if gvar.isMaybe sharedDefType && allChecked then mergeOneOption loc defs + else if gvar.isDictionaryEntry sharedDefType && allChecked then + mergeOneOption loc defs + else if gvar.type.variant == sharedDefType && allChecked then + mergeOneOption loc defs else if gvar.type.string == sharedDefType && allChecked then types.str.merge loc defs else if gvar.type.double == sharedDefType && allChecked then diff --git a/third_party/home-manager/modules/manual.nix b/third_party/home-manager/modules/manual.nix index a5c020510f..356f311a9e 100644 --- a/third_party/home-manager/modules/manual.nix +++ b/third_party/home-manager/modules/manual.nix @@ -8,9 +8,7 @@ let docs = import ../docs { inherit lib pkgs; }; -in - -{ +in { options = { manual.html.enable = mkOption { type = types.bool; diff --git a/third_party/home-manager/modules/misc/dconf.nix b/third_party/home-manager/modules/misc/dconf.nix index 7fed1ae279..aaefdfa391 100644 --- a/third_party/home-manager/modules/misc/dconf.nix +++ b/third_party/home-manager/modules/misc/dconf.nix @@ -10,8 +10,16 @@ let mkIniKeyValue = key: value: "${key}=${toString (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 + (concatLists (mapAttrsToList + (dir: entries: mapAttrsToList (key: _: "/${dir}/${key}") entries) + cfg.settings))); + in { - meta.maintainers = [ maintainers.gnidorah maintainers.rycee ]; + meta.maintainers = [ maintainers.rycee ]; options = { dconf = { @@ -21,6 +29,11 @@ in { visible = false; description = '' Whether to enable dconf settings. + + Note, if you use NixOS then you must add + programs.dconf.enable = true + to your system configuration. Otherwise you will see a systemd error + message when your configuration is activated. ''; }; @@ -49,22 +62,58 @@ in { # Make sure the dconf directory exists. xdg.configFile."dconf/.keep".source = builtins.toFile "keep" ""; - home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] - (let iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); - in '' - if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then - DCONF_DBUS_RUN_SESSION="" - else - DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" + home.extraBuilderCommands = '' + mkdir -p $out/state/ + ln -s ${stateDconfKeys} $out/state/${stateDconfKeys.name} + ''; + + home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] (let + iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); + + statePath = "state/${stateDconfKeys.name}"; + + cleanup = pkgs.writeShellScript "dconf-cleanup" '' + set -euo pipefail + + ${config.lib.bash.initHomeManagerLib} + + PATH=${makeBinPath [ pkgs.dconf pkgs.jq ]}''${PATH:+:}$PATH + + oldState="$1" + newState="$2" + + # Can't do cleanup if we don't know the old state. + if [[ ! -f $oldState ]]; then + exit 0 fi - if [[ -v DRY_RUN ]]; then - echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile} - else - $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} - fi + # Reset all keys that are present in the old generation but not the new + # one. + jq -r -n \ + --slurpfile old "$oldState" \ + --slurpfile new "$newState" \ + '($old[] - $new[])[]' \ + | while read -r key; do + $VERBOSE_ECHO "Resetting dconf key \"$key\"" + $DRY_RUN_CMD $DCONF_DBUS_RUN_SESSION dconf reset "$key" + done + ''; + in '' + if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then + export DCONF_DBUS_RUN_SESSION="" + else + export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon" + fi - unset DCONF_DBUS_RUN_SESSION - ''); + if [[ -v oldGenPath ]]; then + ${cleanup} \ + "$oldGenPath/${statePath}" \ + "$newGenPath/${statePath}" + fi + + $DRY_RUN_CMD $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} + + unset DCONF_DBUS_RUN_SESSION + ''); }; } diff --git a/third_party/home-manager/modules/misc/editorconfig.nix b/third_party/home-manager/modules/misc/editorconfig.nix new file mode 100644 index 0000000000..579ef1f81d --- /dev/null +++ b/third_party/home-manager/modules/misc/editorconfig.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.editorconfig; + + iniFormat = pkgs.formats.ini { }; + +in { + meta.maintainers = with maintainers; [ loicreynier ]; + + options.editorconfig = { + enable = mkEnableOption "EditorConfig home configuration file"; + + settings = mkOption { + type = iniFormat.type; + default = { }; + description = '' + Configuration written to $HOME/.editorconfig. + root = true is automatically added to the file, + it must not be added here. + See for documentation. + ''; + example = literalExpression '' + { + "*" = { + charset = "utf-8"; + end_of_line = "lf"; + trim_trailing_whitespace = true; + insert_final_newline = true; + max_line_width = 78; + indent_style = "space"; + indent_size = 4; + }; + }; + ''; + }; + }; + + config = mkIf (cfg.enable && cfg.settings != { }) { + home.file.".editorconfig".text = let + renderedSettings = generators.toINIWithGlobalSection { } { + globalSection = { root = true; }; + sections = cfg.settings; + }; + in '' + # Generated by Home Manager + ${renderedSettings} + ''; + }; +} diff --git a/third_party/home-manager/modules/misc/gtk.nix b/third_party/home-manager/modules/misc/gtk.nix index 669329b7bf..dfebf201f1 100644 --- a/third_party/home-manager/modules/misc/gtk.nix +++ b/third_party/home-manager/modules/misc/gtk.nix @@ -7,33 +7,30 @@ let cfg = config.gtk; cfg2 = config.gtk.gtk2; cfg3 = config.gtk.gtk3; + cfg4 = config.gtk.gtk4; toGtk3Ini = generators.toINI { mkKeyValue = key: value: - let - value' = if isBool value then - (if value then "true" else "false") - else - toString value; - in "${key}=${value'}"; + let value' = if isBool value then boolToString value else toString value; + in "${escape [ "=" ] key}=${value'}"; }; formatGtk2Option = n: v: let v' = if isBool v then - (if v then "true" else "false") + boolToString value else if isString v then ''"${v}"'' else toString v; - in "${n} = ${v'}"; + in "${escape [ "=" ] n} = ${v'}"; themeType = types.submodule { options = { package = mkOption { type = types.nullOr types.package; default = null; - example = literalExpression "pkgs.gnome.gnome_themes_standard"; + example = literalExpression "pkgs.gnome.gnome-themes-extra"; description = '' Package providing the theme. This package will be installed to your profile. If null then the theme @@ -49,6 +46,57 @@ let }; }; + iconThemeType = types.submodule { + options = { + package = mkOption { + type = types.nullOr types.package; + default = null; + example = literalExpression "pkgs.gnome.adwaita-icon-theme"; + description = '' + Package providing the icon theme. This package will be installed + to your profile. If null then the theme + is assumed to already be available in your profile. + ''; + }; + + name = mkOption { + type = types.str; + example = "Adwaita"; + description = "The name of the icon theme within the package."; + }; + }; + }; + + cursorThemeType = types.submodule { + options = { + package = mkOption { + type = types.nullOr types.package; + default = null; + example = literalExpression "pkgs.vanilla-dmz"; + description = '' + Package providing the cursor theme. This package will be installed + to your profile. If null then the theme + is assumed to already be available in your profile. + ''; + }; + + name = mkOption { + type = types.str; + example = "Vanilla-DMZ"; + description = "The name of the cursor theme within the package."; + }; + + size = mkOption { + type = types.nullOr types.int; + default = null; + example = 16; + description = '' + The size of the cursor. + ''; + }; + }; + }; + in { meta.maintainers = [ maintainers.rycee ]; @@ -70,8 +118,14 @@ in { ''; }; + cursorTheme = mkOption { + type = types.nullOr cursorThemeType; + default = null; + description = "The cursor theme to use."; + }; + iconTheme = mkOption { - type = types.nullOr themeType; + type = types.nullOr iconThemeType; default = null; description = "The icon theme to use."; }; @@ -115,7 +169,7 @@ in { }; extraConfig = mkOption { - type = with types; attrsOf (either bool (either int str)); + type = with types; attrsOf (oneOf [ bool int str ]); default = { }; example = { gtk-cursor-blink = false; @@ -123,7 +177,7 @@ in { }; description = '' Extra configuration options to add to - ~/.config/gtk-3.0/settings.ini. + $XDG_CONFIG_HOME/gtk-3.0/settings.ini. ''; }; @@ -132,7 +186,22 @@ in { default = ""; description = '' Extra configuration lines to add verbatim to - ~/.config/gtk-3.0/gtk.css. + $XDG_CONFIG_HOME/gtk-3.0/gtk.css. + ''; + }; + }; + + gtk4 = { + extraConfig = mkOption { + type = with types; attrsOf (either bool (either int str)); + default = { }; + example = { + gtk-cursor-blink = false; + gtk-recent-files-limit = 20; + }; + description = '' + Extra configuration options to add to + $XDG_CONFIG_HOME/gtk-4.0/settings.ini. ''; }; }; @@ -140,7 +209,7 @@ in { }; config = mkIf cfg.enable (let - ini = optionalAttrs (cfg.font != null) { + gtkIni = optionalAttrs (cfg.font != null) { gtk-font-name = let fontSize = optionalString (cfg.font.size != null) " ${toString cfg.font.size}"; @@ -148,6 +217,11 @@ in { } // 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; }; dconfIni = optionalAttrs (cfg.font != null) { @@ -158,29 +232,42 @@ in { } // 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: optional (opt != null && opt.package != null) opt.package; in { - home.packages = optionalPackage cfg.font ++ optionalPackage cfg.theme - ++ optionalPackage cfg.iconTheme; + home.packages = concatMap optionalPackage [ + cfg.font + cfg.theme + cfg.iconTheme + cfg.cursorTheme + ]; home.file.${cfg2.configLocation}.text = - concatMapStrings (l: l + "\n") (mapAttrsToList formatGtk2Option ini) - + cfg2.extraConfig; + concatMapStrings (l: l + "\n") (mapAttrsToList formatGtk2Option gtkIni) + + cfg2.extraConfig + "\n"; home.sessionVariables.GTK2_RC_FILES = cfg2.configLocation; xdg.configFile."gtk-3.0/settings.ini".text = - toGtk3Ini { Settings = ini // cfg3.extraConfig; }; + toGtk3Ini { Settings = gtkIni // cfg3.extraConfig; }; - xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss; + xdg.configFile."gtk-3.0/gtk.css" = + mkIf (cfg3.extraCss != "") { text = cfg3.extraCss; }; xdg.configFile."gtk-3.0/bookmarks" = mkIf (cfg3.bookmarks != [ ]) { text = concatMapStrings (l: l + "\n") cfg3.bookmarks; }; + xdg.configFile."gtk-4.0/settings.ini".text = + toGtk3Ini { Settings = gtkIni // cfg4.extraConfig; }; + dconf.settings."org/gnome/desktop/interface" = dconfIni; }); } diff --git a/third_party/home-manager/modules/misc/news.nix b/third_party/home-manager/modules/misc/news.nix index a850bd8d78..f59d50b591 100644 --- a/third_party/home-manager/modules/misc/news.nix +++ b/third_party/home-manager/modules/misc/news.nix @@ -120,1931 +120,6 @@ in # # date -u +'%Y-%m-%dT%H:%M:%S+00:00' news.entries = [ - { - time = "2017-09-01T10:56:28+00:00"; - message = '' - Hello! This is a news entry and it represents an - experimental new feature of Home Manager. The idea is to - inform you when something of importance happens in Home - Manager or its modules. - - We will try to not disturb you about the same news more than - once so the next time you run - - home-manager switch - - or - - home-manager build - - it should not notify you about this text again. - - News items may be conditional and will then only show if the - condition holds, for example if they are relevant to your - configuration. - - If you want to see all relevant news then please use the - - home-manager news - - command. - - Since this is an experimental feature any positive or - negative feedback would be greatly appreciated. For example, - by commenting in https://git.io/v5BJL. - ''; - } - - { - time = "2017-09-10T22:15:19+00:00"; - condition = config.programs.zsh.enable; - message = '' - Home Manager now offers its own minimal zsh plugin manager - under the 'programs.zsh.plugins' option path. By statically - sourcing your plugins it achieves no startup overhead. - ''; - } - - { - time = "2017-09-12T13:11:48+00:00"; - condition = ( - config.programs.zsh.enable && - config.programs.zsh.shellAliases != {} - ); - message = '' - Aliases defined in 'programs.zsh.shellAliases' - are now have the highest priority. Such aliases will - not be redefined by the code in 'programs.zsh.initExtra' - or any external plugins. - ''; - } - - { - time = "2017-09-12T14:22:18+00:00"; - message = '' - A new service is available: 'services.blueman-applet'. - ''; - } - - { - time = "2017-09-13T11:30:22+00:00"; - message = '' - A new service is available: 'services.compton'. - ''; - } - - { - time = "2017-09-20T14:47:14+00:00"; - message = '' - A new service is available: 'services.screen-locker'. - ''; - } - - { - time = "2017-09-22T12:09:01+00:00"; - condition = isString config.programs.git.extraConfig; - message = '' - The 'programs.git.extraConfig' parameter now accepts - attributes instead of strings which allows more flexible - configuration. - - The string parameter type will be deprecated in the future, - please change your configuration file accordingly. - - For example, if your configuration includes - - programs.git.extraConfig = ''' - [core] - editor = vim - '''; - - then you can now change it to - - programs.git.extraConfig = { - core = { - editor = "vim"; - }; - }; - ''; - } - - { - time = "2017-09-27T07:28:54+00:00"; - message = '' - A new program module is available: 'programs.command-not-found'. - - Note, this differs from the NixOS system command-not-found - tool in that NIX_AUTO_INSTALL is not supported. - ''; - } - - { - time = "2017-09-28T12:39:36+00:00"; - message = '' - A new program module is available: 'programs.rofi'; - ''; - } - - { - time = "2017-10-02T11:15:03+00:00"; - condition = config.services.udiskie.enable; - message = '' - The udiskie service now defaults to automatically mounting - new devices. Previous behavior was to not automatically - mount. To restore this previous behavior add - - services.udiskie.automount = false; - - to your Home Manager configuration. - ''; - } - - { - time = "2017-10-04T18:36:07+00:00"; - message = '' - A new module is available: 'xsession.windowManager.xmonad'. - ''; - } - - { - time = "2017-10-06T08:21:43+00:00"; - message = '' - A new service is available: 'services.polybar'. - ''; - } - - { - time = "2017-10-09T16:38:34+00:00"; - message = '' - A new module is available: 'fonts.fontconfig'. - - In particular, the Boolean option - - fonts.fontconfig.enableProfileFonts - - was added for those who do not use NixOS and want to install - font packages using 'nix-env' or 'home.packages'. If you are - using NixOS then you do not need to enable this option. - ''; - } - - { - time = "2017-10-12T11:21:45+00:00"; - condition = config.programs.zsh.enable; - message = '' - A new option in zsh module is available: 'programs.zsh.sessionVariables'. - - This option can be used to set zsh specific session variables which - will be set only on zsh launch. - ''; - } - - { - time = "2017-10-15T13:59:47+00:00"; - message = '' - A new module is available: 'programs.man'. - - This module is enabled by default and makes sure that manual - pages are installed for packages in 'home.packages'. - ''; - } - - { - time = "2017-10-20T12:15:27+00:00"; - condition = with config.systemd.user; - services != {} || sockets != {} || targets != {} || timers != {}; - message = '' - Home Manager's interaction with systemd is now done using - 'systemctl' from Nixpkgs, not the 'systemctl' in '$PATH'. - - If you are using a distribution whose systemd is - incompatible with the version in Nixpkgs then you can - override this behavior by adding - - systemd.user.systemctlPath = "/usr/bin/systemctl" - - to your configuration. Home Manager will then use your - chosen version. - ''; - } - - { - time = "2017-10-23T23:10:29+00:00"; - condition = !config.programs.home-manager.enable; - message = '' - Unfortunately, due to some internal restructuring it is no - longer possible to install the home-manager command when - having - - home-manager = import ./home-manager { inherit pkgs; }; - - in the '~/.config/nixpkgs/config.nix' package override - section. Attempting to use the above override will now - result in the error "cannot coerce a set to a string". - - To resolve this please delete the override from the - 'config.nix' file and either link the Home Manager overlay - - $ ln -s ~/.config/nixpkgs/home-manager/overlay.nix \ - ~/.config/nixpkgs/overlays/home-manager.nix - - or add - - programs.home-manager.enable = true; - - to your Home Manager configuration. The latter is - recommended as the home-manager tool then is updated - automatically whenever you do a switch. - ''; - } - - { - time = "2017-10-23T23:26:17+00:00"; - message = '' - A new module is available: 'nixpkgs'. - - Like the identically named NixOS module, this allows you to - set Nixpkgs options and define Nixpkgs overlays. Note, the - changes you make here will not automatically apply to Nix - commands run outside Home Manager. - ''; - } - - { - time = "2017-10-28T23:39:55+00:00"; - message = '' - A new module is available: 'xdg'. - - If enabled, this module allows configuration of the XDG base - directory paths. - - Whether the module is enabled or not, it also offers the - option 'xdg.configFile', which acts much like 'home.file' - except the target path is relative to the XDG configuration - directory. That is, unless `XDG_CONFIG_HOME` is configured - otherwise, the assignment - - xdg.configFile.hello.text = "hello world"; - - will result in a file '$HOME/.config/hello'. - - Most modules in Home Manager that previously were hard coded - to write configuration to '$HOME/.config' now use this - option and will therefore honor the XDG configuration - directory. - ''; - } - - { - time = "2017-10-31T11:46:07+00:00"; - message = '' - A new window manager module is available: 'xsession.windowManager.i3'. - ''; - } - - { - time = "2017-11-12T00:18:59+00:00"; - message = '' - A new program module is available: 'programs.neovim'. - ''; - } - - { - time = "2017-11-14T19:56:49+00:00"; - condition = with config.xsession.windowManager; ( - i3.enable && i3.config != null && i3.config.startup != [] - ); - message = '' - A new 'notification' option was added to - xsession.windowManager.i3.startup submodule. - - Startup commands are now executed with the startup-notification - support enabled by default. Please, set 'notification' to false - where --no-startup-id option is necessary. - ''; - } - - { - time = "2017-11-17T10:36:10+00:00"; - condition = config.xsession.windowManager.i3.enable; - message = '' - The i3 window manager module has been extended with the following options: - - i3.config.keycodebindings - i3.config.window.commands - i3.config.window.hideEdgeBorders - i3.config.focus.mouseWarping - ''; - } - - { - time = "2017-11-26T21:57:23+00:00"; - message = '' - Two new modules are available: - - 'services.kbfs' and 'services.keybase' - ''; - } - - { - time = "2017-12-07T22:23:11+00:00"; - message = '' - A new module is available: 'services.parcellite' - ''; - } - - { - time = "2017-12-11T17:23:12+00:00"; - condition = config.home.activation ? reloadSystemd; - message = '' - The Boolean option 'systemd.user.startServices' is now - available. When enabled the current naive systemd unit - reload logic is replaced by a more sophisticated one that - attempts to automatically start, stop, and restart units as - necessary. - ''; - } - - { - time = "2018-02-02T11:15:00+00:00"; - message = '' - A new program configuration is available: 'programs.mercurial' - ''; - } - - { - time = "2018-02-03T10:00:00+00:00"; - message = '' - A new module is available: 'services.stalonetray' - ''; - } - - { - time = "2018-02-04T22:58:49+00:00"; - condition = config.xsession.enable; - message = '' - A new option 'xsession.pointerCursor' is now available. It - allows specifying the pointer cursor theme and size. The - settings will be applied in the xsession, Xresources, and - GTK configurations. - ''; - } - - { - time = "2018-02-06T20:23:34+00:00"; - message = '' - It is now possible to use Home Manager as a NixOS module. - This allows you to prepare user environments from the system - configuration file, which often is more convenient than - using the 'home-manager' tool. It also opens up additional - possibilities, for example, to automatically configure user - environments in NixOS declarative containers or on systems - deployed through NixOps. - - This feature should be considered experimental for now and - some critial limitations apply. For example, it is currently - not possible to use 'nixos-rebuild build-vm' when using the - Home Manager NixOS module. That said, it should be - reasonably robust and stable for simpler use cases. - - To make Home Manager available in your NixOS system - configuration you can add - - imports = [ - "''${builtins.fetchTarball https://github.com/nix-community/home-manager/archive/master.tar.gz}/nixos" - ]; - - to your 'configuration.nix' file. This will introduce a new - NixOS option called 'home-manager.users' whose type is an - attribute set mapping user names to Home Manager - configurations. - - For example, a NixOS configuration may include the lines - - users.users.eve.isNormalUser = true; - home-manager.users.eve = { - home.packages = [ pkgs.atool pkgs.httpie ]; - programs.bash.enable = true; - }; - - and after a 'nixos-rebuild switch' the user eve's - environment should include a basic Bash configuration and - the packages atool and httpie. - - More detailed documentation on the intricacies of this new - feature is slowly forthcoming. - ''; - } - - { - time = "2018-02-19T21:45:26+00:00"; - message = '' - A new module is available: 'programs.pidgin' - ''; - } - - { - time = "2018-03-04T06:54:26+00:00"; - message = '' - A new module is available: 'services.unclutter' - ''; - } - - { - time = "2018-03-07T21:38:27+00:00"; - message = '' - A new module is available: 'programs.fzf'. - ''; - } - - { - time = "2018-03-25T06:49:57+00:00"; - condition = with config.programs.ssh; enable && matchBlocks != {}; - message = '' - Options set through the 'programs.ssh' module are now placed - at the end of the SSH configuration file. This was done to - make it possible to override global options such as - 'ForwardAgent' or 'Compression' inside a host match block. - - If you truly need to override an SSH option across all match - blocks then the new option - - programs.ssh.extraOptionOverrides - - can be used. - ''; - } - - { - time = "2018-04-19T07:42:01+00:00"; - message = '' - A new module is available: 'programs.autorandr'. - ''; - } - - { - time = "2018-04-19T15:44:55+00:00"; - condition = config.programs.git.enable; - message = '' - A new option 'programs.git.includes' is available. Additional - Git configuration files may be included via - - programs.git.includes = [ - { path = "~/path/to/config.inc"; } - ]; - - or conditionally via - - programs.git.includes = [ - { path = "~/path/to/config.inc"; condition = "gitdir:~/src/"; } - ]; - - and the corresponding '[include]' or '[includeIf]' sections will be - appended to the main Git configuration file. - ''; - } - - { - time = "2018-05-01T20:49:31+00:00"; - message = '' - A new module is available: 'services.mbsync'. - ''; - } - { - time = "2018-05-03T12:34:47+00:00"; - message = '' - A new module is available: 'services.flameshot'. - ''; - } - - { - time = "2018-05-18T18:34:15+00:00"; - message = '' - A new module is available: 'qt' - - At the moment this module allows you to set up Qt to use the - GTK+ theme, and not much else. - ''; - } - - { - time = "2018-06-05T01:36:45+00:00"; - message = '' - A new module is available: 'services.kdeconnect'. - ''; - } - - { - time = "2018-06-09T09:11:59+00:00"; - message = '' - A new module is available: `programs.newsboat`. - ''; - } - - { - time = "2018-07-01T14:33:15+00:00"; - message = '' - A new module is available: 'accounts.email'. - - As the name suggests, this new module offers a number of - options for configuring email accounts. This, for example, - includes the email address and owner's real name but also - server settings for IMAP and SMTP. - - The intent is to have a central location for account - specific configuration that other modules can use. - - Note, this module is still somewhat experimental and its - structure should not be seen as final. Feedback is greatly - appreciated, both positive and negative. - ''; - } - - { - time = "2018-07-01T16:07:04+00:00"; - message = '' - A new module is available: 'programs.mbsync'. - ''; - } - - { - time = "2018-07-01T16:12:20+00:00"; - message = '' - A new module is available: 'programs.notmuch'. - ''; - } - - { - time = "2018-07-07T15:48:56+00:00"; - message = '' - A new module is available: 'xsession.windowManager.awesome'. - ''; - } - - { - time = "2018-07-18T20:14:11+00:00"; - message = '' - A new module is available: 'services.mpd'. - ''; - } - - { - time = "2018-07-31T13:33:39+00:00"; - message = '' - A new module is available: 'services.status-notifier-watcher'. - ''; - } - - { - time = "2018-07-31T13:47:06+00:00"; - message = '' - A new module is available: 'programs.direnv'. - ''; - } - - { - time = "2018-08-17T20:30:14+00:00"; - message = '' - A new module is available: 'programs.fish'. - ''; - } - - { - time = "2018-08-18T19:03:42+00:00"; - condition = config.services.gpg-agent.enable; - message = '' - A new option is available: 'services.gpg-agent.extraConfig'. - - Extra lines may be appended to $HOME/.gnupg/gpg-agent.conf - using this option. - ''; - } - - { - time = "2018-08-19T20:46:09+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new modules is available: 'programs.chromium'. - ''; - } - - { - time = "2018-08-20T20:27:26+00:00"; - message = '' - A new module is available: 'programs.msmtp'. - ''; - } - - { - time = "2018-08-21T20:13:50+00:00"; - message = '' - A new module is available: 'services.pasystray'. - ''; - } - - { - time = "2018-08-29T20:27:04+00:00"; - message = '' - A new module is available: 'programs.offlineimap'. - ''; - } - - { - time = "2018-09-18T21:25:14+00:00"; - message = '' - A new module is available: 'programs.taskwarrior'. - ''; - } - - { - time = "2018-09-18T21:43:54+00:00"; - message = '' - A new module is available: 'programs.zathura'. - ''; - } - - { - time = "2018-09-20T19:26:40+00:00"; - message = '' - A new module is available: 'programs.noti'. - ''; - } - - { - time = "2018-09-20T22:10:45+00:00"; - message = '' - A new module is available: 'programs.go'. - ''; - } - - { - time = "2018-09-27T17:48:08+00:00"; - message = '' - A new module is available: 'programs.obs-studio'. - ''; - } - - { - time = "2018-09-28T21:38:48+00:00"; - message = '' - A new module is available: 'programs.alot'. - ''; - } - - { - time = "2018-10-20T09:30:57+00:00"; - message = '' - A new module is available: 'programs.urxvt'. - ''; - } - - { - time = "2018-11-13T23:08:03+00:00"; - message = '' - A new module is available: 'programs.tmux'. - ''; - } - - { - time = "2018-11-18T18:55:15+00:00"; - message = '' - A new module is available: 'programs.astroid'. - ''; - } - - { - time = "2018-11-18T21:41:51+00:00"; - message = '' - A new module is available: 'programs.afew'. - ''; - } - - { - time = "2018-11-19T00:40:34+00:00"; - message = '' - A new nix-darwin module is available. Use it the same way the NixOS - module is used. A major limitation is that Home Manager services don't - work, as they depend explicitly on Linux and systemd user services. - However, 'home.file' and 'home.packages' do work. Everything else is - untested at this time. - ''; - } - - { - time = "2018-11-24T16:22:19+00:00"; - message = '' - A new option 'home.stateVersion' is available. Its function - is much like the 'system.stateVersion' option in NixOS. - - Briefly, the state version indicates a stable set of option - defaults. In the future, whenever Home Manager changes an - option default in a way that may cause program breakage it - will do so only for the unstable state version, currently - 19.03. Once 19.03 becomes the stable version only backwards - compatible changes will be made and 19.09 becomes the - unstable state version. - - The default value for this option is 18.09 but it may still - be a good idea to explicitly add - - home.stateVersion = "18.09"; - - to your Home Manager configuration. - ''; - } - - { - time = "2018-11-25T22:10:15+00:00"; - message = '' - A new module is available: 'services.nextcloud-client'. - ''; - } - - { - time = "2018-11-25T22:55:12+00:00"; - message = '' - A new module is available: 'programs.vscode'. - ''; - } - - { - time = "2018-12-04T21:54:38+00:00"; - condition = config.programs.beets.settings != {}; - message = '' - A new option 'programs.beets.enable' has been added. - Starting with state version 19.03 this option defaults to - false. For earlier versions it defaults to true if - 'programs.beets.settings' is non-empty. - - It is recommended to explicitly add - - programs.beets.enable = true; - - to your configuration. - ''; - } - - { - time = "2018-12-12T21:02:05+00:00"; - message = '' - A new module is available: 'programs.jq'. - ''; - } - - { - time = "2018-12-24T16:26:16+00:00"; - message = '' - A new module is available: 'dconf'. - - Note, on NixOS you may need to add - - services.dbus.packages = with pkgs; [ gnome3.dconf ]; - - to the system configuration for this module to work as - expected. In particular if you get the error message - - The name ca.desrt.dconf was not provided by any .service files - - when activating your Home Manager configuration. - ''; - } - - { - time = "2018-12-28T12:32:30+00:00"; - message = '' - A new module is available: 'programs.opam'. - ''; - } - - { - time = "2019-01-18T00:21:56+00:00"; - message = '' - A new module is available: 'programs.matplotlib'. - ''; - } - - { - time = "2019-01-26T13:20:37+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.xembed-sni-proxy'. - ''; - } - - { - time = "2019-01-28T23:36:10+00:00"; - message = '' - A new module is available: 'programs.irssi'. - ''; - } - - { - time = "2019-02-09T14:09:58+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.emacs'. - - This module provides a user service that runs the Emacs - configured in - - programs.emacs - - as an Emacs daemon. - ''; - } - - { - time = "2019-02-16T20:33:56+00:00"; - condition = hostPlatform.isLinux; - message = '' - When using Home Manager as a NixOS submodule it is now - possible to install packages using the NixOS - - users.users..packages - - option. This is enabled by adding - - home-manager.useUserPackages = true; - - to your NixOS system configuration. This mode of operation - is necessary if you want to use 'nixos-rebuild build-vm'. - ''; - } - - { - time = "2019-02-17T21:11:24+00:00"; - message = '' - A new module is available: 'programs.keychain'. - ''; - } - - { - time = "2019-02-24T00:32:23+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new service is available: 'services.mpdris2'. - ''; - } - - { - time = "2019-03-19T22:56:20+00:00"; - message = '' - A new module is available: 'programs.bat'. - ''; - } - - { - time = "2019-03-19T23:07:34+00:00"; - message = '' - A new module is available: 'programs.lsd'. - ''; - } - - { - time = "2019-04-09T20:10:22+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.xcape'. - ''; - } - - { - time = "2019-04-11T22:50:10+00:00"; - condition = hostPlatform.isLinux; - message = '' - The type used for the systemd unit options under - - systemd.user.services, systemd.user.sockets, etc. - - has been changed to offer more robust merging of configurations. - - If you don't override values within systemd units then you are not - affected by this change. Unfortunately, if you do override unit values - you may encounter errors due to this change. - - In particular, if you get an error saying that a "unique option" is - "defined multiple times" then you need to use 'lib.mkForce'. For - example, - - systemd.user.services.foo.Service.ExecStart = "/foo/bar"; - - becomes - - systemd.user.services.foo.Service.ExecStart = lib.mkForce "/foo/bar"; - - We had to make this change because the old merging was causing too - many confusing situations for people. Apologies for potentially - breaking your configuration! - ''; - } - - { - time = "2019-04-14T15:35:16+00:00"; - message = '' - A new module is available: 'programs.skim'. - ''; - } - - { - time = "2019-04-22T12:43:20+00:00"; - message = '' - A new module is available: 'programs.alacritty'. - ''; - } - - { - time = "2019-04-26T22:53:48+00:00"; - condition = config.programs.vscode.enable; - message = '' - A new module is available: 'programs.vscode.haskell'. - - Enable to add Haskell IDE Engine and syntax highlighting - support to your VSCode. - ''; - } - - { - time = "2019-05-04T23:56:39+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.rsibreak'. - ''; - } - - { - time = "2019-05-07T20:49:29+00:00"; - message = '' - A new module is available: 'programs.mpv'. - ''; - } - - { - time = "2019-05-30T17:49:29+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.xsuspender'. - ''; - } - - { - time = "2019-06-03T21:47:10+00:00"; - message = '' - A new module is available: 'programs.gpg'. - ''; - } - - { - time = "2019-06-09T12:19:18+00:00"; - message = '' - Collisions between unmanaged and managed files can now be - automatically resolved by moving the target file to a new - path instead of failing the switch operation. To enable - this, use the new '-b' command line argument. For example, - - home-manager -b bck switch - - where 'bck' is the suffix to give the moved file. In this - case a colliding file 'foo.conf' will be moved to - 'foo.conf.bck'. - ''; - } - - { - time = "2019-06-19T17:49:29+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: `services.getmail`. - ''; - } - - { - time = "2019-07-02T09:27:56+00:00"; - message = '' - A new module is available: 'programs.broot'. - ''; - } - - { - time = "2019-07-17T19:30:29+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.taskwarrior-sync'. - ''; - } - - { - time = "2019-07-17T20:05:29+00:00"; - message = '' - A new module is available: 'programs.kakoune'. - ''; - } - - { - time = "2019-08-08T11:49:35+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.hound'. - ''; - } - - { - time = "2019-08-17T12:24:58+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.muchsync'. - ''; - } - - { - time = "2019-08-18T14:22:41+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.dwm-status'. - ''; - } - - { - time = "2019-08-28T10:18:07+00:00"; - condition = config.programs.vim.enable; - message = '' - The 'programs.vim.plugins' option now accepts packages. - Specifying them as strings is deprecated. - ''; - } - - { - time = "2019-09-17T19:33:49+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.sxhkd'. - ''; - } - - { - time = "2019-09-26T21:05:24+00:00"; - message = '' - A new module is available: 'programs.starship'. - ''; - } - - { - time = "2019-09-26T21:47:13+00:00"; - message = '' - A new module is available: 'programs.rtorrent'. - ''; - } - - { - time = "2019-11-04T20:56:29+00:00"; - message = '' - A new module is available: 'programs.pazi'. - ''; - } - - { - time = "2019-11-05T21:54:04+00:00"; - condition = config.programs.zsh.enable; - message = '' - The 'programs.zsh.history.path' option behavior and the - default value has changed for state version 20.03 and above. - - Specifically, '$HOME' will no longer be prepended to the - option value, which allows specifying absolute paths (e.g. - using the xdg module). Also, the default value is fixed to - '$HOME/.zsh_history' and 'dotDir' path is not prepended to - it anymore. - ''; - } - - { - time = "2019-11-17T18:47:40+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.lorri'. - ''; - } - - { - time = "2019-11-24T17:46:57+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.spotifyd'. - ''; - } - - { - time = "2019-11-29T21:18:48+00:00"; - message = '' - A new module is available: 'programs.password-store'. - ''; - } - - { - time = "2019-11-29T21:18:48+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.password-store-sync'. - ''; - } - - { - time = "2019-11-29T22:46:49+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.unison'. - ''; - } - - { - time = "2019-12-01T22:10:23+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'xdg.mime'. - - If enabled, which it is by default, this module will create - the XDG mime database and desktop file database caches from - programs installed via Home Manager. - ''; - } - - { - time = "2019-12-08T19:48:26+00:00"; - message = '' - A new module is available: 'programs.readline'. - ''; - } - - { - time = "2020-01-11T11:49:51+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.cbatticon'. - ''; - } - - { - time = "2020-01-26T12:42:33+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'xsession.windowManager.bspwm'. - ''; - } - - { - time = "2020-01-26T12:49:40+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.grobi'. - ''; - } - - { - time = "2020-01-26T19:37:57+00:00"; - message = '' - A new module is available: 'programs.neomutt'. - ''; - } - - { - time = "2020-02-23T10:19:48+00:00"; - message = '' - A new module is available: 'programs.kitty'. - ''; - } - - { - time = "2020-02-26T21:20:55+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'wayland.windowManager.sway' - ''; - } - - { - time = "2020-03-04T18:55:03+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'programs.abook' - ''; - } - - { - time = "2020-03-07T11:43:26+00:00"; - condition = config.programs.fish.enable; - message = '' - The option 'programs.fish.functions' has been reworked in - order to support all available flags, such as - '--description', '--on-event', and more. - ''; - } - - { - time = "2020-03-07T13:11:43+00:00"; - condition = hostPlatform.isLinux; - message = '' - The NixOS module has a new option: 'home-manager.useGlobalPkgs'. - - This enables using the system configuration's 'pkgs' - argument in Home Manager. - - To learn more, see the installation section of the manual - - https://nix-community.github.io/home-manager/#sec-install-nixos-module - ''; - } - - { - time = "2020-03-07T14:12:50+00:00"; - message = '' - A new module is available: 'programs.lieer'. - ''; - } - - { - time = "2020-03-07T14:12:50+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.lieer'. - ''; - } - - { - time = "2020-03-15T16:55:28+00:00"; - condition = config.programs.firefox.enable; - message = '' - In anticipation of Firefox dropping support for extension - sideloading[1], we now install extensions directly to - Firefox profiles managed through Home Manager's - - 'programs.firefox.profiles' - - option. - - Unfortunately this will most likely trigger an "Existing - file is in the way" error when activating your configuration - since Firefox keeps a copy of the add-on in the location - Home Manager wants to overwrite. If this is the case, remove - the listed '.xpi' files and try again. - - This change also means that extensions installed through - Home Manager may disappear from unmanaged profiles in future - Firefox releases. - - [1] https://blog.mozilla.org/addons/2019/10/31/firefox-to-discontinue-sideloaded-extensions/ - ''; - } - - { - time = "2020-03-17T21:56:26+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.keynav'. - ''; - } - - { - time = "2020-03-24T22:17:20+00:00"; - condition = config.services.compton.enable; - message = '' - The 'services.compton' module has been deprecated and - instead the new module 'services.picom' should be used. This - is because Nixpkgs no longer packages compton, and instead - packages the (mostly) compatible fork called picom. - - The 'services.compton' and 'services.picom' modules have a - few differences: - - - 'services.picom' has a new 'experimentalBackends' - option. - - - 'vSync' is now a boolean value on 'services.picom', as - opposed to the string in 'services.compton'. - - Migrating to the new picom service is simple - just change - all references to 'services.compton' to 'services.picom', - and adhere to the above changes. - - The deprecated 'services.compton' will eventually be removed - in the future. Please update your configurations to use - 'services.picom' as soon as possible. - ''; - } - - { - time = "2020-04-08T09:33:05+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'targets.genericLinux'. - - When enabled, this module will configure various settings - and environment variables to make Home Manager and programs - installed through Nix work better on GNU/Linux distributions - other than NixOS. - - It should not be enabled if your Home Manager configuration - is deployed on a NixOS host. - ''; - } - - { - time = "2020-04-08T11:51:15+00:00"; - message = '' - A new module is available: 'programs.qutebrowser' - ''; - } - - { - time = "2020-04-09T09:19:38+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.mako' - ''; - } - - { - time = "2020-04-23T19:45:26+00:00"; - message = '' - A new module is available: 'programs.lf' - ''; - } - - { - time = "2020-04-26T13:46:28+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.pulseeffects' - ''; - } - - { - time = "2020-05-03T11:13:07+00:00"; - message = '' - A new module is available: 'programs.i3status' - ''; - } - - { - time = "2020-05-03T11:21:42+00:00"; - message = '' - A new module is available: 'programs.aria2' - ''; - } - - { - time = "2020-05-04T21:19:43+00:00"; - condition = config.programs.git.enable; - message = '' - The Git module now supports the 'delta' syntax highlighter. - - It can be enabled through the option 'programs.git.delta.enable'. - ''; - } - - { - time = "2020-05-12T20:09:54+00:00"; - message = '' - A new module is available: 'programs.dircolors' - ''; - } - - { - time = "2020-05-26T17:13:58+00:00"; - message = '' - A new module is available: 'programs.zoxide' - ''; - } - - { - time = "2020-06-03T17:46:11+00:00"; - condition = config.programs.ssh.enable; - message = '' - The ssh module now supports the 'ServerAliveCountMax' option - both globally through - - programs.ssh.serverAliveCountMax - - and per match blocks - - programs.ssh.matchBlocks..serverAliveCountMax - ''; - } - - { - time = "2020-06-11T18:06:37+00:00"; - condition = hostPlatform.isLinux && config.services.emacs.enable; - message = '' - The Emacs service now supports systemd socket activation. - - It can be enabled through the option 'services.emacs.socketActivation.enable'. - ''; - } - - { - time = "2020-06-12T17:48:01+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.clipmenu' - ''; - } - - { - time = "2020-06-12T07:08:09+00:00"; - condition = config.programs.bash.enable; - message = '' - A new module is available: 'programs.powerline-go' - ''; - } - - { - time = "2020-06-14T13:30:19+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'service.fluidsynth' - ''; - } - - { - time = "2020-06-17T22:17:52+00:00"; - condition = config.programs.git.enable; - message = '' - Since May 1, 2020 string values in Git configurations are - automatically escaped. If you have any manually escaped characters, - then you may need to restore them to their unescaped form to avoid - double escaping. - - In other words, if you now have something along the lines of - - programs.git.aliases.hello = '''"!echo $'Hello\\nWorld'"'''; - - you must replace it by the unescaped form - - programs.git.aliases.hello = "!echo $'Hello\nWorld'"; - - Apologies for the belated notification! - ''; - } - - { - time = "2020-06-23T20:06:39+00:00"; - message = '' - A new module is available: 'programs.ne' - ''; - } - - { - time = "2020-07-24T15:03:11+00:00"; - message = '' - A new module is available: 'programs.nushell'. - ''; - } - - { - time = "2020-07-25T21:04:59+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.dropbox'. - ''; - } - - { - time = "2020-08-13T22:15:27+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'programs.waybar' - ''; - } - - { - time = "2020-08-14T22:44:20+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.kanshi' - ''; - } - - { - time = "2020-08-25T22:14:01+00:00"; - message = '' - A new module is available: 'programs.mcfly' - ''; - } - - { - time = "2020-09-01T18:38:18+00:00"; - message = '' - A new module is available: 'programs.ncmpcpp' - ''; - } - - { - time = "2020-09-11T10:06:47+00:00"; - condition = hostPlatform.isLinux && config.targets.genericLinux.enable; - message = '' - A new option 'targets.genericLinux.extraXdgDataDirs' is available - to setup the user environment with the OS's data files. - - This is useful for example to get Bash completion for - 'systemctl' which shouldn't be installed through Home Manager. - - This is also useful to have non Home Manager applications - available in menus. - ''; - } - - { - time = "2020-09-09T06:54:59+00:00"; - condition = config.programs.man.enable; - message = '' - A new option 'programs.man.generateCaches' was added to - support the apropos command. - ''; - } - - { - time = "2020-09-22T21:03:28+00:00"; - message = '' - A new module is available: 'programs.pet'. - ''; - } - - { - time = "2020-09-29T21:21:44+00:00"; - message = '' - A new module is available: 'programs.mu'. - ''; - } - - { - time = "2020-10-08T21:28:16+00:00"; - message = '' - A new module is available: 'programs.autojump' - - The option `programs.bash.enableAutojump` is deprecated and this new - module should be used instead. - ''; - } - - { - time = "2020-10-12T00:12:23+00:00"; - condition = config.programs.zsh.enable; - message = '' - A new zsh submodule is available: 'programs.zsh.prezto'. - ''; - } - - { - time = "2020-10-22T21:10:38+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.gammastep'. - ''; - } - - { - time = "2020-10-22T21:30:42+00:00"; - message = '' - A new module is available: 'programs.gh'. - ''; - } - - { - time = "2020-11-01T11:17:02+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.caffeine'. - ''; - } - - { - time = "2020-11-05T22:59:21+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'programs.i3status-rust'. - ''; - } - - { - time = "2020-11-14T13:02:40+00:00"; - condition = config.programs.broot.enable; - message = '' - The 'programs.broot.verbs' option is now a list rather than an - attribute set. To migrate, move the keys of the attrset into the - list items' 'invocation' keys. For example, - - programs.broot.verbs = { - "p" = { execution = ":parent"; }; - }; - - becomes - - programs.broot.verbs = [ - { - invocation = "p"; - execution = ":parent"; - } - ]; - ''; - } - - { - time = "2020-12-01T20:46:14+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.wlsunset'. - ''; - } - - { - time = "2020-12-09T22:34:33+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.pbgopy'. - ''; - } - - { - time = "2020-12-18T22:22:25+00:00"; - message = '' - A new module is available: 'programs.rofi.pass'. - ''; - } - - { - time = "2020-12-31T14:16:47+00:00"; - message = '' - A new module is available: 'programs.octant'. - ''; - } - - { - time = "2021-01-01T08:51:11+00:00"; - condition = config.pam.sessionVariables != {}; - message = '' - The option 'pam.sessionVariables' will be deprecated in the future. - This is due to PAM 1.5.0 deprecating reading of the user environment. - The deprecation will not take place immediately but you may wish to - consider alternatives to PAM environment variables. - - See - - https://github.com/nix-community/home-manager/issues/1691 - - for discussion. - ''; - } - - { - time = "2021-01-02T07:49:15+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.plan9port'. - ''; - } - - { - time = "2021-01-31T11:23:30+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.playerctld'. - ''; - } - - { - time = "2021-01-28T15:07:34+00:00"; - condition = hostPlatform.isDarwin; - message = '' - New options are available for 'targets.darwin': - - - targets.darwin.defaults - - This adds options for configuring macOS through the defaults(1) - system. - - - targets.darwin.keybindings - - This adds options for configuring the default keybindings for macOS - text fields. - - - targets.darwin.search - - This adds options for configuring the default search engine for - macOS. - ''; - } - - { - time = "2021-02-04T22:28:26+00:00"; - message = '' - A new module is available: 'programs.sbt'. - ''; - } - - { - time = "2021-02-20T00:00:00+00:00"; - condition = config.services.polybar.enable; - message = '' - The polybar configuration can now be written in a more nix-friendly format. - The new 'services.polybar.settings' option is an alternative to - 'services.polybar.config' that supports nested keys and converts nix - lists to polybar-style 'foo-0, foo-1, ...' lists. - ''; - } - - { - time = "2021-02-25T22:36:43+00:00"; - condition = config.programs.git.enable && any (msmtp: msmtp.enable) - (mapAttrsToList (name: account: account.msmtp) - config.accounts.email.accounts); - message = '' - Git will now defer to msmtp for sending emails if - 'accounts.email.accounts..msmtp.enable' is true. - ''; - } - - { - time = "2021-03-03T22:16:05+00:00"; - message = '' - Home Manager now respects the 'NO_COLOR' environment variable as per - https://no-color.org/. - ''; - } - - { - time = "2021-03-29T21:05:50+00:00"; - message = '' - Configuration specified by 'programs.dircolors.extraConfig' is now - applied after 'programs.dircolors.settings'. - ''; - } - - { - time = "2021-04-11T20:44:54+00:00"; - message = '' - A new module is available: 'programs.exa'. - ''; - } - - { - time = "2021-04-23T10:00:00+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.pass-secret-service'. - ''; - } - - { - time = "2021-04-26T07:00:00+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new service is available: 'services.poweralertd'. - ''; - } - - { - time = "2021-04-28T10:00:00+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new service is available: 'services.mpris-proxy'. - ''; - } - - { - time = "2021-04-28T12:00:00+00:00"; - message = '' - A new module is available: 'programs.topgrade'. - ''; - } - - { - time = "2021-04-30T22:05:01+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new service is available: 'services.barrier'. - ''; - } - - { - time = "2021-05-01T15:16:08+00:00"; - message = '' - A new module is available: 'programs.lazygit'. - ''; - } - - { - time = "2021-04-27T00:00:00+00:00"; - message = '' - A new module is available: 'programs.ncspot'. - ''; - } - - { - time = "2021-05-02T11:22:42+00:00"; - condition = hostPlatform.isLinux && config.services.sxhkd.enable; - message = '' - The sxhkd service now is started using 'xsession.initExtra', - therefore this module loses systemd service management capabilities - and works only if Home Manager starts the user X session. - - The option 'services.sxhkd.extraPath' has been deprecated. - ''; - } - - { - time = "2021-05-06T20:47:37+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'services.etesync-dav' - ''; - } - - { - time = "2021-05-06T11:01:41+00:00"; - message = '' - A new module is available: 'programs.nix-index'. - ''; - } - - { - time = "2021-05-10T18:50:07+00:00"; - message = '' - A new module is available: 'xdg.systemDirs'. Options are: - - - xdg.systemDirs.config - - Extra directory names to add to $XDG_CONFIG_DIRS in the user - session. - - - xdg.systemDirs.data - - Extra directory names to add to $XDG_DATA_DIRS in the user - session. - - These variables are visible in both systemd user services and - login shells. - ''; - } - - { - time = "2021-05-18T12:22:42+00:00"; - condition = config.services.syncthing != {}; - message = '' - Setting 'services.syncthing.tray' as a boolean will be deprecated in - the future. - - This is to make the syncthing tray package configurable, with - `services.syncthing.tray.package`, following QSyncthingTray becoming - no longer actively maintained. The default syncthing tray package has - also changed to https://github.com/Martchus/syncthingtray. To - continue as before, set `services.syncthing.tray.enable`. - - See - - https://github.com/nix-community/home-manager/pull/1257 - - for discussion. - ''; - } - - { - time = "2021-05-18T20:28:50+00:00"; - condition = hostPlatform.isLinux; - message = '' - A new module is available: 'programs.foot'. - ''; - } - - { - time = "2021-05-23T18:31:38+00:00"; - condition = config.programs.mbsync.enable; - message = '' - mbsync channels no longer accepts the masterPattern or slavePattern - attribute keys. This is due to an upstream change. - They have been renamed: masterPattern -> farPattern, and - slavePattern -> nearPattern. - This is a stateful change, where the database file(s) used to keep track - of mail are silently upgraded once you upgrade both your configuration file - and the mbsync program. - - Note that this change is non-reversible, meaning once you choose to switch to - near/farPattern, you can no longer use your previous slave/masterPattern - configuration file. - ''; - } - - { - time = "2021-05-10T20:41:44+00:00"; - message = '' - A new module is available: 'programs.rbw'. - ''; - } - - { - time = "2021-05-30T15:22:10+00:00"; - message = '' - A new module is available: 'programs.piston-cli'. - ''; - } - { time = "2021-06-02T04:24:10+00:00"; condition = hostPlatform.isLinux; @@ -2280,6 +355,537 @@ in modules. ''; } + + { + time = "2021-12-08T10:23:42+00:00"; + condition = config.programs.less.enable; + message = '' + The 'lesskey' configuration file is now stored under + '$XDG_CONFIG_HOME/lesskey' since it is fully supported upstream + starting from v596. + ''; + } + + { + time = "2021-12-10T23:19:57+00:00"; + message = '' + A new module is available: 'programs.sqls'. + ''; + } + + { + time = "2021-12-11T11:55:12+00:00"; + message = '' + A new module is available: 'programs.navi'. + ''; + } + + { + time = "2021-12-11T16:07:00+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.gromit-mpx'. + ''; + } + + { + time = "2021-12-12T17:09:38+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.opensnitch-ui'. + ''; + } + + { + time = "2021-12-21T22:17:30+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.systembus-notify'. + ''; + } + + { + time = "2021-12-31T09:39:20+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'xsession.windowManager.herbstluftwm'. + ''; + } + + { + time = "2022-01-03T10:34:45+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.swayidle'. + ''; + } + + { + time = "2022-01-11T12:26:43+00:00"; + message = '' + A new module is available: 'programs.sagemath'. + ''; + } + + { + time = "2022-01-22T14:36:25+00:00"; + message = '' + A new module is available: 'programs.helix'. + ''; + } + + { + time = "2022-01-22T15:12:20+00:00"; + message = '' + A new module is available: 'programs.watson'. + ''; + } + + { + time = "2022-01-22T15:33:42+00:00"; + message = '' + A new module is available: 'programs.timidity'. + ''; + } + + { + time = "2022-01-22T16:54:31+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.tint2'. + ''; + } + + { + time = "2022-01-22T17:39:20+00:00"; + message = '' + A new module is available: 'programs.pandoc'. + ''; + } + + { + time = "2022-01-26T22:08:29+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.kodi'. + ''; + } + + { + time = "2022-02-03T23:23:49+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.twmn'. + ''; + } + + { + time = "2022-02-16T23:50:35+00:00"; + message = '' + A new module is available: 'programs.zellij'. + ''; + } + + { + time = "2022-02-17T17:12:46+00:00"; + message = '' + A new module is available: 'programs.eww'. + ''; + } + + { + time = "2022-02-17T23:11:13+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.espanso'. + ''; + } + + { + time = "2022-02-24T22:35:22+00:00"; + message = '' + A new module is available: 'programs.gitui'. + ''; + } + + { + time = "2022-02-26T09:28:57+00:00"; + condition = hostPlatform.isDarwin; + message = '' + A new module is available: 'launchd.agents' + + Use this to enable services based on macOS LaunchAgents. + ''; + } + + { + time = "2022-03-06T08:50:32+00:00"; + message = '' + A new module is available: 'programs.just'. + ''; + } + + { + time = "2022-03-06T09:40:17+00:00"; + message = '' + A new module is available: 'programs.pubs'. + ''; + } + + { + time = "2022-03-13T20:59:38+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.fusuma'. + ''; + } + + { + time = "2022-05-02T20:55:46+00:00"; + message = '' + A new module is available: 'programs.tealdeer'. + ''; + } + + { + time = "2022-05-18T22:09:45+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.mopidy'. + ''; + } + + { + time = "2022-06-21T22:29:37+00:00"; + message = '' + A new module is available: 'programs.mujmap'. + ''; + } + + { + time = "2022-06-24T17:18:32+00:00"; + message = '' + A new module is available: 'programs.micro'. + ''; + } + + { + time = "2022-06-24T22:40:27+00:00"; + message = '' + A new module is available: 'programs.pistol'. + ''; + } + + { + time = "2022-06-26T19:29:25+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.sctd'. + ''; + } + + { + time = "2022-07-12T08:59:50+00:00"; + condition = config.services.picom.enable; + message = '' + The 'services.picom' module has been refactored to use structural + settings. + + As a result 'services.picom.extraOptions' has been removed in favor of + 'services.picom.settings'. Also, 'services.picom.blur*' were removed + since upstream changed the blur settings to be more flexible. You can + migrate the blur settings to use 'services.picom.settings' instead. + ''; + } + + { + time = "2022-07-13T13:28:54+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.librewolf'. + ''; + } + + { + time = "2022-07-24T13:17:01+00:00"; + condition = hostPlatform.isDarwin; + message = '' + A new option is available: 'targets.darwin.currentHostDefaults'. + + This exposes macOS preferences that are available through the + 'defaults -currentHost' command. + ''; + } + + { + time = "2022-07-25T11:29:14+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'xsession.windowManager.spectrwm'. + ''; + } + + { + time = "2022-07-27T12:22:37+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.recoll'. + ''; + } + + { + time = "2022-08-01T16:35:28+00:00"; + message = '' + A new module is available: 'programs.hyfetch'. + ''; + } + + { + time = "2022-08-07T09:07:35+00:00"; + message = '' + A new module is available: 'programs.wezterm'. + ''; + } + + { + time = "2022-08-08T16:11:22+00:00"; + message = '' + A new module is available: 'programs.bashmount'. + ''; + } + + { + time = "2022-08-25T21:01:37+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.pueue'. + ''; + } + + { + time = "2022-09-05T12:33:11+00:00"; + message = '' + A new module is available: 'programs.btop'. + ''; + } + + { + time = "2022-09-05T11:05:25+00:00"; + message = '' + A new module is available: 'editorconfig'. + ''; + } + + { + time = "2022-09-08T15:41:46+00:00"; + message = '' + A new module is available: 'programs.nheko'. + ''; + } + + { + time = "2022-09-08T17:50:43+00:00"; + message = '' + A new module is available: 'programs.yt-dlp'. + ''; + } + + { + time = "2022-09-09T09:55:50+00:00"; + message = '' + A new module is available: 'programs.gallery-dl'. + ''; + } + + { + time = "2022-09-21T22:42:42+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'xsession.windowManager.fluxbox'. + ''; + } + + { + time = "2022-09-25T21:00:05+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.safeeyes'. + ''; + } + + { + time = "2022-09-25T22:22:17+00:00"; + message = '' + A new module is available: 'programs.tmate'. + ''; + } + + { + time = "2022-09-29T13:43:02+00:00"; + message = '' + A new module is available: 'programs.pls'. + ''; + } + + { + time = "2022-10-06T23:06:08+00:00"; + message = '' + A new module is available: 'programs.ledger'. + ''; + } + + { + time = "2022-10-06T23:19:10+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.havoc'. + ''; + } + + { + time = "2022-10-12T23:10:48+00:00"; + message = '' + A new module is available: 'programs.discocss'. + ''; + } + + { + time = "2022-10-16T19:49:46+00:00"; + condition = hostPlatform.isLinux; + message = '' + Two new modules are available: + + - 'programs.borgmatic' and + - 'services.borgmatic'. + + use the first to configure the borgmatic tool and the second if you + want to automatically run scheduled backups. + ''; + } + + { + time = "2022-10-18T08:07:43+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.looking-glass-client'. + ''; + } + + { + time = "2022-10-22T17:52:30+00:00"; + condition = config.programs.firefox.enable; + message = '' + It is now possible to configure the default search engine in Firefox + with + + programs.firefox.profiles..search.default + + and add custom engines with + + programs.firefox.profiles..search.engines. + + It is also recommended to set + + programs.firefox.profiles..search.force = true + + since Firefox will replace the symlink for the search configuration on + every launch, but note that you'll lose any existing configuration by + enabling this. + ''; + } + + { + time = "2022-10-24T22:05:27+00:00"; + message = '' + A new module is available: 'programs.k9s'. + ''; + } + + { + time = "2022-11-01T23:57:50+00:00"; + message = '' + A new module is available: 'programs.oh-my-posh'. + ''; + } + + { + time = "2022-11-02T10:56:14+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'xfconf'. + ''; + } + + { + time = "2022-11-04T14:56:46+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.thunderbird'. + ''; + } + + { + time = "2022-11-13T09:05:51+00:00"; + condition = hostPlatform.isDarwin; + message = '' + A new module is available: 'programs.thunderbird'. + + Please note that the Thunderbird packages provided by Nix are + currently not working on macOS. The module can still be used to manage + configuration files by installing Thunderbird manually and setting the + 'programs.thunderbird.package' option to a dummy package, for example + using 'pkgs.runCommand'. + + This module requires you to set the following environment variables + when using an installation of Thunderbird that is not provided by Nix: + + export MOZ_LEGACY_PROFILES=1 + export MOZ_ALLOW_DOWNGRADE=1 + ''; + } + + { + time = "2022-11-27T13:14:01+00:00"; + condition = config.programs.ssh.enable; + message = '' + 'programs.ssh.matchBlocks.*' now supports literal 'Match' blocks via + 'programs.ssh.matchBlocks.*.match' option as an alternative to plain + 'Host' blocks + ''; + } + + { + time = "2022-12-16T15:01:20+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.megasync'. + ''; + } + + { + time = "2022-12-25T08:41:32+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.cachix-agent'. + ''; + } + + { + time = "2022-12-28T21:48:22+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.clipman'. + ''; + } + + { + time = "2023-01-07T10:47:03+00:00"; + condition = hostPlatform.isLinux; + message = '' + 'xsession.windowManager.i3.config.[window|floating].titlebar' and + 'wayland.windowManager.sway.config.[window|floating].titlebar' now default to 'true'. + ''; + } ]; }; } diff --git a/third_party/home-manager/modules/misc/nix.nix b/third_party/home-manager/modules/misc/nix.nix new file mode 100644 index 0000000000..6ae28157a3 --- /dev/null +++ b/third_party/home-manager/modules/misc/nix.nix @@ -0,0 +1,240 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.nix; + + nixPackage = cfg.package; + + isNixAtLeast = versionAtLeast (getVersion nixPackage); + + nixConf = assert isNixAtLeast "2.2"; + let + + mkValueString = v: + if v == null then + "" + else if isInt v then + toString v + else if isBool v then + boolToString v + else if isFloat v then + floatToString v + else if isList v then + toString v + else if isDerivation v then + toString v + else if builtins.isPath v then + toString v + else if isString v then + v + else if isCoercibleToString v then + toString v + else + abort "The nix conf value: ${toPretty { } v} can not be encoded"; + + mkKeyValue = k: v: "${escape [ "=" ] k} = ${mkValueString v}"; + + mkKeyValuePairs = attrs: + concatStringsSep "\n" (mapAttrsToList mkKeyValue attrs); + + in pkgs.writeTextFile { + name = "nix.conf"; + text = '' + # WARNING: this file is generated from the nix.settings option in + # your Home Manager configuration at $XDG_CONFIG_HOME/nix/nix.conf. + # Do not edit it! + ${mkKeyValuePairs cfg.settings} + ${cfg.extraOptions} + ''; + checkPhase = + if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then '' + echo "Ignoring validation for cross-compilation" + '' else '' + echo "Validating generated nix.conf" + ln -s $out ./nix.conf + set -e + set +o pipefail + NIX_CONF_DIR=$PWD \ + ${cfg.package}/bin/nix show-config ${ + 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" + }') + set -o pipefail + ''; + }; + + 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)); + + jsonFormat = pkgs.formats.json { }; + +in { + options.nix = { + enable = mkEnableOption '' + the Nix configuration module + '' // { + default = true; + visible = false; + }; + + package = mkOption { + type = types.nullOr types.package; + default = null; + example = literalExpression "pkgs.nix"; + description = '' + The Nix package that the configuration should be generated for. + ''; + }; + + 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"; + }; + 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 is to be rewritten."; + }; + flake = mkOption { + type = types.nullOr types.attrs; + default = null; + example = literalExpression "nixpkgs"; + description = '' + The flake input to which is to be rewritten. + ''; + }; + exact = mkOption { + type = types.bool; + default = true; + description = '' + Whether the reference needs to match exactly. If set, + a 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. + ''; + }; + + registryVersion = mkOption { + type = types.int; + default = 2; + internal = true; + description = "The flake registry format version."; + }; + + checkConfig = mkOption { + type = types.bool; + default = true; + description = '' + If enabled (the default), checks for data type mismatches and that Nix + can parse the generated nix.conf. + ''; + }; + + extraOptions = mkOption { + type = types.lines; + default = ""; + example = '' + keep-outputs = true + keep-derivations = true + ''; + description = + "Additional text appended to nix.conf."; + }; + + settings = mkOption { + type = types.submodule { freeformType = semanticConfType; }; + default = { }; + example = literalExpression '' + { + use-sandbox = true; + show-trace = true; + system-features = [ "big-parallel" "kvm" "recursive-nix" ]; + } + ''; + description = '' + Configuration for Nix, see + or + + nix.conf + 5 + for available options. + The value declared here will be translated directly to the key-value pairs Nix expects. + + + Configuration specified in which will be appended + verbatim to the resulting config file. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [{ + assertion = cfg.settings == { } || cfg.package != null; + message = '' + A corresponding Nix package must be specified via `nix.package` for generating + nix.conf. + ''; + }]; + + xdg.configFile = { + "nix/registry.json" = mkIf (cfg.registry != { }) { + source = jsonFormat.generate "registry.json" { + version = cfg.registryVersion; + flakes = + mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry; + }; + }; + + "nix/nix.conf" = mkIf (cfg.settings != { } || cfg.extraOptions != "") { + source = nixConf; + }; + }; + }; + + meta.maintainers = [ maintainers.polykernel ]; +} diff --git a/third_party/home-manager/modules/misc/pam.nix b/third_party/home-manager/modules/misc/pam.nix index c94efb5067..cf3321ffba 100644 --- a/third_party/home-manager/modules/misc/pam.nix +++ b/third_party/home-manager/modules/misc/pam.nix @@ -4,10 +4,10 @@ with lib; let - vars = config.pam.sessionVariables; + cfg = config.pam; in { - meta.maintainers = [ maintainers.rycee ]; + meta.maintainers = with maintainers; [ rycee veehaitch ]; options = { pam.sessionVariables = mkOption { @@ -26,10 +26,46 @@ in { therefore discouraged. ''; }; + + pam.yubico.authorizedYubiKeys = { + ids = mkOption { + type = with types; + let + yubiKeyId = addCheck str (s: stringLength s == 12) // { + name = "yubiKeyId"; + description = "string of length 12"; + }; + in listOf yubiKeyId; + default = [ ]; + description = '' + List of authorized YubiKey token IDs. Refer to + + for details on how to obtain the token ID of a YubiKey. + ''; + }; + + path = mkOption { + type = types.str; + default = ".yubico/authorized_yubikeys"; + description = '' + File path to write the authorized YubiKeys, + relative to HOME. + ''; + }; + }; }; - config = mkIf (vars != { }) { - home.file.".pam_environment".text = concatStringsSep "\n" - (mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'') vars) + "\n"; - }; + config = mkMerge [ + (mkIf (cfg.sessionVariables != { }) { + home.file.".pam_environment".text = concatStringsSep "\n" + (mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'') + cfg.sessionVariables) + "\n"; + }) + + (mkIf (cfg.yubico.authorizedYubiKeys.ids != [ ]) { + home.file.${cfg.yubico.authorizedYubiKeys.path}.text = + concatStringsSep ":" + ([ config.home.username ] ++ cfg.yubico.authorizedYubiKeys.ids); + }) + ]; } diff --git a/third_party/home-manager/modules/misc/specialization.nix b/third_party/home-manager/modules/misc/specialization.nix new file mode 100644 index 0000000000..67e593e2c4 --- /dev/null +++ b/third_party/home-manager/modules/misc/specialization.nix @@ -0,0 +1,71 @@ +{ config, extendModules, lib, ... }: + +with lib; + +{ + options.specialization = mkOption { + type = types.attrsOf (types.submodule { + options = { + configuration = mkOption { + type = let + stopRecursion = { specialization = mkOverride 0 { }; }; + extended = extendModules { modules = [ stopRecursion ]; }; + 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 + your base configuration with additional settings. For example, you can + have specializations named light and dark + that applies light and dark color theme configurations. + + + + Note, this is an experimental option for now and you therefore have to + activate the specialization by looking up and running the activation + script yourself. Note, running the activation script will create a new + Home Manager generation. + + + + For example, to activate the dark specialization. You can + first look up your current Home Manager generation by running + + + $ home-manager generations | head -1 + 2022-05-02 22:49 : id 1758 -> /nix/store/jy…ac-home-manager-generation + + + then run + + + $ /nix/store/jy…ac-home-manager-generation/specialization/dark/activate + Starting Home Manager activation + … + + + + + WARNING! Since this option is experimental, the activation process may + change in backwards incompatible ways. + ''; + }; + + config = mkIf (config.specialization != { }) { + home.extraBuilderCommands = let + link = n: v: + let pkg = v.configuration.home.activationPackage; + in "ln -s ${pkg} $out/specialization/${n}"; + in '' + mkdir $out/specialization + ${concatStringsSep "\n" (mapAttrsToList link config.specialization)} + ''; + }; +} diff --git a/third_party/home-manager/modules/misc/version.nix b/third_party/home-manager/modules/misc/version.nix index 9673c0ffa5..0c590372a0 100644 --- a/third_party/home-manager/modules/misc/version.nix +++ b/third_party/home-manager/modules/misc/version.nix @@ -15,8 +15,9 @@ with lib; "21.05" "21.11" "22.05" + "22.11" + "23.05" ]; - default = "18.09"; description = '' It is occasionally necessary for Home Manager to change configuration defaults in a way that is incompatible with @@ -30,5 +31,39 @@ with lib; conversion or moving files. ''; }; + + home.version = { + full = mkOption { + internal = true; + readOnly = true; + type = types.str; + default = let + inherit (config.home.version) release revision; + suffix = + optionalString (revision != null) "+${substring 0 8 revision}"; + in "${release}${suffix}"; + example = "22.11+213a0629"; + description = "The full Home Manager version."; + }; + + release = mkOption { + internal = true; + readOnly = true; + type = types.str; + default = fileContents ../../.release; + example = "22.11"; + description = "The Home Manager release."; + }; + + revision = mkOption { + internal = true; + type = types.nullOr types.str; + default = let gitRepo = "${toString ./../..}/.git"; + in if pathIsGitRepo gitRepo then commitIdFromGitRepo gitRepo else null; + description = '' + The Git revision from which this Home Manager configuration was built. + ''; + }; + }; }; } diff --git a/third_party/home-manager/modules/misc/xdg-desktop-entries.nix b/third_party/home-manager/modules/misc/xdg-desktop-entries.nix index 6e8393c2a6..3274f6ec94 100644 --- a/third_party/home-manager/modules/misc/xdg-desktop-entries.nix +++ b/third_party/home-manager/modules/misc/xdg-desktop-entries.nix @@ -4,8 +4,14 @@ with lib; let desktopEntry = { + imports = [ + (mkRemovedOptionModule [ "extraConfig" ] + "The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.") + (mkRemovedOptionModule [ "fileValidation" ] + "Validation of the desktop file is always enabled.") + ]; options = { - # Since this module uses the nixpkgs/pkgs/build-support/make-desktopitem function, + # Since this module uses the nixpkgs/pkgs/build-support/make-desktopitem function, # our options and defaults follow its parameters, with the following exceptions: # `desktopName` on makeDesktopItem is controlled by `name`. @@ -13,17 +19,10 @@ let # `name` on makeDesktopItem is controlled by this module's key in the attrset. # This is the file's filename excluding ".desktop". - # `extraEntries` on makeDesktopItem is controlled by `extraConfig`, - # and `extraDesktopEntries` by `settings`, + # `extraConfig` on makeDesktopItem is controlled by `settings`, # to match what's commonly used by other home manager modules. - # `startupNotify` on makeDesktopItem asks for "true" or "false" strings, - # for usability's sake we ask for a boolean. - - # `mimeType` and `categories` on makeDesktopItem ask for a string in the format "one;two;three;", - # for the same reason we ask for a list of strings. - - # Descriptions are taken from the desktop entry spec: + # Descriptions are taken from the desktop entry spec: # https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys type = mkOption { @@ -34,12 +33,12 @@ let exec = mkOption { description = "Program to execute, possibly with arguments."; - type = types.str; + type = types.nullOr types.str; }; icon = mkOption { description = "Icon to display in file manager, menus, etc."; - type = types.nullOr types.str; + type = with types; nullOr (either str path); default = null; }; @@ -81,27 +80,35 @@ let startupNotify = mkOption { description = '' - If true, it is KNOWN that the application will send a "remove" - message when started with the DESKTOP_STARTUP_ID - environment variable set. If false, it is KNOWN that the application + If true, it is KNOWN that the application will send a "remove" + message when started with the DESKTOP_STARTUP_ID + environment variable set. If false, it is KNOWN that the application does not work with startup notification at all.''; type = types.nullOr types.bool; default = null; }; - extraConfig = mkOption { + noDisplay = mkOption { description = '' - Extra configuration. Will be appended to the end of the file and - may thus contain extra sections. + Means "this application exists, but don't display it in the menus". + This can be useful to e.g. associate this application with MIME types. ''; - type = types.lines; - default = ""; + type = types.nullOr types.bool; + default = null; + }; + + prefersNonDefaultGPU = mkOption { + description = '' + If true, the application prefers to be run on a more powerful discrete GPU if available. + ''; + type = types.nullOr types.bool; + default = null; }; settings = mkOption { type = types.attrsOf types.string; description = '' - Extra key-value pairs to add to the [Desktop Entry] section. + Extra key-value pairs to add to the [Desktop Entry] section. This may override other values. ''; default = { }; @@ -113,41 +120,66 @@ let ''; }; - fileValidation = mkOption { - type = types.bool; - description = "Whether to validate the generated desktop file."; - default = true; + 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."; + }; + 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 '' + { + "New Window" = { + exec = "''${pkgs.firefox}/bin/firefox --new-window %u"; + }; + } + ''; + description = + "The set of actions made available to application launchers."; + }; + + # Required for the assertions + # TODO: Remove me once https://github.com/NixOS/nixpkgs/issues/96006 is fixed + assertions = mkOption { + type = types.listOf types.unspecified; + default = [ ]; + visible = false; + internal = true; }; }; }; #formatting helpers - ifNotNull = a: a': if a == null then null else a'; - stringBool = bool: if bool then "true" else "false"; semicolonList = list: (concatStringsSep ";" list) + ";"; # requires trailing semicolon #passes config options to makeDesktopItem in expected format makeFile = name: config: pkgs.makeDesktopItem { - name = name; - type = config.type; - exec = config.exec; - icon = config.icon; - comment = config.comment; - terminal = config.terminal; + inherit name; + inherit (config) + type exec icon comment terminal genericName startupNotify noDisplay + prefersNonDefaultGPU actions; desktopName = config.name; - genericName = config.genericName; - mimeType = ifNotNull config.mimeType (semicolonList config.mimeType); - categories = - ifNotNull config.categories (semicolonList config.categories); - startupNotify = - ifNotNull config.startupNotify (stringBool config.startupNotify); - extraEntries = config.extraConfig; - extraDesktopEntries = config.settings; + mimeTypes = optionals (config.mimeType != null) config.mimeType; + categories = optionals (config.categories != null) config.categories; + extraConfig = config.settings; }; in { - meta.maintainers = with maintainers; [ cwyc ]; + meta.maintainers = [ hm.maintainers.cwyc ]; options.xdg.desktopEntries = mkOption { description = '' @@ -174,7 +206,7 @@ in { config = mkIf (config.xdg.desktopEntries != { }) { assertions = [ (hm.assertions.assertPlatform "xdg.desktopEntries" pkgs platforms.linux) - ]; + ] ++ flatten (catAttrs "assertions" (attrValues config.xdg.desktopEntries)); home.packages = (map hiPrio # we need hiPrio to override existing entries (attrsets.mapAttrsToList makeFile config.xdg.desktopEntries)); diff --git a/third_party/home-manager/modules/misc/xdg-mime-apps.nix b/third_party/home-manager/modules/misc/xdg-mime-apps.nix index 5372c6259f..2093caa2da 100644 --- a/third_party/home-manager/modules/misc/xdg-mime-apps.nix +++ b/third_party/home-manager/modules/misc/xdg-mime-apps.nix @@ -72,20 +72,50 @@ in { }; }; - config = mkIf cfg.enable { - assertions = - [ (hm.assertions.assertPlatform "xdg.mimeApps" pkgs platforms.linux) ]; + config = mkMerge [ + { + # 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: + zipAttrs + (filter (e: e != null) (map processLine (splitString "\n" str))); - # Deprecated but still used by some applications. - xdg.dataFile."applications/mimeapps.list".source = - config.xdg.configFile."mimeapps.list".source; + processLine = str: + let + entry = splitString ";" str; + k = elemAt entry 0; + v = elemAt entry 1; + in if length entry == 2 then { ${k} = v; } else null; - xdg.configFile."mimeapps.list".text = - let joinValues = mapAttrs (n: concatStringsSep ";"); - in generators.toINI { } { - "Added Associations" = joinValues cfg.associations.added; - "Removed Associations" = joinValues cfg.associations.removed; - "Default Applications" = joinValues cfg.defaultApplications; - }; - }; + 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)); + } + + (mkIf cfg.enable { + assertions = + [ (hm.assertions.assertPlatform "xdg.mimeApps" pkgs platforms.linux) ]; + + # Deprecated but still used by some applications. + xdg.dataFile."applications/mimeapps.list".source = + config.xdg.configFile."mimeapps.list".source; + + xdg.configFile."mimeapps.list".text = + let joinValues = mapAttrs (n: concatStringsSep ";"); + in generators.toINI { } { + "Added Associations" = joinValues cfg.associations.added; + "Removed Associations" = joinValues cfg.associations.removed; + "Default Applications" = joinValues cfg.defaultApplications; + }; + }) + ]; } diff --git a/third_party/home-manager/modules/misc/xdg-user-dirs.nix b/third_party/home-manager/modules/misc/xdg-user-dirs.nix index 78d350cdec..2ea07709aa 100644 --- a/third_party/home-manager/modules/misc/xdg-user-dirs.nix +++ b/third_party/home-manager/modules/misc/xdg-user-dirs.nix @@ -33,57 +33,78 @@ in { # https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml desktop = mkOption { - type = types.str; - default = "$HOME/Desktop"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Desktop"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Desktop"''; description = "The Desktop directory."; }; documents = mkOption { - type = types.str; - default = "$HOME/Documents"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Documents"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Documents"''; description = "The Documents directory."; }; download = mkOption { - type = types.str; - default = "$HOME/Downloads"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Downloads"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Downloads"''; description = "The Downloads directory."; }; music = mkOption { - type = types.str; - default = "$HOME/Music"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Music"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Music"''; description = "The Music directory."; }; pictures = mkOption { - type = types.str; - default = "$HOME/Pictures"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Pictures"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Pictures"''; description = "The Pictures directory."; }; publicShare = mkOption { - type = types.str; - default = "$HOME/Public"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Public"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Public"''; description = "The Public share directory."; }; templates = mkOption { - type = types.str; - default = "$HOME/Templates"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Templates"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Templates"''; description = "The Templates directory."; }; videos = mkOption { - type = types.str; - default = "$HOME/Videos"; + type = with types; nullOr (coercedTo path toString str); + default = "${config.home.homeDirectory}/Videos"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Videos"''; description = "The Videos directory."; }; extraConfig = mkOption { - type = with types; attrsOf str; + type = with types; attrsOf (coercedTo path toString str); default = { }; - example = { XDG_MISC_DIR = "$HOME/Misc"; }; + defaultText = literalExpression "{ }"; + example = literalExpression '' + { + XDG_MISC_DIR = "''${config.home.homeDirectory}/Misc"; + } + ''; description = "Other user directories."; }; @@ -92,7 +113,7 @@ in { }; config = let - directories = { + directories = (filterAttrs (n: v: !isNull v) { XDG_DESKTOP_DIR = cfg.desktop; XDG_DOCUMENTS_DIR = cfg.documents; XDG_DOWNLOAD_DIR = cfg.download; @@ -101,7 +122,7 @@ in { XDG_PUBLICSHARE_DIR = cfg.publicShare; XDG_TEMPLATES_DIR = cfg.templates; XDG_VIDEOS_DIR = cfg.videos; - } // cfg.extraConfig; + }) // cfg.extraConfig; in mkIf cfg.enable { assertions = [ (hm.assertions.assertPlatform "xdg.userDirs" pkgs platforms.linux) ]; @@ -113,12 +134,12 @@ in { xdg.configFile."user-dirs.conf".text = "enabled=False"; - home.activation = mkIf cfg.createDirectories { - createXdgUserDirectories = let - directoriesList = attrValues directories; - mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"''); - in lib.hm.dag.entryAfter [ "writeBoundary" ] - (strings.concatMapStringsSep "\n" mkdir directoriesList); - }; + home.sessionVariables = directories; + + home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let + directoriesList = attrValues directories; + mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"''); + in lib.hm.dag.entryAfter [ "linkGeneration" ] + (strings.concatMapStringsSep "\n" mkdir directoriesList)); }; } diff --git a/third_party/home-manager/modules/misc/xdg.nix b/third_party/home-manager/modules/misc/xdg.nix index 5961cac398..247e731921 100644 --- a/third_party/home-manager/modules/misc/xdg.nix +++ b/third_party/home-manager/modules/misc/xdg.nix @@ -80,18 +80,22 @@ in { }; config = mkMerge [ - (mkIf cfg.enable { - xdg.cacheHome = mkDefault defaultCacheHome; - xdg.configHome = mkDefault defaultConfigHome; - xdg.dataHome = mkDefault defaultDataHome; - xdg.stateHome = mkDefault defaultStateHome; - - home.sessionVariables = { + (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 = mkDefault defaultCacheHome; + xdg.configHome = mkDefault defaultConfigHome; + xdg.dataHome = mkDefault defaultDataHome; + xdg.stateHome = mkDefault defaultStateHome; + + home.sessionVariables = variables; + systemd.user.sessionVariables = + mkIf pkgs.stdenv.hostPlatform.isLinux variables; }) # Legacy non-deterministic setup. diff --git a/third_party/home-manager/modules/misc/xfconf.nix b/third_party/home-manager/modules/misc/xfconf.nix new file mode 100644 index 0000000000..b4141bf53b --- /dev/null +++ b/third_party/home-manager/modules/misc/xfconf.nix @@ -0,0 +1,102 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xfconf; + + withType = v: + 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" ] ++ concatMap withType v + else + throw "unexpected xfconf type: ${builtins.typeOf v}"; + +in { + meta.maintainers = [ maintainers.chuangzhu ]; + + options.xfconf = { + enable = mkOption { + type = types.bool; + default = true; + visible = false; + description = '' + Whether to enable Xfconf settings. + + Note, if you use NixOS then you must add + programs.xfconf.enable = true + to your system configuration. Otherwise you will see a systemd error + message when your configuration is activated. + ''; + }; + + settings = mkOption { + type = with types; + attrsOf (attrsOf (oneOf [ + bool + int + float + str + (listOf (oneOf [ bool int float str ])) + ])) // { + description = "xfconf settings"; + }; + default = { }; + example = literalExpression '' + { + xfce4-session = { + "startup/ssh-agent/enabled" = false; + "general/LockCommand" = "''${pkgs.lightdm}/bin/dm-tool lock"; + }; + xfce4-desktop = { + "backdrop/screen0/monitorLVDS-1/workspace0/last-image" = + "''${pkgs.nixos-artwork.wallpapers.stripes-logo.gnomeFilePath}"; + }; + } + ''; + description = '' + Settings to write to the Xfconf configuration system. + ''; + }; + }; + + config = mkIf (cfg.enable && cfg.settings != { }) { + assertions = + [ (hm.assertions.assertPlatform "xfconf" pkgs platforms.linux) ]; + + home.activation.xfconfSettings = hm.dag.entryAfter [ "installPackages" ] + (let + mkCommand = channel: property: value: '' + $DRY_RUN_CMD ${pkgs.xfce.xfconf}/bin/xfconf-query \ + ${ + escapeShellArgs + ([ "-n" "-c" channel "-p" "/${property}" ] ++ withType value) + } + ''; + + commands = mapAttrsToList + (channel: properties: mapAttrsToList (mkCommand channel) properties) + cfg.settings; + in concatMapStrings concatStrings commands); + }; +} diff --git a/third_party/home-manager/modules/modules.nix b/third_party/home-manager/modules/modules.nix index b62d6f4aa6..7e6d2e71d1 100644 --- a/third_party/home-manager/modules/modules.nix +++ b/third_party/home-manager/modules/modules.nix @@ -15,13 +15,16 @@ let modules = [ ./accounts/email.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 @@ -29,6 +32,7 @@ let ./misc/numlock.nix ./misc/pam.nix ./misc/qt.nix + ./misc/specialization.nix ./misc/submodule-support.nix ./misc/tmpfiles.nix ./misc/version.nix @@ -39,7 +43,9 @@ let ./misc/xdg-system-dirs.nix ./misc/xdg-user-dirs.nix ./misc/xdg.nix + ./misc/xfconf.nix ./programs/abook.nix + ./programs/aerc.nix ./programs/afew.nix ./programs/alacritty.nix ./programs/alot.nix @@ -49,47 +55,64 @@ let ./programs/autojump.nix ./programs/autorandr.nix ./programs/bash.nix + ./programs/bashmount.nix ./programs/bat.nix ./programs/beets.nix + ./programs/borgmatic.nix ./programs/bottom.nix ./programs/broot.nix ./programs/browserpass.nix + ./programs/btop.nix ./programs/chromium.nix ./programs/command-not-found/command-not-found.nix ./programs/dircolors.nix ./programs/direnv.nix + ./programs/discocss.nix ./programs/eclipse.nix ./programs/emacs.nix + ./programs/eww.nix ./programs/exa.nix ./programs/feh.nix ./programs/firefox.nix ./programs/fish.nix ./programs/foot.nix ./programs/fzf.nix + ./programs/gallery-dl.nix ./programs/getmail.nix ./programs/gh.nix ./programs/git.nix + ./programs/gitui.nix ./programs/gnome-terminal.nix ./programs/go.nix ./programs/gpg.nix + ./programs/havoc.nix + ./programs/helix.nix ./programs/hexchat.nix ./programs/himalaya.nix ./programs/home-manager.nix ./programs/htop.nix + ./programs/hyfetch.nix ./programs/i3status-rust.nix ./programs/i3status.nix ./programs/info.nix + ./programs/ion.nix ./programs/irssi.nix ./programs/java.nix ./programs/jq.nix + ./programs/just.nix + ./programs/k9s.nix ./programs/kakoune.nix ./programs/keychain.nix ./programs/kitty.nix + ./programs/kodi.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 @@ -97,15 +120,19 @@ let ./programs/mbsync.nix ./programs/mcfly.nix ./programs/mercurial.nix + ./programs/micro.nix ./programs/mpv.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/neovim.nix ./programs/newsboat.nix + ./programs/nheko.nix ./programs/nix-index.nix ./programs/nnn.nix ./programs/noti.nix @@ -114,40 +141,61 @@ let ./programs/obs-studio.nix ./programs/octant.nix ./programs/offlineimap.nix + ./programs/oh-my-posh.nix ./programs/opam.nix + ./programs/pandoc.nix ./programs/password-store.nix ./programs/pazi.nix ./programs/pet.nix ./programs/pidgin.nix + ./programs/pistol.nix ./programs/piston-cli.nix + ./programs/pls.nix ./programs/powerline-go.nix + ./programs/pubs.nix + ./programs/pylint.nix ./programs/qutebrowser.nix ./programs/rbw.nix ./programs/readline.nix ./programs/rofi-pass.nix ./programs/rofi.nix ./programs/rtorrent.nix + ./programs/sagemath.nix ./programs/sbt.nix ./programs/scmpuff.nix ./programs/senpai.nix + ./programs/sioyek.nix ./programs/skim.nix ./programs/sm64ex.nix + ./programs/sqls.nix ./programs/ssh.nix ./programs/starship.nix + ./programs/swaylock.nix ./programs/taskwarrior.nix + ./programs/tealdeer.nix ./programs/terminator.nix ./programs/termite.nix ./programs/texlive.nix + ./programs/thunderbird.nix + ./programs/timidity.nix + ./programs/tint2.nix + ./programs/tiny.nix + ./programs/tmate.nix ./programs/tmux.nix ./programs/topgrade.nix ./programs/urxvt.nix ./programs/vim.nix ./programs/vscode.nix ./programs/vscode/haskell.nix + ./programs/pywal.nix + ./programs/watson.nix ./programs/waybar.nix + ./programs/wezterm.nix ./programs/xmobar.nix + ./programs/yt-dlp.nix ./programs/z-lua.nix ./programs/zathura.nix + ./programs/zellij.nix ./programs/zoxide.nix ./programs/zplug.nix ./programs/zsh.nix @@ -155,10 +203,12 @@ let ./services/barrier.nix ./services/betterlockscreen.nix ./services/blueman-applet.nix + ./services/borgmatic.nix + ./services/cachix-agent.nix ./services/caffeine.nix ./services/cbatticon.nix + ./services/clipman.nix ./services/clipmenu.nix - ./services/compton.nix ./services/devilspie2.nix ./services/dropbox.nix ./services/dunst.nix @@ -166,14 +216,18 @@ let ./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/gnome-keyring.nix ./services/gpg-agent.nix ./services/grobi.nix + ./services/gromit-mpx.nix + ./services/home-manager-auto-upgrade.nix ./services/hound.nix ./services/imapnotify.nix ./services/kanshi.nix @@ -186,13 +240,17 @@ let ./services/lorri.nix ./services/mako.nix ./services/mbsync.nix + ./services/megasync.nix + ./services/mopidy.nix ./services/mpd.nix ./services/mpdris2.nix + ./services/mpd-discord-rpc.nix ./services/mpris-proxy.nix ./services/muchsync.nix ./services/network-manager-applet.nix ./services/nextcloud-client.nix ./services/notify-osd.nix + ./services/opensnitch-ui.nix ./services/owncloud-client.nix ./services/pantalaimon.nix ./services/parcellite.nix @@ -203,32 +261,43 @@ let ./services/picom.nix ./services/plan9port.nix ./services/playerctld.nix + ./services/plex-mpv-shim.nix ./services/polybar.nix ./services/poweralertd.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/rsibreak.nix + ./services/safeeyes.nix ./services/screen-locker.nix + ./services/sctd.nix ./services/spotifyd.nix ./services/stalonetray.nix ./services/status-notifier-watcher.nix + ./services/swayidle.nix ./services/sxhkd.nix ./services/syncthing.nix + ./services/systembus-notify.nix ./services/taffybar.nix ./services/tahoe-lafs.nix ./services/taskwarrior-sync.nix ./services/trayer.nix + ./services/twmn.nix ./services/udiskie.nix ./services/unclutter.nix ./services/unison.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/i3-sway/i3.nix ./services/window-managers/i3-sway/sway.nix ./services/window-managers/i3-sway/swaynag.nix + ./services/window-managers/spectrwm.nix ./services/window-managers/xmonad.nix ./services/wlsunset.nix ./services/xcape.nix @@ -240,9 +309,9 @@ let ./systemd.nix ./targets/darwin ./targets/generic-linux.nix - ./xcursor.nix ./xresources.nix ./xsession.nix + ./misc/nix.nix (pkgs.path + "/nixos/modules/misc/assertions.nix") (pkgs.path + "/nixos/modules/misc/meta.nix") ] ++ optional useNixpkgsModule ./misc/nixpkgs.nix diff --git a/third_party/home-manager/modules/po/ca.po b/third_party/home-manager/modules/po/ca.po new file mode 100644 index 0000000000..031f19f5fb --- /dev/null +++ b/third_party/home-manager/modules/po/ca.po @@ -0,0 +1,124 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-06-08 10:18+0000\n" +"Last-Translator: Leix b \n" +"Language-Team: Catalan \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.13-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Creant enllaços dels fitxers personals a %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Netejant enllaços orfes de %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Creant generació de perfil %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "No hi ha canvis, reutilitzant últim perfil generat %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Oops, Nix no ha pogut instal·lar el teu nou perfil de Home Manager.\n" +"\n" +"Potser hi ha un conflicte amb un paquet instal·lat mitjançant\n" +"\"%s\"? Prova d'executar\n" +"\n" +" %s\n" +"\n" +"i si hi ha un paquet conflictiu el pots eliminar amb\n" +"\n" +" %s\n" +"\n" +"i després provar d'activar la teva configuració de Home Manager de nou." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Activant %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Comprovant oldGenNum i oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Conflicte entre el número de generació prèvia i el camí! Aquests\n" +"han de ser o bé ambdós buits o definits com a:\n" +"\n" +" '%s' i '%s'\n" +"\n" +"Si no t'importa perdre les generacions de perfil prèvies,\n" +"la solució més fàcil probablement és executar:\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"i provar home-manager switch de nou. Bona Sort!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Començant activació de Home Manager" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Comprovant Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Execució de simulacre" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Execució en viu" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Utilitzant versió de Nix: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Variables d'activació:" diff --git a/third_party/home-manager/modules/po/da.po b/third_party/home-manager/modules/po/da.po new file mode 100644 index 0000000000..d2f5467e25 --- /dev/null +++ b/third_party/home-manager/modules/po/da.po @@ -0,0 +1,124 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-09-19 18:22+0000\n" +"Last-Translator: cafkafk \n" +"Language-Team: Danish \n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Skaber hjemme fil links i %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Opryder forældreløse links fra %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Kreere profil generation %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Ingen ændring så genbrug den seneste profil generation %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Åh nej, Nix fejlede i at installere din nye Home Manager profil! \n" +" \n" +"Måske er der en konflikt med en pakke der blev installeret gennem\n" +"\"%s\"? Prøv at køre \n" +"\n" +" %s\n" +" \n" +"og hvis der er en pakke konflikt, kan du fjerne pakken med \n" +" \n" +" %s\n" +" \n" +"og så prøve at genaktivere din Home Manager konfiguration igen." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Aktivere %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Tjekker fornuften af oldGenNum and oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Den forrige generations nummer og sti er i konflikt! Disse\n" +"skal enten begge være tomme, eller begge være sat, men er nu sat til \n" +" \n" +" '%s' and '%s'\n" +" \n" +"Hvis du ikke har noget mod at miste tidligere profil generationer så\n" +"er den nemmeste løsning nok at køre \n" +" \n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +" \n" +"og så prøve at køre home-manager switch igen. Held og lykke!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Starter Home Manager aktivation" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Udføre fornuft check af Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Dette er en tør kørsel" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Dette er en direkte kørsel" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Bruger Nix version: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Aktivere variable:" diff --git a/third_party/home-manager/modules/po/de.po b/third_party/home-manager/modules/po/de.po new file mode 100644 index 0000000000..c4f4c509c3 --- /dev/null +++ b/third_party/home-manager/modules/po/de.po @@ -0,0 +1,153 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: German \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Erstelle home Dateiverknpfungen in %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Bereinige verwaiste Links unter %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Erstelle Profilgeneration %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Keine Änderungen. Benutze daher letzte Profilgeneration %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Ups, Nix konnte Ihr neues Home Manager Profil nicht installieren!\n" +"\n" +"Vielleicht gibt es einen Konflikt mit einem Paket, welches über\n" +"\"%s\" installiert wurde? Versuchen Sie\n" +"\n" +" %s\n" +"\n" +"auszuführen und wenn es ein problematisches Paket gibt, entfernen Sie es\n" +"mit\n" +"\n" +" %s\n" +"\n" +"Versuchen Sie dann, Ihre Home Manager Konfiguration erneut zu aktivieren." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Aktiviere %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Überprüfe zur Sicherheit oldGenNum und oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Die vorherige Generationsnummer und -pfad stehen im Konflikt. Es\n" +"müssen entweder beide leer sein oder beide haben den Wert\n" +"\n" +" '%s' und '%s'\n" +"\n" +"Wenn es Ihnen nichts ausmacht frühere Generationen zu verlieren,\n" +"dann ist die einfachste Lösung folgendes auszuführen:\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"Führen Sie danach 'home-manager switch' aus. Viel Glück!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Starte Home Manager Aktivierung" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Überprüfe zur Sicherheit Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Dies ist ein Probelauf" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Dies ist eine Live-Ausführung" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Nutze Nix Version: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Aktivierungsvariablen:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "Ups, nix-env konnte Ihr neues Home Manager Profil nicht installieren!\n" +#~ "\n" +#~ "Vielleicht gibt es einen Konflikt mit einem Paket, welches über \"nix-env " +#~ "-i\" installiert wurde? Versuchen Sie\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "auszuführen und wenn es ein problematisches Paket gibt, entfernen Sie es " +#~ "mit\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Versuchen Sie dann, Ihre Home Manager Konfiguration erneut zu aktivieren." diff --git a/third_party/home-manager/modules/po/es.po b/third_party/home-manager/modules/po/es.po new file mode 100644 index 0000000000..b5c0ee58a3 --- /dev/null +++ b/third_party/home-manager/modules/po/es.po @@ -0,0 +1,151 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Spanish \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Creando vínculos del directorio de inicio en %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Limpiando vínculos huérfanos de %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Creando generación de perfil %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "No hay cambios, reutilizando la generación más reciente del perfil: %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Nix no pudo instalar el nuevo perfil de Home Manager!\n" +"\n" +"Tal vez haya un conflicto con algún paquete instalado con \"%s\"?\n" +"Intente ejecutar\n" +"\n" +" %s\n" +"\n" +"y si hay algún paquete en conflicto bórrelo con:\n" +"\n" +" %s\n" +"\n" +"Y después reintente activar su configuración de Home Manager." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Activando %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Chequeando oldGenNum y oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Conflicto entre ruta y número de la generación previa. Ambos deben o estar " +"vacíos o definidos como\n" +"\n" +" '%s' y '%s'\n" +"\n" +"Si no le importa perder las generaciones de perfil anteriores, la solución " +"más sencilla es ejecutar:\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"y luego reintente ejectuar \"home-manager switch\". Suerte!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Comenzando activación de Home Manager" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Chequeando Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Ejecución de simulacro" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Ejecución en vivo" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Usando Nix versión %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Variables de activación:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "nix-env no pudo instalar el nuevo perfil de Home Manager!\n" +#~ "\n" +#~ "Tal vez haya un conflicto con algún paquete instalado con \"nix-env -i\"? " +#~ "Intente ejecutar\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "y si hay algún paquete en conflicto bórrelo con:\n" +#~ "\n" +#~ " nix-env -e {paquete}\n" +#~ "\n" +#~ "Y después reintente activar su configuración de Home Manager." diff --git a/third_party/home-manager/modules/po/fa.po b/third_party/home-manager/modules/po/fa.po new file mode 100644 index 0000000000..fe1713272a --- /dev/null +++ b/third_party/home-manager/modules/po/fa.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: fa\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "" diff --git a/third_party/home-manager/modules/po/fi.po b/third_party/home-manager/modules/po/fi.po new file mode 100644 index 0000000000..4c3b6195e1 --- /dev/null +++ b/third_party/home-manager/modules/po/fi.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: fi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "" diff --git a/third_party/home-manager/modules/po/fr.po b/third_party/home-manager/modules/po/fr.po new file mode 100644 index 0000000000..c538ddc5dd --- /dev/null +++ b/third_party/home-manager/modules/po/fr.po @@ -0,0 +1,154 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-05-18 23:12+0000\n" +"Last-Translator: Naïm Camille Favier \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.13-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Création des liens de fichiers personnels dans %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Nettoyage des liens orphelins de %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Création de la génération de profil %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Pas de changement, réutilisation du dernier profil génération %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Oups, Nix n'a pas réussi à installer votre nouveau profil de Home Manager !\n" +"\n" +"Il y a peut-être un conflit avec un autre paquet qui a été installé avec\n" +"« %s » ? Essayez d'exécuter\n" +"\n" +" %s\n" +"\n" +"et s'il y a un paquet en conflit, vous pourrez le supprimer avec\n" +"\n" +" %s\n" +"\n" +"Après, essayez encore d'activer votre configuration de Home Manager." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Activation de %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Vérification de oldGenNum et oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Le numéro et le chemin de la génération précédente sont en conflit ! Ils " +"doivent\n" +"être vides ou les deux mis à\n" +"\n" +" '%s' et '%s'\n" +"\n" +"Si ça ne vous dérange pas de perdre les générations précédentes, la solution " +"la plus\n" +"simple est probablement d'exécuter\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"et de réessayer home-manager switch. Bonne chance !" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Démarrage de l'activation de Home Manager" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Vérification de Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Ceci est une fausse activation (essai à blanc)" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Ceci est une vraie activation" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Version de Nix : %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Variables d'activation :" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "Oups, nix-env n'a pas réussi à installer votre nouveau profil de Home " +#~ "Manager\n" +#~ "\n" +#~ "Il y a peut-être un conflit avec un autre paquet qui a été installé avec\n" +#~ "« nix-env -i » ? Essayez d'éxecuter\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "et s'il y a un paquet en conflict, vous pourrez le supprimer avec\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Après, essayez encore d'activer votre configuration de Home Manager." diff --git a/third_party/home-manager/modules/po/hm-modules.pot b/third_party/home-manager/modules/po/hm-modules.pot new file mode 100644 index 0000000000..7bff64af49 --- /dev/null +++ b/third_party/home-manager/modules/po/hm-modules.pot @@ -0,0 +1,98 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "" diff --git a/third_party/home-manager/modules/po/it.po b/third_party/home-manager/modules/po/it.po new file mode 100644 index 0000000000..b4c475c5b5 --- /dev/null +++ b/third_party/home-manager/modules/po/it.po @@ -0,0 +1,112 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-12-15 08:50+0000\n" +"Last-Translator: Walter Franzini \n" +"Language-Team: Italian \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.15-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Creo i collegamenti della home in %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Pulisco i collegamenti rimasti orfani da %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Creando profilo di generazione %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Nessuna modifica, verrà riutilizzata l'ultimo generazione di profilo %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Attivando %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Controllando oldGenNum e oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"I precedenti numero di generazione e il percorso sono in conflitto!\n" +"Devono essere entrambi vuoti o entrambi popolati ma ora sono impostati su\n" +"\n" +"'%s' e '%s'\n" +"\n" +"Se non ti dispiace perdere le generazioni di profili precedenti,\n" +"allora la soluzione più semplice è probabilmente eseguire i comandi\n" +"\n" +"rm %s/home-manager*\n" +"rm %s/current-home\n" +"\n" +"e provare a cambiare home-manager di nuovo. Buona fortuna!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Iniziando attivazione Home Manager" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Controllando Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Questo è un avvio secco" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Questa è una esecuzione live" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Versione di Nix in uso: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Variabili di attivazione:" diff --git a/third_party/home-manager/modules/po/ja.po b/third_party/home-manager/modules/po/ja.po new file mode 100644 index 0000000000..f5cec7ba21 --- /dev/null +++ b/third_party/home-manager/modules/po/ja.po @@ -0,0 +1,153 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Japanese \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "ホームファイルのリンクを %s に作ります" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "%s から無効なリンクを消去しています" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "世代 %s のプロファイルを生成しています" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "変更されていないので最新の世代 %s のプロファイルを再利用します" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"NixはHome Managerの新しいプロファイルをインストールできませんでした!\n" +"\n" +"おそらく\"%s\"を使ってインストールしたパッケージが矛盾しているのでは?\n" +"以下のコマンド\n" +"\n" +" %s\n" +"\n" +"を試してみて、もし衝突しているパッケージがあれば、\n" +"\n" +" %s\n" +"\n" +"で削除し、再度Home Managerの設定の有効化を試してみてください。" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "%s を有効化しています" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "oldGenNum と oldGenPath の健全性検査をしています" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"先行する世代番号とパスが矛盾しています!\n" +"それらはどちらも空かどちらもセットされていなければいけません。しかし\n" +"\n" +" '%s' と '%s'\n" +"\n" +"となっています。もしプロファイルの以前の世代を失っても構わないなら\n" +"おそらくもっとも簡単な解決法は\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"を実行して、home-manager switch を再び実行してみることでしょう。幸運を!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Home Managerの有効化を開始しました" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Nixの健全性検査中です" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "これは予行練習(dry run)です" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "これは実際に実行します" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Nix バージョン %s を使用しています" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "有効化変数:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "nix-envはHome managerの新しいプロファイルをインストールできませんでし" +#~ "た!\n" +#~ "\n" +#~ "おそらく\"nix-env -i\"を使ってインストールしたパッケージが矛盾しているので" +#~ "は?\n" +#~ "以下のコマンド\n" +#~ "\n" +#~ "nix-env -q\n" +#~ "\n" +#~ "を試してみて、もし衝突しているパッケージがあれば、\n" +#~ "\n" +#~ "nix-env -e {パッケージ名前}\n" +#~ "\n" +#~ "で削除し、再度Home Managerの設定の有効化を試してみてください。" diff --git a/third_party/home-manager/modules/po/ko.po b/third_party/home-manager/modules/po/ko.po new file mode 100644 index 0000000000..7c97f64a3f --- /dev/null +++ b/third_party/home-manager/modules/po/ko.po @@ -0,0 +1,154 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Korean \n" +"Language: ko\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "home 파일 링크를 %s에 생성하는 중" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "%s에서 연결이 끊어진 링크 파일들을 지우는 중" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "profile 세대 %s를 생성하는 중" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" +"바뀐 것이 없어서 가장 최근의 profile 세대 %s를 다시 사용하는 것으로 설정하는 " +"중" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"아이고, Nix가 새로운 홈 매니저 profile을 설치하는데 실패했네요!\n" +"\n" +"혹시나 \"%s\"를 이용해서 설치된 패키지와 충돌이 일어난 것 일까요?\n" +"다음의 명령어를 시도해보세요.\n" +"\n" +" %s\n" +"\n" +"만약 충돌하는 패키지가 있다면 다음의 명령어로 제거할 수 있습니다.\n" +"\n" +" %s\n" +"\n" +"그런 후, 다시 홈 매니저 설정을 활성화 해보세요." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "%s를 활성화 하는 중" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "oldGenNum과 oldGenPath가 정상인지 확인 중" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"이전 세대 번호와 경로가 서로 충돌하고 있습니다! 이들은 둘 다 비어있든지\n" +"아니면 둘 다 설정돼있어야 하는데 지금 이들은 다음으로 설정되어있습니다.\n" +"\n" +" '%s' 와 '%s'\n" +"\n" +"만약 이전 profile 세대들을 잃는 것이 상관없다면\n" +"가장 쉬운 해결 방법은 아마 다음의 명령어를 실행하는 것일 겁니다.\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"그런 후 'home-manager switch'를 다시 시도해 보십시오. 행운을 빕니다!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "홈 매니저 활성화를 시작하는 중" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Nix가 정상인지 확인 중" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "모의 실행 중 입니다" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "모의 실행이 아닌 실제 실행 중 입니다" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "사용 중인 Nix 버전: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "활성화 변수들:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "아이고, nix-env가 새로운 홈 매니저 profile을 설치하는데 실패했네요!\n" +#~ "\n" +#~ "혹시나 \"nix-env -i\"를 이용해서 설치된 패키지와 충돌이 일어난 것 일까" +#~ "요?\n" +#~ "다음의 명령어를 시도해보세요.\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "만약 충돌하는 패키지가 있다면 다음의 명령어로 제거할 수 있습니다.\n" +#~ "\n" +#~ " nix-env -e {패키지 이름}\n" +#~ "\n" +#~ "그런 후, 다시 홈 매니저 설정을 활성화 해보세요." diff --git a/third_party/home-manager/modules/po/lt.po b/third_party/home-manager/modules/po/lt.po new file mode 100644 index 0000000000..166bf80854 --- /dev/null +++ b/third_party/home-manager/modules/po/lt.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "" diff --git a/third_party/home-manager/modules/po/nb_NO.po b/third_party/home-manager/modules/po/nb_NO.po new file mode 100644 index 0000000000..11bc04d943 --- /dev/null +++ b/third_party/home-manager/modules/po/nb_NO.po @@ -0,0 +1,153 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Norwegian Bokmål \n" +"Language: nb_NO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Lager hjemmefillenker i %s …" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Tømmer overflødige lenker fra %s …" + +#: modules/files.nix:262 +#, fuzzy +msgid "Creating profile generation %s" +msgstr "Oppretter profil for generering %s …" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Ingen endring. Gjenbruker siste profilgenerering %s …" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Nix kunne ikke installere din nye Home Manager-profil!\n" +"\n" +"Kanskje det er en konflikt med en pakke som ble installert ved bruk av\n" +"«%s«? Prøv å kjøre\n" +"\n" +" %s\n" +"\n" +"og hvis det er en pakke i konflikt kan du fjerne den med\n" +"\n" +" %s\n" +"\n" +"for så å aktivere ditt Home Manager-oppsett igjen." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Aktiverer %s …" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Kontrollerer verdiene av oldGenNum og oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +#, fuzzy +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Forrige generasjonstall og sti er i konflikt. Disse\n" +"må enten begge være tomme, eller så må begge settes, men er nå\n" +"\n" +" «%s« og «%s«\n" +"\n" +"Hvis du ikke bryr deg om å miste tidligere profilgenereringer\n" +"er det enkleste å kjøre\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"for så å prøve «home-manager»-bryteren igjen. Lykke til!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Starter aktivering av hjemmebehandler …" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Kontrollerer at Nix fungerer" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Dette er en simulert kjøring" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Dette er en virkelig kjøring" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Bruker Nix-versjon: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Aktiveringsvariabler:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "nix-env kunne ikke installere din nye Home Manager-profil!\n" +#~ "\n" +#~ "Kanskje det er en konflikt med en pakke som ble installert ved bruk av\n" +#~ "«nix-env -i«? Prøv å kjøre\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "og hvis det er en pakke i konflikt kan du fjerne den med\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "for så å aktivere ditt Home Manager-oppsett igjen." diff --git a/third_party/home-manager/modules/po/nl.po b/third_party/home-manager/modules/po/nl.po new file mode 100644 index 0000000000..de46344b16 --- /dev/null +++ b/third_party/home-manager/modules/po/nl.po @@ -0,0 +1,126 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-11-16 13:47+0000\n" +"Last-Translator: Pablo Bollansee \n" +"Language-Team: Dutch \n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.15-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Home-bestandskoppelingen aan het maken in %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Wees links van %s aan het opkuisen" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Profiel generatie %s aan het maken" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" +"Geen veranderingen dus de laatste profiel generatie %s wordt hergebruikt" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Oei, het is Nix niet gelukt om je nieuwe Home Manager profiel te installeren!" +"\n" +"\n" +"Misschien is er een conflict met het pakket dat geïnstalleerd was met\n" +"\"%s\"? Probeer het volgende te draaien\n" +"\n" +" %s\n" +"\n" +"en als er een pakket is dat een conflict geeft kan je dat verwijderen met\n" +"\n" +" %s\n" +"\n" +"Probeer daarna je Home Manager configuratie opnieuw te activeren." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "%s aan het activeren" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "oldGenNum en oldGenPath aan het sanity checken" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Er is een conflict met de generatie nummer en pad! Deze\n" +"moeten beide leeg of beide ingevuld zijn, maar zijn nu\n" +"\n" +" '%s' en '%s'\n" +"\n" +"Als je het niet erg vindt je vorige profiel generaties te verliezen dan\n" +"is waarschijnlijk de eenvoudigste oplossing om het volgende te draaien\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"en dan opnieuw 'home-manager switch' te proberen. Veel succes!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Home manager activatie aan het starten" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Nix aan het sanity checken" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Dit is een oefening" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Dit is voor echt" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Nix versie %s wordt gebruikt" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Activatie variabelen:" diff --git a/third_party/home-manager/modules/po/pl.po b/third_party/home-manager/modules/po/pl.po new file mode 100644 index 0000000000..307ffc0115 --- /dev/null +++ b/third_party/home-manager/modules/po/pl.po @@ -0,0 +1,125 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-11-16 13:47+0000\n" +"Last-Translator: Jakub Janczak \n" +"Language-Team: Polish \n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.15-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Tworzenie dowiązań plików w %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Czyszczenie osieroconych linków z %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Tworzenie profilu generacji %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Brak zmian więc używam ostatniej generacji profilu %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Oops, Nix nie zdołał zainstalować twojego profilu Home Manager'a!\n" +"\n" +"Być może zaistniał konflikt z pakietem zainstalowanym przez\n" +"\"%s\"? Spróbuj uruchomić\n" +"\n" +" %s\n" +"\n" +"i jeśli istnieje konflikt możesz spróbować go rozwiązać uruchamiając\n" +"\n" +" %s\n" +"\n" +"Następnie spróbuj aktywować konfigurację Home Manager'a ponownie." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Aktywowanie %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Sprawdzanie poprawności oldGenNum i oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Istnieje konflikt pomiędzy poprzednią generacją i ścieżką! Powinny\n" +"być obie puste lub ustawione, a efektywnie są ustawione na:\n" +"\n" +" '%s' i '%s'\n" +"\n" +"Jeśli możesz sobie pozwolić na utratę poprzednich generacji,\n" +"możesz uruchomić\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"i spróbować uruchomić home-manager switch raz jeszcze. Powodzenia!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Rozpoczynam aktywację Home Managera" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Sprawdzanie poprawności Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "To jest wykonanie testowe" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "To jest wykonanie właściwe" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Używając wersji Nix: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Zmienne aktywacyjne:" diff --git a/third_party/home-manager/modules/po/pt_BR.po b/third_party/home-manager/modules/po/pt_BR.po new file mode 100644 index 0000000000..3ca9977ce7 --- /dev/null +++ b/third_party/home-manager/modules/po/pt_BR.po @@ -0,0 +1,124 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-04-04 11:11+0000\n" +"Last-Translator: Alex Miranda \n" +"Language-Team: Portuguese (Brazil) \n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Criando links simbólicos em %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Limpando links órfãos do directório %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Criando geração %s para o perfil" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Nenhuma mudança, portanto reusando a última geração %s para o perfil" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Opa! O nix não conseguiu instalar seu novo perfil do Home Manager.\n" +"\n" +"Talvez haja um conflito com um pacote que foi instalado usando\n" +"\"%s\"? Tente executar\n" +"\n" +" %s\n" +"\n" +"e se houver algum pacote com conflito, remova-o com\n" +"\n" +" %s\n" +"\n" +"E então tente novamente ativar a sua configuração do Home Manager." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Ativando %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Revalidando oldGenNum e oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"O número da geração anterior e o caminho não batem! Ambos\n" +"precisam estar ou vazios ou definidos, mas estão definidos como\n" +"\n" +" '%s' e '%s'\n" +"\n" +"Se você não se importa de perder gerações de perfis anteriores, então\n" +"a solução mais rápida é provavelmente rodar\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"e tentar rodar \"home-manager switch\" de novo. Boa sorte!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Iniciando ativação do Home Manager" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Revalidando Nix" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Essa é uma execução de teste" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Essa é uma execução de fato" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Usando versão do Nix: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Variáveis durante ativação:" diff --git a/third_party/home-manager/modules/po/ru.po b/third_party/home-manager/modules/po/ru.po new file mode 100644 index 0000000000..feba1b94ab --- /dev/null +++ b/third_party/home-manager/modules/po/ru.po @@ -0,0 +1,152 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Russian \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Создаю ссылки в домашней директории %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Удаляю устаревшие ссылки из %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Создаю профиль в поколении %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Изменений нет, переиспользую профиль в последнем поколении %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Ой, Nix не смог установить новый профиль Home Manager!\n" +"\n" +"Возможно, возник конфликт с пакетом, ранее установленным\n" +"с помощью \"%s\". Попробуйте выполнить\n" +"\n" +" %s\n" +"\n" +"и если найдётся конфликтующий пакет, удалите его командой\n" +"\n" +" %s\n" +"\n" +"После попробуйте активировать конфигурацию снова." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Активирую %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Сравниваю oldGenNum и oldGenPath на всякий" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Номер и путь прошлого поколения конфликтуют! Они должны быть\n" +"одинаково пустыми или заполненными, но сейчас имеют значения\n" +"\n" +" '%s' и '%s'\n" +"\n" +"Если вы не против потерять предыдущие профили, тогда,\n" +"вероятно, простейшим решением будет запустить\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"и выполнить home-manager switch ещё раз. Удачи!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Начинаю активацию Home Manager" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Проверяю Nix на всякий случай" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Это пробный запуск" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Это реальный запуск" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Использую Nix версии: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Переменные для активации:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "Ой, nix-env не смог установить новый профиль Home Manager!\n" +#~ "\n" +#~ "Возможно, возник конфликт с пакетом, ранее установленным\n" +#~ "с помощью \"nix-env -i\". Попробуйте выполнить\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "и если найдётся конфликтующий пакет, удалите его командой\n" +#~ "\n" +#~ " nix-env -e {имя пакета}\n" +#~ "\n" +#~ "После попробуйте активировать конфигурацию снова." diff --git a/third_party/home-manager/modules/po/sv.po b/third_party/home-manager/modules/po/sv.po new file mode 100644 index 0000000000..09e8a9e99a --- /dev/null +++ b/third_party/home-manager/modules/po/sv.po @@ -0,0 +1,151 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:56+0000\n" +"Last-Translator: Robert Helgesson \n" +"Language-Team: Swedish \n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "Skapar hemfil-länkar i %s" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Rensar bort överflödiga länkar från %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "Skapar profil för generation %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Ingen förändring, återanvänder därför profil-generation %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Ajdå, Nix lyckades inte installera din nya Home Manager-profil!\n" +"\n" +"Kanske det finns en konflikt med ett paket som installerades genom\n" +"\"%s\"? Prova att köra\n" +"\n" +" %s\n" +"\n" +"och om det finns ett paket som är i vägen så kan du ta bort det med\n" +"\n" +" %s\n" +"\n" +"Prova sedan att aktivera din Home Manager-konfiguration igen." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "Aktiverar %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "Kontrollerar värdena på oldGenNum och oldGenPath" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Föregående generationsnummer och sökväg motsäger varandra! Dessa måste\n" +"antingen båda vara tomma eller båda vara satta men de har nu värdena\n" +"\n" +" '%s' and '%s'\n" +"\n" +"Om du inte har något emot att förlora tidigare profilgenerationer så\n" +"är den enklaste lösningen antagligen att köra\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"och prova 'home-manager switch' igen. Lycka till!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Startar Home Manager-aktivering" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Kontrollerar att Nix funkar" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Detta är en simulerad körning" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Detta är en verklig körning" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Använder Nix-version: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Aktiveringsvariabler:" + +#~ msgid "" +#~ "Oops, nix-env failed to install your new Home Manager profile!\n" +#~ "\n" +#~ "Perhaps there is a conflict with a package that was installed using\n" +#~ "\"nix-env -i\"? Try running\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "and if there is a conflicting package you can remove it with\n" +#~ "\n" +#~ " nix-env -e {package name}\n" +#~ "\n" +#~ "Then try activating your Home Manager configuration again." +#~ msgstr "" +#~ "Ajdå, nix-env lyckades inte installera din nya Home Manager-profil!\n" +#~ "\n" +#~ "Kanske det finns en konflikt med ett paket som installerades genom\n" +#~ "\"nix-env -i\"? Prova att köra\n" +#~ "\n" +#~ " nix-env -q\n" +#~ "\n" +#~ "och om det finns ett paket som är i vägen så kan du ta bort det med\n" +#~ "\n" +#~ " nix-env -e {paketnamn}\n" +#~ "\n" +#~ "Prova sedan att aktivera din Home Manager-konfiguration igen." diff --git a/third_party/home-manager/modules/po/tr.po b/third_party/home-manager/modules/po/tr.po new file mode 100644 index 0000000000..5b7dad7396 --- /dev/null +++ b/third_party/home-manager/modules/po/tr.po @@ -0,0 +1,125 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-03-26 23:57+0000\n" +"Last-Translator: Oğuz Ersen \n" +"Language-Team: Turkish \n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.12-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "%s konumunda ev dosya bağlantıları oluşturuluyor" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "Geçersiz bağlantılar temizleniyor %s" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "%s profil inşası oluşturuluyor" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "Değişiklik yok, bu nedenle en son profil inşası %s yeniden kullanılıyor" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"Eyvah, Nix yeni Home Manager profilinizi kuramadı!\n" +"\n" +"Belki de \"%s\" kullanan kurulan paketlerin biriyle bir çakışma vardır?\n" +"\n" +" %s\n" +"\n" +"komutunu çalıştırın ve eğer çakışan bir paket varsa onu\n" +"\n" +" %s\n" +"\n" +"ile kaldırabilirsiniz. Sonra Home Manager yapılandırmanızı yeniden\n" +"etkinleştirmeyi deneyin." + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "%s etkinleştiriliyor" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "oldGenNum ve oldGenPath denetleniyor" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" +"Önceki inşa numarası ve yolu çakışıyor! Bunların ikisi de boş olmalı\n" +"veya ayarlanmalı ama şu anda\n" +"\n" +" '%s' ve '%s'\n" +"\n" +"olarak ayarlandı. Önceki profil inşalarını kaybetmeyi önemsemiyorsanız\n" +"en kolay çözüm muhtemelen\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"komutlarını çalıştırmak ve tekrar home-manager switch denemektir. İyi " +"şanslar!" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "Home Manager etkinleştirmesi başlatılıyor" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "Nix denetleniyor" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "Bu bir deneme çalıştırmasıdır" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "Bu bir gerçek çalıştırmadır" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "Kullanılan Nix sürümü: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "Etkinleştirme değişkenleri:" diff --git a/third_party/home-manager/modules/po/zh_Hans.po b/third_party/home-manager/modules/po/zh_Hans.po new file mode 100644 index 0000000000..ca62aa8749 --- /dev/null +++ b/third_party/home-manager/modules/po/zh_Hans.po @@ -0,0 +1,112 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-05-16 13:18+0000\n" +"Last-Translator: Yubo-Cao \n" +"Language-Team: Chinese (Simplified) \n" +"Language: zh_Hans\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.13-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "正在 %s 中创建家目录文件链接" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "正在从 %s 清理孤立链接" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "正在创建配置文件世代 %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "未发生变化,正在重新使用最近一次的配置文件世代 %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"糟糕,Nix 未能安装您的新 Home Manager 配置文件!\n" +"\n" +"也许这里和使用 \"%s\" 安装的包有冲突?\n" +"尝试运行\n" +"\n" +" %s\n" +"\n" +"如果有冲突的包,你可以用\n" +"\n" +" %s\n" +"\n" +"来移除。然后尝试再次激活您的 Home Manager 配置。" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "正在激活 %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "正在进行 oldGenNum 和 oldGenPath 的完整性检查" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "正在启动 Home Manager 初始化程序" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "正在进行 Nix 完整性检查" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "这是试运行" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "这是在实际运行" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "正在使用的 Nix 版本: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "激活的变量:" diff --git a/third_party/home-manager/modules/po/zh_Hant.po b/third_party/home-manager/modules/po/zh_Hant.po new file mode 100644 index 0000000000..0e7fc6f84c --- /dev/null +++ b/third_party/home-manager/modules/po/zh_Hant.po @@ -0,0 +1,112 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2023-01-08 11:50+0000\n" +"Last-Translator: Eric Ho \n" +"Language-Team: Chinese (Traditional) \n" +"Language: zh_Hant\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.15.1-dev\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "正在 %s 中建立家目錄檔案連結" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "正在從 %s 清理孤立連結" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "正在建立配置檔案世代 %s" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "未發生變化,正在重新使用最近一次的配置檔案世代 %s" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" +"糟糕,Nix 未能安裝您的新 Home Manager 配置文件!\n" +"\n" +"也許這裏和使用 \"%s\" 安裝的包有衝突?\n" +"嘗試運行\n" +"\n" +" %s\n" +"\n" +"如果有衝突的包,你可以用\n" +"\n" +" %s\n" +"\n" +"來移除。然後嘗試再次啟用您的 Home Manager 配置。" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "正在啟用 %s" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "正在進行 oldGenNum 和 oldGenPath 的完整性檢查" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "正在啟動 Home Manager 初始化程式" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "正在進行 Nix 完整性檢查" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "這是試運行" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "這是在實際運行" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "正在使用的 Nix 版本: %s" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "啟用的變數:" diff --git a/third_party/home-manager/modules/programs/aerc-accounts.nix b/third_party/home-manager/modules/programs/aerc-accounts.nix new file mode 100644 index 0000000000..ebe1d5413a --- /dev/null +++ b/third_party/home-manager/modules/programs/aerc-accounts.nix @@ -0,0 +1,131 @@ +{ config, lib, pkgs, confSections, confSection, ... }: + +with lib; + +let + mapAttrNames = f: attr: + with builtins; + listToAttrs (attrValues (mapAttrs (k: v: { + name = f k; + value = v; + }) attr)); + addAccountName = name: k: "${k}:account=${name}"; +in { + type = mkOption { + type = types.attrsOf (types.submodule { + options.aerc = { + enable = mkEnableOption "aerc"; + extraAccounts = mkOption { + type = confSection; + default = { }; + example = + literalExpression ''{ source = "maildir://~/Maildir/example"; }''; + description = '' + Extra config added to the configuration of this account in + $HOME/.config/aerc/accounts.conf. + See aerc-config(5). + ''; + }; + extraBinds = mkOption { + type = confSections; + default = { }; + example = literalExpression + ''{ messages = { d = ":move ''${folder.trash}"; }; }''; + description = '' + Extra bindings specific to this account, added to + $HOME/.config/aerc/accounts.conf. + See aerc-config(5). + ''; + }; + extraConfig = mkOption { + type = confSections; + default = { }; + example = literalExpression "{ ui = { sidebar-width = 42; }; }"; + description = '' + Extra config specific to this account, added to + $HOME/.config/aerc/aerc.conf. + See aerc-config(5). + ''; + }; + smtpAuth = mkOption { + type = with types; nullOr (enum [ "none" "plain" "login" ]); + default = "plain"; + example = "auth"; + description = '' + Sets the authentication mechanism if smtp is used as the outgoing + method. + See aerc-smtp(5). + ''; + }; + }; + }); + }; + 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 { }; + optPwCmd = k: p: + optAttr "${k}-cred-cmd" (nullOrMap (builtins.concatStringsSep " ") p); + mkConfig = { + maildir = cfg: { + source = + "maildir://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}"; + }; + imap = { userName, imap, passwordCommand, aerc, ... }@cfg: + let + protocol = if imap.tls.enable then + if imap.tls.useStartTls then "imap" else "imaps" + else + "imap+insecure"; + port' = optPort imap.port; + in { + source = "${protocol}://${userName}@${imap.host}${port'}"; + } // optPwCmd "source" passwordCommand; + smtp = { userName, smtp, passwordCommand, ... }@cfg: + let + loginMethod' = + if cfg.aerc.smtpAuth != null then "+${cfg.aerc.smtpAuth}" else ""; + protocol = if smtp.tls.enable && !smtp.tls.useStartTls then + "smtps${loginMethod'}" + else + "smtp${loginMethod'}"; + port' = optPort smtp.port; + smtp-starttls = + if smtp.tls.enable && smtp.tls.useStartTls then "yes" else null; + in { + outgoing = "${protocol}://${userName}@${smtp.host}${port'}"; + } // optPwCmd "outgoing" passwordCommand + // optAttr "smtp-starttls" smtp-starttls; + msmtp = cfg: { + outgoing = "msmtpq --read-envelope-from --read-recipients"; + }; + }; + basicCfg = account: + { + from = "${account.realName} <${account.address}>"; + } // (optAttr "copy-to" account.folders.sent) + // (optAttr "default" account.folders.inbox) + // (optAttr "postpone" account.folders.drafts) + // (optAttr "aliases" account.aliases) // account.aerc.extraAccounts; + sourceCfg = account: + if account.mbsync.enable || account.offlineimap.enable then + mkConfig.maildir account + else if account.imap != null then + mkConfig.imap account + else + { }; + outgoingCfg = account: + if account.msmtp.enable then + mkConfig.msmtp account + else if account.smtp != null then + mkConfig.smtp account + else + { }; + in (basicCfg account) // (sourceCfg account) // (outgoingCfg account); + mkAccountConfig = name: account: + mapAttrNames (addAccountName name) account.aerc.extraConfig; + mkAccountBinds = name: account: + mapAttrNames (addAccountName name) account.aerc.extraBinds; +} diff --git a/third_party/home-manager/modules/programs/aerc.nix b/third_party/home-manager/modules/programs/aerc.nix new file mode 100644 index 0000000000..ad44bf9064 --- /dev/null +++ b/third_party/home-manager/modules/programs/aerc.nix @@ -0,0 +1,165 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.programs.aerc; + primitive = with types; + ((type: either type (listOf type)) (nullOr (oneOf [ str int bool float ]))) + // { + description = + "values (null, bool, int, string of float) or a list of values, that will be joined with a comma"; + }; + confSection = types.attrsOf primitive; + confSections = types.attrsOf confSection; + sectionsOrLines = types.either types.lines confSections; + accounts = import ./aerc-accounts.nix { + inherit config pkgs lib confSection confSections; + }; + aerc-accounts = + attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts; +in { + meta.maintainers = with lib.hm.maintainers; [ lukasngl ]; + + options.accounts.email.accounts = accounts.type; + options.programs.aerc = { + + enable = mkEnableOption "aerc"; + + extraAccounts = mkOption { + type = sectionsOrLines; + default = { }; + example = literalExpression + ''{ Work = { source = "maildir://~/Maildir/work"; }; }''; + description = '' + Extra lines added to $HOME/.config/aerc/accounts.conf. + See aerc-config(5). + ''; + }; + + extraBinds = mkOption { + type = sectionsOrLines; + default = { }; + example = literalExpression ''{ messages = { q = ":quit"; }; }''; + description = '' + Extra lines added to $HOME/.config/aerc/binds.conf. + Global keybindings can be set in the `global` section. + See aerc-config(5). + ''; + }; + + extraConfig = mkOption { + type = sectionsOrLines; + default = { }; + example = literalExpression ''{ ui = { sort = "-r date"; }; }''; + description = '' + Extra lines added to $HOME/.config/aerc/aerc.conf. + See aerc-config(5). + ''; + }; + + stylesets = mkOption { + type = with types; attrsOf (either confSection lines); + default = { }; + example = literalExpression '' + { default = { ui = { "tab.selected.reverse" = toggle; }; }; }; + ''; + description = '' + Stylesets added to $HOME/.config/aerc/stylesets/. + See aerc-stylesets(7). + ''; + }; + templates = mkOption { + type = with types; attrsOf lines; + default = { }; + example = literalExpression '' + { new_message = "Hello!"; }; + ''; + description = '' + Templates added to $HOME/.config/aerc/templates/. + See aerc-templates(7). + ''; + }; + }; + + config = let + joinCfg = cfgs: + with builtins; + concatStringsSep "\n" (filter (v: v != "") cfgs); + toINI = conf: # quirk: global section is prepended w/o section heading + let + global = conf.global or { }; + local = removeAttrs conf [ "global" ]; + optNewLine = if global != { } && local != { } then "\n" else ""; + mkValueString = v: + with builtins; + if isList v then # join with comma + 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 builtins.isString conf then conf else toINI conf; + mkStyleset = attrsets.mapAttrs' (k: v: + let value = if builtins.isString v then v else toINI { global = v; }; + in { + name = "aerc/stylesets/${k}"; + value.text = joinCfg [ header value ]; + }); + mkTemplates = attrsets.mapAttrs' (k: v: { + name = "aerc/templates/${k}"; + value.text = v; + }); + accountsExtraAccounts = builtins.mapAttrs accounts.mkAccount aerc-accounts; + accountsExtraConfig = + builtins.mapAttrs accounts.mkAccountConfig aerc-accounts; + accountsExtraBinds = + builtins.mapAttrs accounts.mkAccountBinds aerc-accounts; + joinContextual = contextual: + with builtins; + joinCfg (map mkINI (attrValues contextual)); + header = '' + # Generated by Home Manager. + ''; + in mkIf cfg.enable { + warnings = if ((cfg.extraAccounts != "" && cfg.extraAccounts != { }) + || accountsExtraAccounts != { }) + && (cfg.extraConfig.general.unsafe-accounts-conf or false) == false then ['' + aerc: An email account was configured, but `extraConfig.general.unsafe-accounts-conf` is set to false or unset. + This will prevent aerc from starting, see `unsafe-accounts-conf` in aerc-config(5) for details. + Consider setting the option `extraConfig.general.unsafe-accounts-conf` to true. + ''] else + [ ]; + home.packages = [ pkgs.aerc ]; + xdg.configFile = { + "aerc/accounts.conf" = mkIf + ((cfg.extraAccounts != "" && cfg.extraAccounts != { }) + || accountsExtraAccounts != { }) { + text = joinCfg [ + header + (mkINI cfg.extraAccounts) + (mkINI accountsExtraAccounts) + ]; + }; + "aerc/aerc.conf" = + mkIf (cfg.extraConfig != "" && cfg.extraConfig != { }) { + text = joinCfg [ + header + (mkINI cfg.extraConfig) + (joinContextual accountsExtraConfig) + ]; + }; + "aerc/binds.conf" = mkIf ((cfg.extraBinds != "" && cfg.extraBinds != { }) + || accountsExtraBinds != { }) { + text = joinCfg [ + header + (mkINI cfg.extraBinds) + (joinContextual accountsExtraBinds) + ]; + }; + } // (mkStyleset cfg.stylesets) // (mkTemplates cfg.templates); + }; +} diff --git a/third_party/home-manager/modules/programs/alacritty.nix b/third_party/home-manager/modules/programs/alacritty.nix index d34efb7759..eaf304144d 100644 --- a/third_party/home-manager/modules/programs/alacritty.nix +++ b/third_party/home-manager/modules/programs/alacritty.nix @@ -37,8 +37,8 @@ in { ''; description = '' Configuration written to - ~/.config/alacritty/alacritty.yml. See - + $XDG_CONFIG_HOME/alacritty/alacritty.yml. See + for the default configuration. ''; }; diff --git a/third_party/home-manager/modules/programs/astroid.nix b/third_party/home-manager/modules/programs/astroid.nix index 296e8dc5e4..4e79ea4d3c 100644 --- a/third_party/home-manager/modules/programs/astroid.nix +++ b/third_party/home-manager/modules/programs/astroid.nix @@ -42,7 +42,8 @@ let template = fromJSON (readFile ./astroid-config-template.json); astroidConfig = foldl' recursiveUpdate template [ { - astroid.notmuch_config = "${config.xdg.configHome}/notmuch/notmuchrc"; + astroid.notmuch_config = + "${config.xdg.configHome}/notmuch/default/config"; accounts = mapAttrs (n: accountAttr) astroidAccounts; crypto.gpg.path = "${pkgs.gnupg}/bin/gpg"; } diff --git a/third_party/home-manager/modules/programs/atuin.nix b/third_party/home-manager/modules/programs/atuin.nix index dcf1232f8f..9a38f54218 100644 --- a/third_party/home-manager/modules/programs/atuin.nix +++ b/third_party/home-manager/modules/programs/atuin.nix @@ -40,6 +40,16 @@ in { ''; }; + enableFishIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Atuin's Fish integration. + + If enabled, this will bind the up-arrow key to open the Atuin history. + ''; + }; + settings = mkOption { type = with types; let @@ -60,7 +70,7 @@ in { ''; description = '' Configuration written to - ~/.config/atuin/config.toml. + $XDG_CONFIG_HOME/atuin/config.toml. See for the full list of options. @@ -79,12 +89,20 @@ in { }; programs.bash.initExtra = mkIf cfg.enableBashIntegration '' - source "${pkgs.bash-preexec}/share/bash/bash-preexec.sh" - eval "$(${cfg.package}/bin/atuin init bash)" + if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then + source "${pkgs.bash-preexec}/share/bash/bash-preexec.sh" + eval "$(${cfg.package}/bin/atuin init bash)" + fi ''; programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' - eval "$(${cfg.package}/bin/atuin init zsh)" + if [[ $options[zle] = on ]]; then + eval "$(${cfg.package}/bin/atuin init zsh)" + fi + ''; + + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' + ${cfg.package}/bin/atuin init fish | source ''; }; } diff --git a/third_party/home-manager/modules/programs/autorandr.nix b/third_party/home-manager/modules/programs/autorandr.nix index 359795e85d..9e7c6fcc43 100644 --- a/third_party/home-manager/modules/programs/autorandr.nix +++ b/third_party/home-manager/modules/programs/autorandr.nix @@ -89,13 +89,6 @@ let example = "60.00"; }; - panning = mkOption { - type = types.str; - description = "X11 panning specification ([width]x[height]+[x]+[y])."; - default = ""; - example = "3840x2160+0+0"; - }; - gamma = mkOption { type = types.str; description = "Output gamma configuration."; @@ -183,6 +176,13 @@ let } ''; }; + + filter = mkOption { + type = types.nullOr (types.enum [ "bilinear" "nearest" ]); + description = "Interpolation method to be used for scaling the output."; + default = null; + example = "nearest"; + }; }; }; @@ -266,9 +266,9 @@ let ++ optional (config.dpi != null) "dpi ${toString config.dpi}" ++ optional (config.gamma != "") "gamma ${config.gamma}" ++ optional (config.mode != "") "mode ${config.mode}" - ++ optional (config.panning != "") "panning ${config.panning}" ++ 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 " + concatMapStringsSep "," toString (flatten config.transform)) ++ optional (config.scale != null) @@ -305,7 +305,7 @@ in { DPI=144 ;; *) - echo "Unknown profle: $AUTORANDR_CURRENT_PROFILE" + echo "Unknown profile: $AUTORANDR_CURRENT_PROFILE" exit 1 esac diff --git a/third_party/home-manager/modules/programs/bash.nix b/third_party/home-manager/modules/programs/bash.nix index c0165fe763..742087b7d8 100644 --- a/third_party/home-manager/modules/programs/bash.nix +++ b/third_party/home-manager/modules/programs/bash.nix @@ -6,6 +6,13 @@ let cfg = config.programs.bash; + writeBashScript = name: text: pkgs.writeTextFile { + inherit name text; + checkPhase = '' + ${pkgs.stdenv.shellDryRun} "$target" + ''; + }; + in { @@ -23,6 +30,27 @@ in programs.bash = { enable = mkEnableOption "GNU Bourne-Again SHell"; + enableCompletion = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Bash completion for all interactive Bash shells. + + + + Note, if you use NixOS or nix-darwin and do not have Bash completion + enabled in the system configuration, then make sure to add + + + environment.pathsToLink = [ "/share/bash-completion" ]; + + + to your system configuration to get completion for system packages. + Note, the legacy /etc/bash_completion.d path is + not supported by Home Manager. + ''; + }; + historySize = mkOption { type = types.int; default = 10000; @@ -174,11 +202,11 @@ in HISTCONTROL = concatStringsSep ":" cfg.historyControl; } // optionalAttrs (cfg.historyIgnore != []) { - HISTIGNORE = concatStringsSep ":" cfg.historyIgnore; + HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore); } )); in mkIf cfg.enable { - home.file.".bash_profile".source = pkgs.writeShellScript "bash_profile" '' + home.file.".bash_profile".source = writeBashScript "bash_profile" '' # include .profile if it exists [[ -f ~/.profile ]] && . ~/.profile @@ -186,7 +214,16 @@ in [[ -f ~/.bashrc ]] && . ~/.bashrc ''; - home.file.".profile".source = pkgs.writeShellScript "profile" '' + # 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 (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" ${sessionVarsStr} @@ -194,7 +231,7 @@ in ${cfg.profileExtra} ''; - home.file.".bashrc".source = pkgs.writeShellScript "bashrc" '' + home.file.".bashrc".source = writeBashScript "bashrc" '' ${cfg.bashrcExtra} # Commands that should be applied only for interactive shells. @@ -210,7 +247,7 @@ in ''; home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") { - source = pkgs.writeShellScript "bash_logout" cfg.logoutExtra; + source = writeBashScript "bash_logout" cfg.logoutExtra; }; } ); diff --git a/third_party/home-manager/modules/programs/bashmount.nix b/third_party/home-manager/modules/programs/bashmount.nix new file mode 100644 index 0000000000..38d57456e7 --- /dev/null +++ b/third_party/home-manager/modules/programs/bashmount.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.bashmount; + +in { + meta.maintainers = [ maintainers.AndersonTorres ]; + + options.programs.bashmount = { + enable = mkEnableOption "bashmount"; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Configuration written to + $XDG_CONFIG_HOME/bashmount/config. Look at + + for explanation about possible values. + ''; + }; + + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.bashmount ]; + + xdg.configFile."bashmount/config" = + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + }; +} diff --git a/third_party/home-manager/modules/programs/bat.nix b/third_party/home-manager/modules/programs/bat.nix index 30b0bbb715..df2e496855 100644 --- a/third_party/home-manager/modules/programs/bat.nix +++ b/third_party/home-manager/modules/programs/bat.nix @@ -30,6 +30,16 @@ in { ''; }; + extraPackages = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExpression + "with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];"; + description = '' + Additional bat packages to install. + ''; + }; + themes = mkOption { type = types.attrsOf types.lines; default = { }; @@ -51,7 +61,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.bat ]; + home.packages = [ pkgs.bat ] ++ cfg.extraPackages; xdg.configFile = mkMerge ([{ "bat/config" = diff --git a/third_party/home-manager/modules/programs/beets.nix b/third_party/home-manager/modules/programs/beets.nix index a0b8a346b0..fa959669c2 100644 --- a/third_party/home-manager/modules/programs/beets.nix +++ b/third_party/home-manager/modules/programs/beets.nix @@ -45,7 +45,7 @@ in { default = { }; description = '' Configuration written to - ~/.config/beets/config.yaml + $XDG_CONFIG_HOME/beets/config.yaml ''; }; }; diff --git a/third_party/home-manager/modules/programs/borgmatic.nix b/third_party/home-manager/modules/programs/borgmatic.nix new file mode 100644 index 0000000000..d69803884d --- /dev/null +++ b/third_party/home-manager/modules/programs/borgmatic.nix @@ -0,0 +1,196 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.borgmatic; + + mkNullableOption = args: + lib.mkOption (args // { + type = lib.types.nullOr args.type; + default = null; + }); + + mkRetentionOption = frequency: + mkNullableOption { + type = types.int; + description = + "Number of ${frequency} archives to keep. Use -1 for no limit."; + example = 3; + }; + + extraConfigOption = mkOption { + type = with types; attrsOf (oneOf [ str bool path int (listOf str) ]); + default = { }; + description = "Extra settings."; + }; + + consistencyCheckModule = types.submodule { + options = { + name = mkOption { + type = types.enum [ "repository" "archives" "data" "extract" ]; + description = "Name of consistency check to run."; + example = "repository"; + }; + + frequency = mkNullableOption { + type = types.strMatching "([[:digit:]]+ .*)|always"; + description = "Frequency of this type of check"; + example = "2 weeks"; + }; + }; + }; + + configModule = types.submodule { + options = { + location = { + sourceDirectories = mkOption { + type = types.listOf types.str; + description = "Directories to backup."; + example = literalExpression "[config.home.homeDirectory]"; + }; + + repositories = mkOption { + type = types.listOf types.str; + description = "Paths to repositories."; + example = + literalExpression ''["ssh://myuser@myrepo.myserver.com/./repo"]''; + }; + + 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; + }; + }; + }; + + removeNullValues = attrSet: filterAttrs (key: value: value != null) attrSet; + + writeConfig = config: + generators.toYAML { } { + location = removeNullValues { + source_directories = config.location.sourceDirectories; + repositories = config.location.repositories; + } // config.location.extraConfig; + storage = removeNullValues { + encryption_passcommand = config.storage.encryptionPasscommand; + } // config.storage.extraConfig; + retention = removeNullValues { + 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; + } // config.retention.extraConfig; + consistency = removeNullValues { checks = config.consistency.checks; } + // config.consistency.extraConfig; + }; +in { + meta.maintainers = [ maintainers.DamienCassou ]; + + options = { + programs.borgmatic = { + enable = mkEnableOption "Borgmatic"; + + package = mkPackageOption pkgs "borgmatic" { }; + + backups = mkOption { + type = types.attrsOf configModule; + description = '' + Borgmatic allows for several named backup configurations, + each with its own source directories and repositories. + ''; + example = literalExpression '' + { + personal = { + location = { + sourceDirectories = [ "/home/me/personal" ]; + repositories = [ "ssh://myuser@myserver.com/./personal-repo" ]; + }; + }; + work = { + location = { + sourceDirectories = [ "/home/me/work" ]; + repositories = [ "ssh://myuser@myserver.com/./work-repo" ]; + }; + }; + }; + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.borgmatic" pkgs + lib.platforms.linux) + ]; + + xdg.configFile = with lib.attrsets; + mapAttrs' (configName: config: + nameValuePair ("borgmatic.d/" + configName + ".yaml") { + text = writeConfig config; + }) cfg.backups; + + home.packages = [ cfg.package ]; + }; +} diff --git a/third_party/home-manager/modules/programs/broot.nix b/third_party/home-manager/modules/programs/broot.nix index 79ffb3888d..d78074ef4f 100644 --- a/third_party/home-manager/modules/programs/broot.nix +++ b/third_party/home-manager/modules/programs/broot.nix @@ -8,14 +8,159 @@ let tomlFormat = pkgs.formats.toml { }; - brootConf = { - verbs = cfg.verbs; - skin = cfg.skin; - modal = cfg.modal; + settingsModule = { + freeformType = tomlFormat.type; + + options = { + modal = mkEnableOption "modal (vim) mode"; + + verbs = mkOption { + type = with types; listOf (attrsOf (either bool str)); + default = [ ]; + example = literalExpression '' + [ + { invocation = "p"; execution = ":parent"; } + { invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}" ; } + { invocation = "create {subpath}"; execution = "$EDITOR {directory}/{subpath}"; } + { invocation = "view"; execution = "less {file}"; } + { + invocation = "blop {name}\\.{type}"; + execution = "mkdir {parent}/{type} && ''${pkgs.neovim}/bin/nvim {parent}/{type}/{name}.{type}"; + from_shell = true; + } + ] + ''; + description = '' + Define new verbs. For more information, see + . + + The possible attributes are: + + + + + + invocation (optional) + how the verb is called by the user, with placeholders for arguments + + + execution (mandatory) + how the verb is executed + + + key (optional) + a keyboard key triggering execution + + + shortcut (optional) + an alternate way to call the verb (without + the arguments part) + + + leave_broot (optional) + whether to quit broot on execution + (default: true) + + + from_shell (optional) + whether the verb must be executed from the + parent shell (default: + false) + + + ''; + }; + + skin = mkOption { + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + status_normal_fg = "grayscale(18)"; + status_normal_bg = "grayscale(3)"; + status_error_fg = "red"; + status_error_bg = "yellow"; + tree_fg = "red"; + selected_line_bg = "grayscale(7)"; + permissions_fg = "grayscale(12)"; + size_bar_full_bg = "red"; + size_bar_void_bg = "black"; + directory_fg = "lightyellow"; + input_fg = "cyan"; + flag_value_fg = "lightyellow"; + table_border_fg = "red"; + code_fg = "lightyellow"; + } + ''; + description = '' + Color configuration. + + Complete list of keys (expected to change before the v1 of broot): + + + char_match + code + directory + exe + file + file_error + flag_label + flag_value + input + link + permissions + selected_line + size_bar_full + size_bar_void + size_text + spinner + status_error + status_normal + table_border + tree + unlisted + + + + Add _fg for a foreground color and + _bg for a background colors. + ''; + }; + }; }; + shellInit = shell: + # Using mkAfter to make it more likely to appear after other + # manipulations of the prompt. + mkAfter '' + source ${ + pkgs.runCommand "br.${shell}" { nativeBuildInputs = [ cfg.package ]; } + "broot --print-shell-function ${shell} > $out" + } + ''; in { - meta.maintainers = [ maintainers.aheaume ]; + meta.maintainers = [ hm.maintainers.aheaume ]; + + 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" + ]) + ]; options.programs.broot = { enable = mkEnableOption "Broot, a better way to navigate directories"; @@ -44,83 +189,6 @@ in { ''; }; - modal = mkEnableOption "modal (vim) mode"; - - verbs = mkOption { - type = with types; listOf (attrsOf (either bool str)); - default = [ - { - invocation = "p"; - execution = ":parent"; - } - { - invocation = "edit"; - shortcut = "e"; - execution = "$EDITOR {file}"; - } - { - invocation = "create {subpath}"; - execution = "$EDITOR {directory}/{subpath}"; - } - { - invocation = "view"; - execution = "less {file}"; - } - ]; - example = literalExpression '' - [ - { invocation = "p"; execution = ":parent"; } - { invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}" ; } - { invocation = "create {subpath}"; execution = "$EDITOR {directory}/{subpath}"; } - { invocation = "view"; execution = "less {file}"; } - { - invocation = "blop {name}\\.{type}"; - execution = "/bin/mkdir {parent}/{type} && /usr/bin/nvim {parent}/{type}/{name}.{type}"; - from_shell = true; - } - ] - ''; - description = '' - Define new verbs. For more information, see - . - - The possible attributes are: - - - - - - invocation (optional) - how the verb is called by the user, with placeholders for arguments - - - execution (mandatory) - how the verb is executed - - - key (optional) - a keyboard key triggering execution - - - shortcut (optional) - an alternate way to call the verb (without - the arguments part) - - - leave_broot (optional) - whether to quit broot on execution - (default: true) - - - from_shell (optional) - whether the verb must be executed from the - parent shell (default: - false) - - - ''; - }; - package = mkOption { type = types.package; default = pkgs.broot; @@ -128,149 +196,48 @@ in { description = "Package providing broot"; }; - skin = mkOption { - type = types.attrsOf types.str; + settings = mkOption { + type = types.submodule settingsModule; default = { }; - example = literalExpression '' - { - status_normal_fg = "grayscale(18)"; - status_normal_bg = "grayscale(3)"; - status_error_fg = "red"; - status_error_bg = "yellow"; - tree_fg = "red"; - selected_line_bg = "grayscale(7)"; - permissions_fg = "grayscale(12)"; - size_bar_full_bg = "red"; - size_bar_void_bg = "black"; - directory_fg = "lightyellow"; - input_fg = "cyan"; - flag_value_fg = "lightyellow"; - table_border_fg = "red"; - code_fg = "lightyellow"; - } - ''; - description = '' - Color configuration. - - Complete list of keys (expected to change before the v1 of broot): - - - char_match - code - directory - exe - file - file_error - flag_label - flag_value - input - link - permissions - selected_line - size_bar_full - size_bar_void - size_text - spinner - status_error - status_normal - table_border - tree - unlisted - - - - Add _fg for a foreground color and - _bg for a background colors. - ''; + description = "Verbatim config entries"; }; }; config = mkIf cfg.enable { home.packages = [ cfg.package ]; - xdg.configFile."broot/conf.toml".source = - tomlFormat.generate "broot-config" brootConf; + xdg.configFile."broot" = { + recursive = true; + source = pkgs.symlinkJoin { + name = "xdg.configFile.broot"; + paths = [ + (pkgs.writeTextDir "conf.toml" (builtins.readFile + (tomlFormat.generate "broot-config" cfg.settings))) - # Dummy file to prevent broot from trying to reinstall itself - xdg.configFile."broot/launcher/installed-v1".text = ""; + # Copy all files under /resources/default-conf + "${cfg.package.src}/resources/default-conf" - programs.bash.initExtra = mkIf cfg.enableBashIntegration ( - # Using mkAfter to make it more likely to appear after other - # manipulations of the prompt. - mkAfter '' - # This script was automatically generated by the broot function - # More information can be found in https://github.com/Canop/broot - # This function starts broot and executes the command - # it produces, if any. - # It's needed because some shell commands, like `cd`, - # have no useful effect if executed in a subshell. - function br { - f=$(mktemp) - ( - set +e - broot --outcmd "$f" "$@" - code=$? - if [ "$code" != 0 ]; then - rm -f "$f" - exit "$code" - fi - ) - code=$? - if [ "$code" != 0 ]; then - return "$code" - fi - d=$(cat "$f") - rm -f "$f" - eval "$d" - } - ''); + # Dummy file to prevent broot from trying to reinstall itself + (pkgs.writeTextDir "launcher/installed-v1" "") + ]; - programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' - # This script was automatically generated by the broot function - # More information can be found in https://github.com/Canop/broot - # This function starts broot and executes the command - # it produces, if any. - # It's needed because some shell commands, like `cd`, - # have no useful effect if executed in a subshell. - function br { - f=$(mktemp) - ( - set +e - broot --outcmd "$f" "$@" - code=$? - if [ "$code" != 0 ]; then - rm -f "$f" - exit "$code" - fi - ) - code=$? - if [ "$code" != 0 ]; then - return "$code" - fi - d=$(cat "$f") - rm -f "$f" - eval "$d" + # Remove conf.hjson, whose content has been merged into programs.broot.settings + postBuild = '' + rm $out/conf.hjson + ''; + }; + }; + + programs.broot.settings = builtins.fromJSON (builtins.readFile + (pkgs.runCommand "default-conf.json" { + nativeBuildInputs = [ pkgs.hjson ]; } - ''; + "hjson -c ${cfg.package.src}/resources/default-conf/conf.hjson > $out")); - programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - # This script was automatically generated by the broot function - # More information can be found in https://github.com/Canop/broot - # This function starts broot and executes the command - # it produces, if any. - # It's needed because some shell commands, like `cd`, - # have no useful effect if executed in a subshell. - function br - set f (mktemp) - broot --outcmd $f $argv - if test $status -ne 0 - rm -f "$f" - return "$code" - end - set d (cat "$f") - rm -f "$f" - eval "$d" - end - ''; + programs.bash.initExtra = mkIf cfg.enableBashIntegration (shellInit "bash"); + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration (shellInit "zsh"); + + programs.fish.shellInit = mkIf cfg.enableFishIntegration (shellInit "fish"); }; } diff --git a/third_party/home-manager/modules/programs/browserpass.nix b/third_party/home-manager/modules/programs/browserpass.nix index 10a2883c87..8faf53151b 100644 --- a/third_party/home-manager/modules/programs/browserpass.nix +++ b/third_party/home-manager/modules/programs/browserpass.nix @@ -2,7 +2,9 @@ with lib; -let browsers = [ "chrome" "chromium" "firefox" "vivaldi" ]; +let + cfg = config.programs.browserpass; + browsers = [ "brave" "chrome" "chromium" "firefox" "vivaldi" ]; in { options = { programs.browserpass = { @@ -17,10 +19,22 @@ in { }; }; - config = mkIf config.programs.browserpass.enable { + config = mkIf cfg.enable { home.file = foldl' (a: b: a // b) { } (concatMap (x: with pkgs.stdenv; - if x == "chrome" then + 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" @@ -71,6 +85,6 @@ in { "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; }] else - throw "unknown browser ${x}") config.programs.browserpass.browsers); + throw "unknown browser ${x}") cfg.browsers); }; } diff --git a/third_party/home-manager/modules/programs/btop.nix b/third_party/home-manager/modules/programs/btop.nix new file mode 100644 index 0000000000..cdf011e79f --- /dev/null +++ b/third_party/home-manager/modules/programs/btop.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.btop; + + finalConfig = let + toKeyValue = generators.toKeyValue { + mkKeyValue = 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} + ${optionalString (cfg.extraConfig != "") cfg.extraConfig} + ''; + +in { + meta.maintainers = [ hm.maintainers.GaetanLepage ]; + + options.programs.btop = { + enable = mkEnableOption "btop"; + + package = mkPackageOption pkgs "btop" { }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool float int str ]); + default = { }; + example = { + color_theme = "Default"; + theme_background = false; + }; + description = '' + Options to add to btop.conf file. + See + for options. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra lines added to the btop.conf file. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."btop/btop.conf" = + mkIf (cfg.settings != { }) { text = finalConfig; }; + }; +} diff --git a/third_party/home-manager/modules/programs/chromium.nix b/third_party/home-manager/modules/programs/chromium.nix index 5a10fe760b..646d847302 100644 --- a/third_party/home-manager/modules/programs/chromium.nix +++ b/third_party/home-manager/modules/programs/chromium.nix @@ -4,6 +4,15 @@ with lib; let + supportedBrowsers = [ + "chromium" + "google-chrome" + "google-chrome-beta" + "google-chrome-dev" + "brave" + "vivaldi" + ]; + browserModule = defaultPkg: name: visible: let browser = (builtins.parseDrvName defaultPkg.name).name; @@ -11,10 +20,10 @@ let in { enable = mkOption { inherit visible; + type = types.bool; default = false; example = true; description = "Whether to enable ${name}."; - type = lib.types.bool; }; package = mkOption { @@ -24,6 +33,25 @@ let defaultText = literalExpression "pkgs.${browser}"; description = "The ${name} package to use."; }; + + commandLineArgs = mkOption { + inherit visible; + type = types.listOf types.str; + default = [ ]; + example = [ "--enable-logging=stderr" "--ignore-gpu-blocklist" ]; + description = '' + List of command-line arguments to be passed to ${name}. + + Note this option does not have any effect when using a + custom package for . + + For a list of common switches, see + Chrome switches. + + To search switches for other components, see + Chromium codesearch. + ''; + }; } // optionalAttrs (!isProprietaryChrome) { # Extensions do not work with Google Chrome # see https://github.com/nix-community/home-manager/issues/1383 @@ -36,7 +64,7 @@ let id = mkOption { type = strMatching "[a-zA-Z]{32}"; description = '' - The extension's ID from the Chome Web Store url or the unpacked crx. + The extension's ID from the Chrome Web Store url or the unpacked crx. ''; default = ""; }; @@ -105,6 +133,7 @@ let drvName = (builtins.parseDrvName cfg.package.name).name; browser = if drvName == "ungoogled-chromium" then "chromium" else drvName; + isProprietaryChrome = hasPrefix "google-chrome" drvName; darwinDirs = { chromium = "Chromium"; @@ -135,9 +164,19 @@ let in mkIf cfg.enable { home.packages = [ cfg.package ]; - home.file = listToAttrs (map extensionJson (cfg.extensions or [ ])); + home.file = optionalAttrs (!isProprietaryChrome) + (listToAttrs (map extensionJson cfg.extensions)); }; + browserPkgs = genAttrs supportedBrowsers (browser: + let cfg = config.programs.${browser}; + in if cfg.commandLineArgs != [ ] then + pkgs.${browser}.override { + commandLineArgs = concatStringsSep " " cfg.commandLineArgs; + } + else + pkgs.${browser}); + in { # Extensions do not work with the proprietary Google Chrome version # see https://github.com/nix-community/home-manager/issues/1383 @@ -149,20 +188,17 @@ in { ]; options.programs = { - chromium = browserModule pkgs.chromium "Chromium" true; - google-chrome = browserModule pkgs.google-chrome "Google Chrome" false; + chromium = browserModule browserPkgs.chromium "Chromium" true; + google-chrome = + browserModule browserPkgs.google-chrome "Google Chrome" false; google-chrome-beta = - browserModule pkgs.google-chrome-beta "Google Chrome Beta" false; + browserModule browserPkgs.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; + browserModule browserPkgs.google-chrome-dev "Google Chrome Dev" false; + brave = browserModule browserPkgs.brave "Brave Browser" false; + vivaldi = browserModule browserPkgs.vivaldi "Vivaldi Browser" false; }; - config = mkMerge [ - (browserConfig config.programs.chromium) - (browserConfig config.programs.google-chrome) - (browserConfig config.programs.google-chrome-beta) - (browserConfig config.programs.google-chrome-dev) - (browserConfig config.programs.brave) - ]; + config = mkMerge + (map (browser: browserConfig config.programs.${browser}) supportedBrowsers); } diff --git a/third_party/home-manager/modules/programs/direnv.nix b/third_party/home-manager/modules/programs/direnv.nix index ad4c499346..1d6ef2127d 100644 --- a/third_party/home-manager/modules/programs/direnv.nix +++ b/third_party/home-manager/modules/programs/direnv.nix @@ -29,7 +29,7 @@ in { default = { }; description = '' Configuration written to - ~/.config/direnv/config.toml. + $XDG_CONFIG_HOME/direnv/direnv.toml. See @@ -45,7 +45,7 @@ in { default = ""; description = '' Custom stdlib written to - ~/.config/direnv/direnvrc. + $XDG_CONFIG_HOME/direnv/direnvrc. ''; }; @@ -72,7 +72,20 @@ in { description = '' Whether to enable Fish integration. Note, enabling the direnv module will always active its functionality for Fish since the direnv package - automatically gets loaded in Fish. + automatically gets loaded in Fish. If this is not the case try adding + + environment.pathsToLink = [ "/share/fish" ]; + + to the system configuration. + ''; + }; + + enableNushellIntegration = mkOption { + default = true; + type = types.bool; + readOnly = true; + description = '' + Whether to enable Nushell integration. ''; }; @@ -88,7 +101,7 @@ in { config = mkIf cfg.enable { home.packages = [ pkgs.direnv ]; - xdg.configFile."direnv/config.toml" = mkIf (cfg.config != { }) { + xdg.configFile."direnv/direnv.toml" = mkIf (cfg.config != { }) { source = tomlFormat.generate "direnv-config" cfg.config; }; @@ -108,5 +121,28 @@ in { programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' eval "$(${pkgs.direnv}/bin/direnv hook zsh)" ''; + + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ( + # Using mkAfter to make it more likely to appear after other + # manipulations of the prompt. + mkAfter '' + ${pkgs.direnv}/bin/direnv hook fish | source + ''); + + programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration ( + # Using mkAfter to make it more likely to appear after other + # manipulations of the prompt. + mkAfter '' + let-env config = ($env | default {} config).config + let-env config = ($env.config | default {} hooks) + let-env config = ($env.config | update hooks ($env.config.hooks | default [] pre_prompt)) + let-env config = ($env.config | update hooks.pre_prompt ($env.config.hooks.pre_prompt | append { + code: " + let direnv = (${pkgs.direnv}/bin/direnv export json | from json) + let direnv = if ($direnv | length) == 1 { $direnv } else { {} } + $direnv | load-env + " + })) + ''); }; } diff --git a/third_party/home-manager/modules/programs/discocss.nix b/third_party/home-manager/modules/programs/discocss.nix new file mode 100644 index 0000000000..5a35f187f3 --- /dev/null +++ b/third_party/home-manager/modules/programs/discocss.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.programs.discocss; +in { + meta.maintainers = with maintainers; [ kranzes ]; + + options = { + programs.discocss = { + enable = mkEnableOption + "discocss, a tiny Discord CSS injector for Linux and MacOS"; + + package = mkPackageOption pkgs "discocss" { }; + + discordPackage = mkPackageOption pkgs "discord" { }; + + discordAlias = mkOption { + type = types.bool; + default = true; + description = "Whether to alias discocss to discord."; + }; + + css = mkOption { + type = types.str; + default = ""; + description = "The custom CSS for discocss to use."; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [{ + assertion = cfg.discordAlias + -> !(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 = [ + (cfg.package.override { + discordAlias = cfg.discordAlias; + discord = cfg.discordPackage; + }) + ]; + + xdg.configFile."discocss/custom.css".text = cfg.css; + }; +} diff --git a/third_party/home-manager/modules/programs/emacs.nix b/third_party/home-manager/modules/programs/emacs.nix index 4e69c55b0e..a9a779497f 100644 --- a/third_party/home-manager/modules/programs/emacs.nix +++ b/third_party/home-manager/modules/programs/emacs.nix @@ -13,11 +13,15 @@ let emacsWithPackages = emacsPackages.emacsWithPackages; - createConfPackage = epkgs: - epkgs.trivialBuild { - pname = "default"; - src = pkgs.writeText "default.el" cfg.extraConfig; - }; + extraPackages = epkgs: + let + packages = cfg.extraPackages epkgs; + userConfig = epkgs.trivialBuild { + pname = "default"; + src = pkgs.writeText "default.el" cfg.extraConfig; + packageRequires = packages; + }; + in packages ++ optional (cfg.extraConfig != "") userConfig; in { meta.maintainers = [ maintainers.rycee ]; @@ -48,6 +52,10 @@ in { Configuration to include in the Emacs default init file. See for more. + + Note, the inhibit-startup-message Emacs option + cannot be set here since Emacs disallows setting it from the default + initialization file. ''; }; @@ -91,10 +99,6 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.finalPackage ]; - programs.emacs = { - finalPackage = emacsWithPackages cfg.extraPackages; - extraPackages = epkgs: - optional (cfg.extraConfig != "") (createConfPackage epkgs); - }; + programs.emacs.finalPackage = emacsWithPackages extraPackages; }; } diff --git a/third_party/home-manager/modules/programs/eww.nix b/third_party/home-manager/modules/programs/eww.nix new file mode 100644 index 0000000000..9200986d4d --- /dev/null +++ b/third_party/home-manager/modules/programs/eww.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.eww; + +in { + meta.maintainers = [ hm.maintainers.mainrs ]; + + options.programs.eww = { + enable = mkEnableOption "eww"; + + package = mkOption { + type = types.package; + default = pkgs.eww; + defaultText = literalExpression "pkgs.eww"; + example = literalExpression "pkgs.eww"; + description = '' + The eww package to install. + ''; + }; + + configDir = mkOption { + type = types.path; + example = literalExpression "./eww-config-dir"; + description = '' + The directory that gets symlinked to + $XDG_CONFIG_HOME/eww. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + xdg.configFile."eww".source = cfg.configDir; + }; +} diff --git a/third_party/home-manager/modules/programs/exa.nix b/third_party/home-manager/modules/programs/exa.nix index 771e4e65ce..a1b4a2712e 100644 --- a/third_party/home-manager/modules/programs/exa.nix +++ b/third_party/home-manager/modules/programs/exa.nix @@ -15,16 +15,19 @@ let }; in { - meta.maintainers = [ maintainers.kalhauge ]; + meta.maintainers = [ hm.maintainers.kalhauge ]; options.programs.exa = { enable = mkEnableOption "exa, a modern replacement for ls"; + enableAliases = mkEnableOption "recommended exa aliases"; + + package = mkPackageOption pkgs "exa" { }; }; config = mkIf cfg.enable { - home.packages = [ pkgs.exa ]; + home.packages = [ cfg.package ]; programs.bash.shellAliases = mkIf cfg.enableAliases aliases; @@ -32,5 +35,6 @@ in { programs.fish.shellAliases = mkIf cfg.enableAliases aliases; + programs.ion.shellAliases = mkIf cfg.enableAliases aliases; }; } diff --git a/third_party/home-manager/modules/programs/feh.nix b/third_party/home-manager/modules/programs/feh.nix index e098342b53..15aac17518 100644 --- a/third_party/home-manager/modules/programs/feh.nix +++ b/third_party/home-manager/modules/programs/feh.nix @@ -27,6 +27,8 @@ in { options.programs.feh = { enable = mkEnableOption "feh - a fast and light image viewer"; + package = mkPackageOption pkgs "feh" { }; + buttons = mkOption { default = { }; type = with types; bindingsOf (either str int); @@ -69,7 +71,7 @@ in { "To disable a keybinding, use `null` instead of an empty string."; }]; - home.packages = [ pkgs.feh ]; + home.packages = [ cfg.package ]; xdg.configFile."feh/buttons" = mkIf (cfg.buttons != { }) { text = renderBindings cfg.buttons + "\n"; }; diff --git a/third_party/home-manager/modules/programs/firefox.nix b/third_party/home-manager/modules/programs/firefox.nix index 292bbb91aa..a0620e28d4 100644 --- a/third_party/home-manager/modules/programs/firefox.nix +++ b/third_party/home-manager/modules/programs/firefox.nix @@ -8,6 +8,8 @@ let cfg = config.programs.firefox; + jsonFormat = pkgs.formats.json { }; + mozillaConfigPath = if isDarwin then "Library/Application Support/Mozilla" else ".mozilla"; @@ -42,7 +44,7 @@ let mkUserJs = prefs: extraPrefs: bookmarks: let - prefs' = lib.optionalAttrs ({ } != bookmarks) { + prefs' = lib.optionalAttrs ([ ] != bookmarks) { "browser.bookmarks.file" = toString (firefoxBookmarksFile bookmarks); "browser.places.importBookmarksHTML" = true; } // prefs; @@ -58,20 +60,40 @@ let firefoxBookmarksFile = bookmarks: let - escapeXML = replaceStrings [ ''"'' "'" "<" ">" "&" ] [ - """ - "'" - "<" - ">" - "&" - ]; - mapper = _: entry: '' -

${escapeXML entry.name} - ''; - bookmarksEntries = lib.attrsets.mapAttrsToList mapper bookmarks; + indent = level: + lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level)); + + bookmarkToHTML = indentLevel: bookmark: + '' + ${indent indentLevel}
${escapeXML bookmark.name}''; + + directoryToHTML = indentLevel: directory: '' + ${indent indentLevel}
${ + if directory.toolbar then + ''

Bookmarks Toolbar'' + else + "

${escapeXML directory.name}" + }

+ ${indent indentLevel}

+ ${allItemsToHTML (indentLevel + 1) directory.bookmarks} + ${indent indentLevel}

''; + + itemToHTMLOrRecurse = indentLevel: item: + if item ? "url" then + bookmarkToHTML indentLevel item + else + directoryToHTML indentLevel item; + + allItemsToHTML = indentLevel: bookmarks: + lib.concatStringsSep "\n" + (map (itemToHTMLOrRecurse indentLevel) bookmarks); + + bookmarkEntries = allItemsToHTML 1 bookmarks; in pkgs.writeText "firefox-bookmarks.html" '' + 1 + + + + + ''; + + stylesheetTagsAsSettingWithId = '' + + + + + + + + + ''; + + stylesheetAdvancedSettingsRootTag = '' + + Generated by Home Manager. + + + + + ''; + + stylesheetSourcesRootTag = '' + + Generated by Home Manager. + + + + + ''; + + stylesheetAddonSettingsRootTag = '' + + Generated by Home Manager. + + + + + ''; + + attrsetToXml = attrs: name: stylesheet: + pkgs.runCommand name { + # Package splicing for libxslt does not work correctly leading to errors + # when cross-compiling. Use the version from buildPackages explicitely to + # fix this. + nativeBuildInputs = [ pkgs.buildPackages.libxslt.bin ]; + xml = builtins.toXML attrs; + passAsFile = [ "xml" ]; + } '' + xsltproc ${stylesheet} - < "$xmlPath" > "$out" + ''; + + attrsetToAdvancedSettingsXml = attrs: name: + let + stylesheet = builtins.toFile "stylesheet.xsl" '' + ${stylesheetCommonHeader} + ${stylesheetAdvancedSettingsRootTag} + ${stylesheetNestedTags} + ${stylesheetCommonFooter} + ''; + in attrsetToXml attrs name stylesheet; + + attrsetToSourcesXml = attrs: name: + let + stylesheet = builtins.toFile "stylesheet.xsl" '' + ${stylesheetCommonHeader} + ${stylesheetSourcesRootTag} + ${stylesheetNestedTags} + ${stylesheetCommonFooter} + ''; + in attrsetToXml attrs name stylesheet; + + attrsetToAddonSettingsXml = attrs: name: + let + stylesheet = builtins.toFile "stylesheet.xsl" '' + ${stylesheetCommonHeader} + ${stylesheetAddonSettingsRootTag} + ${stylesheetTagsAsSettingWithId} + ${stylesheetCommonFooter} + ''; + in attrsetToXml attrs name stylesheet; + +in { + meta.maintainers = [ hm.maintainers.dwagenk ]; + + options.programs.kodi = { + enable = mkEnableOption "Kodi"; + + package = mkOption { + type = types.package; + default = pkgs.kodi; + defaultText = literalExpression "pkgs.kodi"; + example = literalExpression + "pkgs.kodi.withPackages (exts: [ exts.pvr-iptvsimple ])"; + description = '' + The kodi package to use. + Can be used to specify extensions. + ''; + }; + + datadir = mkOption { + type = types.path; + default = "${config.home.homeDirectory}/.kodi"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/.kodi"''; + example = literalExpression ''"''${config.xdg.dataHome}/kodi"''; + description = "Directory to store configuration and metadata."; + }; + + settings = mkOption { + type = with types; + let + valueType = either str (attrsOf valueType) // { + description = "attribute sets of strings"; + }; + in nullOr valueType; + default = null; + example = literalExpression '' + { videolibrary.showemptytvshows = "true"; } + ''; + description = '' + Configuration to write to the advancedsettings.xml + file in kodis userdata directory. Settings specified here will be + immutable from inside kodi and be hidden from the GUI settings dialog. + + See as + reference for how settings need to be specified. + + The innermost attributes must be of type str. + ''; + }; + + sources = mkOption { + type = with types; + let + valueType = oneOf [ str (attrsOf valueType) (listOf valueType) ] // { + description = "attribute sets or lists of strings"; + }; + in nullOr valueType; + default = null; + example = literalExpression '' + { + video = { + default = "movies"; + source = [ + { name = "videos"; path = "/path/to/videos"; allowsharing = "true"; } + { name = "movies"; path = "/path/to/movies"; allowsharing = "true"; } + ]; + }; + } + ''; + description = '' + Contents to populate the file sources.xml in kodis + userdata directory. + + See as + reference for how sources need to be specified. + + Kodi will still show the dialogs to modify sources in the GUI and they + appear to be mutable. This however is not the case and the sources will + stay as specified via Home Manager. + + The innermost attributes must be of type str. + ''; + }; + + addonSettings = mkOption { + type = with types; nullOr (attrsOf (attrsOf str)); + default = null; + example = literalExpression '' + { "service.xbmc.versioncheck".versioncheck_enable = "false"; } + ''; + description = '' + Attribute set with the plugin namespace as toplevel key and the plugins + settings as lower level key/value pairs. + + Kodi will still show the settings of plugins configured via this + mechanism in the GUI and they appear to be mutable. This however is + not the case and the settings will stay as specified via Home Manager. + ''; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.kodi" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + home.sessionVariables = { KODI_DATA = cfg.datadir; }; + } + + (mkIf (cfg.settings != null) { + home.file."${cfg.datadir}/userdata/advancedsettings.xml".source = + attrsetToAdvancedSettingsXml cfg.settings "kodi-advancedsettings.xml"; + }) + + (mkIf (cfg.sources != null) { + home.file."${cfg.datadir}/userdata/sources.xml".source = + attrsetToSourcesXml cfg.sources "kodi-sources.xml"; + }) + + (mkIf (cfg.addonSettings != null) { + home.file = mapAttrs' (k: v: + attrsets.nameValuePair + ("${cfg.datadir}/userdata/addon_data/${k}/settings.xml") { + source = attrsetToAddonSettingsXml v "kodi-addon-${k}-settings.xml"; + }) cfg.addonSettings; + }) + ]); +} diff --git a/third_party/home-manager/modules/programs/lazygit.nix b/third_party/home-manager/modules/programs/lazygit.nix index f2d516200f..84dab379cc 100644 --- a/third_party/home-manager/modules/programs/lazygit.nix +++ b/third_party/home-manager/modules/programs/lazygit.nix @@ -11,11 +11,13 @@ let inherit (pkgs.stdenv.hostPlatform) isDarwin; in { - meta.maintainers = [ maintainers.kalhauge ]; + meta.maintainers = [ hm.maintainers.kalhauge ]; options.programs.lazygit = { enable = mkEnableOption "lazygit, a simple terminal UI for git commands"; + package = mkPackageOption pkgs "lazygit" { }; + settings = mkOption { type = yamlFormat.type; default = { }; @@ -32,7 +34,7 @@ in { ''; description = '' Configuration written to - ~/.config/lazygit/config.yml on Linux + $XDG_CONFIG_HOME/lazygit/config.yml on Linux or ~/Library/Application Support/lazygit/config.yml on Darwin. See for supported values. @@ -41,7 +43,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.lazygit ]; + home.packages = [ cfg.package ]; home.file."Library/Application Support/lazygit/config.yml" = mkIf (cfg.settings != { } && isDarwin) { diff --git a/third_party/home-manager/modules/programs/ledger.nix b/third_party/home-manager/modules/programs/ledger.nix new file mode 100644 index 0000000000..c51ed7d12f --- /dev/null +++ b/third_party/home-manager/modules/programs/ledger.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.ledger; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.ledger = { + enable = mkEnableOption "ledger, a double-entry accounting system"; + + package = mkPackageOption pkgs "ledger" { }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = literalExpression '' + --sort date + --effective + --date-format %Y-%m-%d + ''; + description = '' + Configuration written to $XDG_CONFIG_HOME/ledger/ledgerrc. + See + for explanation about possible values. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."ledger/ledgerrc" = + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + }; +} diff --git a/third_party/home-manager/modules/programs/less.nix b/third_party/home-manager/modules/programs/less.nix index 3bee0a828b..9e6e672012 100644 --- a/third_party/home-manager/modules/programs/less.nix +++ b/third_party/home-manager/modules/programs/less.nix @@ -19,7 +19,7 @@ in { ''; description = '' Extra configuration for less written to - $HOME/.lesskey. + $XDG_CONFIG_HOME/lesskey. ''; }; }; @@ -27,6 +27,6 @@ in { config = mkIf cfg.enable { home.packages = [ pkgs.less ]; - home.file.".lesskey".text = cfg.keys; + xdg.configFile."lesskey".text = cfg.keys; }; } diff --git a/third_party/home-manager/modules/programs/lf.nix b/third_party/home-manager/modules/programs/lf.nix index 06333e9c99..8f0a07cb8b 100644 --- a/third_party/home-manager/modules/programs/lf.nix +++ b/third_party/home-manager/modules/programs/lf.nix @@ -58,6 +58,15 @@ in { programs.lf = { enable = mkEnableOption "lf"; + package = mkOption { + type = types.package; + default = pkgs.lf; + defaultText = literalExpression "pkgs.lf"; + description = '' + lf package to use. + ''; + }; + settings = mkOption { type = lfSettingsType; default = { }; @@ -169,7 +178,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.lf ]; + home.packages = [ cfg.package ]; xdg.configFile."lf/lfrc".text = let fmtSetting = k: v: @@ -180,9 +189,8 @@ in { "${k} ${if isInt v then toString v else ''"${v}"''}" }"; - settingsStr = concatStringsSep "\n" (filter (x: x != "") - (mapAttrsToList fmtSetting - (builtins.intersectAttrs knownSettings cfg.settings))); + settingsStr = concatStringsSep "\n" (remove "" (mapAttrsToList fmtSetting + (builtins.intersectAttrs knownSettings cfg.settings))); fmtCmdMap = before: k: v: "${before} ${k}${optionalString (v != null && v != "") " ${v}"}"; diff --git a/third_party/home-manager/modules/programs/librewolf.nix b/third_party/home-manager/modules/programs/librewolf.nix new file mode 100644 index 0000000000..99613d46b8 --- /dev/null +++ b/third_party/home-manager/modules/programs/librewolf.nix @@ -0,0 +1,59 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.librewolf; + + mkOverridesFile = prefs: '' + // Generated by Home Manager. + + ${concatStrings (mapAttrsToList (name: value: '' + defaultPref("${name}", ${builtins.toJSON value}); + '') prefs)} + ''; + +in { + meta.maintainers = [ maintainers.onny ]; + + options.programs.librewolf = { + enable = + mkEnableOption "Librewolf browser, a privacy enhanced Firefox fork"; + + package = mkOption { + type = types.package; + default = pkgs.librewolf; + defaultText = literalExpression "pkgs.librewolf"; + description = "The LibreWolf package to use."; + }; + + settings = mkOption { + type = with types; attrsOf (either bool (either int str)); + default = { }; + example = literalExpression '' + { + "webgl.disabled" = false; + "privacy.resistFingerprinting" = false; + } + ''; + description = '' + Attribute set of LibreWolf settings and overrides. Refer to + + for details on supported values. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.librewolf" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + home.file.".librewolf/librewolf.overrides.cfg".text = + mkOverridesFile cfg.settings; + }; +} diff --git a/third_party/home-manager/modules/programs/lieer.nix b/third_party/home-manager/modules/programs/lieer.nix index e0369ffc66..15fda1ae7e 100644 --- a/third_party/home-manager/modules/programs/lieer.nix +++ b/third_party/home-manager/modules/programs/lieer.nix @@ -238,8 +238,8 @@ in { package = mkOption { type = types.package; - default = pkgs.gmailieer; - defaultText = "pkgs.gmailieer"; + default = pkgs.lieer; + defaultText = "pkgs.lieer"; description = '' lieer package to use. ''; diff --git a/third_party/home-manager/modules/programs/looking-glass-client.nix b/third_party/home-manager/modules/programs/looking-glass-client.nix new file mode 100644 index 0000000000..1c14282b97 --- /dev/null +++ b/third_party/home-manager/modules/programs/looking-glass-client.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.looking-glass-client; + settingsFormat = pkgs.formats.ini { }; +in { + meta.maintainers = with maintainers; [ j-brn ]; + + options.programs.looking-glass-client = { + enable = mkEnableOption "looking-glass-client"; + + package = mkPackageOption pkgs "looking-glass-client" { }; + + settings = mkOption { + type = settingsFormat.type; + default = { }; + description = "looking-glass-client settings."; + example = literalExpression '' + { + app = { + allowDMA = true; + shmFile = "/dev/kvmfr0"; + }; + + win = { + fullScreen = true; + showFPS = false; + jitRender = true; + }; + + spice = { + enable = true; + audio = true; + }; + + input = { + rawMouse = true; + escapeKey = 62; + }; + } + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "programs.looking-glass-client" pkgs + platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xdg.configFile."looking-glass/client.ini" = mkIf (cfg.settings != { }) { + source = + settingsFormat.generate ("looking-glass-client.ini") cfg.settings; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/lsd.nix b/third_party/home-manager/modules/programs/lsd.nix index b5dd260e02..0b54abe3de 100644 --- a/third_party/home-manager/modules/programs/lsd.nix +++ b/third_party/home-manager/modules/programs/lsd.nix @@ -39,7 +39,7 @@ in { }; description = '' Configuration written to - ~/.config/lsd/config.yaml. See + $XDG_CONFIG_HOME/lsd/config.yaml. See for supported values. ''; diff --git a/third_party/home-manager/modules/programs/man.nix b/third_party/home-manager/modules/programs/man.nix index b235b02fe2..69ae5cac79 100644 --- a/third_party/home-manager/modules/programs/man.nix +++ b/third_party/home-manager/modules/programs/man.nix @@ -2,7 +2,8 @@ with lib; -{ +let cfg = config.programs.man; +in { options = { programs.man = { enable = mkOption { @@ -15,6 +16,13 @@ with lib; ''; }; + package = mkOption { + type = types.package; + default = pkgs.man; + defaultText = literalExpression "pkgs.man"; + description = "The man package to use."; + }; + generateCaches = mkOption { type = types.bool; default = false; @@ -39,7 +47,7 @@ with lib; }; config = mkIf config.programs.man.enable { - home.packages = [ pkgs.man ]; + home.packages = [ cfg.package ]; home.extraOutputsToInstall = [ "man" ]; # This is mostly copy/pasted/adapted from NixOS' documentation.nix. @@ -61,7 +69,7 @@ with lib; echo "MANDB_MAP ${manualPages}/share/man $out" > man.conf # Run mandb to generate cache files: - ${pkgs.man-db}/bin/mandb -C man.conf --no-straycats --create \ + ${cfg.package}/bin/mandb -C man.conf --no-straycats --create \ ${manualPages}/share/man ''; in '' diff --git a/third_party/home-manager/modules/programs/mangohud.nix b/third_party/home-manager/modules/programs/mangohud.nix index 0f14a8c63a..f095e0736b 100644 --- a/third_party/home-manager/modules/programs/mangohud.nix +++ b/third_party/home-manager/modules/programs/mangohud.nix @@ -39,7 +39,7 @@ in { type = types.bool; default = false; description = '' - Sets environment variables so that + Sets environment variables so that MangoHud is started on any application that supports it. ''; }; @@ -55,8 +55,8 @@ in { ''; description = '' Configuration written to - ~/.config/MangoHud/MangoHud.conf. See - + $XDG_CONFIG_HOME/MangoHud/MangoHud.conf. See + for the default configuration. ''; }; @@ -74,8 +74,8 @@ in { description = '' Sets MangoHud settings per application. Configuration written to - ~/.config/MangoHud/{application_name}.conf. See - + $XDG_CONFIG_HOME/MangoHud/{application_name}.conf. See + for the default configuration. ''; }; diff --git a/third_party/home-manager/modules/programs/mbsync-accounts.nix b/third_party/home-manager/modules/programs/mbsync-accounts.nix index fa3f00ab33..af368b9dfc 100644 --- a/third_party/home-manager/modules/programs/mbsync-accounts.nix +++ b/third_party/home-manager/modules/programs/mbsync-accounts.nix @@ -4,7 +4,8 @@ with lib; let - extraConfigType = with lib.types; attrsOf (either (either str int) bool); + extraConfigType = with lib.types; + attrsOf (oneOf [ str int bool (listOf str) ]); perAccountGroups = { name, config, ... }: { options = { diff --git a/third_party/home-manager/modules/programs/mbsync.nix b/third_party/home-manager/modules/programs/mbsync.nix index 1ba493dd83..373828a0b2 100644 --- a/third_party/home-manager/modules/programs/mbsync.nix +++ b/third_party/home-manager/modules/programs/mbsync.nix @@ -63,7 +63,7 @@ let if isList v then concatMapStringsSep " " (genValue n) v else if isBool v then - (if v then "yes" else "no") + lib.hm.booleans.yesNo v else if isInt v then toString v else if isString v && hasSpace v then @@ -158,8 +158,8 @@ let genGroupsChannels = group: concatStringsSep "\n" (genChannelStrings group.name group.channels); # Generate all channel configurations for all groups for this account. - in concatStringsSep "\n" (filter (s: s != "") - (mapAttrsToList (name: group: genGroupsChannels group) groups)); + in concatStringsSep "\n" + (remove "" (mapAttrsToList (name: group: genGroupsChannels group) groups)); # Given the attr set of groups, return a string which maps channels to groups genAccountGroups = groups: @@ -177,9 +177,9 @@ let # of the groups and its consituent channels. genGroupsStrings = mapAttrsToList (name: info: concatStringsSep "\n" (genGroupChannelString groups.${name})) groups; - in concatStringsSep "\n\n" (filter (s: s != "") - genGroupsStrings) # filter for the cases of empty groups - + "\n"; # Put all strings together. + # Join all non-empty groups. + combined = concatStringsSep "\n\n" (remove "" genGroupsStrings) + "\n"; + in combined; genGroupConfig = name: channels: let diff --git a/third_party/home-manager/modules/programs/mcfly.nix b/third_party/home-manager/modules/programs/mcfly.nix index e6b1640bb1..8d4bfd3c0c 100644 --- a/third_party/home-manager/modules/programs/mcfly.nix +++ b/third_party/home-manager/modules/programs/mcfly.nix @@ -8,6 +8,17 @@ let in { meta.maintainers = [ maintainers.marsam ]; + imports = [ + (mkChangedOptionModule # \ + [ "programs" "mcfly" "enableFuzzySearch" ] # \ + [ "programs" "mcfly" "fuzzySearchFactor" ] # \ + (config: + let + value = + getAttrFromPath [ "programs" "mcfly" "enableFuzzySearch" ] config; + in if value then 2 else 0)) + ]; + options.programs.mcfly = { enable = mkEnableOption "mcfly"; @@ -27,11 +38,13 @@ in { ''; }; - enableFuzzySearch = mkOption { - default = false; - type = types.bool; + fuzzySearchFactor = mkOption { + default = 0; + type = types.ints.unsigned; description = '' Whether to enable fuzzy searching. + 0 is off; higher numbers weight toward shorter matches. + Values in the 2-5 range get good results so far. ''; }; @@ -81,6 +94,8 @@ in { (mkIf cfg.enableLightTheme { home.sessionVariables.MCFLY_LIGHT = "TRUE"; }) - (mkIf cfg.enableFuzzySearch { home.sessionVariables.MCFLY_FUZZY = "TRUE"; }) + (mkIf (cfg.fuzzySearchFactor > 0) { + home.sessionVariables.MCFLY_FUZZY = cfg.fuzzySearchFactor; + }) ]); } diff --git a/third_party/home-manager/modules/programs/micro.nix b/third_party/home-manager/modules/programs/micro.nix new file mode 100644 index 0000000000..f2f8b6bf76 --- /dev/null +++ b/third_party/home-manager/modules/programs/micro.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.micro; + + jsonFormat = pkgs.formats.json { }; + +in { + meta.maintainers = [ hm.maintainers.mforster ]; + + options = { + programs.micro = { + enable = mkEnableOption "micro, a terminal-based text editor"; + + settings = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + { + autosu = false; + cursorline = false; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/micro/settings.json. See + + for supported values. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.micro ]; + + xdg.configFile."micro/settings.json".source = + jsonFormat.generate "micro-settings" cfg.settings; + }; +} diff --git a/third_party/home-manager/modules/programs/mpv.nix b/third_party/home-manager/modules/programs/mpv.nix index a53f4c40d1..47413490d3 100644 --- a/third_party/home-manager/modules/programs/mpv.nix +++ b/third_party/home-manager/modules/programs/mpv.nix @@ -18,9 +18,7 @@ let rec { int = toString option; float = int; - - bool = if option then "yes" else "no"; - + bool = lib.hm.booleans.yesNo option; string = option; }.${typeOf option}; @@ -79,7 +77,7 @@ in { }; scripts = mkOption { - type = with types; listOf (either package str); + type = with types; listOf package; default = [ ]; example = literalExpression "[ pkgs.mpvScripts.mpris ]"; description = '' @@ -90,7 +88,7 @@ in { config = mkOption { description = '' Configuration written to - ~/.config/mpv/mpv.conf. See + $XDG_CONFIG_HOME/mpv/mpv.conf. See mpv 1 @@ -112,7 +110,7 @@ in { profiles = mkOption { description = '' Sub-configuration options for specific profiles written to - ~/.config/mpv/mpv.conf. See + $XDG_CONFIG_HOME/mpv/mpv.conf. See for more information. ''; type = mpvProfiles; @@ -143,7 +141,7 @@ in { bindings = mkOption { description = '' Input configuration written to - ~/.config/mpv/input.conf. See + $XDG_CONFIG_HOME/mpv/input.conf. See mpv 1 diff --git a/third_party/home-manager/modules/programs/msmtp.nix b/third_party/home-manager/modules/programs/msmtp.nix index e1fc35d2e8..04e7be8e59 100644 --- a/third_party/home-manager/modules/programs/msmtp.nix +++ b/third_party/home-manager/modules/programs/msmtp.nix @@ -28,9 +28,12 @@ let tls_trust_file = smtp.tls.certificatesFile; } // optionalAttrs (passwordCommand != null) { passwordeval = toString passwordCommand; - } // msmtp.extraConfig) ++ optional primary '' + } // msmtp.extraConfig) ++ optional primary "account default : ${name}" + ++ map (alias: '' - account default : ${name}''); + account ${alias} : ${name} + from ${alias} + '') aliases); configFile = mailAccounts: '' # Generated by Home Manager. diff --git a/third_party/home-manager/modules/programs/mu.nix b/third_party/home-manager/modules/programs/mu.nix index 233624d14c..835be361af 100644 --- a/third_party/home-manager/modules/programs/mu.nix +++ b/third_party/home-manager/modules/programs/mu.nix @@ -12,12 +12,14 @@ let # Takes the list of accounts with mu.enable = true, and generates a # command-line flag for initializing the mu database. myAddresses = let - # List of account sets where mu.enable = true. + # Set of email account sets where mu.enable = true. muAccounts = filter (a: a.mu.enable) (attrValues config.accounts.email.accounts); addrs = map (a: a.address) muAccounts; - # Prefix --my-address= to each account's address with mu.enable. - addMyAddress = map (addr: "--my-address=" + addr) addrs; + # Construct list of lists containing email aliases, and flatten + aliases = flatten (map (a: a.aliases) muAccounts); + # Prefix --my-address= to each account's address AND all defined aliases + addMyAddress = map (addr: "--my-address=" + addr) (addrs ++ aliases); in concatStringsSep " " addMyAddress; in { @@ -50,7 +52,7 @@ in { # In theory, mu is the only thing that creates that directory, and it is # only created during the initial index. if [[ ! -d "${dbLocation}" ]]; then - $DRY_RUN_CMD mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG; + $DRY_RUN_CMD ${pkgs.mu}/bin/mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG; fi ''; }; diff --git a/third_party/home-manager/modules/programs/mujmap.nix b/third_party/home-manager/modules/programs/mujmap.nix new file mode 100644 index 0000000000..9d290fefb4 --- /dev/null +++ b/third_party/home-manager/modules/programs/mujmap.nix @@ -0,0 +1,315 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.mujmap; + + mujmapAccounts = + filter (a: a.mujmap.enable) (attrValues config.accounts.email.accounts); + + missingNotmuchAccounts = map (a: a.name) + (filter (a: !a.notmuch.enable && a.mujmap.notmuchSetupWarning) + mujmapAccounts); + + notmuchConfigHelp = + map (name: "accounts.email.accounts.${name}.notmuch.enable = true;") + missingNotmuchAccounts; + + settingsFormat = pkgs.formats.toml { }; + + filterNull = attrs: attrsets.filterAttrs (n: v: v != null) attrs; + + configFile = account: + let + settings'' = if (account.jmap == null) then + { } + else + filterNull { + fqdn = account.jmap.host; + session_url = account.jmap.sessionUrl; + }; + + settings' = settings'' // { + username = account.userName; + password_command = escapeShellArgs account.passwordCommand; + } // filterNull account.mujmap.settings; + + settings = if (hasAttr "fqdn" settings') then + (removeAttrs settings' [ "session_url" ]) + else + settings'; + in { + name = "${account.maildir.absPath}/mujmap.toml"; + value.source = settingsFormat.generate + "mujmap-${lib.replaceStrings [ "@" ] [ "_at_" ] account.address}.toml" + settings; + }; + + tagsOpts = { + lowercase = mkOption { + type = types.bool; + default = false; + description = '' + If true, translate all mailboxes to lowercase names when mapping to notmuch + tags. + ''; + }; + + directory_separator = mkOption { + type = types.str; + default = "/"; + example = "."; + description = '' + Directory separator for mapping notmuch tags to maildirs. + ''; + }; + + inbox = mkOption { + type = types.str; + default = "inbox"; + description = '' + Tag for notmuch to use for messages stored in the mailbox labeled with the + Inbox name attribute. + + If set to an empty string, this mailbox and its child + mailboxes are not synchronized with a tag. + ''; + }; + + deleted = mkOption { + type = types.str; + default = "deleted"; + description = '' + Tag for notmuch to use for messages stored in the mailbox labeled with the + Trash name attribute. + + If set to an empty string, this mailbox and its child + mailboxes are not synchronized with a tag. + ''; + }; + + sent = mkOption { + type = types.str; + default = "sent"; + description = '' + Tag for notmuch to use for messages stored in the mailbox labeled with the + Sent name attribute. + + If set to an empty string, this mailbox and its child + mailboxes are not synchronized with a tag. + ''; + }; + + spam = mkOption { + type = types.str; + default = "spam"; + description = '' + Tag for notmuch to use for messages stored in the mailbox labeled with the + Junk name attribute and/or with the $Junk keyword, + except for messages with the $NotJunk keyword. + + If set to an empty string, this mailbox, its child + mailboxes, and these keywords are not synchronized with a tag. + ''; + }; + + important = mkOption { + type = types.str; + default = "important"; + description = '' + Tag for notmuch to use for messages stored in the mailbox labeled with the + Important name attribute and/or with the $Important + keyword. + + If set to an empty string, this mailbox, its child + mailboxes, and these keywords are not synchronized with a tag. + ''; + }; + + phishing = mkOption { + type = types.str; + default = "phishing"; + description = '' + Tag for notmuch to use for the IANA $Phishing keyword. + + If set to an empty string, this keyword is not synchronized with a tag. + ''; + }; + }; + + rootOpts = { + username = mkOption { + type = types.nullOr types.str; + default = null; + example = "alice@example.com"; + description = '' + Username for basic HTTP authentication. + + If null, defaults to + . + ''; + }; + + password_command = mkOption { + type = types.nullOr (types.either types.str (types.listOf types.str)); + default = null; + apply = p: if isList p then escapeShellArgs p else p; + example = "pass alice@example.com"; + description = '' + Shell command which will print a password to stdout for basic HTTP + authentication. + + If null, defaults to + . + ''; + }; + + fqdn = mkOption { + type = types.nullOr types.str; + default = null; + example = "example.com"; + description = '' + Fully qualified domain name of the JMAP service. + + mujmap looks up the JMAP SRV record for this host to determine the JMAP session + URL. Mutually exclusive with + . + + If null, defaults to + . + ''; + }; + + session_url = mkOption { + type = types.nullOr types.str; + default = null; + example = "https://jmap.example.com/.well-known/jmap"; + description = '' + Sesion URL to connect to. + + Mutually exclusive with + . + + If null, defaults to + . + ''; + }; + + auto_create_new_mailboxes = mkOption { + type = types.bool; + default = true; + description = '' + Whether to create new mailboxes automatically on the server from notmuch + tags. + ''; + }; + + cache_dir = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The cache directory in which to store mail files while they are being + downloaded. The default is operating-system specific. + ''; + }; + + tags = mkOption { + type = types.submodule { + freeformType = settingsFormat.type; + options = tagsOpts; + }; + default = { }; + description = '' + Tag configuration. + + Beware that there are quirks that require manual consideration if changing the + values of these files; please see + + for more details. + ''; + }; + }; + + mujmapOpts = { + enable = mkEnableOption "mujmap JMAP synchronization for notmuch"; + + notmuchSetupWarning = mkOption { + type = types.bool; + default = true; + description = '' + Warn if Notmuch is not also enabled for this account. + + This can safely be disabled if mujmap.toml is managed + outside of Home Manager. + ''; + }; + + settings = mkOption { + type = types.submodule { + freeformType = settingsFormat.type; + options = rootOpts; + }; + default = { }; + description = '' + Settings which are applied to mujmap.toml + for the account. + + See the mujmap project + for documentation of settings not explicitly covered by this module. + ''; + }; + }; + + mujmapModule = types.submodule { options = { mujmap = mujmapOpts; }; }; +in { + meta.maintainers = with maintainers; [ elizagamedev ]; + + options = { + programs.mujmap = { + enable = mkEnableOption "mujmap Gmail synchronization for notmuch"; + + package = mkOption { + type = types.package; + default = pkgs.mujmap; + defaultText = "pkgs.mujmap"; + description = '' + mujmap package to use. + ''; + }; + }; + + accounts.email.accounts = + mkOption { type = with types; attrsOf mujmapModule; }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf (missingNotmuchAccounts != [ ]) { + warnings = ['' + mujmap is enabled for the following email accounts, but notmuch is not: + + ${concatStringsSep "\n " missingNotmuchAccounts} + + Notmuch can be enabled with: + + ${concatStringsSep "\n " notmuchConfigHelp} + + If you have configured notmuch outside of Home Manager, you can suppress this + warning with: + + programs.mujmap.notmuchSetupWarning = false; + '']; + }) + + { + warnings = flatten (map (account: account.warnings) mujmapAccounts); + + home.packages = [ cfg.package ]; + + # Notmuch should ignore non-mail files created by mujmap. + programs.notmuch.new.ignore = [ "/.*[.](toml|json|lock)$/" ]; + + home.file = listToAttrs (map configFile mujmapAccounts); + } + ]); +} diff --git a/third_party/home-manager/modules/programs/navi.nix b/third_party/home-manager/modules/programs/navi.nix new file mode 100644 index 0000000000..f8d4803286 --- /dev/null +++ b/third_party/home-manager/modules/programs/navi.nix @@ -0,0 +1,86 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + + cfg = config.programs.navi; + + yamlFormat = pkgs.formats.yaml { }; + + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support" + else + config.xdg.configHome; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.navi = { + enable = mkEnableOption "Navi"; + + package = mkOption { + type = types.package; + default = pkgs.navi; + defaultText = literalExpression "pkgs.navi"; + description = "The package to use for the navi binary."; + }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = literalExpression '' + { + cheats = { + paths = [ + "~/cheats/" + ]; + }; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/navi/config.yaml on Linux or + $HOME/Library/Application Support/navi/config.yaml + on Darwin. See + + for more information. + ''; + }; + + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then + eval "$(${cfg.package}/bin/navi widget bash)" + fi + ''; + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' + if [[ $options[zle] = on ]]; then + eval "$(${cfg.package}/bin/navi widget zsh)" + fi + ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + ${cfg.package}/bin/navi widget fish | source + ''; + + home.file."${configDir}/navi/config.yaml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "navi-config" cfg.settings; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/ncmpcpp.nix b/third_party/home-manager/modules/programs/ncmpcpp.nix index 96013a9d84..5f9bd36ebc 100644 --- a/third_party/home-manager/modules/programs/ncmpcpp.nix +++ b/third_party/home-manager/modules/programs/ncmpcpp.nix @@ -14,7 +14,7 @@ let renderValue = option: { int = toString option; - bool = if option then "yes" else "no"; + bool = lib.hm.booleans.yesNo option; string = option; }.${builtins.typeOf option}; @@ -44,7 +44,7 @@ let }); in { - meta.maintainers = with maintainers; [ olmokramer ]; + meta.maintainers = [ hm.maintainers.olmokramer ]; options.programs.ncmpcpp = { enable = @@ -62,7 +62,7 @@ in { }; mpdMusicDir = mkOption { - type = types.nullOr types.path; + type = with types; nullOr (coercedTo path toString str); default = let mpdCfg = config.services.mpd; in if pkgs.stdenv.hostPlatform.isLinux && mpdCfg.enable then mpdCfg.musicDirectory @@ -123,7 +123,7 @@ in { xdg.configFile = { "ncmpcpp/config" = let settings = cfg.settings // optionalAttrs (cfg.mpdMusicDir != null) { - mpd_music_dir = toString cfg.mpdMusicDir; + mpd_music_dir = cfg.mpdMusicDir; }; in mkIf (settings != { }) { text = renderSettings settings + "\n"; }; diff --git a/third_party/home-manager/modules/programs/ncspot.nix b/third_party/home-manager/modules/programs/ncspot.nix index 7acb8d364d..3b6d401e61 100644 --- a/third_party/home-manager/modules/programs/ncspot.nix +++ b/third_party/home-manager/modules/programs/ncspot.nix @@ -32,7 +32,7 @@ in { ''; description = '' Configuration written to - ~/.config/ncspot/config.toml. + $XDG_CONFIG_HOME/ncspot/config.toml. See for the full list of options. diff --git a/third_party/home-manager/modules/programs/neomutt.nix b/third_party/home-manager/modules/programs/neomutt.nix index 2a2f79fae3..75508303e2 100644 --- a/third_party/home-manager/modules/programs/neomutt.nix +++ b/third_party/home-manager/modules/programs/neomutt.nix @@ -89,7 +89,6 @@ let }; }; - yesno = x: if x then "yes" else "no"; setOption = n: v: if v == null then "unset ${n}" else "set ${n}=${v}"; escape = replaceStrings [ "%" ] [ "%25" ]; @@ -167,7 +166,7 @@ let sidebarSection = '' # Sidebar set sidebar_visible = yes - set sidebar_short_path = ${yesno cfg.sidebar.shortPath} + set sidebar_short_path = ${lib.hm.booleans.yesNo cfg.sidebar.shortPath} set sidebar_width = ${toString cfg.sidebar.width} set sidebar_format = '${cfg.sidebar.format}' ''; @@ -197,15 +196,26 @@ let accountStr = account: with account; - '' + let + signature = if account.signature.showSignature == "none" then + "unset signature" + else if account.signature.command != null then + ''set signature = "${account.signature.command}|"'' + else + "set signature = ${ + pkgs.writeText "signature.txt" account.signature.text + }"; + in '' # Generated by Home Manager. set ssl_force_tls = yes set certificate_file=${toString config.accounts.email.certificatesFile} # GPG section set crypt_use_gpgme = yes - set crypt_autosign = ${yesno (gpg.signByDefault or false)} - set crypt_opportunistic_encrypt = ${yesno (gpg.encryptByDefault or false)} + set crypt_autosign = ${lib.hm.booleans.yesNo (gpg.signByDefault or false)} + set crypt_opportunistic_encrypt = ${ + lib.hm.booleans.yesNo (gpg.encryptByDefault or false) + } set pgp_use_gpg_agent = yes set mbox_type = ${if maildir != null then "Maildir" else "mbox"} set sort = "${cfg.sort}" @@ -222,8 +232,8 @@ let # Extra configuration ${account.neomutt.extraConfig} - '' + optionalString (account.signature.showSignature != "none") '' - set signature = ${pkgs.writeText "signature.txt" account.signature.text} + + ${signature} '' + optionalString account.notmuch.enable (notmuchSection account); in { diff --git a/third_party/home-manager/modules/programs/neovim.nix b/third_party/home-manager/modules/programs/neovim.nix index f57148cc06..c8edd22579 100644 --- a/third_party/home-manager/modules/programs/neovim.nix +++ b/third_party/home-manager/modules/programs/neovim.nix @@ -6,22 +6,28 @@ let cfg = config.programs.neovim; - jsonFormat = pkgs.formats.json { }; + fileType = (import ../lib/file-type.nix { + inherit (config.home) homeDirectory; + inherit lib pkgs; + }).fileType; - extraPython3PackageType = mkOptionType { - name = "extra-python3-packages"; - description = "python3 packages in python.withPackages format"; - check = with types; - (x: if isFunction x then isList (x pkgs.python3Packages) else false); - merge = mergeOneOption; - }; + jsonFormat = pkgs.formats.json { }; pluginWithConfigType = types.submodule { options = { config = mkOption { - type = types.lines; - description = "vimscript for this plugin to be placed in init.vim"; - default = ""; + type = types.nullOr types.lines; + description = + "Script to configure this plugin. The scripting language should match type."; + default = null; + }; + + type = mkOption { + type = + types.either (types.enum [ "lua" "viml" "teal" "fennel" ]) types.str; + description = + "Language used in config. Configurations are aggregated per-language."; + default = "viml"; }; optional = mkEnableOption "optional" // { @@ -32,39 +38,60 @@ let type = types.package; description = "vim plugin"; }; + + runtime = mkOption { + default = { }; + # passing actual "${xdg.configHome}/nvim" as basePath was a bit tricky + # due to how fileType.target is implemented + type = fileType "xdg.configHome/nvim" "nvim"; + example = literalExpression '' + { "ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; } + ''; + description = lib.mdDoc '' + Set of files that have to be linked in nvim config folder. + ''; + }; }; }; - # A function to get the configuration string (if any) from an element of 'plugins' - pluginConfig = p: - if p ? plugin && (p.config or "") != "" then '' - " ${p.plugin.pname or p.plugin.name} {{{ - ${p.config} - " }}} - '' else - ""; - - moduleConfigure = { - packages.home-manager = { - start = filter (f: f != null) (map - (x: if x ? plugin && x.optional == true then null else (x.plugin or x)) - cfg.plugins); - opt = filter (f: f != null) - (map (x: if x ? plugin && x.optional == true then x.plugin else null) - cfg.plugins); - }; - beforePlugins = ""; + allPlugins = cfg.plugins ++ optional cfg.coc.enable { + type = "viml"; + plugin = cfg.coc.package; + config = cfg.coc.pluginConfig; + optional = false; }; + luaPackages = cfg.finalPackage.unwrapped.lua.pkgs; + resolvedExtraLuaPackages = cfg.extraLuaPackages luaPackages; + extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ]) ''--suffix PATH : "${lib.makeBinPath cfg.extraPackages}"''; - + extraMakeWrapperLuaCArgs = + lib.optionalString (resolvedExtraLuaPackages != [ ]) '' + --suffix LUA_CPATH ";" "${ + lib.concatMapStringsSep ";" luaPackages.getLuaCPath + resolvedExtraLuaPackages + }"''; + extraMakeWrapperLuaArgs = lib.optionalString (resolvedExtraLuaPackages != [ ]) + '' + --suffix LUA_PATH ";" "${ + lib.concatMapStringsSep ";" luaPackages.getLuaPath + resolvedExtraLuaPackages + }"''; in { imports = [ (mkRemovedOptionModule [ "programs" "neovim" "withPython" ] "Python2 support has been removed from neovim.") (mkRemovedOptionModule [ "programs" "neovim" "extraPythonPackages" ] "Python2 support has been removed from neovim.") + (mkRemovedOptionModule [ "programs" "neovim" "configure" ] '' + programs.neovim.configure is deprecated. + Other programs.neovim options can override its settings or ignore them. + Please use the other options at your disposal: + configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }] + configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }] + configure.customRC -> programs.neovim.extraConfig + '') ]; options = { @@ -122,13 +149,51 @@ in { }; extraPython3Packages = mkOption { - type = with types; either extraPython3PackageType (listOf package); - default = (_: [ ]); - defaultText = "ps: []"; - example = literalExpression "(ps: with ps; [ python-language-server ])"; + # In case we get a plain list, we need to turn it into a function, + # as expected by the function in nixpkgs. + # The only way to do so is to call `const`, which will ignore its input. + type = with types; + let fromType = listOf package; + in coercedTo fromType (flip warn const '' + Assigning a plain list to extraPython3Packages is deprecated. + Please assign a function taking a package set as argument, so + extraPython3Packages = [ pkgs.python3Packages.xxx ]; + should become + extraPython3Packages = ps: [ ps.xxx ]; + '') (functionTo fromType); + default = _: [ ]; + defaultText = literalExpression "ps: [ ]"; + example = + literalExpression "pyPkgs: with pyPkgs; [ python-language-server ]"; description = '' - A function in python.withPackages format, which returns a - list of Python 3 packages required for your plugins to work. + The extra Python 3 packages required for your plugins to work. + This option accepts a function that takes a Python 3 package set as an argument, + and selects the required Python 3 packages from this package set. + See the example for more info. + ''; + }; + + # We get the Lua package from the final package and use its + # Lua packageset to evaluate the function that this option was set to. + # This ensures that we always use the same Lua version as the Neovim package. + extraLuaPackages = mkOption { + type = with types; + let fromType = listOf package; + in coercedTo fromType (flip warn const '' + Assigning a plain list to extraLuaPackages is deprecated. + Please assign a function taking a package set as argument, so + extraLuaPackages = [ pkgs.lua51Packages.xxx ]; + should become + extraLuaPackages = ps: [ ps.xxx ]; + '') (functionTo fromType); + default = _: [ ]; + defaultText = literalExpression "ps: [ ]"; + example = literalExpression "luaPkgs: with luaPkgs; [ luautf8 ]"; + description = '' + The extra Lua packages required for your plugins to work. + This option accepts a function that takes a Lua package set as an argument, + and selects the required Lua packages from this package set. + See the example for more info. ''; }; @@ -141,6 +206,27 @@ in { ''; }; + generatedConfigs = mkOption { + type = types.attrsOf types.lines; + visible = true; + readOnly = true; + example = literalExpression '' + { + viml = ''' + " Generated by home-manager + map , + '''; + + lua = ''' + -- Generated by home-manager + vim.opt.background = "dark" + '''; + }''; + description = '' + Generated configurations with as key their language (set via type). + ''; + }; + package = mkOption { type = types.package; default = pkgs.neovim-unwrapped; @@ -155,32 +241,12 @@ in { description = "Resulting customized neovim package."; }; - configure = mkOption { - type = types.attrsOf types.anything; - default = { }; - example = literalExpression '' - configure = { - customRC = $'''' - " here your custom configuration goes! - $''''; - packages.myVimPackage = with pkgs.vimPlugins; { - # loaded on launch - start = [ fugitive ]; - # manually loadable by calling `:packadd $plugin-name` - opt = [ ]; - }; - }; - ''; + defaultEditor = mkOption { + type = types.bool; + default = false; description = '' - Deprecated. Please use the other options. - - Generate your init file from your list of plugins and custom commands, - and loads it from the store via nvim -u /nix/store/hash-vimrc - - - - This option is mutually exclusive with extraConfig - and plugins. + Whether to configure nvim as the default + editor using the EDITOR environment variable. ''; }; @@ -188,22 +254,17 @@ in { type = types.lines; default = ""; example = '' - set nocompatible set nobackup ''; description = '' Custom vimrc lines. - - - - This option is mutually exclusive with configure. ''; }; extraPackages = mkOption { type = with types; listOf package; default = [ ]; - example = "[ pkgs.shfmt ]"; + example = literalExpression "[ pkgs.shfmt ]"; description = "Extra packages available to nvim."; }; @@ -232,8 +293,15 @@ in { coc = { enable = mkEnableOption "Coc"; + package = mkOption { + type = types.package; + default = pkgs.vimPlugins.coc-nvim; + defaultText = literalExpression "pkgs.vimPlugins.coc-nvim"; + description = "The package to use for the CoC plugin."; + }; + settings = mkOption { - type = jsonFormat.type; + inherit (jsonFormat) type; default = { }; example = literalExpression '' { @@ -265,45 +333,81 @@ in { for options. ''; }; + + pluginConfig = mkOption { + type = types.lines; + default = ""; + description = "Script to configure CoC. Must be viml."; + }; }; }; }; config = let + defaultPlugin = { + type = "viml"; + plugin = null; + config = null; + optional = false; + runtime = { }; + }; + + # transform all plugins into a standardized attrset + pluginsNormalized = + map (x: defaultPlugin // (if (x ? plugin) then x else { plugin = x; })) + allPlugins; + + suppressNotVimlConfig = p: + if p.type != "viml" then p // { config = null; } else p; + neovimConfig = pkgs.neovimUtils.makeNeovimConfig { - inherit (cfg) - extraPython3Packages withPython3 withNodeJs withRuby viAlias vimAlias; - configure = cfg.configure // moduleConfigure; - plugins = cfg.plugins - ++ optionals cfg.coc.enable [ pkgs.vimPlugins.coc-nvim ]; + inherit (cfg) extraPython3Packages withPython3 withRuby viAlias vimAlias; + withNodeJs = cfg.withNodeJs || cfg.coc.enable; + plugins = map suppressNotVimlConfig pluginsNormalized; customRC = cfg.extraConfig; }; in mkIf cfg.enable { - warnings = optional (cfg.configure != { }) '' - programs.neovim.configure is deprecated. - Other programs.neovim options can override its settings or ignore them. - Please use the other options at your disposal: - configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }] - configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }] - configure.customRC -> programs.neovim.extraConfig - ''; programs.neovim.generatedConfigViml = neovimConfig.neovimRcContent; + programs.neovim.generatedConfigs = let + grouped = lib.lists.groupBy (x: x.type) pluginsNormalized; + concatConfigs = lib.concatMapStrings (p: p.config); + configsOnly = lib.foldl + (acc: p: if p.config != null then acc ++ [ p.config ] else acc) [ ]; + in mapAttrs (name: vals: lib.concatStringsSep "\n" (configsOnly vals)) + grouped; + home.packages = [ cfg.finalPackage ]; - xdg.configFile."nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { - text = neovimConfig.neovimRcContent; - }; - xdg.configFile."nvim/coc-settings.json" = mkIf cfg.coc.enable { - source = jsonFormat.generate "coc-settings.json" cfg.coc.settings; - }; + home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; }; + + xdg.configFile = + let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs; + in mkMerge ( + # writes runtime + (map (x: x.runtime) pluginsNormalized) ++ [{ + "nvim/init.lua" = let + luaRcContent = + lib.optionalString (neovimConfig.neovimRcContent != "") + "vim.cmd [[source ${ + pkgs.writeText "nvim-init-home-manager.vim" + neovimConfig.neovimRcContent + }]]" + lib.optionalString hasLuaConfig + config.programs.neovim.generatedConfigs.lua; + in mkIf (luaRcContent != "") { text = luaRcContent; }; + + "nvim/coc-settings.json" = mkIf cfg.coc.enable { + source = jsonFormat.generate "coc-settings.json" cfg.coc.settings; + }; + }]); programs.neovim.finalPackage = pkgs.wrapNeovimUnstable cfg.package (neovimConfig // { wrapperArgs = (lib.escapeShellArgs neovimConfig.wrapperArgs) + " " - + extraMakeWrapperArgs; + + extraMakeWrapperArgs + " " + extraMakeWrapperLuaCArgs + " " + + extraMakeWrapperLuaArgs; wrapRc = false; }); diff --git a/third_party/home-manager/modules/programs/newsboat.nix b/third_party/home-manager/modules/programs/newsboat.nix index eac4cce8c0..d2782bf2da 100644 --- a/third_party/home-manager/modules/programs/newsboat.nix +++ b/third_party/home-manager/modules/programs/newsboat.nix @@ -24,7 +24,7 @@ let max-items ${toString cfg.maxItems} browser ${cfg.browser} reload-threads ${toString cfg.reloadThreads} - auto-reload ${if cfg.autoReload then "yes" else "no"} + auto-reload ${lib.hm.booleans.yesNo cfg.autoReload} ${optionalString (cfg.reloadTime != null) (toString "reload-time ${toString cfg.reloadTime}")} prepopulate-query-feeds yes @@ -68,7 +68,10 @@ in { url = "http://example.com"; tags = [ "foo" "bar" ]; }]; - description = "List of news feeds."; + description = '' + List of news feeds. Leave it empty if you want to manage feeds + imperatively, for example, using Syncthing. + ''; }; maxItems = mkOption { @@ -121,16 +124,24 @@ in { }; config = mkIf cfg.enable { + assertions = [{ + assertion = cfg.queries != { } -> cfg.urls != [ ]; + message = '' + Cannot specify queries if urls is empty. Unset queries if you + want to manage urls imperatively. + ''; + }]; + home.packages = [ pkgs.newsboat ]; # Use ~/.newsboat on stateVersion < 21.05 and use ~/.config/newsboat for # stateVersion >= 21.05. home.file = mkIf (versionOlder config.home.stateVersion "21.05") { - ".newsboat/urls".text = urlsFileContents; + ".newsboat/urls" = mkIf (cfg.urls != [ ]) { text = urlsFileContents; }; ".newsboat/config".text = configFileContents; }; xdg.configFile = mkIf (versionAtLeast config.home.stateVersion "21.05") { - "newsboat/urls".text = urlsFileContents; + "newsboat/urls" = mkIf (cfg.urls != [ ]) { text = urlsFileContents; }; "newsboat/config".text = configFileContents; }; }; diff --git a/third_party/home-manager/modules/programs/nheko.nix b/third_party/home-manager/modules/programs/nheko.nix new file mode 100644 index 0000000000..53f6701120 --- /dev/null +++ b/third_party/home-manager/modules/programs/nheko.nix @@ -0,0 +1,85 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.nheko; + + iniFmt = pkgs.formats.ini { }; + + configDir = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support" + else + config.xdg.configHome; + + camelCaseToSnakeCase = + replaceStrings upperChars (map (s: "_${s}") lowerChars); + + inherit (generators) mkKeyValueDefault toINI; + +in { + meta.maintainers = [ maintainers.gvolpe ]; + + options.programs.nheko = { + enable = mkEnableOption "Qt desktop client for Matrix"; + + package = mkPackageOption pkgs "nheko" { }; + + settings = mkOption { + type = iniFmt.type; + default = { }; + example = literalExpression '' + { + general.disableCertificateValidation = false; + auth = { + accessToken = "SECRET"; + deviceId = "MY_DEVICE"; + homeServer = "https://matrix-client.matrix.org:443"; + userId = "@@user:matrix.org"; + }; + settings.scaleFactor = 1.0; + sidebar.width = 416; + user = { + alertOnNotification = true; + animateImagesOnHover = false; + "sidebar\\roomListWidth" = 308; + }; + } + ''; + description = '' + Attribute set of Nheko preferences (converted to an INI file). + + + + For now, it is recommended to run nheko and sign-in before filling in + the configuration settings in this module, as nheko writes the access + token to $XDG_CONFIG_HOME/nheko/nheko.conf the + first time we sign in, and we need that data into these settings for the + correct functionality of the application. + + + + This a temporary inconvenience, however, as nheko has plans to move the + authentication stuff into the local database they currently use. Once + this happens, this will no longer be an issue. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file."${configDir}/nheko/nheko.conf" = mkIf (cfg.settings != { }) { + text = '' + ; Generated by Home Manager. + + ${toINI { + mkKeyValue = k: v: + mkKeyValueDefault { } "=" (camelCaseToSnakeCase k) v; + } cfg.settings} + ''; + }; + }; +} + diff --git a/third_party/home-manager/modules/programs/noti.nix b/third_party/home-manager/modules/programs/noti.nix index 069d87e642..d8affdd53e 100644 --- a/third_party/home-manager/modules/programs/noti.nix +++ b/third_party/home-manager/modules/programs/noti.nix @@ -17,7 +17,7 @@ in { default = { }; description = '' Configuration written to - ~/.config/noti/noti.yaml. + $XDG_CONFIG_HOME/noti/noti.yaml. See diff --git a/third_party/home-manager/modules/programs/notmuch.nix b/third_party/home-manager/modules/programs/notmuch.nix index b93cc6a5ed..9c1c9f5c0e 100644 --- a/third_party/home-manager/modules/programs/notmuch.nix +++ b/third_party/home-manager/modules/programs/notmuch.nix @@ -167,29 +167,29 @@ in { home.packages = [ pkgs.notmuch ]; home.sessionVariables = { - NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/notmuchrc"; + NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/default/config"; NMBGIT = "${config.xdg.dataHome}/notmuch/nmbug"; }; - xdg.configFile."notmuch/notmuchrc".text = - let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; - in '' - # Generated by Home Manager. - - '' + toIni notmuchIni; - - home.file = let + xdg.configFile = let hook = name: cmds: { - "${notmuchIni.database.path}/.notmuch/hooks/${name}".source = - pkgs.writeShellScript name '' - export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH" - export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc" - export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug" + "notmuch/default/hooks/${name}".source = pkgs.writeShellScript name '' + export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH" + export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/default/config" + export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug" - ${cmds} - ''; + ${cmds} + ''; }; - in optionalAttrs (cfg.hooks.preNew != "") (hook "pre-new" cfg.hooks.preNew) + in { + "notmuch/default/config".text = + let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; + in '' + # Generated by Home Manager. + + '' + toIni notmuchIni; + } + // optionalAttrs (cfg.hooks.preNew != "") (hook "pre-new" cfg.hooks.preNew) // optionalAttrs (cfg.hooks.postNew != "") (hook "post-new" cfg.hooks.postNew) // optionalAttrs (cfg.hooks.postInsert != "") diff --git a/third_party/home-manager/modules/programs/nushell.nix b/third_party/home-manager/modules/programs/nushell.nix index f37b889a1a..da01672b19 100644 --- a/third_party/home-manager/modules/programs/nushell.nix +++ b/third_party/home-manager/modules/programs/nushell.nix @@ -6,11 +6,51 @@ let cfg = config.programs.nushell; - tomlFormat = pkgs.formats.toml { }; + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support/nushell" + else + "${config.xdg.configHome}/nushell"; + linesOrSource = name: + types.submodule ({ config, ... }: { + options = { + text = mkOption { + type = types.lines; + default = if config.source != null then + builtins.readFile config.source + else + ""; + defaultText = literalExpression + "if source is defined, the content of source, otherwise empty"; + description = '' + Text of the nushell ${name} file. + If unset then the source option will be preferred. + ''; + }; + + source = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Path of the nushell ${name} file to use. + If the text option is set, it will be preferred. + ''; + }; + }; + }); in { meta.maintainers = [ maintainers.Philipp-M ]; + imports = [ + (mkRemovedOptionModule [ "programs" "nushell" "settings" ] '' + Please use + + 'programs.nushell.configFile' and 'programs.nushell.envFile' + + instead. + '') + ]; + options.programs.nushell = { enable = mkEnableOption "nushell"; @@ -21,40 +61,73 @@ in { description = "The package to use for nushell."; }; - settings = mkOption { - type = with types; - let - 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 = "Nushell configuration"; }; - default = { }; + configFile = mkOption { + type = types.nullOr (linesOrSource "config.nu"); + default = null; example = literalExpression '' - { - edit_mode = "vi"; - startup = [ "alias la [] { ls -a }" "alias e [msg] { echo $msg }" ]; - key_timeout = 10; - completion_mode = "circular"; - no_auto_pivot = true; + { text = ''' + let $config = { + filesize_metric: false + table_mode: rounded + use_ls_colors: true + } + '''; } ''; description = '' - Configuration written to - ~/.config/nushell/config.toml. - - See for the full list - of options. + The configuration file to be used for nushell. + + + See for more information. + ''; + }; + + envFile = mkOption { + type = types.nullOr (linesOrSource "env.nu"); + default = null; + example = '' + let-env FOO = 'BAR' + ''; + description = '' + The environment variables file to be used for nushell. + + + See for more information. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Additional configuration to add to the nushell configuration file. + ''; + }; + + extraEnv = mkOption { + type = types.lines; + default = ""; + description = '' + Additional configuration to add to the nushell environment variables file. ''; }; }; config = mkIf cfg.enable { home.packages = [ cfg.package ]; - - xdg.configFile."nu/config.toml" = mkIf (cfg.settings != { }) { - source = tomlFormat.generate "nushell-config" cfg.settings; - }; + home.file = mkMerge [ + (mkIf (cfg.configFile != null || cfg.extraConfig != "") { + "${configDir}/config.nu".text = mkMerge [ + (mkIf (cfg.configFile != null) cfg.configFile.text) + cfg.extraConfig + ]; + }) + (mkIf (cfg.envFile != null || cfg.extraEnv != "") { + "${configDir}/env.nu".text = mkMerge [ + (mkIf (cfg.envFile != null) cfg.envFile.text) + cfg.extraEnv + ]; + }) + ]; }; } diff --git a/third_party/home-manager/modules/programs/offlineimap.nix b/third_party/home-manager/modules/programs/offlineimap.nix index 83a31dd2ba..c5b800599e 100644 --- a/third_party/home-manager/modules/programs/offlineimap.nix +++ b/third_party/home-manager/modules/programs/offlineimap.nix @@ -12,10 +12,8 @@ let toIni = generators.toINI { mkKeyValue = key: value: let - value' = if isBool value then - (if value then "yes" else "no") - else - toString value; + value' = + (if isBool value then lib.hm.booleans.yesNo else toString) value; in "${key} = ${value'}"; }; @@ -160,13 +158,13 @@ in { xdg.configFile."offlineimap/get_settings.py".text = cfg.pythonFile; xdg.configFile."offlineimap/get_settings.pyc".source = "${ pkgs.runCommandLocal "get_settings-compile" { - nativeBuildInputs = [ pkgs.python2 ]; + nativeBuildInputs = [ pkgs.offlineimap ]; pythonFile = cfg.pythonFile; passAsFile = [ "pythonFile" ]; } '' mkdir -p $out/bin cp $pythonFilePath $out/bin/get_settings.py - python2 -m py_compile $out/bin/get_settings.py + python -m py_compile $out/bin/get_settings.py '' }/bin/get_settings.pyc"; diff --git a/third_party/home-manager/modules/programs/oh-my-posh.nix b/third_party/home-manager/modules/programs/oh-my-posh.nix new file mode 100644 index 0000000000..d1dfda97f5 --- /dev/null +++ b/third_party/home-manager/modules/programs/oh-my-posh.nix @@ -0,0 +1,94 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + + cfg = config.programs.oh-my-posh; + + jsonFormat = pkgs.formats.json { }; + + configArgument = if cfg.settings != { } then + "--config ${config.xdg.configHome}/oh-my-posh/config.json" + else if cfg.useTheme != null then + "--config ${cfg.package}/share/oh-my-posh/themes/${cfg.useTheme}.omp.json" + else + ""; + +in { + meta.maintainers = [ maintainers.arjan-s ]; + + options.programs.oh-my-posh = { + enable = mkEnableOption "oh-my-posh, a prompt theme engine for any shell"; + + package = mkPackageOption pkgs "oh-my-posh" { }; + + settings = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile "''${pkgs.oh-my-posh}/share/oh-my-posh/themes/space.omp.json"))''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/oh-my-posh/config.json. See + + for details. The useTheme option is ignored when this + option is used. + ''; + }; + + useTheme = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Use one of the official themes. This should be a name from this list: + . Because a theme + is essentially a configuration file, this option is not used when a + configFile is set. + ''; + }; + + enableBashIntegration = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Bash integration. + ''; + }; + + enableZshIntegration = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Zsh integration. + ''; + }; + + enableFishIntegration = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Fish integration. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."oh-my-posh/config.json" = mkIf (cfg.settings != { }) { + source = jsonFormat.generate "oh-my-posh-settings" cfg.settings; + }; + + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + eval "$(${cfg.package}/bin/oh-my-posh init bash ${configArgument})" + ''; + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' + eval "$(${cfg.package}/bin/oh-my-posh init zsh ${configArgument})" + ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + ${cfg.package}/bin/oh-my-posh init fish ${configArgument} | source + ''; + }; +} diff --git a/third_party/home-manager/modules/programs/opam.nix b/third_party/home-manager/modules/programs/opam.nix index 9cd76d9565..2916fb197d 100644 --- a/third_party/home-manager/modules/programs/opam.nix +++ b/third_party/home-manager/modules/programs/opam.nix @@ -34,6 +34,14 @@ in { Whether to enable Zsh integration. ''; }; + + enableFishIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Fish integration. + ''; + }; }; config = mkIf cfg.enable { @@ -46,5 +54,9 @@ in { programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' eval "$(${cfg.package}/bin/opam env --shell=zsh)" ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + eval "$(${cfg.package}/bin/opam env --shell=fish)" + ''; }; } diff --git a/third_party/home-manager/modules/programs/pandoc.nix b/third_party/home-manager/modules/programs/pandoc.nix new file mode 100644 index 0000000000..7f0fa713cd --- /dev/null +++ b/third_party/home-manager/modules/programs/pandoc.nix @@ -0,0 +1,104 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.programs.pandoc; + + inherit (lib) literalExpression mkEnableOption mkIf mkOption types; + + jsonFormat = pkgs.formats.json { }; + + makeTemplateFile = name: file: + lib.nameValuePair "pandoc/templates/${name}" { source = file; }; + + getFileName = file: + # This is actually safe here, since it is just a file name + builtins.unsafeDiscardStringContext (baseNameOf file); + + makeCslFile = file: + lib.nameValuePair "pandoc/csl/${getFileName file}" { source = file; }; + +in { + meta.maintainers = [ lib.maintainers.kirelagin ]; + + options.programs.pandoc = { + enable = mkEnableOption "pandoc"; + + package = mkOption { + type = types.package; + default = pkgs.pandoc; + defaultText = literalExpression "pkgs.pandoc"; + description = "The pandoc package to use."; + }; + + # We wrap the executable to pass some arguments + finalPackage = mkOption { + type = types.package; + readOnly = true; + description = "Resulting package."; + }; + + defaults = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + { + metadata = { + author = "John Doe"; + }; + pdf-engine = "xelatex"; + citeproc = true; + } + ''; + description = '' + Options to set by default. + These will be converted to JSON and written to a defaults + file (see Default files in pandoc documentation). + ''; + }; + + defaultsFile = mkOption { + type = types.path; + readOnly = true; + description = "Resulting defaults file."; + }; + + templates = mkOption { + type = types.attrsOf types.path; + default = { }; + example = literalExpression '' + { + "default.latex" = path/to/your/template; + } + ''; + description = "Custom templates."; + }; + + citationStyles = mkOption { + type = types.listOf types.path; + default = [ ]; + example = literalExpression "[ path/to/file.csl ]"; + description = "List of .csl files to install."; + }; + }; + + config = mkIf cfg.enable { + programs.pandoc = { + defaultsFile = jsonFormat.generate "hm.json" cfg.defaults; + + finalPackage = pkgs.symlinkJoin { + name = "pandoc-with-defaults"; + paths = [ cfg.package ]; + nativeBuildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram "$out/bin/pandoc" \ + --add-flags '--defaults "${cfg.defaultsFile}"' + ''; + }; + }; + + home.packages = [ cfg.finalPackage ]; + xdg.dataFile = lib.mapAttrs' makeTemplateFile cfg.templates + // lib.listToAttrs (map makeCslFile cfg.citationStyles); + }; +} diff --git a/third_party/home-manager/modules/programs/pet.nix b/third_party/home-manager/modules/programs/pet.nix index e75b10df3a..48e972aecd 100644 --- a/third_party/home-manager/modules/programs/pet.nix +++ b/third_party/home-manager/modules/programs/pet.nix @@ -99,8 +99,9 @@ in { else { General = cfg.settings; }); - "pet/snippet.toml".source = - format.generate "snippet.toml" { snippets = cfg.snippets; }; + "pet/snippet.toml" = mkIf (cfg.snippets != [ ]) { + source = format.generate "snippet.toml" { snippets = cfg.snippets; }; + }; }; }; } diff --git a/third_party/home-manager/modules/programs/pistol.nix b/third_party/home-manager/modules/programs/pistol.nix new file mode 100644 index 0000000000..4d6a1d2950 --- /dev/null +++ b/third_party/home-manager/modules/programs/pistol.nix @@ -0,0 +1,85 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.pistol; + + configFile = concatStringsSep "\n" (map ({ fpath, mime, command }: + if fpath == "" then "${mime} ${command}" else "fpath ${fpath} ${command}") + cfg.associations); + + association = types.submodule { + options = { + command = mkOption { + type = types.str; + description = "Preview command for files matched by this association."; + }; + + fpath = mkOption { + type = types.str; + default = ""; + description = "File path regex that this association should match."; + }; + + mime = mkOption { + type = types.str; + default = ""; + description = "Mime type regex that this association should match."; + }; + }; + }; +in { + imports = [ + (mkRemovedOptionModule [ "programs" "pistol" "config" ] + "Pistol is now configured with programs.pistol.associations.") + ]; + + meta.maintainers = [ hm.maintainers.mtoohey ]; + + options.programs.pistol = { + enable = mkEnableOption "file previewer for terminal file managers"; + + associations = mkOption { + type = types.listOf association; + default = [ ]; + example = literalExpression '' + [ + { mime = "application/json"; command = "bat %pistol-filename%"; } + { mime = "application/*"; command = "hexyl %pistol-filename%"; } + { fpath = ".*.md$"; command = "sh: bat --paging=never --color=always %pistol-filename% | head -8"; } + ] + ''; + description = '' + Associations written to the Pistol configuration at + $XDG_CONFIG_HOME/pistol/pistol.conf. + ''; + }; + + }; + + config = mkIf cfg.enable (mkMerge [ + { + assertions = [{ + assertion = all ({ fpath, mime, ... }: + (fpath != "" && mime == "") || (fpath == "" && mime != "")) + cfg.associations; + message = '' + Each entry in programs.pistol.associations must contain exactly one + of fpath or mime. + ''; + }]; + + home.packages = [ pkgs.pistol ]; + } + + (mkIf (cfg.associations != [ ] && pkgs.stdenv.hostPlatform.isDarwin) { + home.file."Library/Application Support/pistol/pistol.conf".text = + configFile; + }) + + (mkIf (cfg.associations != [ ] && !pkgs.stdenv.hostPlatform.isDarwin) { + xdg.configFile."pistol/pistol.conf".text = configFile; + }) + ]); +} diff --git a/third_party/home-manager/modules/programs/pls.nix b/third_party/home-manager/modules/programs/pls.nix new file mode 100644 index 0000000000..1c5af37828 --- /dev/null +++ b/third_party/home-manager/modules/programs/pls.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.pls; + + aliases = { + ls = "${cfg.package}/bin/pls"; + ll = + "${cfg.package}/bin/pls -d perms -d user -d group -d size -d mtime -d git"; + }; + +in { + meta.maintainers = [ hm.maintainers.kalhauge ]; + + options.programs.pls = { + enable = + mkEnableOption "pls, a modern replacement for ls"; + + package = mkPackageOption pkgs "pls" { }; + + enableAliases = mkEnableOption "recommended pls aliases"; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + programs.bash.shellAliases = mkIf cfg.enableAliases aliases; + + programs.fish.shellAliases = mkIf cfg.enableAliases aliases; + + programs.zsh.shellAliases = mkIf cfg.enableAliases aliases; + }; +} diff --git a/third_party/home-manager/modules/programs/pubs.nix b/third_party/home-manager/modules/programs/pubs.nix new file mode 100644 index 0000000000..5a597deabc --- /dev/null +++ b/third_party/home-manager/modules/programs/pubs.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.pubs; + +in { + meta.maintainers = [ hm.maintainers.loicreynier ]; + + options.programs.pubs = { + enable = mkEnableOption "pubs"; + + package = mkOption { + type = types.package; + default = pkgs.pubs; + defaultText = literalExpression "pkgs.pubs"; + description = "The package to use for the pubs script."; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = literalExpression '' + ''' + [main] + pubsdir = ''${config.home.homeDirectory}/.pubs + docsdir = ''${config.home.homeDirectory}/.pubs/doc + doc_add = link + open_cmd = xdg-open + + [plugins] + active = git,alias + + [[alias]] + + [[[la]]] + command = list -a + description = lists papers in lexicographic order + + [[git]] + quiet = True + manual = False + force_color = False + '''''; + description = '' + Configuration using syntax written to + $HOME/.pubsrc. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file.".pubsrc" = + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + }; +} diff --git a/third_party/home-manager/modules/programs/pylint.nix b/third_party/home-manager/modules/programs/pylint.nix new file mode 100644 index 0000000000..e6679b985b --- /dev/null +++ b/third_party/home-manager/modules/programs/pylint.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.pylint; + listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault { }); + iniFormat = pkgs.formats.ini { inherit listToValue; }; +in { + meta.maintainers = [ hm.maintainers.florpe ]; + options.programs.pylint = { + enable = mkEnableOption "the pylint Python linter"; + package = mkOption { + type = types.package; + default = pkgs.python3Packages.pylint; + defaultText = literalExpression "pkgs.python3Packages.pylint"; + description = "The pylint package to use."; + }; + settings = mkOption { + type = iniFormat.type; + default = { }; + defaultText = literalExpression "{}"; + description = "The pylint configuration."; + }; + }; + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + home.file.".pylintrc".source = iniFormat.generate "pylintrc" cfg.settings; + }; +} diff --git a/third_party/home-manager/modules/programs/pywal.nix b/third_party/home-manager/modules/programs/pywal.nix new file mode 100644 index 0000000000..b32f087c32 --- /dev/null +++ b/third_party/home-manager/modules/programs/pywal.nix @@ -0,0 +1,81 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.programs.pywal; + +in { + options = { programs.pywal = { enable = mkEnableOption "pywal"; }; }; + + config = mkIf cfg.enable { + + home.packages = [ pkgs.pywal ]; + + programs.zsh.initExtra = '' + # Import colorscheme from 'wal' asynchronously + # & # Run the process in the background. + # ( ) # Hide shell job control messages. + (cat ${config.xdg.cacheHome}/wal/sequences &) + ''; + + programs.kitty.extraConfig = '' + include ${config.xdg.cacheHome}/wal/colors-kitty.conf + ''; + + programs.rofi.theme."@import" = + "${config.xdg.cacheHome}/wal/colors-rofi-dark.rasi"; + + programs.neovim.plugins = [{ + plugin = pkgs.vimPlugins.pywal-nvim; + type = "lua"; + }]; + + # wal generates and that's the one we should load from /home/teto/.cache/wal/colors.Xresources ~/.Xresources + xsession.windowManager.i3 = { + extraConfig = '' + set_from_resource $bg i3wm.color0 #ff0000 + set_from_resource $bg-alt i3wm.color14 #ff0000 + set_from_resource $fg i3wm.color15 #ff0000 + set_from_resource $fg-alt i3wm.color2 #ff0000 + set_from_resource $hl i3wm.color13 #ff0000 + ''; + + config.colors = { + focused = { + border = "$fg-alt"; + background = "$bg"; + text = "$hl"; + indicator = "$fg-alt"; + childBorder = "$hl"; + }; + + focusedInactive = { + border = "$fg-alt"; + background = "$bg"; + text = "$fg"; + indicator = "$fg-alt"; + childBorder = "$fg-alt"; + }; + + unfocused = { + border = "$fg-alt"; + background = "$bg"; + text = "$fg"; + indicator = "$fg-alt"; + childBorder = "$fg-alt"; + }; + + urgent = { + border = "$fg-alt"; + background = "$bg"; + text = "$fg"; + indicator = "$fg-alt"; + childBorder = "$fg-alt"; + }; + + background = "$bg"; + }; + }; + }; +} + diff --git a/third_party/home-manager/modules/programs/rbw.nix b/third_party/home-manager/modules/programs/rbw.nix index f3a17ca5b6..204aaa6b6b 100644 --- a/third_party/home-manager/modules/programs/rbw.nix +++ b/third_party/home-manager/modules/programs/rbw.nix @@ -68,7 +68,7 @@ in { meta.maintainers = with lib.hm.maintainers; [ ambroisie ]; options.programs.rbw = with lib; { - enable = mkEnableOption "rwb, a CLI Bitwarden client"; + enable = mkEnableOption "rbw, a CLI Bitwarden client"; package = mkOption { type = types.package; diff --git a/third_party/home-manager/modules/programs/rofi.nix b/third_party/home-manager/modules/programs/rofi.nix index 0c4bc3d897..649070737e 100644 --- a/third_party/home-manager/modules/programs/rofi.nix +++ b/third_party/home-manager/modules/programs/rofi.nix @@ -40,7 +40,12 @@ let end = ""; } name value) + "\n"; - toRasi = attrs: concatStringsSep "\n" (mapAttrsToList mkRasiSection attrs); + toRasi = attrs: + concatStringsSep "\n" (concatMap (mapAttrsToList mkRasiSection) [ + (filterAttrs (n: _: n == "@theme") attrs) + (filterAttrs (n: _: n == "@import") attrs) + (removeAttrs attrs [ "@theme" "@import" ]) + ]); locationsMap = { center = 0; @@ -110,6 +115,14 @@ in { ''; }; + finalPackage = mkOption { + type = types.package; + readOnly = true; + description = '' + Resulting customized rofi package. + ''; + }; + plugins = mkOption { default = [ ]; type = types.listOf types.package; @@ -249,14 +262,15 @@ in { inherit value; }; - home.packages = let + programs.rofi.finalPackage = let rofiWithPlugins = cfg.package.override (old: rec { plugins = (old.plugins or [ ]) ++ cfg.plugins; }); - rofiPackage = if builtins.hasAttr "override" cfg.package then - rofiWithPlugins - else - cfg.package; - in [ rofiPackage ]; + in if builtins.hasAttr "override" cfg.package then + rofiWithPlugins + else + cfg.package; + + home.packages = [ cfg.finalPackage ]; home.file."${cfg.configPath}".text = toRasi { configuration = ({ diff --git a/third_party/home-manager/modules/programs/rtorrent.nix b/third_party/home-manager/modules/programs/rtorrent.nix index 7beeb2e422..5cfbe2f1a0 100644 --- a/third_party/home-manager/modules/programs/rtorrent.nix +++ b/third_party/home-manager/modules/programs/rtorrent.nix @@ -9,15 +9,21 @@ let in { meta.maintainers = [ maintainers.marsam ]; + imports = [ + (mkRenamedOptionModule # \ + [ "programs" "rtorrent" "settings" ] # \ + [ "programs" "rtorrent" "extraConfig" ]) + ]; + options.programs.rtorrent = { enable = mkEnableOption "rTorrent"; - settings = mkOption { + extraConfig = mkOption { type = types.lines; default = ""; description = '' Configuration written to - ~/.config/rtorrent/rtorrent.rc. See + $XDG_CONFIG_HOME/rtorrent/rtorrent.rc. See for explanation about possible values. ''; @@ -29,6 +35,6 @@ in { home.packages = [ pkgs.rtorrent ]; xdg.configFile."rtorrent/rtorrent.rc" = - mkIf (cfg.settings != "") { text = cfg.settings; }; + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; }; } diff --git a/third_party/home-manager/modules/programs/sagemath.nix b/third_party/home-manager/modules/programs/sagemath.nix new file mode 100644 index 0000000000..b07cec10f8 --- /dev/null +++ b/third_party/home-manager/modules/programs/sagemath.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.programs.sagemath; + + inherit (lib) literalExpression mkEnableOption mkOption types; + +in { + meta.maintainers = [ lib.maintainers.kirelagin ]; + + options.programs.sagemath = { + enable = mkEnableOption "SageMath, a mathematics software system"; + + package = mkOption { + type = types.package; + default = pkgs.sage; + defaultText = literalExpression "pkgs.sage"; + description = "The SageMath package to use."; + }; + + configDir = mkOption { + type = types.str; + default = "${config.xdg.configHome}/sage"; + defaultText = literalExpression "\${config.xdg.configHome}/sage"; + description = '' + Directory where the sage.init file will be stored. + Note that the upstream default is ~/.sage, + but our default is to follow XDG. + ''; + }; + + dataDir = mkOption { + type = types.str; + default = "${config.xdg.dataHome}/sage"; + defaultText = literalExpression "\${config.xdg.dataHome}/sage"; + description = '' + Location for DOT_SAGE. + Note that the upstream default is ~/.sage, + but our default is to follow XDG. + ''; + }; + + initScript = mkOption { + type = types.lines; + default = ""; + example = "%colors linux"; + description = '' + Contents of the init.sage file that is loaded on startup. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file."${cfg.configDir}/init.sage".text = cfg.initScript; + home.sessionVariables = { + DOT_SAGE = cfg.dataDir; + SAGE_STARTUP_FILE = "${cfg.configDir}/init.sage"; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/sbt.nix b/third_party/home-manager/modules/programs/sbt.nix index 4e10d61ea6..3e8dbc102e 100644 --- a/third_party/home-manager/modules/programs/sbt.nix +++ b/third_party/home-manager/modules/programs/sbt.nix @@ -8,13 +8,27 @@ let addSbtPlugin("${plugin.org}" % "${plugin.artifact}" % "${plugin.version}") ''; - renderCredential = cred: '' - credentials += Credentials("${cred.realm}", "${cred.host}", "${cred.user}", "${cred.passwordCommand}".lazyLines.mkString("\n")) - ''; + renderCredential = idx: cred: + let symbol = "credential_${toString idx}"; + in '' + lazy val ${symbol} = "${cred.passwordCommand}".!!.trim + credentials += Credentials("${cred.realm}", "${cred.host}", "${cred.user}", ${symbol}) + ''; renderCredentials = creds: '' import scala.sys.process._ - ${concatStrings (map renderCredential creds)}''; + ${concatStrings (imap0 renderCredential creds)}''; + + renderRepository = value: + if isString value then '' + ${value} + '' else '' + ${concatStrings (mapAttrsToList (name: value: "${name}: ${value}") value)} + ''; + + renderRepositories = repos: '' + [repositories] + ${concatStrings (map renderRepository cfg.repositories)}''; sbtTypes = { plugin = types.submodule { @@ -68,6 +82,11 @@ let cfg = config.programs.sbt; in { + imports = [ + (mkRemovedOptionModule [ "programs" "sbt" "baseConfigPath" ] + "Use programs.sbt.baseUserConfigPath instead, but note that the semantics are slightly different.") + ]; + meta.maintainers = [ maintainers.kubukoz ]; options.programs.sbt = { @@ -80,10 +99,13 @@ in { description = "The package with sbt to be installed."; }; - baseConfigPath = mkOption { + baseUserConfigPath = mkOption { type = types.str; - default = ".sbt/1.0"; - description = "Where the plugins and credentials should be located."; + default = ".sbt"; + description = '' + Where the sbt configuration files should be located, relative + HOME. + ''; }; plugins = mkOption { @@ -123,19 +145,63 @@ in { A list of credentials to define in the sbt configuration directory. ''; }; + + repositories = mkOption { + type = with types; + listOf + (either (enum [ "local" "maven-central" "maven-local" ]) (attrsOf str)); + default = [ ]; + example = literalExpression '' + [ + "local" + { my-ivy-proxy-releases = "http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]" } + { my-maven-proxy-releases = "http://repo.company.com/maven-releases/" } + "maven-central" + ] + ''; + description = '' + A list of repositories to use when resolving dependencies. Defined as a + list of pre-defined repository or custom repository as a set of name to + URL. The list will be used populate the ~/.sbt/repositories + file in the order specified. + + + + Pre-defined repositories must be one of local, + maven-local, maven-central. + + + + Custom repositories are defined as + { name-of-repo = "https://url.to.repo.com"}. + + + + See + + about this configuration section and + + to read about proxy repositories. + ''; + }; }; config = mkIf cfg.enable (mkMerge [ { home.packages = [ cfg.package ]; } (mkIf (cfg.plugins != [ ]) { - home.file."${cfg.baseConfigPath}/plugins/plugins.sbt".text = + home.file."${cfg.baseUserConfigPath}/1.0/plugins/plugins.sbt".text = concatStrings (map renderPlugin cfg.plugins); }) (mkIf (cfg.credentials != [ ]) { - home.file."${cfg.baseConfigPath}/credentials.sbt".text = + home.file."${cfg.baseUserConfigPath}/1.0/credentials.sbt".text = renderCredentials cfg.credentials; }) + + (mkIf (cfg.repositories != [ ]) { + home.file."${cfg.baseUserConfigPath}/repositories".text = + renderRepositories cfg.repositories; + }) ]); } diff --git a/third_party/home-manager/modules/programs/scmpuff.nix b/third_party/home-manager/modules/programs/scmpuff.nix index 5f36ca0213..0a573af069 100644 --- a/third_party/home-manager/modules/programs/scmpuff.nix +++ b/third_party/home-manager/modules/programs/scmpuff.nix @@ -31,6 +31,14 @@ in { Whether to enable Zsh integration. ''; }; + + enableFishIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable fish integration. + ''; + }; }; config = mkIf cfg.enable { @@ -43,5 +51,10 @@ in { programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' eval "$(${cfg.package}/bin/scmpuff init -s)" ''; + + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration + (mkAfter '' + ${cfg.package}/bin/scmpuff init -s --shell=fish | source + ''); }; } diff --git a/third_party/home-manager/modules/programs/sioyek.nix b/third_party/home-manager/modules/programs/sioyek.nix new file mode 100644 index 0000000000..63bf5b6f1b --- /dev/null +++ b/third_party/home-manager/modules/programs/sioyek.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.sioyek; + + renderConfig = generators.toKeyValue { + mkKeyValue = key: value: "${key} ${value}"; + listsAsDuplicateKeys = true; + }; + +in { + options = { + programs.sioyek = { + enable = mkEnableOption + "Sioyek is a PDF viewer designed for reading research papers and technical books."; + + package = mkOption { + default = pkgs.sioyek; + defaultText = literalExpression "pkgs.sioyek"; + type = types.package; + description = "Package providing the sioyek binary"; + }; + + bindings = mkOption { + description = '' + Input configuration written to + $XDG_CONFIG_HOME/sioyek/keys_user.config. + See . + + Each attribute could also accept a list of strings to set multiple + bindings of the same command. + ''; + type = with types; attrsOf (either str (listOf str)); + default = { }; + example = literalExpression '' + { + "move_up" = "k"; + "move_down" = "j"; + "move_left" = "h"; + "move_right" = "l"; + "screen_down" = [ "d" "" ]; + "screen_up" = [ "u" "" ]; + } + ''; + }; + + config = mkOption { + description = '' + Input configuration written to + $XDG_CONFIG_HOME/sioyek/prefs_user.config. + See . + ''; + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + "background_color" = "1.0 1.0 1.0"; + "text_highlight_color" = "1.0 0.0 0.0"; + } + ''; + }; + + }; + }; + + config = mkIf cfg.enable (mkMerge [ + { home.packages = [ cfg.package ]; } + (mkIf (cfg.config != { }) { + xdg.configFile."sioyek/prefs_user.config".text = renderConfig cfg.config; + }) + (mkIf (cfg.bindings != { }) { + xdg.configFile."sioyek/keys_user.config".text = renderConfig cfg.bindings; + }) + ]); + + meta.maintainers = [ hm.maintainers.podocarp ]; +} diff --git a/third_party/home-manager/modules/programs/skim.nix b/third_party/home-manager/modules/programs/skim.nix index 40377054bf..3d4da74df2 100644 --- a/third_party/home-manager/modules/programs/skim.nix +++ b/third_party/home-manager/modules/programs/skim.nix @@ -10,6 +10,13 @@ in { options.programs.skim = { enable = mkEnableOption "skim - a command-line fuzzy finder"; + package = mkOption { + type = types.package; + default = pkgs.skim; + defaultText = literalExpression "pkgs.skim"; + description = "Package providing the skim tool."; + }; + defaultCommand = mkOption { type = types.nullOr types.str; default = null; @@ -102,7 +109,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.skim ]; + home.packages = [ cfg.package ]; home.sessionVariables = mapAttrs (n: v: toString v) (filterAttrs (n: v: v != [ ] && v != null) { @@ -117,20 +124,20 @@ in { programs.bash.initExtra = mkIf cfg.enableBashIntegration '' if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then - . ${pkgs.skim}/share/skim/completion.bash - . ${pkgs.skim}/share/skim/key-bindings.bash + . ${cfg.package}/share/skim/completion.bash + . ${cfg.package}/share/skim/key-bindings.bash fi ''; programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' if [[ $options[zle] = on ]]; then - . ${pkgs.skim}/share/skim/completion.zsh - . ${pkgs.skim}/share/skim/key-bindings.zsh + . ${cfg.package}/share/skim/completion.zsh + . ${cfg.package}/share/skim/key-bindings.zsh fi ''; programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - source ${pkgs.skim}/share/skim/key-bindings.fish && skim_key_bindings + source ${cfg.package}/share/skim/key-bindings.fish && skim_key_bindings ''; }; } diff --git a/third_party/home-manager/modules/programs/sm64ex.nix b/third_party/home-manager/modules/programs/sm64ex.nix index a5debee180..48c1cb9bea 100644 --- a/third_party/home-manager/modules/programs/sm64ex.nix +++ b/third_party/home-manager/modules/programs/sm64ex.nix @@ -80,7 +80,7 @@ in { nullOr (attrsOf (either str (either int (either bool (listOf str))))); default = null; description = - "Settings for sm64ex's ~/.local/share/sm64pc/sm64config.txt file."; + "Settings for sm64ex's $XDG_DATA_HOME/sm64pc/sm64config.txt file."; example = literalExpression '' { fullscreen = false; diff --git a/third_party/home-manager/modules/programs/sqls.nix b/third_party/home-manager/modules/programs/sqls.nix new file mode 100644 index 0000000000..33a8448fff --- /dev/null +++ b/third_party/home-manager/modules/programs/sqls.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.sqls; + + yamlFormat = pkgs.formats.yaml { }; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.sqls = { + enable = mkEnableOption "sqls, a SQL language server written in Go"; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = literalExpression '' + { + lowercaseKeywords = true; + connections = [ + { + driver = "mysql"; + dataSourceName = "root:root@tcp(127.0.0.1:13306)/world"; + } + ]; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/sqls/config.yml. See + + for supported values. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.sqls ]; + + xdg.configFile."sqls/config.yml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "sqls-config" cfg.settings; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/ssh.nix b/third_party/home-manager/modules/programs/ssh.nix index b51ecedf4b..f906d1bc73 100644 --- a/third_party/home-manager/modules/programs/ssh.nix +++ b/third_party/home-manager/modules/programs/ssh.nix @@ -13,8 +13,6 @@ let then " ${entry.address}" else " [${entry.address}]:${toString entry.port}"; - yn = flag: if flag then "yes" else "no"; - unwords = builtins.concatStringsSep " "; bindOptions = { @@ -62,10 +60,37 @@ let matchBlockModule = types.submodule ({ dagName, ... }: { options = { host = mkOption { - type = types.str; + type = types.nullOr types.str; + default = null; example = "*.example.org"; description = '' - The host pattern used by this conditional block. + Host pattern used by this conditional block. + See + + ssh_config + 5 + + for Host block details. + This option is ignored if + + if defined. + ''; + }; + + match = mkOption { + type = types.nullOr types.str; + default = null; + example = "host canonical\nhost exec \"ping -c1 -q 192.168.17.1\""; + description = '' + Match block conditions used by this block. See + + ssh_config + 5 + + for Match block details. + This option takes precedence over + + if defined. ''; }; @@ -278,13 +303,18 @@ let }; }; - config.host = mkDefault dagName; +# config.host = mkDefault dagName; }); - matchBlockStr = cf: concatStringsSep "\n" ( - ["Host ${cf.host}"] + matchBlockStr = key: cf: concatStringsSep "\n" ( + let + hostOrDagName = if cf.host != null then cf.host else key; + matchHead = if cf.match != null + then "Match ${cf.match}" + else "Host ${hostOrDagName}"; + in [ "${matchHead}" ] ++ optional (cf.port != null) " Port ${toString cf.port}" - ++ optional (cf.forwardAgent != null) " ForwardAgent ${yn cf.forwardAgent}" + ++ optional (cf.forwardAgent != null) " ForwardAgent ${lib.hm.booleans.yesNo cf.forwardAgent}" ++ optional cf.forwardX11 " ForwardX11 yes" ++ optional cf.forwardX11Trusted " ForwardX11Trusted yes" ++ optional cf.identitiesOnly " IdentitiesOnly yes" @@ -296,7 +326,7 @@ let " ServerAliveInterval ${toString cf.serverAliveInterval}" ++ optional (cf.serverAliveCountMax != 3) " ServerAliveCountMax ${toString cf.serverAliveCountMax}" - ++ optional (cf.compression != null) " Compression ${yn cf.compression}" + ++ optional (cf.compression != null) " Compression ${lib.hm.booleans.yesNo cf.compression}" ++ optional (!cf.checkHostIP) " CheckHostIP no" ++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}" ++ optional (cf.proxyJump != null) " ProxyJump ${cf.proxyJump}" @@ -494,15 +524,15 @@ in ++ (optional (cfg.includes != [ ]) '' Include ${concatStringsSep " " cfg.includes} '') - ++ (map (block: matchBlockStr block.data) matchBlocks) + ++ (map (block: matchBlockStr block.name block.data) matchBlocks) )} Host * - ForwardAgent ${yn cfg.forwardAgent} - Compression ${yn cfg.compression} + ForwardAgent ${lib.hm.booleans.yesNo cfg.forwardAgent} + Compression ${lib.hm.booleans.yesNo cfg.compression} ServerAliveInterval ${toString cfg.serverAliveInterval} ServerAliveCountMax ${toString cfg.serverAliveCountMax} - HashKnownHosts ${yn cfg.hashKnownHosts} + HashKnownHosts ${lib.hm.booleans.yesNo cfg.hashKnownHosts} UserKnownHostsFile ${cfg.userKnownHostsFile} ControlMaster ${cfg.controlMaster} ControlPath ${cfg.controlPath} @@ -510,5 +540,9 @@ in ${replaceStrings ["\n"] ["\n "] cfg.extraConfig} ''; + + warnings = mapAttrsToList + (n: v: "The SSH config match block `programs.ssh.matchBlocks.${n}` sets both of the host and match options.\nThe match option takes precedence.") + (filterAttrs (n: v: v.data.host != null && v.data.match != null) cfg.matchBlocks); }; } diff --git a/third_party/home-manager/modules/programs/starship.nix b/third_party/home-manager/modules/programs/starship.nix index 77a9cad31d..05763c0ba3 100644 --- a/third_party/home-manager/modules/programs/starship.nix +++ b/third_party/home-manager/modules/programs/starship.nix @@ -51,7 +51,7 @@ in { ''; description = '' Configuration written to - ~/.config/starship.toml. + $XDG_CONFIG_HOME/starship.toml. See for the full list of options. @@ -81,6 +81,22 @@ in { Whether to enable Fish integration. ''; }; + + enableIonIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Ion integration. + ''; + }; + + enableNushellIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Nushell integration. + ''; + }; }; config = mkIf cfg.enable { @@ -92,7 +108,7 @@ in { programs.bash.initExtra = mkIf cfg.enableBashIntegration '' if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then - eval "$(${starshipCmd} init bash)" + eval "$(${starshipCmd} init bash --print-full-init)" fi ''; @@ -107,5 +123,28 @@ in { eval (${starshipCmd} init fish) end ''; + + programs.ion.initExtra = mkIf cfg.enableIonIntegration '' + if test $TERM != "dumb" && not exists -s INSIDE_EMACS || test $INSIDE_EMACS = "vterm" + eval $(${starshipCmd} init ion) + end + ''; + + programs.nushell = mkIf cfg.enableNushellIntegration { + # Unfortunately nushell doesn't allow conditionally sourcing nor + # conditionally setting (global) environment variables, which is why the + # check for terminal compatibility (as seen above for the other shells) is + # not done here. + extraEnv = '' + let starship_cache = "${config.xdg.cacheHome}/starship" + if not ($starship_cache | path exists) { + mkdir $starship_cache + } + ${starshipCmd} init nu | save --force ${config.xdg.cacheHome}/starship/init.nu + ''; + extraConfig = '' + source ${config.xdg.cacheHome}/starship/init.nu + ''; + }; }; } diff --git a/third_party/home-manager/modules/programs/swaylock.nix b/third_party/home-manager/modules/programs/swaylock.nix new file mode 100644 index 0000000000..187ff9d616 --- /dev/null +++ b/third_party/home-manager/modules/programs/swaylock.nix @@ -0,0 +1,32 @@ +{ config, lib, ... }: + +let cfg = config.programs.swaylock; +in { + meta.maintainers = [ lib.hm.maintainers.rcerc ]; + + options.programs.swaylock.settings = lib.mkOption { + type = with lib.types; attrsOf (oneOf [ bool float int str ]); + default = { }; + description = '' + Default arguments to swaylock. An empty set + disables configuration generation. + ''; + example = { + color = "808080"; + font-size = 24; + indicator-idle-visible = false; + indicator-radius = 100; + line-color = "ffffff"; + show-failed-attempts = true; + }; + }; + + config.xdg.configFile."swaylock/config" = lib.mkIf (cfg.settings != { }) { + text = lib.concatStrings (lib.mapAttrsToList (n: v: + if v == false then + "" + else + (if v == true then n else n + "=" + builtins.toString v) + "\n") + cfg.settings); + }; +} diff --git a/third_party/home-manager/modules/programs/taskwarrior.nix b/third_party/home-manager/modules/programs/taskwarrior.nix index 441313252b..3eb0013e30 100644 --- a/third_party/home-manager/modules/programs/taskwarrior.nix +++ b/third_party/home-manager/modules/programs/taskwarrior.nix @@ -24,6 +24,8 @@ let formatPair = key: value: if isAttrs value then formatSet key value else formatLine key value; + homeConf = "${config.xdg.configHome}/task/home-manager-taskrc"; + userConf = "${config.xdg.configHome}/task/taskrc"; in { options = { programs.taskwarrior = { @@ -88,7 +90,7 @@ in { config = mkIf cfg.enable { home.packages = [ pkgs.taskwarrior ]; - xdg.configFile."task/taskrc".text = '' + home.file."${homeConf}".text = '' data.location=${cfg.dataLocation} ${optionalString (cfg.colorTheme != null) (if isString cfg.colorTheme then "include ${cfg.colorTheme}.theme" @@ -99,5 +101,21 @@ in { ${cfg.extraConfig} ''; + + home.activation.regenDotTaskRc = hm.dag.entryAfter [ "writeBoundary" ] '' + $VERBOSE_ECHO "Ensuring generated taskwarrior config included in taskrc" + + if [[ ! -s "${userConf}" ]]; then + # Ensure file's existence + if [[ -v DRY_RUN ]]; then + $DRY_RUN_CMD echo "include ${homeConf}" ">" "${userConf}" + else + echo "include ${homeConf}" > "${userConf}" + fi + elif ! grep -qF "include ${homeConf}" ${escapeShellArg userConf}; then + # Add include statement for Home Manager generated config. + $DRY_RUN_CMD sed -i '1i include ${homeConf}' ${escapeShellArg userConf} + fi + ''; }; } diff --git a/third_party/home-manager/modules/programs/tealdeer.nix b/third_party/home-manager/modules/programs/tealdeer.nix new file mode 100644 index 0000000000..98ef4d2c8a --- /dev/null +++ b/third_party/home-manager/modules/programs/tealdeer.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.programs.tealdeer; + + tomlFormat = pkgs.formats.toml { }; + + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support" + else + config.xdg.configHome; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.tealdeer = { + enable = mkEnableOption "Tealdeer"; + + settings = mkOption { + type = tomlFormat.type; + default = { }; + defaultText = literalExpression "{ }"; + example = literalExpression '' + { + display = { + compact = false; + use_pager = true; + }; + updates = { + auto_update = false; + }; + }; + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/tealdeer/config.toml on Linux or + $HOME/Library/Application Support/tealdeer/config.toml + on Darwin. See + + for more information. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.tealdeer ]; + + home.file."${configDir}/tealdeer/config.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "tealdeer-config" cfg.settings; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/thunderbird.nix b/third_party/home-manager/modules/programs/thunderbird.nix new file mode 100644 index 0000000000..8c5a4b8686 --- /dev/null +++ b/third_party/home-manager/modules/programs/thunderbird.nix @@ -0,0 +1,306 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + inherit (pkgs.stdenv.hostPlatform) isDarwin; + + cfg = config.programs.thunderbird; + + enabledAccounts = attrValues + (filterAttrs (_: a: a.thunderbird.enable) config.accounts.email.accounts); + + enabledAccountsWithId = + map (a: a // { id = builtins.hashString "sha256" a.name; }) enabledAccounts; + + thunderbirdConfigPath = + if isDarwin then "Library/Thunderbird" else ".thunderbird"; + + thunderbirdProfilesPath = if isDarwin then + "${thunderbirdConfigPath}/Profiles" + else + thunderbirdConfigPath; + + profilesWithId = + imap0 (i: v: v // { id = toString i; }) (attrValues cfg.profiles); + + profilesIni = foldl recursiveUpdate { + General = { + StartWithLastProfile = 1; + Version = 2; + }; + } (flip map profilesWithId (profile: { + "Profile${profile.id}" = { + Name = profile.name; + Path = if isDarwin then "Profiles/${profile.name}" else profile.name; + IsRelative = 1; + Default = if profile.isDefault then 1 else 0; + }; + })); + + toThunderbirdAccount = account: profile: + let id = account.id; + in { + "mail.account.account_${id}.identities" = "id_${id}"; + "mail.account.account_${id}.server" = "server_${id}"; + "mail.identity.id_${id}.fullName" = account.realName; + "mail.identity.id_${id}.useremail" = account.address; + "mail.identity.id_${id}.valid" = true; + } // optionalAttrs account.primary { + "mail.accountmanager.defaultaccount" = "account_${id}"; + } // optionalAttrs (account.gpg != null) { + "mail.identity.id_${id}.attachPgpKey" = false; + "mail.identity.id_${id}.autoEncryptDrafts" = true; + "mail.identity.id_${id}.e2etechpref" = 0; + "mail.identity.id_${id}.encryptionpolicy" = + if account.gpg.encryptByDefault then 2 else 0; + "mail.identity.id_${id}.is_gnupg_key_id" = true; + "mail.identity.id_${id}.last_entered_external_gnupg_key_id" = + account.gpg.key; + "mail.identity.id_${id}.openpgp_key_id" = account.gpg.key; + "mail.identity.id_${id}.protectSubject" = true; + "mail.identity.id_${id}.sign_mail" = account.gpg.signByDefault; + } // optionalAttrs (account.imap != null) { + "mail.server.server_${id}.directory" = + "${thunderbirdProfilesPath}/${profile.name}/ImapMail/${id}"; + "mail.server.server_${id}.directory-rel" = "[ProfD]ImapMail/${id}"; + "mail.server.server_${id}.hostname" = account.imap.host; + "mail.server.server_${id}.login_at_startup" = true; + "mail.server.server_${id}.name" = account.name; + "mail.server.server_${id}.port" = + if (account.imap.port != null) then account.imap.port else 143; + "mail.server.server_${id}.socketType" = if !account.imap.tls.enable then + 0 + else if account.imap.tls.useStartTls then + 2 + else + 3; + "mail.server.server_${id}.type" = "imap"; + "mail.server.server_${id}.userName" = account.userName; + } // optionalAttrs (account.smtp != null) { + "mail.identity.id_${id}.smtpServer" = "smtp_${id}"; + "mail.smtpserver.smtp_${id}.authMethod" = 3; + "mail.smtpserver.smtp_${id}.hostname" = account.smtp.host; + "mail.smtpserver.smtp_${id}.port" = + if (account.smtp.port != null) then account.smtp.port else 587; + "mail.smtpserver.smtp_${id}.try_ssl" = if !account.smtp.tls.enable then + 0 + else if account.smtp.tls.useStartTls then + 2 + else + 3; + "mail.smtpserver.smtp_${id}.username" = account.userName; + } // optionalAttrs (account.smtp != null && account.primary) { + "mail.smtp.defaultserver" = "smtp_${id}"; + } // account.thunderbird.settings id; + + mkUserJs = prefs: '' + // Generated by Home Manager. + + ${concatStrings (mapAttrsToList (name: value: '' + user_pref("${name}", ${builtins.toJSON value}); + '') prefs)} + ''; +in { + meta.maintainers = with hm.maintainers; [ d-dervishi jkarlson ]; + + options = { + programs.thunderbird = { + enable = mkEnableOption "Thunderbird"; + + package = mkOption { + type = types.package; + default = pkgs.thunderbird; + defaultText = literalExpression "pkgs.thunderbird"; + example = literalExpression "pkgs.thunderbird-91"; + description = "The Thunderbird package to use."; + }; + + profiles = mkOption { + type = with types; + attrsOf (submodule ({ config, name, ... }: { + options = { + name = mkOption { + type = types.str; + default = name; + readOnly = true; + description = "This profile's name."; + }; + + isDefault = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Whether this is a default profile. There must be exactly one + default profile. + ''; + }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + "mail.spellcheck.inline" = false; + } + ''; + description = '' + Preferences to add to this profile's + user.js. + ''; + }; + + withExternalGnupg = mkOption { + type = types.bool; + default = false; + example = true; + description = "Allow using external GPG keys with GPGME."; + }; + }; + })); + }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + "general.useragent.override" = ""; + "privacy.donottrackheader.enabled" = true; + } + ''; + description = '' + Attribute set of Thunderbird preferences to be added to + all profiles. + ''; + }; + + darwinSetupWarning = mkOption { + type = types.bool; + default = true; + example = false; + visible = isDarwin; + readOnly = !isDarwin; + description = '' + Warn to set environment variables before using this module. Only + relevant on Darwin. + ''; + }; + }; + + accounts.email.accounts = mkOption { + type = with types; + attrsOf (submodule { + options.thunderbird = { + enable = + mkEnableOption "the Thunderbird mail client for this account"; + + profiles = mkOption { + type = with types; listOf str; + default = [ ]; + example = literalExpression '' + [ "profile1" "profile2" ] + ''; + description = '' + List of Thunderbird profiles for which this account should be + enabled. If this list is empty (the default), this account will + be enabled for all declared profiles. + ''; + }; + + settings = mkOption { + type = with types; functionTo (attrsOf (oneOf [ bool int str ])); + default = _: { }; + defaultText = literalExpression "_: { }"; + example = literalExpression '' + id: { + "mail.identity.id_''${id}.protectSubject" = false; + "mail.identity.id_''${id}.autoEncryptDrafts" = false; + }; + ''; + description = '' + Extra settings to add to this Thunderbird account configuration. + The id given as argument is an automatically + generated account identifier. + ''; + }; + }; + }); + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (let defaults = catAttrs "name" (filter (a: a.isDefault) profilesWithId); + in { + assertion = cfg.profiles == { } || length defaults == 1; + message = "Must have exactly one default Thunderbird profile but found " + + toString (length defaults) + optionalString (length defaults > 1) + (", namely " + concatStringsSep "," defaults); + }) + + (let + profiles = catAttrs "name" profilesWithId; + selectedProfiles = + concatMap (a: a.thunderbird.profiles) enabledAccounts; + in { + assertion = (intersectLists profiles selectedProfiles) + == selectedProfiles; + message = "Cannot enable an account for a non-declared profile. " + + "The declared profiles are " + (concatStringsSep "," profiles) + + ", but the used profiles are " + + (concatStringsSep "," selectedProfiles); + }) + ]; + + warnings = optional (isDarwin && cfg.darwinSetupWarning) '' + Thunderbird packages are not yet supported on Darwin. You can still use + this module to manage your accounts and profiles by setting + 'programs.thunderbird.package' to a dummy value, for example using + 'pkgs.runCommand'. + + Note that this module requires you to set the following environment + variables when using an installation of Thunderbird that is not provided + by Nix: + + export MOZ_LEGACY_PROFILES=1 + export MOZ_ALLOW_DOWNGRADE=1 + ''; + + home.packages = [ cfg.package ] + ++ optional (any (p: p.withExternalGnupg) (attrValues cfg.profiles)) + pkgs.gpgme; + + home.file = mkMerge ([{ + "${thunderbirdConfigPath}/profiles.ini" = + mkIf (cfg.profiles != { }) { text = generators.toINI { } profilesIni; }; + }] ++ flip mapAttrsToList cfg.profiles (name: profile: { + "${thunderbirdProfilesPath}/${name}/user.js" = let + accounts = filter (a: + a.thunderbird.profiles == [ ] + || any (p: p == name) a.thunderbird.profiles) enabledAccountsWithId; + + smtp = filter (a: a.smtp != null) accounts; + in { + text = mkUserJs (builtins.foldl' (a: b: a // b) { } ([ + cfg.settings + + (optionalAttrs (length accounts != 0) { + "mail.accountmanager.accounts" = + concatStringsSep "," (map (a: "account_${a.id}") accounts); + }) + + (optionalAttrs (length smtp != 0) { + "mail.smtpservers" = + concatStringsSep "," (map (a: "smtp_${a.id}") smtp); + }) + + { "mail.openpgp.allow_external_gnupg" = profile.withExternalGnupg; } + + profile.settings + ] ++ (map (a: toThunderbirdAccount a profile) accounts))); + }; + })); + }; +} diff --git a/third_party/home-manager/modules/programs/timidity.nix b/third_party/home-manager/modules/programs/timidity.nix new file mode 100644 index 0000000000..26b9de9829 --- /dev/null +++ b/third_party/home-manager/modules/programs/timidity.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.programs.timidity; + +in { + meta.maintainers = [ lib.hm.maintainers.amesgen ]; + + options.programs.timidity = { + enable = lib.mkEnableOption "timidity, a software MIDI renderer"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.timidity; + defaultText = lib.literalExpression "pkgs.timidity"; + description = "The timidity package to use."; + }; + + finalPackage = lib.mkOption { + readOnly = true; + type = lib.types.package; + description = "Resulting package."; + }; + + extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + example = lib.literalExpression '' + ''' + soundfont ''${pkgs.soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2 + ''' + ''; + description = "Extra configuration."; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ cfg.finalPackage ]; + + programs.timidity.finalPackage = pkgs.symlinkJoin { + name = "timidity-with-config"; + paths = [ cfg.package ]; + nativeBuildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/timidity \ + --add-flags '-c ${pkgs.writeText "timidity.cfg" cfg.extraConfig}' + ''; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/tint2.nix b/third_party/home-manager/modules/programs/tint2.nix new file mode 100644 index 0000000000..4579f619cb --- /dev/null +++ b/third_party/home-manager/modules/programs/tint2.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.tint2; + +in { + meta.maintainers = [ hm.maintainers.CarlosLoboxyz ]; + + options.programs.tint2 = { + enable = + mkEnableOption "tint2, a simple, unobtrusive and light panel for Xorg"; + + package = mkOption { + type = types.package; + default = pkgs.tint2; + defaultText = literalExpression "pkgs.tint2"; + description = "Tint2 package to install."; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Commands for tint2 that will be add to the tint2rc + file. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile = { + "tint2/tint2rc" = + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/tiny.nix b/third_party/home-manager/modules/programs/tiny.nix new file mode 100644 index 0000000000..eba0c9c436 --- /dev/null +++ b/third_party/home-manager/modules/programs/tiny.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.programs.tiny; + format = pkgs.formats.yaml { }; + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support/tiny" + else + "${config.xdg.configHome}/tiny"; +in { + meta.maintainers = [ hm.maintainers.kmaasrud ]; + + options = { + programs.tiny = { + enable = mkEnableOption "tiny, a TUI IRC client written in Rust"; + + package = mkOption { + type = types.package; + default = pkgs.tiny; + defaultText = literalExpression "pkgs.tiny"; + description = "The tiny package to install."; + }; + + settings = mkOption { + type = format.type; + default = { }; + defaultText = literalExpression "{ }"; + example = literalExpression '' + { + servers = [ + { + addr = "irc.libera.chat"; + port = 6697; + tls = true; + realname = "John Doe"; + nicks = [ "tinyuser" ]; + } + ]; + defaults = { + nicks = [ "tinyuser" ]; + realname = "John Doe"; + join = []; + tls = true; + }; + }; + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/tiny/config.yml. See + + for the default configuration. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file."${configDir}/config.yml" = mkIf (cfg.settings != { }) { + source = format.generate "tiny-config" cfg.settings; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/tmate.nix b/third_party/home-manager/modules/programs/tmate.nix new file mode 100644 index 0000000000..6681baf6c1 --- /dev/null +++ b/third_party/home-manager/modules/programs/tmate.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.tmate; + +in { + meta.maintainers = [ maintainers.jlesquembre ]; + + options = { + programs.tmate = { + enable = mkEnableOption "tmate"; + + package = mkOption { + type = types.package; + default = pkgs.tmate; + defaultText = literalExpression "pkgs.tmate"; + example = literalExpression "pkgs.tmate"; + description = "The tmate package to install."; + }; + + host = mkOption { + type = with types; nullOr str; + default = null; + example = literalExpression "tmate.io"; + description = "Tmate server address."; + }; + + port = mkOption { + type = with types; nullOr port; + default = null; + example = 2222; + description = "Tmate server port."; + }; + + dsaFingerprint = mkOption { + type = with types; nullOr string; + default = null; + example = literalExpression + "SHA256:1111111111111111111111111111111111111111111"; + description = "Tmate server EdDSA key fingerprint."; + }; + + rsaFingerprint = mkOption { + type = with types; nullOr string; + default = null; + example = literalExpression + "SHA256:1111111111111111111111111111111111111111111"; + description = "Tmate server RSA key fingerprint."; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Additional content written at the end of + ~/.tmate.conf. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file.".tmate.conf".text = let + conf = + optional (cfg.host != null) ''set -g tmate-server-host "${cfg.host}"'' + ++ optional (cfg.port != null) + "set -g tmate-server-port ${builtins.toString cfg.port}" + ++ optional (cfg.dsaFingerprint != null) + ''set -g tmate-server-ed25519-fingerprint "${cfg.dsaFingerprint}"'' + ++ optional (cfg.rsaFingerprint != null) + ''set -g tmate-server-rsa-fingerprint "${cfg.rsaFingerprint}"'' + ++ optional (cfg.extraConfig != "") cfg.extraConfig; + in concatStringsSep "\n" conf + "\n"; + }; +} diff --git a/third_party/home-manager/modules/programs/tmux.nix b/third_party/home-manager/modules/programs/tmux.nix index 4b5125966d..bf98a3f37b 100644 --- a/third_party/home-manager/modules/programs/tmux.nix +++ b/third_party/home-manager/modules/programs/tmux.nix @@ -49,8 +49,8 @@ let ${optionalString cfg.newSession "new-session"} ${optionalString cfg.reverseSplit '' - bind v split-window -h - bind s split-window -v + bind -N "Split the pane into two, left and right" v split-window -h + bind -N "Split the pane into two, top and bottom" s split-window -v ''} set -g status-keys ${cfg.keyMode} @@ -58,34 +58,40 @@ let ${optionalString (cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) '' - bind h select-pane -L - bind j select-pane -D - bind k select-pane -U - bind l select-pane -R + bind -N "Select pane to the left of the active pane" h select-pane -L + bind -N "Select pane below the active pane" j select-pane -D + bind -N "Select pane above the active pane" k select-pane -U + bind -N "Select pane to the right of the active pane" l select-pane -R - bind -r H resize-pane -L ${toString cfg.resizeAmount} - bind -r J resize-pane -D ${toString cfg.resizeAmount} - bind -r K resize-pane -U ${toString cfg.resizeAmount} - bind -r L resize-pane -R ${toString cfg.resizeAmount} + bind -r -N "Resize the pane left by ${toString cfg.resizeAmount}" \ + H resize-pane -L ${toString cfg.resizeAmount} + bind -r -N "Resize the pane down by ${toString cfg.resizeAmount}" \ + J resize-pane -D ${toString cfg.resizeAmount} + bind -r -N "Resize the pane up by ${toString cfg.resizeAmount}" \ + K resize-pane -U ${toString cfg.resizeAmount} + bind -r -N "Resize the pane right by ${toString cfg.resizeAmount}" \ + L resize-pane -R ${toString cfg.resizeAmount} ''} ${if cfg.prefix != null then '' # rebind main key: ${cfg.prefix} unbind C-${defaultShortcut} set -g prefix ${cfg.prefix} - bind ${cfg.prefix} send-prefix + bind -N "Send the prefix key through to the application" \ + ${cfg.prefix} send-prefix '' else optionalString (cfg.shortcut != defaultShortcut) '' # rebind main key: C-${cfg.shortcut} unbind C-${defaultShortcut} set -g prefix C-${cfg.shortcut} - bind ${cfg.shortcut} send-prefix + bind -N "Send the prefix key through to the application" \ + ${cfg.shortcut} send-prefix bind C-${cfg.shortcut} last-window ''} ${optionalString cfg.disableConfirmationPrompt '' - bind-key & kill-window - bind-key x kill-pane + bind-key -N "Kill the current window" & kill-window + bind-key -N "Kill the current pane" x kill-pane ''} setw -g aggressive-resize ${boolToStr cfg.aggressiveResize} diff --git a/third_party/home-manager/modules/programs/topgrade.nix b/third_party/home-manager/modules/programs/topgrade.nix index 1511d4b45c..ac88643d09 100644 --- a/third_party/home-manager/modules/programs/topgrade.nix +++ b/third_party/home-manager/modules/programs/topgrade.nix @@ -42,7 +42,7 @@ in { ''; description = '' Configuration written to - ~/.config/topgrade.toml. + $XDG_CONFIG_HOME/topgrade.toml. See for the full list of options. diff --git a/third_party/home-manager/modules/programs/urxvt.nix b/third_party/home-manager/modules/programs/urxvt.nix index 905e14c14a..545a1e7f87 100644 --- a/third_party/home-manager/modules/programs/urxvt.nix +++ b/third_party/home-manager/modules/programs/urxvt.nix @@ -12,8 +12,8 @@ in { package = mkOption { type = types.package; - default = pkgs.rxvt_unicode; - defaultText = literalExpression "pkgs.rxvt_unicode"; + default = pkgs.rxvt-unicode; + defaultText = literalExpression "pkgs.rxvt-unicode"; description = "rxvt-unicode package to install."; }; diff --git a/third_party/home-manager/modules/programs/vim.nix b/third_party/home-manager/modules/programs/vim.nix index a0168add85..e4d993a619 100644 --- a/third_party/home-manager/modules/programs/vim.nix +++ b/third_party/home-manager/modules/programs/vim.nix @@ -127,16 +127,26 @@ in { packageConfigurable = mkOption { type = types.package; - description = "Configurable vim package"; - default = pkgs.vim_configurable; - defaultText = "pkgs.vim_configurable"; + description = "Vim package to customize"; + default = pkgs.vim-full or pkgs.vim_configurable; + defaultText = literalExpression "pkgs.vim-full"; + example = literalExpression "pkgs.vim"; + }; + + defaultEditor = mkOption { + type = types.bool; + default = false; + description = '' + Whether to configure vim as the default + editor using the EDITOR environment variable. + ''; }; }; }; config = (let customRC = '' - ${concatStringsSep "\n" (filter (v: v != "") (mapAttrsToList setExpr + ${concatStringsSep "\n" (remove "" (mapAttrsToList setExpr (builtins.intersectAttrs knownSettings cfg.settings)))} ${cfg.extraConfig} @@ -170,6 +180,8 @@ in { home.packages = [ cfg.package ]; + home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "vim"; }; + programs.vim = { package = vim; plugins = defaultPlugins; diff --git a/third_party/home-manager/modules/programs/vscode.nix b/third_party/home-manager/modules/programs/vscode.nix index 5fa2d59ed0..27faf39bc4 100644 --- a/third_party/home-manager/modules/programs/vscode.nix +++ b/third_party/home-manager/modules/programs/vscode.nix @@ -28,12 +28,26 @@ let "${config.xdg.configHome}/${configDir}/User"; configFilePath = "${userDir}/settings.json"; + tasksFilePath = "${userDir}/tasks.json"; keybindingsFilePath = "${userDir}/keybindings.json"; # TODO: On Darwin where are the extensions? extensionPath = ".${extensionDir}/extensions"; + mergedUserSettings = cfg.userSettings + // optionalAttrs (!cfg.enableUpdateCheck) { "update.mode" = "none"; } + // optionalAttrs (!cfg.enableExtensionUpdateCheck) { + "extensions.autoCheckUpdates" = false; + }; in { + imports = [ + (mkChangedOptionModule [ "programs" "vscode" "immutableExtensionsDir" ] [ + "programs" + "vscode" + "mutableExtensionsDir" + ] (config: !config.programs.vscode.immutableExtensionsDir)) + ]; + options = { programs.vscode = { enable = mkEnableOption "Visual Studio Code"; @@ -47,12 +61,28 @@ in { ''; }; + enableUpdateCheck = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable update checks/notifications. + ''; + }; + + enableExtensionUpdateCheck = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable update notifications for extensions. + ''; + }; + userSettings = mkOption { type = jsonFormat.type; default = { }; example = literalExpression '' { - "update.channel" = "none"; + "files.autoSave" = "off"; "[nix]"."editor.tabSize" = 2; } ''; @@ -62,6 +92,27 @@ in { ''; }; + userTasks = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + { + version = "2.0.0"; + tasks = [ + { + type = "shell"; + label = "Hello task"; + command = "hello"; + } + ]; + } + ''; + description = '' + Configuration written to Visual Studio Code's + tasks.json. + ''; + }; + keybindings = mkOption { type = types.listOf (types.submodule { options = { @@ -112,10 +163,19 @@ in { extensions = mkOption { type = types.listOf types.package; default = [ ]; - example = literalExpression "[ pkgs.vscode-extensions.bbenoist.Nix ]"; + example = literalExpression "[ pkgs.vscode-extensions.bbenoist.nix ]"; description = '' The extensions Visual Studio Code should be started with. - These will override but not delete manually installed ones. + ''; + }; + + mutableExtensionsDir = mkOption { + type = types.bool; + default = true; + example = false; + description = '' + Whether extensions can be installed or updated manually + or by Visual Studio Code. ''; }; }; @@ -124,26 +184,42 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - # Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2 - home.file = let - subDir = "share/vscode/extensions"; - toPaths = ext: - # Links every dir in ext to the extension path. - map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; }) - (if ext ? vscodeExtUniqueId then - [ ext.vscodeExtUniqueId ] - else - builtins.attrNames (builtins.readDir (ext + "/${subDir}"))); - toSymlink = concatMap toPaths cfg.extensions; - dropNullFields = filterAttrs (_: v: v != null); - in foldr (a: b: a // b) { - "${configFilePath}" = mkIf (cfg.userSettings != { }) { - source = jsonFormat.generate "vscode-user-settings" cfg.userSettings; - }; - "${keybindingsFilePath}" = mkIf (cfg.keybindings != [ ]) { - source = jsonFormat.generate "vscode-keybindings" - (map dropNullFields cfg.keybindings); - }; - } toSymlink; + home.file = mkMerge [ + (mkIf (mergedUserSettings != { }) { + "${configFilePath}".source = + jsonFormat.generate "vscode-user-settings" mergedUserSettings; + }) + (mkIf (cfg.userTasks != { }) { + "${tasksFilePath}".source = + jsonFormat.generate "vscode-user-tasks" cfg.userTasks; + }) + (mkIf (cfg.keybindings != [ ]) + (let dropNullFields = filterAttrs (_: v: v != null); + in { + "${keybindingsFilePath}".source = + jsonFormat.generate "vscode-keybindings" + (map dropNullFields cfg.keybindings); + })) + (mkIf (cfg.extensions != [ ]) (let + subDir = "share/vscode/extensions"; + + # Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2 + toPaths = ext: + map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; }) + (if ext ? vscodeExtUniqueId then + [ ext.vscodeExtUniqueId ] + else + builtins.attrNames (builtins.readDir (ext + "/${subDir}"))); + in if cfg.mutableExtensionsDir then + mkMerge (concatMap toPaths cfg.extensions) + else { + "${extensionPath}".source = let + combinedExtensionsDrv = pkgs.buildEnv { + name = "vscode-extensions"; + paths = cfg.extensions; + }; + in "${combinedExtensionsDrv}/${subDir}"; + })) + ]; }; } diff --git a/third_party/home-manager/modules/programs/watson.nix b/third_party/home-manager/modules/programs/watson.nix new file mode 100644 index 0000000000..54cfbc135f --- /dev/null +++ b/third_party/home-manager/modules/programs/watson.nix @@ -0,0 +1,94 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.watson; + + iniFormat = pkgs.formats.ini { }; + + configDir = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support" + else + config.xdg.configHome; + +in { + meta.maintainers = [ maintainers.polykernel ]; + + options.programs.watson = { + enable = mkEnableOption "watson, a wonderful CLI to track your time"; + + package = mkOption { + type = types.package; + default = pkgs.watson; + defaultText = literalExpression "pkgs.watson"; + description = "Package providing the watson."; + }; + + enableBashIntegration = mkEnableOption "watson's bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "watson's zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "watson's fish integration" // { + default = true; + }; + + settings = mkOption { + type = iniFormat.type; + default = { }; + description = '' + Configuration written to + $XDG_CONFIG_HOME/watson/config on Linux or + $HOME/Library/Application Support/watson/config on Darwin. + + See + for an example configuration. + ''; + example = literalExpression '' + { + backend = { + url = "https://api.crick.fr"; + token = "yourapitoken"; + }; + + options = { + stop_on_start = true; + stop_on_restart = false; + date_format = "%Y.%m.%d"; + time_format = "%H:%M:%S%z"; + week_start = "monday"; + log_current = false; + pager = true; + report_current = false; + reverse_log = true; + }; + } + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file."${configDir}/watson/config" = mkIf (cfg.settings != { }) { + source = iniFormat.generate "watson-config" cfg.settings; + }; + + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + source ${cfg.package}/share/bash-completion/completions/watson + ''; + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' + source ${cfg.package}/share/zsh/site-functions/_watson + ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + source ${cfg.package}/share/fish/vendor_completions.d/watson.fish + ''; + }; +} diff --git a/third_party/home-manager/modules/programs/waybar.nix b/third_party/home-manager/modules/programs/waybar.nix index e7963e8277..12002d546d 100644 --- a/third_party/home-manager/modules/programs/waybar.nix +++ b/third_party/home-manager/modules/programs/waybar.nix @@ -97,7 +97,8 @@ let modules = mkOption { type = jsonFormat.type; - default = { }; + visible = false; + default = null; description = "Modules configuration."; example = literalExpression '' { @@ -156,7 +157,7 @@ in { }; settings = mkOption { - type = listOf waybarBarConfig; + type = either (listOf waybarBarConfig) (attrsOf waybarBarConfig); default = [ ]; description = '' Configuration for Waybar, see + + When setting this value to "sway-session.target", + make sure to also enable , + otherwise the service may never be started. + ''; + }; + style = mkOption { type = nullOr (either path str); default = null; @@ -230,7 +244,7 @@ in { config = let # Removes nulls because Waybar ignores them. # This is not recursive. - removeNulls = filterAttrs (_: v: v != null); + removeTopLevelNulls = filterAttrs (_: v: v != null); # Makes the actual valid configuration Waybar accepts # (strips our custom settings before converting to JSON) @@ -240,10 +254,17 @@ in { # as its descendants have to live at the top-level settingsWithoutModules = removeAttrs configuration [ "modules" ]; settingsModules = - optionalAttrs (configuration.modules != { }) configuration.modules; - in removeNulls (settingsWithoutModules // settingsModules); + optionalAttrs (configuration.modules != null) configuration.modules; + in removeTopLevelNulls (settingsWithoutModules // settingsModules); + + # Allow using attrs for settings instead of a list in order to more easily override + settings = if builtins.isAttrs cfg.settings then + lib.attrValues cfg.settings + else + cfg.settings; + # The clean list of configurations - finalConfiguration = map makeConfiguration cfg.settings; + finalConfiguration = map makeConfiguration settings; configSource = jsonFormat.generate "waybar-config.json" finalConfiguration; @@ -255,7 +276,7 @@ in { ({ assertion = if lib.versionAtLeast config.home.stateVersion "22.05" then - all (x: !hasAttr "modules" x) cfg.settings + all (x: !hasAttr "modules" x || x.modules == null) settings else true; message = '' @@ -267,7 +288,7 @@ in { home.packages = [ cfg.package ]; - xdg.configFile."waybar/config" = mkIf (cfg.settings != [ ]) { + xdg.configFile."waybar/config" = mkIf (settings != [ ]) { source = configSource; onChange = '' ${pkgs.procps}/bin/pkill -u $USER -USR2 waybar || true @@ -297,12 +318,12 @@ in { Service = { ExecStart = "${cfg.package}/bin/waybar"; - ExecReload = "kill -SIGUSR2 $MAINPID"; + ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID"; Restart = "on-failure"; KillMode = "mixed"; }; - Install = { WantedBy = [ "graphical-session.target" ]; }; + Install = { WantedBy = [ cfg.systemd.target ]; }; }; }) ]); diff --git a/third_party/home-manager/modules/programs/wezterm.nix b/third_party/home-manager/modules/programs/wezterm.nix new file mode 100644 index 0000000000..94e2f89855 --- /dev/null +++ b/third_party/home-manager/modules/programs/wezterm.nix @@ -0,0 +1,101 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.wezterm; + tomlFormat = pkgs.formats.toml { }; + +in { + options.programs.wezterm = { + enable = mkEnableOption "wezterm"; + + package = mkOption { + type = types.package; + default = pkgs.wezterm; + defaultText = literalExpression "pkgs.wezterm"; + description = "The Wezterm package to install."; + }; + + extraConfig = mkOption { + type = types.lines; + default = '' + return {} + ''; + example = literalExpression '' + -- Your lua code / config here + local mylib = require 'mylib'; + return { + usemylib = mylib.do_fun(); + 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"}, + } + } + ''; + description = '' + Extra configuration written to + $XDG_CONFIG_HOME/wezterm/wezterm.lua. See + + how to configure. + ''; + }; + + colorSchemes = mkOption { + type = types.attrsOf (tomlFormat.type); + default = { }; + example = literalExpression '' + myCoolTheme = { + ansi = [ + "#222222" "#D14949" "#48874F" "#AFA75A" + "#599797" "#8F6089" "#5C9FA8" "#8C8C8C" + ]; + brights = [ + "#444444" "#FF6D6D" "#89FF95" "#FFF484" + "#97DDFF" "#FDAAF2" "#85F5DA" "#E9E9E9" + ]; + background = "#1B1B1B"; + cursor_bg = "#BEAF8A"; + cursor_border = "#BEAF8A"; + cursor_fg = "#1B1B1B"; + foreground = "#BEAF8A"; + selection_bg = "#444444"; + selection_fg = "#E9E9E9"; + }; + ''; + description = '' + Attribute set of additional color schemes to be written to + $XDG_CONFIG_HOME/wezterm/colors, where each key is + taken as the name of the corresponding color scheme. See + + for more details of the TOML color scheme format. + ''; + }; + + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile = { + "wezterm/wezterm.lua".text = '' + -- Generated by Home Manager. + -- See https://wezfurlong.org/wezterm/ + + -- Add config folder to watchlist for config reloads. + local wezterm = require 'wezterm'; + wezterm.add_to_config_reload_watch_list(wezterm.config_dir) + + ${cfg.extraConfig} + ''; + } // mapAttrs' (name: value: + nameValuePair "wezterm/colors/${name}.toml" { + source = tomlFormat.generate "${name}.toml" { colors = value; }; + }) cfg.colorSchemes; + }; +} diff --git a/third_party/home-manager/modules/programs/xmobar.nix b/third_party/home-manager/modules/programs/xmobar.nix index 9d8593b7bc..a29bea846a 100644 --- a/third_party/home-manager/modules/programs/xmobar.nix +++ b/third_party/home-manager/modules/programs/xmobar.nix @@ -55,5 +55,5 @@ in { xdg.configFile."xmobar/.xmobarrc".text = cfg.extraConfig; }; - meta.maintainers = with maintainers; [ t4ccer ]; + meta.maintainers = [ hm.maintainers.t4ccer ]; } diff --git a/third_party/home-manager/modules/programs/yt-dlp.nix b/third_party/home-manager/modules/programs/yt-dlp.nix new file mode 100644 index 0000000000..af74db16dc --- /dev/null +++ b/third_party/home-manager/modules/programs/yt-dlp.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.yt-dlp; + + renderSettings = mapAttrsToList (name: value: + if isBool value then + if value then "--${name}" else "--no-${name}" + else + "--${name} ${toString value}"); + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.yt-dlp = { + enable = mkEnableOption "yt-dlp"; + + package = mkOption { + type = types.package; + default = pkgs.yt-dlp; + defaultText = literalExpression "pkgs.yt-dlp"; + description = "Package providing the yt-dlp tool."; + }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/yt-dlp/config. + + Options must be specified in their long form, for + example, update = true; instead of U = true;. + Short options can be specified in the extraConfig option. + See + for explanation about possible values. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = '' + --update + -F + ''; + description = '' + Extra configuration to add to + $XDG_CONFIG_HOME/yt-dlp/config. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."yt-dlp/config" = mkIf (cfg.settings != { }) { + text = concatStringsSep "\n" + (remove "" (renderSettings cfg.settings ++ [ cfg.extraConfig ])) + "\n"; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/zathura.nix b/third_party/home-manager/modules/programs/zathura.nix index 64a77cb3be..769ec71020 100644 --- a/third_party/home-manager/modules/programs/zathura.nix +++ b/third_party/home-manager/modules/programs/zathura.nix @@ -12,6 +12,8 @@ let if isBool v then (if v then "true" else "false") else toString v; in ''set ${n} "${formatValue v}"''; + formatMapLine = n: v: "map ${n} ${toString v}"; + in { meta.maintainers = [ maintainers.rprospero ]; @@ -45,6 +47,24 @@ in { }; }; + mappings = mkOption { + default = { }; + type = with types; attrsOf str; + description = '' + Add mappings to zathura and make + them permanent. See + + zathurarc + 5 + + for the full list of possible mappings. + ''; + example = { + D = "toggle_page_mode"; + "" = "navigate next"; + }; + }; + extraConfig = mkOption { type = types.lines; default = ""; @@ -60,6 +80,7 @@ in { xdg.configFile."zathura/zathurarc".text = concatStringsSep "\n" ([ ] ++ optional (cfg.extraConfig != "") cfg.extraConfig - ++ mapAttrsToList formatLine cfg.options) + "\n"; + ++ mapAttrsToList formatLine cfg.options + ++ mapAttrsToList formatMapLine cfg.mappings) + "\n"; }; } diff --git a/third_party/home-manager/modules/programs/zellij.nix b/third_party/home-manager/modules/programs/zellij.nix new file mode 100644 index 0000000000..2cfa625daa --- /dev/null +++ b/third_party/home-manager/modules/programs/zellij.nix @@ -0,0 +1,56 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.zellij; + yamlFormat = pkgs.formats.yaml { }; + + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support/org.Zellij-Contributors.Zellij" + else + "${config.xdg.configHome}/zellij"; + +in { + meta.maintainers = [ hm.maintainers.mainrs ]; + + options.programs.zellij = { + enable = mkEnableOption "zellij"; + + package = mkOption { + type = types.package; + default = pkgs.zellij; + defaultText = literalExpression "pkgs.zellij"; + description = '' + The zellij package to install. + ''; + }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = literalExpression '' + { + theme = "custom"; + themes.custom.fg = 5; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/zellij/config.yaml. + + See for the full + list of options. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file."${configDir}/config.yaml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "zellij.yaml" cfg.settings; + }; + }; +} diff --git a/third_party/home-manager/modules/programs/zplug.nix b/third_party/home-manager/modules/programs/zplug.nix index 5f2b44311f..7c731444a7 100644 --- a/third_party/home-manager/modules/programs/zplug.nix +++ b/third_party/home-manager/modules/programs/zplug.nix @@ -45,10 +45,10 @@ in { home.packages = [ pkgs.zplug ]; programs.zsh.initExtraBeforeCompInit = '' - source ${pkgs.zplug}/init.zsh - export ZPLUG_HOME=${cfg.zplugHome} + source ${pkgs.zplug}/init.zsh + ${optionalString (cfg.plugins != [ ]) '' ${concatStrings (map (plugin: '' zplug "${plugin.name}"${ diff --git a/third_party/home-manager/modules/programs/zsh.nix b/third_party/home-manager/modules/programs/zsh.nix index 6cd880309f..9ffe9dfac3 100644 --- a/third_party/home-manager/modules/programs/zsh.nix +++ b/third_party/home-manager/modules/programs/zsh.nix @@ -18,10 +18,6 @@ let mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") cfg.shellAliases ); - globalAliasesStr = concatStringsSep "\n" ( - mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases - ); - dirHashesStr = concatStringsSep "\n" ( mapAttrsToList (k: v: ''hash -d ${k}="${v}"'') cfg.dirHashes ); @@ -188,6 +184,28 @@ let }; }; + historySubstringSearchModule = types.submodule { + options = { + enable = mkEnableOption "history substring search"; + searchUpKey = mkOption { + type = types.str; + default = "^[[A"; + description = '' + The key code to be used when searching up. + The default of ^[[A corresponds to the UP key. + ''; + }; + searchDownKey = mkOption { + type = types.str; + default = "^[[B"; + description = '' + The key code to be used when searching down. + The default of ^[[B corresponds to the DOWN key. + ''; + }; + }; + }; + in { @@ -246,7 +264,7 @@ in } ''; description = '' - Similar to opt-programs.zsh.shellAliases, + Similar to , but are substituted anywhere on a line. ''; type = types.attrsOf types.str; @@ -295,6 +313,12 @@ in description = "Enable zsh syntax highlighting"; }; + historySubstringSearch = mkOption { + type = historySubstringSearchModule; + default = {}; + description = "Options related to zsh-history-substring-search."; + }; + history = mkOption { type = historyModule; default = {}; @@ -442,40 +466,54 @@ in ''; }) + { + home.file."${relToDotDir ".zshenv"}".text = '' + # Environment variables + . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" + + # Only source this once + if [[ -z "$__HM_ZSH_SESS_VARS_SOURCED" ]]; then + export __HM_ZSH_SESS_VARS_SOURCED=1 + ${envVarsStr} + fi + ''; + } + { home.packages = with pkgs; [ zsh ] ++ optional cfg.enableCompletion nix-zsh-completions ++ optional cfg.oh-my-zsh.enable oh-my-zsh; - home.file."${relToDotDir ".zshrc"}".text = '' - ${cfg.initExtraFirst} + home.file."${relToDotDir ".zshrc"}".text = concatStringsSep "\n" ([ + cfg.initExtraFirst + "typeset -U path cdpath fpath manpath" - typeset -U path cdpath fpath manpath - - ${optionalString (cfg.cdpath != []) '' + (optionalString (cfg.cdpath != []) '' cdpath+=(${concatStringsSep " " cfg.cdpath}) - ''} + '') + '' 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="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" + '' - ${optionalString (cfg.defaultKeymap != null) '' + (optionalString (cfg.defaultKeymap != null) '' # Use ${cfg.defaultKeymap} keymap as the default. ${getAttr cfg.defaultKeymap bindkeyCommands} - ''} + '') + localVarsStr - ${localVarsStr} + cfg.initExtraBeforeCompInit - ${cfg.initExtraBeforeCompInit} - - ${concatStrings (map (plugin: '' + (concatStrings (map (plugin: '' path+="$HOME/${pluginsDir}/${plugin.name}" fpath+="$HOME/${pluginsDir}/${plugin.name}" - '') cfg.plugins)} + '') cfg.plugins)) + '' # Oh-My-Zsh/Prezto calls compinit during initialization, # calling it twice causes slight start up slowdown # as all $fpath entries will be traversed again. @@ -487,14 +525,6 @@ in "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh" } - ${optionalString cfg.enableSyntaxHighlighting - "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - } - - # Environment variables - . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" - ${envVarsStr} - ${optionalString cfg.oh-my-zsh.enable '' # oh-my-zsh extra settings for plugins ${cfg.oh-my-zsh.extraConfig} @@ -542,13 +572,29 @@ in # Aliases ${aliasesStr} - - # Global Aliases - ${globalAliasesStr} - + '' + ] + ++ (mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases) + ++ [ ('' # Named Directory Hashes ${dirHashesStr} - ''; + '') + + (optionalString cfg.enableSyntaxHighlighting + # Load zsh-syntax-highlighting after all custom widgets have been created + # https://github.com/zsh-users/zsh-syntax-highlighting#faq + "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" + ) + + (optionalString (cfg.historySubstringSearch.enable or false) + # Load zsh-history-substring-search after zsh-syntax-highlighting + # https://github.com/zsh-users/zsh-history-substring-search#usage + '' + source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh + bindkey '${cfg.historySubstringSearch.searchUpKey}' history-substring-search-up + bindkey '${cfg.historySubstringSearch.searchDownKey}' history-substring-search-down + '') + ]); } (mkIf cfg.oh-my-zsh.enable { diff --git a/third_party/home-manager/modules/programs/zsh/prezto.nix b/third_party/home-manager/modules/programs/zsh/prezto.nix index 5c2853e7a6..17680ff259 100644 --- a/third_party/home-manager/modules/programs/zsh/prezto.nix +++ b/third_party/home-manager/modules/programs/zsh/prezto.nix @@ -365,11 +365,11 @@ in { # Generated by Nix ${optionalString (cfg.caseSensitive != null) '' zstyle ':prezto:*:*' case-sensitive '${ - if cfg.caseSensitive then "yes" else "no" + lib.hm.booleans.yesNo cfg.caseSensitive }' ''} ${optionalString (cfg.color != null) '' - zstyle ':prezto:*:*' color '${if cfg.color then "yes" else "no"}' + zstyle ':prezto:*:*' color '${lib.hm.booleans.yesNo cfg.color}' ''} ${optionalString (cfg.pmoduleDirs != [ ]) '' zstyle ':prezto:load' pmodule-dirs ${ @@ -410,12 +410,12 @@ in { ''} ${optionalString (cfg.editor.dotExpansion != null) '' zstyle ':prezto:module:editor' dot-expansion '${ - if cfg.editor.dotExpansion then "yes" else "no" + lib.hm.booleans.yesNo cfg.editor.dotExpansion }' ''} ${optionalString (cfg.editor.promptContext != null) '' zstyle ':prezto:module:editor' ps-context '${ - if cfg.editor.promptContext then "yes" else "no" + lib.hm.booleans.yesNo cfg.editor.promptContext }' ''} ${optionalString (cfg.git.submoduleIgnore != null) '' @@ -447,27 +447,27 @@ in { ''} ${optionalString (cfg.python.virtualenvAutoSwitch != null) '' zstyle ':prezto:module:python:virtualenv' auto-switch '${ - if cfg.python.virtualenvAutoSwitch then "yes" else "no" + lib.hm.booleans.yesNo cfg.python.virtualenvAutoSwitch }' ''} ${optionalString (cfg.python.virtualenvInitialize != null) '' zstyle ':prezto:module:python:virtualenv' initialize '${ - if cfg.python.virtualenvInitialize then "yes" else "no" + lib.hm.booleans.yesNo cfg.python.virtualenvInitialize }' ''} ${optionalString (cfg.ruby.chrubyAutoSwitch != null) '' zstyle ':prezto:module:ruby:chruby' auto-switch '${ - if cfg.ruby.chrubyAutoSwitch then "yes" else "no" + lib.hm.booleans.yesNo cfg.ruby.chrubyAutoSwitch }' ''} ${optionalString (cfg.screen.autoStartLocal != null) '' zstyle ':prezto:module:screen:auto-start' local '${ - if cfg.screen.autoStartLocal then "yes" else "no" + lib.hm.booleans.yesNo cfg.screen.autoStartLocal }' ''} ${optionalString (cfg.screen.autoStartRemote != null) '' zstyle ':prezto:module:screen:auto-start' remote '${ - if cfg.screen.autoStartRemote then "yes" else "no" + lib.hm.booleans.yesNo cfg.screen.autoStartRemote }' ''} ${optionalString (cfg.ssh.identities != [ ]) '' @@ -502,7 +502,7 @@ in { ''} ${optionalString (cfg.terminal.autoTitle != null) '' zstyle ':prezto:module:terminal' auto-title '${ - if cfg.terminal.autoTitle then "yes" else "no" + lib.hm.booleans.yesNo cfg.terminal.autoTitle }' ''} ${optionalString (cfg.terminal.windowTitleFormat != null) '' @@ -516,17 +516,17 @@ in { ''} ${optionalString (cfg.tmux.autoStartLocal != null) '' zstyle ':prezto:module:tmux:auto-start' local '${ - if cfg.tmux.autoStartLocal then "yes" else "no" + lib.hm.booleans.yesNo cfg.tmux.autoStartLocal }' ''} ${optionalString (cfg.tmux.autoStartRemote != null) '' zstyle ':prezto:module:tmux:auto-start' remote '${ - if cfg.tmux.autoStartRemote then "yes" else "no" + lib.hm.booleans.yesNo cfg.tmux.autoStartRemote }' ''} ${optionalString (cfg.tmux.itermIntegration != null) '' zstyle ':prezto:module:tmux:iterm' integrate '${ - if cfg.tmux.itermIntegration then "yes" else "no" + lib.hm.booleans.yesNo cfg.tmux.itermIntegration }' ''} ${optionalString (cfg.tmux.defaultSessionName != null) '' @@ -534,7 +534,7 @@ in { ''} ${optionalString (cfg.utility.safeOps != null) '' zstyle ':prezto:module:utility' safe-ops '${ - if cfg.utility.safeOps then "yes" else "no" + lib.hm.booleans.yesNo cfg.utility.safeOps }' ''} ${cfg.extraConfig} diff --git a/third_party/home-manager/modules/services/barrier.nix b/third_party/home-manager/modules/services/barrier.nix index 21364b7a3c..b619cb2870 100644 --- a/third_party/home-manager/modules/services/barrier.nix +++ b/third_party/home-manager/modules/services/barrier.nix @@ -70,7 +70,7 @@ in { Service.ExecStart = with cfg.client; toString ([ "${pkgs.barrier}/bin/barrierc" ] ++ optional (name != null) "--name ${name}" - ++ optional enableCrypto "--enable-crypto" + ++ optional (!enableCrypto) "--disable-crypto" ++ optional enableDragDrop "--enable-drag-drop" ++ extraFlags ++ [ server ]); }; diff --git a/third_party/home-manager/modules/services/borgmatic.nix b/third_party/home-manager/modules/services/borgmatic.nix new file mode 100644 index 0000000000..f5368cdfca --- /dev/null +++ b/third_party/home-manager/modules/services/borgmatic.nix @@ -0,0 +1,87 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + serviceConfig = config.services.borgmatic; + programConfig = config.programs.borgmatic; +in { + meta.maintainers = [ maintainers.DamienCassou ]; + + options = { + services.borgmatic = { + enable = mkEnableOption "Borgmatic service"; + + frequency = mkOption { + type = types.str; + default = "hourly"; + description = '' + How often to run borgmatic when + services.borgmatic.enable = true. + This value is passed to the systemd timer configuration as + the onCalendar option. See + + systemd.time + 7 + + for more information about the format. + ''; + }; + }; + }; + + config = mkIf serviceConfig.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.borgmatic" pkgs + lib.platforms.linux) + ]; + + systemd.user = { + services.borgmatic = { + Unit = { + Description = "borgmatic backup"; + # Prevent borgmatic from running unless the machine is + # plugged into power: + ConditionACPower = true; + }; + Service = { + Type = "oneshot"; + + # Lower CPU and I/O priority: + Nice = 19; + CPUSchedulingPolicy = "batch"; + IOSchedulingClass = "best-effort"; + IOSchedulingPriority = 7; + IOWeight = 100; + + Restart = "no"; + LogRateLimitIntervalSec = 0; + + # Delay start to prevent backups running during boot: + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3m"; + + ExecStart = '' + ${pkgs.systemd}/bin/systemd-inhibit \ + --who="borgmatic" \ + --why="Prevent interrupting scheduled backup" \ + ${programConfig.package}/bin/borgmatic \ + --stats \ + --verbosity -1 \ + --list \ + --syslog-verbosity 1 + ''; + }; + }; + + timers.borgmatic = { + Unit.Description = "Run borgmatic backup"; + Timer = { + OnCalendar = serviceConfig.frequency; + Persistent = true; + RandomizedDelaySec = "10m"; + }; + Install.WantedBy = [ "timers.target" ]; + }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/cachix-agent.nix b/third_party/home-manager/modules/services/cachix-agent.nix new file mode 100644 index 0000000000..01eca05b75 --- /dev/null +++ b/third_party/home-manager/modules/services/cachix-agent.nix @@ -0,0 +1,84 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + + cfg = config.services.cachix-agent; + +in { + meta.maintainers = [ maintainers.rycee ]; + + options.services.cachix-agent = { + enable = mkEnableOption '' + Cachix Deploy Agent: ''; + + name = mkOption { + type = types.str; + description = "The unique agent name."; + }; + + verbose = mkEnableOption "verbose output"; + + profile = mkOption { + type = types.str; + default = "home-manager"; + description = '' + The Nix profile name. + ''; + }; + + host = mkOption { + type = types.nullOr types.str; + default = null; + description = "Cachix URI to use."; + }; + + package = mkPackageOption pkgs "cachix" { }; + + credentialsFile = mkOption { + type = types.path; + default = "${config.xdg.configHome}/cachix-agent.token"; + defaultText = + literalExpression ''"''${config.xdg.configHome}/cachix-agent.token"''; + description = '' + Required file that needs to contain + CACHIX_AGENT_TOKEN=.... + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.cachix-agent" pkgs + lib.platforms.linux) + ]; + + systemd.user.services.cachix-agent = { + Unit.Description = "Cachix Deploy Agent"; + + Service = { + Environment = [ + "PATH=${ + if config.nix.enable && config.nix.package != null then + config.nix.package + else + pkgs.nix + }/bin" + ]; + EnvironmentFile = cfg.credentialsFile; + + # We don't want to kill children processes as those are deployments. + KillMode = "process"; + Restart = "on-failure"; + ExecStart = escapeShellArgs ([ "${cfg.package}/bin/cachix" ] + ++ optional cfg.verbose "--verbose" + ++ optional (cfg.host != null) "--host ${cfg.host}" + ++ [ "deploy" "agent" cfg.name ] + ++ optional (cfg.profile != null) cfg.profile); + }; + + Install.WantedBy = [ "default.target" ]; + }; + }; +} diff --git a/third_party/home-manager/modules/services/clipman.nix b/third_party/home-manager/modules/services/clipman.nix new file mode 100644 index 0000000000..4afee9a3e4 --- /dev/null +++ b/third_party/home-manager/modules/services/clipman.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.clipman; + +in { + meta.maintainers = [ maintainers.jwygoda ]; + + options.services.clipman = { + enable = mkEnableOption "clipman, a simple clipboard manager for Wayland"; + + package = mkPackageOption pkgs "clipman" { }; + + systemdTarget = mkOption { + type = types.str; + default = "graphical-session.target"; + example = "sway-session.target"; + description = '' + The systemd target that will automatically start the Waybar service. + + + When setting this value to "sway-session.target", + make sure to also enable , + otherwise the service may never be started. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.clipman" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.clipman = { + Unit = { + Description = "Clipboard management daemon"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = + "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${cfg.package}/bin/clipman store"; + ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID"; + Restart = "on-failure"; + KillMode = "mixed"; + }; + + Install = { WantedBy = [ cfg.systemdTarget ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/clipmenu.nix b/third_party/home-manager/modules/services/clipmenu.nix index 3f2055c9ac..4bb8916f10 100644 --- a/third_party/home-manager/modules/services/clipmenu.nix +++ b/third_party/home-manager/modules/services/clipmenu.nix @@ -18,6 +18,16 @@ in { defaultText = "pkgs.clipmenu"; description = "clipmenu derivation to use."; }; + + launcher = mkOption { + type = types.nullOr types.str; + default = null; + example = "rofi"; + description = '' + Launcher command, if not set, dmenu + will be used by default. + ''; + }; }; config = mkIf cfg.enable { @@ -28,6 +38,9 @@ in { home.packages = [ cfg.package ]; + home.sessionVariables = + mkIf (cfg.launcher != null) { CM_LAUNCHER = cfg.launcher; }; + systemd.user.services.clipmenu = { Unit = { Description = "Clipboard management daemon"; diff --git a/third_party/home-manager/modules/services/compton.nix b/third_party/home-manager/modules/services/compton.nix deleted file mode 100644 index 0b8e7232b4..0000000000 --- a/third_party/home-manager/modules/services/compton.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; { - imports = let - old = n: [ "services" "compton" n ]; - new = n: [ "services" "picom" n ]; - in [ - (mkRenamedOptionModule (old "activeOpacity") (new "activeOpacity")) - (mkRenamedOptionModule (old "backend") (new "backend")) - (mkRenamedOptionModule (old "blur") (new "blur")) - (mkRenamedOptionModule (old "blurExclude") (new "blurExclude")) - (mkRenamedOptionModule (old "extraOptions") (new "extraOptions")) - (mkRenamedOptionModule (old "fade") (new "fade")) - (mkRenamedOptionModule (old "fadeDelta") (new "fadeDelta")) - (mkRenamedOptionModule (old "fadeExclude") (new "fadeExclude")) - (mkRenamedOptionModule (old "fadeSteps") (new "fadeSteps")) - (mkRenamedOptionModule (old "inactiveDim") (new "inactiveDim")) - (mkRenamedOptionModule (old "inactiveOpacity") (new "inactiveOpacity")) - (mkRenamedOptionModule (old "menuOpacity") (new "menuOpacity")) - (mkRenamedOptionModule (old "noDNDShadow") (new "noDNDShadow")) - (mkRenamedOptionModule (old "noDockShadow") (new "noDockShadow")) - (mkRenamedOptionModule (old "opacityRule") (new "opacityRule")) - (mkRenamedOptionModule (old "package") (new "package")) - (mkRenamedOptionModule (old "refreshRate") (new "refreshRate")) - (mkRenamedOptionModule (old "shadow") (new "shadow")) - (mkRenamedOptionModule (old "shadowExclude") (new "shadowExclude")) - (mkRenamedOptionModule (old "shadowOffsets") (new "shadowOffsets")) - (mkRenamedOptionModule (old "shadowOpacity") (new "shadowOpacity")) - (mkChangedOptionModule (old "vSync") (new "vSync") (v: v != "none")) - ]; - - options.services.compton.enable = mkEnableOption "Compton X11 compositor" // { - visible = false; - }; - - config = mkIf config.services.compton.enable { - warnings = [ - "Obsolete option `services.compton.enable' is used. It was renamed to `services.picom.enable'." - ]; - - services.picom.enable = true; - }; -} diff --git a/third_party/home-manager/modules/services/dunst.nix b/third_party/home-manager/modules/services/dunst.nix index 238abc297e..b98b645e42 100644 --- a/third_party/home-manager/modules/services/dunst.nix +++ b/third_party/home-manager/modules/services/dunst.nix @@ -13,7 +13,7 @@ let mkKeyValue = key: value: let value' = if isBool value then - (if value then "yes" else "no") + (lib.hm.booleans.yesNo value) else if isString value then ''"${value}"'' else @@ -108,7 +108,10 @@ in { example = literalExpression '' { global = { - geometry = "300x5-30+50"; + width = 300; + height = 300; + offset = "30x50"; + origin = "top-right"; transparency = 10; frame_color = "#eceff1"; font = "Droid Sans 9"; diff --git a/third_party/home-manager/modules/services/easyeffects.nix b/third_party/home-manager/modules/services/easyeffects.nix index 001ff5d025..9dd01b9473 100644 --- a/third_party/home-manager/modules/services/easyeffects.nix +++ b/third_party/home-manager/modules/services/easyeffects.nix @@ -20,6 +20,13 @@ in { to your system configuration for the daemon to work correctly''; + package = mkOption { + type = types.package; + default = pkgs.easyeffects; + defaultText = literalExpression "pkgs.easyeffects"; + description = "The easyeffects package to use."; + }; + preset = mkOption { type = types.str; default = ""; @@ -38,7 +45,7 @@ in { # running easyeffects will just attach itself to gapplication service # at-spi2-core is to minimize journalctl noise of: # "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files" - home.packages = with pkgs; [ easyeffects at-spi2-core ]; + home.packages = with pkgs; [ cfg.package at-spi2-core ]; systemd.user.services.easyeffects = { Unit = { @@ -52,8 +59,8 @@ in { Service = { ExecStart = - "${pkgs.easyeffects}/bin/easyeffects --gapplication-service ${presetOpts}"; - ExecStop = "${pkgs.easyeffects}/bin/easyeffects --quit"; + "${cfg.package}/bin/easyeffects --gapplication-service ${presetOpts}"; + ExecStop = "${cfg.package}/bin/easyeffects --quit"; Restart = "on-failure"; RestartSec = 5; }; diff --git a/third_party/home-manager/modules/services/emacs.nix b/third_party/home-manager/modules/services/emacs.nix index 1631275ba9..9a6ef5e482 100644 --- a/third_party/home-manager/modules/services/emacs.nix +++ b/third_party/home-manager/modules/services/emacs.nix @@ -80,6 +80,27 @@ in { socketActivation = { enable = mkEnableOption "systemd socket activation for the Emacs service"; }; + + startWithUserSession = lib.mkOption { + type = lib.types.bool; + default = !cfg.socketActivation.enable; + defaultText = + literalExpression "!config.services.emacs.socketActivation.enable"; + example = true; + description = '' + Whether to launch Emacs service with the systemd user session. + ''; + }; + + defaultEditor = mkOption rec { + type = types.bool; + default = false; + example = !default; + description = '' + Whether to configure emacsclient as the default + editor using the EDITOR environment variable. + ''; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -135,11 +156,20 @@ in { ExecStopPost = "${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}"; }; - } // optionalAttrs (!cfg.socketActivation.enable) { + } // optionalAttrs (cfg.startWithUserSession) { Install = { WantedBy = [ "default.target" ]; }; }; - home.packages = optional cfg.client.enable (hiPrio clientDesktopItem); + home = { + packages = optional cfg.client.enable (hiPrio clientDesktopItem); + + sessionVariables = mkIf cfg.defaultEditor { + EDITOR = getBin (pkgs.writeShellScript "editor" '' + exec ${ + getBin cfg.package + }/bin/emacsclient "''${@:---create-frame}"''); + }; + }; } (mkIf cfg.socketActivation.enable { diff --git a/third_party/home-manager/modules/services/espanso.nix b/third_party/home-manager/modules/services/espanso.nix new file mode 100644 index 0000000000..3d66a59874 --- /dev/null +++ b/third_party/home-manager/modules/services/espanso.nix @@ -0,0 +1,86 @@ +{ pkgs, config, lib, ... }: + +let + + inherit (lib) + mkOption mkEnableOption mkIf maintainers literalExpression types platforms; + + inherit (lib.hm.assertions) assertPlatform; + + cfg = config.services.espanso; + + yaml = pkgs.formats.yaml { }; + +in { + meta.maintainers = with maintainers; [ lucasew ]; + + options = { + services.espanso = { + enable = mkEnableOption "Espanso: cross platform text expander in Rust"; + + package = mkOption { + type = types.package; + description = "Which espanso package to use"; + default = pkgs.espanso; + defaultText = literalExpression "pkgs.espanso"; + }; + + settings = mkOption { + type = yaml.type; + default = { matches = [ ]; }; + example = literalExpression '' + { + matches = [ + { # Simple text replacement + trigger = ":espanso"; + replace = "Hi there!"; + } + { # Dates + trigger = ":date"; + replace = "{{mydate}}"; + vars = [{ + name = "mydate"; + type = "date"; + params = { format = "%m/%d/%Y"; }; + }]; + } + { # Shell commands + trigger = ":shell"; + replace = "{{output}}"; + vars = [{ + name = "output"; + type = "shell"; + params = { cmd = "echo Hello from your shell"; }; + }]; + } + ]; + } + ''; + description = '' + The Espanso configuration to use. See + + for a description of available options. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ (assertPlatform "services.espanso" pkgs platforms.linux) ]; + + home.packages = [ cfg.package ]; + + xdg.configFile."espanso/default.yml".source = + yaml.generate "espanso-default.yml" cfg.settings; + + systemd.user.services.espanso = { + Unit = { Description = "Espanso: cross platform text expander in Rust"; }; + Service = { + Type = "exec"; + ExecStart = "${cfg.package}/bin/espanso daemon"; + Restart = "on-failure"; + }; + Install = { WantedBy = [ "default.target" ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/fnott.nix b/third_party/home-manager/modules/services/fnott.nix index 3ab3f0a748..aa9e918118 100644 --- a/third_party/home-manager/modules/services/fnott.nix +++ b/third_party/home-manager/modules/services/fnott.nix @@ -5,8 +5,7 @@ with lib; let cfg = config.services.fnott; - concatStringsSep' = sep: list: - concatStringsSep sep (filter (x: x != "") list); + concatStringsSep' = sep: list: concatStringsSep sep (remove "" list); iniFormat = pkgs.formats.ini { }; in { @@ -43,7 +42,7 @@ in { Note that environment variables in the path won't be properly expanded. - The configuration specified under + The configuration specified under will be generated and written to $XDG_CONFIG_HOME/fnott/fnott.ini regardless of this option. This allows using a mutable configuration file @@ -62,7 +61,7 @@ in { fnott.ini 5 - for a list of avaliable options and for a list of available options and for an example configuration. ''; diff --git a/third_party/home-manager/modules/services/fusuma.nix b/third_party/home-manager/modules/services/fusuma.nix new file mode 100644 index 0000000000..c48cf5a958 --- /dev/null +++ b/third_party/home-manager/modules/services/fusuma.nix @@ -0,0 +1,134 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.fusuma; + + yamlFormat = pkgs.formats.yaml { }; + + configJson = pkgs.writeText "config.json" (builtins.toJSON cfg.settings); + + configYamlRaw = pkgs.runCommand "config.yaml.raw" { } '' + ${pkgs.remarshal}/bin/json2yaml -i ${configJson} -o $out; + ''; + + # convert keys into literal numbers where necessary, + # fusuma does not support string type finger count. + strToInt = pkgs.writers.writePython3 "str2int" { + libraries = [ pkgs.python3Packages.pyyaml ]; + } '' + import yaml + from yaml import FullLoader + + + def str2int(config): + if type(config) is not dict: + return + + for key in list(config): + if type(config[key]) is dict and key.isdigit(): + t = config[key] + del config[key] + config[int(key)] = t + else: + str2int(config[key]) + + + if __name__ == '__main__': + path = "${configYamlRaw}" + with open(path) as f: + config = yaml.load(f, Loader=FullLoader) + str2int(config) + print(yaml.dump(config)) + ''; + + configYaml = pkgs.stdenv.mkDerivation { + name = "config.yaml"; + buildCommand = '' + ${strToInt} > $out + ''; + }; + + makeBinPath = packages: + foldl (a: b: if a == "" then b else "${a}:${b}") "" + (map (pkg: "${pkg}/bin") packages); + +in { + meta.maintainers = [ hm.maintainers.iosmanthus ]; + + options.services.fusuma = { + enable = mkEnableOption + "the fusuma systemd service to automatically enable touchpad gesture"; + + package = mkOption { + type = types.package; + default = pkgs.fusuma; + defaultText = literalExpression "pkgs.fusuma"; + description = "Package providing fusuma."; + }; + + settings = mkOption { + type = yamlFormat.type; + example = literalExpression '' + { + threshold = { + swipe = 0.1; + }; + interval = { + swipe = 0.7; + }; + swipe = { + "3" = { + left = { + # GNOME: Switch to left workspace + command = "xdotool key ctrl+alt+Right"; + }; + }; + }; + }; + ''; + description = '' + YAML config that will override the default fusuma configuration. + ''; + }; + + extraPackages = mkOption { + type = types.listOf types.package; + default = with pkgs; [ coreutils ]; + defaultText = literalExpression "pkgs.coreutils"; + example = literalExpression '' + with pkgs; [ coreutils xdotool ]; + ''; + description = '' + Extra packages needs to bring to the scope of fusuma service. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.fusuma" pkgs + lib.platforms.linux) + ]; + + xdg.configFile."fusuma/config.yaml".source = configYaml; + + systemd.user.services.fusuma = { + Unit = { + Description = "Fusuma services"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + Environment = with pkgs; "PATH=${makeBinPath cfg.extraPackages}"; + ExecStart = + "${cfg.package}/bin/fusuma -c ${config.xdg.configHome}/fusuma/config.yaml"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/getmail.nix b/third_party/home-manager/modules/services/getmail.nix index 83ed4ed456..05950e62ae 100644 --- a/third_party/home-manager/modules/services/getmail.nix +++ b/third_party/home-manager/modules/services/getmail.nix @@ -44,7 +44,7 @@ in { systemd.user.services.getmail = { Unit = { Description = "getmail email fetcher"; }; - Service = { ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}"; }; + Service = { ExecStart = "${pkgs.getmail6}/bin/getmail ${configFiles}"; }; }; systemd.user.timers.getmail = { diff --git a/third_party/home-manager/modules/services/git-sync.nix b/third_party/home-manager/modules/services/git-sync.nix index 07a7927126..42f8c4cc33 100644 --- a/third_party/home-manager/modules/services/git-sync.nix +++ b/third_party/home-manager/modules/services/git-sync.nix @@ -13,6 +13,7 @@ let Service = { Environment = [ + "PATH=${lib.makeBinPath (with pkgs; [ openssh git ])}" "GIT_SYNC_DIRECTORY=${repo.path}" "GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync" "GIT_SYNC_REPOSITORY=${repo.uri}" @@ -65,7 +66,7 @@ let }); in { - meta.maintainers = [ maintainers.imalison ]; + meta.maintainers = [ maintainers.imalison maintainers.cab404 ]; options = { services.git-sync = { diff --git a/third_party/home-manager/modules/services/gpg-agent.nix b/third_party/home-manager/modules/services/gpg-agent.nix index 785f11141c..ca70406f15 100644 --- a/third_party/home-manager/modules/services/gpg-agent.nix +++ b/third_party/home-manager/modules/services/gpg-agent.nix @@ -12,31 +12,58 @@ let gpgInitStr = '' GPG_TTY="$(tty)" export GPG_TTY - '' - + optionalString cfg.enableSshSupport - "${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null"; + '' + optionalString cfg.enableSshSupport + "${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null"; # mimic `gpgconf` output for use in `systemd` unit definitions. # we cannot use `gpgconf` directly because it heavily depends on system # state, but we need the values at build time. original: # https://github.com/gpg/gnupg/blob/c6702d77d936b3e9d91b34d8fdee9599ab94ee1b/common/homedir.c#L672-L681 gpgconf = dir: - if homedir == options.programs.gpg.homedir.default then + let + hash = + substring 0 24 (hexStringToBase32 (builtins.hashString "sha1" homedir)); + in if homedir == options.programs.gpg.homedir.default then "%t/gnupg/${dir}" else - builtins.readFile (pkgs.runCommand dir {} '' - PATH=${pkgs.xxd}/bin:$PATH + "%t/gnupg/d.${hash}/${dir}"; - hash=$(echo -n ${homedir} | sha1sum -b | xxd -r -p | base32 | \ - cut -c -24 | tr '[:upper:]' '[:lower:]' | \ - tr abcdefghijklmnopqrstuvwxyz234567 \ - ybndrfg8ejkmcpqxot1uwisza345h769) - echo -n "%t/gnupg/d.$hash/${dir}" > "$out" - ''); + # Act like `xxd -r -p | base32` but with z-base-32 alphabet and no trailing padding. + # Written in Nix for purity. + hexStringToBase32 = let + mod = a: b: a - a / b * b; + pow2 = elemAt [ 1 2 4 8 16 32 64 128 256 ]; + splitChars = s: init (tail (splitString "" s)); -in + base32Alphabet = splitChars "ybndrfg8ejkmcpqxot1uwisza345h769"; + hexToIntTable = listToAttrs (genList (x: { + name = toLower (toHexString x); + value = x; + }) 16); -{ + initState = { + ret = ""; + buf = 0; + bufBits = 0; + }; + go = { ret, buf, bufBits }: + hex: + let + buf' = buf * pow2 4 + hexToIntTable.${hex}; + bufBits' = bufBits + 4; + extraBits = bufBits' - 5; + in if bufBits >= 5 then { + ret = ret + elemAt base32Alphabet (buf' / pow2 extraBits); + buf = mod buf' (pow2 extraBits); + bufBits = bufBits' - 5; + } else { + ret = ret; + buf = buf'; + bufBits = bufBits'; + }; + in hexString: (foldl' go initState (splitChars hexString)).ret; + +in { meta.maintainers = [ maintainers.rycee ]; options = { @@ -170,35 +197,38 @@ in now. ''; }; + + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; }; }; config = mkIf cfg.enable (mkMerge [ { - home.file."${homedir}/gpg-agent.conf".text = concatStringsSep "\n" ( - optional (cfg.enableSshSupport) "enable-ssh-support" - ++ - optional (!cfg.grabKeyboardAndMouse) "no-grab" - ++ - optional (!cfg.enableScDaemon) "disable-scdaemon" - ++ - optional (cfg.defaultCacheTtl != null) + home.file."${homedir}/gpg-agent.conf".text = concatStringsSep "\n" + (optional (cfg.enableSshSupport) "enable-ssh-support" + ++ optional cfg.grabKeyboardAndMouse "grab" + ++ optional (!cfg.enableScDaemon) "disable-scdaemon" + ++ optional (cfg.defaultCacheTtl != null) "default-cache-ttl ${toString cfg.defaultCacheTtl}" - ++ - optional (cfg.defaultCacheTtlSsh != null) + ++ optional (cfg.defaultCacheTtlSsh != null) "default-cache-ttl-ssh ${toString cfg.defaultCacheTtlSsh}" - ++ - optional (cfg.maxCacheTtl != null) + ++ optional (cfg.maxCacheTtl != null) "max-cache-ttl ${toString cfg.maxCacheTtl}" - ++ - optional (cfg.maxCacheTtlSsh != null) + ++ optional (cfg.maxCacheTtlSsh != null) "max-cache-ttl-ssh ${toString cfg.maxCacheTtlSsh}" - ++ - optional (cfg.pinentryFlavor != null) + ++ optional (cfg.pinentryFlavor != null) "pinentry-program ${pkgs.pinentry.${cfg.pinentryFlavor}}/bin/pinentry" - ++ - [ cfg.extraConfig ] - ); + ++ [ cfg.extraConfig ]); home.sessionVariablesExtra = optionalString cfg.enableSshSupport '' if [[ -z "$SSH_AUTH_SOCK" ]]; then @@ -206,16 +236,18 @@ in fi ''; - programs.bash.initExtra = gpgInitStr; - programs.zsh.initExtra = gpgInitStr; - programs.fish.interactiveShellInit = '' + programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr; + programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr; + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' set -gx GPG_TTY (tty) ''; } (mkIf (cfg.sshKeys != null) { # Trailing newlines are important - home.file."${homedir}/sshcontrol".text = concatMapStrings (s: "${s}\n") cfg.sshKeys; + home.file."${homedir}/sshcontrol".text = concatMapStrings (s: '' + ${s} + '') cfg.sshKeys; }) # The systemd units below are direct translations of the @@ -239,7 +271,7 @@ in ExecStart = "${gpgPkg}/bin/gpg-agent --supervised" + optionalString cfg.verbose " --verbose"; ExecReload = "${gpgPkg}/bin/gpgconf --reload gpg-agent"; - Environment = "GNUPGHOME=${homedir}"; + Environment = [ "GNUPGHOME=${homedir}" ]; }; }; @@ -256,9 +288,7 @@ in DirectoryMode = "0700"; }; - Install = { - WantedBy = [ "sockets.target" ]; - }; + Install = { WantedBy = [ "sockets.target" ]; }; }; } @@ -266,7 +296,8 @@ in systemd.user.sockets.gpg-agent-ssh = { Unit = { Description = "GnuPG cryptographic agent (ssh-agent emulation)"; - Documentation = "man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1)"; + Documentation = + "man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1)"; }; Socket = { @@ -277,16 +308,15 @@ in DirectoryMode = "0700"; }; - Install = { - WantedBy = [ "sockets.target" ]; - }; + Install = { WantedBy = [ "sockets.target" ]; }; }; }) (mkIf cfg.enableExtraSocket { systemd.user.sockets.gpg-agent-extra = { Unit = { - Description = "GnuPG cryptographic agent and passphrase cache (restricted)"; + Description = + "GnuPG cryptographic agent and passphrase cache (restricted)"; Documentation = "man:gpg-agent(1) man:ssh(1)"; }; @@ -298,9 +328,7 @@ in DirectoryMode = "0700"; }; - Install = { - WantedBy = [ "sockets.target" ]; - }; + Install = { WantedBy = [ "sockets.target" ]; }; }; }) ]); diff --git a/third_party/home-manager/modules/services/grobi.nix b/third_party/home-manager/modules/services/grobi.nix index 2f64310996..d90b7244a9 100644 --- a/third_party/home-manager/modules/services/grobi.nix +++ b/third_party/home-manager/modules/services/grobi.nix @@ -24,7 +24,7 @@ in { Commands to be run after an output configuration was changed. The Nix value declared here will be translated to JSON and written to the key - in ~/.config/grobi.conf. + in $XDG_CONFIG_HOME/grobi.conf. ''; }; @@ -64,7 +64,7 @@ in { for more information. The Nix value declared here will be translated to JSON and written to the - key in ~/.config/grobi.conf. + key in $XDG_CONFIG_HOME/grobi.conf. ''; }; }; diff --git a/third_party/home-manager/modules/services/gromit-mpx.nix b/third_party/home-manager/modules/services/gromit-mpx.nix new file mode 100644 index 0000000000..7a85cf7647 --- /dev/null +++ b/third_party/home-manager/modules/services/gromit-mpx.nix @@ -0,0 +1,234 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.gromit-mpx; + + # Select the appropriate hot key: + hotkey = if isInt cfg.hotKey then + "--keycode ${toString cfg.hotKey}" + else if cfg.hotKey != null then + "--key ${cfg.hotKey}" + else + "--key none"; + + # Select the appropriate undo key: + undokey = if isInt cfg.undoKey then + "--undo-keycode ${toString cfg.undoKey}" + else if cfg.undoKey != null then + "--undo-key ${cfg.undoKey}" + else + "--undo-key none"; + + # The command line to send to gromit-mpx: + commandArgs = concatStringsSep " " [ hotkey undokey ]; + + # Gromit reads and writes from this file to store it's run time + # state. That will break our config so we set it manually which, + # thanks to the read-only Nix store, prevents Gromit from writing to + # it. + keyFile = generators.toINI { } { + General.ShowIntroOnStartup = false; + Drawing.Opacity = cfg.opacity; + }; + + # Allowed modifiers: + modsAndButtons = [ "1" "2" "3" "4" "5" "SHIFT" "CONTROL" "ALT" "META" ]; + + # Create a string of tool attributes: + toolAttrs = tool: + concatStringsSep " " ([ "size=${toString tool.size}" ] + ++ optional (tool.type != "eraser") ''color="${tool.color}"'' + ++ optional (tool.arrowSize != null) + "arrowsize=${toString tool.arrowSize}"); + + # Optional tool modifier string: + toolMod = tool: + if tool.modifiers != [ ] then + "[" + concatStringsSep ", " tool.modifiers + "]" + else + ""; + + # A single tool configuration: + toolToCfg = n: tool: '' + "tool-${toString n}" = ${toUpper tool.type} (${toolAttrs tool}); + "${tool.device}"${toolMod tool} = "tool-${toString n}"; + ''; + + # Per-tool options: + toolOptions = { + options = { + device = mkOption { + type = types.str; + example = "default"; + description = '' + Use this tool with the given xinput device. The device with + the name default works with any input. + ''; + }; + + type = mkOption { + type = types.enum [ "pen" "eraser" "recolor" ]; + default = "pen"; + example = "eraser"; + description = "Which type of tool this is."; + }; + + color = mkOption { + type = types.str; + default = "red"; + example = "#ff00ff"; + description = "The stroke (or recolor) color of the tool."; + }; + + size = mkOption { + type = types.ints.positive; + default = 5; + example = 3; + description = "The tool size."; + }; + + arrowSize = mkOption { + type = types.nullOr types.ints.positive; + default = null; + example = 2; + description = '' + If not null, automatically draw an arrow + at the end of a stroke with the given size. + ''; + }; + + modifiers = mkOption { + type = types.listOf (types.enum modsAndButtons); + default = [ ]; + example = [ "SHIFT" ]; + description = '' + Only activate this tool if the given modifiers are also active. + ''; + }; + }; + }; + +in { + meta.maintainers = [ maintainers.pjones ]; + + options.services.gromit-mpx = { + enable = mkEnableOption "Gromit-MPX annotation tool"; + + package = mkOption { + type = types.package; + default = pkgs.gromit-mpx; + defaultText = "pkgs.gromit-mpx"; + description = "The gromit-mpx package to use."; + }; + + hotKey = mkOption { + type = with types; nullOr (either str ints.positive); + default = "F9"; + example = "Insert"; + description = '' + A keysym or raw keycode that toggles the activation state of + gromit-mpx. Set to null to disable the + hotkey in which case you'll have to activate gromit-mpx + manually using the command line. + ''; + }; + + undoKey = mkOption { + type = with types; nullOr (either str ints.positive); + default = "F10"; + description = '' + A keysym or raw keycode that causes gromit-mpx to undo the + last stroke. Use this key along with the shift key to redo an + undone stoke. Set to null to disable the + undo hotkey. + ''; + }; + + opacity = mkOption { + type = types.addCheck types.float (f: f >= 0.0 && f <= 1.0) // { + description = "float between 0.0 and 1.0 (inclusive)"; + }; + default = 0.75; + example = 1.0; + description = "Opacity of the drawing overlay."; + }; + + tools = mkOption { + type = types.listOf (types.submodule toolOptions); + default = [ + { + device = "default"; + type = "pen"; + size = 5; + color = "red"; + } + { + device = "default"; + type = "pen"; + size = 5; + color = "blue"; + modifiers = [ "SHIFT" ]; + } + { + device = "default"; + type = "pen"; + size = 5; + color = "yellow"; + modifiers = [ "CONTROL" ]; + } + { + device = "default"; + type = "pen"; + size = 6; + color = "green"; + arrowSize = 1; + modifiers = [ "2" ]; + } + { + device = "default"; + type = "eraser"; + size = 75; + modifiers = [ "3" ]; + } + ]; + description = '' + Tool definitions for gromit-mpx to use. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.gromit-mpx" pkgs + lib.platforms.linux) + ]; + + xdg.configFile."gromit-mpx.ini".text = keyFile; + xdg.configFile."gromit-mpx.cfg".text = + concatStringsSep "\n" (imap1 toolToCfg cfg.tools); + + home.packages = [ cfg.package ]; + + systemd.user.services.gromit-mpx = { + Unit = { + Description = "Gromit-MPX"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + X-Restart-Triggers = [ + "${config.xdg.configFile."gromit-mpx.cfg".source}" + "${config.xdg.configFile."gromit-mpx.ini".source}" + ]; + }; + + Service = { + Type = "simple"; + ExecStart = "${cfg.package}/bin/gromit-mpx ${commandArgs}"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/home-manager-auto-upgrade.nix b/third_party/home-manager/modules/services/home-manager-auto-upgrade.nix new file mode 100644 index 0000000000..2f975ef1ba --- /dev/null +++ b/third_party/home-manager/modules/services/home-manager-auto-upgrade.nix @@ -0,0 +1,69 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.services.home-manager.autoUpgrade; + + homeManagerPackage = pkgs.callPackage ../../home-manager { + path = config.programs.home-manager.path; + }; + +in { + meta.maintainers = [ lib.hm.maintainers.pinage404 ]; + + options = { + services.home-manager.autoUpgrade = { + enable = lib.mkEnableOption '' + the Home Manager upgrade service that periodically updates your Nix + channels before running home-manager switch''; + + frequency = lib.mkOption { + type = lib.types.str; + example = "weekly"; + description = '' + The interval at which the Home Manager auto upgrade is run. + This value is passed to the systemd timer configuration + as the OnCalendar option. + The format is described in + + systemd.time + 7 + . + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.home-manager.autoUpgrade" pkgs + lib.platforms.linux) + ]; + + systemd.user = { + timers.home-manager-auto-upgrade = { + Unit.Description = "Home Manager upgrade timer"; + + Install.WantedBy = [ "timers.target" ]; + + Timer = { + OnCalendar = cfg.frequency; + Unit = "home-manager-auto-upgrade.service"; + Persistent = true; + }; + }; + + services.home-manager-auto-upgrade = { + Unit.Description = "Home Manager upgrade"; + + Service.ExecStart = toString + (pkgs.writeShellScript "home-manager-auto-upgrade" '' + echo "Update Nix's channels" + ${pkgs.nix}/bin/nix-channel --update + echo "Upgrade Home Manager" + ${homeManagerPackage}/bin/home-manager switch + ''); + }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/imapnotify.nix b/third_party/home-manager/modules/services/imapnotify.nix index d33124522d..0197ec54d6 100644 --- a/third_party/home-manager/modules/services/imapnotify.nix +++ b/third_party/home-manager/modules/services/imapnotify.nix @@ -6,7 +6,7 @@ let cfg = config.services.imapnotify; - safeName = lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; + safeName = lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; imapnotifyAccounts = filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts); @@ -27,7 +27,7 @@ let Type = "simple"; } // optionalAttrs account.notmuch.enable { Environment = - "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc"; + "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; }; Install = { WantedBy = [ "default.target" ]; }; diff --git a/third_party/home-manager/modules/services/kanshi.nix b/third_party/home-manager/modules/services/kanshi.nix index e482e9b8cb..cdef4c7249 100644 --- a/third_party/home-manager/modules/services/kanshi.nix +++ b/third_party/home-manager/modules/services/kanshi.nix @@ -109,7 +109,7 @@ let example = "[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]"; description = '' - Commands executed after the profile is succesfully applied. + Commands executed after the profile is successfully applied. Note that if you provide multiple commands, they will be executed asynchronously with no guaranteed ordering. ''; @@ -128,7 +128,7 @@ let ''; in { - meta.maintainers = [ maintainers.nurelin ]; + meta.maintainers = [ hm.maintainers.nurelin ]; options.services.kanshi = { enable = mkEnableOption diff --git a/third_party/home-manager/modules/services/kdeconnect.nix b/third_party/home-manager/modules/services/kdeconnect.nix index 82de1f0eb7..87c57c4e9b 100644 --- a/third_party/home-manager/modules/services/kdeconnect.nix +++ b/third_party/home-manager/modules/services/kdeconnect.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.kdeconnect; - package = pkgs.kdeconnect; + package = pkgs.plasma5Packages.kdeconnect-kde; in { meta.maintainers = [ maintainers.adisbladis ]; diff --git a/third_party/home-manager/modules/services/lieer.nix b/third_party/home-manager/modules/services/lieer.nix index 6960db4528..e5f3076169 100644 --- a/third_party/home-manager/modules/services/lieer.nix +++ b/third_party/home-manager/modules/services/lieer.nix @@ -27,7 +27,7 @@ let ExecStart = "${config.programs.lieer.package}/bin/gmi sync"; WorkingDirectory = account.maildir.absPath; Environment = - "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc"; + "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; }; }; }; diff --git a/third_party/home-manager/modules/services/lorri.nix b/third_party/home-manager/modules/services/lorri.nix index 0a49cb5454..85b75682f8 100644 --- a/third_party/home-manager/modules/services/lorri.nix +++ b/third_party/home-manager/modules/services/lorri.nix @@ -12,12 +12,22 @@ in { options.services.lorri = { enable = mkEnableOption "lorri build daemon"; + enableNotifications = mkEnableOption "lorri build notifications"; + package = mkOption { type = types.package; default = pkgs.lorri; defaultText = literalExpression "pkgs.lorri"; description = "Which lorri package to install."; }; + + nixPackage = mkOption { + type = types.package; + default = pkgs.nix; + defaultText = literalExpression "pkgs.nix"; + example = literalExpression "pkgs.nixVersions.unstable"; + description = "Which nix package to use."; + }; }; config = mkIf cfg.enable { @@ -45,7 +55,7 @@ in { Restart = "on-failure"; Environment = let path = with pkgs; - makeSearchPath "bin" [ nix gitMinimal gnutar gzip ]; + makeSearchPath "bin" [ cfg.nixPackage gitMinimal gnutar gzip ]; in [ "PATH=${path}" ]; }; }; @@ -60,6 +70,37 @@ in { Install = { WantedBy = [ "sockets.target" ]; }; }; + + services.lorri-notify = mkIf cfg.enableNotifications { + Unit = { + Description = "lorri build notifications"; + After = "lorri.service"; + Requires = "lorri.service"; + }; + + Service = { + ExecStart = let + jqFile = '' + ( + (.Started? | values | "Build starting in \(.nix_file)"), + (.Completed? | values | "Build complete in \(.nix_file)"), + (.Failure? | values | "Build failed in \(.nix_file)") + ) + ''; + + notifyScript = pkgs.writeShellScript "lorri-notify" '' + lorri internal stream-events --kind live \ + | jq --unbuffered '${jqFile}' \ + | xargs -n 1 notify-send "Lorri Build" + ''; + in toString notifyScript; + Restart = "on-failure"; + Environment = let + path = makeSearchPath "bin" + (with pkgs; [ bash jq findutils libnotify cfg.package ]); + in "PATH=${path}"; + }; + }; }; }; } diff --git a/third_party/home-manager/modules/services/mako.nix b/third_party/home-manager/modules/services/mako.nix index 67c11e314f..fc9e21610e 100644 --- a/third_party/home-manager/modules/services/mako.nix +++ b/third_party/home-manager/modules/services/mako.nix @@ -15,6 +15,13 @@ in { Mako, lightweight notification daemon for Wayland ''; + package = mkOption { + type = types.package; + default = pkgs.mako; + defaultText = literalExpression "pkgs.mako"; + description = "The mako package to use."; + }; + maxVisible = mkOption { default = 5; type = types.nullOr types.int; @@ -122,8 +129,8 @@ in { type = types.nullOr types.str; description = '' Set margin of each edge specified in pixels. Specify single value to - apply margin on all sides. Two comma-seperated values will set - vertical and horizontal edges seperately. Four comma-seperated will + apply margin on all sides. Two comma-separated values will set + vertical and horizontal edges separately. Four comma-seperated will give each edge a seperate value. For example: 10,20,5 will set top margin to 10, left and right to 20 and bottom to five. @@ -135,8 +142,8 @@ in { type = types.nullOr types.str; description = '' Set padding of each edge specified in pixels. Specify single value to - apply margin on all sides. Two comma-seperated values will set - vertical and horizontal edges seperately. Four comma-seperated will + apply margin on all sides. Two comma-separated values will set + vertical and horizontal edges separately. Four comma-seperated will give each edge a seperate value. For example: 10,20,5 will set top margin to 10, left and right to 20 and bottom to five. @@ -295,11 +302,11 @@ in { assertions = [ (hm.assertions.assertPlatform "services.mako" pkgs platforms.linux) ]; - home.packages = [ pkgs.mako ]; + home.packages = [ cfg.package ]; xdg.configFile."mako/config" = { onChange = '' - ${pkgs.mako}/bin/makoctl reload || true + ${cfg.package}/bin/makoctl reload || true ''; text = '' ${optionalInteger "max-visible" cfg.maxVisible} diff --git a/third_party/home-manager/modules/services/megasync.nix b/third_party/home-manager/modules/services/megasync.nix new file mode 100644 index 0000000000..c519ba51f0 --- /dev/null +++ b/third_party/home-manager/modules/services/megasync.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.megasync; + +in { + meta.maintainers = [ maintainers.GaetanLepage ]; + + options = { + services.megasync = { + enable = mkEnableOption "Megasync client"; + + package = mkPackageOption pkgs "megasync" { }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.megasync" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.megasync = { + Unit = { + Description = "megasync"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { ExecStart = "${cfg.package}/bin/megasync"; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/mopidy.nix b/third_party/home-manager/modules/services/mopidy.nix new file mode 100644 index 0000000000..f5064c5131 --- /dev/null +++ b/third_party/home-manager/modules/services/mopidy.nix @@ -0,0 +1,152 @@ +{ config, options, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.mopidy; + + # The configuration format of Mopidy. It seems to use configparser with + # some quirky handling of its types. You can see how they're handled in + # `mopidy/config/types.py` from the source code. + toMopidyConf = generators.toINI { + mkKeyValue = generators.mkKeyValueDefault { + mkValueString = v: + if isList v then + "\n " + concatStringsSep "\n " v + else + generators.mkValueStringDefault { } v; + } " = "; + }; + + mopidyEnv = pkgs.buildEnv { + name = "mopidy-with-extensions-${pkgs.mopidy.version}"; + paths = closePropagation cfg.extensionPackages; + pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + makeWrapper ${pkgs.mopidy}/bin/mopidy $out/bin/mopidy \ + --prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages} + ''; + }; + + # Nix-representable format for Mopidy config. + mopidyConfFormat = { }: { + type = with types; + let + valueType = nullOr (oneOf [ bool float int str (listOf valueType) ]) + // { + description = "Mopidy config value"; + }; + in attrsOf (attrsOf valueType); + + generate = name: value: pkgs.writeText name (toMopidyConf value); + }; + + settingsFormat = mopidyConfFormat { }; + + configFilePaths = concatStringsSep ":" + ([ "${config.xdg.configHome}/mopidy/mopidy.conf" ] ++ cfg.extraConfigFiles); + +in { + meta.maintainers = [ hm.maintainers.foo-dogsquared ]; + + options.services.mopidy = { + enable = mkEnableOption "Mopidy music player daemon"; + + extensionPackages = mkOption { + type = with types; listOf package; + default = [ ]; + example = literalExpression + "with pkgs; [ mopidy-spotify mopidy-mpd mopidy-mpris ]"; + description = '' + Mopidy extensions that should be loaded by the service. + ''; + }; + + settings = mkOption { + type = settingsFormat.type; + default = { }; + example = literalExpression '' + { + file = { + media_dirs = [ + "$XDG_MUSIC_DIR|Music" + "~/library|Library" + ]; + follow_symlinks = true; + excluded_file_extensions = [ + ".html" + ".zip" + ".jpg" + ".jpeg" + ".png" + ]; + }; + + # Please don't put your mopidy-spotify configuration in the public. :) + # Think of your Spotify Premium subscription! + spotify = { + client_id = "CLIENT_ID"; + client_secret = "CLIENT_SECRET"; + }; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/mopidy/mopidy.conf. + + See for + more details. + ''; + }; + + extraConfigFiles = mkOption { + default = [ ]; + type = types.listOf types.path; + description = '' + Extra configuration files read by Mopidy when the service starts. + Later files in the list override earlier configuration files and + structured settings. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = + [ (hm.assertions.assertPlatform "services.mopidy" pkgs platforms.linux) ]; + + xdg.configFile."mopidy/mopidy.conf".source = + settingsFormat.generate "mopidy-${config.home.username}" cfg.settings; + + systemd.user.services.mopidy = { + Unit = { + Description = "mopidy music player daemon"; + Documentation = [ "https://mopidy.com/" ]; + After = [ "network.target" "sound.target" ]; + }; + + Service = { + ExecStart = "${mopidyEnv}/bin/mopidy --config ${configFilePaths}"; + }; + + Install.WantedBy = [ "default.target" ]; + }; + + systemd.user.services.mopidy-scan = { + Unit = { + Description = "mopidy local files scanner"; + Documentation = [ "https://mopidy.com/" ]; + After = [ "network.target" "sound.target" ]; + }; + + Service = { + ExecStart = + "${mopidyEnv}/bin/mopidy --config ${configFilePaths} local scan"; + Type = "oneshot"; + }; + + Install.WantedBy = [ "default.target" ]; + }; + }; +} diff --git a/third_party/home-manager/modules/services/mpd-discord-rpc.nix b/third_party/home-manager/modules/services/mpd-discord-rpc.nix new file mode 100644 index 0000000000..5e7a6664b8 --- /dev/null +++ b/third_party/home-manager/modules/services/mpd-discord-rpc.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.mpd-discord-rpc; + tomlFormat = pkgs.formats.toml { }; + configFile = tomlFormat.generate "config.toml" cfg.settings; +in { + meta.maintainers = [ maintainers.kranzes ]; + + options.services.mpd-discord-rpc = { + enable = mkEnableOption "the mpd-discord-rpc service"; + + settings = mkOption { + type = tomlFormat.type; + default = { }; + example = literalExpression '' + { + hosts = [ "localhost:6600" ]; + format = { + details = "$title"; + state = "On $album by $artist"; + }; + } + ''; + description = '' + Configuration included in config.toml. + For available options see + ''; + }; + + package = mkOption { + type = types.package; + default = pkgs.mpd-discord-rpc; + defaultText = literalExpression "pkgs.mpd-discord-rpc"; + description = "mpd-discord-rpc package to use."; + }; + }; + + config = mkIf cfg.enable { + xdg.configFile."discord-rpc/config.toml".source = configFile; + + systemd.user.services.mpd-discord-rpc = { + Unit = { + Description = "Discord Rich Presence for MPD"; + Documentation = "https://github.com/JakeStanger/mpd-discord-rpc"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${cfg.package}/bin/mpd-discord-rpc"; + Restart = "on-failure"; + }; + Install.WantedBy = [ "graphical-session.target" ]; + }; + }; +} diff --git a/third_party/home-manager/modules/services/mpd.nix b/third_party/home-manager/modules/services/mpd.nix index 5800a18c15..6ba93a19da 100644 --- a/third_party/home-manager/modules/services/mpd.nix +++ b/third_party/home-manager/modules/services/mpd.nix @@ -18,9 +18,9 @@ let sticker_file "${cfg.dataDir}/sticker.sql" ${optionalString (cfg.network.listenAddress != "any") - ''bind_to_address "${cfg.network.listenAddress}"''} + ''bind_to_address "${cfg.network.listenAddress}"''} ${optionalString (cfg.network.port != 6600) - ''port "${toString cfg.network.port}"''} + ''port "${toString cfg.network.port}"''} ${cfg.extraConfig} ''; @@ -52,19 +52,26 @@ in { musicDirectory = mkOption { type = with types; either path str; - default = "${config.home.homeDirectory}/music"; - defaultText = "$HOME/music"; - apply = toString; # Prevent copies to Nix store. + defaultText = literalExpression '' + ''${home.homeDirectory}/music if state version < 22.11 + ''${xdg.userDirs.music} if xdg.userDirs.enable == true + undefined otherwise + ''; + apply = toString; # Prevent copies to Nix store. description = '' The directory where mpd reads music from. + + If is + true then the defined XDG music directory is used. + Otherwise, you must explicitly specify a value. ''; }; playlistDirectory = mkOption { type = types.path; default = "${cfg.dataDir}/playlists"; - defaultText = ''''${dataDir}/playlists''; - apply = toString; # Prevent copies to Nix store. + defaultText = "\${dataDir}/playlists"; + apply = toString; # Prevent copies to Nix store. description = '' The directory where mpd stores playlists. ''; @@ -89,7 +96,7 @@ in { type = types.path; default = "${config.xdg.dataHome}/${name}"; defaultText = "$XDG_DATA_HOME/mpd"; - apply = toString; # Prevent copies to Nix store. + apply = toString; # Prevent copies to Nix store. description = '' The directory where MPD stores its state, tag cache, playlists etc. @@ -101,7 +108,7 @@ in { type = types.bool; default = false; description = '' - Enable systemd socket activation. + Enable systemd socket activation. ''; }; @@ -128,7 +135,7 @@ in { dbFile = mkOption { type = types.nullOr types.str; default = "${cfg.dataDir}/tag_cache"; - defaultText = ''''${dataDir}/tag_cache''; + defaultText = "\${dataDir}/tag_cache"; description = '' The path to MPD's database. If set to null the parameter is omitted from the @@ -139,13 +146,22 @@ in { }; - ###### implementation config = mkIf cfg.enable { assertions = [ - (lib.hm.assertions.assertPlatform "services.mpd" pkgs - lib.platforms.linux) + (lib.hm.assertions.assertPlatform "services.mpd" pkgs lib.platforms.linux) + ]; + + services.mpd = mkMerge [ + (mkIf (versionAtLeast config.home.stateVersion "22.11" + && config.xdg.userDirs.enable) { + musicDirectory = mkOptionDefault config.xdg.userDirs.music; + }) + + (mkIf (versionOlder config.home.stateVersion "22.11") { + musicDirectory = mkOptionDefault "${config.home.homeDirectory}/music"; + }) ]; systemd.user.services.mpd = { @@ -162,26 +178,28 @@ in { Environment = "PATH=${config.home.profileDirectory}/bin"; ExecStart = "${cfg.package}/bin/mpd --no-daemon ${mpdConf}"; Type = "notify"; - ExecStartPre = ''${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"''; + ExecStartPre = '' + ${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"''; }; }; + systemd.user.sockets.mpd = mkIf cfg.network.startWhenNeeded { Socket = { ListenStream = let - listen = - if cfg.network.listenAddress == "any" - then toString cfg.network.port - else "${cfg.network.listenAddress}:${toString cfg.network.port}"; + listen = if cfg.network.listenAddress == "any" then + toString cfg.network.port + else + "${cfg.network.listenAddress}:${toString cfg.network.port}"; in [ listen "%t/mpd/socket" ]; Backlog = 5; KeepAlive = true; }; - Install = { - WantedBy = [ "sockets.target" ]; - }; + Install = { WantedBy = [ "sockets.target" ]; }; }; + + home.packages = [ cfg.package ]; }; } diff --git a/third_party/home-manager/modules/services/mpdris2.nix b/third_party/home-manager/modules/services/mpdris2.nix index bf9b783b3b..79f2709fc5 100644 --- a/third_party/home-manager/modules/services/mpdris2.nix +++ b/third_party/home-manager/modules/services/mpdris2.nix @@ -21,6 +21,8 @@ let host = cfg.mpd.host; port = cfg.mpd.port; music_dir = cfg.mpd.musicDirectory; + } // optionalAttrs (cfg.mpd.password != null) { + password = cfg.mpd.password; }; Bling = { @@ -70,6 +72,14 @@ in { If set, mpDris2 will use this directory to access music artwork. ''; }; + + password = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The password to connect to MPD. + ''; + }; }; }; @@ -77,11 +87,6 @@ in { assertions = [ (lib.hm.assertions.assertPlatform "services.mpdris2" pkgs lib.platforms.linux) - - { - assertion = config.services.mpd.enable; - message = "The mpdris2 module requires 'services.mpd.enable = true'."; - } ]; xdg.configFile."mpDris2/mpDris2.conf".text = toIni mpdris2Conf; diff --git a/third_party/home-manager/modules/services/opensnitch-ui.nix b/third_party/home-manager/modules/services/opensnitch-ui.nix new file mode 100644 index 0000000000..a086554cad --- /dev/null +++ b/third_party/home-manager/modules/services/opensnitch-ui.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.opensnitch-ui; + +in { + + meta.maintainers = [ maintainers.onny ]; + + options = { + services.opensnitch-ui = { enable = mkEnableOption "Opensnitch client"; }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.opensnitch-ui" pkgs + lib.platforms.linux) + ]; + + systemd.user.services.opensnitch-ui = { + Unit = { + Description = "Opensnitch ui"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + Environment = "PATH=${config.home.profileDirectory}/bin"; + ExecStart = "${pkgs.opensnitch-ui}/bin/opensnitch-ui"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/parcellite.nix b/third_party/home-manager/modules/services/parcellite.nix index 6ed9946b4d..39b81e8699 100644 --- a/third_party/home-manager/modules/services/parcellite.nix +++ b/third_party/home-manager/modules/services/parcellite.nix @@ -12,6 +12,15 @@ in { options.services.parcellite = { enable = mkEnableOption "Parcellite"; + extraOptions = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "--no-icon" ]; + description = '' + Command line arguments passed to Parcellite. + ''; + }; + package = mkOption { type = types.package; default = pkgs.parcellite; @@ -40,7 +49,9 @@ in { Install = { WantedBy = [ "graphical-session.target" ]; }; Service = { - ExecStart = "${cfg.package}/bin/${cfg.package.pname}"; + ExecStart = "${cfg.package}/bin/${cfg.package.pname} ${ + escapeShellArgs cfg.extraOptions + }"; Restart = "on-abort"; }; }; diff --git a/third_party/home-manager/modules/services/pasystray.nix b/third_party/home-manager/modules/services/pasystray.nix index d41d6c9347..15c951e137 100644 --- a/third_party/home-manager/modules/services/pasystray.nix +++ b/third_party/home-manager/modules/services/pasystray.nix @@ -3,7 +3,7 @@ with lib; { - meta.maintainers = [ maintainers.pltanton ]; + meta.maintainers = [ hm.maintainers.pltanton ]; options = { services.pasystray = { enable = mkEnableOption "PulseAudio system tray"; }; diff --git a/third_party/home-manager/modules/services/picom.nix b/third_party/home-manager/modules/services/picom.nix index 280a2a21ed..f4f8edb430 100644 --- a/third_party/home-manager/modules/services/picom.nix +++ b/third_party/home-manager/modules/services/picom.nix @@ -1,90 +1,73 @@ -{ config, lib, pkgs, ... }: - -with lib; -with builtins; +{ config, options, lib, pkgs, ... }: let + inherit (builtins) elemAt isAttrs isBool length mapAttrs toJSON; + inherit (lib) + boolToString concatMapStringsSep concatStringsSep escape literalExpression + mapAttrsToList mkEnableOption mkRenamedOptionModule mkRemovedOptionModule + mkDefault mkIf mkOption optional types warn; cfg = config.services.picom; + opt = options.services.picom; - configFile = pkgs.writeText "picom.conf" (optionalString cfg.fade '' - # fading - fading = true; - fade-delta = ${toString cfg.fadeDelta}; - fade-in-step = ${elemAt cfg.fadeSteps 0}; - fade-out-step = ${elemAt cfg.fadeSteps 1}; - fade-exclude = ${toJSON cfg.fadeExclude}; - '' + optionalString cfg.shadow '' - - # shadows - shadow = true; - shadow-offset-x = ${toString (elemAt cfg.shadowOffsets 0)}; - shadow-offset-y = ${toString (elemAt cfg.shadowOffsets 1)}; - shadow-opacity = ${cfg.shadowOpacity}; - shadow-exclude = ${toJSON cfg.shadowExclude}; - '' + optionalString cfg.blur '' - - # blur - blur-background = true; - blur-background-exclude = ${toJSON cfg.blurExclude}; - '' + '' - - # opacity - active-opacity = ${cfg.activeOpacity}; - inactive-opacity = ${cfg.inactiveOpacity}; - inactive-dim = ${cfg.inactiveDim}; - opacity-rule = ${toJSON cfg.opacityRule}; - - wintypes: - { - dock = { shadow = ${toJSON (!cfg.noDockShadow)}; }; - dnd = { shadow = ${toJSON (!cfg.noDNDShadow)}; }; - popup_menu = { opacity = ${cfg.menuOpacity}; }; - dropdown_menu = { opacity = ${cfg.menuOpacity}; }; + pairOf = x: + with types; + addCheck (listOf x) (y: length y == 2) // { + description = "pair of ${x.description}"; }; - # other options - backend = ${toJSON cfg.backend}; - vsync = ${toJSON cfg.vSync}; - refresh-rate = ${toString cfg.refreshRate}; - '' + cfg.extraOptions); + mkDefaultAttrs = mapAttrs (n: v: mkDefault v); + + # Basically a tinkered lib.generators.mkKeyValueDefault + # It either serializes a top-level definition "key: { values };" + # or an expression "key = { values };" + mkAttrsString = top: + mapAttrsToList (k: v: + let sep = if (top && isAttrs v) then ": " else " = "; + in "${escape [ sep ] k}${sep}${mkValueString v};"); + + # This serializes a Nix expression to the libconfig format. + mkValueString = v: + if types.bool.check v then + boolToString v + else if types.int.check v then + toString v + else if types.float.check v then + toString v + else if types.str.check v then + ''"${escape [ ''"'' ] v}"'' + else if builtins.isList v then + "[ ${concatMapStringsSep " , " mkValueString v} ]" + else if types.attrs.check v then + "{ ${concatStringsSep " " (mkAttrsString false v)} }" + else + throw '' + invalid expression used in option services.picom.settings: + ${v} + ''; + + toConf = attrs: concatStringsSep "\n" (mkAttrsString true cfg.settings); + + configFile = toConf cfg.settings; in { + imports = [ + (mkRemovedOptionModule [ "services" "picom" "refreshRate" ] + "The option `refresh-rate` has been deprecated by upstream.") + (mkRemovedOptionModule [ "services" "picom" "experimentalBackends" ] + "The option `--experimental-backends` has been removed by upstream.") + (mkRemovedOptionModule [ "services" "picom" "extraOptions" ] + "This option has been replaced by `services.picom.settings`.") + (mkRenamedOptionModule [ "services" "picom" "opacityRule" ] [ + "services" + "picom" + "opacityRules" + ]) + ]; options.services.picom = { enable = mkEnableOption "Picom X11 compositor"; - blur = mkOption { - type = types.bool; - default = false; - description = '' - Enable background blur on transparent windows. - ''; - }; - - blurExclude = mkOption { - type = types.listOf types.str; - default = [ ]; - example = [ "class_g = 'slop'" "class_i = 'polybar'" ]; - description = '' - List of windows to exclude background blur. - See the - - picom - 1 - - man page for more examples. - ''; - }; - - experimentalBackends = mkOption { - type = types.bool; - default = false; - description = '' - Whether to use the new experimental backends. - ''; - }; - fade = mkOption { type = types.bool; default = false; @@ -94,7 +77,7 @@ in { }; fadeDelta = mkOption { - type = types.int; + type = types.ints.positive; default = 10; example = 5; description = '' @@ -103,9 +86,9 @@ in { }; fadeSteps = mkOption { - type = types.listOf types.str; - default = [ "0.028" "0.03" ]; - example = [ "0.04" "0.04" ]; + type = pairOf (types.numbers.between 1.0e-2 1); + default = [ 2.8e-2 3.0e-2 ]; + example = [ 4.0e-2 4.0e-2 ]; description = '' Opacity change between fade steps (in and out). ''; @@ -117,12 +100,7 @@ in { example = [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ]; description = '' List of conditions of windows that should not be faded. - See the - - picom - 1 - - man page for more examples. + See picom(1) man page for more examples. ''; }; @@ -135,20 +113,20 @@ in { }; shadowOffsets = mkOption { - type = types.listOf types.int; + type = pairOf types.int; default = [ (-15) (-15) ]; example = [ (-10) (-15) ]; description = '' - Horizontal and vertical offsets for shadows (in pixels). + Left and right offset for shadows (in pixels). ''; }; shadowOpacity = mkOption { - type = types.str; - default = "0.75"; - example = "0.8"; + type = types.numbers.between 0 1; + default = 0.75; + example = 0.8; description = '' - Window shadows opacity (number in range 0 - 1). + Window shadows opacity. ''; }; @@ -158,87 +136,72 @@ in { example = [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ]; description = '' List of conditions of windows that should have no shadow. - See the - - picom - 1 - - man page for more examples. - ''; - }; - - noDockShadow = mkOption { - type = types.bool; - default = true; - description = '' - Avoid shadow on docks. - ''; - }; - - noDNDShadow = mkOption { - type = types.bool; - default = true; - description = '' - Avoid shadow on drag-and-drop windows. + See picom(1) man page for more examples. ''; }; activeOpacity = mkOption { - type = types.str; - default = "1.0"; - example = "0.8"; + type = types.numbers.between 0 1; + default = 1.0; + example = 0.8; description = '' Opacity of active windows. ''; }; - inactiveDim = mkOption { - type = types.str; - default = "0.0"; - example = "0.2"; - description = '' - Dim inactive windows. - ''; - }; - inactiveOpacity = mkOption { - type = types.str; - default = "1.0"; - example = "0.8"; + type = types.numbers.between 0.1 1; + default = 1.0; + example = 0.8; description = '' Opacity of inactive windows. ''; }; menuOpacity = mkOption { - type = types.str; - default = "1.0"; - example = "0.8"; + type = types.numbers.between 0 1; + default = 1.0; + example = 0.8; description = '' Opacity of dropdown and popup menu. ''; }; - opacityRule = mkOption { + wintypes = mkOption { + type = types.attrs; + default = { + popup_menu = { opacity = cfg.menuOpacity; }; + dropdown_menu = { opacity = cfg.menuOpacity; }; + }; + defaultText = literalExpression '' + { + popup_menu = { opacity = config.${opt.menuOpacity}; }; + dropdown_menu = { opacity = config.${opt.menuOpacity}; }; + } + ''; + example = { }; + description = '' + Rules for specific window types. + ''; + }; + + opacityRules = mkOption { type = types.listOf types.str; default = [ ]; - example = [ "87:class_i ?= 'scratchpad'" "91:class_i ?= 'xterm'" ]; + example = [ + "95:class_g = 'URxvt' && !_NET_WM_STATE@:32a" + "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" + ]; description = '' - List of opacity rules. - See the - - picom - 1 - - man page for more examples. + Rules that control the opacity of windows, in format PERCENT:PATTERN. ''; }; backend = mkOption { - type = types.str; - default = "glx"; + type = types.enum [ "egl" "glx" "xrender" "xr_glx_hybrid" ]; + default = "xrender"; description = '' - Backend to use: glx or xrender. + Backend to use: egl, glx, xrender or xr_glx_hybrid. ''; }; @@ -250,12 +213,12 @@ in { ''; }; - refreshRate = mkOption { - type = types.int; - default = 0; - example = 60; + extraArgs = mkOption { + type = with types; listOf str; + default = [ ]; + example = literalExpression ''[ "--legacy-backends" ]''; description = '' - Screen refresh rate (0 = automatically detect). + Extra arguments to be passed to the picom executable. ''; }; @@ -265,31 +228,80 @@ in { defaultText = literalExpression "pkgs.picom"; example = literalExpression "pkgs.picom"; description = '' - picom derivation to use. + Picom derivation to use. ''; }; - extraOptions = mkOption { - type = types.str; - default = ""; - example = '' - unredir-if-possible = true; - dbe = true; - ''; - description = '' - Additional Picom configuration. - ''; - }; + settings = with types; + let + scalar = oneOf [ bool int float str ] // { + description = "scalar types"; + }; + + libConfig = oneOf [ scalar (listOf libConfig) (attrsOf libConfig) ] // { + description = "libconfig type"; + }; + + topLevel = attrsOf libConfig // { + description = '' + libconfig configuration. The format consists of an attributes + set (called a group) of settings. Each setting can be a scalar type + (boolean, integer, floating point number or string), a list of + scalars or a group itself + ''; + }; + + in mkOption { + type = topLevel; + default = { }; + example = literalExpression '' + blur = + { method = "gaussian"; + size = 10; + deviation = 5.0; + }; + ''; + description = '' + Picom settings. Use this option to configure Picom settings not exposed + in a NixOS option or to bypass one. For the available options see the + CONFIGURATION FILES section at picom(1). + ''; + }; }; config = mkIf cfg.enable { - assertions = [ - (lib.hm.assertions.assertPlatform "services.picom" pkgs - lib.platforms.linux) - ]; + services.picom.settings = mkDefaultAttrs { + # fading + fading = cfg.fade; + fade-delta = cfg.fadeDelta; + fade-in-step = elemAt cfg.fadeSteps 0; + fade-out-step = elemAt cfg.fadeSteps 1; + fade-exclude = cfg.fadeExclude; + + # shadows + shadow = cfg.shadow; + shadow-offset-x = elemAt cfg.shadowOffsets 0; + shadow-offset-y = elemAt cfg.shadowOffsets 1; + shadow-opacity = cfg.shadowOpacity; + shadow-exclude = cfg.shadowExclude; + + # opacity + active-opacity = cfg.activeOpacity; + inactive-opacity = cfg.inactiveOpacity; + + wintypes = cfg.wintypes; + + opacity-rule = cfg.opacityRules; + + # other options + backend = cfg.backend; + vsync = cfg.vSync; + }; home.packages = [ cfg.package ]; + xdg.configFile."picom/picom.conf".text = configFile; + systemd.user.services.picom = { Unit = { Description = "Picom X11 compositor"; @@ -299,18 +311,16 @@ in { Install = { WantedBy = [ "graphical-session.target" ]; }; - Service = let - experimentalBackendsFlag = - if cfg.experimentalBackends then " --experimental-backends" else ""; - in { - ExecStart = "${cfg.package}/bin/picom --config ${configFile}" - + experimentalBackendsFlag; + Service = { + ExecStart = concatStringsSep " " ([ + "${cfg.package}/bin/picom" + "--config ${config.xdg.configFile."picom/picom.conf".source}" + ] ++ cfg.extraArgs); Restart = "always"; RestartSec = 3; - } // optionalAttrs (cfg.backend == "glx") { - # Temporarily fixes corrupt colours with Mesa 18. - Environment = [ "allow_rgb10_configs=false" ]; }; }; }; + + meta.maintainers = with lib.maintainers; [ thiagokokada ]; } diff --git a/third_party/home-manager/modules/services/playerctld.nix b/third_party/home-manager/modules/services/playerctld.nix index dccc1ecc00..5fed8f2b43 100644 --- a/third_party/home-manager/modules/services/playerctld.nix +++ b/third_party/home-manager/modules/services/playerctld.nix @@ -7,7 +7,7 @@ let cfg = config.services.playerctld; in { - meta.maintainers = [ maintainers.fendse ]; + meta.maintainers = [ hm.maintainers.fendse ]; options.services.playerctld = { enable = mkEnableOption "playerctld daemon"; diff --git a/third_party/home-manager/modules/services/plex-mpv-shim.nix b/third_party/home-manager/modules/services/plex-mpv-shim.nix new file mode 100644 index 0000000000..b5fb621838 --- /dev/null +++ b/third_party/home-manager/modules/services/plex-mpv-shim.nix @@ -0,0 +1,70 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + jsonFormat = pkgs.formats.json { }; + cfg = config.services.plex-mpv-shim; + +in { + meta.maintainers = [ maintainers.starcraft66 ]; + + options = { + services.plex-mpv-shim = { + enable = mkEnableOption "Plex mpv shim"; + + package = mkOption { + type = types.package; + default = pkgs.plex-mpv-shim; + defaultText = literalExpression "pkgs.plex-mpv-shim"; + description = "The package to use for the Plex mpv shim."; + }; + + settings = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + { + adaptive_transcode = false; + allow_http = false; + always_transcode = false; + audio_ac3passthrough = false; + audio_dtspassthrough = false; + auto_play = true; + auto_transcode = true; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/plex-mpv-shim/config.json. See + + for the configuration documentation. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.plex-mpv-shim" pkgs + lib.platforms.linux) + ]; + + xdg.configFile."plex-mpv-shim/conf.json" = mkIf (cfg.settings != { }) { + source = jsonFormat.generate "conf.json" cfg.settings; + }; + + systemd.user.services.plex-mpv-shim = { + Unit = { + Description = "Plex mpv shim"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { ExecStart = "${cfg.package}/bin/plex-mpv-shim"; }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/polybar.nix b/third_party/home-manager/modules/services/polybar.nix index 7912d8988f..d3ac68ded8 100644 --- a/third_party/home-manager/modules/services/polybar.nix +++ b/third_party/home-manager/modules/services/polybar.nix @@ -1,10 +1,11 @@ -{ config, lib, pkgs, ... }: +{ config, options, lib, pkgs, ... }: with lib; let cfg = config.services.polybar; + opt = options.services.polybar; eitherStrBoolIntList = with types; either str (either bool (either int (listOf str))); @@ -54,11 +55,17 @@ let in "${key}=${value'}"; }; - configFile = pkgs.writeText "polybar.conf" '' - ${toPolybarIni cfg.config} - ${toPolybarIni (mapAttrs convertPolybarSection cfg.settings)} - ${cfg.extraConfig} - ''; + configFile = let + isDeclarativeConfig = cfg.settings != opt.settings.default || cfg.config + != opt.config.default || cfg.extraConfig != opt.extraConfig.default; + in if isDeclarativeConfig then + pkgs.writeText "polybar.conf" '' + ${toPolybarIni cfg.config} + ${toPolybarIni (mapAttrs convertPolybarSection cfg.settings)} + ${cfg.extraConfig} + '' + else + null; in { options = { @@ -198,15 +205,17 @@ in { lib.platforms.linux) ]; + meta.maintainers = with maintainers; [ h7x4 ]; + home.packages = [ cfg.package ]; - xdg.configFile."polybar/config".source = configFile; + xdg.configFile."polybar/config.ini" = + mkIf (configFile != null) { source = configFile; }; systemd.user.services.polybar = { Unit = { Description = "Polybar status bar"; PartOf = [ "tray.target" ]; - X-Restart-Triggers = - [ "${config.xdg.configFile."polybar/config".source}" ]; + X-Restart-Triggers = mkIf (configFile != null) "${configFile}"; }; Service = { diff --git a/third_party/home-manager/modules/services/poweralertd.nix b/third_party/home-manager/modules/services/poweralertd.nix index cae44c753c..bc02dead39 100644 --- a/third_party/home-manager/modules/services/poweralertd.nix +++ b/third_party/home-manager/modules/services/poweralertd.nix @@ -8,7 +8,7 @@ in { meta.maintainers = [ maintainers.thibautmarty ]; options.services.poweralertd.enable = - mkEnableOption "the Upower-powered power alerterd"; + mkEnableOption "the Upower-powered power alertd"; config = mkIf cfg.enable { assertions = [ diff --git a/third_party/home-manager/modules/services/pueue.nix b/third_party/home-manager/modules/services/pueue.nix new file mode 100644 index 0000000000..3375f49d76 --- /dev/null +++ b/third_party/home-manager/modules/services/pueue.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.pueue; + yamlFormat = pkgs.formats.yaml { }; + configFile = yamlFormat.generate "pueue.yaml" cfg.settings; + +in { + meta.maintainers = [ maintainers.AndersonTorres ]; + + options.services.pueue = { + enable = mkEnableOption "Pueue, CLI process scheduler and manager"; + + package = mkPackageOption pkgs "pueue" { }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = literalExpression '' + { + daemon = { + default_parallel_tasks = 2; + }; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/pueue/pueue.yml. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = + [ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ]; + + home.packages = [ cfg.package ]; + + xdg.configFile = + mkIf (cfg.settings != { }) { "pueue/pueue.yml".source = configFile; }; + + systemd.user = { + services.pueued = { + Unit = { + Description = "Pueue Daemon - CLI process scheduler and manager"; + }; + + Service = { + Restart = "on-failure"; + ExecStart = "${cfg.package}/bin/pueued -v -c ${configFile}"; + }; + + Install.WantedBy = [ "default.target" ]; + }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/recoll.nix b/third_party/home-manager/modules/services/recoll.nix new file mode 100644 index 0000000000..644b011846 --- /dev/null +++ b/third_party/home-manager/modules/services/recoll.nix @@ -0,0 +1,192 @@ +{ config, options, lib, pkgs, ... }: + +with lib; + +# TODO: Fix the formatting of the resulting config. +let + cfg = config.services.recoll; + + # The key-value generator for Recoll config format. For future references, + # see the example configuration from the package (i.e., + # `$out/share/recoll/examples/recoll.conf`). + mkRecollConfKeyValue = generators.mkKeyValueDefault { + mkValueString = v: + if v == true then + "1" + else if v == false then + "0" + else if isList v then + concatStringsSep " " v + else + generators.mkValueStringDefault { } v; + } " = "; + + # A modified version of 'lib.generators.toINI' that also accepts top-level + # attributes as non-attrsets. + toRecollConf = { listsAsDuplicateKeys ? false }: + attr: + let + toKeyValue = generators.toKeyValue { + inherit listsAsDuplicateKeys; + mkKeyValue = mkRecollConfKeyValue; + }; + mkSectionName = name: strings.escape [ "[" "]" ] name; + convert = k: v: + if isAttrs v then + '' + [${mkSectionName k}] + '' + toKeyValue v + else + toKeyValue { "${k}" = v; }; + + # TODO: Improve this chunk of code, pls. + # There's a possibility of attributes with attrsets overriding other + # top-level attributes with non-attrsets so we're forcing the attrsets to + # come last. + _config = mapAttrsToList convert (filterAttrs (k: v: !isAttrs v) attr); + _config' = mapAttrsToList convert (filterAttrs (k: v: isAttrs v) attr); + config = _config ++ _config'; + in concatStringsSep "\n" config; + + # A specific type for Recoll config format. Taken from `pkgs.formats` + # implementation from nixpkgs. See the 'Nix-representable formats' from the + # NixOS manual for more information. + recollConfFormat = { }: { + type = with types; + let + valueType = nullOr (oneOf [ + bool + float + int + path + str + (attrsOf valueType) + (listOf valueType) + ]) // { + description = "Recoll config value"; + }; + in attrsOf valueType; + + generate = name: value: pkgs.writeText name (toRecollConf { } value); + }; + + # The actual object we're going to use for this module. This is for the sake + # of consistency (and dogfooding the settings format implementation). + settingsFormat = recollConfFormat { }; +in { + meta.maintainers = [ maintainers.foo-dogsquared ]; + + options.services.recoll = { + enable = mkEnableOption "Recoll file index service"; + + package = mkOption { + type = types.package; + default = pkgs.recoll; + defaultText = literalExpression "pkgs.recoll"; + description = '' + Package providing the recoll binary. + ''; + example = literalExpression "(pkgs.recoll.override { withGui = false; })"; + }; + + startAt = mkOption { + type = types.str; + default = "hourly"; + example = "00/2:00"; + description = '' + When or how often the periodic update should run. Must be the format + described from + + systemd.time + 7 + . + ''; + }; + + settings = mkOption { + type = settingsFormat.type; + default = { }; + description = '' + The configuration to be written at + ''${config.services.recoll.configDir}/recoll.conf. + + See + + recoll + 5 + for more details about the configuration. + ''; + example = literalExpression '' + { + nocjk = true; + loglevel = 5; + topdirs = [ "~/Downloads" "~/Documents" "~/projects" ]; + + "~/Downloads" = { + "skippedNames+" = [ "*.iso" ]; + }; + + "~/projects" = { + "skippedNames+" = [ "node_modules" "target" "result" ]; + }; + } + ''; + }; + + configDir = mkOption { + type = types.str; + default = "${config.home.homeDirectory}/.recoll"; + defaultText = literalExpression "\${config.home.homeDirectory}/.recoll"; + example = literalExpression "\${config.xdg.configHome}/recoll"; + description = '' + The directory to contain Recoll configuration files. This will be set + as RECOLL_CONFDIR. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.recoll" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + home.sessionVariables = { RECOLL_CONFDIR = cfg.configDir; }; + + home.file."${cfg.configDir}/recoll.conf".source = + settingsFormat.generate "recoll-conf-${config.home.username}" + cfg.settings; + + systemd.user.services.recollindex = { + Unit = { + Description = "Recoll index update"; + Documentation = [ + "man:recoll" + "man:recollindex" + "https://www.lesbonscomptes.com/recoll/usermanual/" + ]; + }; + + Service = { + ExecStart = "${cfg.package}/bin/recollindex"; + Environment = [ "RECOLL_CONFDIR=${escapeShellArg cfg.configDir}" ]; + }; + }; + + systemd.user.timers.recollindex = { + Unit = { + Description = "Recoll index update"; + PartOf = [ "default.target" ]; + }; + + Timer = { + Persistent = true; + OnCalendar = cfg.startAt; + }; + + Install.WantedBy = [ "timers.target" ]; + }; + }; +} diff --git a/third_party/home-manager/modules/services/redshift-gammastep/lib/options.nix b/third_party/home-manager/modules/services/redshift-gammastep/lib/options.nix index 475cca57c3..4c9d68ab31 100644 --- a/third_party/home-manager/modules/services/redshift-gammastep/lib/options.nix +++ b/third_party/home-manager/modules/services/redshift-gammastep/lib/options.nix @@ -10,9 +10,7 @@ let settingsFormat = pkgs.formats.ini { }; in { - meta = { - maintainers = with maintainers; [ rycee petabyteboy thiagokokada ]; - }; + meta.maintainers = with maintainers; [ rycee thiagokokada ]; imports = let mkRenamed = old: new: @@ -112,6 +110,8 @@ in { ''; }; + enableVerboseLogging = mkEnableOption "verbose service logging"; + tray = mkOption { type = types.bool; default = false; @@ -184,10 +184,14 @@ in { settingsFormat.generate xdgConfigFilePath cfg.settings; systemd.user.services.${moduleName} = { - Unit = { + Unit = let + geoclueAgentService = + lib.optional (cfg.provider == "geoclue2") "geoclue-agent.service"; + in { Description = "${programName} colour temperature adjuster"; Documentation = serviceDocumentation; - After = [ "graphical-session-pre.target" ]; + After = [ "graphical-session-pre.target" ] ++ geoclueAgentService; + Wants = geoclueAgentService; PartOf = [ "graphical-session.target" ]; }; @@ -197,7 +201,10 @@ in { ExecStart = let command = if cfg.tray then appletExecutable else mainExecutable; configFullPath = config.xdg.configHome + "/${xdgConfigFilePath}"; - in "${cfg.package}/bin/${command} -v -c ${configFullPath}"; + in "${cfg.package}/bin/${command} " + cli.toGNUCommandLineShell { } { + v = cfg.enableVerboseLogging; + c = configFullPath; + }; RestartSec = 3; Restart = "on-failure"; }; diff --git a/third_party/home-manager/modules/services/safeeyes.nix b/third_party/home-manager/modules/services/safeeyes.nix new file mode 100644 index 0000000000..156624691f --- /dev/null +++ b/third_party/home-manager/modules/services/safeeyes.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.safeeyes; + +in { + meta.maintainers = [ hm.maintainers.rosuavio ]; + + options = { + services.safeeyes = { + enable = mkEnableOption "The Safe Eyes OSGI service"; + + package = mkPackageOption pkgs "safeeyes" { }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "services.safeeyes" pkgs platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.safeeyes = { + Install.WantedBy = [ "graphical-session.target" ]; + + Unit = { + Description = "Safe Eyes"; + PartOf = [ "graphical-session.target" ]; + StartLimitIntervalSec = 350; + StartLimitBurst = 30; + }; + + Service = { + ExecStart = getExe pkgs.safeeyes; + Restart = "on-failure"; + RestartSec = 3; + }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/screen-locker.nix b/third_party/home-manager/modules/services/screen-locker.nix index 34794d1c14..155896cd3b 100644 --- a/third_party/home-manager/modules/services/screen-locker.nix +++ b/third_party/home-manager/modules/services/screen-locker.nix @@ -94,6 +94,16 @@ in { Extra command-line arguments to pass to xss-lock. ''; }; + + screensaverCycle = mkOption { + type = types.int; + default = 600; + description = '' + The X server's screensaver cycle value expressed as seconds. + This will be used with xset to configure + the cycle along with timeout. + ''; + }; }; }; @@ -122,7 +132,9 @@ in { } (mkIf (!cfg.xautolock.enable) { systemd.user.services.xss-lock.Service.ExecStartPre = - "${pkgs.xorg.xset}/bin/xset s ${toString (cfg.inactiveInterval * 60)}"; + "${pkgs.xorg.xset}/bin/xset s ${toString (cfg.inactiveInterval * 60)} ${ + toString cfg.xss-lock.screensaverCycle + }"; }) (mkIf cfg.xautolock.enable { systemd.user.services.xautolock-session = { diff --git a/third_party/home-manager/modules/services/sctd.nix b/third_party/home-manager/modules/services/sctd.nix new file mode 100644 index 0000000000..54cf53e45e --- /dev/null +++ b/third_party/home-manager/modules/services/sctd.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + meta.maintainers = [ maintainers.somasis ]; + + options = { + services.sctd = { + enable = mkEnableOption "sctd"; + + baseTemperature = mkOption { + type = types.ints.between 2500 9000; + default = 4500; + description = '' + The base color temperature used by sctd, which should be between 2500 and 9000. + See + + sctd + 1 + + for more details. + ''; + }; + }; + }; + + config = mkIf config.services.sctd.enable { + assertions = + [ (hm.assertions.assertPlatform "services.sctd" pkgs platforms.linux) ]; + + systemd.user.services.sctd = { + Unit = { + Description = + "Dynamically adjust the screen color temperature twice every minute"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + + Service = { + ExecStart = "${pkgs.sct}/bin/sctd ${ + toString config.services.sctd.baseTemperature + }"; + ExecStopPost = "${pkgs.sct}/bin/sct"; + Restart = "on-abnormal"; + SuccessExitStatus = 1; + + Environment = let + # HACK: Remove duplicate messages in the journal; `sctd` calls + # both `logger -s` (which outputs the message to stderr) + # *and* outputs to stderr itself. We can at least silence + # `logger`'s output without hiding sctd's own stderr. + logger = pkgs.writeShellScriptBin "logger" '' + exec 2>/dev/null + exec ${pkgs.util-linux}/bin/logger "$@" + ''; + in [ + "PATH=${ + lib.makeBinPath [ + pkgs.bash + pkgs.coreutils + pkgs.gnused + pkgs.which + pkgs.sct + logger + ] + }" + ]; + }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/status-notifier-watcher.nix b/third_party/home-manager/modules/services/status-notifier-watcher.nix index 8de09d7ddb..c6fe08da6d 100644 --- a/third_party/home-manager/modules/services/status-notifier-watcher.nix +++ b/third_party/home-manager/modules/services/status-notifier-watcher.nix @@ -7,7 +7,7 @@ let cfg = config.services.status-notifier-watcher; in { - meta.maintainers = [ maintainers.pltanton ]; + meta.maintainers = [ hm.maintainers.pltanton ]; options = { services.status-notifier-watcher = { diff --git a/third_party/home-manager/modules/services/swayidle.nix b/third_party/home-manager/modules/services/swayidle.nix new file mode 100644 index 0000000000..db54f9e27f --- /dev/null +++ b/third_party/home-manager/modules/services/swayidle.nix @@ -0,0 +1,129 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.swayidle; + + mkTimeout = t: + [ "timeout" (toString t.timeout) (escapeShellArg t.command) ] + ++ optionals (t.resumeCommand != null) [ + "resume" + (escapeShellArg t.resumeCommand) + ]; + + mkEvent = e: [ e.event (escapeShellArg e.command) ]; + + args = cfg.extraArgs ++ (concatMap mkTimeout cfg.timeouts) + ++ (concatMap mkEvent cfg.events); + +in { + meta.maintainers = [ maintainers.c0deaddict ]; + + options.services.swayidle = let + + timeoutModule = { ... }: { + options = { + timeout = mkOption { + type = types.ints.positive; + example = 60; + description = "Timeout in seconds."; + }; + + command = mkOption { + type = types.str; + description = "Command to run after timeout seconds of inactivity."; + }; + + resumeCommand = mkOption { + type = with types; nullOr str; + default = null; + description = "Command to run when there is activity again."; + }; + }; + }; + + eventModule = { ... }: { + options = { + event = mkOption { + type = types.enum [ "before-sleep" "after-resume" "lock" "unlock" ]; + description = "Event name."; + }; + + command = mkOption { + type = types.str; + description = "Command to run when event occurs."; + }; + }; + }; + + in { + enable = mkEnableOption "idle manager for Wayland"; + + package = mkOption { + type = types.package; + default = pkgs.swayidle; + defaultText = literalExpression "pkgs.swayidle"; + description = "Swayidle package to install."; + }; + + timeouts = mkOption { + type = with types; listOf (submodule timeoutModule); + default = [ ]; + example = literalExpression '' + [ + { timeout = 60; command = "${pkgs.swaylock}/bin/swaylock -fF"; } + ] + ''; + description = "List of commands to run after idle timeout."; + }; + + events = mkOption { + type = with types; listOf (submodule eventModule); + default = [ ]; + example = literalExpression '' + [ + { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; } + { event = "lock"; command = "lock"; } + ] + ''; + description = "Run command on occurrence of a event."; + }; + + extraArgs = mkOption { + type = with types; listOf str; + default = [ ]; + description = "Extra arguments to pass to swayidle."; + }; + + systemdTarget = mkOption { + type = types.str; + default = "sway-session.target"; + description = '' + Systemd target to bind to. + ''; + }; + + }; + + config = mkIf cfg.enable { + systemd.user.services.swayidle = { + Unit = { + Description = "Idle manager for Wayland"; + Documentation = "man:swayidle(1)"; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + Type = "simple"; + # swayidle executes commands using "sh -c", so the PATH needs to contain a shell. + Environment = [ "PATH=${makeBinPath [ pkgs.bash ]}" ]; + ExecStart = + "${cfg.package}/bin/swayidle -w ${concatStringsSep " " args}"; + }; + + Install = { WantedBy = [ cfg.systemdTarget ]; }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/syncthing.nix b/third_party/home-manager/modules/services/syncthing.nix index d2f7f2964e..2f9cecdb4f 100644 --- a/third_party/home-manager/modules/services/syncthing.nix +++ b/third_party/home-manager/modules/services/syncthing.nix @@ -2,13 +2,26 @@ with lib; -{ +let + + cfg = config.services.syncthing; + +in { meta.maintainers = [ maintainers.rycee ]; options = { services.syncthing = { enable = mkEnableOption "Syncthing continuous file synchronization"; + extraOptions = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "--gui-apikey=apiKey" ]; + description = '' + Extra command-line arguments to pass to syncthing. + ''; + }; + tray = mkOption { type = with types; either bool (submodule { @@ -43,7 +56,12 @@ with lib; }; config = mkMerge [ - (mkIf config.services.syncthing.enable { + (mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.syncthing" pkgs + lib.platforms.linux) + ]; + home.packages = [ (getOutput "man" pkgs.syncthing) ]; systemd.user.services = { @@ -57,7 +75,9 @@ with lib; Service = { ExecStart = - "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0"; + "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0" + + optionalString (cfg.extraOptions != [ ]) + (" " + escapeShellArgs cfg.extraOptions); Restart = "on-failure"; SuccessExitStatus = [ 3 4 ]; RestartForceExitStatus = [ 3 4 ]; @@ -77,49 +97,46 @@ with lib; }; }) - (mkIf (isAttrs config.services.syncthing.tray - && config.services.syncthing.tray.enable) { - systemd.user.services = { - ${config.services.syncthing.tray.package.pname} = { - Unit = { - Description = config.services.syncthing.tray.package.pname; - Requires = [ "tray.target" ]; - After = [ "graphical-session-pre.target" "tray.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Service = { - ExecStart = - "${config.services.syncthing.tray.package}/bin/${config.services.syncthing.tray.command}"; - }; - - Install = { WantedBy = [ "graphical-session.target" ]; }; + (mkIf (isAttrs cfg.tray && cfg.tray.enable) { + systemd.user.services = { + ${cfg.tray.package.pname} = { + Unit = { + Description = cfg.tray.package.pname; + Requires = [ "tray.target" ]; + After = [ "graphical-session-pre.target" "tray.target" ]; + PartOf = [ "graphical-session.target" ]; }; + + Service = { + ExecStart = "${cfg.tray.package}/bin/${cfg.tray.command}"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; }; - }) + }; + }) # deprecated - (mkIf (isBool config.services.syncthing.tray - && config.services.syncthing.tray) { - systemd.user.services = { - "syncthingtray" = { - Unit = { - Description = "syncthingtray"; - Requires = [ "tray.target" ]; - After = [ "graphical-session-pre.target" "tray.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Service = { - ExecStart = "${pkgs.syncthingtray-minimal}/bin/syncthingtray"; - }; - - Install = { WantedBy = [ "graphical-session.target" ]; }; + (mkIf (isBool cfg.tray && cfg.tray) { + systemd.user.services = { + "syncthingtray" = { + Unit = { + Description = "syncthingtray"; + Requires = [ "tray.target" ]; + After = [ "graphical-session-pre.target" "tray.target" ]; + PartOf = [ "graphical-session.target" ]; }; + + Service = { + ExecStart = "${pkgs.syncthingtray-minimal}/bin/syncthingtray"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; }; - warnings = [ - "Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257." - ]; - }) + }; + warnings = [ + "Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257." + ]; + }) ]; } diff --git a/third_party/home-manager/modules/services/systembus-notify.nix b/third_party/home-manager/modules/services/systembus-notify.nix new file mode 100644 index 0000000000..1b8f1be837 --- /dev/null +++ b/third_party/home-manager/modules/services/systembus-notify.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + meta.maintainers = [ maintainers.asymmetric ]; + + options = { + services.systembus-notify = { + enable = + mkEnableOption "systembus-notify - system bus notification daemon"; + }; + }; + + config = mkIf config.services.systembus-notify.enable { + assertions = [ + (hm.assertions.assertPlatform "services.systembus-notify" pkgs + platforms.linux) + ]; + + systemd.user.services.systembus-notify = { + Unit.Description = "systembus-notify daemon"; + Install.WantedBy = [ "graphical-session.target" ]; + Service.ExecStart = "${pkgs.systembus-notify}/bin/systembus-notify"; + }; + }; +} diff --git a/third_party/home-manager/modules/services/trayer.nix b/third_party/home-manager/modules/services/trayer.nix index 6abfbf7d1b..0621c55e60 100644 --- a/third_party/home-manager/modules/services/trayer.nix +++ b/third_party/home-manager/modules/services/trayer.nix @@ -100,7 +100,7 @@ let cfg = config.services.trayer; in { - meta.maintainers = [ maintainers.mager ]; + meta.maintainers = [ hm.maintainers.mager ]; options = { services.trayer = { diff --git a/third_party/home-manager/modules/services/twmn.nix b/third_party/home-manager/modules/services/twmn.nix new file mode 100644 index 0000000000..d4c1268293 --- /dev/null +++ b/third_party/home-manager/modules/services/twmn.nix @@ -0,0 +1,380 @@ +{ config, lib, pkgs, stdenv, ... }: + +with lib; + +let + + cfg = config.services.twmn; + + animationOpts = { + curve = mkOption { + type = types.ints.between 0 40; + default = 38; + example = 19; + description = '' + The qt easing-curve animation to use for the animation. See + + QEasingCurve documentation. + ''; + }; + + duration = mkOption { + type = types.ints.unsigned; + default = 1000; + example = 618; + description = "The animation duration in milliseconds."; + }; + }; + +in { + meta.maintainers = [ hm.maintainers.austreelis ]; + + options.services.twmn = { + enable = mkEnableOption "twmn, a tiling window manager notification daemon"; + + duration = mkOption { + type = types.ints.unsigned; + default = 3000; + example = 5000; + description = '' + The time each notification remains visible, in milliseconds. + ''; + }; + + extraConfig = mkOption { + type = types.attrs; + default = { }; + example = literalExpression + ''{ main.activation_command = "\${pkgs.hello}/bin/hello"; }''; + description = '' + Extra configuration options to add to the twmnd config file. See + + for details. + ''; + }; + + host = mkOption { + type = types.str; + default = "127.0.0.1"; + example = "laptop.lan"; + description = "Host address to listen on for notifications."; + }; + + icons = { + critical = mkOption { + type = types.nullOr types.path; + default = null; + description = "Path to the critical notifications' icon."; + }; + + info = mkOption { + type = types.nullOr types.path; + default = null; + description = "Path to the informative notifications' icon."; + }; + + warning = mkOption { + type = types.nullOr types.path; + default = null; + description = "Path to the warning notifications' icon."; + }; + }; + + port = mkOption { + type = types.port; + default = 9797; + description = "UDP port to listen on for notifications."; + }; + + screen = mkOption { + type = types.nullOr types.int; + default = null; + example = 0; + description = '' + Screen number to display notifications on when using a multi-head + desktop. + ''; + }; + + soundCommand = mkOption { + type = types.str; + default = ""; + description = "Command to execute to play a notification's sound."; + }; + + text = { + color = mkOption { + type = types.str; + default = "#999999"; + example = "lightgray"; + description = '' + Notification's text color. RGB hex and keywords (e.g. lightgray) + are supported. + ''; + }; + + font = { + package = mkOption { + type = types.nullOr types.package; + default = null; + example = literalExpression "pkgs.dejavu_fonts"; + description = '' + Notification text's font package. If null then + the font is assumed to already be available in your profile. + ''; + }; + + family = mkOption { + type = types.str; + default = "Sans"; + example = "Noto Sans"; + description = "Notification text's font family."; + }; + + size = mkOption { + type = types.ints.unsigned; + default = 13; + example = 42; + description = "Notification text's font size."; + }; + + variant = mkOption { + # These are the font variant supported by twmn + # See https://github.com/sboli/twmn/blob/master/README.md?plain=1#L42 + type = types.enum [ + "oblique" + "italic" + "ultra-light" + "light" + "medium" + "semi-bold" + "bold" + "ultra-bold" + "heavy" + "ultra-condensed" + "extra-condensed" + "condensed" + "semi-condensed" + "semi-expanded" + "expanded" + "extra-expanded" + "ultra-expanded" + ]; + default = "medium"; + example = "heavy"; + description = "Notification text's font variant."; + }; + }; + + maxLength = mkOption { + type = types.nullOr types.ints.unsigned; + default = null; + example = 80; + description = '' + Maximum length of the text before it is cut and suffixed with "...". + Never cuts if null. + ''; + }; + }; + + window = { + alwaysOnTop = + mkEnableOption "forcing the notification window to always be on top"; + + animation = { + easeIn = mkOption { + type = types.submodule { options = animationOpts; }; + default = { }; + example = literalExpression '' + { + curve = 19; + duration = 618; + } + ''; + description = "Options for the notification appearance's animation."; + }; + + easeOut = mkOption { + type = types.submodule { options = animationOpts; }; + default = { }; + example = literalExpression '' + { + curve = 19; + duration = 618; + } + ''; + description = + "Options for the notification disappearance's animation."; + }; + + bounce = { + enable = mkEnableOption + "notification bounce when displaying next notification directly."; + + duration = mkOption { + type = types.ints.unsigned; + default = 500; + example = 618; + description = "The bounce animation duration in milliseconds."; + }; + }; + }; + + color = mkOption { + type = types.str; + default = "#000000"; + example = "lightgray"; + description = '' + Notification's background color. RGB hex and keywords (e.g. + lightgray) are supported. + ''; + }; + + height = mkOption { + type = types.ints.unsigned; + default = 18; + example = 42; + description = '' + Height of the slide bar. Useful to match your tiling window + manager's bar. + ''; + }; + + offset = { + x = mkOption { + type = types.int; + default = 0; + example = 50; + description = '' + Offset of the notification's slide starting point in pixels on the + horizontal axis (positive is rightward). + ''; + }; + + y = mkOption { + type = types.int; + default = 0; + example = -100; + description = '' + Offset of the notification's slide starting point in pixels on the + vertical axis (positive is upward). + ''; + }; + }; + + opacity = mkOption { + type = types.ints.between 0 100; + default = 100; + example = 80; + description = "The notification window's opacity."; + }; + + position = mkOption { + type = types.enum [ + "tr" + "top_right" + "tl" + "top_left" + "br" + "bottom_right" + "bl" + "bottom_left" + "tc" + "top_center" + "bc" + "bottom_center" + "c" + "center" + ]; + default = "top_right"; + example = "bottom_left"; + description = '' + Position of the notification slide. The notification will slide + in vertically from the border if placed in + top_center or bottom_center, + horizontally otherwise. + ''; + }; + }; + }; + + ################# + # Implementation + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.twmn" pkgs + lib.platforms.linux) + ]; + + home.packages = + lib.optional (!isNull cfg.text.font.package) cfg.text.font.package + ++ [ pkgs.twmn ]; + + xdg.configFile."twmn/twmn.conf".text = let + conf = recursiveUpdate { + gui = { + always_on_top = if cfg.window.alwaysOnTop then "true" else "false"; + background_color = cfg.window.color; + bounce = + if cfg.window.animation.bounce.enable then "true" else "false"; + bounce_duration = toString cfg.window.animation.bounce.duration; + font = cfg.text.font.family; + font_size = toString cfg.text.font.size; + font_variant = cfg.text.font.variant; + foreground_color = cfg.text.color; + height = toString cfg.window.height; + in_animation = toString cfg.window.animation.easeIn.curve; + in_animation_duration = toString cfg.window.animation.easeIn.duration; + max_length = toString + (if isNull cfg.text.maxLength then -1 else cfg.text.maxLength); + offset_x = with cfg.window.offset; + if x < 0 then toString x else "+${toString x}"; + offset_y = with cfg.window.offset; + if y < 0 then toString y else "+${toString y}"; + opacity = toString cfg.window.opacity; + out_animation = toString cfg.window.animation.easeOut.curve; + out_animation_duration = + toString cfg.window.animation.easeOut.duration; + position = cfg.window.position; + screen = toString cfg.screen; + }; + # map null values to empty strings because formats.toml generator fails + # when encountering a null. + icons = mapAttrs (_: toString) cfg.icons; + main = { + duration = toString cfg.duration; + host = cfg.host; + port = toString cfg.port; + sound_command = cfg.soundCommand; + }; + } cfg.extraConfig; + + mkLine = name: value: "${name}=${value}"; + + mkSection = section: conf: '' + [${section}] + ${concatStringsSep "\n" (mapAttrsToList mkLine conf)} + ''; + in concatStringsSep "\n" (mapAttrsToList mkSection conf) + "\n"; + + systemd.user.services.twmnd = { + Unit = { + Description = "twmn daemon"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + X-Restart-Triggers = + [ "${config.xdg.configFile."twmn/twmn.conf".source}" ]; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + + Service = { + ExecStart = "${pkgs.twmn}/bin/twmnd"; + Restart = "on-failure"; + Type = "simple"; + StandardOutput = "null"; + }; + }; + }; +} diff --git a/third_party/home-manager/modules/services/udiskie.nix b/third_party/home-manager/modules/services/udiskie.nix index 331e65ffc8..d53d7cc8ab 100644 --- a/third_party/home-manager/modules/services/udiskie.nix +++ b/third_party/home-manager/modules/services/udiskie.nix @@ -4,17 +4,11 @@ with lib; let - cfg = config.services.udiskie; + mergeSets = sets: lists.fold attrsets.recursiveUpdate { } sets; - commandArgs = concatStringsSep " " (map (opt: "-" + opt) [ - (if cfg.automount then "a" else "A") - (if cfg.notify then "n" else "N") - ({ - always = "t"; - auto = "s"; - never = "T"; - }.${cfg.tray}) - ] ++ optional config.xsession.preferStatusNotifierItems "--appindicator"); + yaml = pkgs.formats.yaml { }; + + cfg = config.services.udiskie; in { meta.maintainers = [ maintainers.rycee ]; @@ -31,7 +25,37 @@ in { options = { services.udiskie = { - enable = mkEnableOption "udiskie mount daemon"; + enable = mkEnableOption "udiskie mount daemon" // { + description = '' + Whether to enable the udiskie mount daemon. + + Note, if you use NixOS then you must add + services.udisks2.enable = true + to your system configuration. Otherwise mounting will fail because + the Udisk2 DBus service is not found. + ''; + }; + + settings = mkOption { + type = yaml.type; + default = { }; + example = literalExpression '' + { + program_options = { + udisks_version = 2; + tray = true; + }; + icon_names.media = [ "media-optical" ]; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/udiskie/config.yml. + + See + for the full list of options. + ''; + }; automount = mkOption { type = types.bool; @@ -74,17 +98,36 @@ in { }; config = mkIf config.services.udiskie.enable { + xdg.configFile."udiskie/config.yml".source = + yaml.generate "udiskie-config.yml" (mergeSets [ + { + program_options = { + automount = cfg.automount; + tray = if cfg.tray == "always" then + true + else if cfg.tray == "never" then + false + else + "auto"; + notify = cfg.notify; + }; + } + cfg.settings + ]); + systemd.user.services.udiskie = { Unit = { Description = "udiskie mount daemon"; - Requires = [ "tray.target" ]; - After = [ "graphical-session-pre.target" "tray.target" ]; + Requires = lib.optional (cfg.tray != "never") "tray.target"; + After = [ "graphical-session-pre.target" ] + ++ lib.optional (cfg.tray != "never") "tray.target"; PartOf = [ "graphical-session.target" ]; }; - Service = { ExecStart = "${pkgs.udiskie}/bin/udiskie ${commandArgs}"; }; + Service.ExecStart = toString ([ "${pkgs.udiskie}/bin/udiskie" ] + ++ optional config.xsession.preferStatusNotifierItems "--appindicator"); - Install = { WantedBy = [ "graphical-session.target" ]; }; + Install.WantedBy = [ "graphical-session.target" ]; }; }; } diff --git a/third_party/home-manager/modules/services/unison.nix b/third_party/home-manager/modules/services/unison.nix index 1683e8851a..d7f8a628a5 100644 --- a/third_party/home-manager/modules/services/unison.nix +++ b/third_party/home-manager/modules/services/unison.nix @@ -80,10 +80,12 @@ in { default = { }; example = literalExpression '' { - roots = [ - "/home/user/documents" - "ssh://remote/documents" - ]; + "my-documents" = { + roots = [ + "/home/user/documents" + "ssh://remote/documents" + ]; + }; } ''; description = '' diff --git a/third_party/home-manager/modules/services/window-managers/awesome.nix b/third_party/home-manager/modules/services/window-managers/awesome.nix index 9692bec7c6..d79e72fe51 100644 --- a/third_party/home-manager/modules/services/window-managers/awesome.nix +++ b/third_party/home-manager/modules/services/window-managers/awesome.nix @@ -6,7 +6,7 @@ let cfg = config.xsession.windowManager.awesome; awesome = cfg.package; - getLuaPath = lib: dir: "${lib}/${dir}/lua/${pkgs.luaPackages.lua.luaversion}"; + getLuaPath = lib: dir: "${lib}/${dir}/lua/${awesome.lua.luaversion}"; makeSearchPath = lib.concatMapStrings (path: " --search ${getLuaPath path "share"}" + " --search ${getLuaPath path "lib"}"); @@ -14,7 +14,7 @@ let in { options = { xsession.windowManager.awesome = { - enable = mkEnableOption "Awesome window manager."; + enable = mkEnableOption "Awesome window manager"; package = mkOption { type = types.package; diff --git a/third_party/home-manager/modules/services/window-managers/bspwm/default.nix b/third_party/home-manager/modules/services/window-managers/bspwm/default.nix index c2b8fd49c3..84a75e3a4d 100644 --- a/third_party/home-manager/modules/services/window-managers/bspwm/default.nix +++ b/third_party/home-manager/modules/services/window-managers/bspwm/default.nix @@ -10,7 +10,19 @@ let builtins.replaceStrings upperChars (map (c: "_${c}") lowerChars); formatMonitor = monitor: desktops: - "bspc monitor ${escapeShellArg monitor} -d ${escapeShellArgs desktops}"; + let + resetDesktops = + "bspc monitor ${escapeShellArg monitor} -d ${escapeShellArgs desktops}"; + defaultDesktopName = + "Desktop"; # https://github.com/baskerville/bspwm/blob/master/src/desktop.h + in if cfg.alwaysResetDesktops then + resetDesktops + else '' + if [[ $(bspc query --desktops --names --monitor ${ + escapeShellArg monitor + }) == ${defaultDesktopName} ]]; then + ${resetDesktops} + fi''; formatValue = v: if isList v then @@ -49,20 +61,28 @@ in { home.packages = [ cfg.package ]; - xdg.configFile."bspwm/bspwmrc".source = pkgs.writeShellScript "bspwmrc" '' - ${concatStringsSep "\n" (mapAttrsToList formatMonitor cfg.monitors)} + xdg.configFile."bspwm/bspwmrc".source = pkgs.writeShellScript "bspwmrc" + ((optionalString (cfg.extraConfigEarly != "") + (cfg.extraConfigEarly + "\n")) + '' + ${concatStringsSep "\n" (mapAttrsToList formatMonitor cfg.monitors)} - ${concatStringsSep "\n" (mapAttrsToList formatSetting cfg.settings)} + ${concatStringsSep "\n" (mapAttrsToList formatSetting cfg.settings)} - bspc rule -r '*' - ${concatStringsSep "\n" (mapAttrsToList formatRule cfg.rules)} + bspc rule -r '*' + ${concatStringsSep "\n" (mapAttrsToList formatRule cfg.rules)} + # java gui fixes + export _JAVA_AWT_WM_NONREPARENTING=1 + bspc rule -a sun-awt-X11-XDialogPeer state=floating + + ${cfg.extraConfig} + ${concatMapStringsSep "\n" formatStartupProgram cfg.startupPrograms} + ''); + + # for applications not started by bspwm, e.g. sxhkd + xsession.profileExtra = '' # java gui fixes export _JAVA_AWT_WM_NONREPARENTING=1 - bspc rule -a sun-awt-X11-XDialogPeer state=floating - - ${cfg.extraConfig} - ${concatMapStringsSep "\n" formatStartupProgram cfg.startupPrograms} ''; xsession.windowManager.command = diff --git a/third_party/home-manager/modules/services/window-managers/bspwm/options.nix b/third_party/home-manager/modules/services/window-managers/bspwm/options.nix index 124236309a..848e991bdd 100644 --- a/third_party/home-manager/modules/services/window-managers/bspwm/options.nix +++ b/third_party/home-manager/modules/services/window-managers/bspwm/options.nix @@ -4,7 +4,11 @@ with lib; let + primitive = with types; oneOf [ bool int float str ]; + rule = types.submodule { + freeformType = with types; attrsOf primitive; + options = { monitor = mkOption { type = types.nullOr types.str; @@ -139,12 +143,20 @@ let description = "Whether the node should have border."; example = true; }; + + rectangle = mkOption { + type = types.nullOr types.str; + default = null; + description = + "The node's geometry, in the format WxH+X+Y."; + example = "800x600+32+32"; + }; }; }; in { xsession.windowManager.bspwm = { - enable = mkEnableOption "bspwm window manager."; + enable = mkEnableOption "bspwm window manager"; package = mkOption { type = types.package; @@ -155,9 +167,7 @@ in { }; settings = mkOption { - type = with types; - let primitive = either bool (either int (either float str)); - in attrsOf (either primitive (listOf primitive)); + type = with types; attrsOf (either primitive (listOf primitive)); default = { }; description = "General settings given to bspc config."; example = { @@ -177,6 +187,13 @@ in { ''; }; + extraConfigEarly = mkOption { + type = types.lines; + default = ""; + description = + "Like extraConfig, except commands are run at the start of the config file."; + }; + monitors = mkOption { type = types.attrsOf (types.listOf types.str); default = { }; @@ -185,6 +202,19 @@ in { example = { "HDMI-0" = [ "web" "terminal" "III" "IV" ]; }; }; + alwaysResetDesktops = mkOption { + type = types.bool; + default = true; + description = '' + If set to true, desktops configured in will be reset + every time the config is run. + + If set to false, desktops will only be configured the first time the config is run. + This is useful if you want to dynamically add desktops and you don't want them to be destroyed if you + re-run bspwmrc. + ''; + }; + rules = mkOption { type = types.attrsOf rule; default = { }; diff --git a/third_party/home-manager/modules/services/window-managers/fluxbox.nix b/third_party/home-manager/modules/services/window-managers/fluxbox.nix new file mode 100644 index 0000000000..6b05d29587 --- /dev/null +++ b/third_party/home-manager/modules/services/window-managers/fluxbox.nix @@ -0,0 +1,122 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xsession.windowManager.fluxbox; + +in { + meta.maintainers = [ maintainers.AndersonTorres ]; + + options = { + xsession.windowManager.fluxbox = { + enable = mkEnableOption "Fluxbox window manager"; + + package = mkPackageOption pkgs "fluxbox" { }; + + init = mkOption { + type = types.lines; + default = ""; + description = '' + Init configuration for Fluxbox, written to + ~/.fluxbox/init. Look at the + + fluxbox + 1 manpage for details. + ''; + }; + + apps = mkOption { + type = types.lines; + default = ""; + description = '' + Apps configuration for Fluxbox, written to + ~/.fluxbox/apps. Look at the + fluxbox + 1 manpage for details. + ''; + }; + + keys = mkOption { + type = types.lines; + default = ""; + description = '' + Keyboard shortcuts configuration for Fluxbox, written to + ~/.fluxbox/keys. Look at the + fluxbox-keys + 1 manpage for details. + ''; + }; + + menu = mkOption { + type = types.lines; + default = ""; + description = '' + Menu configuration for Fluxbox, written to + ~/.fluxbox/menu. Look at the + fluxbox-menu + 1 manpage for details. + ''; + }; + + slitlist = mkOption { + type = types.lines; + default = ""; + description = '' + Slitlist configuration for Fluxbox, written to + ~/.fluxbox/slitlist. Look at the + fluxbox + 1 manpage for details. + ''; + }; + + windowmenu = mkOption { + type = types.lines; + default = ""; + description = '' + Window menu configuration for Fluxbox, written to + ~/.fluxbox/windowmenu. Look at the + fluxbox-menu + 1 + manpage for details. + ''; + }; + + extraCommandLineArgs = mkOption { + type = with types; listOf str; + default = [ ]; + example = [ "-log" "/tmp/fluxbox.log" ]; + description = '' + Extra command line arguments to pass to fluxbox. + Look at the + fluxbox + 1 manpage for details. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "xsession.windowManager.fluxbox" pkgs + platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + home.file = { + ".fluxbox/init" = mkIf (cfg.init != "") { text = cfg.init; }; + ".fluxbox/apps" = mkIf (cfg.apps != "") { text = cfg.apps; }; + ".fluxbox/keys" = mkIf (cfg.keys != "") { text = cfg.keys; }; + ".fluxbox/menu" = mkIf (cfg.menu != "") { text = cfg.menu; }; + ".fluxbox/slitlist" = mkIf (cfg.slitlist != "") { text = cfg.slitlist; }; + ".fluxbox/windowmenu" = + mkIf (cfg.windowmenu != "") { text = cfg.windowmenu; }; + }; + + xsession.windowManager.command = concatStringsSep " " + ([ "${cfg.package}/bin/fluxbox" ] + ++ escapeShellArgs (remove "" cfg.extraCommandLineArgs)); + }; +} diff --git a/third_party/home-manager/modules/services/window-managers/herbstluftwm.nix b/third_party/home-manager/modules/services/window-managers/herbstluftwm.nix new file mode 100644 index 0000000000..67457e95a7 --- /dev/null +++ b/third_party/home-manager/modules/services/window-managers/herbstluftwm.nix @@ -0,0 +1,174 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.xsession.windowManager.herbstluftwm; + + renderValue = val: + if lib.isBool val then + if val then "true" else "false" + else + lib.escapeShellArg val; + + renderSettings = settings: + lib.concatStringsSep "\n" (lib.mapAttrsToList + (name: value: "herbstclient set ${name} ${renderValue value}") settings); + + renderKeybinds = keybinds: + lib.concatStringsSep "\n" + (lib.mapAttrsToList (key: cmd: "herbstclient keybind ${key} ${cmd}") + keybinds); + + renderMousebinds = mousebinds: + lib.concatStringsSep "\n" + (lib.mapAttrsToList (btn: cmd: "herbstclient mousebind ${btn} ${cmd}") + mousebinds); + + renderRules = rules: + lib.concatStringsSep "\n" (map (rule: "herbstclient rule ${rule}") rules); + + settingType = lib.types.oneOf [ lib.types.bool lib.types.int lib.types.str ]; + +in { + meta.maintainers = [ lib.hm.maintainers.olmokramer ]; + + options.xsession.windowManager.herbstluftwm = { + enable = lib.mkEnableOption "herbstluftwm window manager"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.herbstluftwm; + defaultText = lib.literalExpression "pkgs.herbstluftwm"; + description = '' + Package providing the herbstluftwm and + herbstclient commands. + ''; + }; + + settings = lib.mkOption { + type = lib.types.attrsOf settingType; + default = { }; + example = lib.literalExpression '' + { + gapless_grid = false; + window_border_width = 1; + window_border_active_color = "#FF0000"; + } + ''; + description = "Herbstluftwm settings."; + }; + + keybinds = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = { }; + example = lib.literalExpression '' + { + Mod4-o = "split right"; + Mod4-u = "split bottom"; + } + ''; + description = "Herbstluftwm keybinds."; + }; + + mousebinds = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = { }; + example = lib.literalExpression '' + { + Mod4-B1 = "move"; + Mod4-B3 = "resize"; + } + ''; + description = "Herbstluftwm mousebinds."; + }; + + rules = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + example = lib.literalExpression '' + [ + "windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' focus=on pseudotile=on" + "windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off" + ] + ''; + description = "Herbstluftwm rules."; + }; + + tags = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + example = lib.literalExpression '' + [ "work" "browser" "music" "gaming" ] + ''; + description = "Tags to create on startup."; + }; + + extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + example = '' + herbstclient set_layout max + herbstclient detect_monitors + ''; + description = '' + Extra configuration lines to add verbatim to + $XDG_CONFIG_HOME/herbstluftwm/autostart. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "xsession.windowManager.herbstluftwm" + pkgs lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xsession.windowManager.command = "${cfg.package}/bin/herbstluftwm --locked"; + + xdg.configFile."herbstluftwm/autostart".source = + pkgs.writeShellScript "herbstluftwm-autostart" '' + shopt -s expand_aliases + + # shellcheck disable=SC2142 + alias herbstclient='set -- "$@" ";"' + set -- + + herbstclient emit_hook reload + + # Reset everything. + herbstclient attr theme.tiling.reset 1 + herbstclient attr theme.floating.reset 1 + herbstclient keyunbind --all + herbstclient mouseunbind --all + herbstclient unrule --all + + ${renderSettings cfg.settings} + + ${lib.optionalString (cfg.tags != [ ]) '' + if ${cfg.package}/bin/herbstclient object_tree tags.default &>/dev/null; then + herbstclient rename default ${ + lib.escapeShellArg (builtins.head cfg.tags) + } + fi + + for tag in ${lib.escapeShellArgs cfg.tags}; do + herbstclient add "$tag" + done + ''} + + ${renderKeybinds cfg.keybinds} + + ${renderMousebinds cfg.mousebinds} + + ${renderRules cfg.rules} + + ${cfg.extraConfig} + + herbstclient unlock + + ${cfg.package}/bin/herbstclient chain ";" "$@" + ''; + }; +} diff --git a/third_party/home-manager/modules/services/window-managers/i3-sway/i3.nix b/third_party/home-manager/modules/services/window-managers/i3-sway/i3.nix index a5be60dd74..f28b9b6729 100644 --- a/third_party/home-manager/modules/services/window-managers/i3-sway/i3.nix +++ b/third_party/home-manager/modules/services/window-managers/i3-sway/i3.nix @@ -9,7 +9,6 @@ let commonOptions = import ./lib/options.nix { inherit config lib cfg pkgs; moduleName = "i3"; - isGaps = cfg.package == pkgs.i3-gaps; }; configModule = types.submodule { @@ -105,7 +104,7 @@ let in lib.mkOptionDefault { "''${modifier}+Return" = "exec i3-sensible-terminal"; "''${modifier}+Shift+q" = "kill"; - "''${modifier}+d" = "exec \${pkgs.dmenu}/bin/dmenu_run"; + "''${modifier}+d" = "exec ''${pkgs.dmenu}/bin/dmenu_run"; } ''; }; @@ -134,7 +133,7 @@ let }; commonFunctions = import ./lib/functions.nix { - inherit cfg lib; + inherit config cfg lib; moduleName = "i3"; }; @@ -143,53 +142,49 @@ let floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr; - startupEntryStr = { command, always, notification, workspace, ... }: '' - ${if always then "exec_always" else "exec"} ${ - if (notification && workspace == null) then "" else "--no-startup-id" - } ${ - if (workspace == null) then + startupEntryStr = { command, always, notification, workspace, ... }: + concatStringsSep " " [ + (if always then "exec_always" else "exec") + (if (notification && workspace == null) then "" else "--no-startup-id") + (if (workspace == null) then command else - "i3-msg 'workspace ${workspace}; exec ${command}'" - } - ''; + "i3-msg 'workspace ${workspace}; exec ${command}'") + ]; - configFile = pkgs.writeText "i3.conf" ((if cfg.config != null then - with cfg.config; '' - ${fontConfigStr fonts} - floating_modifier ${floating.modifier} - ${windowBorderString window floating} - hide_edge_borders ${window.hideEdgeBorders} - force_focus_wrapping ${if focus.forceWrapping then "yes" else "no"} - focus_follows_mouse ${if focus.followMouse then "yes" else "no"} - focus_on_window_activation ${focus.newWindow} - mouse_warping ${if focus.mouseWarping then "output" else "none"} - workspace_layout ${workspaceLayout} - workspace_auto_back_and_forth ${ - if workspaceAutoBackAndForth then "yes" else "no" - } - - client.focused ${colorSetStr colors.focused} - client.focused_inactive ${colorSetStr colors.focusedInactive} - client.unfocused ${colorSetStr colors.unfocused} - client.urgent ${colorSetStr colors.urgent} - client.placeholder ${colorSetStr colors.placeholder} - client.background ${colors.background} - - ${keybindingsStr { keybindings = keybindingDefaultWorkspace; }} - ${keybindingsStr { keybindings = keybindingsRest; }} - ${keycodebindingsStr keycodebindings} - ${concatStringsSep "\n" (mapAttrsToList (modeStr false) modes)} - ${concatStringsSep "\n" (mapAttrsToList assignStr assigns)} - ${concatStringsSep "\n" (map barStr bars)} - ${optionalString (gaps != null) gapsStr} - ${concatStringsSep "\n" (map floatingCriteriaStr floating.criteria)} - ${concatStringsSep "\n" (map windowCommandsStr window.commands)} - ${concatStringsSep "\n" (map startupEntryStr startup)} - ${concatStringsSep "\n" (map workspaceOutputStr workspaceOutputAssign)} - '' - else - "") + "\n" + cfg.extraConfig); + configFile = pkgs.writeText "i3.conf" (concatStringsSep "\n" + ((if cfg.config != null then + with cfg.config; + ([ + (fontConfigStr fonts) + "floating_modifier ${floating.modifier}" + (windowBorderString window floating) + "hide_edge_borders ${window.hideEdgeBorders}" + "force_focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}" + "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" + "focus_on_window_activation ${focus.newWindow}" + "mouse_warping ${if focus.mouseWarping then "output" else "none"}" + "workspace_layout ${workspaceLayout}" + "workspace_auto_back_and_forth ${ + lib.hm.booleans.yesNo workspaceAutoBackAndForth + }" + "client.focused ${colorSetStr colors.focused}" + "client.focused_inactive ${colorSetStr colors.focusedInactive}" + "client.unfocused ${colorSetStr colors.unfocused}" + "client.urgent ${colorSetStr colors.urgent}" + "client.placeholder ${colorSetStr colors.placeholder}" + "client.background ${colors.background}" + (keybindingsStr { keybindings = keybindingDefaultWorkspace; }) + (keybindingsStr { keybindings = keybindingsRest; }) + (keycodebindingsStr keycodebindings) + ] ++ mapAttrsToList (modeStr false) modes + ++ mapAttrsToList assignStr assigns ++ map barStr bars + ++ optional (gaps != null) gapsStr + ++ map floatingCriteriaStr floating.criteria + ++ map windowCommandsStr window.commands ++ map startupEntryStr startup + ++ map workspaceOutputStr workspaceOutputAssign) + else + [ ]) ++ [ cfg.extraConfig ])); # Validates the i3 configuration checkI3Config = @@ -197,7 +192,7 @@ let # We have to make sure the wrapper does not start a dbus session export DBUS_SESSION_BUS_ADDRESS=1 - # A zero exit code means i3 succesfully validated the configuration + # A zero exit code means i3 successfully validated the configuration i3 -c ${configFile} -C -d all || { echo "i3 configuration validation failed" echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'" @@ -207,22 +202,13 @@ let ''; in { - meta.maintainers = with maintainers; [ sumnerevans ]; + meta.maintainers = with maintainers; [ sumnerevans sebtm ]; options = { xsession.windowManager.i3 = { - enable = mkEnableOption "i3 window manager."; + enable = mkEnableOption "i3 window manager"; - package = mkOption { - type = types.package; - default = pkgs.i3; - defaultText = literalExpression "pkgs.i3"; - example = literalExpression "pkgs.i3-gaps"; - description = '' - i3 package to use. - If 'i3.config.gaps' settings are specified, 'pkgs.i3-gaps' will be set as a default package. - ''; - }; + package = mkPackageOption pkgs "i3" { }; config = mkOption { type = types.nullOr configModule; @@ -253,19 +239,17 @@ in { xdg.configFile."i3/config" = { source = checkI3Config; onChange = '' - i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.* - if [ -S $i3Socket ]; then - ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null - fi + # There may be several sockets after log out/log in, but the old ones + # will fail with "Connection refused". + for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do + if [[ -S $i3Socket ]]; then + ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true + fi + done ''; }; } - (mkIf (cfg.config != null) { - xsession.windowManager.i3.package = - mkDefault (if (cfg.config.gaps != null) then pkgs.i3-gaps else pkgs.i3); - }) - (mkIf (cfg.config != null) { warnings = (optional (isList cfg.config.fonts) "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") diff --git a/third_party/home-manager/modules/services/window-managers/i3-sway/lib/functions.nix b/third_party/home-manager/modules/services/window-managers/i3-sway/lib/functions.nix index 75b3f7b6f4..c6a6ada156 100644 --- a/third_party/home-manager/modules/services/window-managers/i3-sway/lib/functions.nix +++ b/third_party/home-manager/modules/services/window-managers/i3-sway/lib/functions.nix @@ -1,4 +1,4 @@ -{ cfg, lib, moduleName }: +{ cfg, config, lib, moduleName }: with lib; @@ -20,9 +20,9 @@ rec { cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace) cfg.config.keybindings; - keybindingsStr = { keybindings, bindsymArgs ? "" }: + keybindingsStr = { keybindings, bindsymArgs ? "", indent ? "" }: concatStringsSep "\n" (mapAttrsToList (keycomb: action: - optionalString (action != null) "bindsym ${ + optionalString (action != null) "${indent}bindsym ${ lib.optionalString (bindsymArgs != "") "${bindsymArgs} " }${keycomb} ${action}") keybindings); @@ -46,6 +46,7 @@ rec { ${keybindingsStr { inherit keybindings; bindsymArgs = lib.optionalString bindkeysToCode "--to-code"; + indent = " "; }} } ''; @@ -56,12 +57,8 @@ rec { fontConfigStr = let toFontStr = { names, style ? "", size ? "" }: - optionalString (names != [ ]) concatStringsSep " " (filter (x: x != "") [ - "font" - "pango:${concatStringsSep ", " names}" - style - size - ]); + optionalString (names != [ ]) concatStringsSep " " + (remove "" [ "font" "pango:${concatStringsSep ", " names}" style size ]); in fontCfg: if isList fontCfg then toFontStr { names = fontCfg; } @@ -77,89 +74,76 @@ rec { let colorsNotNull = lib.filterAttrs (n: v: v != null) colors != { }; in '' bar { - ${optionalString (id != null) "id ${id}"} - ${fontConfigStr fonts} - ${optionalString (mode != null) "mode ${mode}"} - ${optionalString (hiddenState != null) "hidden_state ${hiddenState}"} - ${optionalString (position != null) "position ${position}"} ${ - optionalString (statusCommand != null) - "status_command ${statusCommand}" + concatStringsSep "\n" (indent (lists.subtractLists [ "" null ] + (flatten [ + (optionalString (id != null) "id ${id}") + (fontConfigStr fonts) + (optionalString (mode != null) "mode ${mode}") + (optionalString (hiddenState != null) + "hidden_state ${hiddenState}") + (optionalString (position != null) "position ${position}") + (optionalString (statusCommand != null) + "status_command ${statusCommand}") + "${moduleName}bar_command ${command}" + (optionalString (workspaceButtons != null) + "workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}") + (optionalString (workspaceNumbers != null) + "strip_workspace_numbers ${ + lib.hm.booleans.yesNo (!workspaceNumbers) + }") + (optionalString (trayOutput != null) "tray_output ${trayOutput}") + (optionals colorsNotNull (indent + (lists.subtractLists [ "" null ] [ + "colors {" + (optionalString (colors.background != null) + "background ${colors.background}") + (optionalString (colors.statusline != null) + "statusline ${colors.statusline}") + (optionalString (colors.separator != null) + "separator ${colors.separator}") + (optionalString (colors.focusedBackground != null) + "focused_background ${colors.focusedBackground}") + (optionalString (colors.focusedStatusline != null) + "focused_statusline ${colors.focusedStatusline}") + (optionalString (colors.focusedSeparator != null) + "focused_separator ${colors.focusedSeparator}") + (optionalString (colors.focusedWorkspace != null) + "focused_workspace ${ + barColorSetStr colors.focusedWorkspace + }") + (optionalString (colors.activeWorkspace != null) + "active_workspace ${barColorSetStr colors.activeWorkspace}") + (optionalString (colors.inactiveWorkspace != null) + "inactive_workspace ${ + barColorSetStr colors.inactiveWorkspace + }") + (optionalString (colors.urgentWorkspace != null) + "urgent_workspace ${barColorSetStr colors.urgentWorkspace}") + (optionalString (colors.bindingMode != null) + "binding_mode ${barColorSetStr colors.bindingMode}") + "}" + ]) { })) + extraConfig + ])) { }) } - ${moduleName}bar_command ${command} - ${ - optionalString (workspaceButtons != null) - "workspace_buttons ${if workspaceButtons then "yes" else "no"}" - } - ${ - optionalString (workspaceNumbers != null) - "strip_workspace_numbers ${if !workspaceNumbers then "yes" else "no"}" - } - ${optionalString (trayOutput != null) "tray_output ${trayOutput}"} - ${optionalString colorsNotNull "colors {"} - ${ - optionalString (colors.background != null) - "background ${colors.background}" - } - ${ - optionalString (colors.statusline != null) - "statusline ${colors.statusline}" - } - ${ - optionalString (colors.separator != null) - "separator ${colors.separator}" - } - ${ - optionalString (colors.focusedBackground != null) - "focused_background ${colors.focusedBackground}" - } - ${ - optionalString (colors.focusedStatusline != null) - "focused_statusline ${colors.focusedStatusline}" - } - ${ - optionalString (colors.focusedSeparator != null) - "focused_separator ${colors.focusedSeparator}" - } - ${ - optionalString (colors.focusedWorkspace != null) - "focused_workspace ${barColorSetStr colors.focusedWorkspace}" - } - ${ - optionalString (colors.activeWorkspace != null) - "active_workspace ${barColorSetStr colors.activeWorkspace}" - } - ${ - optionalString (colors.inactiveWorkspace != null) - "inactive_workspace ${barColorSetStr colors.inactiveWorkspace}" - } - ${ - optionalString (colors.urgentWorkspace != null) - "urgent_workspace ${barColorSetStr colors.urgentWorkspace}" - } - ${ - optionalString (colors.bindingMode != null) - "binding_mode ${barColorSetStr colors.bindingMode}" - } - ${optionalString colorsNotNull "}"} - ${extraConfig} } ''; - gapsStr = with cfg.config.gaps; '' - ${optionalString (inner != null) "gaps inner ${toString inner}"} - ${optionalString (outer != null) "gaps outer ${toString outer}"} - ${optionalString (horizontal != null) - "gaps horizontal ${toString horizontal}"} - ${optionalString (vertical != null) "gaps vertical ${toString vertical}"} - ${optionalString (top != null) "gaps top ${toString top}"} - ${optionalString (bottom != null) "gaps bottom ${toString bottom}"} - ${optionalString (left != null) "gaps left ${toString left}"} - ${optionalString (right != null) "gaps right ${toString right}"} - - ${optionalString smartGaps "smart_gaps on"} - ${optionalString (smartBorders != "off") "smart_borders ${smartBorders}"} - ''; + gapsStr = with cfg.config.gaps; + concatStringsSep "\n" (lists.subtractLists [ "" null ] [ + (optionalString (inner != null) "gaps inner ${toString inner}") + (optionalString (outer != null) "gaps outer ${toString outer}") + (optionalString (horizontal != null) + "gaps horizontal ${toString horizontal}") + (optionalString (vertical != null) "gaps vertical ${toString vertical}") + (optionalString (top != null) "gaps top ${toString top}") + (optionalString (bottom != null) "gaps bottom ${toString bottom}") + (optionalString (left != null) "gaps left ${toString left}") + (optionalString (right != null) "gaps right ${toString right}") + (optionalString smartGaps "smart_gaps on") + (optionalString (smartBorders != "off") "smart_borders ${smartBorders}") + ]); windowBorderString = window: floating: let @@ -176,4 +160,14 @@ rec { "for_window ${criteriaStr criteria} ${command}"; workspaceOutputStr = item: ''workspace "${item.workspace}" output ${item.output}''; + + indent = list: + { includesWrapper ? true, level ? 1 }: + let prefix = concatStringsSep "" (lib.genList (x: " ") (level * 2)); + + in (lib.imap1 (i: v: + "${if includesWrapper && (i == 1 || i == (lib.length list)) then + v + else + "${prefix}${v}"}") list); } diff --git a/third_party/home-manager/modules/services/window-managers/i3-sway/lib/options.nix b/third_party/home-manager/modules/services/window-managers/i3-sway/lib/options.nix index c4d1535a7c..d04a11762f 100644 --- a/third_party/home-manager/modules/services/window-managers/i3-sway/lib/options.nix +++ b/third_party/home-manager/modules/services/window-managers/i3-sway/lib/options.nix @@ -1,5 +1,4 @@ -{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName -, isGaps ? true }: +{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }: with lib; @@ -7,6 +6,8 @@ let isI3 = moduleName == "i3"; isSway = !isI3; + inherit (config.home) stateVersion; + fontOptions = types.submodule { options = { names = mkOption { @@ -67,7 +68,7 @@ let default = null; description = '' Launch application on a particular workspace. DEPRECATED: - Use xsession.windowManager.i3.config.assigns + Use instead. See . ''; }; @@ -77,7 +78,7 @@ let barModule = types.submodule { options = let - versionAtLeast2009 = versionAtLeast config.home.stateVersion "20.09"; + versionAtLeast2009 = versionAtLeast stateVersion "20.09"; mkNullableOption = { type, default, ... }@args: mkOption (args // { type = types.nullOr type; @@ -158,7 +159,7 @@ let defaultText = "i3bar"; description = "Command that will be used to start a bar."; example = if isI3 then - "\${pkgs.i3-gaps}/bin/i3bar -t" + "\${pkgs.i3}/bin/i3bar -t" else "\${pkgs.waybar}/bin/waybar"; }; @@ -389,11 +390,17 @@ in { options = { titlebar = mkOption { type = types.bool; - default = !isGaps; - defaultText = if isI3 then - "xsession.windowManager.i3.package != nixpkgs.i3-gaps (titlebar should be disabled for i3-gaps)" + default = if versionOlder stateVersion "23.05" then + (isI3 && (cfg.config.gaps == null)) else - "false"; + true; + defaultText = if isI3 then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; description = "Whether to show window titlebars."; }; @@ -432,11 +439,17 @@ in { options = { titlebar = mkOption { type = types.bool; - default = !isGaps; - defaultText = if isI3 then - "xsession.windowManager.i3.package != nixpkgs.i3-gaps (titlebar should be disabled for i3-gaps)" + default = if versionOlder stateVersion "23.05" then + (isI3 && (cfg.config.gaps == null)) else - "false"; + true; + defaultText = if isI3 then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; description = "Whether to show floating window titlebars."; }; @@ -494,10 +507,7 @@ in { default = if isSway then "yes" else true; description = "Whether focus should follow the mouse."; apply = val: - if (isSway && isBool val) then - (if val then "yes" else "no") - else - val; + if (isSway && isBool val) then (lib.hm.booleans.yesNo val) else val; }; forceWrapping = mkOption { @@ -511,7 +521,10 @@ in { }; mouseWarping = mkOption { - type = types.bool; + type = if isSway then + types.oneOf [ types.bool (types.enum [ "container" "output" ]) ] + else + types.bool; default = true; description = '' Whether mouse cursor should be warped to the center of the window when switching focus @@ -670,7 +683,7 @@ in { bars = mkOption { type = types.listOf barModule; - default = if versionAtLeast config.home.stateVersion "20.09" then [{ + default = if versionAtLeast stateVersion "20.09" then [{ mode = "dock"; hiddenState = "hide"; position = "bottom"; @@ -826,19 +839,14 @@ in { }; }); default = null; - description = if isSway then '' + description = '' Gaps related settings. - '' else '' - i3Gaps related settings. The i3-gaps package must be used for these features to work. ''; }; terminal = mkOption { type = types.str; - default = if isI3 then - "i3-sensible-terminal" - else - "${pkgs.rxvt-unicode-unwrapped}/bin/urxvt"; + default = if isI3 then "i3-sensible-terminal" else "${pkgs.foot}/bin/foot"; description = "Default terminal to run."; example = "alacritty"; }; diff --git a/third_party/home-manager/modules/services/window-managers/i3-sway/sway.nix b/third_party/home-manager/modules/services/window-managers/i3-sway/sway.nix index ecd7bb5339..fdcbaabcd0 100644 --- a/third_party/home-manager/modules/services/window-managers/i3-sway/sway.nix +++ b/third_party/home-manager/modules/services/window-managers/i3-sway/sway.nix @@ -239,7 +239,7 @@ let }; commonFunctions = import ./lib/functions.nix { - inherit cfg lib; + inherit config cfg lib; moduleName = "sway"; }; @@ -262,59 +262,63 @@ let outputStr = moduleStr "output"; seatStr = moduleStr "seat"; - configFile = pkgs.writeText "sway.conf" ((if cfg.config != null then - with cfg.config; '' - ${fontConfigStr fonts} - floating_modifier ${floating.modifier} - ${windowBorderString window floating} - hide_edge_borders ${window.hideEdgeBorders} - focus_wrapping ${if focus.forceWrapping then "yes" else "no"} - focus_follows_mouse ${focus.followMouse} - focus_on_window_activation ${focus.newWindow} - mouse_warping ${if focus.mouseWarping then "output" else "none"} - workspace_layout ${workspaceLayout} - workspace_auto_back_and_forth ${ - if workspaceAutoBackAndForth then "yes" else "no" - } - - client.focused ${colorSetStr colors.focused} - client.focused_inactive ${colorSetStr colors.focusedInactive} - client.unfocused ${colorSetStr colors.unfocused} - client.urgent ${colorSetStr colors.urgent} - client.placeholder ${colorSetStr colors.placeholder} - client.background ${colors.background} - - ${keybindingsStr { - keybindings = keybindingDefaultWorkspace; - bindsymArgs = - lib.optionalString (cfg.config.bindkeysToCode) "--to-code"; - }} - ${keybindingsStr { - keybindings = keybindingsRest; - bindsymArgs = - lib.optionalString (cfg.config.bindkeysToCode) "--to-code"; - }} - ${keycodebindingsStr keycodebindings} - ${concatStringsSep "\n" ( - # Append all of the lists together to avoid unnecessary whitespace. - mapAttrsToList inputStr input # inputs - ++ mapAttrsToList outputStr output # outputs - ++ mapAttrsToList seatStr seat # seats - ++ mapAttrsToList (modeStr cfg.config.bindkeysToCode) modes # modes - ++ mapAttrsToList assignStr assigns # assigns - ++ map barStr bars # bars - ++ optional (gaps != null) gapsStr # gaps - ++ map floatingCriteriaStr floating.criteria # floating - ++ map windowCommandsStr window.commands # window commands - ++ map startupEntryStr startup # startup - ++ map workspaceOutputStr workspaceOutputAssign # custom mapping - )} - '' - else - "") + "\n" + (if cfg.systemdIntegration then '' - exec "systemctl --user import-environment; systemctl --user start sway-session.target" - '' else - "") + cfg.extraConfig); + configFile = pkgs.writeText "sway.conf" (concatStringsSep "\n" + ((optional (cfg.extraConfigEarly != "") cfg.extraConfigEarly) + ++ (if cfg.config != null then + with cfg.config; + ([ + (fontConfigStr fonts) + "floating_modifier ${floating.modifier}" + (windowBorderString window floating) + "hide_edge_borders ${window.hideEdgeBorders}" + "focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}" + "focus_follows_mouse ${focus.followMouse}" + "focus_on_window_activation ${focus.newWindow}" + "mouse_warping ${ + if builtins.isString (focus.mouseWarping) then + focus.mouseWarping + else if focus.mouseWarping then + "output" + else + "none" + }" + "workspace_layout ${workspaceLayout}" + "workspace_auto_back_and_forth ${ + lib.hm.booleans.yesNo workspaceAutoBackAndForth + }" + "client.focused ${colorSetStr colors.focused}" + "client.focused_inactive ${colorSetStr colors.focusedInactive}" + "client.unfocused ${colorSetStr colors.unfocused}" + "client.urgent ${colorSetStr colors.urgent}" + "client.placeholder ${colorSetStr colors.placeholder}" + "client.background ${colors.background}" + (keybindingsStr { + keybindings = keybindingDefaultWorkspace; + bindsymArgs = + lib.optionalString (cfg.config.bindkeysToCode) "--to-code"; + }) + (keybindingsStr { + keybindings = keybindingsRest; + bindsymArgs = + lib.optionalString (cfg.config.bindkeysToCode) "--to-code"; + }) + (keycodebindingsStr keycodebindings) + ] ++ mapAttrsToList inputStr input + ++ mapAttrsToList outputStr output # outputs + ++ mapAttrsToList seatStr seat # seats + ++ mapAttrsToList (modeStr cfg.config.bindkeysToCode) modes # modes + ++ mapAttrsToList assignStr assigns # assigns + ++ map barStr bars # bars + ++ optional (gaps != null) gapsStr # gaps + ++ map floatingCriteriaStr floating.criteria # floating + ++ map windowCommandsStr window.commands # window commands + ++ map startupEntryStr startup # startup + ++ map workspaceOutputStr workspaceOutputAssign # custom mapping + ) + else + [ ]) ++ (optional cfg.systemdIntegration '' + exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target"'') + ++ (optional (!cfg.xwayland) "xwayland disable") ++ [ cfg.extraConfig ])); defaultSwayPackage = pkgs.sway.override { extraSessionCommands = cfg.extraSessionCommands; @@ -324,7 +328,7 @@ let }; in { - meta.maintainers = with maintainers; [ alexarice sumnerevans ]; + meta.maintainers = with maintainers; [ alexarice sumnerevans sebtm oxalica ]; options.wayland.windowManager.sway = { enable = mkEnableOption "sway wayland compositor"; @@ -350,6 +354,14 @@ in { Whether to enable sway-session.target on sway startup. This links to graphical-session.target. + Some important environment variables will be imported to systemd + and dbus user environment before reaching the target, including + + DISPLAY + WAYLAND_DISPLAY + SWAYSOCK + XDG_CURRENT_DESKTOP + ''; }; @@ -414,6 +426,13 @@ in { description = "Extra configuration lines to add to ~/.config/sway/config."; }; + + extraConfigEarly = mkOption { + type = types.lines; + default = ""; + description = + "Like extraConfig, except lines are added to ~/.config/sway/config before all other configuration."; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -435,12 +454,14 @@ in { home.packages = optional (cfg.package != null) cfg.package ++ optional cfg.xwayland pkgs.xwayland; - xdg.configFile."sway/config" = { + xdg.configFile."sway/config" = let + swayPackage = if cfg.package == null then pkgs.sway else cfg.package; + in { source = configFile; onChange = '' - swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway || true).sock - if [ -S $swaySocket ]; then - ${pkgs.sway}/bin/swaymsg -s $swaySocket reload + swaySocket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep --uid $UID -x sway || true).sock" + if [ -S "$swaySocket" ]; then + ${swayPackage}/bin/swaymsg -s $swaySocket reload fi ''; }; @@ -454,6 +475,13 @@ in { After = [ "graphical-session-pre.target" ]; }; }; + + systemd.user.targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = [ "graphical-session-pre.target" ]; + }; + }; } ]); } diff --git a/third_party/home-manager/modules/services/window-managers/i3-sway/swaynag.nix b/third_party/home-manager/modules/services/window-managers/i3-sway/swaynag.nix index 97d6f47381..8b77b55fc5 100644 --- a/third_party/home-manager/modules/services/window-managers/i3-sway/swaynag.nix +++ b/third_party/home-manager/modules/services/window-managers/i3-sway/swaynag.nix @@ -33,7 +33,7 @@ in { swaynag 5 - for a list of avaliable options and an example configuration. + for a list of available options and an example configuration. Note, configurations declared under <config> will override the default type values of swaynag. ''; diff --git a/third_party/home-manager/modules/services/window-managers/spectrwm.nix b/third_party/home-manager/modules/services/window-managers/spectrwm.nix new file mode 100644 index 0000000000..f2d7af4c0a --- /dev/null +++ b/third_party/home-manager/modules/services/window-managers/spectrwm.nix @@ -0,0 +1,135 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xsession.windowManager.spectrwm; + + renderedValue = val: + if isBool val then if val then "1" else "0" else toString val; + + renderedSettings = settings: + mapAttrsToList (name: value: "${name} = ${renderedValue value}") settings; + + renderedBindings = bindings: + mapAttrsToList (name: value: "bind[${name}] = ${value}") bindings; + + renderedUnbindings = unbindings: map (value: "bind[] = ${value}") unbindings; + + renderedPrograms = programs: + mapAttrsToList (name: value: "program[${name}] = ${value}") programs; + + renderedQuirks = quirks: + mapAttrsToList (name: value: "quirk[${name}] = ${value}") quirks; + + settingType = types.oneOf [ types.bool types.int types.str ]; + +in { + meta.maintainers = [ hm.maintainers.loicreynier ]; + + options = { + xsession.windowManager.spectrwm = { + enable = mkEnableOption "Spectrwm window manager"; + + package = mkOption { + type = types.package; + default = pkgs.spectrwm; + defaultText = literalExpression "pkgs.spectrwm"; + description = '' + Package providing the spectrwm command. + ''; + }; + + settings = mkOption { + type = types.attrsOf settingType; + default = { }; + example = literalExpression '' + { + modkey = "Mod4"; + workspace_limit = 5; + focus_mode = "manual"; + focus_close = "next"; + } + ''; + description = "Spectrwm settings."; + }; + + bindings = mkOption { + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + term = "Mod+Return"; + restart = "Mod+Shift+r"; + quit = "Mod+Shift+q"; + } + ''; + description = "Spectrwm keybindings."; + }; + + unbindings = mkOption { + type = types.listOf types.str; + default = [ ]; + example = literalExpression '' + [ + "MOD+e" + "MOD+f" + "MOD+m" + "MOD+s" + "MOD+u" + "MOD+t" + ] + ''; + description = '' + List of keybindings to disable from default Spectrwm configuration. + ''; + }; + + programs = mkOption { + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + term = "alacritty"; + search = "dmenu -ip -p 'Window name/id:'; + } + ''; + description = "Spectrwm programs variables."; + }; + + quirks = mkOption { + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + Matplotlib = "FLOAT"; + Pavucontrol = "FLOAT"; + } + ''; + description = "Spectrwm quicks (custom window rules)."; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "xsession.windowManager.spectrwm" pkgs + platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xsession.windowManager.command = "${cfg.package}/bin/spectrwm"; + + xdg.configFile."spectrwm/spectrwm.conf".text = '' + # Generated by Home Manager + ${concatStringsSep "\n" ( # \ + renderedSettings cfg.settings # \ + ++ renderedPrograms cfg.programs # \ + ++ renderedQuirks cfg.quirks # \ + ++ renderedBindings cfg.bindings # \ + ++ renderedUnbindings cfg.unbindings)} + ''; + }; +} diff --git a/third_party/home-manager/modules/services/window-managers/xmonad.nix b/third_party/home-manager/modules/services/window-managers/xmonad.nix index 2718637600..8066bae2cc 100644 --- a/third_party/home-manager/modules/services/window-managers/xmonad.nix +++ b/third_party/home-manager/modules/services/window-managers/xmonad.nix @@ -132,7 +132,13 @@ in { # The resulting binary name depends on the arch and os # https://github.com/xmonad/xmonad/blob/56b0f850bc35200ec23f05c079eca8b0a1f90305/src/XMonad/Core.hs#L565-L572 - mv "$XMONAD_DATA_DIR/xmonad-${pkgs.stdenv.hostPlatform.system}" $out/bin/ + if [ -f "$XMONAD_DATA_DIR/xmonad-${pkgs.stdenv.hostPlatform.system}" ]; then + # xmonad 0.15.0 + mv "$XMONAD_DATA_DIR/xmonad-${pkgs.stdenv.hostPlatform.system}" $out/bin/ + else + # xmonad 0.17.0 (https://github.com/xmonad/xmonad/commit/9813e218b034009b0b6d09a70650178980e05d54) + mv "$XMONAD_CACHE_DIR/xmonad-${pkgs.stdenv.hostPlatform.system}" $out/bin/ + fi '' }/bin/xmonad-${pkgs.stdenv.hostPlatform.system}"; diff --git a/third_party/home-manager/modules/services/wlsunset.nix b/third_party/home-manager/modules/services/wlsunset.nix index 28e595af95..6cd45ed5e4 100644 --- a/third_party/home-manager/modules/services/wlsunset.nix +++ b/third_party/home-manager/modules/services/wlsunset.nix @@ -5,10 +5,10 @@ with lib; let cfg = config.services.wlsunset; in { - meta.maintainers = [ maintainers.matrss ]; + meta.maintainers = [ hm.maintainers.matrss ]; options.services.wlsunset = { - enable = mkEnableOption "Whether to enable wlsunset."; + enable = mkEnableOption "wlsunset"; package = mkOption { type = types.package; diff --git a/third_party/home-manager/modules/services/xidlehook.nix b/third_party/home-manager/modules/services/xidlehook.nix index f292504756..d769ccafb2 100644 --- a/third_party/home-manager/modules/services/xidlehook.nix +++ b/third_party/home-manager/modules/services/xidlehook.nix @@ -23,13 +23,14 @@ let ${concatStringsSep " " (notEmpty [ "${cfg.package}/bin/xidlehook" (optionalString cfg.once "--once") + (optionalString cfg.detect-sleep "--detect-sleep") (optionalString cfg.not-when-fullscreen "--not-when-fullscreen") (optionalString cfg.not-when-audio "--not-when-audio") timers ])} ''; in { - meta.maintainers = [ maintainers.dschrempf ]; + meta.maintainers = [ maintainers.dschrempf hm.maintainers.bertof ]; options.services.xidlehook = { enable = mkEnableOption "xidlehook systemd service"; @@ -55,6 +56,9 @@ in { ''; }; + detect-sleep = mkEnableOption + "detecting when the system wakes up from a suspended state and resetting the idle timer"; + not-when-fullscreen = mkOption { type = types.bool; default = false; diff --git a/third_party/home-manager/modules/services/xscreensaver.nix b/third_party/home-manager/modules/services/xscreensaver.nix index 3c0661e898..3ae92658f0 100644 --- a/third_party/home-manager/modules/services/xscreensaver.nix +++ b/third_party/home-manager/modules/services/xscreensaver.nix @@ -53,6 +53,7 @@ in { Service = { ExecStart = "${pkgs.xscreensaver}/bin/xscreensaver -no-splash"; + Environment = "PATH=${makeBinPath [ pkgs.xscreensaver ]}"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; diff --git a/third_party/home-manager/modules/systemd.nix b/third_party/home-manager/modules/systemd.nix index 0be586d7c6..e4c36ae420 100644 --- a/third_party/home-manager/modules/systemd.nix +++ b/third_party/home-manager/modules/systemd.nix @@ -8,7 +8,7 @@ let # From mkPathSafeName = - lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; + lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; enabled = cfg.services != { } # \ || cfg.slices != { } # \ @@ -44,14 +44,15 @@ let destination = "/${filename}"; } + "/${filename}"; - wantedBy = target: { - name = "systemd/user/${target}.wants/${filename}"; + install = variant: target: { + name = "systemd/user/${target}.${variant}/${filename}"; value = { inherit source; }; }; in lib.singleton { name = "systemd/user/${filename}"; value = { inherit source; }; - } ++ map wantedBy (serviceCfg.Install.WantedBy or [ ]); + } ++ map (install "wants") (serviceCfg.Install.WantedBy or [ ]) + ++ map (install "requires") (serviceCfg.Install.RequiredBy or [ ]); buildServices = style: serviceCfgs: lib.concatLists (lib.mapAttrsToList (buildService style) serviceCfgs); @@ -106,7 +107,7 @@ in { systemd.user = { systemctlPath = mkOption { default = "${pkgs.systemd}/bin/systemctl"; - defaultText = "\${pkgs.systemd}/bin/systemctl"; + defaultText = literalExpression ''"''${pkgs.systemd}/bin/systemctl"''; type = types.str; description = '' Absolute path to the systemctl tool. This @@ -124,9 +125,9 @@ in { slices = mkOption { default = { }; - type = unitType "slices"; - description = unitDescription "slices"; - example = unitExample "Slices"; + type = unitType "slice"; + description = unitDescription "slice"; + example = unitExample "Slice"; }; sockets = mkOption { @@ -262,7 +263,7 @@ in { (mkIf (pkgs.stdenv.isLinux && config.home.username != "root") { xdg.configFile = mkMerge [ (lib.listToAttrs ((buildServices "service" cfg.services) - ++ (buildServices "slices" cfg.slices) + ++ (buildServices "slice" cfg.slices) ++ (buildServices "socket" cfg.sockets) ++ (buildServices "target" cfg.targets) ++ (buildServices "timer" cfg.timers) diff --git a/third_party/home-manager/modules/targets/darwin/default.nix b/third_party/home-manager/modules/targets/darwin/default.nix index 4cf295daa0..360a3f3d5f 100644 --- a/third_party/home-manager/modules/targets/darwin/default.nix +++ b/third_party/home-manager/modules/targets/darwin/default.nix @@ -1,76 +1,13 @@ -{ config, lib, pkgs, ... }: +{ lib, ... }: -with lib; +{ + meta.maintainers = with lib.maintainers; [ midchildan ]; -let - cfg = config.targets.darwin; - - toDefaultsFile = domain: attrs: - pkgs.writeText "${domain}.plist" (lib.generators.toPlist { } attrs); - - toActivationCmd = domain: attrs: - "$DRY_RUN_CMD defaults import ${escapeShellArg domain} ${ - toDefaultsFile domain attrs - }"; - - nonNullDefaults = - mapAttrs (domain: attrs: (filterAttrs (n: v: v != null) attrs)) - cfg.defaults; - writableDefaults = filterAttrs (domain: attrs: attrs != { }) nonNullDefaults; - activationCmds = mapAttrsToList toActivationCmd writableDefaults; -in { - meta.maintainers = [ maintainers.midchildan ]; - - imports = [ ./fonts.nix ./keybindings.nix ./linkapps.nix ./search.nix ]; - - options.targets.darwin.defaults = mkOption { - type = types.submodule ./options.nix; - default = { }; - example = { - "com.apple.desktopservices" = { - DSDontWriteNetworkStores = true; - DSDontWriteUSBStores = true; - }; - }; - description = '' - Set macOS user defaults. Values set to null are - ignored. - - - - Some settings might require a re-login to take effect. - - - ''; - }; - - config = mkIf (activationCmds != [ ]) { - assertions = [ - (hm.assertions.assertPlatform "targets.darwin.defaults" pkgs - platforms.darwin) - ]; - - warnings = let - batteryPercentage = - attrByPath [ "com.apple.menuextra.battery" "ShowPercent" ] null - cfg.defaults; - webkitDevExtras = attrByPath [ - "com.apple.Safari" - "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" - ] null cfg.defaults; - in optional (batteryPercentage != null) '' - The option 'com.apple.menuextra.battery.ShowPercent' no longer works on - macOS 11 and later. Instead, open System Preferences, go to "Dock & - Menu Bar", select "Battery", and toggle the checkbox labeled "Show - Percentage." - '' ++ optional (webkitDevExtras != null) '' - The option 'com.apple.Safari.com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled' - is no longer present in recent versions of Safari. - ''; - - home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] '' - $VERBOSE_ECHO "Configuring macOS user defaults" - ${concatStringsSep "\n" activationCmds} - ''; - }; + imports = [ + ./user-defaults + ./fonts.nix + ./keybindings.nix + ./linkapps.nix + ./search.nix + ]; } diff --git a/third_party/home-manager/modules/targets/darwin/linkapps.nix b/third_party/home-manager/modules/targets/darwin/linkapps.nix index 118321e8f1..0d434234bb 100644 --- a/third_party/home-manager/modules/targets/darwin/linkapps.nix +++ b/third_party/home-manager/modules/targets/darwin/linkapps.nix @@ -1,9 +1,7 @@ { config, lib, pkgs, ... }: { - # Disabled for now due to conflicting behavior with nix-darwin. See - # https://github.com/nix-community/home-manager/issues/1341#issuecomment-687286866 - config = lib.mkIf (false && pkgs.stdenv.hostPlatform.isDarwin) { + config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { # Install MacOS applications to the user environment. home.file."Applications/Home Manager Apps".source = let apps = pkgs.buildEnv { diff --git a/third_party/home-manager/modules/targets/darwin/user-defaults/default.nix b/third_party/home-manager/modules/targets/darwin/user-defaults/default.nix new file mode 100644 index 0000000000..c44d4f9c42 --- /dev/null +++ b/third_party/home-manager/modules/targets/darwin/user-defaults/default.nix @@ -0,0 +1,112 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.targets.darwin; + + mkActivationCmds = isLocal: settings: + let + toDefaultsFile = domain: attrs: + pkgs.writeText "${domain}.plist" (lib.generators.toPlist { } attrs); + + cliFlags = lib.optionalString isLocal "-currentHost"; + + toActivationCmd = domain: attrs: + "$DRY_RUN_CMD /usr/bin/defaults ${cliFlags} import ${ + escapeShellArg domain + } ${toDefaultsFile domain attrs}"; + + nonNullDefaults = + mapAttrs (domain: attrs: (filterAttrs (n: v: v != null) attrs)) + settings; + + writableDefaults = + filterAttrs (domain: attrs: attrs != { }) nonNullDefaults; + in mapAttrsToList toActivationCmd writableDefaults; + + defaultsCmds = mkActivationCmds false cfg.defaults; + currentHostDefaultsCmds = mkActivationCmds true cfg.currentHostDefaults; + + activationCmds = defaultsCmds ++ currentHostDefaultsCmds; +in { + meta.maintainers = [ maintainers.midchildan ]; + + options.targets.darwin.defaults = mkOption { + type = types.submodule ./opts-allhosts.nix; + default = { }; + example = { + "com.apple.desktopservices" = { + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + }; + description = '' + Set macOS user defaults. Values set to null are + ignored. + + + + Some settings might require a re-login to take effect. + + + + + Some settings are only read from + . + + + ''; + }; + + options.targets.darwin.currentHostDefaults = mkOption { + type = types.submodule ./opts-currenthost.nix; + default = { }; + example = { + "com.apple.controlcenter" = { BatteryShowPercentage = true; }; + }; + description = '' + Set macOS user defaults. Unlike , + the preferences will only be applied to the currently logged-in host. This + distinction is important for networked accounts. + + Values set to null are ignored. + + + + Some settings might require a re-login to take effect. + + + ''; + }; + + config = mkIf (activationCmds != [ ]) { + assertions = [ + (hm.assertions.assertPlatform "targets.darwin.defaults" pkgs + platforms.darwin) + ]; + + warnings = let + batteryOptionName = '' + targets.darwin.currentHostDefaults."com.apple.controlcenter".BatteryShowPercentage''; + batteryPercentage = + attrByPath [ "com.apple.menuextra.battery" "ShowPercent" ] null + cfg.defaults; + webkitDevExtras = attrByPath [ + "com.apple.Safari" + "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" + ] null cfg.defaults; + in optional (batteryPercentage != null) '' + The option 'com.apple.menuextra.battery.ShowPercent' no longer works on + macOS 11 and later. Instead, use '${batteryOptionName}'. + '' ++ optional (webkitDevExtras != null) '' + The option 'com.apple.Safari.com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled' + is no longer present in recent versions of Safari. + ''; + + home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] '' + $VERBOSE_ECHO "Configuring macOS user defaults" + ${concatStringsSep "\n" activationCmds} + ''; + }; +} diff --git a/third_party/home-manager/modules/targets/darwin/options.nix b/third_party/home-manager/modules/targets/darwin/user-defaults/opts-allhosts.nix similarity index 96% rename from third_party/home-manager/modules/targets/darwin/options.nix rename to third_party/home-manager/modules/targets/darwin/user-defaults/opts-allhosts.nix index 65ce4e0114..832318a9d2 100644 --- a/third_party/home-manager/modules/targets/darwin/options.nix +++ b/third_party/home-manager/modules/targets/darwin/user-defaults/opts-allhosts.nix @@ -50,7 +50,7 @@ in { AppleMetricUnits = mkNullableEnableOption "the metric system"; NSAutomaticCapitalizationEnabled = - mkNullableEnableOption "automatic captilization"; + mkNullableEnableOption "automatic capitalization"; NSAutomaticDashSubstitutionEnabled = mkNullableEnableOption "smart dashes"; @@ -99,9 +99,8 @@ in { type = types.enum [ "YES" "NO" ]; example = "NO"; description = '' - This option no longer works on macOS 11 and later. Instead, open System - Preferences, go to "Dock & Menu Bar", select "Battery", and toggle - the checkbox labeled "Show Percentage." + This option no longer works on macOS 11 and later. Instead, use + . Whether to show battery percentage in the menu bar. ''; diff --git a/third_party/home-manager/modules/targets/darwin/user-defaults/opts-currenthost.nix b/third_party/home-manager/modules/targets/darwin/user-defaults/opts-currenthost.nix new file mode 100644 index 0000000000..129f91487a --- /dev/null +++ b/third_party/home-manager/modules/targets/darwin/user-defaults/opts-currenthost.nix @@ -0,0 +1,29 @@ +{ config, lib, ... }: + +let + mkNullableOption = args: + lib.mkOption (args // { + type = lib.types.nullOr args.type; + default = null; + }); + + mkNullableEnableOption = name: + lib.mkOption { + type = with lib.types; nullOr bool; + default = null; + example = true; + description = "Whether to enable ${name}."; + }; +in { + freeformType = with lib.types; attrsOf (attrsOf anything); + + options = { + "com.apple.controlcenter".BatteryShowPercentage = mkNullableOption { + type = lib.types.bool; + example = true; + description = '' + Whether to show battery percentage in the menu bar. + ''; + }; + }; +} diff --git a/third_party/home-manager/modules/targets/generic-linux.nix b/third_party/home-manager/modules/targets/generic-linux.nix index 9132d8898b..b5a07d5fac 100644 --- a/third_party/home-manager/modules/targets/generic-linux.nix +++ b/third_party/home-manager/modules/targets/generic-linux.nix @@ -8,6 +8,8 @@ let profileDirectory = config.home.profileDirectory; + nixPkg = if config.nix.package == null then pkgs.nix else config.nix.package; + in { imports = [ (mkRenamedOptionModule [ "targets" "genericLinux" "extraXdgDataDirs" ] [ @@ -43,8 +45,19 @@ in { "/var/lib/snapd/desktop" ]; + # We need to append system-wide FHS directories due to the default prefix + # resolving to the Nix store. + # https://github.com/nix-community/home-manager/pull/2891#issuecomment-1101064521 + home.sessionVariables = { + XCURSOR_PATH = "$XCURSOR_PATH\${XCURSOR_PATH:+:}" + concatStringsSep ":" [ + "${config.home.profileDirectory}/share/icons" + "/usr/share/icons" + "/usr/share/pixmaps" + ]; + }; + home.sessionVariablesExtra = '' - . "${pkgs.nix}/etc/profile.d/nix.sh" + . "${nixPkg}/etc/profile.d/nix.sh" # reset TERM with new TERMINFO available (if any) export TERM="$TERM" @@ -53,7 +66,7 @@ in { # We need to source both nix.sh and hm-session-vars.sh as noted in # https://github.com/nix-community/home-manager/pull/797#issuecomment-544783247 programs.bash.initExtra = '' - . "${pkgs.nix}/etc/profile.d/nix.sh" + . "${nixPkg}/etc/profile.d/nix.sh" . "${profileDirectory}/etc/profile.d/hm-session-vars.sh" ''; diff --git a/third_party/home-manager/modules/xcursor.nix b/third_party/home-manager/modules/xcursor.nix deleted file mode 100644 index 3ec2a354db..0000000000 --- a/third_party/home-manager/modules/xcursor.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.xsession.pointerCursor; - - cursorType = types.submodule { - options = { - package = mkOption { - type = types.package; - example = literalExpression "pkgs.vanilla-dmz"; - description = "Package providing the cursor theme."; - }; - - name = mkOption { - type = types.str; - example = "Vanilla-DMZ"; - description = "The cursor name within the package."; - }; - - size = mkOption { - type = types.int; - default = 32; - example = 64; - description = "The cursor size."; - }; - - defaultCursor = mkOption { - type = types.str; - default = "left_ptr"; - example = "X_cursor"; - description = "The default cursor file to use within the package."; - }; - }; - }; - -in { - meta.maintainers = [ maintainers.league ]; - - options = { - xsession.pointerCursor = mkOption { - type = types.nullOr cursorType; - default = null; - description = '' - The X cursor theme and settings. The package - xorg.xcursorthemes contains cursors named - whiteglass, redglass, and handhelds. The package - vanilla-dmz contains cursors named Vanilla-DMZ - and Vanilla-DMZ-AA. Note: handhelds does not seem to work at - custom sizes. - ''; - }; - }; - - config = mkIf (cfg != null) { - assertions = [ - (hm.assertions.assertPlatform "xsession.pointerCursor" pkgs - platforms.linux) - ]; - - home.packages = [ cfg.package ]; - - xsession.initExtra = '' - ${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cfg.package}/share/icons/${cfg.name}/cursors/${cfg.defaultCursor} ${ - toString cfg.size - } - ''; - - xresources.properties = { - "Xcursor.theme" = cfg.name; - "Xcursor.size" = cfg.size; - }; - - gtk.gtk2.extraConfig = '' - gtk-cursor-theme-name="${cfg.name}" - gtk-cursor-theme-size=${toString cfg.size} - ''; - - gtk.gtk3.extraConfig = { - "gtk-cursor-theme-name" = cfg.name; - "gtk-cursor-theme-size" = cfg.size; - }; - - # Set name in icons theme, for compatibility with AwesomeWM etc. See: - # https://github.com/nix-community/home-manager/issues/2081 - # https://wiki.archlinux.org/title/Cursor_themes#XDG_specification - home.file.".icons/default/index.theme".text = '' - [icon theme] - Name=Default - Comment=Default Cursor Theme - Inherits=${cfg.name} - ''; - }; -} diff --git a/third_party/home-manager/modules/xsession.nix b/third_party/home-manager/modules/xsession.nix index 35e517a021..7ba9b54e93 100644 --- a/third_party/home-manager/modules/xsession.nix +++ b/third_party/home-manager/modules/xsession.nix @@ -126,6 +126,29 @@ in { in "${pkgs.xorg.setxkbmap}/bin/setxkbmap ${toString args}"; }; }; + + xplugd = { + Unit = { + Description = "Rerun setxkbmap.service when I/O is changed"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { + Type = "forking"; + ExecStart = let + script = pkgs.writeShellScript "xplugrc" '' + case "$1,$3" in + keyboard,connected) + systemctl --user restart setxkbmap.service + ;; + esac + ''; + in "${pkgs.xplugd}/bin/xplugd ${script}"; + }; + }; }; targets = { diff --git a/third_party/home-manager/nix-darwin/default.nix b/third_party/home-manager/nix-darwin/default.nix index 8d354a1d5d..018e9bab62 100644 --- a/third_party/home-manager/nix-darwin/default.nix +++ b/third_party/home-manager/nix-darwin/default.nix @@ -6,136 +6,26 @@ let cfg = config.home-manager; - extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib; +in { + imports = [ ../nixos/common.nix ]; - hmModule = types.submoduleWith { - specialArgs = { - lib = extendedLib; - darwinConfig = config; - osConfig = config; - modulesPath = ../modules; - } // cfg.extraSpecialArgs; - modules = [ - ({ name, ... }: { - imports = import ../modules/modules.nix { - inherit pkgs; - lib = extendedLib; - useNixpkgsModule = !cfg.useGlobalPkgs; - }; - - config = { - submoduleSupport.enable = true; - submoduleSupport.externalPackageInstall = cfg.useUserPackages; - - home.username = config.users.users.${name}.name; - home.homeDirectory = config.users.users.${name}.home; - }; - }) - ] ++ cfg.sharedModules; - }; - -in - -{ - options = { - home-manager = { - useUserPackages = mkEnableOption '' - installation of user packages through the - option. - ''; - - useGlobalPkgs = mkEnableOption '' - using the system configuration's pkgs - argument in Home Manager. This disables the Home Manager - options - ''; - - backupFileExtension = mkOption { - type = types.nullOr types.str; - default = null; - example = "backup"; - description = '' - On activation move existing files by appending the given - file extension rather than exiting with an error. - ''; - }; - - extraSpecialArgs = mkOption { - type = types.attrs; - default = { }; - example = literalExpression "{ inherit emacs-overlay; }"; - description = '' - Extra specialArgs passed to Home Manager. This - option can be used to pass additional arguments to all modules. - ''; - }; - - sharedModules = mkOption { - type = with types; - # TODO: use types.raw once this PR is merged: https://github.com/NixOS/nixpkgs/pull/132448 - listOf (mkOptionType { - name = "submodule"; - inherit (submodule { }) check; - merge = lib.options.mergeOneOption; - description = "Home Manager modules"; - }); - default = [ ]; - example = literalExpression "[ { home.packages = [ nixpkgs-fmt ]; } ]"; - description = '' - Extra modules added to all users. - ''; - }; - - verbose = mkEnableOption "verbose output on activation"; - - users = mkOption { - type = types.attrsOf hmModule; - default = {}; - # Set as not visible to prevent the entire submodule being included in - # the documentation. - visible = false; - description = '' - Per-user Home Manager configuration. - ''; - }; - }; - }; - - config = mkIf (cfg.users != {}) { - warnings = - flatten (flip mapAttrsToList cfg.users (user: config: - flip map config.warnings (warning: - "${user} profile: ${warning}" - ) - )); - - assertions = - flatten (flip mapAttrsToList cfg.users (user: config: - flip map config.assertions (assertion: - { - inherit (assertion) assertion; - message = "${user} profile: ${assertion.message}"; + config = mkMerge [ + { home-manager.extraSpecialArgs.darwinConfig = config; } + (mkIf (cfg.users != { }) { + system.activationScripts.postActivation.text = concatStringsSep "\n" + (mapAttrsToList (username: usercfg: '' + echo Activating home-manager configuration for ${username} + sudo -u ${username} --set-home ${ + pkgs.writeShellScript "activation-${username}" '' + ${lib.optionalString (cfg.backupFileExtension != null) + "export HOME_MANAGER_BACKUP_EXT=${ + lib.escapeShellArg cfg.backupFileExtension + }"} + ${lib.optionalString cfg.verbose "export VERBOSE=1"} + exec ${usercfg.home.activationPackage}/activate + '' } - ) - )); - - users.users = mkIf cfg.useUserPackages ( - mapAttrs (username: usercfg: { - packages = [ usercfg.home.path ]; - }) cfg.users - ); - - environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ]; - - system.activationScripts.postActivation.text = - concatStringsSep "\n" (mapAttrsToList (username: usercfg: '' - echo Activating home-manager configuration for ${username} - sudo -u ${username} -i ${pkgs.writeShellScript "activation-${username}" '' - ${lib.optionalString (cfg.backupFileExtension != null) - "export HOME_MANAGER_BACKUP_EXT=${lib.escapeShellArg cfg.backupFileExtension}"} - ${lib.optionalString cfg.verbose "export VERBOSE=1"} - exec ${usercfg.home.activationPackage}/activate - ''} - '') cfg.users); - }; + '') cfg.users); + }) + ]; } diff --git a/third_party/home-manager/nixos/common.nix b/third_party/home-manager/nixos/common.nix new file mode 100644 index 0000000000..25872b2544 --- /dev/null +++ b/third_party/home-manager/nixos/common.nix @@ -0,0 +1,115 @@ +# This module is the common base for the NixOS and nix-darwin modules. +# For OS-specific configuration, please edit nixos/default.nix or nix-darwin/default.nix instead. + +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.home-manager; + + extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib; + + hmModule = types.submoduleWith { + description = "Home Manager module"; + specialArgs = { + lib = extendedLib; + osConfig = config; + modulesPath = builtins.toString ../modules; + } // cfg.extraSpecialArgs; + modules = [ + ({ name, ... }: { + imports = import ../modules/modules.nix { + inherit pkgs; + lib = extendedLib; + useNixpkgsModule = !cfg.useGlobalPkgs; + }; + + config = { + submoduleSupport.enable = true; + submoduleSupport.externalPackageInstall = cfg.useUserPackages; + + home.username = config.users.users.${name}.name; + home.homeDirectory = config.users.users.${name}.home; + + # Make activation script use same version of Nix as system as a whole. + # This avoids problems with Nix not being in PATH. + nix.package = config.nix.package; + }; + }) + ] ++ cfg.sharedModules; + }; + +in { + options.home-manager = { + useUserPackages = mkEnableOption '' + installation of user packages through the + option + ''; + + useGlobalPkgs = mkEnableOption '' + using the system configuration's pkgs + argument in Home Manager. This disables the Home Manager + options + ''; + + backupFileExtension = mkOption { + type = types.nullOr types.str; + default = null; + example = "backup"; + description = '' + On activation move existing files by appending the given + file extension rather than exiting with an error. + ''; + }; + + extraSpecialArgs = mkOption { + type = types.attrs; + default = { }; + example = literalExpression "{ inherit emacs-overlay; }"; + description = '' + Extra specialArgs passed to Home Manager. This + option can be used to pass additional arguments to all modules. + ''; + }; + + sharedModules = mkOption { + type = with types; listOf raw; + default = [ ]; + example = literalExpression "[ { home.packages = [ nixpkgs-fmt ]; } ]"; + description = '' + Extra modules added to all users. + ''; + }; + + verbose = mkEnableOption "verbose output on activation"; + + users = mkOption { + type = types.attrsOf hmModule; + default = { }; + # Prevent the entire submodule being included in the documentation. + visible = "shallow"; + description = '' + Per-user Home Manager configuration. + ''; + }; + }; + + config = mkIf (cfg.users != { }) { + warnings = flatten (flip mapAttrsToList cfg.users (user: config: + flip map config.warnings (warning: "${user} profile: ${warning}"))); + + assertions = flatten (flip mapAttrsToList cfg.users (user: config: + flip map config.assertions (assertion: { + inherit (assertion) assertion; + message = "${user} profile: ${assertion.message}"; + }))); + + users.users = mkIf cfg.useUserPackages + (mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; }) + cfg.users); + + environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ]; + }; +} diff --git a/third_party/home-manager/nixos/default.nix b/third_party/home-manager/nixos/default.nix index e8225d9845..f8a5d64261 100644 --- a/third_party/home-manager/nixos/default.nix +++ b/third_party/home-manager/nixos/default.nix @@ -6,180 +6,80 @@ let cfg = config.home-manager; - extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib; - - hmModule = types.submoduleWith { - specialArgs = { - lib = extendedLib; - nixosConfig = config; - osConfig = config; - modulesPath = ../modules; - } // cfg.extraSpecialArgs; - modules = [ - ({ name, ... }: { - imports = import ../modules/modules.nix { - inherit pkgs; - lib = extendedLib; - useNixpkgsModule = !cfg.useGlobalPkgs; - }; - - config = { - submoduleSupport.enable = true; - submoduleSupport.externalPackageInstall = cfg.useUserPackages; - - # The per-user directory inside /etc/profiles is not known by - # fontconfig by default. - fonts.fontconfig.enable = cfg.useUserPackages - && config.fonts.fontconfig.enable; - - home.username = config.users.users.${name}.name; - home.homeDirectory = config.users.users.${name}.home; - - # Make activation script use same version of Nix as system as a whole. - # This avoids problems with Nix not being in PATH. - home.extraActivationPath = [ config.nix.package ]; - }; - }) - ] ++ cfg.sharedModules; - }; - serviceEnvironment = optionalAttrs (cfg.backupFileExtension != null) { HOME_MANAGER_BACKUP_EXT = cfg.backupFileExtension; } // optionalAttrs cfg.verbose { VERBOSE = "1"; }; in { - options = { - home-manager = { - useUserPackages = mkEnableOption '' - installation of user packages through the - option. - ''; + imports = [ ./common.nix ]; - useGlobalPkgs = mkEnableOption '' - using the system configuration's pkgs - argument in Home Manager. This disables the Home Manager - options - ''; + config = mkMerge [ + { + home-manager = { + extraSpecialArgs.nixosConfig = config; - backupFileExtension = mkOption { - type = types.nullOr types.str; - default = null; - example = "backup"; - description = '' - On activation move existing files by appending the given - file extension rather than exiting with an error. - ''; + sharedModules = [{ + # The per-user directory inside /etc/profiles is not known by + # fontconfig by default. + fonts.fontconfig.enable = lib.mkDefault + (cfg.useUserPackages && config.fonts.fontconfig.enable); + }]; }; + } + (mkIf (cfg.users != { }) { + systemd.services = mapAttrs' (_: usercfg: + let username = usercfg.home.username; + in nameValuePair ("home-manager-${utils.escapeSystemdPath username}") { + description = "Home Manager environment for ${username}"; + wantedBy = [ "multi-user.target" ]; + wants = [ "nix-daemon.socket" ]; + after = [ "nix-daemon.socket" ]; + before = [ "systemd-user-sessions.service" ]; - extraSpecialArgs = mkOption { - type = types.attrs; - default = { }; - example = literalExpression "{ inherit emacs-overlay; }"; - description = '' - Extra specialArgs passed to Home Manager. This - option can be used to pass additional arguments to all modules. - ''; - }; + environment = serviceEnvironment; - sharedModules = mkOption { - type = with types; - # TODO: use types.raw once this PR is merged: https://github.com/NixOS/nixpkgs/pull/132448 - listOf (mkOptionType { - name = "submodule"; - inherit (submodule { }) check; - merge = lib.options.mergeOneOption; - description = "Home Manager modules"; - }); - default = [ ]; - example = literalExpression "[ { home.packages = [ nixpkgs-fmt ]; } ]"; - description = '' - Extra modules added to all users. - ''; - }; + unitConfig = { RequiresMountsFor = usercfg.home.homeDirectory; }; - verbose = mkEnableOption "verbose output on activation"; + stopIfChanged = false; - users = mkOption { - type = types.attrsOf hmModule; - default = { }; - # Set as not visible to prevent the entire submodule being included in - # the documentation. - visible = false; - description = '' - Per-user Home Manager configuration. - ''; - }; - }; - }; + serviceConfig = { + User = usercfg.home.username; + Type = "oneshot"; + RemainAfterExit = "yes"; + TimeoutStartSec = 90; + SyslogIdentifier = "hm-activate-${username}"; - config = mkIf (cfg.users != { }) { - warnings = flatten (flip mapAttrsToList cfg.users (user: config: - flip map config.warnings (warning: "${user} profile: ${warning}"))); + ExecStart = let + systemctl = + "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$UID} systemctl"; - assertions = flatten (flip mapAttrsToList cfg.users (user: config: - flip map config.assertions (assertion: { - inherit (assertion) assertion; - message = "${user} profile: ${assertion.message}"; - }))); + sed = "${pkgs.gnused}/bin/sed"; - users.users = mkIf cfg.useUserPackages - (mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; }) - cfg.users); + exportedSystemdVariables = concatStringsSep "|" [ + "DBUS_SESSION_BUS_ADDRESS" + "DISPLAY" + "WAYLAND_DISPLAY" + "XAUTHORITY" + "XDG_RUNTIME_DIR" + ]; - environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ]; + setupEnv = pkgs.writeScript "hm-setup-env" '' + #! ${pkgs.runtimeShell} -el - systemd.services = mapAttrs' (_: usercfg: - let username = usercfg.home.username; - in nameValuePair ("home-manager-${utils.escapeSystemdPath username}") { - description = "Home Manager environment for ${username}"; - wantedBy = [ "multi-user.target" ]; - wants = [ "nix-daemon.socket" ]; - after = [ "nix-daemon.socket" ]; - before = [ "systemd-user-sessions.service" ]; + # The activation script is run by a login shell to make sure + # that the user is given a sane environment. + # If the user is logged in, import variables from their current + # session environment. + eval "$( + ${systemctl} --user show-environment 2> /dev/null \ + | ${sed} -En '/^(${exportedSystemdVariables})=/s/^/export /p' + )" - environment = serviceEnvironment; - - unitConfig = { RequiresMountsFor = usercfg.home.homeDirectory; }; - - stopIfChanged = false; - - serviceConfig = { - User = usercfg.home.username; - Type = "oneshot"; - RemainAfterExit = "yes"; - TimeoutStartSec = 90; - SyslogIdentifier = "hm-activate-${username}"; - - ExecStart = let - systemctl = - "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$UID} systemctl"; - - sed = "${pkgs.gnused}/bin/sed"; - - exportedSystemdVariables = concatStringsSep "|" [ - "DBUS_SESSION_BUS_ADDRESS" - "DISPLAY" - "WAYLAND_DISPLAY" - "XAUTHORITY" - "XDG_RUNTIME_DIR" - ]; - - setupEnv = pkgs.writeScript "hm-setup-env" '' - #! ${pkgs.runtimeShell} -el - - # The activation script is run by a login shell to make sure - # that the user is given a sane environment. - # If the user is logged in, import variables from their current - # session environment. - eval "$( - ${systemctl} --user show-environment 2> /dev/null \ - | ${sed} -En '/^(${exportedSystemdVariables})=/s/^/export /p' - )" - - exec "$1/activate" - ''; - in "${setupEnv} ${usercfg.home.activationPackage}"; - }; - }) cfg.users; - }; + exec "$1/activate" + ''; + in "${setupEnv} ${usercfg.home.activationPackage}"; + }; + }) cfg.users; + }) + ]; } diff --git a/third_party/home-manager/overlay.nix b/third_party/home-manager/overlay.nix index 35136cc855..78fcb60ce3 100644 --- a/third_party/home-manager/overlay.nix +++ b/third_party/home-manager/overlay.nix @@ -1,3 +1,3 @@ -self: super: { - home-manager = super.callPackage ./home-manager { path = toString ./.; }; +final: prev: { + home-manager = prev.callPackage ./home-manager { path = toString ./.; }; } diff --git a/third_party/home-manager/templates/nix-darwin/flake.nix b/third_party/home-manager/templates/nix-darwin/flake.nix new file mode 100644 index 0000000000..ff73efd8fd --- /dev/null +++ b/third_party/home-manager/templates/nix-darwin/flake.nix @@ -0,0 +1,31 @@ +{ + description = "Darwin configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + darwin.url = "github:lnl7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ nixpkgs, home-manager, darwin, ... }: { + darwinConfigurations = { + hostname = darwin.lib.darwinSystem { + system = "x86_64-darwin"; + modules = [ + ./configuration.nix + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jdoe = import ./home.nix; + + # Optionally, use home-manager.extraSpecialArgs to pass + # arguments to home.nix + } + ]; + }; + }; + }; +} diff --git a/third_party/home-manager/templates/nixos/flake.nix b/third_party/home-manager/templates/nixos/flake.nix new file mode 100644 index 0000000000..fd4d0cd472 --- /dev/null +++ b/third_party/home-manager/templates/nixos/flake.nix @@ -0,0 +1,29 @@ +{ + description = "NixOS configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ nixpkgs, home-manager, ... }: { + nixosConfigurations = { + hostname = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jdoe = import ./home.nix; + + # Optionally, use home-manager.extraSpecialArgs to pass + # arguments to home.nix + } + ]; + }; + }; + }; +} diff --git a/third_party/home-manager/templates/standalone/flake.nix b/third_party/home-manager/templates/standalone/flake.nix new file mode 100644 index 0000000000..c35ca3fa2c --- /dev/null +++ b/third_party/home-manager/templates/standalone/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Home Manager configuration of Jane Doe"; + + inputs = { + # Specify the source of Home Manager and Nixpkgs. + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, home-manager, ... }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + homeConfigurations.jdoe = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ ./home.nix ]; + + # Optionally use extraSpecialArgs + # to pass through arguments to home.nix + }; + }; +} diff --git a/third_party/home-manager/tests/big-test.nix b/third_party/home-manager/tests/big-test.nix new file mode 100644 index 0000000000..421eaebbd8 --- /dev/null +++ b/third_party/home-manager/tests/big-test.nix @@ -0,0 +1,13 @@ +{ lib, ... }: + +{ + options.test.enableBig = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Whether to enable big tests. These are tests that require + more resources than typical tests. For example, tests that depend on large + packages or tests that take long to run. + ''; + }; +} diff --git a/third_party/home-manager/tests/default.nix b/third_party/home-manager/tests/default.nix index 6b21e355dd..ac31f3b50a 100644 --- a/third_party/home-manager/tests/default.nix +++ b/third_party/home-manager/tests/default.nix @@ -4,11 +4,10 @@ let lib = import ../modules/lib/stdlib-extended.nix pkgs.lib; - nmt = pkgs.fetchFromGitLab { - owner = "rycee"; - repo = "nmt"; - rev = "89924d8e6e0fcf866a11324d32c6bcaa89cda506"; - sha256 = "02wzrbmpdpgig58a1rhz8sb0p2rvbapnlcmhi4d4bi8w9md6pmdl"; + nmt = fetchTarball { + url = + "https://gitlab.com/api/v4/projects/rycee%2Fnmt/repository/archive.tar.gz?sha=d83601002c99b78c89ea80e5e6ba21addcfe12ae"; + sha256 = "1xzwwxygzs1cmysg97hzd285r7n1g1lwx5y1ar68gwq07a1rczmv"; }; modules = import ../modules/modules.nix { @@ -16,17 +15,26 @@ let check = false; } ++ [ { + # Bypass reference inside modules/modules.nix to make the test + # suite more pure. + _module.args.pkgsPath = pkgs.path; + # Fix impurities. Without these some of the user's environment # will leak into the tests through `builtins.getEnv`. xdg.enable = true; - home.username = "hm-user"; - home.homeDirectory = "/home/hm-user"; + home = { + username = "hm-user"; + homeDirectory = "/home/hm-user"; + stateVersion = lib.mkDefault "18.09"; + }; # Avoid including documentation since this will cause # unnecessary rebuilds of the tests. manual.manpages.enable = false; - imports = [ ./asserts.nix ./stubs.nix ]; + imports = [ ./asserts.nix ./big-test.nix ./stubs.nix ]; + + test.enableBig = enableBig; } ]; @@ -43,6 +51,9 @@ import nmt { ./modules/files ./modules/home-environment ./modules/misc/fontconfig + ./modules/misc/nix + ./modules/misc/specialization + ./modules/programs/aerc ./modules/programs/alacritty ./modules/programs/alot ./modules/programs/aria2 @@ -53,17 +64,23 @@ import nmt { ./modules/programs/bottom ./modules/programs/broot ./modules/programs/browserpass + ./modules/programs/btop ./modules/programs/dircolors ./modules/programs/direnv + ./modules/programs/emacs ./modules/programs/feh ./modules/programs/fish + ./modules/programs/gallery-dl ./modules/programs/gh ./modules/programs/git ./modules/programs/gpg + ./modules/programs/helix ./modules/programs/himalaya ./modules/programs/htop + ./modules/programs/hyfetch ./modules/programs/i3status ./modules/programs/irssi + ./modules/programs/k9s ./modules/programs/kakoune ./modules/programs/kitty ./modules/programs/less @@ -71,36 +88,53 @@ import nmt { ./modules/programs/lieer ./modules/programs/man ./modules/programs/mbsync + ./modules/programs/micro ./modules/programs/mpv + ./modules/programs/mu + ./modules/programs/mujmap ./modules/programs/ncmpcpp ./modules/programs/ne ./modules/programs/neomutt ./modules/programs/newsboat + ./modules/programs/nheko ./modules/programs/nix-index ./modules/programs/nnn ./modules/programs/nushell + ./modules/programs/oh-my-posh + ./modules/programs/pandoc ./modules/programs/pet + ./modules/programs/pistol + ./modules/programs/pls ./modules/programs/powerline-go + ./modules/programs/pubs ./modules/programs/qutebrowser ./modules/programs/readline + ./modules/programs/sagemath ./modules/programs/sbt ./modules/programs/scmpuff + ./modules/programs/sioyek ./modules/programs/sm64ex ./modules/programs/ssh ./modules/programs/starship ./modules/programs/taskwarrior ./modules/programs/texlive + ./modules/programs/tmate ./modules/programs/tmux ./modules/programs/topgrade ./modules/programs/vscode + ./modules/programs/watson + ./modules/programs/wezterm ./modules/programs/zplug ./modules/programs/zsh ./modules/xresources ] ++ lib.optionals isDarwin [ + ./modules/launchd ./modules/targets-darwin ] ++ lib.optionals isLinux [ ./modules/config/i18n ./modules/i18n/input-method + ./modules/misc/debug + ./modules/misc/editorconfig ./modules/misc/gtk ./modules/misc/numlock ./modules/misc/pam @@ -109,50 +143,71 @@ import nmt { ./modules/misc/xsession ./modules/programs/abook ./modules/programs/autorandr + ./modules/programs/borgmatic + ./modules/programs/firefox ./modules/programs/foot ./modules/programs/getmail ./modules/programs/gnome-terminal ./modules/programs/hexchat ./modules/programs/i3status-rust + ./modules/programs/kodi + ./modules/programs/looking-glass-client ./modules/programs/mangohud ./modules/programs/ncmpcpp-linux ./modules/programs/neovim # Broken package dependency on Darwin. ./modules/programs/rbw ./modules/programs/rofi ./modules/programs/rofi-pass + ./modules/programs/swaylock ./modules/programs/terminator + ./modules/programs/thunderbird ./modules/programs/waybar ./modules/programs/xmobar + ./modules/programs/yt-dlp ./modules/services/barrier + ./modules/services/borgmatic + ./modules/services/cachix-agent + ./modules/services/clipman ./modules/services/devilspie2 ./modules/services/dropbox ./modules/services/emacs + ./modules/services/espanso ./modules/services/flameshot ./modules/services/fluidsynth ./modules/services/fnott + ./modules/services/fusuma ./modules/services/git-sync + ./modules/services/gpg-agent + ./modules/services/gromit-mpx + ./modules/services/home-manager-auto-upgrade ./modules/services/kanshi ./modules/services/lieer + ./modules/services/mopidy + ./modules/services/mpd + ./modules/services/mpdris2 ./modules/services/pantalaimon + ./modules/services/parcellite ./modules/services/pbgopy + ./modules/services/picom ./modules/services/playerctld ./modules/services/polybar + ./modules/services/recoll ./modules/services/redshift-gammastep ./modules/services/screen-locker + ./modules/services/swayidle ./modules/services/sxhkd ./modules/services/syncthing ./modules/services/trayer + ./modules/services/twmn + ./modules/services/udiskie ./modules/services/window-managers/bspwm + ./modules/services/window-managers/herbstluftwm ./modules/services/window-managers/i3 + ./modules/services/window-managers/spectrwm ./modules/services/window-managers/sway ./modules/services/wlsunset ./modules/services/xsettingsd ./modules/systemd ./modules/targets-linux - ] ++ lib.optionals enableBig [ - ./modules/programs/emacs - ] ++ lib.optionals (enableBig && isLinux) [ - ./modules/misc/debug - ./modules/programs/firefox ]); } diff --git a/third_party/home-manager/tests/lib/types/dag-merge-result.txt b/third_party/home-manager/tests/lib/types/dag-merge-result.txt index 9779ef13c0..0330161e67 100644 --- a/third_party/home-manager/tests/lib/types/dag-merge-result.txt +++ b/third_party/home-manager/tests/lib/types/dag-merge-result.txt @@ -1,3 +1,4 @@ before:before +merged:left,middle,middle,right between:between after:after diff --git a/third_party/home-manager/tests/lib/types/dag-merge.nix b/third_party/home-manager/tests/lib/types/dag-merge.nix index 5e361cd7e7..5d502924aa 100644 --- a/third_party/home-manager/tests/lib/types/dag-merge.nix +++ b/third_party/home-manager/tests/lib/types/dag-merge.nix @@ -1,7 +1,8 @@ { config, lib, pkgs, ... }: let - inherit (lib) concatStringsSep hm mkMerge mkOption types; + inherit (lib) + concatStringsSep hm mkIf mkMerge mkBefore mkAfter mkOption types; dag = lib.hm.dag; @@ -11,13 +12,22 @@ let in concatStringsSep "\n" data + "\n"; in { - options.tested.dag = mkOption { type = hm.types.dagOf types.str; }; + options.tested.dag = mkOption { type = hm.types.dagOf types.commas; }; config = { - tested = mkMerge [ - { dag.after = "after"; } - { dag.before = dag.entryBefore [ "after" ] "before"; } - { dag.between = dag.entryBetween [ "after" ] [ "before" ] "between"; } + tested.dag = mkMerge [ + (mkIf false { never = "never"; }) + { never2 = mkIf false "never2"; } + { after = mkMerge [ "after" (mkIf false "neither") ]; } + { before = dag.entryBefore [ "after" ] (mkIf true "before"); } + { + between = + mkIf true (dag.entryBetween [ "after" ] [ "before" ] "between"); + } + { merged = dag.entryBefore [ "between" ] "middle"; } + { merged = mkBefore "left"; } + { merged = dag.entryBetween [ "after" ] [ "before" ] (mkAfter "right"); } + { merged = dag.entryBefore [ "between" ] "middle"; } ]; home.file."result.txt".text = result; diff --git a/third_party/home-manager/tests/lib/types/gvariant-merge.nix b/third_party/home-manager/tests/lib/types/gvariant-merge.nix index c4de6827f8..5a04848a50 100644 --- a/third_party/home-manager/tests/lib/types/gvariant-merge.nix +++ b/third_party/home-manager/tests/lib/types/gvariant-merge.nix @@ -50,6 +50,11 @@ in { { maybe1 = mkNothing type.string; } { maybe2 = mkJust (mkUint32 4); } + + { variant1 = mkVariant "foo"; } + { variant2 = mkVariant 42; } + + { dictionaryEntry = mkDictionaryEntry [ 1 [ "foo" ] ]; } ]; home.file."result.txt".text = let @@ -65,6 +70,7 @@ in { array1 = @as ['one','two'] array2 = @au [1,2] bool = true + dictionaryEntry = @{ias} {1,@as ['foo']} emptyArray1 = @as [] emptyArray2 = @au [] escapedString = '\'\\\n' @@ -79,6 +85,8 @@ in { uint16 = @q 42 uint32 = @u 42 uint64 = @t 42 + variant1 = @v <'foo'> + variant2 = @v <42> '' } ''; diff --git a/third_party/home-manager/tests/modules/home-environment/session-variables.nix b/third_party/home-manager/tests/modules/home-environment/session-variables.nix index eae7830f35..08c988d2bb 100644 --- a/third_party/home-manager/tests/modules/home-environment/session-variables.nix +++ b/third_party/home-manager/tests/modules/home-environment/session-variables.nix @@ -31,7 +31,8 @@ let export XDG_STATE_HOME="/home/hm-user/.local/state" ''; - expected = pkgs.writeText "expected" (if isDarwin then darwinExpected else linuxExpected); + expected = pkgs.writeText "expected" + (if isDarwin then darwinExpected else linuxExpected); in { config = { diff --git a/third_party/home-manager/tests/modules/i18n/input-method/default.nix b/third_party/home-manager/tests/modules/i18n/input-method/default.nix index f214d85136..a9d5764dfd 100644 --- a/third_party/home-manager/tests/modules/i18n/input-method/default.nix +++ b/third_party/home-manager/tests/modules/i18n/input-method/default.nix @@ -1 +1,4 @@ -{ input-method-fcitx5-configuration = ./fcitx5-configuration.nix; } +{ + input-method-fcitx5-configuration = ./fcitx5-configuration.nix; + input-method-kime-configuration = ./kime-configuration.nix; +} diff --git a/third_party/home-manager/tests/modules/i18n/input-method/kime-configuration.nix b/third_party/home-manager/tests/modules/i18n/input-method/kime-configuration.nix new file mode 100644 index 0000000000..fe50273fbc --- /dev/null +++ b/third_party/home-manager/tests/modules/i18n/input-method/kime-configuration.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + i18n.inputMethod = { + enabled = "kime"; + kime.config = { engine = { hangul = { layout = "dubeolsik"; }; }; }; + }; + + test.stubs.kime = { outPath = null; }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/kime-daemon.service + ''; +} diff --git a/third_party/home-manager/tests/modules/launchd/agents.nix b/third_party/home-manager/tests/modules/launchd/agents.nix new file mode 100644 index 0000000000..cbcff6b5a2 --- /dev/null +++ b/third_party/home-manager/tests/modules/launchd/agents.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + launchd.agents."test-service" = { + enable = true; + config = { + ProgramArguments = [ "/some/command" "--with-arguments" "foo" ]; + KeepAlive = { + Crashed = true; + SuccessfulExit = false; + }; + ProcessType = "Background"; + }; + }; + + nmt.script = '' + serviceFile=LaunchAgents/org.nix-community.home.test-service.plist + assertFileExists $serviceFile + assertFileContent $serviceFile ${./expected-agent.plist} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/launchd/default.nix b/third_party/home-manager/tests/modules/launchd/default.nix new file mode 100644 index 0000000000..09549ee7b3 --- /dev/null +++ b/third_party/home-manager/tests/modules/launchd/default.nix @@ -0,0 +1 @@ +{ launchd-agents = ./agents.nix; } diff --git a/third_party/home-manager/tests/modules/launchd/expected-agent.plist b/third_party/home-manager/tests/modules/launchd/expected-agent.plist new file mode 100644 index 0000000000..c56ad4da44 --- /dev/null +++ b/third_party/home-manager/tests/modules/launchd/expected-agent.plist @@ -0,0 +1,23 @@ + + + + + KeepAlive + + Crashed + + SuccessfulExit + + + Label + org.nix-community.home.test-service + ProcessType + Background + ProgramArguments + + /some/command + --with-arguments + foo + + + \ No newline at end of file diff --git a/third_party/home-manager/tests/modules/misc/debug/default.nix b/third_party/home-manager/tests/modules/misc/debug/default.nix index b42462d080..19ff4e2b81 100644 --- a/third_party/home-manager/tests/modules/misc/debug/default.nix +++ b/third_party/home-manager/tests/modules/misc/debug/default.nix @@ -1,25 +1,26 @@ { - debug = { pkgs, config, lib, ... }: { - home.enableDebugInfo = true; - home.packages = with pkgs; [ curl gdb ]; + debug = { pkgs, config, lib, ... }: + lib.mkIf config.test.enableBig { + home.enableDebugInfo = true; + home.packages = with pkgs; [ curl gdb ]; - nmt.script = '' - [ -L $TESTED/home-path/lib/debug/curl ] \ - || fail "Debug-symbols for pkgs.curl should exist in \`/home-path/lib/debug'!" + nmt.script = '' + [ -L $TESTED/home-path/lib/debug/curl ] \ + || fail "Debug-symbols for pkgs.curl should exist in \`/home-path/lib/debug'!" - #source $TESTED/home-path/etc/profile.d/hm-session-vars.sh - #[[ "$NIX_DEBUG_INFO_DIRS" =~ /lib/debug$ ]] \ - #|| fail "Invalid NIX_DEBUG_INFO_DIRS!" - assertFileExists home-path/etc/profile.d/hm-session-vars.sh - assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ - 'NIX_DEBUG_INFO_DIRS=.*/lib/debug' + #source $TESTED/home-path/etc/profile.d/hm-session-vars.sh + #[[ "$NIX_DEBUG_INFO_DIRS" =~ /lib/debug$ ]] \ + #|| fail "Invalid NIX_DEBUG_INFO_DIRS!" + assertFileExists home-path/etc/profile.d/hm-session-vars.sh + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ + 'NIX_DEBUG_INFO_DIRS=.*/lib/debug' - # We need to override NIX_DEBUG_INFO_DIRS here as $HOME evalutes to the home - # of the user who executes this testcase :/ - { echo quit | PATH="$TESTED/home-path/bin''${PATH:+:}$PATH" NIX_DEBUG_INFO_DIRS=$TESTED/home-path/lib/debug \ - gdb curl 2>&1 | \ - grep 'Reading symbols from ${builtins.storeDir}/'; \ - } || fail "Failed to read debug symbols from curl in gdb" - ''; - }; + # We need to override NIX_DEBUG_INFO_DIRS here as $HOME evalutes to the home + # of the user who executes this testcase :/ + { echo quit | PATH="$TESTED/home-path/bin''${PATH:+:}$PATH" NIX_DEBUG_INFO_DIRS=$TESTED/home-path/lib/debug \ + gdb curl 2>&1 | \ + grep 'Reading symbols from ${builtins.storeDir}/'; \ + } || fail "Failed to read debug symbols from curl in gdb" + ''; + }; } diff --git a/third_party/home-manager/tests/modules/misc/editorconfig/default.nix b/third_party/home-manager/tests/modules/misc/editorconfig/default.nix new file mode 100644 index 0000000000..9e81bc16cd --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/editorconfig/default.nix @@ -0,0 +1 @@ +{ editorconfig-simple-config = ./editorconfig-simple-config.nix; } diff --git a/third_party/home-manager/tests/modules/misc/editorconfig/editorconfig-simple-config-expected b/third_party/home-manager/tests/modules/misc/editorconfig/editorconfig-simple-config-expected new file mode 100644 index 0000000000..321c5e7e2a --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/editorconfig/editorconfig-simple-config-expected @@ -0,0 +1,15 @@ +# Generated by Home Manager +root=true + +[*] +charset=utf-8 +end_of_line=lf +indent_style=space +insert_final_newline=true +max_line_width=78 +trim_trailing_whitespace=true + +[*.md] +indent_size=unset +trim_trailing_whitespace=false + diff --git a/third_party/home-manager/tests/modules/misc/editorconfig/editorconfig-simple-config.nix b/third_party/home-manager/tests/modules/misc/editorconfig/editorconfig-simple-config.nix new file mode 100644 index 0000000000..ca0581e5f0 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/editorconfig/editorconfig-simple-config.nix @@ -0,0 +1,28 @@ +{ ... }: + +{ + editorconfig = { + enable = true; + settings = { + "*" = { + charset = "utf-8"; + end_of_line = "lf"; + trim_trailing_whitespace = true; + insert_final_newline = true; + max_line_width = 78; + indent_style = "space"; + }; + "*.md" = { + indent_size = "unset"; + trim_trailing_whitespace = false; + }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.editorconfig + assertFileContent home-files/.editorconfig ${ + ./editorconfig-simple-config-expected + } + ''; +} diff --git a/third_party/home-manager/tests/modules/misc/gtk/default.nix b/third_party/home-manager/tests/modules/misc/gtk/default.nix index 0dbae61ebb..a812d4ad32 100644 --- a/third_party/home-manager/tests/modules/misc/gtk/default.nix +++ b/third_party/home-manager/tests/modules/misc/gtk/default.nix @@ -1,5 +1,6 @@ { gtk2-basic-config = ./gtk2-basic-config.nix; gtk2-config-file-location = ./gtk2-config-file-location.nix; + gtk3-basic-settings = ./gtk3-basic-settings.nix; } diff --git a/third_party/home-manager/tests/modules/misc/gtk/gtk-basic-config-expected.conf b/third_party/home-manager/tests/modules/misc/gtk/gtk-basic-config-expected.conf deleted file mode 100644 index 2e4c1c368e..0000000000 --- a/third_party/home-manager/tests/modules/misc/gtk/gtk-basic-config-expected.conf +++ /dev/null @@ -1 +0,0 @@ -gtk-can-change-accels = 1 \ No newline at end of file diff --git a/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config-expected.conf b/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config-expected.conf new file mode 100644 index 0000000000..4096a84775 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config-expected.conf @@ -0,0 +1,2 @@ +gtk-theme-name = "Adwaita" +gtk-can-change-accels = 1 diff --git a/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config.nix b/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config.nix index a49cc44e7e..5671ac93e6 100644 --- a/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config.nix +++ b/third_party/home-manager/tests/modules/misc/gtk/gtk2-basic-config.nix @@ -6,6 +6,7 @@ with lib; config = { gtk = { enable = true; + theme.name = "Adwaita"; gtk2.extraConfig = "gtk-can-change-accels = 1"; }; @@ -13,9 +14,10 @@ with lib; nmt.script = '' assertFileExists home-files/.gtkrc-2.0 - assertFileContent home-files/.gtkrc-2.0 ${ - ./gtk-basic-config-expected.conf - } + + assertFileContent home-files/.gtkrc-2.0 \ + ${./gtk2-basic-config-expected.conf} + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ 'GTK2_RC_FILES=.*/.gtkrc-2.0' ''; diff --git a/third_party/home-manager/tests/modules/misc/gtk/gtk3-basic-settings-expected.ini b/third_party/home-manager/tests/modules/misc/gtk/gtk3-basic-settings-expected.ini new file mode 100644 index 0000000000..f1218b0693 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/gtk/gtk3-basic-settings-expected.ini @@ -0,0 +1,3 @@ +[Settings] +gtk-cursor-blink=false +gtk-recent-files-limit=20 diff --git a/third_party/home-manager/tests/modules/misc/gtk/gtk3-basic-settings.nix b/third_party/home-manager/tests/modules/misc/gtk/gtk3-basic-settings.nix new file mode 100644 index 0000000000..058dd85b29 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/gtk/gtk3-basic-settings.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + gtk = { + enable = true; + gtk3.extraConfig = { + gtk-cursor-blink = false; + gtk-recent-files-limit = 20; + }; + }; + + test.stubs.dconf = { }; + + nmt.script = '' + assertFileExists home-files/.config/gtk-3.0/settings.ini + + assertFileContent home-files/.config/gtk-3.0/settings.ini \ + ${./gtk3-basic-settings-expected.ini} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/misc/nix/default.nix b/third_party/home-manager/tests/modules/misc/nix/default.nix new file mode 100644 index 0000000000..b0370c2e46 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/nix/default.nix @@ -0,0 +1,5 @@ +{ + nix-empty-settings = ./empty-settings.nix; + nix-example-settings = ./example-settings.nix; + nix-example-registry = ./example-registry.nix; +} diff --git a/third_party/home-manager/tests/modules/misc/nix/empty-settings.nix b/third_party/home-manager/tests/modules/misc/nix/empty-settings.nix new file mode 100644 index 0000000000..18f1ab4301 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/nix/empty-settings.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nix = { package = config.lib.test.mkStubPackage { }; }; + + nmt.script = '' + assertPathNotExists home-files/.config/nix + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/misc/nix/example-registry-expected.json b/third_party/home-manager/tests/modules/misc/nix/example-registry-expected.json new file mode 100644 index 0000000000..cf5cee2292 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/nix/example-registry-expected.json @@ -0,0 +1,17 @@ +{ + "flakes": [ + { + "exact": true, + "from": { + "id": "nixpkgs", + "type": "indirect" + }, + "to": { + "owner": "my-org", + "repo": "my-nixpkgs", + "type": "github" + } + } + ], + "version": 2 +} diff --git a/third_party/home-manager/tests/modules/misc/nix/example-registry.nix b/third_party/home-manager/tests/modules/misc/nix/example-registry.nix new file mode 100644 index 0000000000..1875b34d3c --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/nix/example-registry.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nix = { + registry = { + nixpkgs = { + to = { + type = "github"; + owner = "my-org"; + repo = "my-nixpkgs"; + }; + }; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/nix/registry.json \ + ${./example-registry-expected.json} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/misc/nix/example-settings-expected.conf b/third_party/home-manager/tests/modules/misc/nix/example-settings-expected.conf new file mode 100644 index 0000000000..2c2587fd69 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/nix/example-settings-expected.conf @@ -0,0 +1,7 @@ +# WARNING: this file is generated from the nix.settings option in +# your Home Manager configuration at $XDG_CONFIG_HOME/nix/nix.conf. +# Do not edit it! +show-trace = true +system-features = big-parallel kvm recursive-nix +use-sandbox = true + diff --git a/third_party/home-manager/tests/modules/misc/nix/example-settings.nix b/third_party/home-manager/tests/modules/misc/nix/example-settings.nix new file mode 100644 index 0000000000..6cbcd9dfa4 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/nix/example-settings.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nix = { + package = config.lib.test.mkStubPackage { + version = lib.getVersion pkgs.nixVersions.stable; + buildScript = '' + target=$out/bin/nix + mkdir -p "$(dirname "$target")" + + echo -n "true" > "$target" + + chmod +x "$target" + ''; + }; + + settings = { + use-sandbox = true; + show-trace = true; + system-features = [ "big-parallel" "kvm" "recursive-nix" ]; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/nix/nix.conf \ + ${./example-settings-expected.conf} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/misc/pam/default.nix b/third_party/home-manager/tests/modules/misc/pam/default.nix index 81c435e764..a570738956 100644 --- a/third_party/home-manager/tests/modules/misc/pam/default.nix +++ b/third_party/home-manager/tests/modules/misc/pam/default.nix @@ -1 +1,5 @@ -{ pam-session-variables = ./session-variables.nix; } +{ + pam-session-variables = ./session-variables.nix; + pam-yubico-with-ids = ./yubico-with-ids.nix; + pam-yubico-no-ids = ./yubico-with-ids.nix; +} diff --git a/third_party/home-manager/tests/modules/misc/pam/yubico-no-ids.nix b/third_party/home-manager/tests/modules/misc/pam/yubico-no-ids.nix new file mode 100644 index 0000000000..0236ccd593 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/pam/yubico-no-ids.nix @@ -0,0 +1,7 @@ +{ + config = { + nmt.script = '' + assertPathNotExists home-files/.yubico/authorized_yubikeys + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/misc/pam/yubico-with-ids.nix b/third_party/home-manager/tests/modules/misc/pam/yubico-with-ids.nix new file mode 100644 index 0000000000..af722e95b6 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/pam/yubico-with-ids.nix @@ -0,0 +1,15 @@ +{ + config = { + pam.yubico.authorizedYubiKeys.ids = [ "abcdefghijkl" "012345678912" ]; + + nmt.script = '' + assertFileExists home-files/.yubico/authorized_yubikeys + assertFileContent \ + home-files/.yubico/authorized_yubikeys \ + ${ + builtins.toFile "yubico-with-ids-expected.txt" + "hm-user:abcdefghijkl:012345678912" + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/misc/specialization/default.nix b/third_party/home-manager/tests/modules/misc/specialization/default.nix new file mode 100644 index 0000000000..ddbc22c6ac --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/specialization/default.nix @@ -0,0 +1 @@ +{ specialization = ./specialization.nix; } diff --git a/third_party/home-manager/tests/modules/misc/specialization/specialization.nix b/third_party/home-manager/tests/modules/misc/specialization/specialization.nix new file mode 100644 index 0000000000..9d6149a0a5 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/specialization/specialization.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + home.file.testfile.text = "not special"; + specialization.test.configuration = { + home.file.testfile.text = "very special"; + }; + + nmt.script = '' + assertFileExists home-files/testfile + assertFileContains home-files/testfile "not special" + + assertFileExists specialization/test/home-files/testfile + assertFileContains specialization/test/home-files/testfile "not special" + ''; +} diff --git a/third_party/home-manager/tests/modules/misc/xdg/default.nix b/third_party/home-manager/tests/modules/misc/xdg/default.nix index f3fef09291..4cce5bafc6 100644 --- a/third_party/home-manager/tests/modules/misc/xdg/default.nix +++ b/third_party/home-manager/tests/modules/misc/xdg/default.nix @@ -4,4 +4,5 @@ xdg-desktop-entries = ./desktop-entries.nix; xdg-file-gen = ./file-gen.nix; xdg-default-locations = ./default-locations.nix; + xdg-user-dirs-null = ./user-dirs-null.nix; } diff --git a/third_party/home-manager/tests/modules/misc/xdg/desktop-entries.nix b/third_party/home-manager/tests/modules/misc/xdg/desktop-entries.nix index 098aa7eeed..541a7cc53f 100644 --- a/third_party/home-manager/tests/modules/misc/xdg/desktop-entries.nix +++ b/third_party/home-manager/tests/modules/misc/xdg/desktop-entries.nix @@ -16,20 +16,35 @@ with lib; mimeType = [ "text/html" "text/xml" ]; categories = [ "Network" "WebBrowser" ]; startupNotify = false; - extraConfig = '' - [X-ExtraSection] - Exec=foo -o - ''; + noDisplay = false; + prefersNonDefaultGPU = false; settings = { Keywords = "calc;math"; DBusActivatable = "false"; }; - fileValidation = true; + actions = { + "New-Window" = { + name = "New Window"; + exec = "test --new-window"; + icon = "test"; + }; + "Default" = { exec = "test --default"; }; + }; }; min = { # minimal definition exec = "test --option"; name = "Test"; }; + deprecated = { + exec = "test --option"; + name = "Test"; + # Deprecated options + fileValidation = true; + extraConfig = '' + [X-ExtraSection] + Exec=foo -o + ''; + }; }; #testing that preexisting entries in the store are overridden @@ -46,6 +61,19 @@ with lib; }) ]; + test.asserts.assertions.expected = + let currentFile = toString ./desktop-entries.nix; + in [ + '' + The option definition `fileValidation' in `${currentFile}' no longer has any effect; please remove it. + Validation of the desktop file is always enabled. + '' + '' + The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it. + The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs. + '' + ]; + nmt.script = '' assertFileExists home-path/share/applications/full.desktop assertFileExists home-path/share/applications/min.desktop diff --git a/third_party/home-manager/tests/modules/misc/xdg/desktop-full-expected.desktop b/third_party/home-manager/tests/modules/misc/xdg/desktop-full-expected.desktop index fd5ace1b92..b40f96c21f 100644 --- a/third_party/home-manager/tests/modules/misc/xdg/desktop-full-expected.desktop +++ b/third_party/home-manager/tests/modules/misc/xdg/desktop-full-expected.desktop @@ -1,16 +1,26 @@ [Desktop Entry] -Categories=Network;WebBrowser; +Actions=Default;New-Window +Categories=Network;WebBrowser Comment=My Application DBusActivatable=false Exec=test --option GenericName=Web Browser Icon=test Keywords=calc;math -MimeType=text/html;text/xml; +MimeType=text/html;text/xml Name=Test +NoDisplay=false +PrefersNonDefaultGPU=false StartupNotify=false Terminal=true Type=Application -[X-ExtraSection] -Exec=foo -o +Version=1.4 +[Desktop Action Default] +Exec=test --default +Name=Default + +[Desktop Action New-Window] +Exec=test --new-window +Icon=test +Name=New Window diff --git a/third_party/home-manager/tests/modules/misc/xdg/desktop-min-expected.desktop b/third_party/home-manager/tests/modules/misc/xdg/desktop-min-expected.desktop index 9475024ae9..1b36b57c67 100644 --- a/third_party/home-manager/tests/modules/misc/xdg/desktop-min-expected.desktop +++ b/third_party/home-manager/tests/modules/misc/xdg/desktop-min-expected.desktop @@ -3,3 +3,4 @@ Exec=test --option Name=Test Terminal=false Type=Application +Version=1.4 diff --git a/third_party/home-manager/tests/modules/misc/xdg/system-dirs.nix b/third_party/home-manager/tests/modules/misc/xdg/system-dirs.nix index 9bfa2ae446..fa34ae0b5f 100644 --- a/third_party/home-manager/tests/modules/misc/xdg/system-dirs.nix +++ b/third_party/home-manager/tests/modules/misc/xdg/system-dirs.nix @@ -11,8 +11,12 @@ assertFileContent $envFile ${ pkgs.writeText "expected" '' LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive + XDG_CACHE_HOME=/home/hm-user/.cache XDG_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS} + XDG_CONFIG_HOME=/home/hm-user/.config XDG_DATA_DIRS=/usr/local/share:/usr/share:/baz/quux''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS} + XDG_DATA_HOME=/home/hm-user/.local/share + XDG_STATE_HOME=/home/hm-user/.local/state '' } diff --git a/third_party/home-manager/tests/modules/misc/xdg/user-dirs-null.nix b/third_party/home-manager/tests/modules/misc/xdg/user-dirs-null.nix new file mode 100644 index 0000000000..6e8c4f18d9 --- /dev/null +++ b/third_party/home-manager/tests/modules/misc/xdg/user-dirs-null.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + xdg.userDirs = { + enable = true; + desktop = null; + }; + + nmt.script = '' + configFile=home-files/.config/user-dirs.dirs + assertFileExists $configFile + assertFileContent $configFile ${ + pkgs.writeText "expected" '' + XDG_DOCUMENTS_DIR="/home/hm-user/Documents" + XDG_DOWNLOAD_DIR="/home/hm-user/Downloads" + XDG_MUSIC_DIR="/home/hm-user/Music" + XDG_PICTURES_DIR="/home/hm-user/Pictures" + XDG_PUBLICSHARE_DIR="/home/hm-user/Public" + XDG_TEMPLATES_DIR="/home/hm-user/Templates" + XDG_VIDEOS_DIR="/home/hm-user/Videos" + '' + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/aerc/default.nix b/third_party/home-manager/tests/modules/programs/aerc/default.nix new file mode 100644 index 0000000000..f5d810927b --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/default.nix @@ -0,0 +1,4 @@ +{ + aerc-noSettings = ./noSettings.nix; + aerc-settings = ./settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/aerc/extraAccounts.expected b/third_party/home-manager/tests/modules/programs/aerc/extraAccounts.expected new file mode 100644 index 0000000000..15749c0382 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/extraAccounts.expected @@ -0,0 +1,76 @@ +# Generated by Home Manager. + +[Test1] +enable-folders-sort = true +folders = INBOX,SENT,JUNK +source = maildir:///dev/null + +[Test2] +pgp-key-id = 42 + +[a_imap-nopasscmd-tls-starttls-folders] +copy-to = aercSent +default = aercInbox +from = Foo Bar +postpone = aercDrafts +source = imap://foobar@imap.host.invalid:1337 + +[b_imap-passcmd-tls-nostarttls-extraAccounts] +connection-timeout = 42s +from = Foo Bar +source = imaps://foobar@imap.host.invalid:1337 +source-cred-cmd = echo PaSsWorD! + +[c_imap-passcmd-notls-nostarttls-extraConfig] +from = Foo Bar +source = imap+insecure://foobar@imap.host.invalid:1337 +source-cred-cmd = echo PaSsWorD! + +[d_imap-passcmd-notls-starttls-extraBinds] +from = Foo Bar +source = imap+insecure://foobar@imap.host.invalid:1337 +source-cred-cmd = echo PaSsWorD! + +[e_smtp-nopasscmd-tls-starttls] +from = Foo Bar +outgoing = smtp+plain://foobar@smtp.host.invalid:42 +smtp-starttls = yes + +[f_smtp-passcmd-tls-nostarttls] +from = Foo Bar +outgoing = smtps+plain://foobar@smtp.host.invalid:42 +outgoing-cred-cmd = echo PaSsWorD! + +[g_smtp-passcmd-notls-nostarttls] +from = Foo Bar +outgoing = smtp+plain://foobar@smtp.host.invalid:42 +outgoing-cred-cmd = echo PaSsWorD! + +[h_smtp-passcmd-notls-starttls] +from = Foo Bar +outgoing = smtp+plain://foobar@smtp.host.invalid:42 +outgoing-cred-cmd = echo PaSsWorD! + +[i_maildir-mbsync] +from = Foo Bar +source = maildir:///home/hm-user/Maildir/i_maildir-mbsync + +[j_maildir-offlineimap] +from = Foo Bar +source = maildir:///home/hm-user/Maildir/j_maildir-offlineimap + +[l_smpt-auth-none] +from = Foo Bar +outgoing = smtps+none://foobar@smtp.host.invalid:42 + +[m_smpt-auth-plain] +from = Foo Bar +outgoing = smtps+plain://foobar@smtp.host.invalid:42 + +[n_smpt-auth-login] +from = Foo Bar +outgoing = smtps+login://foobar@smtp.host.invalid:42 + +[o_msmtp] +from = Foo Bar +outgoing = msmtpq --read-envelope-from --read-recipients diff --git a/third_party/home-manager/tests/modules/programs/aerc/extraBinds.expected b/third_party/home-manager/tests/modules/programs/aerc/extraBinds.expected new file mode 100644 index 0000000000..36ce9d934d --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/extraBinds.expected @@ -0,0 +1,17 @@ +# Generated by Home Manager. + + = :next-tab + = :prev-tab + = :term + +[compose::editor] +$ex = +$noinherit = true + = :prev-field + +[messages] +j = :next +q = :quit + +[messages:account=d_imap-passcmd-notls-starttls-extraBinds] +d = :move Trash diff --git a/third_party/home-manager/tests/modules/programs/aerc/extraConfig.expected b/third_party/home-manager/tests/modules/programs/aerc/extraConfig.expected new file mode 100644 index 0000000000..416db406f6 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/extraConfig.expected @@ -0,0 +1,18 @@ +# Generated by Home Manager. + +[general] +unsafe-accounts-conf = true + +[ui] +index-format = null +mouse-enabled = false +sidebar-width = 42 +sort = -r date +spinner = true,2,3.400000,5 +test-float = 1337.420000 + +[ui:account=Test] +sidebar-width = 1337 + +[ui:account=c_imap-passcmd-notls-nostarttls-extraConfig] +index-format = %42.1337n diff --git a/third_party/home-manager/tests/modules/programs/aerc/noSettings.nix b/third_party/home-manager/tests/modules/programs/aerc/noSettings.nix new file mode 100644 index 0000000000..c941c19b7a --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/noSettings.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nmt.script = let dir = "home-files/.config/aerc"; + in '' + assertPathNotExists ${dir}/accounts.conf + assertPathNotExists ${dir}/aerc.conf + assertPathNotExists ${dir}/binds.conf + assertPathNotExists ${dir}/stylesets + ''; + programs.aerc.enable = true; + + test.stubs.aerc = { }; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/aerc/settings.nix b/third_party/home-manager/tests/modules/programs/aerc/settings.nix new file mode 100644 index 0000000000..2fded9cc84 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/settings.nix @@ -0,0 +1,229 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nmt.script = let dir = "home-files/.config/aerc"; + in '' + assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected} + assertFileContent ${dir}/binds.conf ${./extraBinds.expected} + assertFileContent ${dir}/aerc.conf ${./extraConfig.expected} + assertFileContent ${dir}/templates/bar ${./templates.expected} + assertFileContent ${dir}/templates/foo ${./templates.expected} + assertFileContent ${dir}/stylesets/default ${./stylesets.expected} + assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected} + ''; + + test.stubs.aerc = { }; + + programs.aerc = { + enable = true; + + extraAccounts = { + Test1 = { + source = "maildir:///dev/null"; + enable-folders-sort = true; + folders = [ "INBOX" "SENT" "JUNK" ]; + }; + Test2 = { pgp-key-id = 42; }; + }; + + extraBinds = { + global = { + "" = ":prev-tab"; + "" = ":next-tab"; + "" = ":term"; + }; + messages = { + q = ":quit"; + j = ":next"; + }; + "compose::editor" = { + "$noinherit" = "true"; + "$ex" = ""; + "" = ":prev-field"; + }; + }; + + extraConfig = { + general.unsafe-accounts-conf = true; + ui = { + index-format = null; + sort = "-r date"; + spinner = [ true 2 3.4 "5" ]; + sidebar-width = 42; + mouse-enabled = false; + test-float = 1337.42; + }; + "ui:account=Test" = { sidebar-width = 1337; }; + }; + + stylesets = { + asLines = '' + *.default = true + *.selected.reverse = toggle + *error.bold = true + error.fg = red + header.bold = true + title.reverse = true + ''; + default = { + "*.default" = "true"; + "*error.bold" = "true"; + "error.fg" = "red"; + "header.bold" = "true"; + "*.selected.reverse" = "toggle"; + "title.reverse" = "true"; + }; + }; + + templates = rec { + foo = '' + X-Mailer: aerc {{version}} + + Just a test. + ''; + bar = foo; + }; + }; + + accounts.email.accounts = let + basics = { + aerc = { enable = true; }; + realName = "Foo Bar"; + userName = "foobar"; + address = "addr@mail.invalid"; + folders = { + drafts = ""; + inbox = ""; + sent = ""; + trash = ""; + }; + }; + in { + a_imap-nopasscmd-tls-starttls-folders = basics // { + primary = true; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = true; + tls.useStartTls = true; + }; + folders = { + drafts = "aercDrafts"; + inbox = "aercInbox"; + sent = "aercSent"; + }; + }; + b_imap-passcmd-tls-nostarttls-extraAccounts = basics // { + passwordCommand = "echo PaSsWorD!"; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = true; + tls.useStartTls = false; + }; + aerc = { + enable = true; + extraAccounts = { connection-timeout = "42s"; }; + }; + }; + c_imap-passcmd-notls-nostarttls-extraConfig = basics // { + passwordCommand = "echo PaSsWorD!"; + aerc = { + enable = true; + extraConfig = { ui.index-format = "%42.1337n"; }; + }; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = false; + tls.useStartTls = false; + }; + }; + d_imap-passcmd-notls-starttls-extraBinds = basics // { + passwordCommand = "echo PaSsWorD!"; + imap = { + host = "imap.host.invalid"; + port = 1337; + tls.enable = false; + tls.useStartTls = true; + }; + aerc = { + enable = true; + extraBinds = { messages = { d = ":move Trash"; }; }; + }; + }; + e_smtp-nopasscmd-tls-starttls = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = true; + tls.useStartTls = true; + }; + }; + f_smtp-passcmd-tls-nostarttls = basics // { + passwordCommand = "echo PaSsWorD!"; + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = true; + tls.useStartTls = false; + }; + }; + g_smtp-passcmd-notls-nostarttls = basics // { + passwordCommand = "echo PaSsWorD!"; + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = false; + tls.useStartTls = false; + }; + }; + h_smtp-passcmd-notls-starttls = basics // { + passwordCommand = "echo PaSsWorD!"; + smtp = { + host = "smtp.host.invalid"; + port = 42; + tls.enable = false; + tls.useStartTls = true; + }; + }; + i_maildir-mbsync = basics // { mbsync.enable = true; }; + j_maildir-offlineimap = basics // { offlineimap.enable = true; }; + k_notEnabled = basics // { aerc.enable = false; }; + l_smpt-auth-none = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; + }; + aerc = { + enable = true; + smtpAuth = "none"; + }; + }; + m_smpt-auth-plain = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; + }; + aerc = { + enable = true; + smtpAuth = "plain"; + }; + }; + n_smpt-auth-login = basics // { + smtp = { + host = "smtp.host.invalid"; + port = 42; + }; + aerc = { + enable = true; + smtpAuth = "login"; + }; + }; + o_msmtp = basics // { msmtp = { enable = true; }; }; + }; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/aerc/stylesets.expected b/third_party/home-manager/tests/modules/programs/aerc/stylesets.expected new file mode 100644 index 0000000000..f6ab9d4307 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/stylesets.expected @@ -0,0 +1,8 @@ +# Generated by Home Manager. + +*.default = true +*.selected.reverse = toggle +*error.bold = true +error.fg = red +header.bold = true +title.reverse = true diff --git a/third_party/home-manager/tests/modules/programs/aerc/templates.expected b/third_party/home-manager/tests/modules/programs/aerc/templates.expected new file mode 100644 index 0000000000..5e6b728977 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/aerc/templates.expected @@ -0,0 +1,3 @@ +X-Mailer: aerc {{version}} + +Just a test. diff --git a/third_party/home-manager/tests/modules/programs/atuin/bash.nix b/third_party/home-manager/tests/modules/programs/atuin/bash.nix index f8c3140998..521886b2eb 100644 --- a/third_party/home-manager/tests/modules/programs/atuin/bash.nix +++ b/third_party/home-manager/tests/modules/programs/atuin/bash.nix @@ -3,7 +3,10 @@ { programs = { atuin.enable = true; - bash.enable = true; + bash = { + enable = true; + enableCompletion = false; + }; }; test.stubs = { diff --git a/third_party/home-manager/tests/modules/programs/atuin/default.nix b/third_party/home-manager/tests/modules/programs/atuin/default.nix index 386a172883..ee22818a35 100644 --- a/third_party/home-manager/tests/modules/programs/atuin/default.nix +++ b/third_party/home-manager/tests/modules/programs/atuin/default.nix @@ -2,6 +2,7 @@ atuin-bash = ./bash.nix; atuin-empty-settings = ./empty-settings.nix; atuin-example-settings = ./example-settings.nix; + atuin-fish = ./fish.nix; atuin-no-shell = ./no-shell.nix; atuin-zsh = ./zsh.nix; } diff --git a/third_party/home-manager/tests/modules/programs/atuin/fish.nix b/third_party/home-manager/tests/modules/programs/atuin/fish.nix new file mode 100644 index 0000000000..527943d67b --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/atuin/fish.nix @@ -0,0 +1,24 @@ +{ lib, ... }: + +{ + programs = { + atuin.enable = true; + fish.enable = true; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs = { + atuin = { }; + bash-preexec = { }; + }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + 'atuin init fish | source' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/atuin/no-shell.nix b/third_party/home-manager/tests/modules/programs/atuin/no-shell.nix index ef3bfe5d6b..381bcc0caa 100644 --- a/third_party/home-manager/tests/modules/programs/atuin/no-shell.nix +++ b/third_party/home-manager/tests/modules/programs/atuin/no-shell.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, ... }: { programs = { @@ -6,18 +6,25 @@ enable = true; enableBashIntegration = false; enableZshIntegration = false; + enableFishIntegration = false; }; bash.enable = true; zsh.enable = true; + fish.enable = true; }; + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + test.stubs = { atuin = { }; bash-preexec = { }; }; nmt.script = '' - assertFileNotRegex home-files/.zshrc '@atuin@ init zsh' - assertFileNotRegex home-files/.bashrc '@atuin@ init bash' + assertFileNotRegex home-files/.zshrc 'atuin init zsh' + assertFileNotRegex home-files/.bashrc 'atuin init bash' + assertFileNotRegex home-files/.config/fish/config.fish 'atuin init fish' ''; } diff --git a/third_party/home-manager/tests/modules/programs/autorandr/basic-configuration.nix b/third_party/home-manager/tests/modules/programs/autorandr/basic-configuration.nix index c28edaa2af..e650f6005a 100644 --- a/third_party/home-manager/tests/modules/programs/autorandr/basic-configuration.nix +++ b/third_party/home-manager/tests/modules/programs/autorandr/basic-configuration.nix @@ -17,6 +17,7 @@ primary = true; position = "0x0"; mode = "1920x1080"; + filter = "nearest"; transform = [ [ 0.6 0.0 0.0 ] # a b c [ 0.0 0.6 0.0 ] # d e f @@ -50,6 +51,7 @@ crtc 0 primary mode 1920x1080 + filter nearest transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000'' } ''; diff --git a/third_party/home-manager/tests/modules/programs/bash/completion.nix b/third_party/home-manager/tests/modules/programs/bash/completion.nix new file mode 100644 index 0000000000..2e5e69dd1f --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/bash/completion.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + programs.bash.enable = true; + + test.stubs.bash-completion = { }; + + nmt.script = '' + assertFileExists home-files/.bashrc + + assertFileContains \ + home-files/.bashrc \ + 'if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then' + assertFileContains \ + home-files/.bashrc \ + ' . "@bash-completion@/etc/profile.d/bash_completion.sh"' + assertFileContains \ + home-files/.bashrc \ + 'fi' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/bash/default.nix b/third_party/home-manager/tests/modules/programs/bash/default.nix index e9f431cd2b..1dbbee777e 100644 --- a/third_party/home-manager/tests/modules/programs/bash/default.nix +++ b/third_party/home-manager/tests/modules/programs/bash/default.nix @@ -1,4 +1,5 @@ { + bash-completion = ./completion.nix; bash-logout = ./logout.nix; bash-session-variables = ./session-variables.nix; } diff --git a/third_party/home-manager/tests/modules/programs/bash/logout.nix b/third_party/home-manager/tests/modules/programs/bash/logout.nix index 7b7f738ab2..c366c520ee 100644 --- a/third_party/home-manager/tests/modules/programs/bash/logout.nix +++ b/third_party/home-manager/tests/modules/programs/bash/logout.nix @@ -6,6 +6,7 @@ with lib; config = { programs.bash = { enable = true; + enableCompletion = false; logoutExtra = '' clear-console @@ -17,7 +18,7 @@ with lib; assertFileContent \ home-files/.bash_logout \ ${ - pkgs.writeShellScript "logout-expected" '' + builtins.toFile "logout-expected" '' clear-console '' } diff --git a/third_party/home-manager/tests/modules/programs/bash/session-variables.nix b/third_party/home-manager/tests/modules/programs/bash/session-variables.nix index 47ed2130d7..bbf2b71abe 100644 --- a/third_party/home-manager/tests/modules/programs/bash/session-variables.nix +++ b/third_party/home-manager/tests/modules/programs/bash/session-variables.nix @@ -6,6 +6,7 @@ with lib; config = { programs.bash = { enable = true; + enableCompletion = false; sessionVariables = { V1 = "v1"; @@ -18,7 +19,7 @@ with lib; assertFileContent \ home-files/.profile \ ${ - pkgs.writeShellScript "session-variables-expected" '' + builtins.toFile "session-variables-expected" '' . "/home/hm-user/.nix-profile/etc/profile.d/hm-session-vars.sh" export V1="v1" diff --git a/third_party/home-manager/tests/modules/programs/borgmatic/basic-configuration.nix b/third_party/home-manager/tests/modules/programs/borgmatic/basic-configuration.nix new file mode 100644 index 0000000000..b9988d4706 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/borgmatic/basic-configuration.nix @@ -0,0 +1,116 @@ +{ config, pkgs, ... }: + +let + boolToString = bool: if bool then "true" else "false"; + backups = config.programs.borgmatic.backups; +in { + config = { + programs.borgmatic = { + enable = true; + backups = { + main = { + location = { + sourceDirectories = [ "/my-stuff-to-backup" ]; + repositories = [ "/mnt/disk1" "/mnt/disk2" ]; + extraConfig = { + one_file_system = true; + exclude_patterns = [ "*.swp" ]; + }; + }; + + storage = { + encryptionPasscommand = "fetch-the-password.sh"; + extraConfig = { checkpoint_interval = 200; }; + }; + + retention = { + keepWithin = "14d"; + keepSecondly = 12; + extraConfig = { prefix = "hostname"; }; + }; + + consistency = { + checks = [ + { + name = "repository"; + frequency = "2 weeks"; + } + { + name = "archives"; + frequency = "4 weeks"; + } + ]; + + extraConfig = { prefix = "hostname"; }; + }; + }; + }; + }; + + test.stubs.borgmatic = { }; + + nmt.script = '' + config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml + assertFileExists $config_file + + declare -A expectations + + expectations[location.source_directories[0]]="${ + builtins.elemAt backups.main.location.sourceDirectories 0 + }" + expectations[location.repositories[0]]="${ + builtins.elemAt backups.main.location.repositories 0 + }" + expectations[location.repositories[1]]="${ + builtins.elemAt backups.main.location.repositories 1 + }" + expectations[location.one_file_system]="${ + boolToString backups.main.location.extraConfig.one_file_system + }" + expectations[location.exclude_patterns[0]]="${ + builtins.elemAt backups.main.location.extraConfig.exclude_patterns 0 + }" + + expectations[storage.encryption_passcommand]="${backups.main.storage.encryptionPasscommand}" + expectations[storage.checkpoint_interval]="${ + toString backups.main.storage.extraConfig.checkpoint_interval + }" + + expectations[retention.keep_within]="${backups.main.retention.keepWithin}" + expectations[retention.keep_secondly]="${ + toString backups.main.retention.keepSecondly + }" + expectations[retention.prefix]="${backups.main.retention.extraConfig.prefix}" + + expectations[consistency.checks[0].name]="${ + (builtins.elemAt backups.main.consistency.checks 0).name + }" + expectations[consistency.checks[0].frequency]="${ + (builtins.elemAt backups.main.consistency.checks 0).frequency + }" + expectations[consistency.checks[1].name]="${ + (builtins.elemAt backups.main.consistency.checks 1).name + }" + expectations[consistency.checks[1].frequency]="${ + (builtins.elemAt backups.main.consistency.checks 1).frequency + }" + expectations[consistency.prefix]="${backups.main.consistency.extraConfig.prefix}" + + yq=${pkgs.yq-go}/bin/yq + + for filter in "''${!expectations[@]}"; do + expected_value="''${expectations[$filter]}" + actual_value="$($yq ".$filter" $config_file)" + + if [[ "$actual_value" != "$expected_value" ]]; then + fail "Expected '$filter' to be '$expected_value' but was '$actual_value'" + fi + done + + one_file_system=$($yq ".location.one_file_system" $config_file) + if [[ $one_file_system != "true" ]]; then + fail "Expected one_file_system to be true but it was $one_file_system" + fi + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/borgmatic/default.nix b/third_party/home-manager/tests/modules/programs/borgmatic/default.nix new file mode 100644 index 0000000000..721c482318 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/borgmatic/default.nix @@ -0,0 +1 @@ +{ borgmatic-program-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/programs/bottom/empty-settings.nix b/third_party/home-manager/tests/modules/programs/bottom/empty-settings.nix index 71799c8318..15c03c11a2 100644 --- a/third_party/home-manager/tests/modules/programs/bottom/empty-settings.nix +++ b/third_party/home-manager/tests/modules/programs/bottom/empty-settings.nix @@ -9,8 +9,13 @@ with lib; package = config.lib.test.mkStubPackage { }; }; - nmt.script = '' - assertPathNotExists home-files/.config/bottom + nmt.script = let + configDir = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support" + else + "home-files/.config"; + in '' + assertPathNotExists ${configDir}/bottom ''; }; } diff --git a/third_party/home-manager/tests/modules/programs/bottom/example-settings-expected.toml b/third_party/home-manager/tests/modules/programs/bottom/example-settings-expected.toml new file mode 100644 index 0000000000..019a182531 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/bottom/example-settings-expected.toml @@ -0,0 +1,6 @@ +[colors] +low_battery_color = "red" + +[flags] +avg_cpu = true +temperature_type = "c" diff --git a/third_party/home-manager/tests/modules/programs/bottom/example-settings.nix b/third_party/home-manager/tests/modules/programs/bottom/example-settings.nix index 30d8e21bf5..1777b5264b 100644 --- a/third_party/home-manager/tests/modules/programs/bottom/example-settings.nix +++ b/third_party/home-manager/tests/modules/programs/bottom/example-settings.nix @@ -26,16 +26,7 @@ with lib; in '' assertFileContent \ "${configDir}/bottom/bottom.toml" \ - ${ - builtins.toFile "example-settings-expected.toml" '' - [colors] - low_battery_color = "red" - - [flags] - avg_cpu = true - temperature_type = "c" - '' - } + ${./example-settings-expected.toml} ''; }; } diff --git a/third_party/home-manager/tests/modules/programs/broot/broot.nix b/third_party/home-manager/tests/modules/programs/broot/broot.nix index a2dddca38d..b39929e365 100644 --- a/third_party/home-manager/tests/modules/programs/broot/broot.nix +++ b/third_party/home-manager/tests/modules/programs/broot/broot.nix @@ -1,42 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { - config = { - programs.broot = { - enable = true; - modal = true; - }; - - test.stubs.broot = { }; - - nmt.script = '' - assertFileExists home-files/.config/broot/conf.toml - assertFileContent home-files/.config/broot/conf.toml ${ - pkgs.writeText "broot.expected" '' - modal = true - - [[verbs]] - execution = ":parent" - invocation = "p" - - [[verbs]] - execution = "$EDITOR {file}" - invocation = "edit" - shortcut = "e" - - [[verbs]] - execution = "$EDITOR {directory}/{subpath}" - invocation = "create {subpath}" - - [[verbs]] - execution = "less {file}" - invocation = "view" - - [skin] - '' - } - ''; + programs.broot = { + enable = true; + settings.modal = true; }; + + nmt.script = '' + assertFileExists home-files/.config/broot/conf.toml + assertFileContent home-files/.config/broot/conf.toml ${ + builtins.toFile "broot.expected" '' + content_search_max_file_size = "10MB" + imports = ["verbs.hjson", {file = "dark-blue-skin.hjson", luma = ["dark", "unknown"]}, {file = "white-skin.hjson", luma = "light"}] + modal = true + show_selection_mark = true + verbs = [] + + [skin] + + [special_paths] + "/media" = "no-enter" + '' + } + ''; } diff --git a/third_party/home-manager/tests/modules/programs/browserpass/browserpass.nix b/third_party/home-manager/tests/modules/programs/browserpass/browserpass.nix index 9189a445ac..2e1ca65e89 100644 --- a/third_party/home-manager/tests/modules/programs/browserpass/browserpass.nix +++ b/third_party/home-manager/tests/modules/programs/browserpass/browserpass.nix @@ -6,11 +6,11 @@ with lib; config = { programs.browserpass = { enable = true; - browsers = [ "chrome" "chromium" "firefox" "vivaldi" ]; + browsers = [ "brave" "chrome" "chromium" "firefox" "vivaldi" ]; }; nmt.script = if pkgs.stdenv.hostPlatform.isDarwin then '' - for dir in "Google/Chrome" "Chromium" "Mozilla" "Vivaldi"; do + for dir in "BraveSoftware/Brave-Browser" "Google/Chrome" "Chromium" "Mozilla" "Vivaldi"; do assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json" done @@ -18,8 +18,11 @@ with lib; assertFileExists "home-files/Library/Application Support/$dir/policies/managed/com.github.browserpass.native.json" done '' else '' - for dir in "google-chrome" "chromium" "vivaldi"; do + for dir in "BraveSoftware/Brave-Browser" "google-chrome" "chromium" "vivaldi"; do assertFileExists "home-files/.config/$dir/NativeMessagingHosts/com.github.browserpass.native.json" + done + + for dir in "google-chrome" "chromium" "vivaldi"; do assertFileExists "home-files/.config/$dir/policies/managed/com.github.browserpass.native.json" done diff --git a/third_party/home-manager/tests/modules/programs/btop/default.nix b/third_party/home-manager/tests/modules/programs/btop/default.nix new file mode 100644 index 0000000000..1b6f74d6b7 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/btop/default.nix @@ -0,0 +1,4 @@ +{ + btop-example-settings = ./example-settings.nix; + btop-empty-settings = ./empty-settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/btop/empty-settings.nix b/third_party/home-manager/tests/modules/programs/btop/empty-settings.nix new file mode 100644 index 0000000000..21aad857d6 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/btop/empty-settings.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs.btop.enable = true; + + test.stubs.btop = { }; + + nmt.script = '' + assertPathNotExists home-files/.config/btop + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/btop/example-settings-expected.conf b/third_party/home-manager/tests/modules/programs/btop/example-settings-expected.conf new file mode 100644 index 0000000000..05a2bae3b2 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/btop/example-settings-expected.conf @@ -0,0 +1,9 @@ +disks_filter = "exclude=/foo/bar" +io_graph_combined = True +io_graph_speeds = "" +log_level = "DEBUG" +show_io_stat = False +update_ms = 1000 + +clock_format = "%H:%M" + diff --git a/third_party/home-manager/tests/modules/programs/btop/example-settings.nix b/third_party/home-manager/tests/modules/programs/btop/example-settings.nix new file mode 100644 index 0000000000..bbd3649c5d --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/btop/example-settings.nix @@ -0,0 +1,34 @@ +{ config, ... }: + +{ + programs.btop = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { + # Integer + update_ms = 1000; + + # Boolean + show_io_stat = false; + io_graph_combined = true; + + # String + disks_filter = "exclude=/foo/bar"; + log_level = "DEBUG"; + + # Empty string + io_graph_speeds = ""; + }; + + extraConfig = '' + clock_format = "%H:%M" + ''; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/btop/btop.conf \ + ${./example-settings-expected.conf} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/direnv/default.nix b/third_party/home-manager/tests/modules/programs/direnv/default.nix index 3efad2b694..a0e618481f 100644 --- a/third_party/home-manager/tests/modules/programs/direnv/default.nix +++ b/third_party/home-manager/tests/modules/programs/direnv/default.nix @@ -1,6 +1,7 @@ { direnv-bash = ./bash.nix; direnv-nix-direnv = ./nix-direnv.nix; + direnv-nushell = ./nushell.nix; direnv-stdlib = ./stdlib.nix; direnv-stdlib-and-nix-direnv = ./stdlib-and-nix-direnv.nix; } diff --git a/third_party/home-manager/tests/modules/programs/direnv/nushell.nix b/third_party/home-manager/tests/modules/programs/direnv/nushell.nix new file mode 100644 index 0000000000..3041770c1c --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/direnv/nushell.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: + +{ + programs.nushell.enable = true; + programs.direnv.enable = true; + + test.stubs.nushell = { }; + + nmt.script = let + configFile = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/nushell/config.nu" + else + "home-files/.config/nushell/config.nu"; + in '' + assertFileExists "${configFile}" + assertFileRegex "${configFile}" \ + 'let direnv = (/nix/store/.*direnv.*/bin/direnv export json | from json)' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/emacs/extra-config.nix b/third_party/home-manager/tests/modules/programs/emacs/extra-config.nix index 67778c3514..52e83de5c9 100644 --- a/third_party/home-manager/tests/modules/programs/emacs/extra-config.nix +++ b/third_party/home-manager/tests/modules/programs/emacs/extra-config.nix @@ -5,16 +5,32 @@ let testScript = pkgs.writeText "test.el" '' ;; Emacs won't automatically load default.el when --script is specified (load "default") - (kill-emacs (if (eq hm 'home-manager) 0 1)) + (let* ((test-load-config (eq hm 'home-manager)) + (test-load-package (eq (hm-test-fn) 'success)) + (is-ok (and test-load-config test-load-package))) + (kill-emacs (if is-ok 0 1))) ''; emacsBin = "${config.programs.emacs.finalPackage}/bin/emacs"; -in { + mkTestPackage = epkgs: + epkgs.trivialBuild { + pname = "hm-test"; + src = pkgs.writeText "hm-test.el" '' + (defun hm-test-fn () 'success) + (provide 'hm-test) + ''; + }; + +in lib.mkIf config.test.enableBig { programs.emacs = { enable = true; package = pkgs.emacs-nox; - extraConfig = "(setq hm 'home-manager)"; + extraConfig = '' + (require 'hm-test) + (setq hm 'home-manager) + ''; + extraPackages = epkgs: [ (mkTestPackage epkgs) ]; }; # running emacs with --script would enable headless mode diff --git a/third_party/home-manager/tests/modules/programs/firefox/deprecated-native-messenger.nix b/third_party/home-manager/tests/modules/programs/firefox/deprecated-native-messenger.nix index 9c624388fd..796389f116 100644 --- a/third_party/home-manager/tests/modules/programs/firefox/deprecated-native-messenger.nix +++ b/third_party/home-manager/tests/modules/programs/firefox/deprecated-native-messenger.nix @@ -2,37 +2,35 @@ with lib; -{ - config = { - programs.firefox = { - enable = true; - enableGnomeExtensions = true; - }; - - nixpkgs.overlays = [ - (self: super: { - firefox-unwrapped = pkgs.runCommandLocal "firefox-0" { - meta.description = "I pretend to be Firefox"; - passthru.gtk3 = null; - } '' - mkdir -p "$out"/{bin,lib} - touch "$out/bin/firefox" - chmod 755 "$out/bin/firefox" - ''; - - chrome-gnome-shell = - pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } '' - mkdir -p $out/lib/mozilla/native-messaging-hosts - touch $out/lib/mozilla/native-messaging-hosts/dummy - ''; - }) - ]; - - test.asserts.warnings.expected = ['' - Using 'programs.firefox.enableGnomeExtensions' has been deprecated and - will be removed in the future. Please change to overriding the package - configuration using 'programs.firefox.package' instead. You can refer to - its example for how to do this. - '']; +lib.mkIf config.test.enableBig { + programs.firefox = { + enable = true; + enableGnomeExtensions = true; }; + + nixpkgs.overlays = [ + (self: super: { + firefox-unwrapped = pkgs.runCommandLocal "firefox-0" { + meta.description = "I pretend to be Firefox"; + passthru.gtk3 = null; + } '' + mkdir -p "$out"/{bin,lib} + touch "$out/bin/firefox" + chmod 755 "$out/bin/firefox" + ''; + + chrome-gnome-shell = + pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } '' + mkdir -p $out/lib/mozilla/native-messaging-hosts + touch $out/lib/mozilla/native-messaging-hosts/dummy + ''; + }) + ]; + + test.asserts.warnings.expected = ['' + Using 'programs.firefox.enableGnomeExtensions' has been deprecated and + will be removed in the future. Please change to overriding the package + configuration using 'programs.firefox.package' instead. You can refer to + its example for how to do this. + '']; } diff --git a/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html b/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html index 15ce487b0e..d60e88ff45 100644 --- a/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html +++ b/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html @@ -6,7 +6,20 @@ Bookmarks

Bookmarks Menu

-

kernel.org -
wikipedia - +

Bookmarks Toolbar

+

+

Home Manager +

+
wikipedia +
kernel.org +

Nix sites

+

+

homepage +
wiki +

Nix sites

+

+

homepage +
wiki +

+

diff --git a/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-search.json b/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-search.json new file mode 100644 index 0000000000..ceee27ee64 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/firefox/profile-settings-expected-search.json @@ -0,0 +1,75 @@ +{ + "engines": [ + { + "_definedAliases": [ + "@np" + ], + "_iconURL": "file:///run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg", + "_isAppProvided": false, + "_loadPath": "[home-manager]/programs.firefox.profiles.search.search.engines.\"Nix Packages\"", + "_metaData": { + "order": 1 + }, + "_name": "Nix Packages", + "_urls": [ + { + "params": [ + { + "name": "type", + "value": "packages" + }, + { + "name": "query", + "value": "{searchTerms}" + } + ], + "template": "https://search.nixos.org/packages" + } + ] + }, + { + "_definedAliases": [ + "@nw" + ], + "_iconURL": "https://nixos.wiki/favicon.png", + "_iconUpdateURL": "https://nixos.wiki/favicon.png", + "_isAppProvided": false, + "_loadPath": "[home-manager]/programs.firefox.profiles.search.search.engines.\"NixOS Wiki\"", + "_metaData": { + "order": 2 + }, + "_name": "NixOS Wiki", + "_updateInterval": 86400000, + "_urls": [ + { + "template": "https://nixos.wiki/index.php?search={searchTerms}" + } + ] + }, + { + "_isAppProvided": true, + "_metaData": { + "hidden": true + }, + "_name": "Bing" + }, + { + "_isAppProvided": true, + "_metaData": {}, + "_name": "DuckDuckGo" + }, + { + "_isAppProvided": true, + "_metaData": { + "alias": "@g" + }, + "_name": "Google" + } + ], + "metaData": { + "current": "DuckDuckGo", + "hash": "BWvqUiaCuMJ20lbymFf2dqzWyl1cgm1LZhhdWNEp0Cc=", + "useSavedOrder": true + }, + "version": 6 +} diff --git a/third_party/home-manager/tests/modules/programs/firefox/profile-settings.nix b/third_party/home-manager/tests/modules/programs/firefox/profile-settings.nix index 10d5855a05..b28e64597e 100644 --- a/third_party/home-manager/tests/modules/programs/firefox/profile-settings.nix +++ b/third_party/home-manager/tests/modules/programs/firefox/profile-settings.nix @@ -2,70 +2,157 @@ with lib; -{ - config = { - programs.firefox = { - enable = true; - profiles.basic.isDefault = true; +lib.mkIf config.test.enableBig { + programs.firefox = { + enable = true; + profiles.basic.isDefault = true; - profiles.test = { - id = 1; - settings = { "general.smoothScroll" = false; }; - }; + profiles.test = { + id = 1; + settings = { "general.smoothScroll" = false; }; + }; - profiles.bookmarks = { - id = 2; - settings = { "general.smoothScroll" = false; }; - bookmarks = { - wikipedia = { - keyword = "wiki"; - url = - "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go"; + profiles.bookmarks = { + id = 2; + settings = { "general.smoothScroll" = false; }; + bookmarks = [ + { + toolbar = true; + bookmarks = [{ + name = "Home Manager"; + url = "https://nixos.wiki/wiki/Home_Manager"; + }]; + } + { + name = "wikipedia"; + keyword = "wiki"; + url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go"; + } + { + name = "kernel.org"; + url = "https://www.kernel.org"; + } + { + name = "Nix sites"; + bookmarks = [ + { + name = "homepage"; + url = "https://nixos.org/"; + } + { + name = "wiki"; + url = "https://nixos.wiki/"; + } + { + name = "Nix sites"; + bookmarks = [ + { + name = "homepage"; + url = "https://nixos.org/"; + } + { + name = "wiki"; + url = "https://nixos.wiki/"; + } + ]; + } + ]; + } + ]; + }; + + profiles.search = { + id = 3; + search = { + force = true; + default = "DuckDuckGo"; + order = [ "Nix Packages" "NixOS Wiki" ]; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + }]; + + icon = + "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + + definedAliases = [ "@np" ]; }; - "kernel.org" = { url = "https://www.kernel.org"; }; + + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = [ "@nw" ]; + }; + + "Bing".metaData.hidden = true; + "Google".metaData.alias = "@g"; }; }; }; - - nixpkgs.overlays = [ - (self: super: { - firefox-unwrapped = pkgs.runCommand "firefox-0" { - meta.description = "I pretend to be Firefox"; - preferLocalBuild = true; - passthru.gtk3 = null; - } '' - mkdir -p "$out"/{bin,lib} - touch "$out/bin/firefox" - chmod 755 "$out/bin/firefox" - ''; - }) - ]; - - nmt.script = '' - assertFileRegex \ - home-path/bin/firefox \ - MOZ_APP_LAUNCHER - - assertDirectoryExists home-files/.mozilla/firefox/basic - - assertFileContent \ - home-files/.mozilla/firefox/test/user.js \ - ${./profile-settings-expected-user.js} - - bookmarksUserJs=$(normalizeStorePaths \ - home-files/.mozilla/firefox/bookmarks/user.js) - - assertFileContent \ - $bookmarksUserJs \ - ${./profile-settings-expected-bookmarks-user.js} - - bookmarksFile="$(sed -n \ - '/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \ - $TESTED/home-files/.mozilla/firefox/bookmarks/user.js)" - - assertFileContent \ - $bookmarksFile \ - ${./profile-settings-expected-bookmarks.html} - ''; }; + + nixpkgs.overlays = [ + (self: super: { + firefox-unwrapped = pkgs.runCommand "firefox-0" { + meta.description = "I pretend to be Firefox"; + preferLocalBuild = true; + passthru.gtk3 = null; + } '' + mkdir -p "$out"/{bin,lib} + touch "$out/bin/firefox" + chmod 755 "$out/bin/firefox" + ''; + }) + ]; + + nmt.script = '' + assertFileRegex \ + home-path/bin/firefox \ + MOZ_APP_LAUNCHER + + assertDirectoryExists home-files/.mozilla/firefox/basic + + assertFileContent \ + home-files/.mozilla/firefox/test/user.js \ + ${./profile-settings-expected-user.js} + + bookmarksUserJs=$(normalizeStorePaths \ + home-files/.mozilla/firefox/bookmarks/user.js) + + assertFileContent \ + $bookmarksUserJs \ + ${./profile-settings-expected-bookmarks-user.js} + + bookmarksFile="$(sed -n \ + '/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \ + $TESTED/home-files/.mozilla/firefox/bookmarks/user.js)" + + assertFileContent \ + $bookmarksFile \ + ${./profile-settings-expected-bookmarks.html} + + compressedSearch=$(normalizeStorePaths \ + home-files/.mozilla/firefox/search/search.json.mozlz4) + + decompressedSearch=$(dirname $compressedSearch)/search.json + ${pkgs.mozlz4a}/bin/mozlz4a -d "$compressedSearch" >(${pkgs.jq}/bin/jq . > "$decompressedSearch") + + assertFileContent \ + $decompressedSearch \ + ${./profile-settings-expected-search.json} + ''; } diff --git a/third_party/home-manager/tests/modules/programs/firefox/state-version-19_09.nix b/third_party/home-manager/tests/modules/programs/firefox/state-version-19_09.nix index 3eb6084f31..bf0b95f05c 100644 --- a/third_party/home-manager/tests/modules/programs/firefox/state-version-19_09.nix +++ b/third_party/home-manager/tests/modules/programs/firefox/state-version-19_09.nix @@ -2,30 +2,28 @@ with lib; -{ - config = { - home.stateVersion = "19.09"; +lib.mkIf config.test.enableBig { + home.stateVersion = "19.09"; - programs.firefox.enable = true; + programs.firefox.enable = true; - nixpkgs.overlays = [ - (self: super: { - firefox-unwrapped = pkgs.runCommand "firefox-0" { - meta.description = "I pretend to be Firefox"; - preferLocalBuild = true; - passthru.gtk3 = null; - } '' - mkdir -p "$out"/{bin,lib} - touch "$out/bin/firefox" - chmod 755 "$out/bin/firefox" - ''; - }) - ]; + nixpkgs.overlays = [ + (self: super: { + firefox-unwrapped = pkgs.runCommand "firefox-0" { + meta.description = "I pretend to be Firefox"; + preferLocalBuild = true; + passthru.gtk3 = null; + } '' + mkdir -p "$out"/{bin,lib} + touch "$out/bin/firefox" + chmod 755 "$out/bin/firefox" + ''; + }) + ]; - nmt.script = '' - assertFileRegex \ - home-path/bin/firefox \ - MOZ_APP_LAUNCHER - ''; - }; + nmt.script = '' + assertFileRegex \ + home-path/bin/firefox \ + MOZ_APP_LAUNCHER + ''; } diff --git a/third_party/home-manager/tests/modules/programs/fish/default.nix b/third_party/home-manager/tests/modules/programs/fish/default.nix index 99fe813670..3ed5b9cfec 100644 --- a/third_party/home-manager/tests/modules/programs/fish/default.nix +++ b/third_party/home-manager/tests/modules/programs/fish/default.nix @@ -1,4 +1,5 @@ { + fish-format-scripts = ./format-scripts.nix; fish-functions = ./functions.nix; fish-no-functions = ./no-functions.nix; fish-plugins = ./plugins.nix; diff --git a/third_party/home-manager/tests/modules/programs/fish/format-scripts.nix b/third_party/home-manager/tests/modules/programs/fish/format-scripts.nix new file mode 100644 index 0000000000..2ba58cae16 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/fish/format-scripts.nix @@ -0,0 +1,50 @@ +{ config, pkgs, ... }: + +let + + expectedFunc = pkgs.writeText "func.fish" '' + function func + echo foo + end + ''; + + expectedFuncMulti = pkgs.writeText "func-multi.fish" '' + function func-multi + echo bar + if foo + bar + baz + end + end + ''; + +in { + config = { + programs.fish = { + enable = true; + + formatFishScripts = true; + + functions = { + func = ''echo "foo"''; + func-multi = '' + echo bar + if foo + bar + baz + end + ''; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/fish/functions/func.fish + echo ${expectedFunc} + assertFileContent home-files/.config/fish/functions/func.fish ${expectedFunc} + + assertFileExists home-files/.config/fish/functions/func-multi.fish + echo ${expectedFuncMulti} + assertFileContent home-files/.config/fish/functions/func-multi.fish ${expectedFuncMulti} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/fish/functions.nix b/third_party/home-manager/tests/modules/programs/fish/functions.nix index 67f8ba0d56..b8b5793a56 100644 --- a/third_party/home-manager/tests/modules/programs/fish/functions.nix +++ b/third_party/home-manager/tests/modules/programs/fish/functions.nix @@ -6,13 +6,13 @@ let func = pkgs.writeText "func.fish" '' function func - echo "Hello" + echo Hello end ''; funcEvent = pkgs.writeText "func-event.fish" '' function func-event --on-event="fish_command_not_found" - echo "Not found!" + echo "Not found!" end ''; @@ -34,8 +34,6 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.function is set, check file exists and contents match"; diff --git a/third_party/home-manager/tests/modules/programs/fish/no-functions.nix b/third_party/home-manager/tests/modules/programs/fish/no-functions.nix index 0ab38a09e7..125ed88415 100644 --- a/third_party/home-manager/tests/modules/programs/fish/no-functions.nix +++ b/third_party/home-manager/tests/modules/programs/fish/no-functions.nix @@ -14,8 +14,6 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.functions is blank, the functions folder should not exist."; diff --git a/third_party/home-manager/tests/modules/programs/fish/plugins.nix b/third_party/home-manager/tests/modules/programs/fish/plugins.nix index 6b02dd46f0..88684b3b44 100644 --- a/third_party/home-manager/tests/modules/programs/fish/plugins.nix +++ b/third_party/home-manager/tests/modules/programs/fish/plugins.nix @@ -12,26 +12,26 @@ let # Set paths to import plugin components if test -d $plugin_dir/functions - set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] + set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] end if test -d $plugin_dir/completions - set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] + set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] end # Source initialization code if it exists. if test -d $plugin_dir/conf.d - for f in $plugin_dir/conf.d/*.fish - source $f - end + for f in $plugin_dir/conf.d/*.fish + source $f + end end if test -f $plugin_dir/key_bindings.fish - source $plugin_dir/key_bindings.fish + source $plugin_dir/key_bindings.fish end if test -f $plugin_dir/init.fish - source $plugin_dir/init.fish + source $plugin_dir/init.fish end ''; @@ -50,8 +50,6 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.plugins set, check conf.d file exists and contents match"; diff --git a/third_party/home-manager/tests/modules/programs/foot/systemd-user-service-expected.service b/third_party/home-manager/tests/modules/programs/foot/systemd-user-service-expected.service index ff0f8a61b4..517344e531 100644 --- a/third_party/home-manager/tests/modules/programs/foot/systemd-user-service-expected.service +++ b/third_party/home-manager/tests/modules/programs/foot/systemd-user-service-expected.service @@ -3,6 +3,7 @@ WantedBy=graphical-session.target [Service] ExecStart=@foot@/bin/foot --server +OOMPolicy=continue Restart=on-failure [Unit] diff --git a/third_party/home-manager/tests/modules/programs/gallery-dl/default.nix b/third_party/home-manager/tests/modules/programs/gallery-dl/default.nix new file mode 100644 index 0000000000..42caef2ff9 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/gallery-dl/default.nix @@ -0,0 +1 @@ +{ gallery-dl = ./gallery-dl.nix; } diff --git a/third_party/home-manager/tests/modules/programs/gallery-dl/gallery-dl.nix b/third_party/home-manager/tests/modules/programs/gallery-dl/gallery-dl.nix new file mode 100644 index 0000000000..43d0daa9f7 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/gallery-dl/gallery-dl.nix @@ -0,0 +1,28 @@ +{ ... }: + +{ + programs.gallery-dl = { + enable = true; + + settings = { + cache.file = "~/gallery-dl/cache.sqlite3"; + extractor.base-directory = "~/gallery-dl/"; + }; + }; + + test.stubs.gallery-dl = { }; + + nmt.script = '' + assertFileContent home-files/.config/gallery-dl/config.json \ + ${builtins.toFile "gallery-dl-expected-settings.json" '' + { + "cache": { + "file": "~/gallery-dl/cache.sqlite3" + }, + "extractor": { + "base-directory": "~/gallery-dl/" + } + } + ''} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/gh/credential-helper.nix b/third_party/home-manager/tests/modules/programs/gh/credential-helper.nix index e7ee8e42bf..0c5ed872f3 100644 --- a/third_party/home-manager/tests/modules/programs/gh/credential-helper.nix +++ b/third_party/home-manager/tests/modules/programs/gh/credential-helper.nix @@ -8,10 +8,7 @@ programs.git.enable = true; - test.stubs = { - gh = { }; - git = { }; - }; + test.stubs.gh = { }; nmt.script = '' assertFileExists home-files/.config/git/config diff --git a/third_party/home-manager/tests/modules/programs/gh/default.nix b/third_party/home-manager/tests/modules/programs/gh/default.nix index c683b484e6..d033ae22c8 100644 --- a/third_party/home-manager/tests/modules/programs/gh/default.nix +++ b/third_party/home-manager/tests/modules/programs/gh/default.nix @@ -1,5 +1,6 @@ { gh-config-file = ./config-file.nix; gh-credential-helper = ./credential-helper.nix; + gh-extensions = ./extensions.nix; gh-warnings = ./warnings.nix; } diff --git a/third_party/home-manager/tests/modules/programs/gh/extensions.nix b/third_party/home-manager/tests/modules/programs/gh/extensions.nix new file mode 100644 index 0000000000..c8824ed090 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/gh/extensions.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +{ + programs.gh = { + enable = true; + extensions = [ pkgs.gh-eco ]; + }; + + test.stubs = { + gh = { }; + gh-eco = { + name = "gh-eco"; + buildScript = '' + mkdir -p $out/bin + touch $out/bin/gh-eco + chmod +x $out/bin/gh-eco + ''; + outPath = null; + }; + }; + + nmt.script = '' + gh_eco=home-files/.local/share/gh/extensions/gh-eco/gh-eco + assertFileExists "$gh_eco" + assertFileIsExecutable "$gh_eco" + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/git/default.nix b/third_party/home-manager/tests/modules/programs/git/default.nix index 3d401d8fc2..3b92b2ff16 100644 --- a/third_party/home-manager/tests/modules/programs/git/default.nix +++ b/third_party/home-manager/tests/modules/programs/git/default.nix @@ -5,4 +5,5 @@ git-with-str-extra-config = ./git-with-str-extra-config.nix; git-with-signing-key-id = ./git-with-signing-key-id.nix; git-without-signing-key-id = ./git-without-signing-key-id.nix; + git-with-hooks = ./git-with-hooks.nix; } diff --git a/third_party/home-manager/tests/modules/programs/git/git-expected.conf b/third_party/home-manager/tests/modules/programs/git/git-expected.conf index fe258a0d3b..61e0a2cc50 100644 --- a/third_party/home-manager/tests/modules/programs/git/git-expected.conf +++ b/third_party/home-manager/tests/modules/programs/git/git-expected.conf @@ -43,6 +43,9 @@ [interactive] diffFilter = "@delta@/bin/delta --color-only" +[tag] + gpgSign = true + [user] email = "user@example.org" name = "John Doe" @@ -56,3 +59,6 @@ [includeIf "gitdir:~/src/dir"] path = "@git_include_path@" + +[includeIf "gitdir:~/src/otherproject"] + path = "@git_named_include_path@" diff --git a/third_party/home-manager/tests/modules/programs/git/git-pre-commit-hook.sh b/third_party/home-manager/tests/modules/programs/git/git-pre-commit-hook.sh new file mode 100644 index 0000000000..291cfd30f7 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/git/git-pre-commit-hook.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo "pre-commit hook..." diff --git a/third_party/home-manager/tests/modules/programs/git/git-with-hooks.nix b/third_party/home-manager/tests/modules/programs/git/git-with-hooks.nix new file mode 100644 index 0000000000..83f1059bc5 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/git/git-with-hooks.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: + +{ + programs.git = { + enable = true; + hooks = { pre-commit = ./git-pre-commit-hook.sh; }; + }; + + nmt.script = '' + function getGitConfig() { + ${pkgs.gitMinimal}/bin/git config \ + --file $TESTED/home-files/.config/git/config \ + --get $1 + } + + assertFileExists home-files/.config/git/config + hookPath=$(getGitConfig core.hooksPath) + assertLinkExists $hookPath/pre-commit + + actual="$(readlink "$hookPath/pre-commit")" + expected="${./git-pre-commit-hook.sh}" + if [[ $actual != $expected ]]; then + fail "Symlink $hookPath/pre-commit should point to $expected via the Nix store, but it actually points to $actual." + fi + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/git/git-with-signing-key-id-expected.conf b/third_party/home-manager/tests/modules/programs/git/git-with-signing-key-id-expected.conf index 4a42899020..b26377aacd 100644 --- a/third_party/home-manager/tests/modules/programs/git/git-with-signing-key-id-expected.conf +++ b/third_party/home-manager/tests/modules/programs/git/git-with-signing-key-id-expected.conf @@ -4,6 +4,9 @@ [gpg] program = "path-to-gpg" +[tag] + gpgSign = true + [user] email = "user@example.org" name = "John Doe" diff --git a/third_party/home-manager/tests/modules/programs/git/git-without-signing-key-id-expected.conf b/third_party/home-manager/tests/modules/programs/git/git-without-signing-key-id-expected.conf index 7564b35021..8c04aeda17 100644 --- a/third_party/home-manager/tests/modules/programs/git/git-without-signing-key-id-expected.conf +++ b/third_party/home-manager/tests/modules/programs/git/git-without-signing-key-id-expected.conf @@ -4,6 +4,9 @@ [gpg] program = "path-to-gpg" +[tag] + gpgSign = true + [user] email = "user@example.org" name = "John Doe" diff --git a/third_party/home-manager/tests/modules/programs/git/git.nix b/third_party/home-manager/tests/modules/programs/git/git.nix index 6c7320604b..fb949be003 100644 --- a/third_party/home-manager/tests/modules/programs/git/git.nix +++ b/third_party/home-manager/tests/modules/programs/git/git.nix @@ -14,7 +14,9 @@ let substituteExpected = path: pkgs.substituteAll { src = path; - git_include_path = pkgs.writeText "contents" + 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); }; @@ -46,6 +48,11 @@ in { condition = "gitdir:~/src/dir"; contents = gitInclude; } + { + condition = "gitdir:~/src/otherproject"; + contents = gitInclude; + contentSuffix = "gitconfig-work"; + } ]; signing = { gpgPath = "path-to-gpg"; diff --git a/third_party/home-manager/tests/modules/programs/gpg/immutable-keyfiles.nix b/third_party/home-manager/tests/modules/programs/gpg/immutable-keyfiles.nix index d75ff52044..55a38ecc72 100644 --- a/third_party/home-manager/tests/modules/programs/gpg/immutable-keyfiles.nix +++ b/third_party/home-manager/tests/modules/programs/gpg/immutable-keyfiles.nix @@ -12,16 +12,16 @@ source = pkgs.fetchurl { url = "https://keybase.io/rycee/pgp_keys.asc?fingerprint=36cacf52d098cc0e78fb0cb13573356c25c424d4"; - sha256 = "082mjy6llvrdry6i9r5gx97nw9d89blnam7bghza4ynsjk1mmx6c"; + hash = "sha256-5z2kTUXQp0f7kyP0Id6NS3rCdzGGrrkIYzGK42Qy9Sw="; }; - trust = 1; + trust = 1; # "unknown" } { source = pkgs.fetchurl { url = "https://www.rsync.net/resources/pubkey.txt"; sha256 = "16nzqfb1kvsxjkq919hxsawx6ydvip3md3qyhdmw54qx6drnxckl"; }; - trust = 2; + trust = "never"; } ]; }; diff --git a/third_party/home-manager/tests/modules/programs/gpg/override-defaults.nix b/third_party/home-manager/tests/modules/programs/gpg/override-defaults.nix index 62fe50dc2a..e410433956 100644 --- a/third_party/home-manager/tests/modules/programs/gpg/override-defaults.nix +++ b/third_party/home-manager/tests/modules/programs/gpg/override-defaults.nix @@ -11,10 +11,7 @@ with lib; no-comments = false; s2k-cipher-algo = "AES128"; throw-keyids = true; - trusted-key = [ - "0xXXXXXXXXXXXXX" - "0xYYYYYYYYYYYYY" - ]; + trusted-key = [ "0xXXXXXXXXXXXXX" "0xYYYYYYYYYYYYY" ]; }; homedir = "${config.home.homeDirectory}/bar/foopg"; @@ -22,7 +19,9 @@ with lib; 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/third_party/home-manager/tests/modules/programs/helix/default.nix b/third_party/home-manager/tests/modules/programs/helix/default.nix new file mode 100644 index 0000000000..77172c7082 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/helix/default.nix @@ -0,0 +1 @@ +{ helix-example-settings = ./example-settings.nix; } diff --git a/third_party/home-manager/tests/modules/programs/helix/example-settings.nix b/third_party/home-manager/tests/modules/programs/helix/example-settings.nix new file mode 100644 index 0000000000..ed0b4713b4 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/helix/example-settings.nix @@ -0,0 +1,118 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.helix = { + enable = true; + + settings = { + theme = "base16"; + lsp.display-messages = true; + keys.normal = { + space.space = "file_picker"; + space.w = ":w"; + space.q = ":q"; + }; + }; + + languages = [{ + name = "rust"; + auto-format = false; + }]; + + themes = { + base16 = let + transparent = "none"; + gray = "#665c54"; + dark-gray = "#3c3836"; + white = "#fbf1c7"; + black = "#282828"; + red = "#fb4934"; + green = "#b8bb26"; + yellow = "#fabd2f"; + orange = "#fe8019"; + blue = "#83a598"; + magenta = "#d3869b"; + cyan = "#8ec07c"; + in { + "ui.menu" = transparent; + "ui.menu.selected" = { modifiers = [ "reversed" ]; }; + "ui.linenr" = { + fg = gray; + bg = dark-gray; + }; + "ui.popup" = { modifiers = [ "reversed" ]; }; + "ui.linenr.selected" = { + fg = white; + bg = black; + modifiers = [ "bold" ]; + }; + "ui.selection" = { + fg = black; + bg = blue; + }; + "ui.selection.primary" = { modifiers = [ "reversed" ]; }; + "comment" = { fg = gray; }; + "ui.statusline" = { + fg = white; + bg = dark-gray; + }; + "ui.statusline.inactive" = { + fg = dark-gray; + bg = white; + }; + "ui.help" = { + fg = dark-gray; + bg = white; + }; + "ui.cursor" = { modifiers = [ "reversed" ]; }; + "variable" = red; + "variable.builtin" = orange; + "constant.numeric" = orange; + "constant" = orange; + "attributes" = yellow; + "type" = yellow; + "ui.cursor.match" = { + fg = yellow; + modifiers = [ "underlined" ]; + }; + "string" = green; + "variable.other.member" = red; + "constant.character.escape" = cyan; + "function" = blue; + "constructor" = blue; + "special" = blue; + "keyword" = magenta; + "label" = magenta; + "namespace" = blue; + "diff.plus" = green; + "diff.delta" = yellow; + "diff.minus" = red; + "diagnostic" = { modifiers = [ "underlined" ]; }; + "ui.gutter" = { bg = black; }; + "info" = blue; + "hint" = dark-gray; + "debug" = dark-gray; + "warning" = yellow; + "error" = red; + }; + }; + }; + + test.stubs.helix = { }; + + nmt.script = '' + assertFileContent \ + home-files/.config/helix/config.toml \ + ${./settings-expected.toml} + assertFileContent \ + home-files/.config/helix/languages.toml \ + ${./languages-expected.toml} + assertFileContent \ + home-files/.config/helix/themes/base16.toml \ + ${./theme-base16-expected.toml} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/helix/languages-expected.toml b/third_party/home-manager/tests/modules/programs/helix/languages-expected.toml new file mode 100644 index 0000000000..d3404397b3 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/helix/languages-expected.toml @@ -0,0 +1,3 @@ +[[language]] +auto-format = false +name = "rust" diff --git a/third_party/home-manager/tests/modules/programs/helix/settings-expected.toml b/third_party/home-manager/tests/modules/programs/helix/settings-expected.toml new file mode 100644 index 0000000000..772bcf5253 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/helix/settings-expected.toml @@ -0,0 +1,9 @@ +theme = "base16" + +[keys.normal.space] +q = ":q" +space = "file_picker" +w = ":w" + +[lsp] +display-messages = true diff --git a/third_party/home-manager/tests/modules/programs/helix/theme-base16-expected.toml b/third_party/home-manager/tests/modules/programs/helix/theme-base16-expected.toml new file mode 100644 index 0000000000..25d0bef0cb --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/helix/theme-base16-expected.toml @@ -0,0 +1,74 @@ +attributes = "#fabd2f" +constant = "#fe8019" +"constant.character.escape" = "#8ec07c" +"constant.numeric" = "#fe8019" +constructor = "#83a598" +debug = "#3c3836" +"diff.delta" = "#fabd2f" +"diff.minus" = "#fb4934" +"diff.plus" = "#b8bb26" +error = "#fb4934" +function = "#83a598" +hint = "#3c3836" +info = "#83a598" +keyword = "#d3869b" +label = "#d3869b" +namespace = "#83a598" +special = "#83a598" +string = "#b8bb26" +type = "#fabd2f" +"ui.menu" = "none" +variable = "#fb4934" +"variable.builtin" = "#fe8019" +"variable.other.member" = "#fb4934" +warning = "#fabd2f" + +[comment] +fg = "#665c54" + +[diagnostic] +modifiers = ["underlined"] + +["ui.cursor"] +modifiers = ["reversed"] + +["ui.cursor.match"] +fg = "#fabd2f" +modifiers = ["underlined"] + +["ui.gutter"] +bg = "#282828" + +["ui.help"] +bg = "#fbf1c7" +fg = "#3c3836" + +["ui.linenr"] +bg = "#3c3836" +fg = "#665c54" + +["ui.linenr.selected"] +bg = "#282828" +fg = "#fbf1c7" +modifiers = ["bold"] + +["ui.menu.selected"] +modifiers = ["reversed"] + +["ui.popup"] +modifiers = ["reversed"] + +["ui.selection"] +bg = "#83a598" +fg = "#282828" + +["ui.selection.primary"] +modifiers = ["reversed"] + +["ui.statusline"] +bg = "#3c3836" +fg = "#fbf1c7" + +["ui.statusline.inactive"] +bg = "#fbf1c7" +fg = "#3c3836" diff --git a/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config b/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config index 29d232842b..e550ca481b 100644 --- a/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config +++ b/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config @@ -8,7 +8,7 @@ S=irc.mzima.net S=irc.prison.net J=#computers -N=freenode +N=oftc L=6 E=UTF-8 (Unicode) F=12 @@ -17,8 +17,6 @@ i=user_ R=real_user U=user P=password -S=chat.freenode.net -S=irc.freenode.net +S=irc.oftc.net J=#home-manager -J=#nixos diff --git a/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration.nix b/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration.nix index 1aa39bd49a..6371a0e0b7 100644 --- a/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration.nix +++ b/third_party/home-manager/tests/modules/programs/hexchat/basic-configuration.nix @@ -6,7 +6,7 @@ enable = true; overwriteConfigFiles = true; channels = { - freenode = { + oftc = { charset = "UTF-8 (Unicode)"; userName = "user"; password = "password"; @@ -18,8 +18,8 @@ autoconnect = true; forceSSL = true; }; - servers = [ "chat.freenode.net" "irc.freenode.net" ]; - autojoin = [ "#home-manager" "#nixos" ]; + servers = [ "irc.oftc.net" ]; + autojoin = [ "#home-manager" ]; }; efnet = { options = { forceSSL = true; }; diff --git a/third_party/home-manager/tests/modules/programs/himalaya/himalaya-expected.toml b/third_party/home-manager/tests/modules/programs/himalaya/himalaya-expected.toml index db94d42a8a..ca7ada66de 100644 --- a/third_party/home-manager/tests/modules/programs/himalaya/himalaya-expected.toml +++ b/third_party/home-manager/tests/modules/programs/himalaya/himalaya-expected.toml @@ -1,18 +1,25 @@ +display-name = "" downloads-dir = "/data/download" -name = "" ["hm@example.com"] +backend = "imap" default = true -default-page-size = 50 +display-name = "H. M. Test" email = "hm@example.com" +email-listing-page-size = 50 imap-host = "imap.example.com" imap-login = "home.manager" imap-passwd-cmd = "'password-command'" imap-port = 995 imap-starttls = false -name = "H. M. Test" +sender = "smtp" smtp-host = "smtp.example.com" smtp-login = "home.manager" smtp-passwd-cmd = "'password-command'" smtp-port = 465 smtp-starttls = false + +["hm@example.com".mailboxes] +draft = "Drafts" +inbox = "In" +sent = "Out" diff --git a/third_party/home-manager/tests/modules/programs/himalaya/himalaya.nix b/third_party/home-manager/tests/modules/programs/himalaya/himalaya.nix index 827a09bef1..4d556ff860 100644 --- a/third_party/home-manager/tests/modules/programs/himalaya/himalaya.nix +++ b/third_party/home-manager/tests/modules/programs/himalaya/himalaya.nix @@ -10,7 +10,15 @@ with lib; himalaya = { enable = true; - settings = { default-page-size = 50; }; + backend = "imap"; + sender = "smtp"; + settings = { email-listing-page-size = 50; }; + }; + + folders = { + inbox = "In"; + sent = "Out"; + drafts = "Drafts"; }; imap.port = 995; @@ -32,4 +40,3 @@ with lib; } ''; } - diff --git a/third_party/home-manager/tests/modules/programs/htop/header_layout.nix b/third_party/home-manager/tests/modules/programs/htop/header_layout.nix index 2cf34998d6..aaf6285223 100644 --- a/third_party/home-manager/tests/modules/programs/htop/header_layout.nix +++ b/third_party/home-manager/tests/modules/programs/htop/header_layout.nix @@ -17,7 +17,12 @@ with lib; # Test that the 'fields' key is written in addition to the customized # settings or htop won't read the options. - nmt.script = '' + 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 \ @@ -28,7 +33,7 @@ with lib; column_meters_1=Tasks LoadAverage Uptime Systemd column_meters_modes_0=1 1 1 2 column_meters_modes_1=2 2 2 2 - fields=0 48 17 18 38 39 40 2 46 47 49 1 + fields=${fields} '' } ''; diff --git a/third_party/home-manager/tests/modules/programs/htop/settings-without-fields.nix b/third_party/home-manager/tests/modules/programs/htop/settings-without-fields.nix index 2f4b3e864c..f1efac2d43 100644 --- a/third_party/home-manager/tests/modules/programs/htop/settings-without-fields.nix +++ b/third_party/home-manager/tests/modules/programs/htop/settings-without-fields.nix @@ -11,14 +11,19 @@ with lib; # Test that the 'fields' key is written in addition to the customized # settings or htop won't read the options. - nmt.script = '' + 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=0 48 17 18 38 39 40 2 46 47 49 1 + fields=${fields} '' } ''; diff --git a/third_party/home-manager/tests/modules/programs/hyfetch/default.nix b/third_party/home-manager/tests/modules/programs/hyfetch/default.nix new file mode 100644 index 0000000000..680b38cc90 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/hyfetch/default.nix @@ -0,0 +1,4 @@ +{ + hyfetch-settings = ./settings.nix; + hyfetch-empty-settings = ./empty-settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/hyfetch/empty-settings.nix b/third_party/home-manager/tests/modules/programs/hyfetch/empty-settings.nix new file mode 100644 index 0000000000..badb5220f4 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/hyfetch/empty-settings.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.hyfetch.enable = true; + + test.stubs.hyfetch = { }; + + nmt.script = '' + assertPathNotExists home-files/.config/hyfetch.json + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/hyfetch/hyfetch.json b/third_party/home-manager/tests/modules/programs/hyfetch/hyfetch.json new file mode 100644 index 0000000000..f94a9757a6 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/hyfetch/hyfetch.json @@ -0,0 +1,11 @@ +{ + "color_align": { + "custom_colors": [], + "fore_back": null, + "mode": "horizontal" + }, + "light_dark": "dark", + "lightness": 0.5, + "mode": "rgb", + "preset": "rainbow" +} diff --git a/third_party/home-manager/tests/modules/programs/hyfetch/settings.nix b/third_party/home-manager/tests/modules/programs/hyfetch/settings.nix new file mode 100644 index 0000000000..1cd98dc26a --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/hyfetch/settings.nix @@ -0,0 +1,25 @@ +{ ... }: + +{ + programs.hyfetch = { + enable = true; + + settings = { + preset = "rainbow"; + mode = "rgb"; + light_dark = "dark"; + lightness = 0.5; + color_align = { + mode = "horizontal"; + custom_colors = [ ]; + fore_back = null; + }; + }; + }; + + test.stubs.hyfetch = { }; + + nmt.script = '' + assertFileContent home-files/.config/hyfetch.json ${./hyfetch.json} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/i3status-rust/with-custom.nix b/third_party/home-manager/tests/modules/programs/i3status-rust/with-custom.nix index b53963ddba..c4131e02ad 100644 --- a/third_party/home-manager/tests/modules/programs/i3status-rust/with-custom.nix +++ b/third_party/home-manager/tests/modules/programs/i3status-rust/with-custom.nix @@ -102,14 +102,14 @@ with lib; icons = "awesome5" theme = "gruvbox-dark" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" @@ -175,7 +175,7 @@ with lib; [[block]] block = "battery" - '' + '' } ''; }; diff --git a/third_party/home-manager/tests/modules/programs/i3status-rust/with-default.nix b/third_party/home-manager/tests/modules/programs/i3status-rust/with-default.nix index 4a0d4a4c4d..b5c20cee73 100644 --- a/third_party/home-manager/tests/modules/programs/i3status-rust/with-default.nix +++ b/third_party/home-manager/tests/modules/programs/i3status-rust/with-default.nix @@ -16,20 +16,20 @@ with lib; icons = "none" theme = "plain" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" display_type = "memory" - format_mem = "{Mup}%" - format_swap = "{SUp}%" + format_mem = "{mem_used_percents}" + format_swap = "{swap_used_percents}" [[block]] block = "cpu" @@ -47,7 +47,7 @@ with lib; block = "time" format = "%a %d/%m %R" interval = 60 - '' + '' } ''; }; diff --git a/third_party/home-manager/tests/modules/programs/i3status-rust/with-extra-settings.nix b/third_party/home-manager/tests/modules/programs/i3status-rust/with-extra-settings.nix index 4a0442732b..aad7618ed6 100644 --- a/third_party/home-manager/tests/modules/programs/i3status-rust/with-extra-settings.nix +++ b/third_party/home-manager/tests/modules/programs/i3status-rust/with-extra-settings.nix @@ -105,20 +105,20 @@ with lib; test.stubs.i3status-rust = { }; nmt.script = '' - assertFileExists home-files/.config/i3status-rust/config-extra-settings.toml + 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" '' icons = "awesome5" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" @@ -191,7 +191,7 @@ with lib; [theme.overrides] idle_bg = "#123456" idle_fg = "#abcdef" - '' + '' } ''; }; diff --git a/third_party/home-manager/tests/modules/programs/i3status-rust/with-multiple-bars.nix b/third_party/home-manager/tests/modules/programs/i3status-rust/with-multiple-bars.nix index eab7f42d47..a8ffd37383 100644 --- a/third_party/home-manager/tests/modules/programs/i3status-rust/with-multiple-bars.nix +++ b/third_party/home-manager/tests/modules/programs/i3status-rust/with-multiple-bars.nix @@ -62,14 +62,14 @@ with lib; icons = "none" theme = "plain" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" diff --git a/third_party/home-manager/tests/modules/programs/i3status/with-custom.nix b/third_party/home-manager/tests/modules/programs/i3status/with-custom.nix index 830bc6c98d..8b673b8add 100644 --- a/third_party/home-manager/tests/modules/programs/i3status/with-custom.nix +++ b/third_party/home-manager/tests/modules/programs/i3status/with-custom.nix @@ -16,6 +16,8 @@ with lib; interval = 1; }; + package = config.lib.test.mkStubPackage { }; + modules = { "volume master" = { position = 1; diff --git a/third_party/home-manager/tests/modules/programs/irssi/example-settings-expected.config b/third_party/home-manager/tests/modules/programs/irssi/example-settings-expected.config index 8c54243bc3..6857eccf86 100644 --- a/third_party/home-manager/tests/modules/programs/irssi/example-settings-expected.config +++ b/third_party/home-manager/tests/modules/programs/irssi/example-settings-expected.config @@ -13,6 +13,8 @@ oftc = { type = "IRC"; nick = "nick"; autosendcmd = ""; + sasl_username = "nick"; + sasl_mechanism = "EXTERNAL"; }; }; diff --git a/third_party/home-manager/tests/modules/programs/irssi/example-settings.nix b/third_party/home-manager/tests/modules/programs/irssi/example-settings.nix index 93cf9f2d7c..f279b03c85 100644 --- a/third_party/home-manager/tests/modules/programs/irssi/example-settings.nix +++ b/third_party/home-manager/tests/modules/programs/irssi/example-settings.nix @@ -8,6 +8,7 @@ with lib; enable = true; networks.oftc = { nick = "nick"; + saslExternal = true; server = { address = "irc.oftc.net"; port = 6697; diff --git a/third_party/home-manager/tests/modules/programs/k9s/default.nix b/third_party/home-manager/tests/modules/programs/k9s/default.nix new file mode 100644 index 0000000000..58d9f32f3e --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/k9s/default.nix @@ -0,0 +1,4 @@ +{ + k9s-example-settings = ./example-settings.nix; + k9s-empty-settings = ./empty-settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/k9s/empty-settings.nix b/third_party/home-manager/tests/modules/programs/k9s/empty-settings.nix new file mode 100644 index 0000000000..5084be4fe0 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/k9s/empty-settings.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs.k9s.enable = true; + + test.stubs.k9s = { }; + + nmt.script = '' + assertPathNotExists home-files/.config/k9s + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/k9s/example-config-expected.yml b/third_party/home-manager/tests/modules/programs/k9s/example-config-expected.yml new file mode 100644 index 0000000000..019ee7a727 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/k9s/example-config-expected.yml @@ -0,0 +1,5 @@ +k9s: + enableMouse: true + headless: false + maxConnRetry: 5 + refreshRate: 2 diff --git a/third_party/home-manager/tests/modules/programs/k9s/example-settings.nix b/third_party/home-manager/tests/modules/programs/k9s/example-settings.nix new file mode 100644 index 0000000000..ffe5214487 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/k9s/example-settings.nix @@ -0,0 +1,42 @@ +{ config, ... }: + +{ + programs.k9s = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { + k9s = { + refreshRate = 2; + maxConnRetry = 5; + enableMouse = true; + headless = false; + }; + }; + + skin = { + k9s = { + body = { + fgColor = "dodgerblue"; + bgColor = "#ffffff"; + logoColor = "#0000ff"; + }; + info = { + fgColor = "lightskyblue"; + sectionColor = "steelblue"; + }; + }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/k9s/config.yml + assertFileContent \ + home-files/.config/k9s/config.yml \ + ${./example-config-expected.yml} + assertFileExists home-files/.config/k9s/skin.yml + assertFileContent \ + home-files/.config/k9s/skin.yml \ + ${./example-skin-expected.yml} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/k9s/example-skin-expected.yml b/third_party/home-manager/tests/modules/programs/k9s/example-skin-expected.yml new file mode 100644 index 0000000000..94f7e6eb84 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/k9s/example-skin-expected.yml @@ -0,0 +1,8 @@ +k9s: + body: + bgColor: '#ffffff' + fgColor: dodgerblue + logoColor: '#0000ff' + info: + fgColor: lightskyblue + sectionColor: steelblue diff --git a/third_party/home-manager/tests/modules/programs/kitty/example-settings-expected.conf b/third_party/home-manager/tests/modules/programs/kitty/example-settings-expected.conf index 0afd7a9a06..31d2fdc122 100644 --- a/third_party/home-manager/tests/modules/programs/kitty/example-settings-expected.conf +++ b/third_party/home-manager/tests/modules/programs/kitty/example-settings-expected.conf @@ -1,6 +1,5 @@ # Generated by Home Manager. # See https://sw.kovidgoyal.net/kitty/conf.html - font_family DejaVu Sans font_size 8 @@ -9,12 +8,8 @@ enable_audio_bell no scrollback_lines 10000 update_check_interval 0 - map ctrl+c copy_or_interrupt map ctrl+f>2 set_font_size 20 - env LS_COLORS=1 - - diff --git a/third_party/home-manager/tests/modules/programs/kodi/default.nix b/third_party/home-manager/tests/modules/programs/kodi/default.nix new file mode 100644 index 0000000000..1902645c48 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/default.nix @@ -0,0 +1,5 @@ +{ + kodi-example-addon-settings = ./example-addon-settings.nix; + kodi-example-settings = ./example-settings.nix; + kodi-example-sources = ./example-sources.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/kodi/example-addon-settings-expected.xml b/third_party/home-manager/tests/modules/programs/kodi/example-addon-settings-expected.xml new file mode 100644 index 0000000000..21259b2447 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/example-addon-settings-expected.xml @@ -0,0 +1,4 @@ + + + false + diff --git a/third_party/home-manager/tests/modules/programs/kodi/example-addon-settings.nix b/third_party/home-manager/tests/modules/programs/kodi/example-addon-settings.nix new file mode 100644 index 0000000000..c591d1ae39 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/example-addon-settings.nix @@ -0,0 +1,18 @@ +{ config, ... }: + +{ + programs.kodi = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + addonSettings = { + "service.xbmc.versioncheck".versioncheck_enable = "false"; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.kodi/userdata/addon_data/service.xbmc.versioncheck/settings.xml \ + ${./example-addon-settings-expected.xml} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/kodi/example-settings-expected.xml b/third_party/home-manager/tests/modules/programs/kodi/example-settings-expected.xml new file mode 100644 index 0000000000..2aca976377 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/example-settings-expected.xml @@ -0,0 +1,6 @@ + + + + true + + diff --git a/third_party/home-manager/tests/modules/programs/kodi/example-settings.nix b/third_party/home-manager/tests/modules/programs/kodi/example-settings.nix new file mode 100644 index 0000000000..bdb48268af --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/example-settings.nix @@ -0,0 +1,16 @@ +{ config, ... }: + +{ + programs.kodi = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { videolibrary.showemptytvshows = "true"; }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.kodi/userdata/advancedsettings.xml \ + ${./example-settings-expected.xml} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/kodi/example-sources-expected.xml b/third_party/home-manager/tests/modules/programs/kodi/example-sources-expected.xml new file mode 100644 index 0000000000..736f8963a1 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/example-sources-expected.xml @@ -0,0 +1,16 @@ + + + + diff --git a/third_party/home-manager/tests/modules/programs/kodi/example-sources.nix b/third_party/home-manager/tests/modules/programs/kodi/example-sources.nix new file mode 100644 index 0000000000..f49b500011 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/kodi/example-sources.nix @@ -0,0 +1,33 @@ +{ config, ... }: + +{ + programs.kodi = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + sources = { + video = { + default = "movies"; + source = [ + { + name = "videos"; + path = "/path/to/videos"; + allowsharing = "true"; + } + { + name = "movies"; + path = "/path/to/movies"; + allowsharing = "true"; + } + ]; + }; + }; + + }; + + nmt.script = '' + assertFileContent \ + home-files/.kodi/userdata/sources.xml \ + ${./example-sources-expected.xml} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/less/less-with-custom-keys.nix b/third_party/home-manager/tests/modules/programs/less/less-with-custom-keys.nix index 48f52b878d..23d4471892 100644 --- a/third_party/home-manager/tests/modules/programs/less/less-with-custom-keys.nix +++ b/third_party/home-manager/tests/modules/programs/less/less-with-custom-keys.nix @@ -15,8 +15,8 @@ with lib; test.stubs.less = { }; nmt.script = '' - assertFileExists home-files/.lesskey - assertFileContent home-files/.lesskey ${ + assertFileExists home-files/.config/lesskey + assertFileContent home-files/.config/lesskey ${ builtins.toFile "less.expected" '' s back-line t forw-line diff --git a/third_party/home-manager/tests/modules/programs/looking-glass-client/default.nix b/third_party/home-manager/tests/modules/programs/looking-glass-client/default.nix new file mode 100644 index 0000000000..fdbbb25a69 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/looking-glass-client/default.nix @@ -0,0 +1,4 @@ +{ + looking-glass-client-example-settings = ./example-settings.nix; + looking-glass-client-empty-settings = ./empty-settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/looking-glass-client/empty-settings.nix b/third_party/home-manager/tests/modules/programs/looking-glass-client/empty-settings.nix new file mode 100644 index 0000000000..10c177a9ef --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/looking-glass-client/empty-settings.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.looking-glass-client = { + enable = true; + package = config.lib.test.mkStubPackage { }; + }; + + nmt.script = '' + assertPathNotExists home-files/.config/looking-glass/client.ini + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/looking-glass-client/example-config.ini b/third_party/home-manager/tests/modules/programs/looking-glass-client/example-config.ini new file mode 100644 index 0000000000..db006d3f69 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/looking-glass-client/example-config.ini @@ -0,0 +1,16 @@ +[app] +allowDMA=true +shmFile=/dev/kvmfr0 + +[input] +escapeKey=62 +rawMouse=true + +[spice] +audio=true +enable=true + +[win] +fullScreen=true +jitRender=true +showFPS=false diff --git a/third_party/home-manager/tests/modules/programs/looking-glass-client/example-settings.nix b/third_party/home-manager/tests/modules/programs/looking-glass-client/example-settings.nix new file mode 100644 index 0000000000..6ac8f01852 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/looking-glass-client/example-settings.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: + +with lib; + +{ + config = { + programs.looking-glass-client = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { + app = { + allowDMA = true; + shmFile = "/dev/kvmfr0"; + }; + + win = { + fullScreen = true; + showFPS = false; + jitRender = true; + }; + + spice = { + enable = true; + audio = true; + }; + + input = { + rawMouse = true; + escapeKey = 62; + }; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/looking-glass/client.ini \ + ${./example-config.ini} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/mbsync/mbsync-expected.conf b/third_party/home-manager/tests/modules/programs/mbsync/mbsync-expected.conf index c1ca921ac1..1711097825 100644 --- a/third_party/home-manager/tests/modules/programs/mbsync/mbsync-expected.conf +++ b/third_party/home-manager/tests/modules/programs/mbsync/mbsync-expected.conf @@ -57,6 +57,7 @@ CertificateFile /etc/ssl/certs/ca-certificates.crt Host imap.example.com PassCmd password-command SSLType IMAPS +SSLVersions TLSv1.3 TLSv1.2 User home.manager IMAPStore hm@example.com-remote diff --git a/third_party/home-manager/tests/modules/programs/mbsync/mbsync.nix b/third_party/home-manager/tests/modules/programs/mbsync/mbsync.nix index 7042760a5b..862e1c0e00 100644 --- a/third_party/home-manager/tests/modules/programs/mbsync/mbsync.nix +++ b/third_party/home-manager/tests/modules/programs/mbsync/mbsync.nix @@ -21,6 +21,7 @@ with lib; accounts.email.accounts = { "hm@example.com".mbsync = { enable = true; + extraConfig.account.SSLVersions = [ "TLSv1.3" "TLSv1.2" ]; groups.inboxes = { channels = { inbox1 = { diff --git a/third_party/home-manager/tests/modules/programs/micro/default.nix b/third_party/home-manager/tests/modules/programs/micro/default.nix new file mode 100644 index 0000000000..984b9fa63b --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/micro/default.nix @@ -0,0 +1 @@ +{ micro = ./micro.nix; } diff --git a/third_party/home-manager/tests/modules/programs/micro/micro.nix b/third_party/home-manager/tests/modules/programs/micro/micro.nix new file mode 100644 index 0000000000..92ab90e835 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/micro/micro.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + programs.micro = { + enable = true; + + settings = { + autosu = false; + cursorline = false; + }; + }; + + test.stubs.micro = { }; + + nmt.script = '' + assertFileContent home-files/.config/micro/settings.json \ + ${builtins.toFile "micro-expected-settings.json" '' + { + "autosu": false, + "cursorline": false + } + ''} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/mu/basic-configuration.nix b/third_party/home-manager/tests/modules/programs/mu/basic-configuration.nix new file mode 100644 index 0000000000..4b315c2e9c --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/mu/basic-configuration.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + accounts.email.accounts = { + "hm@example.com" = { + mu.enable = true; + aliases = [ "foo@example.com" ]; + }; + }; + + programs.mu.enable = true; + + test.stubs.mu = { }; + + nmt.script = '' + assertFileContains activate \ + 'if [[ ! -d "/home/hm-user/.cache/mu" ]]; then' + + assertFileContains activate \ + '$DRY_RUN_CMD @mu@/bin/mu init --maildir=/home/hm-user/Mail --my-address=hm@example.com --my-address=foo@example.com $VERBOSE_ARG;' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/mu/default.nix b/third_party/home-manager/tests/modules/programs/mu/default.nix new file mode 100644 index 0000000000..bdd8b15605 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/mu/default.nix @@ -0,0 +1 @@ +{ mu-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/programs/mujmap/default.nix b/third_party/home-manager/tests/modules/programs/mujmap/default.nix new file mode 100644 index 0000000000..8de0e917c3 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/mujmap/default.nix @@ -0,0 +1,5 @@ +{ + mujmap-defaults = ./mujmap-defaults.nix; + mujmap-fqdn-and-session-url-specified = + ./mujmap-fqdn-and-session-url-specified.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/mujmap/mujmap-defaults-expected.toml b/third_party/home-manager/tests/modules/programs/mujmap/mujmap-defaults-expected.toml new file mode 100644 index 0000000000..87b5bf402a --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/mujmap/mujmap-defaults-expected.toml @@ -0,0 +1,14 @@ +auto_create_new_mailboxes = true +fqdn = "example.com" +password_command = "'password-command'" +username = "home.manager" + +[tags] +deleted = "deleted" +directory_separator = "/" +important = "important" +inbox = "inbox" +lowercase = false +phishing = "phishing" +sent = "sent" +spam = "spam" diff --git a/third_party/home-manager/tests/modules/programs/mujmap/mujmap-defaults.nix b/third_party/home-manager/tests/modules/programs/mujmap/mujmap-defaults.nix new file mode 100644 index 0000000000..7049789975 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/mujmap/mujmap-defaults.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + programs.mujmap.enable = true; + programs.mujmap.package = config.lib.test.mkStubPackage { }; + + accounts.email.accounts."hm@example.com" = { + jmap.host = "example.com"; + mujmap.enable = true; + notmuch.enable = true; + }; + + nmt.script = '' + assertFileExists home-files/Mail/hm@example.com/mujmap.toml + assertFileContent home-files/Mail/hm@example.com/mujmap.toml ${ + ./mujmap-defaults-expected.toml + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix b/third_party/home-manager/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix new file mode 100644 index 0000000000..03c3f542ee --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/mujmap/mujmap-fqdn-and-session-url-specified.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + programs.mujmap.enable = true; + programs.mujmap.package = config.lib.test.mkStubPackage { }; + + accounts.email.accounts."hm@example.com" = { + jmap.host = "example.com"; + jmap.sessionUrl = "https://jmap.example.com/"; + mujmap.enable = true; + notmuch.enable = true; + }; + + nmt.script = '' + assertFileExists home-files/Mail/hm@example.com/mujmap.toml + assertFileContent home-files/Mail/hm@example.com/mujmap.toml ${ + ./mujmap-defaults-expected.toml + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/default.nix b/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/default.nix index b1185c8524..4193392784 100644 --- a/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/default.nix +++ b/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/default.nix @@ -1 +1,4 @@ -{ ncmpcpp-use-mpd-config = ./ncmpcpp-use-mpd-config.nix; } +{ + ncmpcpp-use-mpd-config = ./ncmpcpp-use-mpd-config.nix; + ncmpcpp-issue-3560 = ./ncmpcpp-issue-3560.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config b/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config new file mode 100644 index 0000000000..24a2f3bc3b --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config @@ -0,0 +1 @@ +mpd_music_dir=~/music diff --git a/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix b/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix new file mode 100644 index 0000000000..ba1607ab8c --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + config = { + # Minimal config reproducing + # https://github.com/nix-community/home-manager/issues/3560 + programs.ncmpcpp.enable = true; + + services.mpd.enable = true; + services.mpd.musicDirectory = "~/music"; + + test.stubs = { + ncmpcpp = { }; + mpd = { }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/ncmpcpp/config \ + ${./ncmpcpp-issue-3560-expected-config} + + assertPathNotExists home-files/.config/ncmpcpp/bindings + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/neomutt/default.nix b/third_party/home-manager/tests/modules/programs/neomutt/default.nix index 62319dd365..8216017c1c 100644 --- a/third_party/home-manager/tests/modules/programs/neomutt/default.nix +++ b/third_party/home-manager/tests/modules/programs/neomutt/default.nix @@ -9,4 +9,6 @@ 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; + neomutt-with-signature = ./neomutt-with-signature.nix; + neomutt-with-signature-command = ./neomutt-with-signature-command.nix; } diff --git a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-expected b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-expected index 6c96f61f41..78b756364a 100644 --- a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-expected +++ b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-expected @@ -31,6 +31,8 @@ set trash='+Trash' # Extra configuration color status cyan default + +unset signature # notmuch section set nm_default_uri = "notmuch:///home/hm-user/Mail" virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox" diff --git a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-gpg-expected.conf b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-gpg-expected.conf index f7763dbe66..576064243d 100644 --- a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-gpg-expected.conf +++ b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-gpg-expected.conf @@ -30,3 +30,5 @@ set trash='+Trash' # Extra configuration + +unset signature diff --git a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-msmtp-expected.conf b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-msmtp-expected.conf index d2e2f3eeec..354cc43ee6 100644 --- a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-msmtp-expected.conf +++ b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-msmtp-expected.conf @@ -30,3 +30,5 @@ set trash='+Trash' # Extra configuration color status cyan default + +unset signature diff --git a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-no-folder-change-expected.conf b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-no-folder-change-expected.conf index 03ea3b31af..e5dee06168 100644 --- a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-no-folder-change-expected.conf +++ b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-no-folder-change-expected.conf @@ -28,3 +28,5 @@ set trash='+Trash' # Extra configuration + +unset signature diff --git a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-command-expected b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-command-expected new file mode 100644 index 0000000000..dfc8bc39ad --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-command-expected @@ -0,0 +1,38 @@ +# Generated by Home Manager. +set ssl_force_tls = yes +set certificate_file=/etc/ssl/certs/ca-certificates.crt + +# GPG section +set crypt_use_gpgme = yes +set crypt_autosign = no +set crypt_opportunistic_encrypt = no +set pgp_use_gpg_agent = yes +set mbox_type = Maildir +set sort = "threads" + +# MTA section +set smtp_pass="`password-command`" +set smtp_url='smtps://home.manager@smtp.example.com' + + + + + +# MRA section +set folder='/home/hm-user/Mail/hm@example.com' +set from='hm@example.com' +set postponed='+Drafts' +set realname='H. M. Test' +set record='+Sent' +set spoolfile='+Inbox' +set trash='+Trash' + + +# Extra configuration +color status cyan default + + +set signature = "/nix/store/00000000000000000000000000000000-signature|" +# notmuch section +set nm_default_uri = "notmuch:///home/hm-user/Mail" +virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox" diff --git a/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-expected b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-expected new file mode 100644 index 0000000000..441374a9b8 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-expected @@ -0,0 +1,38 @@ +# Generated by Home Manager. +set ssl_force_tls = yes +set certificate_file=/etc/ssl/certs/ca-certificates.crt + +# GPG section +set crypt_use_gpgme = yes +set crypt_autosign = no +set crypt_opportunistic_encrypt = no +set pgp_use_gpg_agent = yes +set mbox_type = Maildir +set sort = "threads" + +# MTA section +set smtp_pass="`password-command`" +set smtp_url='smtps://home.manager@smtp.example.com' + + + + + +# MRA section +set folder='/home/hm-user/Mail/hm@example.com' +set from='hm@example.com' +set postponed='+Drafts' +set realname='H. M. Test' +set record='+Sent' +set spoolfile='+Inbox' +set trash='+Trash' + + +# Extra configuration +color status cyan default + + +set signature = /nix/store/00000000000000000000000000000000-signature.txt +# notmuch section +set nm_default_uri = "notmuch:///home/hm-user/Mail" +virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox" diff --git a/third_party/home-manager/tests/modules/programs/neomutt/neomutt-with-signature-command.nix b/third_party/home-manager/tests/modules/programs/neomutt/neomutt-with-signature-command.nix new file mode 100644 index 0000000000..97c2001f96 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/neomutt/neomutt-with-signature-command.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; + }; + imap.port = 993; + signature = { + showSignature = "append"; + command = pkgs.writeScript "signature" "echo This is my signature"; + }; + }; + }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + test.stubs.neomutt = { }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") + assertFileContent "$expectedSignature" ${ + ./hm-example.com-signature-command-expected + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/neomutt/neomutt-with-signature.nix b/third_party/home-manager/tests/modules/programs/neomutt/neomutt-with-signature.nix new file mode 100644 index 0000000000..9461976d3e --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/neomutt/neomutt-with-signature.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + accounts.email.accounts = { + "hm@example.com" = { + notmuch.enable = true; + neomutt = { + enable = true; + extraConfig = '' + color status cyan default + ''; + }; + imap.port = 993; + signature = { + showSignature = "append"; + text = '' + -- + Test Signature + ''; + }; + }; + }; + + programs.neomutt = { + enable = true; + vimKeys = false; + }; + + test.stubs.neomutt = { }; + + nmt.script = '' + assertFileExists home-files/.config/neomutt/neomuttrc + assertFileExists home-files/.config/neomutt/hm@example.com + assertFileContent home-files/.config/neomutt/neomuttrc ${ + ./neomutt-expected.conf + } + expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com") + assertFileContent "$expectedSignature" ${ + ./hm-example.com-signature-expected + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/neovim/default.nix b/third_party/home-manager/tests/modules/programs/neovim/default.nix index 8a6c316ea5..3950dc8b86 100644 --- a/third_party/home-manager/tests/modules/programs/neovim/default.nix +++ b/third_party/home-manager/tests/modules/programs/neovim/default.nix @@ -1,6 +1,8 @@ { neovim-plugin-config = ./plugin-config.nix; neovim-coc-config = ./coc-config.nix; + neovim-runtime = ./runtime.nix; + # waiting for a nixpkgs patch - # neovim-no-init = ./no-init.nix; + neovim-no-init = ./no-init.nix; } diff --git a/third_party/home-manager/tests/modules/programs/neovim/no-init.nix b/third_party/home-manager/tests/modules/programs/neovim/no-init.nix index 1156529d3e..693bdedec0 100644 --- a/third_party/home-manager/tests/modules/programs/neovim/no-init.nix +++ b/third_party/home-manager/tests/modules/programs/neovim/no-init.nix @@ -6,17 +6,23 @@ with lib; config = { programs.neovim = { enable = true; - package = pkgs.neovim-unwrapped; vimAlias = true; withNodeJs = false; withPython3 = true; withRuby = false; extraPython3Packages = (ps: with ps; [ jedi pynvim ]); + + # plugins without associated config should not trigger the creation of init.vim + plugins = with pkgs.vimPlugins; [ + vim-fugitive + ({ plugin = vim-sensible; }) + ]; }; nmt.script = '' - vimrc="home-files/.config/nvim/init.vim" - assertPathNotExists "$vimrc" + nvimFolder="home-files/.config/nvim" + assertPathNotExists "$nvimFolder/init.vim" + assertPathNotExists "$nvimFolder/init.lua" ''; }; } diff --git a/third_party/home-manager/tests/modules/programs/neovim/plugin-config.nix b/third_party/home-manager/tests/modules/programs/neovim/plugin-config.nix index f4f81d8d32..e4921aae6a 100644 --- a/third_party/home-manager/tests/modules/programs/neovim/plugin-config.nix +++ b/third_party/home-manager/tests/modules/programs/neovim/plugin-config.nix @@ -7,27 +7,27 @@ with lib; programs.neovim = { enable = true; extraConfig = '' - " This should be present in vimrc + let g:hmExtraConfig='HM_EXTRA_CONFIG' ''; plugins = with pkgs.vimPlugins; [ vim-nix { plugin = vim-commentary; config = '' - " This should be present too - autocmd FileType c setlocal commentstring=//\ %s - autocmd FileType c setlocal comments=:// + let g:hmPlugins='HM_PLUGINS_CONFIG' ''; } ]; + extraLuaPackages = [ pkgs.lua51Packages.luautf8 ]; }; nmt.script = '' - vimrc="$TESTED/home-files/.config/nvim/init.vim" - vimrcNormalized="$(normalizeStorePaths "$vimrc")" - - assertFileExists "$vimrc" - assertFileContent "$vimrcNormalized" "${./plugin-config.vim}" + vimout=$(mktemp) + echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \ + | ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \ + > "$vimout" + assertFileContains "$vimout" "HM_EXTRA_CONFIG" + assertFileContains "$vimout" "HM_PLUGINS_CONFIG" ''; }; } diff --git a/third_party/home-manager/tests/modules/programs/neovim/plugin-config.vim b/third_party/home-manager/tests/modules/programs/neovim/plugin-config.vim deleted file mode 100644 index 89278a0a94..0000000000 --- a/third_party/home-manager/tests/modules/programs/neovim/plugin-config.vim +++ /dev/null @@ -1,10 +0,0 @@ -set packpath^=/nix/store/00000000000000000000000000000000-vim-pack-dir -set runtimepath^=/nix/store/00000000000000000000000000000000-vim-pack-dir - -" vim-commentary {{{ -" This should be present too -autocmd FileType c setlocal commentstring=//\ %s -autocmd FileType c setlocal comments=:// - -" }}} -" This should be present in vimrc diff --git a/third_party/home-manager/tests/modules/programs/neovim/runtime.nix b/third_party/home-manager/tests/modules/programs/neovim/runtime.nix new file mode 100644 index 0000000000..b9d9638a8b --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/neovim/runtime.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.neovim = lib.mkMerge [ + { + enable = true; + plugins = with pkgs.vimPlugins; [ + vim-nix + { + plugin = vim-commentary; + runtime = { + "after/ftplugin/c.vim".text = '' + " plugin-specific config + setlocal commentstring=//\ %s + setlocal comments=:// + ''; + }; + } + ]; + } + { + extraPython3Packages = ps: with ps; [ jedi pynvim ]; + extraLuaPackages = ps: with ps; [ luacheck ]; + } + { + extraPython3Packages = with pkgs.python3Packages; [ jedi pynvim ]; + extraLuaPackages = with pkgs.lua51Packages; [ luacheck ]; + } + ]; + + nmt.script = '' + ftplugin="home-files/.config/nvim/after/ftplugin/c.vim" + assertFileExists "$ftplugin" + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/nheko/default.nix b/third_party/home-manager/tests/modules/programs/nheko/default.nix new file mode 100644 index 0000000000..573182eda2 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nheko/default.nix @@ -0,0 +1,4 @@ +{ + nheko-empty-settings = ./nheko-empty-settings.nix; + nheko-example-settings = ./nheko-example-settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/nheko/nheko-empty-settings.nix b/third_party/home-manager/tests/modules/programs/nheko/nheko-empty-settings.nix new file mode 100644 index 0000000000..65538d9ebe --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nheko/nheko-empty-settings.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: + +let + configDir = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support" + else + "home-files/.config"; +in { + programs.nheko.enable = true; + + test.stubs.nheko = { }; + + nmt.script = '' + assertPathNotExists "${configDir}/nheko/nheko.conf" + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/nheko/nheko-example-settings-expected-config.ini b/third_party/home-manager/tests/modules/programs/nheko/nheko-example-settings-expected-config.ini new file mode 100644 index 0000000000..d3a1c5e252 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nheko/nheko-example-settings-expected-config.ini @@ -0,0 +1,64 @@ +; Generated by Home Manager. + +[auth] +access_token=MY_ACCESS_TOKEN +device_id=MY_DEVICE +home_server=https://matrix-client.matrix.org:443 +user_id=@@user:matrix.org + +[general] +disable_certificate_validation=false + +[settings] +scale_factor=0.700000 + +[sidebar] +width=416 + +[user] +alert_on_notification=true +animate_images_on_hover=false +automatically_share_keys_with_trusted_users=false +avatar_circles=true +bubbles_enabled=false +decrypt_sidebar=true +desktop_notifications=true +emoji_font_family=Noto Emoji +expose_dbus_api=false +font_family=JetBrainsMonoMedium Nerd Font Mono +font_size=9 +group_view=true +markdown_enabled=true +minor_events=false +mobile_mode=false +muted_tags=global +online_key_backup=false +only_share_keys_with_verified_users=false +open_image_external=false +open_video_external=false +presence=AutomaticPresence +privacy_screen=false +privacy_screen_timeout=0 +read_receipts=true +ringtone=Mute +share_keys_with_trusted_users=true +sidebar\community_list_width=40 +sidebar\room_list_width=308 +small_avatars_enabled=false +sort_by_unread=true +space_notifications=true +theme=dark +timeline\buttons=true +timeline\enlarge_emoji_only_msg=true +timeline\max_width=0 +timeline\message_hover_highlight=false +typing_notifications=true +use_identicon=true +use_stun_server=false +window\start_in_tray=false +window\tray=true + +[window] +height=482 +width=950 + diff --git a/third_party/home-manager/tests/modules/programs/nheko/nheko-example-settings.nix b/third_party/home-manager/tests/modules/programs/nheko/nheko-example-settings.nix new file mode 100644 index 0000000000..26599c5a08 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nheko/nheko-example-settings.nix @@ -0,0 +1,84 @@ +{ pkgs, ... }: + +let + configDir = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support" + else + "home-files/.config"; +in { + programs.nheko = { + enable = true; + + settings = { + general = { disableCertificateValidation = false; }; + + auth = { + accessToken = "MY_ACCESS_TOKEN"; + deviceId = "MY_DEVICE"; + homeServer = "https://matrix-client.matrix.org:443"; + userId = "@@user:matrix.org"; + }; + + sidebar = { width = 416; }; + + settings = { scaleFactor = 0.7; }; + + user = { + alertOnNotification = true; + animateImagesOnHover = false; + automaticallyShareKeysWithTrustedUsers = false; + avatarCircles = true; + bubblesEnabled = false; + decryptSidebar = true; + desktopNotifications = true; + emojiFontFamily = "Noto Emoji"; + exposeDbusApi = false; + fontFamily = "JetBrainsMonoMedium Nerd Font Mono"; + fontSize = 9; + groupView = true; + markdownEnabled = true; + minorEvents = false; + mobileMode = false; + mutedTags = "global"; + onlineKeyBackup = false; + onlyShareKeysWithVerifiedUsers = false; + openImageExternal = false; + openVideoExternal = false; + presence = "AutomaticPresence"; + privacyScreen = false; + privacyScreenTimeout = 0; + readReceipts = true; + ringtone = "Mute"; + shareKeysWithTrustedUsers = true; + smallAvatarsEnabled = false; + "sidebar\\communityListWidth" = 40; + "sidebar\\roomListWidth" = 308; + sortByUnread = true; + spaceNotifications = true; + theme = "dark"; + "timeline\\buttons" = true; + "timeline\\enlargeEmojiOnlyMsg" = true; + "timeline\\maxWidth" = 0; + "timeline\\messageHoverHighlight" = false; + typingNotifications = true; + useIdenticon = true; + useStunServer = false; + "window\\startInTray" = false; + "window\\tray" = true; + }; + + window = { + height = 482; + width = 950; + }; + }; + }; + + test.stubs.nheko = { }; + + nmt.script = '' + assertFileContent \ + "${configDir}/nheko/nheko.conf" \ + ${./nheko-example-settings-expected-config.ini} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/nix-index/assert-on-command-not-found.nix b/third_party/home-manager/tests/modules/programs/nix-index/assert-on-command-not-found.nix index 0fa6ee7998..94d7efc34c 100644 --- a/third_party/home-manager/tests/modules/programs/nix-index/assert-on-command-not-found.nix +++ b/third_party/home-manager/tests/modules/programs/nix-index/assert-on-command-not-found.nix @@ -12,10 +12,7 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - fish = { }; - }; + test.stubs.zsh = { }; programs.nix-index.enable = true; diff --git a/third_party/home-manager/tests/modules/programs/nix-index/integrations.nix b/third_party/home-manager/tests/modules/programs/nix-index/integrations.nix index 1ae46df55e..2fd5253acf 100644 --- a/third_party/home-manager/tests/modules/programs/nix-index/integrations.nix +++ b/third_party/home-manager/tests/modules/programs/nix-index/integrations.nix @@ -16,10 +16,7 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - fish = { }; - }; + test.stubs.zsh = { }; programs.nix-index.enable = true; diff --git a/third_party/home-manager/tests/modules/programs/nnn/nnn.nix b/third_party/home-manager/tests/modules/programs/nnn/nnn.nix index aeb7d3fc51..7a01fd8540 100644 --- a/third_party/home-manager/tests/modules/programs/nnn/nnn.nix +++ b/third_party/home-manager/tests/modules/programs/nnn/nnn.nix @@ -24,6 +24,8 @@ test.stubs = { nnnDummy.buildScript = '' + runHook preInstall + mkdir -p "$out/bin" touch "$out/bin/nnn" chmod +x "$out/bin/nnn" @@ -40,17 +42,13 @@ script = '' assertDirectoryExists home-files/.config/nnn/plugins - assertFileRegex \ - home-path/bin/nnn \ - "^export NNN_BMS='D:~/Downloads;d:~/Documents;p:~/Pictures;v:~/Videos'\''${NNN_BMS:+':'}\$NNN_BMS$" + for bookmark in 'export NNN_BMS' '~/Downloads' '~/Documents' '~/Pictures' '~/Videos'; do + assertFileRegex home-path/bin/nnn "$bookmark" + done - assertFileRegex \ - home-path/bin/nnn \ - "^export NNN_PLUG='c:fzcd;f:finder;v:imgview'\''${NNN_PLUG:+':'}\$NNN_PLUG$" - - assertFileRegex \ - home-path/bin/nnn \ - "/nix/store/.*-"{foo,bar}"/bin" + for plugin in 'export NNN_PLUG' 'fzcd' 'finder' 'imgview'; do + assertFileRegex home-path/bin/nnn "$plugin" + done ''; }; }; diff --git a/third_party/home-manager/tests/modules/programs/nushell/config-expected.nu b/third_party/home-manager/tests/modules/programs/nushell/config-expected.nu new file mode 100644 index 0000000000..c70286d702 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nushell/config-expected.nu @@ -0,0 +1,6 @@ +let $config = { + filesize_metric: false + table_mode: rounded + use_ls_colors: true +} + diff --git a/third_party/home-manager/tests/modules/programs/nushell/default.nix b/third_party/home-manager/tests/modules/programs/nushell/default.nix index 5b3bfa1a5b..52d9b3c7b8 100644 --- a/third_party/home-manager/tests/modules/programs/nushell/default.nix +++ b/third_party/home-manager/tests/modules/programs/nushell/default.nix @@ -1 +1 @@ -{ nushell-settings = ./settings.nix; } +{ nushell-example-settings = ./example-settings.nix; } diff --git a/third_party/home-manager/tests/modules/programs/nushell/env-expected.nu b/third_party/home-manager/tests/modules/programs/nushell/env-expected.nu new file mode 100644 index 0000000000..280b59bfaa --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nushell/env-expected.nu @@ -0,0 +1,2 @@ +let-env FOO = 'BAR' + diff --git a/third_party/home-manager/tests/modules/programs/nushell/example-settings.nix b/third_party/home-manager/tests/modules/programs/nushell/example-settings.nix new file mode 100644 index 0000000000..21d94a70a7 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/nushell/example-settings.nix @@ -0,0 +1,35 @@ +{ pkgs, ... }: + +{ + programs.nushell = { + enable = true; + + configFile.text = '' + let $config = { + filesize_metric: false + table_mode: rounded + use_ls_colors: true + } + ''; + + envFile.text = '' + let-env FOO = 'BAR' + ''; + }; + + test.stubs.nushell = { }; + + nmt.script = let + configDir = if pkgs.stdenv.isDarwin 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} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/nushell/settings-expected.toml b/third_party/home-manager/tests/modules/programs/nushell/settings-expected.toml deleted file mode 100644 index 87c5de2500..0000000000 --- a/third_party/home-manager/tests/modules/programs/nushell/settings-expected.toml +++ /dev/null @@ -1,5 +0,0 @@ -completion_mode = "circular" -edit_mode = "vi" -key_timeout = 10 -no_auto_pivot = true -startup = ["alias la [] { ls -a }", "alias e [msg] { echo $msg }"] diff --git a/third_party/home-manager/tests/modules/programs/nushell/settings.nix b/third_party/home-manager/tests/modules/programs/nushell/settings.nix deleted file mode 100644 index 7eef0909ca..0000000000 --- a/third_party/home-manager/tests/modules/programs/nushell/settings.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -{ - config = { - programs.nushell = { - enable = true; - - settings = mkMerge [ - { - edit_mode = "vi"; - startup = [ "alias la [] { ls -a }" ]; - completion_mode = "circular"; - key_timeout = 10; - } - - { - startup = [ "alias e [msg] { echo $msg }" ]; - no_auto_pivot = true; - } - ]; - }; - - test.stubs.nushell = { }; - - nmt.script = '' - assertFileContent \ - home-files/.config/nu/config.toml \ - ${./settings-expected.toml} - ''; - }; -} diff --git a/third_party/home-manager/tests/modules/programs/oh-my-posh/bash.nix b/third_party/home-manager/tests/modules/programs/oh-my-posh/bash.nix new file mode 100644 index 0000000000..2e3d93ac3f --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/oh-my-posh/bash.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + programs = { + bash.enable = true; + + oh-my-posh = { + enable = true; + useTheme = "jandedobbeleer"; + }; + }; + + test.stubs.oh-my-posh = { }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + '/bin/oh-my-posh init bash --config' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/oh-my-posh/default.nix b/third_party/home-manager/tests/modules/programs/oh-my-posh/default.nix new file mode 100644 index 0000000000..6552625668 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/oh-my-posh/default.nix @@ -0,0 +1,5 @@ +{ + oh-my-posh-bash = ./bash.nix; + oh-my-posh-zsh = ./zsh.nix; + oh-my-posh-fish = ./fish.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/oh-my-posh/fish.nix b/third_party/home-manager/tests/modules/programs/oh-my-posh/fish.nix new file mode 100644 index 0000000000..07137b986f --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/oh-my-posh/fish.nix @@ -0,0 +1,25 @@ +{ lib, ... }: + +{ + programs = { + fish.enable = true; + + oh-my-posh = { + enable = true; + useTheme = "jandedobbeleer"; + }; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs.oh-my-posh = { }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + '/bin/oh-my-posh init fish --config' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/oh-my-posh/zsh.nix b/third_party/home-manager/tests/modules/programs/oh-my-posh/zsh.nix new file mode 100644 index 0000000000..6d2a5bedbd --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/oh-my-posh/zsh.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + programs = { + zsh.enable = true; + + oh-my-posh = { + enable = true; + useTheme = "jandedobbeleer"; + }; + }; + + test.stubs = { + oh-my-posh = { }; + zsh = { }; + }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + '/bin/oh-my-posh init zsh --config' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/pandoc/csl.nix b/third_party/home-manager/tests/modules/programs/pandoc/csl.nix new file mode 100644 index 0000000000..7384ec995e --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/csl.nix @@ -0,0 +1,18 @@ +{ config, ... }: + +{ + programs.pandoc = { + enable = true; + + citationStyles = [ ./example.csl ]; + }; + + test.stubs.pandoc = import ./stub.nix; + + nmt.script = '' + assertFileExists home-files/.local/share/pandoc/csl/example.csl + assertFileContent home-files/.local/share/pandoc/csl/example.csl \ + ${./example.csl} + ''; +} + diff --git a/third_party/home-manager/tests/modules/programs/pandoc/default.nix b/third_party/home-manager/tests/modules/programs/pandoc/default.nix new file mode 100644 index 0000000000..d33eff86c2 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/default.nix @@ -0,0 +1,5 @@ +{ + pandoc-citation-styles = ./csl.nix; + pandoc-defaults = ./defaults.nix; + pandoc-templates = ./templates.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/pandoc/defaults-expected.json b/third_party/home-manager/tests/modules/programs/pandoc/defaults-expected.json new file mode 100644 index 0000000000..efffefb2b3 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/defaults-expected.json @@ -0,0 +1,7 @@ +{ + "citeproc": true, + "metadata": { + "author": "John Doe" + }, + "pdf-engine": "xelatex" +} diff --git a/third_party/home-manager/tests/modules/programs/pandoc/defaults.nix b/third_party/home-manager/tests/modules/programs/pandoc/defaults.nix new file mode 100644 index 0000000000..e9288657b6 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/defaults.nix @@ -0,0 +1,30 @@ +{ config, lib, ... }: + +let cfg = config.programs.pandoc; + +in { + config = lib.mkIf config.test.enableBig { + programs.pandoc = { + enable = true; + + defaults = { + metadata = { author = "John Doe"; }; + pdf-engine = "xelatex"; + citeproc = true; + }; + }; + + nmt.script = '' + assertFileContent ${cfg.defaultsFile} ${./defaults-expected.json} + + # Test that defaults are set by looking at the metadata for an empty file + # (it should contain the author that we set in defaults). + output=$(mktemp) + ${cfg.finalPackage}/bin/pandoc --standalone \ + -f markdown /dev/null \ + -t native -o "$output" + assertFileContent "$output" ${./output-expected} + ''; + }; +} + diff --git a/third_party/home-manager/tests/modules/programs/pandoc/example.csl b/third_party/home-manager/tests/modules/programs/pandoc/example.csl new file mode 100644 index 0000000000..63f6267014 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/example.csl @@ -0,0 +1,12 @@ + + diff --git a/third_party/home-manager/tests/modules/programs/pandoc/output-expected b/third_party/home-manager/tests/modules/programs/pandoc/output-expected new file mode 100644 index 0000000000..390e82099c --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/output-expected @@ -0,0 +1,5 @@ +Pandoc + Meta + { unMeta = fromList [ ( "author" , MetaString "John Doe" ) ] + } + [] diff --git a/third_party/home-manager/tests/modules/programs/pandoc/stub.nix b/third_party/home-manager/tests/modules/programs/pandoc/stub.nix new file mode 100644 index 0000000000..26af1e3ba2 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/stub.nix @@ -0,0 +1,10 @@ +{ + name = "pandoc-stub"; + outPath = null; + buildScript = '' + mkdir -p "$out"/bin + pandoc="$out"/bin/pandoc + echo 'Stub to make the wrapper happy' > "$pandoc" + chmod a+x "$pandoc" + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/pandoc/template.latex b/third_party/home-manager/tests/modules/programs/pandoc/template.latex new file mode 100644 index 0000000000..16d24ec807 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/template.latex @@ -0,0 +1,9 @@ +\documentclass[a4paper]{scrartcl} + +$if(title)$\title{$title$}$endif$ +$if(author)$\author{$for(author)$$author$$sep$ \and $endfor$}$endif$ + +\begin{document} +\maketitle +$body$ +\end{document} diff --git a/third_party/home-manager/tests/modules/programs/pandoc/templates.nix b/third_party/home-manager/tests/modules/programs/pandoc/templates.nix new file mode 100644 index 0000000000..f276381a36 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pandoc/templates.nix @@ -0,0 +1,18 @@ +{ config, ... }: + +{ + programs.pandoc = { + enable = true; + + templates = { "default.latex" = ./template.latex; }; + }; + + test.stubs.pandoc = import ./stub.nix; + + nmt.script = '' + assertFileExists home-files/.local/share/pandoc/templates/default.latex + assertFileContent home-files/.local/share/pandoc/templates/default.latex \ + ${./template.latex} + ''; +} + diff --git a/third_party/home-manager/tests/modules/programs/pistol/associations.nix b/third_party/home-manager/tests/modules/programs/pistol/associations.nix new file mode 100644 index 0000000000..764060ba9e --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pistol/associations.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: + +{ + programs.pistol = { + enable = true; + associations = [ + { + mime = "application/json"; + command = "bat %pistol-filename%"; + } + { + mime = "application/*"; + command = "hexyl %pistol-filename%"; + } + { + fpath = ".*.md$"; + command = + "sh: bat --paging=never --color=always %pistol-filename% | head -8"; + } + ]; + }; + + test.stubs.pistol = { }; + + 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/third_party/home-manager/tests/modules/programs/pistol/config.nix b/third_party/home-manager/tests/modules/programs/pistol/config.nix new file mode 100644 index 0000000000..1999befa66 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pistol/config.nix @@ -0,0 +1,21 @@ +{ + programs.pistol = { + enable = true; + config = { + "text/*" = + "bat --paging=never --color=always --style=auto --wrap=character --terminal-width=%pistol-extra0% --line-range=1:%pistol-extra1% %pistol-filename%"; + "application/json" = + "bat --paging=never --color=always --style=auto --wrap=character --terminal-width=%pistol-extra0% --line-range=1:%pistol-extra1% %pistol-filename%"; + }; + }; + + test.stubs.pistol = { }; + + 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. + '') + ]; +} diff --git a/third_party/home-manager/tests/modules/programs/pistol/default.nix b/third_party/home-manager/tests/modules/programs/pistol/default.nix new file mode 100644 index 0000000000..1efcbc6a7a --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pistol/default.nix @@ -0,0 +1,6 @@ +{ + pistol-associations = ./associations.nix; + pistol-config = ./config.nix; + pistol-double-association = ./double-association.nix; + pistol-missing-association = ./missing-association.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/pistol/double-association.nix b/third_party/home-manager/tests/modules/programs/pistol/double-association.nix new file mode 100644 index 0000000000..103f4d0571 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pistol/double-association.nix @@ -0,0 +1,18 @@ +{ + programs.pistol = { + enable = true; + # contains both fpath and mime + associations = [{ + fpath = ".*.md$"; + mime = "application/json"; + command = "bat %pistol-filename%"; + }]; + }; + + test.stubs.pistol = { }; + + test.asserts.assertions.expected = ['' + Each entry in programs.pistol.associations must contain exactly one + of fpath or mime. + '']; +} diff --git a/third_party/home-manager/tests/modules/programs/pistol/missing-association.nix b/third_party/home-manager/tests/modules/programs/pistol/missing-association.nix new file mode 100644 index 0000000000..6ea0a4486a --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pistol/missing-association.nix @@ -0,0 +1,14 @@ +{ + programs.pistol = { + enable = true; + # contains no fpath or mime value + associations = [{ command = "bat %pistol-filename%"; }]; + }; + + test.stubs.pistol = { }; + + test.asserts.assertions.expected = ['' + Each entry in programs.pistol.associations must contain exactly one + of fpath or mime. + '']; +} diff --git a/third_party/home-manager/tests/modules/programs/pls/bash.nix b/third_party/home-manager/tests/modules/programs/pls/bash.nix new file mode 100644 index 0000000000..d6fff5f4ef --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pls/bash.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs = { + bash.enable = true; + + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; + }; + }; + + test.stubs.pls = { }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + "alias ls='@pls@/bin/pls'" + assertFileContains \ + home-files/.bashrc \ + "alias ll='@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/pls/default.nix b/third_party/home-manager/tests/modules/programs/pls/default.nix new file mode 100644 index 0000000000..fe80aad540 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pls/default.nix @@ -0,0 +1,5 @@ +{ + pls-bash = ./bash.nix; + pls-fish = ./fish.nix; + pls-zsh = ./zsh.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/pls/fish.nix b/third_party/home-manager/tests/modules/programs/pls/fish.nix new file mode 100644 index 0000000000..d555a11c19 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pls/fish.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs = { + fish.enable = true; + + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; + }; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + mkForce (builtins.toFile "empty" ""); + + test.stubs.pls = { }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + "alias ls '@pls@/bin/pls'" + assertFileContains \ + home-files/.config/fish/config.fish \ + "alias ll '@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/pls/zsh.nix b/third_party/home-manager/tests/modules/programs/pls/zsh.nix new file mode 100644 index 0000000000..f3bcbf2a8f --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pls/zsh.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs = { + zsh.enable = true; + + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; + }; + }; + + test.stubs = { + pls = { }; + zsh = { }; + }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + "alias ls='@pls@/bin/pls'" + assertFileContains \ + home-files/.zshrc \ + "alias ll='@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/powerline-go/fish.nix b/third_party/home-manager/tests/modules/programs/powerline-go/fish.nix index b7891bbfba..4861d1ba1e 100644 --- a/third_party/home-manager/tests/modules/programs/powerline-go/fish.nix +++ b/third_party/home-manager/tests/modules/programs/powerline-go/fish.nix @@ -22,10 +22,7 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = mkForce (builtins.toFile "empty" ""); - test.stubs = { - powerline-go = { }; - fish = { }; - }; + test.stubs.powerline-go = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/third_party/home-manager/tests/modules/programs/pubs/default.nix b/third_party/home-manager/tests/modules/programs/pubs/default.nix new file mode 100644 index 0000000000..db68bb1180 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pubs/default.nix @@ -0,0 +1 @@ +{ pubs-example-settings = ./pubs-example-settings.nix; } diff --git a/third_party/home-manager/tests/modules/programs/pubs/pubs-example-settings-expected-pubsrc b/third_party/home-manager/tests/modules/programs/pubs/pubs-example-settings-expected-pubsrc new file mode 100644 index 0000000000..ba1fa88ff7 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pubs/pubs-example-settings-expected-pubsrc @@ -0,0 +1,19 @@ +[main] +pubsdir = ~/.pubs +docsdir = ~/.pubs/doc +doc_add = link +open_cmd = xdg-open + +[plugins] +active = git,alias + +[[alias]] + +[[[la]]] +command = list -a +description = lists papers in lexicographic order + +[[git]] +quiet = True +manual = False +force_color = False diff --git a/third_party/home-manager/tests/modules/programs/pubs/pubs-example-settings.nix b/third_party/home-manager/tests/modules/programs/pubs/pubs-example-settings.nix new file mode 100644 index 0000000000..59f2280093 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/pubs/pubs-example-settings.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +{ + programs.pubs = { + enable = true; + + extraConfig = '' + [main] + pubsdir = ~/.pubs + docsdir = ~/.pubs/doc + doc_add = link + open_cmd = xdg-open + + [plugins] + active = git,alias + + [[alias]] + + [[[la]]] + command = list -a + description = lists papers in lexicographic order + + [[git]] + quiet = True + manual = False + force_color = False + ''; + }; + + test.stubs.pubs = { }; + + nmt.script = '' + assertFileContent \ + home-files/.pubsrc ${./pubs-example-settings-expected-pubsrc} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/rofi/custom-theme.rasi b/third_party/home-manager/tests/modules/programs/rofi/custom-theme.rasi index 8ec0970991..b479e7b76c 100644 --- a/third_party/home-manager/tests/modules/programs/rofi/custom-theme.rasi +++ b/third_party/home-manager/tests/modules/programs/rofi/custom-theme.rasi @@ -1,3 +1,5 @@ +@import "~/.cache/wal/colors-rofi-dark" + #inputbar { children: [ prompt,entry ]; } @@ -15,5 +17,3 @@ border-color: #FFFFFF; foreground-color: rgba ( 250, 251, 252, 100 % ); width: 512; } - -@import "~/.cache/wal/colors-rofi-dark" diff --git a/third_party/home-manager/tests/modules/programs/sagemath/default.nix b/third_party/home-manager/tests/modules/programs/sagemath/default.nix new file mode 100644 index 0000000000..678ba0399f --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sagemath/default.nix @@ -0,0 +1 @@ +{ sagemath = ./sagemath.nix; } diff --git a/third_party/home-manager/tests/modules/programs/sagemath/init-expected.sage b/third_party/home-manager/tests/modules/programs/sagemath/init-expected.sage new file mode 100644 index 0000000000..0510341776 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sagemath/init-expected.sage @@ -0,0 +1 @@ +%colors linux diff --git a/third_party/home-manager/tests/modules/programs/sagemath/sagemath.nix b/third_party/home-manager/tests/modules/programs/sagemath/sagemath.nix new file mode 100644 index 0000000000..2f30ac502f --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sagemath/sagemath.nix @@ -0,0 +1,20 @@ +{ config, ... }: + +{ + programs.sagemath = { + enable = true; + configDir = "${config.xdg.configHome}/sage"; + dataDir = "${config.xdg.dataHome}/sage"; + initScript = '' + %colors linux + ''; + }; + + test.stubs.sage = { }; + + nmt.script = '' + assertFileExists home-files/.config/sage/init.sage + assertFileContent home-files/.config/sage/init.sage \ + ${./init-expected.sage} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/sbt/credentials.nix b/third_party/home-manager/tests/modules/programs/sbt/credentials.nix index 83ec904c9a..1a79582ab2 100644 --- a/third_party/home-manager/tests/modules/programs/sbt/credentials.nix +++ b/third_party/home-manager/tests/modules/programs/sbt/credentials.nix @@ -19,8 +19,10 @@ let ]; expectedCredentialsSbt = pkgs.writeText "credentials.sbt" '' import scala.sys.process._ - credentials += Credentials("Sonatype Nexus Repository Manager", "example.com", "user", "echo password".lazyLines.mkString("\n")) - credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", "echo password1".lazyLines.mkString("\n")) + lazy val credential_0 = "echo password".!!.trim + credentials += Credentials("Sonatype Nexus Repository Manager", "example.com", "user", credential_0) + lazy val credential_1 = "echo password1".!!.trim + credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", credential_1) ''; credentialsSbtPath = ".sbt/1.0/credentials.sbt"; in { diff --git a/third_party/home-manager/tests/modules/programs/sbt/default.nix b/third_party/home-manager/tests/modules/programs/sbt/default.nix index 59ad89dae7..2d506b6831 100644 --- a/third_party/home-manager/tests/modules/programs/sbt/default.nix +++ b/third_party/home-manager/tests/modules/programs/sbt/default.nix @@ -1,4 +1,7 @@ { - sbt-plugins = ./plugins.nix; sbt-credentials = ./credentials.nix; + sbt-deprecated-options = ./deprecated-options.nix; + sbt-plugins = ./plugins.nix; + sbt-repositories = ./repositories.nix; + sbt-user-config-path = ./user-config-path.nix; } diff --git a/third_party/home-manager/tests/modules/programs/sbt/deprecated-options.nix b/third_party/home-manager/tests/modules/programs/sbt/deprecated-options.nix new file mode 100644 index 0000000000..c760354a42 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sbt/deprecated-options.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + programs.sbt = { + enable = true; + baseConfigPath = "gone"; + }; + + test.stubs.sbt = { }; + + 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. + '') + ]; +} diff --git a/third_party/home-manager/tests/modules/programs/sbt/repositories.nix b/third_party/home-manager/tests/modules/programs/sbt/repositories.nix new file mode 100644 index 0000000000..0def44f7cc --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sbt/repositories.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: + +let + repositories = [ + "local" + { 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]"; + } + "maven-central" + ]; + + expectedRepositories = builtins.toFile "repositories" '' + [repositories] + local + 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] + maven-central + ''; + + repositoriesSbtPath = ".sbt/repositories"; +in { + config = { + programs.sbt = { + enable = true; + repositories = repositories; + package = pkgs.writeScriptBin "sbt" ""; + }; + + nmt.script = '' + assertFileExists "home-files/${repositoriesSbtPath}" + assertFileContent "home-files/${repositoriesSbtPath}" "${expectedRepositories}" + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/sbt/user-config-path.nix b/third_party/home-manager/tests/modules/programs/sbt/user-config-path.nix new file mode 100644 index 0000000000..ef7c2ca8ac --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sbt/user-config-path.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + plugins = [{ + org = "a"; + artifact = "b"; + version = "c"; + }]; + + credentials = [{ + realm = "a"; + host = "b"; + user = "c"; + passwordCommand = "d"; + }]; + + repositories = [ "local" ]; + + baseSbtPath = ".config/sbt"; +in { + config = { + programs.sbt = { + enable = true; + plugins = plugins; + credentials = credentials; + repositories = repositories; + baseUserConfigPath = ".config/sbt"; + package = pkgs.writeScriptBin "sbt" ""; + }; + + nmt.script = '' + assertFileExists "home-files/${baseSbtPath}/1.0/plugins/plugins.sbt" + assertFileExists "home-files/${baseSbtPath}/1.0/credentials.sbt" + assertFileExists "home-files/${baseSbtPath}/repositories" + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/scmpuff/default.nix b/third_party/home-manager/tests/modules/programs/scmpuff/default.nix index 5852c5b69f..bf162a9bb7 100644 --- a/third_party/home-manager/tests/modules/programs/scmpuff/default.nix +++ b/third_party/home-manager/tests/modules/programs/scmpuff/default.nix @@ -4,4 +4,6 @@ scmpuff-no-shell = ./no-shell.nix; scmpuff-no-zsh = ./no-zsh.nix; scmpuff-zsh = ./zsh.nix; + scmpuff-fish = ./fish.nix; + scmpuff-no-fish = ./no-fish.nix; } diff --git a/third_party/home-manager/tests/modules/programs/scmpuff/fish.nix b/third_party/home-manager/tests/modules/programs/scmpuff/fish.nix new file mode 100644 index 0000000000..5326995f50 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/scmpuff/fish.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, ... }: { + programs = { + scmpuff.enable = true; + fish.enable = true; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs.scmpuff = { }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + '@scmpuff@/bin/scmpuff init -s --shell=fish | source' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/scmpuff/no-fish.nix b/third_party/home-manager/tests/modules/programs/scmpuff/no-fish.nix new file mode 100644 index 0000000000..94666a5984 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/scmpuff/no-fish.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, ... }: { + programs = { + scmpuff = { + enable = true; + enableFishIntegration = false; + }; + fish.enable = true; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs.scmpuff = { }; + + nmt.script = '' + assertFileNotRegex home-files/.config/fish/config.fish '@scmpuff@' + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/sioyek/default.nix b/third_party/home-manager/tests/modules/programs/sioyek/default.nix new file mode 100644 index 0000000000..c35f1c9fde --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sioyek/default.nix @@ -0,0 +1 @@ +{ sioyek = ./sioyek-basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/programs/sioyek/sioyek-basic-configuration.nix b/third_party/home-manager/tests/modules/programs/sioyek/sioyek-basic-configuration.nix new file mode 100644 index 0000000000..42eb130201 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sioyek/sioyek-basic-configuration.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +{ + programs.sioyek = { + enable = true; + bindings = { + "move_down" = "j"; + "move_left" = "h"; + "move_right" = "l"; + "move_up" = "k"; + "screen_down" = [ "d" "" ]; + "screen_up" = [ "u" "" ]; + }; + config = { + "dark_mode_background_color" = "0.0 0.0 0.0"; + "dark_mode_contrast" = "0.8"; + }; + }; + + test.stubs.sioyek = { }; + + nmt = { + 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 + } + + assertFileExists home-files/.config/sioyek/keys_user.config + assertFileContent home-files/.config/sioyek/keys_user.config ${ + ./test_keys_user.config + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/sioyek/test_keys_user.config b/third_party/home-manager/tests/modules/programs/sioyek/test_keys_user.config new file mode 100644 index 0000000000..f1be89c319 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sioyek/test_keys_user.config @@ -0,0 +1,8 @@ +move_down j +move_left h +move_right l +move_up k +screen_down d +screen_down +screen_up u +screen_up diff --git a/third_party/home-manager/tests/modules/programs/sioyek/test_prefs_user.config b/third_party/home-manager/tests/modules/programs/sioyek/test_prefs_user.config new file mode 100644 index 0000000000..730dd51baf --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/sioyek/test_prefs_user.config @@ -0,0 +1,2 @@ +dark_mode_background_color 0.0 0.0 0.0 +dark_mode_contrast 0.8 diff --git a/third_party/home-manager/tests/modules/programs/ssh/default.nix b/third_party/home-manager/tests/modules/programs/ssh/default.nix index b2f832c91a..c5e1759959 100644 --- a/third_party/home-manager/tests/modules/programs/ssh/default.nix +++ b/third_party/home-manager/tests/modules/programs/ssh/default.nix @@ -2,6 +2,7 @@ ssh-defaults = ./default-config.nix; ssh-includes = ./includes.nix; 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; diff --git a/third_party/home-manager/tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf b/third_party/home-manager/tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf new file mode 100644 index 0000000000..d50343b99b --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf @@ -0,0 +1,19 @@ +Host * !github.com + Port 516 +Host abc + Port 2222 +Match host xyz canonical + Port 2223 + +Host * + ForwardAgent no + Compression no + ServerAliveInterval 0 + ServerAliveCountMax 3 + HashKnownHosts no + UserKnownHostsFile ~/.ssh/known_hosts + ControlMaster no + ControlPath ~/.ssh/master-%r@%n:%p + ControlPersist no + + diff --git a/third_party/home-manager/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix b/third_party/home-manager/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix new file mode 100644 index 0000000000..aa1e40d056 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.ssh = { + enable = true; + matchBlocks = { + abc = { port = 2222; }; + + xyz = { + match = "host xyz canonical"; + port = 2223; + }; + + "* !github.com" = { port = 516; }; + }; + }; + + home.file.assertions.text = builtins.toJSON + (map (a: a.message) (filter (a: !a.assertion) config.assertions)); + + nmt.script = '' + assertFileExists home-files/.ssh/config + assertFileContent \ + home-files/.ssh/config \ + ${./match-blocks-match-and-hosts-expected.conf} + assertFileContent home-files/assertions ${./no-assertions.json} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/swaylock/config b/third_party/home-manager/tests/modules/programs/swaylock/config new file mode 100644 index 0000000000..fdda03ea09 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/swaylock/config @@ -0,0 +1,5 @@ +color=808080 +font-size=24 +indicator-radius=100 +line-color=ffffff +show-failed-attempts diff --git a/third_party/home-manager/tests/modules/programs/swaylock/default.nix b/third_party/home-manager/tests/modules/programs/swaylock/default.nix new file mode 100644 index 0000000000..a8a33fd691 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/swaylock/default.nix @@ -0,0 +1,4 @@ +{ + swaylock-disabled = import ./disabled.nix; + swaylock-settings = import ./settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/swaylock/disabled.nix b/third_party/home-manager/tests/modules/programs/swaylock/disabled.nix new file mode 100644 index 0000000000..94dd14dc70 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/swaylock/disabled.nix @@ -0,0 +1,7 @@ +{ ... }: { + programs.swaylock.settings = { }; + + nmt.script = '' + assertPathNotExists home-files/.config/swaylock/config + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/swaylock/settings.nix b/third_party/home-manager/tests/modules/programs/swaylock/settings.nix new file mode 100644 index 0000000000..9ad46ba5a6 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/swaylock/settings.nix @@ -0,0 +1,16 @@ +{ ... }: { + programs.swaylock.settings = { + color = "808080"; + font-size = 24; + indicator-idle-visible = false; # Test that this does nothing + indicator-radius = 100; + line-color = "ffffff"; + show-failed-attempts = true; + }; + + nmt.script = let homeConfig = "home-files/.config/swaylock/config"; + in '' + assertFileExists ${homeConfig} + assertFileContent ${homeConfig} ${./config} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/taskwarrior/taskwarrior.nix b/third_party/home-manager/tests/modules/programs/taskwarrior/taskwarrior.nix index 98d0a35448..f21198f573 100644 --- a/third_party/home-manager/tests/modules/programs/taskwarrior/taskwarrior.nix +++ b/third_party/home-manager/tests/modules/programs/taskwarrior/taskwarrior.nix @@ -21,9 +21,9 @@ with lib; test.stubs.taskwarrior = { }; nmt.script = '' - assertFileExists home-files/.config/task/taskrc - assertFileContent home-files/.config/task/taskrc ${ - pkgs.writeText "taskwarrior.expected" '' + assertFileExists home-files/.config/task/home-manager-taskrc + assertFileContent home-files/.config/task/home-manager-taskrc ${ + pkgs.writeText "taskwarrior.home-conf.expected" '' data.location=/some/data/location include dark-violets-256.theme diff --git a/third_party/home-manager/tests/modules/programs/thunderbird/default.nix b/third_party/home-manager/tests/modules/programs/thunderbird/default.nix new file mode 100644 index 0000000000..4872977846 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/thunderbird/default.nix @@ -0,0 +1 @@ +{ thunderbird = ./thunderbird.nix; } diff --git a/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-first.js b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-first.js new file mode 100644 index 0000000000..de67757544 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-first.js @@ -0,0 +1,61 @@ +// Generated by Home Manager. + +user_pref("general.useragent.override", ""); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr."); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.protectSubject", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.smtpServer", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.useremail", "hm@example.org"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.valid", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.attachPgpKey", false); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.autoEncryptDrafts", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.e2etechpref", 0); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.encryptionpolicy", 0); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.fullName", "H. M. Test"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.is_gnupg_key_id", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.last_entered_external_gnupg_key_id", "ABC"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.openpgp_key_id", "ABC"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.protectSubject", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.sign_mail", false); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.smtpServer", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.useremail", "hm@example.com"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.valid", true); +user_pref("mail.openpgp.allow_external_gnupg", true); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/first/ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.login_at_startup", true); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.name", "hm-account"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 143); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.socketType", 3); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.type", "imap"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.userName", "home.manager.jr"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory", ".thunderbird/first/ImapMail/cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory-rel", "[ProfD]ImapMail/cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.hostname", "imap.example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.login_at_startup", true); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.name", "hm@example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.port", 123); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.socketType", 3); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.type", "imap"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.userName", "home.manager"); +user_pref("mail.smtp.defaultserver", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.authMethod", 3); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "smtp.example.org"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 587); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.try_ssl", 2); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.username", "home.manager.jr"); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.authMethod", 3); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.hostname", "smtp.example.com"); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.port", 456); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.try_ssl", 3); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.username", "home.manager"); +user_pref("mail.smtpservers", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("privacy.donottrackheader.enabled", true); + diff --git a/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini new file mode 100644 index 0000000000..4191f16072 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini @@ -0,0 +1,15 @@ +[General] +StartWithLastProfile=1 +Version=2 + +[Profile0] +Default=1 +IsRelative=1 +Name=first +Path=first + +[Profile1] +Default=0 +IsRelative=1 +Name=second +Path=second diff --git a/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-second.js b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-second.js new file mode 100644 index 0000000000..12d7991e06 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird-expected-second.js @@ -0,0 +1,31 @@ +// Generated by Home Manager. + +user_pref("general.useragent.override", ""); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr."); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.protectSubject", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.smtpServer", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.useremail", "hm@example.org"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.valid", true); +user_pref("mail.openpgp.allow_external_gnupg", false); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/second/ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.login_at_startup", true); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.name", "hm-account"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 143); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.socketType", 3); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.type", "imap"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.userName", "home.manager.jr"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.authMethod", 3); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "smtp.example.org"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 587); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.try_ssl", 2); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.username", "home.manager.jr"); +user_pref("mail.smtpservers", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("privacy.donottrackheader.enabled", true); +user_pref("second.setting", "some-test-setting"); + diff --git a/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird.nix b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird.nix new file mode 100644 index 0000000000..ee16efa067 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/thunderbird/thunderbird.nix @@ -0,0 +1,64 @@ +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + accounts.email.accounts = { + "hm@example.com" = { + thunderbird = { + enable = true; + profiles = [ "first" ]; + }; + + gpg.key = "ABC"; + + imap = { + port = 123; + tls.enable = true; + }; + smtp.port = 456; + }; + + hm-account = { + thunderbird = { + enable = true; + settings = id: { + "mail.identity.id_${id}.protectSubject" = false; + "mail.identity.id_${id}.autoEncryptDrafts" = false; + }; + }; + }; + }; + + programs.thunderbird = { + enable = true; + + profiles = { + first = { + isDefault = true; + withExternalGnupg = true; + }; + + second.settings = { "second.setting" = "some-test-setting"; }; + }; + + settings = { + "general.useragent.override" = ""; + "privacy.donottrackheader.enabled" = true; + }; + }; + + test.stubs.thunderbird = { }; + + nmt.script = '' + assertFileExists home-files/.thunderbird/profiles.ini + assertFileContent home-files/.thunderbird/profiles.ini \ + ${./thunderbird-expected-profiles.ini} + + assertFileExists home-files/.thunderbird/first/user.js + assertFileContent home-files/.thunderbird/first/user.js \ + ${./thunderbird-expected-first.js} + + assertFileExists home-files/.thunderbird/second/user.js + assertFileContent home-files/.thunderbird/second/user.js \ + ${./thunderbird-expected-second.js} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/tmate/default.nix b/third_party/home-manager/tests/modules/programs/tmate/default.nix new file mode 100644 index 0000000000..c5e05d5625 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/tmate/default.nix @@ -0,0 +1 @@ +{ tmate = ./tmate.nix; } diff --git a/third_party/home-manager/tests/modules/programs/tmate/tmate.nix b/third_party/home-manager/tests/modules/programs/tmate/tmate.nix new file mode 100644 index 0000000000..4beb84c110 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/tmate/tmate.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +{ + programs.tmate = { + enable = true; + port = 222; + dsaFingerprint = "SHA256:1111111111111111111111111111111111111111111"; + extraConfig = ''set tmate-session-name "session-name"''; + }; + + test.stubs.tmate = { }; + + 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 + } + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/tmux/disable-confirmation-prompt.conf b/third_party/home-manager/tests/modules/programs/tmux/disable-confirmation-prompt.conf index 222f733d5f..e97a94d192 100644 --- a/third_party/home-manager/tests/modules/programs/tmux/disable-confirmation-prompt.conf +++ b/third_party/home-manager/tests/modules/programs/tmux/disable-confirmation-prompt.conf @@ -19,8 +19,8 @@ set -g mode-keys emacs -bind-key & kill-window -bind-key x kill-pane +bind-key -N "Kill the current window" & kill-window +bind-key -N "Kill the current pane" x kill-pane setw -g aggressive-resize off diff --git a/third_party/home-manager/tests/modules/programs/tmux/emacs-with-plugins.conf b/third_party/home-manager/tests/modules/programs/tmux/emacs-with-plugins.conf index 97e226316f..d015019252 100644 --- a/third_party/home-manager/tests/modules/programs/tmux/emacs-with-plugins.conf +++ b/third_party/home-manager/tests/modules/programs/tmux/emacs-with-plugins.conf @@ -10,8 +10,8 @@ setw -g pane-base-index 0 new-session -bind v split-window -h -bind s split-window -v +bind -N "Split the pane into two, left and right" v split-window -h +bind -N "Split the pane into two, top and bottom" s split-window -v set -g status-keys emacs diff --git a/third_party/home-manager/tests/modules/programs/tmux/prefix.conf b/third_party/home-manager/tests/modules/programs/tmux/prefix.conf index 3188030023..831ec3b0ec 100644 --- a/third_party/home-manager/tests/modules/programs/tmux/prefix.conf +++ b/third_party/home-manager/tests/modules/programs/tmux/prefix.conf @@ -20,7 +20,8 @@ set -g mode-keys emacs # rebind main key: C-a unbind C-b set -g prefix C-a -bind C-a send-prefix +bind -N "Send the prefix key through to the application" \ + C-a send-prefix diff --git a/third_party/home-manager/tests/modules/programs/tmux/shortcut-without-prefix.conf b/third_party/home-manager/tests/modules/programs/tmux/shortcut-without-prefix.conf index a8bc59cbb8..4fd89ad242 100644 --- a/third_party/home-manager/tests/modules/programs/tmux/shortcut-without-prefix.conf +++ b/third_party/home-manager/tests/modules/programs/tmux/shortcut-without-prefix.conf @@ -20,7 +20,8 @@ set -g mode-keys emacs # rebind main key: C-a unbind C-b set -g prefix C-a -bind a send-prefix +bind -N "Send the prefix key through to the application" \ + a send-prefix bind C-a last-window diff --git a/third_party/home-manager/tests/modules/programs/tmux/vi-all-true.conf b/third_party/home-manager/tests/modules/programs/tmux/vi-all-true.conf index de1cbe06eb..6a6fd61147 100644 --- a/third_party/home-manager/tests/modules/programs/tmux/vi-all-true.conf +++ b/third_party/home-manager/tests/modules/programs/tmux/vi-all-true.conf @@ -10,8 +10,8 @@ setw -g pane-base-index 0 new-session -bind v split-window -h -bind s split-window -v +bind -N "Split the pane into two, left and right" v split-window -h +bind -N "Split the pane into two, top and bottom" s split-window -v set -g status-keys vi diff --git a/third_party/home-manager/tests/modules/programs/vscode/default.nix b/third_party/home-manager/tests/modules/programs/vscode/default.nix index 70f6d2e706..4015121d5a 100644 --- a/third_party/home-manager/tests/modules/programs/vscode/default.nix +++ b/third_party/home-manager/tests/modules/programs/vscode/default.nix @@ -1 +1,5 @@ -{ vscode-keybindings = ./keybindings.nix; } +{ + vscode-keybindings = ./keybindings.nix; + vscode-tasks = ./tasks.nix; + vscode-update-checks = ./update-checks.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/vscode/keybindings.nix b/third_party/home-manager/tests/modules/programs/vscode/keybindings.nix index 57931c43f4..ed457a9ba0 100644 --- a/third_party/home-manager/tests/modules/programs/vscode/keybindings.nix +++ b/third_party/home-manager/tests/modules/programs/vscode/keybindings.nix @@ -27,12 +27,17 @@ let } ]; - targetPath = if pkgs.stdenv.hostPlatform.isDarwin then + keybindingsPath = if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support/Code/User/keybindings.json" else ".config/Code/User/keybindings.json"; - expectedJson = pkgs.writeText "expected.json" '' + settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/settings.json" + else + ".config/Code/User/settings.json"; + + expectedKeybindings = pkgs.writeText "expected.json" '' [ { "command": "editor.action.clipboardCopyAction", @@ -58,6 +63,7 @@ let } ] ''; + in { config = { programs.vscode = { @@ -67,8 +73,10 @@ in { }; nmt.script = '' - assertFileExists "home-files/${targetPath}" - assertFileContent "home-files/${targetPath}" "${expectedJson}" + assertFileExists "home-files/${keybindingsPath}" + assertFileContent "home-files/${keybindingsPath}" "${expectedKeybindings}" + + assertPathNotExists "home-files/${settingsPath}" ''; }; } diff --git a/third_party/home-manager/tests/modules/programs/vscode/tasks.nix b/third_party/home-manager/tests/modules/programs/vscode/tasks.nix new file mode 100644 index 0000000000..f0d2838054 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/vscode/tasks.nix @@ -0,0 +1,43 @@ +{ pkgs, config, ... }: + +let + + tasksFilePath = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/tasks.json" + else + ".config/Code/User/tasks.json"; + + tasks = { + version = "2.0.0"; + tasks = [{ + type = "shell"; + label = "Hello task"; + command = "hello"; + }]; + }; + + expectedTasks = pkgs.writeText "tasks-expected.json" '' + { + "tasks": [ + { + "command": "hello", + "label": "Hello task", + "type": "shell" + } + ], + "version": "2.0.0" + } + ''; + +in { + programs.vscode = { + enable = true; + package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; }; + userTasks = tasks; + }; + + nmt.script = '' + assertFileExists "home-files/${tasksFilePath}" + assertFileContent "home-files/${tasksFilePath}" "${expectedTasks}" + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/vscode/update-checks.nix b/third_party/home-manager/tests/modules/programs/vscode/update-checks.nix new file mode 100644 index 0000000000..1547bd36a7 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/vscode/update-checks.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: + +let + + 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" '' + { + "extensions.autoCheckUpdates": false, + "update.mode": "none" + } + ''; + +in { + programs.vscode = { + enable = true; + package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; }; + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + }; + + nmt.script = '' + assertFileExists "home-files/${settingsPath}" + assertFileContent "home-files/${settingsPath}" "${expectedSettings}" + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/watson/default.nix b/third_party/home-manager/tests/modules/programs/watson/default.nix new file mode 100644 index 0000000000..32df633d44 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/watson/default.nix @@ -0,0 +1,4 @@ +{ + watson-empty-settings = ./empty-settings.nix; + watson-example-settings = ./example-settings.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/watson/empty-settings.nix b/third_party/home-manager/tests/modules/programs/watson/empty-settings.nix new file mode 100644 index 0000000000..8e04746655 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/watson/empty-settings.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + 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 + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/watson/example-settings-expected.ini b/third_party/home-manager/tests/modules/programs/watson/example-settings-expected.ini new file mode 100644 index 0000000000..e148b12e4e --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/watson/example-settings-expected.ini @@ -0,0 +1,14 @@ +[backend] +token=yourapitoken +url=https://api.crick.fr + +[options] +date_format=%Y.%m.%d +log_current=false +pager=true +report_current=false +reverse_log=true +stop_on_restart=false +stop_on_start=true +time_format=%H:%M:%S%z +week_start=monday diff --git a/third_party/home-manager/tests/modules/programs/watson/example-settings.nix b/third_party/home-manager/tests/modules/programs/watson/example-settings.nix new file mode 100644 index 0000000000..f81f1ac857 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/watson/example-settings.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + programs.watson = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { + backend = { + url = "https://api.crick.fr"; + token = "yourapitoken"; + }; + + options = { + stop_on_start = true; + stop_on_restart = false; + date_format = "%Y.%m.%d"; + time_format = "%H:%M:%S%z"; + week_start = "monday"; + log_current = false; + pager = true; + report_current = false; + reverse_log = true; + }; + }; + }; + + 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/third_party/home-manager/tests/modules/programs/waybar/default.nix b/third_party/home-manager/tests/modules/programs/waybar/default.nix index 07949fa805..bcff35bc4a 100644 --- a/third_party/home-manager/tests/modules/programs/waybar/default.nix +++ b/third_party/home-manager/tests/modules/programs/waybar/default.nix @@ -3,5 +3,6 @@ ./systemd-with-graphical-session-target.nix; waybar-styling = ./styling.nix; waybar-settings-complex = ./settings-complex.nix; + waybar-settings-with-attrs = ./settings-with-attrs.nix; waybar-deprecated-modules-option = ./deprecated-modules-option.nix; } diff --git a/third_party/home-manager/tests/modules/programs/waybar/settings-complex-expected.json b/third_party/home-manager/tests/modules/programs/waybar/settings-complex-expected.json index c5c21a6e44..87e4f690d0 100644 --- a/third_party/home-manager/tests/modules/programs/waybar/settings-complex-expected.json +++ b/third_party/home-manager/tests/modules/programs/waybar/settings-complex-expected.json @@ -43,5 +43,21 @@ "all-outputs": true, "disable-scroll": true } + }, + { + "modules-center": [ + "clock" + ], + "modules-left": [ + "sway/mode" + ], + "modules-right": [], + "output": [ + "!DP-1" + ], + "position": "bottom", + "sway/mode": { + "tooltip": true + } } ] diff --git a/third_party/home-manager/tests/modules/programs/waybar/settings-complex.nix b/third_party/home-manager/tests/modules/programs/waybar/settings-complex.nix index 1dd5ea207b..2e205a7df0 100644 --- a/third_party/home-manager/tests/modules/programs/waybar/settings-complex.nix +++ b/third_party/home-manager/tests/modules/programs/waybar/settings-complex.nix @@ -9,43 +9,52 @@ with lib; programs.waybar = { package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; enable = true; - settings = [{ - layer = "top"; - position = "top"; - height = 30; - output = [ "DP-1" ]; - modules-left = [ "sway/workspaces" "sway/mode" "custom/my-module" ]; - modules-center = [ "sway/window" ]; - modules-right = [ - "idle_inhibitor" - "pulseaudio" - "network" - "cpu" - "memory" - "backlight" - "tray" - "battery#bat1" - "battery#bat2" - "clock" - ]; + settings = [ + { + layer = "top"; + position = "top"; + height = 30; + output = [ "DP-1" ]; + modules-left = [ "sway/workspaces" "sway/mode" "custom/my-module" ]; + modules-center = [ "sway/window" ]; + modules-right = [ + "idle_inhibitor" + "pulseaudio" + "network" + "cpu" + "memory" + "backlight" + "tray" + "battery#bat1" + "battery#bat2" + "clock" + ]; - modules = { - "sway/workspaces" = { - disable-scroll = true; - all-outputs = true; + modules = { + "sway/workspaces" = { + disable-scroll = true; + all-outputs = true; + }; + "sway/mode" = { tooltip = false; }; + "sway/window" = { max-length = 120; }; + "idle_inhibitor" = { format = "{icon}"; }; + "custom/my-module" = { + format = "hello from {}"; + exec = let + dummyScript = + config.lib.test.mkStubPackage { outPath = "@dummy@"; }; + in "${dummyScript}/bin/dummy"; + }; }; - "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"; - }; - }; - }]; + } + { + position = "bottom"; + output = [ "!DP-1" ]; + modules-left = [ "sway/mode" ]; + modules-center = [ "clock" ]; + modules = { "sway/mode" = { tooltip = true; }; }; + } + ]; }; nmt.script = '' diff --git a/third_party/home-manager/tests/modules/programs/waybar/settings-with-attrs.nix b/third_party/home-manager/tests/modules/programs/waybar/settings-with-attrs.nix new file mode 100644 index 0000000000..ac7e20fac4 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/waybar/settings-with-attrs.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + home.stateVersion = "21.11"; + + programs.waybar = { + package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; + enable = true; + settings = let + settingsComplex = (import ./settings-complex.nix { + inherit config lib pkgs; + }).config.programs.waybar.settings; + in { + mainBar = builtins.head settingsComplex; + secondaryBar = builtins.elemAt settingsComplex 1; + }; + }; + + nmt.script = '' + assertPathNotExists home-files/.config/waybar/style.css + assertFileContent \ + home-files/.config/waybar/config \ + ${./settings-complex-expected.json} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix b/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix index a0a359d5f3..dc7a620fab 100644 --- a/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix +++ b/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.nix @@ -10,15 +10,17 @@ with lib; package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; enable = true; systemd.enable = true; + systemd.target = "sway-session.target"; }; nmt.script = '' assertPathNotExists home-files/.config/waybar/config assertPathNotExists home-files/.config/waybar/style.css - assertFileContent \ - home-files/.config/systemd/user/waybar.service \ - ${./systemd-with-graphical-session-target.service} + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/waybar.service) + assertFileContent "$serviceFile" ${ + ./systemd-with-graphical-session-target.service + } ''; }; } diff --git a/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service b/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service index e03326e6e7..e1343da8a8 100644 --- a/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service +++ b/third_party/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service @@ -1,8 +1,8 @@ [Install] -WantedBy=graphical-session.target +WantedBy=sway-session.target [Service] -ExecReload=kill -SIGUSR2 $MAINPID +ExecReload=/nix/store/00000000000000000000000000000000-coreutils/bin/kill -SIGUSR2 $MAINPID ExecStart=@waybar@/bin/waybar KillMode=mixed Restart=on-failure diff --git a/third_party/home-manager/tests/modules/programs/wezterm/default.nix b/third_party/home-manager/tests/modules/programs/wezterm/default.nix new file mode 100644 index 0000000000..6a521c9c48 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/wezterm/default.nix @@ -0,0 +1,4 @@ +{ + wezterm-example-setting = ./example-setting.nix; + wezterm-empty-setting = ./empty-setting.nix; +} diff --git a/third_party/home-manager/tests/modules/programs/wezterm/empty-setting.nix b/third_party/home-manager/tests/modules/programs/wezterm/empty-setting.nix new file mode 100644 index 0000000000..062605aaa4 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/wezterm/empty-setting.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + programs.wezterm = { enable = true; }; + + test.stubs.wezterm = { }; + + nmt.script = let + expected = builtins.toFile "wezterm.lua" '' + -- Generated by Home Manager. + -- See https://wezfurlong.org/wezterm/ + + -- Add config folder to watchlist for config reloads. + local wezterm = require 'wezterm'; + wezterm.add_to_config_reload_watch_list(wezterm.config_dir) + + return {} + + ''; + in '' + assertFileExists home-files/.config/wezterm/wezterm.lua + assertFileContent home-files/.config/wezterm/wezterm.lua ${expected} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/wezterm/example-setting.nix b/third_party/home-manager/tests/modules/programs/wezterm/example-setting.nix new file mode 100644 index 0000000000..ec586daa2e --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/wezterm/example-setting.nix @@ -0,0 +1,90 @@ +{ ... }: + +{ + programs.wezterm = { + enable = true; + extraConfig = '' + 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"}, + } + } + ''; + colorSchemes.test = { + ansi = [ + "#222222" + "#D14949" + "#48874F" + "#AFA75A" + "#599797" + "#8F6089" + "#5C9FA8" + "#8C8C8C" + ]; + brights = [ + "#444444" + "#FF6D6D" + "#89FF95" + "#FFF484" + "#97DDFF" + "#FDAAF2" + "#85F5DA" + "#E9E9E9" + ]; + background = "#1B1B1B"; + cursor_bg = "#BEAF8A"; + cursor_border = "#BEAF8A"; + cursor_fg = "#1B1B1B"; + foreground = "#BEAF8A"; + selection_bg = "#444444"; + selection_fg = "#E9E9E9"; + }; + }; + + test.stubs.wezterm = { }; + + nmt.script = let + expectedConfig = builtins.toFile "wezterm.lua" '' + -- Generated by Home Manager. + -- See https://wezfurlong.org/wezterm/ + + -- Add config folder to watchlist for config reloads. + local wezterm = require 'wezterm'; + wezterm.add_to_config_reload_watch_list(wezterm.config_dir) + + 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} + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/yt-dlp/default.nix b/third_party/home-manager/tests/modules/programs/yt-dlp/default.nix new file mode 100644 index 0000000000..4b09a9c5a6 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/yt-dlp/default.nix @@ -0,0 +1 @@ +{ yt-dlp-simple-config = ./yt-dlp-simple-config.nix; } diff --git a/third_party/home-manager/tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected b/third_party/home-manager/tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected new file mode 100644 index 0000000000..f5062ddeb9 --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected @@ -0,0 +1,8 @@ +--downloader aria2c +--downloader-args aria2c:'-c -x8 -s8 -k1M' +--no-embed-subs +--embed-thumbnail +--sub-langs all +--trim-filenames 30 +--config-locations /home/user/.yt-dlp.conf + diff --git a/third_party/home-manager/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix b/third_party/home-manager/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix new file mode 100644 index 0000000000..229f0438cc --- /dev/null +++ b/third_party/home-manager/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix @@ -0,0 +1,27 @@ +{ ... }: + +{ + programs.yt-dlp = { + enable = true; + settings = { + embed-thumbnail = true; + embed-subs = false; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; + trim-filenames = 30; + }; + extraConfig = '' + --config-locations /home/user/.yt-dlp.conf + ''; + }; + + test.stubs.yt-dlp = { }; + + nmt.script = '' + assertFileExists home-files/.config/yt-dlp/config + assertFileContent home-files/.config/yt-dlp/config ${ + ./yt-dlp-simple-config-expected + } + ''; +} diff --git a/third_party/home-manager/tests/modules/programs/zplug/modules.nix b/third_party/home-manager/tests/modules/programs/zplug/modules.nix index 7c4abbc425..9f4d4332a5 100644 --- a/third_party/home-manager/tests/modules/programs/zplug/modules.nix +++ b/third_party/home-manager/tests/modules/programs/zplug/modules.nix @@ -8,7 +8,7 @@ with lib; enable = true; zplug = { enable = true; - zplugHome = ~/.customZplugHome; + zplugHome = pkgs.emptyDirectory; plugins = [ { name = "plugins/git"; diff --git a/third_party/home-manager/tests/modules/programs/zsh/session-variables.nix b/third_party/home-manager/tests/modules/programs/zsh/session-variables.nix index 638b41c9f4..f6f795f79c 100644 --- a/third_party/home-manager/tests/modules/programs/zsh/session-variables.nix +++ b/third_party/home-manager/tests/modules/programs/zsh/session-variables.nix @@ -16,9 +16,9 @@ with lib; test.stubs.zsh = { }; nmt.script = '' - assertFileExists home-files/.zshrc - assertFileRegex home-files/.zshrc 'export V1="v1"' - assertFileRegex home-files/.zshrc 'export V2="v2-v1"' + assertFileExists home-files/.zshenv + assertFileRegex home-files/.zshenv 'export V1="v1"' + assertFileRegex home-files/.zshenv 'export V2="v2-v1"' ''; }; } diff --git a/third_party/home-manager/tests/modules/services/barrier/basic-configuration.nix b/third_party/home-manager/tests/modules/services/barrier/basic-configuration.nix index 03b1beae77..d083428566 100644 --- a/third_party/home-manager/tests/modules/services/barrier/basic-configuration.nix +++ b/third_party/home-manager/tests/modules/services/barrier/basic-configuration.nix @@ -13,7 +13,7 @@ clientServiceFile=home-files/.config/systemd/user/barrierc.service assertFileExists $clientServiceFile - assertFileRegex $clientServiceFile 'ExecStart=.*/bin/barrierc --enable-crypto -f testServer' + assertFileRegex $clientServiceFile 'ExecStart=.*/bin/barrierc -f testServer' ''; }; } diff --git a/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.nix b/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.nix new file mode 100644 index 0000000000..3763b98fa4 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + config = { + services.borgmatic = { + enable = true; + frequency = "weekly"; + }; + + test.stubs.borgmatic = { }; + + nmt.script = '' + assertFileContent \ + $(normalizeStorePaths home-files/.config/systemd/user/borgmatic.service) \ + ${./basic-configuration.service} + + assertFileContent \ + home-files/.config/systemd/user/borgmatic.timer \ + ${./basic-configuration.timer} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.service b/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.service new file mode 100644 index 0000000000..4840f11bc9 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.service @@ -0,0 +1,23 @@ +[Service] +CPUSchedulingPolicy=batch +ExecStart=/nix/store/00000000000000000000000000000000-systemd/bin/systemd-inhibit \ + --who="borgmatic" \ + --why="Prevent interrupting scheduled backup" \ + @borgmatic@/bin/borgmatic \ + --stats \ + --verbosity -1 \ + --list \ + --syslog-verbosity 1 + +ExecStartPre=/nix/store/00000000000000000000000000000000-coreutils/bin/sleep 3m +IOSchedulingClass=best-effort +IOSchedulingPriority=7 +IOWeight=100 +LogRateLimitIntervalSec=0 +Nice=19 +Restart=no +Type=oneshot + +[Unit] +ConditionACPower=true +Description=borgmatic backup diff --git a/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.timer b/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.timer new file mode 100644 index 0000000000..1427925f3c --- /dev/null +++ b/third_party/home-manager/tests/modules/services/borgmatic/basic-configuration.timer @@ -0,0 +1,10 @@ +[Install] +WantedBy=timers.target + +[Timer] +OnCalendar=weekly +Persistent=true +RandomizedDelaySec=10m + +[Unit] +Description=Run borgmatic backup diff --git a/third_party/home-manager/tests/modules/services/borgmatic/default.nix b/third_party/home-manager/tests/modules/services/borgmatic/default.nix new file mode 100644 index 0000000000..802e7d0cc3 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/borgmatic/default.nix @@ -0,0 +1 @@ +{ borgmatic-service-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/cachix-agent/basic-setup.nix b/third_party/home-manager/tests/modules/services/cachix-agent/basic-setup.nix new file mode 100644 index 0000000000..0f84ae35c5 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/cachix-agent/basic-setup.nix @@ -0,0 +1,32 @@ +{ config, ... }: + +{ + services.cachix-agent = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@cachix-agent@"; }; + name = "test-agent"; + }; + + test.stubs.nix = { }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/cachix-agent.service \ + ${ + builtins.toFile "cachix-agent.service" '' + [Install] + WantedBy=default.target + + [Service] + Environment=PATH=@nix@/bin + EnvironmentFile=/home/hm-user/.config/cachix-agent.token + ExecStart='@cachix-agent@/bin/cachix' 'deploy' 'agent' 'test-agent' 'home-manager' + KillMode=process + Restart=on-failure + + [Unit] + Description=Cachix Deploy Agent + '' + } + ''; +} diff --git a/third_party/home-manager/tests/modules/services/cachix-agent/default.nix b/third_party/home-manager/tests/modules/services/cachix-agent/default.nix new file mode 100644 index 0000000000..48f88e0ae2 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/cachix-agent/default.nix @@ -0,0 +1 @@ +{ cachix = ./basic-setup.nix; } diff --git a/third_party/home-manager/tests/modules/services/clipman/clipman-sway-session-target.nix b/third_party/home-manager/tests/modules/services/clipman/clipman-sway-session-target.nix new file mode 100644 index 0000000000..129ab554fb --- /dev/null +++ b/third_party/home-manager/tests/modules/services/clipman/clipman-sway-session-target.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + home.stateVersion = "21.11"; + + services.clipman = { + enable = true; + systemdTarget = "sway-session.target"; + }; + + test.stubs = { + clipman = { }; + wl-clipboard = { }; + }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/clipman.service) + assertFileContent "$serviceFile" ${./clipman-sway-session-target.service} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/clipman/clipman-sway-session-target.service b/third_party/home-manager/tests/modules/services/clipman/clipman-sway-session-target.service new file mode 100644 index 0000000000..0d0478cc7c --- /dev/null +++ b/third_party/home-manager/tests/modules/services/clipman/clipman-sway-session-target.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=sway-session.target + +[Service] +ExecReload=/nix/store/00000000000000000000000000000000-coreutils/bin/kill -SIGUSR2 $MAINPID +ExecStart=@wl-clipboard@/bin/wl-paste -t text --watch @clipman@/bin/clipman store +KillMode=mixed +Restart=on-failure + +[Unit] +After=graphical-session.target +Description=Clipboard management daemon +PartOf=graphical-session.target diff --git a/third_party/home-manager/tests/modules/services/clipman/default.nix b/third_party/home-manager/tests/modules/services/clipman/default.nix new file mode 100644 index 0000000000..abca59c095 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/clipman/default.nix @@ -0,0 +1 @@ +{ clipman-sway-session-target = ./clipman-sway-session-target.nix; } diff --git a/third_party/home-manager/tests/modules/services/emacs/default.nix b/third_party/home-manager/tests/modules/services/emacs/default.nix index 86f68c4c87..cbbd6f6aa7 100644 --- a/third_party/home-manager/tests/modules/services/emacs/default.nix +++ b/third_party/home-manager/tests/modules/services/emacs/default.nix @@ -3,4 +3,7 @@ emacs-service-28 = ./emacs-service-28.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; } diff --git a/third_party/home-manager/tests/modules/services/emacs/emacs-default-editor.nix b/third_party/home-manager/tests/modules/services/emacs/emacs-default-editor.nix new file mode 100644 index 0000000000..77897a5b12 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/emacs/emacs-default-editor.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +{ + nixpkgs.overlays = [ + (self: super: { + # Use `cat` instead of `echo` to prevent arguments from being + # interpreted as an option. + emacs = pkgs.writeShellScriptBin "emacsclient" + ''${pkgs.coreutils}/bin/cat <<< "$*"''; + }) + ]; + + services.emacs = { + defaultEditor = true; + enable = true; + }; + + nmt.script = "source ${ + pkgs.substituteAll { + inherit (pkgs) coreutils; + src = ./emacs-default-editor.sh; + } + }"; +} diff --git a/third_party/home-manager/tests/modules/services/emacs/emacs-default-editor.sh b/third_party/home-manager/tests/modules/services/emacs/emacs-default-editor.sh new file mode 100644 index 0000000000..b1aafaac19 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/emacs/emacs-default-editor.sh @@ -0,0 +1,18 @@ +set +u +source $TESTED/home-path/etc/profile.d/hm-session-vars.sh +set -u + +check_arguments () { + if [ "$1" != "$2" ]; then + @coreutils@/bin/cat <<- EOF + Expected arguments: + $1 + but got: + $2 + EOF + exit 1 + fi +} + +check_arguments "--create-frame" "$($EDITOR)" +check_arguments "foo bar baz" "$($EDITOR foo bar baz)" diff --git a/third_party/home-manager/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix b/third_party/home-manager/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix new file mode 100644 index 0000000000..5f47089ef8 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/emacs/emacs-socket-and-startWithUserSession.nix @@ -0,0 +1,27 @@ +{ lib, pkgs, ... }: + +with lib; + +{ + services.emacs = { + enable = true; + socketActivation.enable = true; + startWithUserSession = true; + }; + + nixpkgs.overlays = [ + (self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = _: + makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + }) + ]; + + nmt.script = '' + assertFileContains \ + home-files/.config/systemd/user/emacs.service \ + "WantedBy=default.target" + ''; +} diff --git a/third_party/home-manager/tests/modules/services/espanso/basic-configuration.nix b/third_party/home-manager/tests/modules/services/espanso/basic-configuration.nix new file mode 100644 index 0000000000..34c6d533b8 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/espanso/basic-configuration.nix @@ -0,0 +1,45 @@ +{ ... }: + +{ + services.espanso = { + enable = true; + settings = { + matches = [ + { # Simple text replacement + trigger = ":espanso"; + replace = "Hi there!"; + } + { # Dates + trigger = ":date"; + replace = "{{mydate}}"; + vars = [{ + name = "mydate"; + type = "date"; + params = { format = "%m/%d/%Y"; }; + }]; + } + { # Shell commands + trigger = ":shell"; + replace = "{{output}}"; + vars = [{ + name = "output"; + type = "shell"; + params = { cmd = "echo Hello from your shell"; }; + }]; + } + ]; + }; + }; + + test.stubs.espanso = { }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/espanso.service + assertFileExists "$serviceFile" + assertFileContent "$serviceFile" ${./basic-configuration.service} + + configFile=home-files/.config/espanso/default.yml + assertFileExists "$configFile" + assertFileContent "$configFile" ${./basic-configuration.yaml} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/espanso/basic-configuration.service b/third_party/home-manager/tests/modules/services/espanso/basic-configuration.service new file mode 100644 index 0000000000..593196e595 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/espanso/basic-configuration.service @@ -0,0 +1,10 @@ +[Install] +WantedBy=default.target + +[Service] +ExecStart=@espanso@/bin/espanso daemon +Restart=on-failure +Type=exec + +[Unit] +Description=Espanso: cross platform text expander in Rust diff --git a/third_party/home-manager/tests/modules/services/espanso/basic-configuration.yaml b/third_party/home-manager/tests/modules/services/espanso/basic-configuration.yaml new file mode 100644 index 0000000000..3789df04b0 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/espanso/basic-configuration.yaml @@ -0,0 +1,17 @@ +matches: +- replace: Hi there! + trigger: :espanso +- replace: '{{mydate}}' + trigger: :date + vars: + - name: mydate + params: + format: '%m/%d/%Y' + type: date +- replace: '{{output}}' + trigger: :shell + vars: + - name: output + params: + cmd: echo Hello from your shell + type: shell diff --git a/third_party/home-manager/tests/modules/services/espanso/default.nix b/third_party/home-manager/tests/modules/services/espanso/default.nix new file mode 100644 index 0000000000..5df5fa3f1b --- /dev/null +++ b/third_party/home-manager/tests/modules/services/espanso/default.nix @@ -0,0 +1 @@ +{ espanso-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/fusuma/default.nix b/third_party/home-manager/tests/modules/services/fusuma/default.nix new file mode 100644 index 0000000000..74024b8b91 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/fusuma/default.nix @@ -0,0 +1,4 @@ +{ + fusuma-example-settings = ./settings.nix; + fusuma-systemd-user-service = ./service.nix; +} diff --git a/third_party/home-manager/tests/modules/services/fusuma/expected-service.service b/third_party/home-manager/tests/modules/services/fusuma/expected-service.service new file mode 100644 index 0000000000..a86627f4c5 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/fusuma/expected-service.service @@ -0,0 +1,11 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +Environment=PATH=@coreutils@/bin:@xdotool@/bin +ExecStart=@fusuma@/bin/fusuma -c /home/hm-user/.config/fusuma/config.yaml + +[Unit] +After=graphical-session-pre.target +Description=Fusuma services +PartOf=graphical-session.target diff --git a/third_party/home-manager/tests/modules/services/fusuma/expected-settings.yaml b/third_party/home-manager/tests/modules/services/fusuma/expected-settings.yaml new file mode 100644 index 0000000000..b02be48adf --- /dev/null +++ b/third_party/home-manager/tests/modules/services/fusuma/expected-settings.yaml @@ -0,0 +1,12 @@ +interval: + swipe: 7 +swipe: + 3: + left: + command: xdotool key ctrl+alt+Right + 4: + left: + command: xdotool key ctrl+shift+alt+Right +threshold: + swipe: 1 + diff --git a/third_party/home-manager/tests/modules/services/fusuma/service.nix b/third_party/home-manager/tests/modules/services/fusuma/service.nix new file mode 100644 index 0000000000..d02a75f52e --- /dev/null +++ b/third_party/home-manager/tests/modules/services/fusuma/service.nix @@ -0,0 +1,19 @@ +{ config, ... }: + +{ + services.fusuma = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@fusuma@"; }; + extraPackages = [ + (config.lib.test.mkStubPackage { outPath = "@coreutils@"; }) + (config.lib.test.mkStubPackage { outPath = "@xdotool@"; }) + ]; + settings = { }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/fusuma.service \ + ${./expected-service.service} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/fusuma/settings.nix b/third_party/home-manager/tests/modules/services/fusuma/settings.nix new file mode 100644 index 0000000000..303a132725 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/fusuma/settings.nix @@ -0,0 +1,24 @@ +{ config, ... }: + +{ + services.fusuma = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@fusuma@"; }; + extraPackages = [ (config.lib.test.mkStubPackage { }) ]; + + settings = { + threshold = { swipe = 1; }; + interval = { swipe = 7; }; + swipe = { + "3" = { left = { command = "xdotool key ctrl+alt+Right"; }; }; + "4" = { left = { command = "xdotool key ctrl+shift+alt+Right"; }; }; + }; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/fusuma/config.yaml \ + ${./expected-settings.yaml} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/git-sync/basic.nix b/third_party/home-manager/tests/modules/services/git-sync/basic.nix index 0e9c7ad65b..039044bfe6 100644 --- a/third_party/home-manager/tests/modules/services/git-sync/basic.nix +++ b/third_party/home-manager/tests/modules/services/git-sync/basic.nix @@ -1,37 +1,43 @@ -{ config, pkgs, ... }: +{ config, ... }: { - config = { - services.git-sync = { - enable = true; - package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; }; - repositories.test = { - path = "/a/path"; - uri = "git+ssh://user@example.com:/~user/path/to/repo.git"; - }; + services.git-sync = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; }; + repositories.test = { + path = "/a/path"; + uri = "git+ssh://user@example.com:/~user/path/to/repo.git"; }; - - nmt.script = '' - serviceFile=home-files/.config/systemd/user/git-sync-test.service - - assertFileExists $serviceFile - assertFileContent $serviceFile ${ - builtins.toFile "expected" '' - [Install] - WantedBy=default.target - - [Service] - 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 - '' - } - ''; }; + + test.stubs = { + git = { name = "git"; }; + openssh = { name = "openssh"; }; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/git-sync-test.service + + assertFileExists $serviceFile + + serviceFile=$(normalizeStorePaths $serviceFile) + assertFileContent $serviceFile ${ + builtins.toFile "expected" '' + [Install] + WantedBy=default.target + + [Service] + Environment=PATH=/nix/store/00000000000000000000000000000000-openssh/bin:/nix/store/00000000000000000000000000000000-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 + '' + } + ''; } diff --git a/third_party/home-manager/tests/modules/services/gpg-agent/default-homedir.nix b/third_party/home-manager/tests/modules/services/gpg-agent/default-homedir.nix index 1b4333e126..faf1537493 100644 --- a/third_party/home-manager/tests/modules/services/gpg-agent/default-homedir.nix +++ b/third_party/home-manager/tests/modules/services/gpg-agent/default-homedir.nix @@ -5,6 +5,7 @@ with lib; { config = { services.gpg-agent.enable = true; + services.gpg-agent.pinentryFlavor = null; # Don't build pinentry package. programs.gpg.enable = true; test.stubs.gnupg = { }; diff --git a/third_party/home-manager/tests/modules/services/gpg-agent/override-homedir.nix b/third_party/home-manager/tests/modules/services/gpg-agent/override-homedir.nix index 6c231a3b2b..23d9f87654 100644 --- a/third_party/home-manager/tests/modules/services/gpg-agent/override-homedir.nix +++ b/third_party/home-manager/tests/modules/services/gpg-agent/override-homedir.nix @@ -5,16 +5,17 @@ with lib; { config = { services.gpg-agent.enable = true; + services.gpg-agent.pinentryFlavor = null; # Don't build pinentry package. programs.gpg = { enable = true; - homedir = "${config.home.homeDirectory}/foo/bar"; + homedir = "/path/to/hash"; }; test.stubs.gnupg = { }; nmt.script = '' in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}" - if [[ $in != "%t/gnupg/d."????????????????????????"/S.gpg-agent" ]] + if [[ $in != "%t/gnupg/d.wp4h7ks5zxy4dodqadgpbbpz/S.gpg-agent" ]] then echo $in fail "gpg-agent socket directory is malformed" diff --git a/third_party/home-manager/tests/modules/services/gromit-mpx/basic-configuration.cfg b/third_party/home-manager/tests/modules/services/gromit-mpx/basic-configuration.cfg new file mode 100644 index 0000000000..d96e9b5ab4 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/gromit-mpx/basic-configuration.cfg @@ -0,0 +1,5 @@ +"tool-1" = PEN (size=5 color="red"); +"default" = "tool-1"; + +"tool-2" = ERASER (size=75); +"default"[3] = "tool-2"; diff --git a/third_party/home-manager/tests/modules/services/gromit-mpx/basic-configuration.nix b/third_party/home-manager/tests/modules/services/gromit-mpx/basic-configuration.nix new file mode 100644 index 0000000000..380bcb5c36 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/gromit-mpx/basic-configuration.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + services.gromit-mpx = { + enable = true; + package = config.lib.test.mkStubPackage { }; + tools = [ + { + device = "default"; + type = "pen"; + size = 5; + } + { + device = "default"; + type = "eraser"; + size = 75; + modifiers = [ "3" ]; + } + ]; + }; + + nmt.script = import ./nmt-script.nix ./basic-configuration.cfg; +} diff --git a/third_party/home-manager/tests/modules/services/gromit-mpx/default-configuration.cfg b/third_party/home-manager/tests/modules/services/gromit-mpx/default-configuration.cfg new file mode 100644 index 0000000000..904c0c6a47 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/gromit-mpx/default-configuration.cfg @@ -0,0 +1,14 @@ +"tool-1" = PEN (size=5 color="red"); +"default" = "tool-1"; + +"tool-2" = PEN (size=5 color="blue"); +"default"[SHIFT] = "tool-2"; + +"tool-3" = PEN (size=5 color="yellow"); +"default"[CONTROL] = "tool-3"; + +"tool-4" = PEN (size=6 color="green" arrowsize=1); +"default"[2] = "tool-4"; + +"tool-5" = ERASER (size=75); +"default"[3] = "tool-5"; diff --git a/third_party/home-manager/tests/modules/services/gromit-mpx/default-configuration.nix b/third_party/home-manager/tests/modules/services/gromit-mpx/default-configuration.nix new file mode 100644 index 0000000000..b2ca50569c --- /dev/null +++ b/third_party/home-manager/tests/modules/services/gromit-mpx/default-configuration.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + services.gromit-mpx = { + enable = true; + package = config.lib.test.mkStubPackage { }; + }; + + nmt.script = import ./nmt-script.nix ./default-configuration.cfg; +} diff --git a/third_party/home-manager/tests/modules/services/gromit-mpx/default.nix b/third_party/home-manager/tests/modules/services/gromit-mpx/default.nix new file mode 100644 index 0000000000..d2a43841f1 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/gromit-mpx/default.nix @@ -0,0 +1,4 @@ +{ + gromit-mpx-default-configuration = ./default-configuration.nix; + gromit-mpx-basic-configuration = ./basic-configuration.nix; +} diff --git a/third_party/home-manager/tests/modules/services/gromit-mpx/nmt-script.nix b/third_party/home-manager/tests/modules/services/gromit-mpx/nmt-script.nix new file mode 100644 index 0000000000..84dcb66f36 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/gromit-mpx/nmt-script.nix @@ -0,0 +1,14 @@ +golden_file: + +'' + serviceFile=home-files/.config/systemd/user/gromit-mpx.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'X-Restart-Triggers=.*gromitmpx\.cfg' + assertFileRegex $serviceFile 'X-Restart-Triggers=.*gromitmpx\.ini' + assertFileRegex $serviceFile 'ExecStart=.*/bin/gromit-mpx' + + assertFileExists home-files/.config/gromit-mpx.ini + assertFileExists home-files/.config/gromit-mpx.cfg + assertFileContent home-files/.config/gromit-mpx.cfg ${golden_file} +'' diff --git a/third_party/home-manager/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix b/third_party/home-manager/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix new file mode 100644 index 0000000000..444c88624f --- /dev/null +++ b/third_party/home-manager/tests/modules/services/home-manager-auto-upgrade/basic-configuration.nix @@ -0,0 +1,18 @@ +{ config, ... }: + +{ + config = { + services.home-manager.autoUpgrade = { + enable = true; + frequency = "00:00"; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/home-manager-auto-upgrade.service + assertFileExists $serviceFile + + timerFile=home-files/.config/systemd/user/home-manager-auto-upgrade.timer + assertFileExists $timerFile + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/services/home-manager-auto-upgrade/default.nix b/third_party/home-manager/tests/modules/services/home-manager-auto-upgrade/default.nix new file mode 100644 index 0000000000..fb09ebc389 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/home-manager-auto-upgrade/default.nix @@ -0,0 +1 @@ +{ home-manager-auto-upgrade-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/lieer/lieer-service-expected.service b/third_party/home-manager/tests/modules/services/lieer/lieer-service-expected.service index 1d282eb980..f532bff2e1 100644 --- a/third_party/home-manager/tests/modules/services/lieer/lieer-service-expected.service +++ b/third_party/home-manager/tests/modules/services/lieer/lieer-service-expected.service @@ -1,6 +1,6 @@ [Service] -Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/notmuchrc -ExecStart=@gmailieer@/bin/gmi sync +Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config +ExecStart=@lieer@/bin/gmi sync Type=oneshot WorkingDirectory=/home/hm-user/Mail/hm@example.com diff --git a/third_party/home-manager/tests/modules/services/lieer/lieer-service.nix b/third_party/home-manager/tests/modules/services/lieer/lieer-service.nix index f624ae8268..f11f1f6e69 100644 --- a/third_party/home-manager/tests/modules/services/lieer/lieer-service.nix +++ b/third_party/home-manager/tests/modules/services/lieer/lieer-service.nix @@ -19,7 +19,7 @@ with lib; }; }; - test.stubs.gmailieer = { }; + test.stubs.lieer = { }; nmt.script = '' assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.service diff --git a/third_party/home-manager/tests/modules/services/mopidy/basic-configuration.conf b/third_party/home-manager/tests/modules/services/mopidy/basic-configuration.conf new file mode 100644 index 0000000000..3654b96105 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mopidy/basic-configuration.conf @@ -0,0 +1,10 @@ +[file] +enabled = true +media_dirs = + $XDG_MUSIC_DIR|Music + ~/Downloads|Downloads + +[spotify] +client_id = TOTALLY_NOT_A_FAKE_CLIENT_ID +client_secret = YOU_CAN_USE_ME_FOR_YOUR_SPOTIFY_PREMIUM_SUBSCRIPTION +enabled = true diff --git a/third_party/home-manager/tests/modules/services/mopidy/basic-configuration.nix b/third_party/home-manager/tests/modules/services/mopidy/basic-configuration.nix new file mode 100644 index 0000000000..418bfde1f6 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mopidy/basic-configuration.nix @@ -0,0 +1,38 @@ +{ config, pkgs, ... }: + +{ + services.mopidy = { + enable = true; + settings = { + file = { + enabled = true; + media_dirs = [ "$XDG_MUSIC_DIR|Music" "~/Downloads|Downloads" ]; + }; + + spotify = { + enabled = true; + client_id = "TOTALLY_NOT_A_FAKE_CLIENT_ID"; + client_secret = "YOU_CAN_USE_ME_FOR_YOUR_SPOTIFY_PREMIUM_SUBSCRIPTION"; + }; + }; + }; + + test.stubs.mopidy = { + version = "0"; + outPath = null; + buildScript = '' + mkdir -p $out/bin + touch $out/bin/mopidy + chmod +x $out/bin/mopidy + ''; + }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/mopidy.service + assertFileExists home-files/.config/systemd/user/mopidy-scan.service + + assertFileExists home-files/.config/mopidy/mopidy.conf + assertFileContent home-files/.config/mopidy/mopidy.conf \ + ${./basic-configuration.conf} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/mopidy/default.nix b/third_party/home-manager/tests/modules/services/mopidy/default.nix new file mode 100644 index 0000000000..2f2c33d235 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mopidy/default.nix @@ -0,0 +1 @@ +{ mopidy-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/mpd/basic-configuration.conf b/third_party/home-manager/tests/modules/services/mpd/basic-configuration.conf new file mode 100644 index 0000000000..59b3568b34 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/basic-configuration.conf @@ -0,0 +1,11 @@ +music_directory "/my/music/dir" +playlist_directory "/home/hm-user/.local/share/mpd/playlists" +db_file "/home/hm-user/.local/share/mpd/tag_cache" + +state_file "/home/hm-user/.local/share/mpd/state" +sticker_file "/home/hm-user/.local/share/mpd/sticker.sql" + +bind_to_address "127.0.0.1" + + + diff --git a/third_party/home-manager/tests/modules/services/mpd/basic-configuration.nix b/third_party/home-manager/tests/modules/services/mpd/basic-configuration.nix new file mode 100644 index 0000000000..6d6250d90b --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/basic-configuration.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + services.mpd = { + enable = true; + musicDirectory = "/my/music/dir"; + }; + + home.stateVersion = "22.11"; + + test.stubs.mpd = { }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) + assertFileContent "$serviceFile" ${./basic-configuration.service} + + confFile=$(grep -o \ + '/nix/store/.*-mpd.conf' \ + $TESTED/home-files/.config/systemd/user/mpd.service) + assertFileContent "$confFile" ${./basic-configuration.conf} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/mpd/basic-configuration.service b/third_party/home-manager/tests/modules/services/mpd/basic-configuration.service new file mode 100644 index 0000000000..fd44042a9b --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/basic-configuration.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=default.target + +[Service] +Environment=PATH=/home/hm-user/.nix-profile/bin +ExecStart=@mpd@/bin/mpd --no-daemon /nix/store/00000000000000000000000000000000-mpd.conf +ExecStartPre=/nix/store/00000000000000000000000000000000-bash/bin/bash -c "/nix/store/00000000000000000000000000000000-coreutils/bin/mkdir -p '/home/hm-user/.local/share/mpd' '/home/hm-user/.local/share/mpd/playlists'" +Type=notify + +[Unit] +After=network.target +After=sound.target +Description=Music Player Daemon diff --git a/third_party/home-manager/tests/modules/services/mpd/before-state-version-22_11.nix b/third_party/home-manager/tests/modules/services/mpd/before-state-version-22_11.nix new file mode 100644 index 0000000000..6e044b3661 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/before-state-version-22_11.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + services.mpd.enable = true; + + home.stateVersion = "18.09"; + + test.stubs.mpd = { }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) + assertFileContent "$serviceFile" ${./basic-configuration.service} + + confFile=$(grep -o \ + '/nix/store/.*-mpd.conf' \ + $TESTED/home-files/.config/systemd/user/mpd.service) + + assertFileContains \ + "$confFile" \ + 'music_directory "/home/hm-user/music"' + ''; +} diff --git a/third_party/home-manager/tests/modules/services/mpd/default.nix b/third_party/home-manager/tests/modules/services/mpd/default.nix new file mode 100644 index 0000000000..d2fd2a2922 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/default.nix @@ -0,0 +1,5 @@ +{ + mpd-basic-configuration = ./basic-configuration.nix; + mpd-before-state-version-22_11 = ./before-state-version-22_11.nix; + mpd-xdg-music-dir = ./xdg-music-dir.nix; +} diff --git a/third_party/home-manager/tests/modules/services/mpd/xdg-music-dir.conf b/third_party/home-manager/tests/modules/services/mpd/xdg-music-dir.conf new file mode 100644 index 0000000000..56fe71b49e --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/xdg-music-dir.conf @@ -0,0 +1,11 @@ +music_directory "/home/hm-user/Music" +playlist_directory "/home/hm-user/.local/share/mpd/playlists" +db_file "/home/hm-user/.local/share/mpd/tag_cache" + +state_file "/home/hm-user/.local/share/mpd/state" +sticker_file "/home/hm-user/.local/share/mpd/sticker.sql" + +bind_to_address "127.0.0.1" + + + diff --git a/third_party/home-manager/tests/modules/services/mpd/xdg-music-dir.nix b/third_party/home-manager/tests/modules/services/mpd/xdg-music-dir.nix new file mode 100644 index 0000000000..775043c155 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpd/xdg-music-dir.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + services.mpd.enable = true; + xdg.userDirs.enable = true; + + home.stateVersion = "22.11"; + + test.stubs.mpd = { }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) + assertFileContent "$serviceFile" ${./basic-configuration.service} + + confFile=$(grep -o \ + '/nix/store/.*-mpd.conf' \ + $TESTED/home-files/.config/systemd/user/mpd.service) + assertFileContent "$confFile" ${./xdg-music-dir.conf} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.config b/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.config new file mode 100644 index 0000000000..e68277562a --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.config @@ -0,0 +1,8 @@ +[Bling] +mmkeys = True +notify = True + +[Connection] +host = 127.0.0.1 +music_dir = /home/hm-user/music +port = 6600 diff --git a/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.nix b/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.nix new file mode 100644 index 0000000000..b8c595be24 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + services.mpdris2 = { + enable = true; + notifications = true; + multimediaKeys = true; + }; + + services.mpd.musicDirectory = "/home/hm-user/music"; + + test.stubs.mpdris2 = { }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/mpdris2.service + assertFileContent "$serviceFile" ${./basic-configuration.service} + + configFile=home-files/.config/mpDris2/mpDris2.conf + assertFileContent "$configFile" ${./basic-configuration.config} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.service b/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.service new file mode 100644 index 0000000000..2ea4656c75 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpdris2/basic-configuration.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=default.target + +[Service] +BusName=org.mpris.MediaPlayer2.mpd +ExecStart=@mpdris2@/bin/mpDris2 +Restart=on-failure +RestartSec=5s +Type=simple + +[Unit] +After=mpd.service +Description=MPRIS 2 support for MPD diff --git a/third_party/home-manager/tests/modules/services/mpdris2/default.nix b/third_party/home-manager/tests/modules/services/mpdris2/default.nix new file mode 100644 index 0000000000..eaf6be337f --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpdris2/default.nix @@ -0,0 +1,4 @@ +{ + mpdris2-basic-configuration = ./basic-configuration.nix; + mpdris2-with-password = ./with-password.nix; +} diff --git a/third_party/home-manager/tests/modules/services/mpdris2/with-password.config b/third_party/home-manager/tests/modules/services/mpdris2/with-password.config new file mode 100644 index 0000000000..939a405899 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpdris2/with-password.config @@ -0,0 +1,9 @@ +[Bling] +mmkeys = False +notify = False + +[Connection] +host = somehost +music_dir = /home/hm-user/music +password = foo +port = 42 diff --git a/third_party/home-manager/tests/modules/services/mpdris2/with-password.nix b/third_party/home-manager/tests/modules/services/mpdris2/with-password.nix new file mode 100644 index 0000000000..af4ef33cc0 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/mpdris2/with-password.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + services.mpdris2 = { + enable = true; + mpd = { + host = "somehost"; + port = 42; + password = "foo"; + }; + }; + + services.mpd.musicDirectory = "/home/hm-user/music"; + + test.stubs.mpdris2 = { }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/mpdris2.service + assertFileContent "$serviceFile" ${./basic-configuration.service} + + configFile=home-files/.config/mpDris2/mpDris2.conf + assertFileContent "$configFile" ${./with-password.config} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/parcellite/default.nix b/third_party/home-manager/tests/modules/services/parcellite/default.nix new file mode 100644 index 0000000000..5cf326b140 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/parcellite/default.nix @@ -0,0 +1 @@ +{ parcellite = ./parcellite.nix; } diff --git a/third_party/home-manager/tests/modules/services/parcellite/parcellite-expected.service b/third_party/home-manager/tests/modules/services/parcellite/parcellite-expected.service new file mode 100644 index 0000000000..02d8243a6e --- /dev/null +++ b/third_party/home-manager/tests/modules/services/parcellite/parcellite-expected.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +ExecStart=@parcellite@/bin/parcellite '--no-icon' +Restart=on-abort + +[Unit] +After=graphical-session-pre.target +After=tray.target +Description=Lightweight GTK+ clipboard manager +PartOf=graphical-session.target +Requires=tray.target diff --git a/third_party/home-manager/tests/modules/services/parcellite/parcellite.nix b/third_party/home-manager/tests/modules/services/parcellite/parcellite.nix new file mode 100644 index 0000000000..25e553bc88 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/parcellite/parcellite.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + services.parcellite = { + enable = true; + package = config.lib.test.mkStubPackage { + name = "parcellite"; + outPath = "@parcellite@"; + }; + extraOptions = [ "--no-icon" ]; + }; + + nmt.script = '' + assertFileContent \ + "home-files/.config/systemd/user/parcellite.service" \ + ${./parcellite-expected.service} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/picom/default.nix b/third_party/home-manager/tests/modules/services/picom/default.nix new file mode 100644 index 0000000000..6437013148 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/picom/default.nix @@ -0,0 +1 @@ +{ picom-basic-configuration = ./picom-basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration-expected.conf b/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration-expected.conf new file mode 100644 index 0000000000..c1e7d19125 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration-expected.conf @@ -0,0 +1,18 @@ +active-opacity = 1.000000; +backend = "xrender"; +dbe = true; +fade-delta = 5; +fade-exclude = [ "window_type *= 'menu'" , "name ~= 'Firefox$'" , "focused = 1" ]; +fade-in-step = 0.040000; +fade-out-step = 0.040000; +fading = true; +inactive-opacity = 1.000000; +opacity-rule = [ ]; +shadow = true; +shadow-exclude = [ "window_type *= 'menu'" , "name ~= 'Firefox$'" , "focused = 1" ]; +shadow-offset-x = -10; +shadow-offset-y = -15; +shadow-opacity = 0.800000; +unredir-if-possible = true; +vsync = true; +wintypes: { dropdown_menu = { opacity = 1.000000; }; popup_menu = { opacity = 1.000000; }; }; \ No newline at end of file diff --git a/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration-expected.service b/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration-expected.service new file mode 100644 index 0000000000..6aeef22495 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration-expected.service @@ -0,0 +1,12 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +ExecStart=@picom@/bin/picom --config /nix/store/00000000000000000000000000000000-hm_picompicom.conf --legacy-backends +Restart=always +RestartSec=3 + +[Unit] +After=graphical-session-pre.target +Description=Picom X11 compositor +PartOf=graphical-session.target diff --git a/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration.nix b/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration.nix new file mode 100644 index 0000000000..1c2689799a --- /dev/null +++ b/third_party/home-manager/tests/modules/services/picom/picom-basic-configuration.nix @@ -0,0 +1,37 @@ +{ config, pkgs, ... }: + +{ + services.picom = { + enable = true; + fade = true; + fadeDelta = 5; + fadeSteps = [ 4.0e-2 4.0e-2 ]; + fadeExclude = + [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ]; + shadow = true; + shadowOffsets = [ (-10) (-15) ]; + shadowOpacity = 0.8; + shadowExclude = + [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ]; + backend = "xrender"; + vSync = true; + settings = { + "unredir-if-possible" = true; + "dbe" = true; + }; + extraArgs = [ "--legacy-backends" ]; + }; + + test.stubs.picom = { }; + + nmt.script = '' + assertFileContent \ + home-files/.config/picom/picom.conf \ + ${./picom-basic-configuration-expected.conf} + + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/picom.service) + assertFileContent \ + "$serviceFile" \ + ${./picom-basic-configuration-expected.service} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/polybar/basic-configuration.nix b/third_party/home-manager/tests/modules/services/polybar/basic-configuration.nix index b6374acd89..5d9c8df582 100644 --- a/third_party/home-manager/tests/modules/services/polybar/basic-configuration.nix +++ b/third_party/home-manager/tests/modules/services/polybar/basic-configuration.nix @@ -47,11 +47,11 @@ serviceFile=home-files/.config/systemd/user/polybar.service assertFileExists $serviceFile - assertFileRegex $serviceFile 'X-Restart-Triggers=.*polybar\.conf' + assertFileRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' - assertFileExists home-files/.config/polybar/config - assertFileContent home-files/.config/polybar/config \ + assertFileExists home-files/.config/polybar/config.ini + assertFileContent home-files/.config/polybar/config.ini \ ${./basic-configuration.conf} ''; }; diff --git a/third_party/home-manager/tests/modules/services/polybar/default.nix b/third_party/home-manager/tests/modules/services/polybar/default.nix index 94d5d3cde2..b5594d247c 100644 --- a/third_party/home-manager/tests/modules/services/polybar/default.nix +++ b/third_party/home-manager/tests/modules/services/polybar/default.nix @@ -1 +1,4 @@ -{ polybar-basic-configuration = ./basic-configuration.nix; } +{ + polybar-basic-configuration = ./basic-configuration.nix; + polybar-empty-configuration = ./empty-configuration.nix; +} diff --git a/third_party/home-manager/tests/modules/services/polybar/empty-configuration.nix b/third_party/home-manager/tests/modules/services/polybar/empty-configuration.nix new file mode 100644 index 0000000000..2635096768 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/polybar/empty-configuration.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +{ + config = { + services.polybar = { + enable = true; + package = config.lib.test.mkStubPackage { }; + script = "polybar bar &"; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/polybar.service + + assertFileExists $serviceFile + assertFileNotRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' + assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' + + assertPathNotExists home-files/.config/polybar/config.ini + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/services/recoll/basic-configuration.conf b/third_party/home-manager/tests/modules/services/recoll/basic-configuration.conf new file mode 100644 index 0000000000..185768a8e6 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/recoll/basic-configuration.conf @@ -0,0 +1,16 @@ +nocjk = 0 + +skippedNames+ = node_modules + +topdirs = ~/Downloads ~/Documents ~/library + +underscoresasletter = 1 + +[~/library/projects] +skippedNames+ = .editorconfig .gitignore result flake.lock go.sum + +[~/library/projects/software] +skippedNames+ = target result + +[~/what-is-this-project] +skippedNames+ = whoa-there diff --git a/third_party/home-manager/tests/modules/services/recoll/basic-configuration.nix b/third_party/home-manager/tests/modules/services/recoll/basic-configuration.nix new file mode 100644 index 0000000000..9775c170ca --- /dev/null +++ b/third_party/home-manager/tests/modules/services/recoll/basic-configuration.nix @@ -0,0 +1,35 @@ +{ config, ... }: + +{ + services.recoll = { + enable = true; + package = config.lib.test.mkStubPackage { }; + configDir = "${config.xdg.configHome}/recoll"; + settings = { + topdirs = [ "~/Downloads" "~/Documents" "~/library" ]; + "skippedNames+" = [ "node_modules" ]; + underscoresasletter = true; + nocjk = false; + + "~/library/projects" = { + "skippedNames+" = + [ ".editorconfig" ".gitignore" "result" "flake.lock" "go.sum" ]; + }; + + "~/library/projects/software" = { + "skippedNames+" = [ "target" "result" ]; + }; + + "~/what-is-this-project" = { "skippedNames+" = [ "whoa-there" ]; }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/recollindex.service + assertFileExists home-files/.config/systemd/user/recollindex.timer + + assertFileExists home-files/.config/recoll/recoll.conf + assertFileContent home-files/.config/recoll/recoll.conf \ + ${./basic-configuration.conf} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/recoll/config-format-order.conf b/third_party/home-manager/tests/modules/services/recoll/config-format-order.conf new file mode 100644 index 0000000000..f1e251ff3d --- /dev/null +++ b/third_party/home-manager/tests/modules/services/recoll/config-format-order.conf @@ -0,0 +1,25 @@ +b = 10 + +d = 0 + +e = This should be the second to the last non-attrset value in the config. + +g = This is coming from a list + +[a] +foo = bar + +[c] +a = This should appear as the second section. +aa = 1 +b = 53 + +[f] +a = This should be second to the last for the attribute names with an attrset. +b = 3193 +c = 0 +d = Hello there + +[foo] +bar = This should be the last attribute with an attrset. +baz = 42 diff --git a/third_party/home-manager/tests/modules/services/recoll/config-format-order.nix b/third_party/home-manager/tests/modules/services/recoll/config-format-order.nix new file mode 100644 index 0000000000..846627d965 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/recoll/config-format-order.nix @@ -0,0 +1,45 @@ +# This is a test primarily concerned with the order of the configuration. The +# configuration is dynamically generated in alphabetical order of the top-level +# attribute names. Because of this, it is possible to override top-level +# attributes that are supposed to be configured in the top-level configuration. +{ config, ... }: + +{ + services.recoll = { + enable = true; + package = config.lib.test.mkStubPackage { }; + settings = { + a = { foo = "bar"; }; + b = 10; + c = { + a = "This should appear as the second section."; + b = 53; + aa = true; + }; + d = false; + 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."; + b = 3193; + c = false; + d = [ "Hello" "there" ]; + }; + foo = { + bar = "This should be the last attribute with an attrset."; + baz = 42; + }; + g = [ "This" "is" "coming" "from" "a" "list" ]; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/recollindex.service + assertFileExists home-files/.config/systemd/user/recollindex.timer + + assertFileExists home-files/.recoll/recoll.conf + assertFileContent home-files/.recoll/recoll.conf \ + ${./config-format-order.conf} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/recoll/default.nix b/third_party/home-manager/tests/modules/services/recoll/default.nix new file mode 100644 index 0000000000..3b0e560f1d --- /dev/null +++ b/third_party/home-manager/tests/modules/services/recoll/default.nix @@ -0,0 +1,4 @@ +{ + recoll-basic-configuration = ./basic-configuration.nix; + recoll-config-format-order = ./config-format-order.nix; +} diff --git a/third_party/home-manager/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service b/third_party/home-manager/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service index 8d0e7a5fbc..d172e3a863 100644 --- a/third_party/home-manager/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service +++ b/third_party/home-manager/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@gammastep@/bin/gammastep -v -c /home/hm-user/.config/gammastep/config.ini +ExecStart=@gammastep@/bin/gammastep '-c' '/home/hm-user/.config/gammastep/config.ini' Restart=on-failure RestartSec=3 diff --git a/third_party/home-manager/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service b/third_party/home-manager/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service index 07ffbf06d8..6ee4cdda23 100644 --- a/third_party/home-manager/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service +++ b/third_party/home-manager/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@redshift@/bin/redshift -v -c /home/hm-user/.config/redshift/redshift.conf +ExecStart=@redshift@/bin/redshift '-c' '/home/hm-user/.config/redshift/redshift.conf' Restart=on-failure RestartSec=3 diff --git a/third_party/home-manager/tests/modules/services/screen-locker/no-xautolock.nix b/third_party/home-manager/tests/modules/services/screen-locker/no-xautolock.nix index 03ab0868cb..7ec5152b0f 100644 --- a/third_party/home-manager/tests/modules/services/screen-locker/no-xautolock.nix +++ b/third_party/home-manager/tests/modules/services/screen-locker/no-xautolock.nix @@ -6,7 +6,10 @@ enable = true; inactiveInterval = 5; lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000"; - xss-lock = { extraOptions = [ "-test" ]; }; + xss-lock = { + extraOptions = [ "-test" ]; + screensaverCycle = 5; + }; xautolock = { enable = false; }; }; @@ -18,7 +21,7 @@ assertFileExists $xssService assertFileRegex $xssService 'ExecStart=.*/bin/xss-lock.*-test.*i3lock -n -c AA0000' - assertFileRegex $xssService 'ExecStartPre=.*/xset s 300' + assertFileRegex $xssService 'ExecStartPre=.*/xset s 300 5' ''; }; } diff --git a/third_party/home-manager/tests/modules/services/swayidle/basic-configuration.nix b/third_party/home-manager/tests/modules/services/swayidle/basic-configuration.nix new file mode 100644 index 0000000000..caa06ae161 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/swayidle/basic-configuration.nix @@ -0,0 +1,53 @@ +{ config, pkgs, lib, ... }: + +{ + services.swayidle = { + enable = true; + package = config.lib.test.mkStubPackage { }; + timeouts = [ + { + timeout = 50; + command = ''notify-send -t 10000 -- "Screen lock in 10 seconds"''; + } + { + timeout = 60; + command = "swaylock -fF"; + } + { + timeout = 300; + command = ''swaymsg "output * dpms off"''; + resumeCommand = ''swaymsg "output * dpms on"''; + } + ]; + events = [ + { + event = "before-sleep"; + command = "swaylock -fF"; + } + { + event = "lock"; + command = "swaylock -fF"; + } + ]; + }; + + nmt.script = let + escapeForRegex = builtins.replaceStrings [ "'" "*" ] [ "'\\''" "\\*" ]; + expectedArgs = escapeForRegex (lib.concatStringsSep " " [ + "-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'" + ]); + in '' + serviceFile=home-files/.config/systemd/user/swayidle.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${expectedArgs}' + assertFileRegex $serviceFile 'Environment=.*PATH=${ + lib.makeBinPath [ pkgs.bash ] + }' + ''; +} diff --git a/third_party/home-manager/tests/modules/services/swayidle/default.nix b/third_party/home-manager/tests/modules/services/swayidle/default.nix new file mode 100644 index 0000000000..124fe1d7d8 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/swayidle/default.nix @@ -0,0 +1 @@ +{ swayidle-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/syncthing/default.nix b/third_party/home-manager/tests/modules/services/syncthing/default.nix index 14136fe637..86f72b571f 100644 --- a/third_party/home-manager/tests/modules/services/syncthing/default.nix +++ b/third_party/home-manager/tests/modules/services/syncthing/default.nix @@ -1,4 +1,5 @@ { + syncthing-extra-options = ./extra-options.nix; syncthing-tray = ./tray.nix; syncthing-tray-as-bool-triggers-warning = ./tray-as-bool-triggers-warning.nix; } diff --git a/third_party/home-manager/tests/modules/services/syncthing/extra-options.nix b/third_party/home-manager/tests/modules/services/syncthing/extra-options.nix new file mode 100644 index 0000000000..c78b00f9c1 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/syncthing/extra-options.nix @@ -0,0 +1,16 @@ +{ config, ... }: + +{ + services.syncthing = { + enable = true; + extraOptions = [ "-foo" ''-bar "baz"'' ]; + }; + + test.stubs.syncthing = { }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/syncthing.service + assertFileContains home-files/.config/systemd/user/syncthing.service \ + "ExecStart=@syncthing@/bin/syncthing -no-browser -no-restart -logflags=0 '-foo' '-bar \"baz\"'" + ''; +} diff --git a/third_party/home-manager/tests/modules/services/twmn/basic-configuration.conf b/third_party/home-manager/tests/modules/services/twmn/basic-configuration.conf new file mode 100644 index 0000000000..a6ddb5c731 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/twmn/basic-configuration.conf @@ -0,0 +1,32 @@ +[gui] +always_on_top=true +background_color=black +bounce=true +bounce_duration=271 +font=Noto Sans +font_size=16 +font_variant=italic +foreground_color=#FF00FF +height=20 +in_animation=27 +in_animation_duration=314 +max_length=80 +offset_x=+20 +offset_y=-60 +opacity=80 +out_animation=13 +out_animation_duration=168 +position=center +screen=0 + +[icons] +critical=/path/icon/critical +info=/path/icon/info +warning=/path/icon/warning + +[main] +duration=4242 +host=example.com +port=9006 +sound_command=/path/sound/command + diff --git a/third_party/home-manager/tests/modules/services/twmn/basic-configuration.nix b/third_party/home-manager/tests/modules/services/twmn/basic-configuration.nix new file mode 100644 index 0000000000..5da926e489 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/twmn/basic-configuration.nix @@ -0,0 +1,51 @@ +{ + config = { + services.twmn = { + enable = true; + duration = 4242; + host = "example.com"; + port = 9006; + screen = 0; + soundCommand = "/path/sound/command"; + icons.critical = "/path/icon/critical"; + icons.info = "/path/icon/info"; + icons.warning = "/path/icon/warning"; + text = { + color = "#FF00FF"; + font.family = "Noto Sans"; + font.size = 16; + font.variant = "italic"; + maxLength = 80; + }; + window = { + alwaysOnTop = true; + color = "black"; + height = 20; + offset.x = 20; + offset.y = -60; + opacity = 80; + position = "center"; + animation = { + easeIn.curve = 27; + easeIn.duration = 314; + easeOut.curve = 13; + easeOut.duration = 168; + bounce.enable = true; + bounce.duration = 271; + }; + }; + }; + + test.stubs.twmn = { }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/twmnd.service" + assertFileExists "$serviceFile" + assertFileRegex "$serviceFile" 'X-Restart-Triggers=.*twmn\.conf' + assertFileRegex "$serviceFile" 'ExecStart=@twmn@/bin/twmnd' + assertFileExists "home-files/.config/twmn/twmn.conf" + assertFileContent "home-files/.config/twmn/twmn.conf" \ + ${./basic-configuration.conf} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/services/twmn/default.nix b/third_party/home-manager/tests/modules/services/twmn/default.nix new file mode 100644 index 0000000000..8a021ba38c --- /dev/null +++ b/third_party/home-manager/tests/modules/services/twmn/default.nix @@ -0,0 +1 @@ +{ twmn-basic-configuration = ./basic-configuration.nix; } diff --git a/third_party/home-manager/tests/modules/services/udiskie/basic.nix b/third_party/home-manager/tests/modules/services/udiskie/basic.nix new file mode 100644 index 0000000000..5fa623c3e1 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/udiskie/basic.nix @@ -0,0 +1,15 @@ +{ + config = { + services.udiskie.enable = true; + + test.stubs.udiskie = { }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/udiskie.service" + assertFileRegex "$serviceFile" 'After=tray\.target' + assertFileRegex "$serviceFile" 'Requires=tray\.target' + assertFileContent "home-files/.config/udiskie/config.yml" \ + ${./basic.yml} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/services/udiskie/basic.yml b/third_party/home-manager/tests/modules/services/udiskie/basic.yml new file mode 100644 index 0000000000..423f4ec827 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/udiskie/basic.yml @@ -0,0 +1,4 @@ +program_options: + automount: true + notify: true + tray: auto diff --git a/third_party/home-manager/tests/modules/services/udiskie/default.nix b/third_party/home-manager/tests/modules/services/udiskie/default.nix new file mode 100644 index 0000000000..b79be5a9c4 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/udiskie/default.nix @@ -0,0 +1,4 @@ +{ + udiskie-basic = ./basic.nix; + udiskie-no-tray = ./no-tray.nix; +} diff --git a/third_party/home-manager/tests/modules/services/udiskie/no-tray.nix b/third_party/home-manager/tests/modules/services/udiskie/no-tray.nix new file mode 100644 index 0000000000..0c7ede0bdd --- /dev/null +++ b/third_party/home-manager/tests/modules/services/udiskie/no-tray.nix @@ -0,0 +1,18 @@ +{ + config = { + services.udiskie = { + enable = true; + tray = "never"; + }; + + test.stubs.udiskie = { }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/udiskie.service" + assertFileNotRegex "$serviceFile" 'After=tray\.target' + assertFileNotRegex "$serviceFile" 'Requires=tray\.target' + assertFileContent "home-files/.config/udiskie/config.yml" \ + ${./no-tray.yml} + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/services/udiskie/no-tray.yml b/third_party/home-manager/tests/modules/services/udiskie/no-tray.yml new file mode 100644 index 0000000000..75eca2ff80 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/udiskie/no-tray.yml @@ -0,0 +1,4 @@ +program_options: + automount: true + notify: true + tray: false diff --git a/third_party/home-manager/tests/modules/services/window-managers/bspwm/bspwmrc b/third_party/home-manager/tests/modules/services/window-managers/bspwm/bspwmrc index 7ebb64aca3..ccc0700886 100755 --- a/third_party/home-manager/tests/modules/services/window-managers/bspwm/bspwmrc +++ b/third_party/home-manager/tests/modules/services/window-managers/bspwm/bspwmrc @@ -1,4 +1,8 @@ -bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top' +extra config early + +if [[ $(bspc query --desktops --names --monitor 'focused') == Desktop ]]; then + bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top' +fi bspc config 'border_width' '2' bspc config 'external_rules_command' '/path/to/external rules command' @@ -7,7 +11,7 @@ bspc config 'ignore_ewmh_fullscreen' 'enter,exit' bspc config 'split_ratio' '0.520000' bspc rule -r '*' -bspc rule -a '*' 'center=off' 'desktop=d'\''esk top#next' 'split_dir=north' 'sticky=on' +bspc rule -a '*' 'center=off' 'desktop=d'\''esk top#next' 'split_dir=north' 'sticky=on' 'unknown_rule=42' # java gui fixes export _JAVA_AWT_WM_NONREPARENTING=1 diff --git a/third_party/home-manager/tests/modules/services/window-managers/bspwm/configuration.nix b/third_party/home-manager/tests/modules/services/window-managers/bspwm/configuration.nix index 8018a3ac18..49c82f6fe4 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/bspwm/configuration.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/bspwm/configuration.nix @@ -8,6 +8,7 @@ with lib; enable = true; monitors.focused = [ "desktop 1" "d'esk top" ]; # pathological desktop names + alwaysResetDesktops = false; settings = { border_width = 2; split_ratio = 0.52; @@ -21,7 +22,11 @@ with lib; desktop = "d'esk top#next"; splitDir = "north"; border = null; + unknownRule = 42; }; + extraConfigEarly = '' + extra config early + ''; extraConfig = '' extra config ''; diff --git a/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/default.nix b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/default.nix new file mode 100644 index 0000000000..31e73365f8 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/default.nix @@ -0,0 +1,4 @@ +{ + herbstluftwm-simple-config = ./herbstluftwm-simple-config.nix; + herbstluftwm-no-tags = ./herbstluftwm-no-tags.nix; +} diff --git a/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart new file mode 100644 index 0000000000..9e8cd78a07 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart @@ -0,0 +1,32 @@ +#!/nix/store/00000000000000000000000000000000-bash/bin/bash +shopt -s expand_aliases + +# shellcheck disable=SC2142 +alias herbstclient='set -- "$@" ";"' +set -- + +herbstclient emit_hook reload + +# Reset everything. +herbstclient attr theme.tiling.reset 1 +herbstclient attr theme.floating.reset 1 +herbstclient keyunbind --all +herbstclient mouseunbind --all +herbstclient unrule --all + + + + + + + + + + + + + +herbstclient unlock + +@herbstluftwm@/bin/herbstclient chain ";" "$@" + diff --git a/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix new file mode 100644 index 0000000000..bd7fb4881e --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix @@ -0,0 +1,16 @@ +{ lib, pkgs, ... }: + +{ + xsession.windowManager.herbstluftwm = { enable = true; }; + + test.stubs.herbstluftwm = { }; + + nmt.script = '' + autostart=home-files/.config/herbstluftwm/autostart + assertFileExists "$autostart" + assertFileIsExecutable "$autostart" + + normalizedAutostart=$(normalizeStorePaths "$autostart") + assertFileContent "$normalizedAutostart" ${./herbstluftwm-no-tags-autostart} + ''; +} diff --git a/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart new file mode 100644 index 0000000000..5f101e0bb3 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart @@ -0,0 +1,50 @@ +#!/nix/store/00000000000000000000000000000000-bash/bin/bash +shopt -s expand_aliases + +# shellcheck disable=SC2142 +alias herbstclient='set -- "$@" ";"' +set -- + +herbstclient emit_hook reload + +# Reset everything. +herbstclient attr theme.tiling.reset 1 +herbstclient attr theme.floating.reset 1 +herbstclient keyunbind --all +herbstclient mouseunbind --all +herbstclient unrule --all + +herbstclient set always_show_frame true +herbstclient set default_frame_layout 'max' +herbstclient set frame_bg_active_color '#000000' +herbstclient set frame_gap '12' +herbstclient set frame_padding '-12' + +if @herbstluftwm@/bin/herbstclient object_tree tags.default &>/dev/null; then + herbstclient rename default '1' +fi + +for tag in '1' 'with space' 'wə1rd#ch@rs'\'''; do + herbstclient add "$tag" +done + + +herbstclient keybind Mod4-1 use 1 +herbstclient keybind Mod4-2 use 2 +herbstclient keybind Mod4-Alt-Tab cycle -1 +herbstclient keybind Mod4-Tab cycle 1 + +herbstclient mousebind Mod4-B1 move +herbstclient mousebind Mod4-B3 resize + +herbstclient rule focus=on +herbstclient rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' focus=on pseudotile=on +herbstclient rule class~'[Pp]inentry' instance=pinentry focus=on floating=on floatplacement=center keys_inactive='.*' + +herbstclient use 1 + + +herbstclient unlock + +@herbstluftwm@/bin/herbstclient chain ";" "$@" + diff --git a/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix new file mode 100644 index 0000000000..e351e78f97 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix @@ -0,0 +1,46 @@ +{ lib, pkgs, ... }: + +{ + xsession.windowManager.herbstluftwm = { + enable = true; + settings = { + always_show_frame = true; + default_frame_layout = "max"; + frame_bg_active_color = "#000000"; + frame_gap = 12; + frame_padding = -12; + }; + keybinds = { + "Mod4-1" = "use 1"; + "Mod4-2" = "use 2"; + "Mod4-Tab" = "cycle 1"; + "Mod4-Alt-Tab" = "cycle -1"; + }; + mousebinds = { + "Mod4-B1" = "move"; + "Mod4-B3" = "resize"; + }; + rules = [ + "focus=on" + "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'" ]; + extraConfig = '' + herbstclient use 1 + ''; + }; + + test.stubs.herbstluftwm = { }; + + nmt.script = '' + autostart=home-files/.config/herbstluftwm/autostart + assertFileExists "$autostart" + assertFileIsExecutable "$autostart" + + normalizedAutostart=$(normalizeStorePaths "$autostart") + assertFileContent "$normalizedAutostart" ${ + ./herbstluftwm-simple-config-autostart + } + ''; +} diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf index c50f317ad9..92f23a921d 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+0 workspace number 10 bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 @@ -66,17 +64,15 @@ bindsym Mod1+v split v bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px or 10 ppt -bindsym Escape mode default -bindsym Left resize shrink width 10 px or 10 ppt -bindsym Return mode default -bindsym Right resize grow width 10 px or 10 ppt -bindsym Up resize shrink height 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Escape mode default + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Return mode default + bindsym Right resize grow width 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt } - bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -98,13 +94,6 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - - - - - - diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf index 3d8ad0d21d..27234b96db 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+0 workspace number 10 bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 @@ -66,17 +64,15 @@ bindsym Mod1+v split v bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px or 10 ppt -bindsym Escape mode default -bindsym Left resize shrink width 10 px or 10 ppt -bindsym Return mode default -bindsym Right resize grow width 10 px or 10 ppt -bindsym Up resize shrink height 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Escape mode default + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Return mode default + bindsym Right resize grow width 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt } - bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -90,21 +86,11 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - - - - - - diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-fonts-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-fonts-expected.conf index 8a565bc3fc..d85d978e07 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-fonts-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-fonts-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+0 workspace number 10 bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 @@ -66,17 +64,15 @@ bindsym Mod1+v split v bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px or 10 ppt -bindsym Escape mode default -bindsym Left resize shrink width 10 px or 10 ppt -bindsym Return mode default -bindsym Right resize grow width 10 px or 10 ppt -bindsym Up resize shrink height 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Escape mode default + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Return mode default + bindsym Right resize grow width 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt } - bar { - font pango:FontAwesome, Iosevka 11.500000 mode dock hidden_state hide @@ -90,21 +86,11 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - - - - - - diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf index 6c310baac9..b3b4c33dea 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+0 workspace number 10 bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 @@ -67,17 +65,15 @@ bindsym Mod1+v split v bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px or 10 ppt -bindsym Escape mode default -bindsym Left resize shrink width 10 px or 10 ppt -bindsym Return mode default -bindsym Right resize grow width 10 px or 10 ppt -bindsym Up resize shrink height 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Escape mode default + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Return mode default + bindsym Right resize grow width 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt } - bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -91,21 +87,11 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - - - - - - diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-null-config.nix b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-null-config.nix index 1c221319b2..f321ad49a5 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-null-config.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-null-config.nix @@ -11,6 +11,6 @@ nmt.script = '' assertFileExists home-files/.config/i3/config assertFileContent home-files/.config/i3/config \ - ${pkgs.writeText "expected" "\n"} + ${pkgs.writeText "expected" ""} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf index d214a96b48..d7fe4b6104 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf @@ -9,14 +9,12 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+0 workspace number 10 bindsym Mod1+2 workspace number 2 @@ -65,17 +63,15 @@ bindsym Mod1+v split v bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px or 10 ppt -bindsym Escape mode default -bindsym Left resize shrink width 10 px or 10 ppt -bindsym Return mode default -bindsym Right resize grow width 10 px or 10 ppt -bindsym Up resize shrink height 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Escape mode default + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Return mode default + bindsym Right resize grow width 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt } - bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -89,21 +85,11 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - - - - - - diff --git a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf index 9166cf9bbe..dedad29e0b 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+0 workspace number 10 bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 @@ -66,17 +64,15 @@ bindsym Mod1+v split v bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px or 10 ppt -bindsym Escape mode default -bindsym Left resize shrink width 10 px or 10 ppt -bindsym Return mode default -bindsym Right resize grow width 10 px or 10 ppt -bindsym Up resize shrink height 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Escape mode default + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Return mode default + bindsym Right resize grow width 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt } - bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -90,24 +86,15 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - } - - - - +} workspace "1" output eDP workspace "ABC" output DP workspace "3: Test" output HDMI workspace "!"§$%&/(){}[]=?\*#<>-_.:,;²³" output DVI - diff --git a/third_party/home-manager/tests/modules/services/window-managers/spectrwm/default.nix b/third_party/home-manager/tests/modules/services/window-managers/spectrwm/default.nix new file mode 100644 index 0000000000..be53aa1b69 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/spectrwm/default.nix @@ -0,0 +1 @@ +{ spectrwm-simple-config = ./spectrwm-simple-config.nix; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config-expected-spectrwm.conf b/third_party/home-manager/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config-expected-spectrwm.conf new file mode 100644 index 0000000000..54e55ad4ad --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config-expected-spectrwm.conf @@ -0,0 +1,8 @@ +# Generated by Home Manager +bar_enabled = 1 +bar_format = +S [+R:+I] %a %b %d [%R] +bar_justify = center +modkey = Mod4 +program[term] = alacritty +bind[term] = MOD+Shift+Return +bind[] = MOD+Return diff --git a/third_party/home-manager/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix b/third_party/home-manager/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix new file mode 100644 index 0000000000..3ba13b4d30 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/spectrwm/spectrwm-simple-config.nix @@ -0,0 +1,25 @@ +{ ... }: + +{ + xsession.windowManager.spectrwm = { + enable = true; + settings = { + bar_enabled = true; + bar_format = "+S [+R:+I] %a %b %d [%R]"; + bar_justify = "center"; + modkey = "Mod4"; + }; + programs = { term = "alacritty"; }; + bindings = { term = "MOD+Shift+Return"; }; + unbindings = [ "MOD+Return" ]; + }; + + test.stubs.spectrwm = { }; + + nmt.script = '' + assertFileContent \ + home-files/.config/spectrwm/spectrwm.conf ${ + ./spectrwm-simple-config-expected-spectrwm.conf + } + ''; +} diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/default.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/default.nix index 6ad673b184..f11ef7e389 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/default.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/default.nix @@ -1,10 +1,12 @@ { sway-bar-focused-colors = ./sway-bar-focused-colors.nix; - sway-bindkeys-to-code = ./sway-bindkeys-to-code.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; sway-modules = ./sway-modules.nix; + sway-no-xwayland = ./sway-no-xwayland.nix; sway-null-config = ./sway-null-config.nix; sway-null-package = ./sway-null-package.nix; sway-post-2003 = ./sway-post-2003.nix; diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 558e579aee..a3b9905d6e 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -71,20 +69,19 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -106,9 +103,7 @@ bar { inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix index 9746d05038..399790fbed 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix @@ -18,7 +18,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-bar-focused-colors.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf similarity index 81% rename from third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf rename to third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index 7879ceab1b..65780062fc 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -1,3 +1,5 @@ +import $HOME/.cache/wal/colors-sway + font pango:monospace 8.000000 floating_modifier Mod1 default_border pixel 2 @@ -9,7 +11,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +18,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym --to-code Mod1+1 workspace number 1 bindsym --to-code Mod1+2 workspace number 2 bindsym --to-code Mod1+3 workspace number 3 @@ -29,7 +29,7 @@ bindsym --to-code Mod1+8 workspace number 8 bindsym --to-code Mod1+9 workspace number 9 bindsym --to-code Mod1+Down focus down bindsym --to-code Mod1+Left focus left -bindsym --to-code Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym --to-code Mod1+Return exec @foot@/bin/foot bindsym --to-code Mod1+Right focus right bindsym --to-code Mod1+Shift+1 move container to workspace number 1 bindsym --to-code Mod1+Shift+2 move container to workspace number 2 @@ -71,20 +71,19 @@ bindsym --to-code Mod1+v splitv bindsym --to-code Mod1+w layout tabbed mode "resize" { -bindsym --to-code Down resize grow height 10 px -bindsym --to-code Escape mode default -bindsym --to-code Left resize shrink width 10 px -bindsym --to-code Return mode default -bindsym --to-code Right resize grow width 10 px -bindsym --to-code Up resize shrink height 10 px -bindsym --to-code h resize shrink width 10 px -bindsym --to-code j resize grow height 10 px -bindsym --to-code k resize shrink height 10 px -bindsym --to-code l resize grow width 10 px + bindsym --to-code Down resize grow height 10 px + bindsym --to-code Escape mode default + bindsym --to-code Left resize shrink width 10 px + bindsym --to-code Return mode default + bindsym --to-code Right resize grow width 10 px + bindsym --to-code Up resize shrink height 10 px + bindsym --to-code h resize shrink width 10 px + bindsym --to-code j resize grow height 10 px + bindsym --to-code k resize shrink height 10 px + bindsym --to-code l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -98,17 +97,13 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" +exec_always pkill flashfocus; flasfocus & diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix similarity index 58% rename from third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix rename to third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix index 5e62748cb9..0817837acc 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix @@ -9,11 +9,17 @@ # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; config.bindkeysToCode = true; + extraConfigEarly = '' + import $HOME/.cache/wal/colors-sway + ''; + extraConfig = '' + exec_always pkill flashfocus; flasfocus & + ''; }; nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ - ${./sway-bindkeys-to-code.conf} + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ + ${./sway-bindkeys-to-code-and-extra-config.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.conf index 1cd75fd522..e1fa6626b5 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -71,20 +69,19 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -98,17 +95,12 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.nix index 7bd4373174..24796118c0 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-default.nix @@ -12,7 +12,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-default.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf index 4eae367946..bf99663784 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -71,17 +69,16 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf index c6497eb6dd..d93031c90e 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -71,17 +69,16 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix index ce69d9f7fb..52aa3cc4a6 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix @@ -18,7 +18,7 @@ with lib; nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-followmouse-legacy-expected.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix index 7065dd1ca5..788ad218fa 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix @@ -16,7 +16,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-followmouse-expected.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.conf index 1cec60e8bb..b217f88475 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -83,20 +81,19 @@ hide_cursor when-typing enable } mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -110,17 +107,12 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.nix index 96366ab0a2..567f7b5c6c 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-modules.nix @@ -18,7 +18,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-modules.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-no-xwayland.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-no-xwayland.nix new file mode 100644 index 0000000000..44077d4413 --- /dev/null +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./sway-stubs.nix ]; + + wayland.windowManager.sway = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + config = null; + systemdIntegration = false; + xwayland = false; + }; + + nmt.script = '' + assertFileExists home-files/.config/sway/config + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ + ${ + pkgs.writeText "expected" '' + xwayland disable + '' + } + ''; +} diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-config.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-config.nix index 4033903d37..0c0d1e7b43 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-config.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-config.nix @@ -12,7 +12,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ - ${pkgs.writeText "expected" "\n"} + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ + ${pkgs.writeText "expected" ""} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.conf index 1cd75fd522..e1fa6626b5 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -71,20 +69,19 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -98,17 +95,12 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.nix index fe2a451961..a449b42c49 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-null-package.nix @@ -21,7 +21,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-null-package.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix index 7596250ec3..72e1fd9eae 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix @@ -14,7 +14,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-default.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-stubs.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-stubs.nix index 55a74e1c47..2ae673c781 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-stubs.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-stubs.nix @@ -3,7 +3,7 @@ # not containing hashes, version numbers etc. test.stubs = { dmenu = { }; - rxvt-unicode-unwrapped = { }; + foot = { }; i3status = { }; sway = { }; sway-unwrapped = { version = "1"; }; diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index 7aa1e1e478..b783d4c20f 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -9,14 +9,12 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+9 workspace number 9 bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 @@ -28,7 +26,7 @@ bindsym Mod1+7 workspace number 7 bindsym Mod1+8 workspace number 8 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -70,20 +68,19 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -97,17 +94,12 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default.nix index d941109805..6af944eb01 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-default.nix @@ -13,7 +13,7 @@ nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-workspace-default-expected.conf} ''; } diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index e4a4f6cfd3..94ba5e27c0 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -9,7 +9,6 @@ focus_on_window_activation smart mouse_warping output workspace_layout default workspace_auto_back_and_forth no - client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a client.unfocused #333333 #222222 #888888 #292d2e #222222 @@ -17,7 +16,6 @@ client.urgent #2f343a #900000 #ffffff #900000 #900000 client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c client.background #ffffff - bindsym Mod1+1 workspace number 1 bindsym Mod1+2 workspace number 2 bindsym Mod1+3 workspace number 3 @@ -29,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 @@ -71,20 +69,19 @@ bindsym Mod1+v splitv bindsym Mod1+w layout tabbed mode "resize" { -bindsym Down resize grow height 10 px -bindsym Escape mode default -bindsym Left resize shrink width 10 px -bindsym Return mode default -bindsym Right resize grow width 10 px -bindsym Up resize shrink height 10 px -bindsym h resize shrink width 10 px -bindsym j resize grow height 10 px -bindsym k resize shrink height 10 px -bindsym l resize grow width 10 px + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px } bar { - font pango:monospace 8.000000 mode dock hidden_state hide @@ -98,21 +95,16 @@ bar { background #000000 statusline #ffffff separator #666666 - - - focused_workspace #4c7899 #285577 #ffffff active_workspace #333333 #5f676a #ffffff inactive_workspace #333333 #222222 #888888 urgent_workspace #2f343a #900000 #ffffff binding_mode #2f343a #900000 #ffffff - } - +} } workspace "1" output eDP workspace "ABC" output DP workspace "3: Test" output HDMI workspace "!"§$%&/(){}[]=?\*#<>-_.:,;²³" output DVI - -exec "systemctl --user import-environment; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output.nix b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output.nix index ce51c1f519..e096aa1f48 100644 --- a/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output.nix +++ b/third_party/home-manager/tests/modules/services/window-managers/sway/sway-workspace-output.nix @@ -39,7 +39,7 @@ in { nmt.script = '' assertFileExists home-files/.config/sway/config - assertFileContent home-files/.config/sway/config \ + assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \ ${./sway-workspace-output-expected.conf} ''; } diff --git a/third_party/home-manager/tests/modules/systemd/default.nix b/third_party/home-manager/tests/modules/systemd/default.nix index c949edd95c..a0271b47be 100644 --- a/third_party/home-manager/tests/modules/systemd/default.nix +++ b/third_party/home-manager/tests/modules/systemd/default.nix @@ -2,5 +2,6 @@ systemd-services = ./services.nix; systemd-services-disabled-for-root = ./services-disabled-for-root.nix; systemd-session-variables = ./session-variables.nix; + systemd-slices = ./slices.nix; systemd-timers = ./timers.nix; } diff --git a/third_party/home-manager/tests/modules/systemd/session-variables-expected.conf b/third_party/home-manager/tests/modules/systemd/session-variables-expected.conf deleted file mode 100644 index 65ced43ea6..0000000000 --- a/third_party/home-manager/tests/modules/systemd/session-variables-expected.conf +++ /dev/null @@ -1,3 +0,0 @@ -LOCALE_ARCHIVE_2_27=@glibcLocales@/lib/locale/locale-archive -V_int=1 -V_str=2 diff --git a/third_party/home-manager/tests/modules/systemd/session-variables.nix b/third_party/home-manager/tests/modules/systemd/session-variables.nix index 8722a9ab3e..cbc348c444 100644 --- a/third_party/home-manager/tests/modules/systemd/session-variables.nix +++ b/third_party/home-manager/tests/modules/systemd/session-variables.nix @@ -15,6 +15,10 @@ LOCALE_ARCHIVE_2_27=${pkgs.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/third_party/home-manager/tests/modules/systemd/slices.nix b/third_party/home-manager/tests/modules/systemd/slices.nix new file mode 100644 index 0000000000..0bb9050411 --- /dev/null +++ b/third_party/home-manager/tests/modules/systemd/slices.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + systemd.user.slices.app-test = { + Unit = { Description = "Slice for a test app"; }; + + Slice = { + MemoryHigh = "30%"; + MemoryMax = "40%"; + }; + }; + + 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% + + [Unit] + Description=Slice for a test app + '' + } + ''; + }; +} diff --git a/third_party/home-manager/tests/modules/targets-darwin/default.nix b/third_party/home-manager/tests/modules/targets-darwin/default.nix index 10e4111f77..e0cf9be56c 100644 --- a/third_party/home-manager/tests/modules/targets-darwin/default.nix +++ b/third_party/home-manager/tests/modules/targets-darwin/default.nix @@ -2,4 +2,5 @@ # Disabled for now due to conflicting behavior with nix-darwin. See # https://github.com/nix-community/home-manager/issues/1341#issuecomment-687286866 #targets-darwin = ./darwin.nix; + user-defaults = ./user-defaults.nix; } diff --git a/third_party/home-manager/tests/modules/targets-darwin/user-defaults.nix b/third_party/home-manager/tests/modules/targets-darwin/user-defaults.nix new file mode 100644 index 0000000000..bb23f718d6 --- /dev/null +++ b/third_party/home-manager/tests/modules/targets-darwin/user-defaults.nix @@ -0,0 +1,18 @@ +{ lib, ... }: + +{ + config = { + targets.darwin = { + defaults."com.apple.desktopservices".DSDontWriteNetworkStores = true; + currentHostDefaults."com.apple.controlcenter".BatteryShowPercentage = + true; + }; + + nmt.script = '' + assertFileRegex activate \ + "/usr/bin/defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" + assertFileRegex activate \ + "/usr/bin/defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" + ''; + }; +} diff --git a/third_party/home-manager/tests/stubs.nix b/third_party/home-manager/tests/stubs.nix index 01f4606547..dacafeb7d9 100644 --- a/third_party/home-manager/tests/stubs.nix +++ b/third_party/home-manager/tests/stubs.nix @@ -40,7 +40,7 @@ let pkg = if name == "dummy" && buildScript == defaultBuildScript then dummyPackage else - pkgs.runCommandLocal name { } buildScript; + pkgs.runCommandLocal name { pname = name; } buildScript; in pkg // optionalAttrs (outPath != null) { inherit outPath; } // optionalAttrs (version != null) { inherit version; }; diff --git a/third_party/home-manager/xgettext b/third_party/home-manager/xgettext new file mode 100755 index 0000000000..8580a324f9 --- /dev/null +++ b/third_party/home-manager/xgettext @@ -0,0 +1,37 @@ +#! /usr/bin/env nix-shell +#! nix-shell -I https://github.com/NixOS/nixpkgs/archive/05f0934825c2a0750d4888c4735f9420c906b388.tar.gz -i bash -p gettext + +set -euo pipefail +shopt -s globstar + +function run() { + packageName="$1" + output="$2" + domain="$3" + shift 3 + + xgettext -v --package-name="$packageName" \ + --copyright-holder='Home Manager contributors' \ + --msgid-bugs-address=https://github.com/nix-community/home-manager/issues \ + -L Shell -k \ + -k_i:1 --flag=_i:1:c-format \ + -k_iError:1 --flag=_i:1:c-format \ + -k_iWarn:1 --flag=_i:1:c-format \ + -k_iNote:1 --flag=_i:1:c-format \ + -k_ip:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ + -k_ipError:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ + -k_ipWarn:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ + -k_ipNote:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ + --add-comments=translators: \ + -o "$output" -d "$domain" "$@" +} + +run 'Home Manager' \ + home-manager/po/home-manager.pot \ + home-manager \ + home-manager/home-manager home-manager/**/*.nix + +run 'Home Manager Modules' \ + modules/po/hm-modules.pot \ + hm-modules \ + modules/**/*.{nix,sh}