Compare commits

..
Author SHA1 Message Date
faa4b16358 podman: add module
This module is a continuation of #2630 by MaeIsBad.

It also adds a module `virtualisation.oci-containers` that is
equivalent to the one in NixOS. Basically it allows a simple toggle to
activate oci-container services and commands.

We also support Podman on mac. Note, Podman requires a VM on mac,
which has to be started before any Podman commands can be executed.
Users might sometimes require VMs that use different architectures
than the default VM started by Podman. Thus, they get the option to
define the VM(s) that will be initialized and started by podman.

Since Podman has to start a machine, it's best to do it using launchd.
The configuration of the machines requires a JSON, generated from an
attrset in Home Manager, which is where Python script comes into play
to take care of diff-ing the `podman machine list` to CRUD them.

PR #4331

Co-authored-by: MaeIsBad <26093674+MaeIsBad@users.noreply.github.com>
2023-12-23 17:27:37 +01:00
4433 changed files with 41766 additions and 175316 deletions
+1 -2
View File
@@ -9,7 +9,6 @@ environment:
NIX_CONFIG: "experimental-features = nix-command flakes"
packages:
- nixos.cachix
- nixos.jq
tasks:
- setup: |
cachix use rycee
@@ -27,7 +26,7 @@ tasks:
if [[ $gitBranch == master ]]; then
dirName="unstable"
else
dirName="$(jq -r .release < release.json)"
dirName="$(cat .release)"
fi
rsync --delete -r --info=stats \
+1 -4
View File
@@ -11,7 +11,7 @@ insert_final_newline = true
# The JSON files contain newlines inconsistently
[*.json]
insert_final_newline = unset
insert_final_newline = ignore
# Makefiles always use tabs for indentation
[Makefile]
@@ -19,6 +19,3 @@ indent_style = tab
[*.md]
trim_trailing_whitespace = false
[*.plist]
insert_final_newline = false
-61
View File
@@ -1,61 +0,0 @@
# This file contains a list of commits that are not likely what you
# are looking for in a blame, such as mass reformatting or renaming.
#
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
# Treewide nixfmt-rfc-style
cba2f9ce95c8d10b66cacf05a275e3ad71959638
# Treewide remove with lib
0b491b460f52e87e23eb17bbf59c6ae64b7664c1
95711f926676018d279ba09fe7530d03b5d5b3e2
5e193cdcab61b5e7096ef3c132fdc0149e14f2d9
55cf1f16324e694c991e846ad5fc897f0f75ac64
a710f337d6f541f5ba50bc2d5daa6c34e9ee5834
10dca990ae02aaf41ff12c5b18dd3dcf258c0d04
d7f451d7b13bbe075abecfd345f8b149a000216a
65413f297f8c4c42a99270c15bce7bda1bfea724
b5976017741653251258112f7e6ee5d8b9e3a832
e0be70bcf94be20f8f0f6d215d909b614ab6ebeb
e30c6a41bc8548738341d10c0b17f8fead8e55ee
b5142d46a3f912ef99e9cec3e51d757fbeaf14ea
56374cc64d58451b359bb4e8502387d3a96e7c7b
32531e457215000b739da6cd40acfb080823f396
34d524f3edcf3a04c00ad2c09c24ec9d35d937f9
439a125afef8c97308ec0c6db75d38e15d92208d
5031c6d2978109336637977c165f82aa49fa16a7
b34b56689dcc75294e14e8c95db4e054a4e9573f
234613d77c939ff2e2c0f2c476a56d80930e5b8b
e3baf274f47678df6289c7482353cb6d38b7be5d
c90cd85b04ff3348978b05ba73ffc8e1b74b9fce
2d731a33b193209cb88b874e508ea912765f7d99
20fd9686b85dc64657a176466e23d0f3a5e1f760
96dee79b178d295b716052feca3ee46abc085abe
97d7946b5e107dd03cc82f21165251d4e0159655
0dfec9deb275854a56c97c356c40ef72e3a2e632
4b2d3b03becc184f2d1485e109c6a55f94d5f886
# Treewide remove lib.mdDoc
9f9e277b60a6e6915ad3a129e06861044b50fdf2
# Treewide replace usage of literalExample
bd11e2c5e67385970e59e55ba7a4c35d1ffaee4d
# Treewide nix fmt change
b4752b0eda6302b92a6d5dd554c83f188bc3ae6d
9136120c369d91144910a985262e3c3b8e8872d6
# Treewide remove noops
f2f1076c1f789595c2a2b18b76466fbd691025dd
# Treewide statix cleanup
01ea51d7065e0ab06a09df9db4d1c17f6eb2675f
74d8d470345b9324f89e14d675c14b92dc4a091d
5209a256fd507322b0dd09ade7bc61923da948cf
11ad9d2e42ebf6d00db4d7bae252f1c6b7dd36a4
74b0e979375b0ed469e2394820aa50ba2114800b
de90ee24082bb8dd44145f5c733b807467856820
# Deadnix cleanup
71402c5df34df5ee7b6c10d738018f9f0c8bde2b
a93d80bcec089abf80894c25ee3934b7e196bbd9
+15
View File
@@ -0,0 +1,15 @@
---
name: Feature request
about: Ask for a new feature to be added (module, program, etc.)
title: ''
labels: feature request
assignees: rycee, berbiche, sumnerevans
---
<!--
Note: Please search to see if the feature has already been requested
-->
### Description
@@ -1,38 +0,0 @@
name: "✨ Feature Request"
description: "Suggest an improvement to Home Manager"
title: "[Feature Request] "
labels: ["feature request"]
body:
- type: markdown
attributes:
value: |
Thank you for contributing to Home Manager!
Before you open a new issue, please search the existing issues to see if your feature has already been requested or discussed.
- type: markdown
attributes:
value: "## 🔧 Existing Module Improvement"
- type: input
id: existing-module-name
attributes:
label: Module Name
description: "What is the name of the module?"
placeholder: "e.g., programs.git"
- type: textarea
id: existing-module-feature
attributes:
label: Requested Feature
description: "Please describe the new feature or improvement in detail."
- type: textarea
id: existing-module-limitation
attributes:
label: Current Limitations
description: "Why can't your goal be achieved with the current implementation? Please be specific."
- type: markdown
attributes:
value: "---"
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Add any other context, screenshots, or configuration examples about the feature request here.
+5
View File
@@ -3,6 +3,10 @@ description: File a bug/issue
title: 'bug: '
labels: [bug, triage]
# We cannot use nix-community/home-manager
# See https://github.com/dear-github/dear-github/issues/170
assignees: [rycee, berbiche, sumnerevans]
body:
- type: checkboxes
attributes:
@@ -36,6 +40,7 @@ body:
label: Maintainer CC
description: |
Please @ people who are in the `meta.maintainers` list of the offending module.
If in doubt, check `git blame` for whoever last touched something.
validations:
required: false
- type: textarea
-37
View File
@@ -1,37 +0,0 @@
name: "✨ New Module Request"
description: "Suggest an addition to Home Manager"
title: "[New Module Request] "
labels: ["new module request"]
body:
- type: markdown
attributes:
value: |
Thank you for contributing to Home Manager!
Before you open a new issue, please search the existing issues to see if your feature has already been requested or discussed.
- type: markdown
attributes:
value: "## New Program or Service"
- type: input
id: new-program-name
attributes:
label: Program/Service Name
description: "What is the name of the program or service you would like to add?"
placeholder: "e.g., my-cool-cli-tool"
- type: input
id: new-program-repo
attributes:
label: Upstream Repository
description: "Please provide a link to the source code repository."
placeholder: "https://github.com/user/repo"
- type: textarea
id: new-program-docs
attributes:
label: Configuration Documentation
description: "Please provide links to any relevant documentation for configuring this program."
placeholder: "e.g., man page, project wiki, configuration file examples, etc."
- type: textarea
id: new-program-reason
attributes:
label: Reason for Addition
description: "**Why do you want this program or service added to Home Manager?"
+15 -15
View File
@@ -15,35 +15,35 @@ pull-request.
Also make sure to read the guidelines found at
https://nix-community.github.io/home-manager/#sec-guidelines
https://github.com/nix-community/home-manager/blob/master/docs/contributing.adoc#sec-guidelines
-->
- [ ] Change is backwards compatible.
- [ ] Code formatted with `nix fmt` or
`nix-shell -A dev --run treefmt`.
- [ ] Code formatted with `./format`.
- [ ] Code tested through `nix build .#test-all`
or a targeted `nix run .#tests -- <pattern>`.
- [ ] Code tested through `nix-shell --pure tests -A run.all` or `nix develop --ignore-environment .#all` using Flakes.
- [ ] Test cases updated/added. See [example](https://github.com/nix-community/home-manager/commit/f3fbb50b68df20da47f9b0def5607857fcc0d021#diff-b61a6d542f9036550ba9c401c80f00ef).
- [ ] Commit messages are formatted like
```
{component}: {description}
```
{component}: {description}
{long description}
```
{long description}
```
See [CONTRIBUTING](https://nix-community.github.io/home-manager/#sec-commit-style) for more information and [recent commit messages](https://github.com/nix-community/home-manager/commits/master) for examples.
See [CONTRIBUTING](https://github.com/nix-community/home-manager/blob/master/docs/contributing.adoc#sec-commit-style) for more information and [recent commit messages](https://github.com/nix-community/home-manager/commits/master) for examples.
- If this PR adds a new module
- [ ] Added myself as module maintainer. See [example](https://github.com/nix-community/home-manager/blob/a51598236f23c89e59ee77eb8e0614358b0e896c/modules/programs/lesspipe.nix#L11).
- [ ] Generate a news entry. See [News](https://nix-community.github.io/home-manager/index.xhtml#sec-news)
- [ ] Basic tests added. See [Tests](https://nix-community.github.io/home-manager/index.xhtml#sec-tests)
- [ ] Added myself as module maintainer. See [example](https://github.com/nix-community/home-manager/blob/068ff76a10e95820f886ac46957edcff4e44621d/modules/programs/lesspipe.nix#L6).
- If this PR adds an exciting new feature or contains a breaking change.
- [ ] Generate a news entry. See [News](https://nix-community.github.io/home-manager/index.xhtml#sec-news)
#### Maintainer CC
<!--
If you are updating a module, please @ people who are in its `meta.maintainers` list.
If in doubt, check `git blame` for whoever last touched something.
-->
+6 -11
View File
@@ -7,24 +7,19 @@ updates:
interval: "weekly"
commit-message:
prefix: "ci:"
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "release-26.05"
target-branch: "release-23.05"
schedule:
interval: "weekly"
commit-message:
prefix: "ci:"
- package-ecosystem: "nix"
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "master"
target-branch: "release-23.11"
schedule:
interval: "weekly"
commit-message:
prefix: "flake:"
- package-ecosystem: "nix"
directory: "/"
target-branch: "release-26.05"
schedule:
interval: "weekly"
commit-message:
prefix: "flake:"
prefix: "ci:"
+34 -742
View File
@@ -1,744 +1,36 @@
"release":
- base-branch:
- '^release-.*'
"ai":
- changed-files:
- any-glob-to-any-file:
- modules/programs/aiac.nix
- modules/programs/aichat.nix
- modules/programs/aider-chat.nix
- modules/programs/claude-code/**/*
- modules/programs/codex.nix
- modules/programs/fabric-ai.nix
- modules/programs/antigravity-cli.nix
- modules/programs/mcp.nix
- modules/programs/mistral-vibe.nix
- modules/programs/mods.nix
- modules/programs/opencode.nix
- modules/services/local-ai.nix
- modules/services/ollama.nix
"audio":
- changed-files:
- any-glob-to-any-file:
- modules/programs/beets.nix
- modules/programs/cava.nix
- modules/programs/cavalier.nix
- modules/programs/cmus.nix
- modules/programs/ncmpcpp.nix
- modules/programs/ncspot.nix
- modules/programs/pianobar.nix
- modules/programs/pyradio.nix
- modules/programs/radio-active.nix
- modules/programs/radio-cli.nix
- modules/programs/rmpc.nix
- modules/programs/spotify-player.nix
- modules/programs/timidity.nix
- modules/services/amberol.nix
- modules/services/easyeffects.nix
- modules/services/fluidsynth.nix
- modules/services/librespot.nix
- modules/services/listenbrainz-mpd.nix
- modules/services/mopidy.nix
- modules/services/mpd-discord-rpc.nix
- modules/services/mpd-mpris.nix
- modules/services/mpd.nix
- modules/services/mpdris2-rs.nix
- modules/services/mpdris2.nix
- modules/services/mpdscribble.nix
- modules/services/mpris-proxy.nix
- modules/services/pasystray.nix
- modules/services/playerctld.nix
- modules/services/pulseeffects.nix
- modules/services/rescrobbled.nix
- modules/services/spotifyd.nix
- tests/modules/services/mpd/**/*
"automation":
- changed-files:
- any-glob-to-any-file:
- modules/services/autotiling.nix
- modules/services/caffeine.nix
- modules/services/darkman.nix
- modules/services/devilspie2.nix
- modules/services/espanso.nix
- modules/services/keynav.nix
- modules/services/skhd.nix
"backup":
- changed-files:
- any-glob-to-any-file:
- modules/programs/borgmatic.nix
- modules/programs/rclone.nix
- modules/services/borgmatic.nix
- modules/services/restic.nix
- tests/modules/programs/borgmatic/**/*
- tests/modules/services/borgmatic/**/*
"bars":
- changed-files:
- any-glob-to-any-file:
- modules/programs/ashell.nix
- modules/programs/eww.nix
- modules/programs/hyprpanel/default.nix
- modules/programs/i3bar-river.nix
- modules/programs/sketchybar.nix
- modules/programs/tray-tui.nix
- modules/programs/waybar.nix
- modules/programs/xmobar.nix
- modules/programs/yambar.nix
- modules/services/polybar.nix
- modules/services/taffybar.nix
- tests/modules/programs/ashell/**/*
- tests/modules/programs/i3bar-river/**/*
- tests/modules/programs/waybar/**/*
- tests/modules/services/polybar/**/*
"browsers":
- changed-files:
- any-glob-to-any-file:
- modules/misc/mozilla-messaging-hosts.nix
- modules/programs/amfora.nix
- modules/programs/chawan.nix
- modules/programs/chromium.nix
- modules/programs/firefox/**/*
- modules/programs/firefoxpwa.nix
- modules/programs/floorp.nix
- modules/programs/librewolf.nix
- modules/programs/nyxt.nix
- modules/programs/qutebrowser.nix
- modules/programs/w3m.nix
- tests/modules/programs/chromium/**/*
- tests/modules/programs/firefox/**/*
- tests/modules/programs/qutebrowser/**/*
"calendar":
- changed-files:
- any-glob-to-any-file:
- modules/*/vdirsyncer*.nix
- modules/accounts/calendar.nix
- modules/programs/khal/**/*
- modules/programs/pimsync/**/*
- modules/programs/qcal.nix
- modules/programs/vdirsyncer/**/*
- modules/services/pimsync.nix
- tests/modules/programs/khal/**/*
"clipboard":
- changed-files:
- any-glob-to-any-file:
- modules/services/clipcat.nix
- modules/services/cliphist.nix
- modules/services/clipman.nix
- modules/services/clipmenu.nix
- modules/services/clipse.nix
- modules/services/copyq.nix
- modules/services/parcellite.nix
- modules/services/pbgopy.nix
- modules/services/wl-clip-persist.nix
- tests/modules/services/clipman/**/*
- tests/modules/services/copyq/**/*
- tests/modules/services/wl-clip-persist/**/*
"cli-tools":
- changed-files:
- any-glob-to-any-file:
- modules/programs/aliae.nix
- modules/programs/amoco.nix
- modules/programs/antidote.nix
- modules/programs/atool.nix
- modules/programs/atuin.nix
- modules/programs/autojump.nix
- modules/programs/bashmount.nix
- modules/programs/bat.nix
- modules/programs/bottom.nix
- modules/programs/boxxy.nix
- modules/programs/broot.nix
- modules/programs/btop.nix
- modules/programs/carapace.nix
- modules/programs/clock-rs.nix
- modules/programs/delta.nix
- modules/programs/diff-highlight.nix
- modules/programs/diff-so-fancy.nix
- modules/programs/difftastic.nix
- modules/programs/dircolors.nix
- modules/programs/direnv.nix
- modules/programs/eza.nix
- modules/programs/fastfetch.nix
- modules/programs/fd.nix
- modules/programs/fzf.nix
- modules/programs/goto.nix
- modules/programs/grep.nix
- modules/programs/hstr.nix
- modules/programs/htop.nix
- modules/programs/hwatch.nix
- modules/programs/hyfetch.nix
- modules/programs/infat.nix
- modules/programs/inori.nix
- modules/programs/jq*.nix
- modules/programs/keychain.nix
- modules/programs/less.nix
- modules/programs/lesspipe.nix
- modules/programs/lsd.nix
- modules/programs/man.nix
- modules/programs/mc.nix
- modules/programs/mcfly.nix
- modules/programs/navi.nix
- modules/programs/nix-your-shell.nix
- modules/programs/nom.nix
- modules/programs/parallel.nix
- modules/programs/patdiff.nix
- modules/programs/pay-respects.nix
- modules/programs/pazi.nix
- modules/programs/pet.nix
- modules/programs/pistol.nix
- modules/programs/pls.nix
- modules/programs/readline.nix
- modules/programs/riff.nix
- modules/programs/ripgrep*.nix
- modules/programs/scmpuff.nix
- modules/programs/screen.nix
- modules/programs/script-directory.nix
- modules/programs/sesh.nix
- modules/programs/sherlock.nix
- modules/programs/skim.nix
- modules/programs/superfile.nix
- modules/programs/tealdeer.nix
- modules/programs/television.nix
- modules/programs/tmate.nix
- modules/programs/tmux.nix
- modules/programs/topgrade.nix
- modules/programs/translate-shell.nix
- modules/programs/ty.nix
- modules/programs/uv.nix
- modules/programs/vivid.nix
- modules/programs/watson.nix
- modules/programs/z-lua.nix
- modules/programs/zellij.nix
- modules/programs/zk.nix
- modules/programs/zoxide.nix
- modules/programs/zplug.nix
- tests/modules/programs/fzf/**/*
- tests/modules/programs/tmux/**/*
"contacts":
- changed-files:
- any-glob-to-any-file:
- modules/accounts/contacts.nix
- modules/programs/abook.nix
- modules/programs/khard.nix
- tests/modules/programs/abook/**/*
- tests/modules/programs/khard/**/*
"containers":
- changed-files:
- any-glob-to-any-file:
- modules/programs/distrobox.nix
- modules/programs/docker-cli.nix
- modules/services/colima.nix
- modules/services/podman/**/*
- modules/services/podman/linux/**/*
"desktop-ui":
- changed-files:
- any-glob-to-any-file:
- modules/programs/desktoppr.nix
- modules/programs/gnome-shell.nix
- modules/programs/hyprshot.nix
- modules/programs/quickshell.nix
- modules/programs/satty.nix
- modules/programs/swappy.nix
- modules/services/avizo.nix
- modules/services/blanket.nix
- modules/services/flameshot.nix
- modules/services/gromit-mpx.nix
- modules/services/linux-wallpaperengine.nix
- modules/services/picom.nix
- modules/services/random-background.nix
- modules/services/volnoti.nix
- modules/services/wob.nix
- modules/services/wpaperd.nix
"desktop-utilities":
- changed-files:
- any-glob-to-any-file:
- modules/programs/autorandr.nix
- modules/programs/bluetuith.nix
- modules/services/autorandr.nix
- modules/services/blueman-applet.nix
- modules/services/gnome-keyring.nix
- modules/services/lxqt-policykit-agent.nix
- modules/services/network-manager-applet.nix
- modules/services/polkit-gnome.nix
- modules/services/redshift-gammastep/**/*
- modules/services/sctd.nix
- modules/services/snixembed.nix
- modules/services/status-notifier-watcher.nix
- modules/services/systembus-notify.nix
- modules/services/tailscale-systray.nix
- modules/services/trayscale.nix
- modules/services/udiskie.nix
- modules/services/unclutter.nix
- modules/services/xembed-sni-proxy.nix
"dev-tools":
- changed-files:
- any-glob-to-any-file:
- modules/programs/amber.nix
- modules/programs/awscli.nix
- modules/programs/bacon.nix
- modules/programs/bun.nix
- modules/programs/cargo.nix
- modules/programs/darcs.nix
- modules/programs/earthly.nix
- modules/programs/eclipse.nix
- modules/programs/gcc.nix
- modules/programs/go.nix
- modules/programs/gradle.nix
- modules/programs/granted.nix
- modules/programs/grype.nix
- modules/programs/java.nix
- modules/programs/jetbrains-remote.nix
- modules/programs/k9s.nix
- modules/programs/kraftkit.nix
- modules/programs/kubecolor.nix
- modules/programs/kubeswitch.nix
- modules/programs/lazydocker.nix
- modules/programs/lazysql.nix
- modules/programs/matplotlib.nix
- modules/programs/mercurial.nix
- modules/programs/mergiraf.nix
- modules/programs/mise.nix
- modules/programs/mr.nix
- modules/programs/mypy.nix
- modules/programs/nh.nix
- modules/programs/nix-index.nix
- modules/programs/nix-init.nix
- modules/programs/nix-search-tv.nix
- modules/programs/npm.nix
- modules/programs/numbat.nix
- modules/programs/nvchecker.nix
- modules/programs/opam.nix
- modules/programs/openstackclient.nix
- modules/programs/pgcli.nix
- modules/programs/piston-cli.nix
- modules/programs/poetry.nix
- modules/programs/pyenv.nix
- modules/programs/pylint.nix
- modules/programs/pywal.nix
- modules/programs/rbenv.nix
- modules/programs/rizin.nix
- modules/programs/ruff.nix
- modules/programs/sagemath.nix
- modules/programs/sbt.nix
- modules/programs/sftpman.nix
- modules/programs/smug.nix
- modules/programs/sqls.nix
- modules/programs/tex-fmt.nix
- modules/programs/texlive.nix
- modules/programs/tirith.nix
- modules/programs/vim-vint.nix
- modules/programs/visidata.nix
- modules/programs/yarn/default.nix
- modules/services/lorri.nix
- tests/modules/programs/go/**/*
- tests/modules/programs/java/**/*
"editors":
- changed-files:
- any-glob-to-any-file:
- modules/programs/amp.nix
- modules/programs/anvil-editor.nix
- modules/programs/cudatext.nix
- modules/programs/emacs.nix
- modules/programs/formiko.nix
- modules/programs/fresh-editor.nix
- modules/programs/helix.nix
- modules/programs/kakoune.nix
- modules/programs/lapce.nix
- modules/programs/micro.nix
- modules/programs/ne.nix
- modules/programs/neovide.nix
- modules/programs/neovim.nix
- modules/programs/retext.nix
- modules/programs/vim.nix
- modules/programs/vscode/**/*
- modules/programs/zed-editor.nix
- modules/services/emacs.nix
- tests/modules/programs/emacs/**/*
- tests/modules/programs/helix/**/*
- tests/modules/programs/neovim/**/*
- tests/modules/programs/vim/**/*
"file-manager":
- changed-files:
- any-glob-to-any-file:
- modules/programs/joshuto.nix
- modules/programs/lf.nix
- modules/programs/nnn.nix
- modules/programs/ranger.nix
- modules/programs/vifm.nix
- modules/programs/xplr.nix
- modules/programs/yazi.nix
- tests/modules/programs/lf/**/*
- tests/modules/programs/nnn/**/*
- tests/modules/programs/ranger/**/*
- tests/modules/programs/yazi/**/*
"gaming":
- changed-files:
- any-glob-to-any-file:
- modules/programs/am2rlauncher.nix
- modules/programs/kodi.nix
- modules/programs/lutris.nix
- modules/programs/mangohud.nix
- modules/programs/prismlauncher.nix
- modules/programs/retroarch.nix
- modules/programs/sm64ex.nix
- modules/programs/ttyper.nix
- modules/programs/vinegar.nix
- modules/services/ludusavi.nix
"git":
- changed-files:
- any-glob-to-any-file:
- modules/programs/gh.nix
- modules/programs/gh-dash.nix
- modules/programs/git*.nix
- modules/programs/jjui.nix
- modules/programs/jujutsu.nix
- modules/programs/lazygit.nix
- modules/programs/lazyworktree.nix
- modules/programs/radicle.nix
- modules/programs/sapling.nix
- modules/services/git-sync.nix
- modules/services/radicle.nix
- tests/modules/programs/gh/**/*
- tests/modules/programs/gh-dash/**/*
- tests/modules/programs/git/**/*
"mail":
- changed-files:
- any-glob-to-any-file:
- modules/*/mbsync*
- modules/programs/aerc/**/*
- modules/programs/afew.nix
- modules/programs/alot/**/*
- modules/programs/astroid/**/*
- modules/programs/getmail*
- modules/programs/getmail/**/*
- modules/programs/himalaya.nix
- modules/programs/lieer.nix
- modules/programs/mbsync/**/*
- modules/programs/meli.nix
- modules/programs/msmtp*
- modules/programs/msmtp/**/*
- modules/programs/mu.nix
- modules/programs/mujmap.nix
- modules/programs/neomutt*
- modules/programs/neomutt/**/*
- modules/programs/notmuch/**/*
- modules/programs/offlineimap/**/*
- modules/programs/thunderbird.nix
- modules/services/getmail.nix
- modules/services/imapnotify/**/*
- modules/services/lieer.nix
- modules/services/muchsync.nix
- modules/services/protonmail-bridge.nix
- tests/modules/programs/aerc/*
- tests/modules/programs/alot/*
- tests/modules/programs/himalaya/*
- tests/modules/programs/mbsync/*
- tests/modules/programs/mujmap/*
- tests/modules/programs/neomutt/*
- tests/modules/programs/thunderbird/*
"messaging":
- changed-files:
- any-glob-to-any-file:
- modules/programs/abaddon.nix
- modules/programs/algia.nix
- modules/programs/discocss.nix
- modules/programs/discord.nix
- modules/programs/element-desktop.nix
- modules/programs/gurk-rs.nix
- modules/programs/halloy.nix
- modules/programs/havoc.nix
- modules/programs/hexchat.nix
- modules/programs/iamb.nix
- modules/programs/irssi.nix
- modules/programs/nheko.nix
- modules/programs/pidgin.nix
- modules/programs/senpai.nix
- modules/programs/tiny.nix
- modules/programs/vesktop.nix
- modules/programs/zapzap.nix
- modules/services/pantalaimon.nix
- tests/modules/programs/gurk-rs/**/*
- tests/modules/programs/irssi/**/*
- tests/modules/programs/nheko/**/*
"monitoring":
- changed-files:
- any-glob-to-any-file:
- modules/services/activitywatch.nix
- modules/services/batsignal.nix
- modules/services/cbatticon.nix
- modules/services/conky.nix
- modules/services/glance.nix
- modules/services/poweralertd.nix
"notification":
- changed-files:
- any-glob-to-any-file:
- modules/programs/noti.nix
- modules/services/dunst.nix
- modules/services/fnott.nix
- modules/services/mako.nix
- modules/services/notify-osd.nix
- modules/services/swaync.nix
- modules/services/twmn.nix
- tests/modules/services/dunst/**/*
- tests/modules/services/mako/**/*
"productivity":
- changed-files:
- any-glob-to-any-file:
- modules/programs/anki/**/*
- modules/programs/aphorme.nix
- modules/programs/calibre.nix
- modules/programs/comodoro.nix
- modules/programs/foliate.nix
- modules/programs/info.nix
- modules/programs/joplin-desktop.nix
- modules/programs/jrnl.nix
- modules/programs/ledger.nix
- modules/programs/newsboat.nix
- modules/programs/obsidian.nix
- modules/programs/onlyoffice.nix
- modules/programs/pandoc.nix
- modules/programs/papis.nix
- modules/programs/pubs.nix
- modules/programs/sioyek.nix
- modules/programs/taskwarrior.nix
- modules/programs/todoman.nix
- modules/programs/zathura.nix
- modules/services/comodoro.nix
- modules/services/rsibreak.nix
- modules/services/safeeyes.nix
- modules/services/taskwarrior-sync.nix
- modules/services/tomat.nix
"password-manager":
- changed-files:
- any-glob-to-any-file:
- modules/programs/browserpass.nix
- modules/programs/keepassxc.nix
- modules/programs/password-store.nix
- modules/programs/rbw.nix
- modules/programs/rofi-pass.nix
- modules/services/pass-secret-service.nix
- modules/services/proton-pass-agent.nix
- tests/modules/programs/keepassxc/**/*
- tests/modules/programs/password-store/**/*
- tests/modules/programs/rofi-pass/**/*
"photo":
- changed-files:
- any-glob-to-any-file:
- modules/programs/ahoviewer.nix
- modules/programs/feh.nix
- modules/programs/gallery-dl.nix
- modules/programs/imv.nix
- modules/programs/pqiv.nix
- modules/programs/swayimg.nix
- modules/programs/wallust.nix
- modules/programs/aerc*.nix
- modules/programs/alot*.nix
- tests/modules/programs/aerc/*
- 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/*
- modules/services/imapnotify.nix
"neovim":
- modules/programs/neovim.nix
- tests/modules/programs/neovim/**/*
"shell":
- changed-files:
- any-glob-to-any-file:
- modules/lib/zsh.nix
- modules/programs/bash.nix
- modules/programs/fish.nix
- modules/programs/intelli-shell.nix
- modules/programs/ion.nix
- modules/programs/nushell.nix
- modules/programs/oh-my-posh.nix
- modules/programs/powerline-go.nix
- modules/programs/sheldon.nix
- modules/programs/starship.nix
- modules/programs/zsh/**/*
- tests/modules/programs/bash/**/*
- tests/modules/programs/fish/**/*
- tests/modules/programs/nushell/**/*
- tests/modules/programs/zsh/**/*
"sync":
- changed-files:
- any-glob-to-any-file:
- modules/programs/acd-cli.nix
- modules/programs/airlift.nix
- modules/programs/alistral.nix
- modules/programs/onedrive.nix
- modules/programs/rtorrent.nix
- modules/services/davmail.nix
- modules/services/dropbox.nix
- modules/services/etesync-dav.nix
- modules/services/kdeconnect.nix
- modules/services/megasync.nix
- modules/services/nextcloud-client.nix
- modules/services/owncloud-client.nix
- modules/services/pizauth.nix
- modules/services/syncthing.nix
- modules/services/unison.nix
- tests/modules/services/dropbox/**/*
- tests/modules/services/syncthing/**/*
"system":
- changed-files:
- any-glob-to-any-file:
- modules/programs/anup.nix
- modules/programs/command-not-found/**/*
- modules/programs/gpg.nix
- modules/programs/home-manager.nix
- modules/programs/mullvad-vpn.nix
- modules/programs/opkssh.nix
- modules/programs/ssh.nix
- modules/services/gpg-agent.nix
- modules/services/home-manager*.nix
- modules/services/kbfs.nix
- modules/services/keybase.nix
- modules/services/macos-remap-keys/**/*
- modules/services/nix-gc.nix
- modules/services/ssh-agent.nix
- modules/services/ssh-tpm-agent.nix
- modules/services/yubikey-agent.nix
- tests/modules/services/home-manager*/**/*
"system-tools":
- changed-files:
- any-glob-to-any-file:
- modules/programs/andcli.nix
- modules/programs/aria2.nix
- modules/programs/aria2p.nix
- modules/programs/trippy.nix
- modules/services/arrpc.nix
- modules/services/cachix-agent.nix
- modules/services/fusuma.nix
- modules/services/grobi.nix
- modules/services/hound.nix
- modules/services/jankyborders.nix
- modules/services/opensnitch-ui.nix
- modules/services/osmscout-server.nix
- modules/services/plan9port.nix
- modules/services/psd.nix
- modules/services/pueue.nix
- modules/services/recoll.nix
- modules/services/signaturepdf.nix
- modules/services/tahoe-lafs.nix
- modules/services/tldr-update.nix
"terminal":
- changed-files:
- any-glob-to-any-file:
- modules/programs/alacritty.nix
- modules/programs/foot.nix
- modules/programs/ghostty.nix
- modules/programs/gnome-terminal.nix
- modules/programs/kitty.nix
- modules/programs/macchina/**/*
- modules/programs/ptyxis.nix
- modules/programs/rio.nix
- modules/programs/terminator.nix
- modules/programs/termite.nix
- modules/programs/urxvt.nix
- modules/programs/waveterm.nix
- modules/programs/wezterm.nix
- modules/services/shpool.nix
- tests/modules/programs/alacritty/**/*
- tests/modules/programs/foot/**/*
- tests/modules/programs/ghostty/**/*
- tests/modules/programs/kitty/**/*
"video":
- changed-files:
- any-glob-to-any-file:
- modules/programs/animdl.nix
- modules/programs/anime-downloader.nix
- modules/programs/aperture.nix
- modules/programs/asciinema.nix
- modules/programs/freetube.nix
- modules/programs/mpv.nix
- modules/programs/mpvpaper.nix
- modules/programs/obs-studio.nix
- modules/programs/streamlink.nix
- modules/programs/twitch-tui.nix
- modules/programs/yt-dlp.nix
- modules/services/jellyfin-mpv-shim.nix
- modules/services/plex-mpv-shim.nix
- tests/modules/programs/mpv/**/*
"remote-desktop":
- changed-files:
- any-glob-to-any-file:
- modules/programs/looking-glass-client.nix
- modules/services/remmina.nix
- modules/services/wayvnc.nix
"wayland":
- changed-files:
- any-glob-to-any-file:
- modules/programs/ashell.nix
- modules/programs/anyrun.nix
- modules/services/awww.nix
- modules/programs/bemenu.nix
- modules/programs/fuzzel.nix
- modules/programs/hyprlock.nix
- modules/programs/kickoff.nix
- modules/programs/onagre.nix
- modules/programs/sway-easyfocus.nix
- modules/programs/swaylock.nix
- modules/programs/swayr.nix
- modules/programs/tofi.nix
- modules/programs/waybar.nix
- modules/programs/waylogout.nix
- modules/programs/wayprompt.nix
- modules/programs/wleave.nix
- modules/programs/wlogout.nix
- modules/programs/wofi.nix
- modules/programs/workstyle.nix
- modules/programs/yofi.nix
- modules/programs/vicinae/**/*
- modules/programs/i3bar-river.nix
- modules/services/fnott.nix
- modules/services/hypridle.nix
- modules/services/hyprlauncher.nix
- modules/services/hyprpaper.nix
- modules/services/hyprpolkitagent.nix
- modules/services/hyprshell.nix
- modules/services/hyprsunset.nix
- modules/services/kanshi.nix
- modules/services/mako.nix
- modules/services/shikane.nix
- modules/services/swayidle.nix
- modules/services/swaync.nix
- modules/services/swayosd.nix
- modules/services/walker.nix
- modules/services/way-displays.nix
- modules/services/wlsunset.nix
- modules/services/wluma.nix
- modules/services/wpaperd.nix
- tests/modules/programs/ashell/**/*
- tests/modules/programs/i3bar-river/**/*
- tests/modules/programs/swaylock/**/*
- tests/modules/programs/vicinae/**/*
- tests/modules/programs/waybar/**/*
"window-managers":
- changed-files:
- any-glob-to-any-file:
- modules/programs/aerospace.nix
- modules/programs/i3bar-river.nix
- modules/programs/i3blocks.nix
- modules/programs/i3status-rust.nix
- modules/programs/i3status.nix
- modules/services/window-managers/**/*
"x11":
- changed-files:
- any-glob-to-any-file:
- modules/programs/i3blocks.nix
- modules/programs/i3status-rust.nix
- modules/programs/i3status.nix
- modules/programs/rofi.nix
- modules/programs/tint2.nix
- modules/programs/xmobar.nix
- modules/programs/yambar.nix
- modules/services/betterlockscreen.nix
- modules/services/dunst.nix
- modules/services/dwm-status.nix
- modules/services/picom.nix
- modules/services/polybar.nix
- modules/services/screen-locker.nix
- modules/services/stalonetray.nix
- modules/services/sxhkd.nix
- modules/services/taffybar.nix
- modules/services/trayer.nix
- modules/services/xcape.nix
- modules/services/xembed-sni-proxy.nix
- modules/services/xidlehook.nix
- modules/services/xscreensaver.nix
- modules/services/xsettingsd.nix
- modules/services/xsuspender.nix
- tests/modules/programs/i3blocks/**/*
- tests/modules/programs/i3status-rust/**/*
- tests/modules/programs/i3status/**/*
- tests/modules/programs/rofi/**/*
- tests/modules/services/picom/**/*
- tests/modules/services/polybar/**/*
- modules/lib/zsh.nix
- modules/programs/zsh*
- modules/programs/bash*
- tests/modules/programs/zsh/**/*
"calendar":
- modules/programs/khal*
- modules/*/vdirsyncer*
- modules/accounts/calendar.nix
"contacts":
- modules/accounts/contacts.nix
+71
View File
@@ -0,0 +1,71 @@
# Configuration for probot-stale - https://github.com/probot/stale
daysUntilStale: 90
daysUntilClose: false
staleLabel: "status: stale"
issues:
markComment: |
<p>
Thank you for your contribution!
I marked this issue as stale due to inactivity.
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.
<b>Please read the relevant sections below before commenting.</b>
</p>
<details>
<summary><b>If you are the original author of the issue</b></summary>
<p>
* If this is resolved, please consider closing it so that the maintainers know not to focus on this.
* If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
* If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
</p>
</details>
<details>
<summary><b>If you are <i>not</i> the original author of the issue</b></summary>
<p>
* If you are also experiencing this issue, please add details of your situation to help with the debugging process.
* If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
</p>
</details>
<details>
<summary><b>Memorandum on closing issues</b></summary>
<p>
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.
</p>
</details>
pulls:
markComment: |
<p>
Thank you for your contribution!
I marked this pull request as stale due to inactivity.
<b>Please read the relevant sections below before commenting.</b>
</p>
<details>
<summary><b>If you are the original author of the PR</b></summary>
<p>
* 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.
</p>
</details>
<details>
<summary><b>If you are <i>not</i> the original author of the PR</b></summary>
<p>
* 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.
</p>
</details>
-45
View File
@@ -1,45 +0,0 @@
# Based on
# https://github.com/NixOS/nixpkgs/blob/2566f9dc/.github/workflows/backport.yml
name: Backport
on:
pull_request_target:
types:
- closed
- labeled
permissions:
contents: write
pull-requests: write
jobs:
backport:
name: Backport Pull Request
if: >
vars.CI_APP_ID
&& github.event.pull_request.merged == true
&& (
github.event.action != 'labeled'
|| startsWith(github.event.label.name, 'backport')
)
runs-on: ubuntu-latest
steps:
- name: Create GitHub App token
uses: actions/create-github-app-token@v3
if: vars.CI_APP_ID
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
- uses: actions/checkout@v7
with:
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.base.sha }}
- name: Create backport PRs
id: backport
uses: korthout/backport-action@v4
with:
# See https://github.com/korthout/backport-action#inputs
github_token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
branch_name: backport/${target_branch}/${pull_number}
copy_labels_pattern: .*
-15
View File
@@ -1,15 +0,0 @@
on:
push:
branches:
- master
jobs:
triage:
runs-on: ubuntu-latest
if: github.repository_owner == 'nix-community'
steps:
- uses: mschilde/auto-label-merge-conflicts@master
with:
CONFLICT_LABEL_NAME: "merge conflict"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAX_RETRIES: 5
WAIT_MS: 10000
+16 -18
View File
@@ -3,28 +3,26 @@ on:
push:
branches:
- master
workflow_dispatch:
jobs:
publish:
if: github.event_name != 'schedule' || github.repository_owner == 'nix-community'
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- uses: cachix/cachix-action@v17
with:
name: nix-community
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: |
nix-build -A docs.html
cp -r result/share/doc/home-manager public
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v13
with:
name: nix-community
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: |
nix-build -A docs.html
cp -r result/share/doc/home-manager public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
+2 -13
View File
@@ -11,25 +11,14 @@ on:
permissions:
contents: read
pull-requests: write
issues: write
jobs:
labels:
runs-on: ubuntu-latest
if: github.repository_owner == 'nix-community'
steps:
- name: Get changed files count
id: count
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
COUNT=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER/files" --paginate --jq '.[].filename' | grep -c '^modules/' || true)
echo "Found $COUNT changed module files."
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
- uses: actions/labeler@v6
if: steps.count.outputs.count <= 10
- uses: actions/labeler@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
-81
View File
@@ -1,81 +0,0 @@
name: Tag Module Maintainers
on:
pull_request_target:
types: [opened, ready_for_review, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
tag-maintainers:
runs-on: ubuntu-latest
if: |
github.event.pull_request.draft == false &&
github.event.pull_request.state == 'open'
steps:
- name: Create GitHub App token
uses: actions/create-github-app-token@v3
if: vars.CI_APP_ID
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Get Nixpkgs revision from flake.lock
id: get-nixpkgs
run: |
echo "rev=$(jq -r '.nodes.nixpkgs.locked.rev' flake.lock)" >> "$GITHUB_OUTPUT"
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ steps.get-nixpkgs.outputs.rev }}.tar.gz
extra_nix_config: |
experimental-features = nix-command flakes
- name: Get changed files
id: changed-files
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
CHANGED_FILES=$(gh pr diff "$PR_NUMBER" --name-only | grep '^modules/' | grep -v '^modules/\(po\|.*\/news\)/' || true)
echo "Changed files:"
echo "$CHANGED_FILES"
echo "changed_files<<EOF" >> "$GITHUB_OUTPUT"
echo "$CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Extract Maintainers
id: extract-maintainers
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
echo "Extracting maintainers from changed files..."
MAINTAINERS=$(lib/python/extract-maintainers.py \
--changed-files "$CHANGED_FILES" \
--pr-author "$PR_AUTHOR")
echo "maintainers=$MAINTAINERS" >> "$GITHUB_OUTPUT"
echo "Found maintainers: $MAINTAINERS"
- name: Manage Reviewers
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
MAINTAINERS: ${{ steps.extract-maintainers.outputs.maintainers }}
CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }}
BOT_NAME: ${{ steps.app-token.outputs.app-slug || 'github-actions' }}
run: |
./lib/python/manage-reviewers.py \
--owner "$OWNER" \
--repo "$REPO" \
--pr-number "$PR_NUMBER" \
--pr-author "$PR_AUTHOR" \
--current-maintainers "$MAINTAINERS" \
--changed-files "$CHANGED_FILES" \
--bot-user-name "$BOT_NAME"
+17 -115
View File
@@ -3,126 +3,28 @@ on:
pull_request:
schedule:
- cron: "30 2 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
docs: ${{ steps.changes.outputs.docs }}
format: ${{ steps.changes.outputs.format }}
hm: ${{ steps.changes.outputs.hm }}
parse: ${{ steps.changes.outputs.parse }}
tests: ${{ steps.changes.outputs.tests }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
tests:
- 'flake.lock'
- 'flake.nix'
- 'modules/**'
- 'nix-darwin/**'
- 'nixos/**'
- 'tests/**'
docs:
- '**.md'
- 'docs/**'
- 'flake.lock'
- 'flake.nix'
- 'modules/**'
format:
- '**/*.nix'
hm:
- 'flake.lock'
- 'flake.nix'
- 'home-manager/**'
parse:
- '**/*.nix'
- 'flake.lock'
tests:
needs: changes
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Get Nixpkgs revision from flake.lock
id: get-nixpkgs
run: |
echo "rev=$(jq -r '.nodes.nixpkgs.locked.rev' flake.lock)" >> "$GITHUB_OUTPUT"
- uses: cachix/install-nix-action@v31
if: github.event_name == 'schedule' || needs.changes.outputs.docs == 'true' || needs.changes.outputs.tests == 'true' || needs.changes.outputs.hm == 'true' || needs.changes.outputs.parse == 'true' || needs.changes.outputs.format == 'true'
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ steps.get-nixpkgs.outputs.rev }}.tar.gz
extra_nix_config: |
sandbox = true
- name: Build docs
if: github.event_name == 'schedule' || needs.changes.outputs.docs == 'true'
run: nix build --show-trace .#docs-jsonModuleMaintainers
- name: Parse Nix files with nix and Lix
if: >-
matrix.os == 'ubuntu-latest' &&
(github.event_name == 'schedule' || needs.changes.outputs.parse == 'true')
run: nix build --show-trace --keep-going .#ci-parse .#ci-parse-lix
- name: Format Check
if: >-
matrix.os == 'ubuntu-latest' &&
(github.event_name == 'schedule' || needs.changes.outputs.format == 'true')
run: nix fmt -- --ci
- name: Test init --switch with locked inputs
if: github.event_name == 'schedule' || needs.changes.outputs.hm == 'true'
run: |
# Copy lock file to home directory for consistent testing
mkdir -p ~/.config/home-manager
cp flake.lock ~/.config/home-manager/
nix run .#home-manager -- init --switch --override-input home-manager .
- name: Uninstall
if: github.event_name == 'schedule' || needs.changes.outputs.hm == 'true'
run: yes | nix run . -- uninstall
- name: Generate Job Summary
if: github.event_name == 'pull_request'
shell: bash
run: |
echo "### Test Job Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "A summary of tasks triggered by file changes in this PR:" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
if [[ "${{ needs.changes.outputs.docs }}" == "true" ]]; then
echo "- ✅ **Docs Build:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Docs Build:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.format }}" == "true" ]]; then
echo "- ✅ **Format Check:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Format Check:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.parse }}" == "true" ]]; then
echo "- ✅ **Nix Parse (nix + Lix):** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Nix Parse (nix + Lix):** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.hm }}" == "true" ]]; then
echo "- ✅ **Home Manager Tests:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **Home Manager Tests:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "${{ needs.changes.outputs.tests }}" == "true" ]]; then
echo "- ✅ **General Tests:** Triggered" >> "$GITHUB_STEP_SUMMARY"
else
echo "- ☑️ **General Tests:** Skipped (no relevant files changed)" >> "$GITHUB_STEP_SUMMARY"
fi
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v13
with:
name: nix-community
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 --show-trace -A docs.jsonModuleMaintainers
- run: ./format -c
- run: nix-shell --show-trace . -A install
- run: nix-shell --show-trace --arg enableBig false --pure tests -A run.all
+20
View File
@@ -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@v4
- name: Install Nix
uses: cachix/install-nix-action@v23
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v20
with:
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
pr-labels: dependencies
-286
View File
@@ -1,286 +0,0 @@
name: Update maintainers list
on:
push:
branches:
- main
paths:
- lib/maintainers.nix
schedule:
# Update every Monday at 9 AM UTC
- cron: "0 9 * * 1"
workflow_dispatch:
inputs:
create_pr:
description: "Create PR even if no changes"
required: false
default: false
type: boolean
jobs:
update-maintainers:
runs-on: ubuntu-latest
if: github.repository_owner == 'nix-community' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
pull-requests: write
issues: write
env:
pr_branch: update/maintainers-${{ github.ref_name }}
steps:
- name: Create GitHub App token
uses: actions/create-github-app-token@v3
if: vars.CI_APP_ID
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
- name: Get GitHub App user info
id: user-info
if: vars.CI_APP_ID
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
slug: ${{ steps.app-token.outputs.app-slug }}
run: |
name="$slug[bot]"
id=$(gh api "/users/$name" --jq .id)
{
echo "id=$id"
echo "name=$name"
echo "email=$id+$name@users.noreply.github.com"
} >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v7
with:
token: ${{ steps.app-token.outputs.token || github.token }}
- name: Get Nixpkgs revision from flake.lock
id: get-nixpkgs
run: |
echo "rev=$(jq -r '.nodes.nixpkgs.locked.rev' flake.lock)" >> "$GITHUB_OUTPUT"
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ steps.get-nixpkgs.outputs.rev }}.tar.gz
- name: Setup Git
env:
name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }}
email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }}
run: |
git config user.name "$name"
git config user.email "$email"
- name: Save old maintainers
id: old-maintainers
run: |
echo "📄 Saving old maintainers file for comparison..."
echo "old_maintainers=$(nix eval --file all-maintainers.nix --apply 'builtins.attrNames' --json 2>/dev/null || echo '[]')" >> "$GITHUB_OUTPUT"
- name: Generate updated maintainers list
run: |
echo "::group::📋 Generating updated generated/all-maintainers.nix..."
./lib/python/generate-all-maintainers.py
echo "::endgroup::"
echo "::group::🎨 Formatting with nixfmt..."
nix fmt all-maintainers.nix
echo "::endgroup::"
- name: Check for changes and compare maintainers
id: check-changes
env:
old_maintainers: ${{ steps.old-maintainers.outputs.old_maintainers }}
run: |
if git diff --quiet all-maintainers.nix; then
echo "No changes to all-maintainers.nix"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
echo "maintainer_changes=No changes detected" >> "$GITHUB_OUTPUT"
else
echo "Changes detected in all-maintainers.nix"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
# Get change statistics
added=$(git diff --numstat all-maintainers.nix | cut -f1)
removed=$(git diff --numstat all-maintainers.nix | cut -f2)
echo "changes_summary=+$added -$removed lines" >> "$GITHUB_OUTPUT"
# Compare old and new maintainers using nix eval
echo "🔍 Comparing maintainers..."
# Extract maintainer names from new file
new_maintainers=$(nix eval --file all-maintainers.nix --apply 'builtins.attrNames' --json)
# Compare using nix eval
comparison=$(nix eval --expr "
let
old = builtins.fromJSON ''$old_maintainers'';
new = builtins.fromJSON ''$new_maintainers'';
oldSet = builtins.listToAttrs (map (name: { name = name; value = true; }) old);
newSet = builtins.listToAttrs (map (name: { name = name; value = true; }) new);
added = builtins.filter (name: !(oldSet ? \${name})) new;
removed = builtins.filter (name: !(newSet ? \${name})) old;
in {
added = added;
removed = removed;
total_old = builtins.length old;
total_new = builtins.length new;
}
" --json)
# Format comparison output
added_count=$(echo "$comparison" | jq '.added | length')
removed_count=$(echo "$comparison" | jq '.removed | length')
total_old=$(echo "$comparison" | jq '.total_old')
total_new=$(echo "$comparison" | jq '.total_new')
maintainer_summary="**Added:** $added_count maintainers"
maintainer_summary="$maintainer_summary\n**Removed:** $removed_count maintainers"
maintainer_summary="$maintainer_summary\n**Total:** $total_old → $total_new maintainers"
if [ "$added_count" -gt 0 ]; then
added_names=$(echo "$comparison" | jq -r '.added | join(", ")')
maintainer_summary="$maintainer_summary\n\n**✅ Added:** $added_names"
fi
if [ "$removed_count" -gt 0 ]; then
removed_names=$(echo "$comparison" | jq -r '.removed | join(", ")')
maintainer_summary="$maintainer_summary\n\n**❌ Removed:** $removed_names"
fi
echo "maintainer_changes<<EOF" >> "$GITHUB_OUTPUT"
echo -e "$maintainer_summary" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Validate generated file
if: steps.check-changes.outputs.has_changes == 'true'
run: |
echo "🔍 Validating generated all-maintainers.nix..."
if nix-instantiate --eval ./all-maintainers.nix --strict > /dev/null; then
echo "✅ Generated file has valid Nix syntax"
else
echo "❌ Generated file has invalid Nix syntax"
exit 1
fi
- name: Create update branch
run: |
git branch -D "$pr_branch" || echo "Nothing to delete"
git switch -c "$pr_branch"
- name: Get info on the current PR
id: open_pr_info
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
run: |
# Query for info about the already open update PR
info=$(
gh api graphql -F owner='{owner}' -F repo='{repo}' -F branch="$pr_branch" -f query='
query($owner:String!, $repo:String!, $branch:String!) {
repository(owner: $owner, name: $repo) {
pullRequests(first: 1, states: OPEN, headRefName: $branch) {
nodes {
number
url
}
}
}
}
' | jq --raw-output '
.data.repository.pullRequests.nodes[]
| to_entries[]
| "\(.key)=\(.value)"
'
)
if [[ -n "$info" ]]; then
echo "PR info:"
echo "$info"
echo "$info" >> "$GITHUB_OUTPUT"
else
echo "No PR is currently open"
fi
- name: Fetch current PR's branch
if: steps.open_pr_info.outputs.number
run: |
git fetch origin "$pr_branch"
git branch --set-upstream-to "origin/$pr_branch"
- name: Create Pull Request
id: create-pr
if: steps.check-changes.outputs.has_changes == 'true' || github.event.inputs.create_pr == 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
title: "maintainers: update all-maintainers.nix"
commit_body: |
Automated update of the master maintainers list combining:
- Home Manager specific maintainers from modules/lib/maintainers.nix
- Nixpkgs maintainers referenced in Home Manager modules
${{ steps.check-changes.outputs.maintainer_changes }}
Generated by: lib/python/generate-all-maintainers.py
pr_url: ${{ steps.open_pr_info.outputs.url }}
pr_num: ${{ steps.open_pr_info.outputs.number }}
pr_body: |
## 📋 Summary
This PR updates the master maintainers list (`all-maintainers.nix`) which combines:
- **Home Manager specific maintainers** from `modules/lib/maintainers.nix`
- **Nixpkgs maintainers** referenced in Home Manager modules
## 🔄 Changes
**Statistics:** ${{ steps.check-changes.outputs.changes_summary || 'No content changes (format/comment updates only)' }}
${{ steps.check-changes.outputs.maintainer_changes }}
The updated list includes all maintainers needed for review assignments across the Home Manager project.
## 🤖 Automation
- **Generated by:** `lib/python/generate-all-maintainers.py`
- **Trigger:** ${{ github.event_name == 'schedule' && 'Scheduled weekly update' || 'Manual workflow dispatch' }}
- **Validation:** File syntax verified with `nix eval`
---
🤖 *This PR was automatically created by the [update-maintainers workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})*
run: |
# Commit the changes
git add all-maintainers.nix
git commit -m "$title" -m "$commit_body"
echo "Pushing to remote branch $pr_branch"
git push --force --set-upstream origin "$pr_branch"
if [ -z "$pr_num" ]; then
echo "Creating new pull request."
PR_URL=$(
gh pr create \
--title "$title" \
--body "$pr_body"
)
else
PR_URL=$pr_url
echo "Pull request already exists: $PR_URL"
gh pr edit "$pr_num" --body "$pr_body"
fi
echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"
- name: Summary
env:
has_changes: ${{ steps.check-changes.outputs.has_changes }}
changes: ${{ steps.check-changes.outputs.changes_summary }}
pr_url: ${{ steps.create-pr.outputs.pr_url}}
pr_num: ${{ steps.open_pr_info.outputs.number }}
run: |
if [[ "$has_changes" == "true" ]]; then
if [[ -n "$pr_num" ]]; then
echo "✅ Successfully updated PR with new changes."
echo "$changes"
echo "🔗 PR URL: $pr_url"
echo "### ✅ PR Updated" >> "$GITHUB_STEP_SUMMARY"
echo "[$pr_url]($pr_url)" >> "$GITHUB_STEP_SUMMARY"
elif [[ -n "$pr_url" ]]; then
echo "✅ Successfully created PR with maintainer updates."
echo "$changes"
echo "🔗 PR URL: $pr_url"
echo "### ✅ PR Created" >> "$GITHUB_STEP_SUMMARY"
echo "[$pr_url]($pr_url)" >> "$GITHUB_STEP_SUMMARY"
else
echo "❌ Failed to create or update pull request."
echo "### ❌ PR Operation Failed" >> "$GITHUB_STEP_SUMMARY"
echo "A pull request was intended but the URL was not captured. Please check the logs." >> "$GITHUB_STEP_SUMMARY"
fi
else
echo "️ No changes detected - maintainers list is up to date."
echo "### ️ No Changes" >> "$GITHUB_STEP_SUMMARY"
echo "The maintainers list is up-to-date. No PR was created." >> "$GITHUB_STEP_SUMMARY"
fi
@@ -1,52 +0,0 @@
name: Validate maintainers.nix
on:
pull_request:
paths:
- "modules/lib/maintainers.nix"
- "flake.lock"
- "all-maintainers.nix"
workflow_dispatch:
inputs:
run_tests:
description: 'Run validation tests'
required: false
default: true
type: boolean
jobs:
validate-maintainers:
runs-on: ubuntu-latest
if: github.repository_owner == 'nix-community'
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Get Nixpkgs revision from flake.lock
id: get-nixpkgs
run: |
echo "rev=$(jq -r '.nodes.nixpkgs.locked.rev' flake.lock)" >> "$GITHUB_OUTPUT"
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ steps.get-nixpkgs.outputs.rev }}.tar.gz
- name: Validate Nix syntax
run: ./lib/python/validate-maintainers-syntax.py
- name: Validate maintainer entries
run: ./lib/python/validate-maintainer-entries.py
- name: Check for duplicate maintainers
run: ./lib/python/check-duplicate-maintainers.py
- name: Test generation
if: inputs.run_tests == true
run: |
echo "🔍 Testing all-maintainers.nix generation..."
./lib/python/generate-all-maintainers.py
echo "🔍 Validating generated file..."
if nix eval --file ./all-maintainers.nix --json > /dev/null; then
echo "✅ Generated file has valid Nix syntax"
else
echo "❌ Generated file has invalid Nix syntax"
exit 1
fi
- name: Summary
run: |
echo "✅ All validation checks passed!"
echo "📋 The maintainers.nix file is ready for merge"
-2
View File
@@ -1,3 +1 @@
/result*
/tests/flake.lock
.DS_Store
+12
View File
@@ -18,3 +18,15 @@ pages:
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: always
Deploy NUR:
stage: deploy
variables:
HM_BRANCH: $CI_COMMIT_REF_NAME
HM_COMMIT_SHA: $CI_COMMIT_SHA
trigger:
project: rycee/nur-expressions
branch: master
rules:
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH =~ /^release-/
when: always
-1
View File
@@ -1 +0,0 @@
Noah Biewesch <dev@noahbiewesch.com> <90870942+trueNAHO@users.noreply.github.com>
-8
View File
@@ -1,8 +0,0 @@
# Contributing
Home Manager contribution guidelines live in the manual:
- [`docs/manual/contributing.md`](docs/manual/contributing.md)
- <https://nix-community.github.io/home-manager/#ch-contributing>
Read those docs before changing modules, tests, news entries, or release notes.
-28
View File
@@ -1,28 +0,0 @@
# Common commands
#
# Contributing manual:
# - https://nix-community.github.io/home-manager/#ch-contributing
# List tests matching a pattern `pattern`
list *pattern:
nix run .#tests -- -l {{pattern}}
# Run all tests matching a pattern `pattern`
test *pattern:
nix run .#tests -- {{pattern}}
# List integration tests
list_integration_tests:
nix run .#tests -- -t -l
# Run integration tests
integration_tests:
nix run .#tests -- -t integration-test-
# Create a news entry
create-news-entry:
modules/misc/news/create-news-entry.sh
# format codebase with treefmt
format:
treefmt
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2026 Home Manager contributors
Copyright (c) 2017-2023 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
-255
View File
@@ -1,255 +0,0 @@
# Maintaining Home Manager
This file is intended as a reference for Home Manager's core maintainers,
although it may be interesting for anyone curious how we do certain things.
## Releasing
Home Manager releases stable versions in sync with NixOS/nixpkgs. A _`YY.05`_
version is released in May and a _`YY.11`_ version is released in November.
We do not need to wait for the release to come out of _"beta"_ before creating a
branch, however we _should_ wait before updating links and references on the
`master` branch.
Creating a stable branch may require temporarily disabling branch protection.
This can only be done by an "admin" or "owner".
Once a stable branch is created, its flake inputs should be updated to point to
the corresponding stable versions. The branch can be created before these exist,
in which case they should be updated when the corresponding stable inputs become
available.
Once a stable version is considered "out of beta", references to Home Manager's
stable branch should be updated on the `master` branch to reference the new
version.
### Release Workflow
The release process involves four phases in a specific order:
1. **On master - Mark current as stable**: Update all documentation and examples
to reflect the current release (e.g., 25.11) as stable, removing "(unstable)"
tags
2. **Cut the release branch**: Create the new release branch from master (e.g.,
`release-25.11`)
3. **On release branch - Mark as release branch**: Set `isReleaseBranch: true`
in `release.json`
4. **On master - Prepare for next**: Bump version to next release (e.g., 26.05)
and add "(unstable)" tag back
**Important**: The `isReleaseBranch` field in `release.json` is managed
differently on each branch:
- On **master**: Always remains `false`
- On **release branches**: Set to `true` in a separate commit after cutting the
branch from master
This workflow ensures that the release branch captures a stable snapshot of
master, which then moves forward to the next development cycle.
### Release Preparation Checklist
#### Step 1: On master - Mark Current as Stable
**When**: When ready to cut a new release branch (e.g., when preparing to
release 25.11)
Reference commits:
- `e08e6e2389234000b0447e57abf61d8ccd59a68e` (home-manager: set 25.05 as stable)
1. **README.md**
- Update example release branch references (e.g., `release-24.11`
`release-25.05`)
- Update current stable version references (e.g., `24.11``25.05`)
2. **docs/manual/installation/nix-darwin.md**
- Update channel version in example commands
- Update `home.stateVersion` in examples
3. **docs/manual/installation/nixos.md**
- Update channel version in example commands
- Update tarball URLs
- Update `home.stateVersion` in examples
4. **docs/manual/installation/standalone.md**
- Update channel version in example commands
5. **docs/manual/manual.md**
- Remove `(unstable)` suffix from version
6. **docs/manual/nix-flakes/standalone.md**
- Update flake references (e.g., `home-manager/release-24.11`
`home-manager/release-25.05`)
- Update `$branch` examples
7. **docs/manual/usage/configuration.md**
- Update `home.stateVersion` in example configurations
8. **docs/release-notes/rl-YYMM.md**
- Replace "This is the current unstable branch and the information in this
section is therefore not final."
- With: "The YY.MM release branch became stable in <Month>, YYYY."
9. **home-manager/home-manager** script
- Update default `home.stateVersion` in generated configurations
- Update `home.stateVersion` in uninstall function
10. **modules/misc/uninstall.nix**
- Update `home.stateVersion` in uninstall config
**Note**: Do NOT change `isReleaseBranch` in `release.json` - keep it as `false`
#### Step 2: Cut the release branch
**When**: After Step 1 is merged to master
1. Create the new release branch from master
- Example: `git checkout -b release-25.11 master`
2. Push the branch to the repository
#### Step 3: On the release branch - Mark as Release Branch
**When**: Immediately after creating the release branch
Reference commits:
- `70a787cc5` (release: set release branch)
1. **release.json**
- Change `isReleaseBranch` from `false` to `true`
- Do NOT change the `release` field (it's already correct from Step 1)
2. **flake.nix**
- Update the nixpkgs input to track the corresponding stable branch
- Example: For `release-25.11`, change from:
```nix
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
```
to:
```nix
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
```
- Run `nix flake update` to update flake.lock to the stable branch
- Commit the flake.nix and flake.lock changes
**Note**: The release branch should track the stable NixOS release channel
(e.g., `nixos-25.11`), while master continues to track `nixpkgs-unstable`.
#### Step 3.5: On master - Update CI for the New Release Branch
**When**: After marking the release branch as a release branch (Step 3)
**Where**: On the **master** branch (CI workflows run from master)
**What**: Update GitHub Actions workflows to include the new stable branch
1. **.github/workflows/update-flake.yml** (on master)
- Replace the old stable branch with the new release branch in the matrix
- Example: When creating `release-25.11`, update the matrix from:
```yaml
strategy:
matrix:
branch: [master, release-25.05]
```
to:
```yaml
strategy:
matrix:
branch: [master, release-25.11]
```
- This ensures automated flake.lock updates run on the current stable branch
- Note: We only maintain CI for the latest stable release, not older releases
2. **.github/dependabot.yml** (on master)
- Replace the old stable branch with the new release branch
- Example: When creating `release-25.11`, update the target-branch from:
```yaml
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "release-25.05"
schedule:
interval: "weekly"
commit-message:
prefix: "ci:"
```
to:
```yaml
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "release-25.11"
schedule:
interval: "weekly"
commit-message:
prefix: "ci:"
```
- This ensures automated dependency updates for GitHub Actions on the current
stable branch
- Note: We only maintain dependabot for the latest stable release, not older
releases
**Important**: CI workflows are executed from master, so this change must be
committed to the master branch.
#### Step 4: On master - Prepare for Next Release
**When**: After cutting the release branch, prepare master for the next
development cycle
Reference commits:
- `9a4a9f1d6e43fe4044f6715ae7cc85ccb1d2fe09` (home-manager: prepare 25.11)
1. **docs/release-notes/rl-YYMM.md** (CREATE NEW)
- Create new release notes file for next version with unstable warning
- Example: Create `rl-2605.md` when preparing for 26.05
2. **docs/manual/manual.md**
- Update version to next release with `(unstable)` tag
- Example: `25.11` → `26.05 (unstable)`
3. **docs/release-notes/release-notes.md**
- Add new release notes file `rl-YYMM.md` at the top of the chapters list
4. **home-manager/home-manager** script
- Update `--version` output to next version
- Example: `echo 25.11-pre` → `echo 26.05-pre`
5. **modules/misc/version.nix**
- Add new version string to `stateVersion` enum list
- Example: Add `"26.05"` after `"25.11"`
6. **release.json**
- Update `release` field to next version (e.g., `"25.11"` → `"26.05"`)
- **IMPORTANT**: Keep `isReleaseBranch` as `false` on master
### Version State Changes
Each release may introduce state version changes that affect the default
behavior of Home Manager for users who set `home.stateVersion` to that version.
State version changes should be documented in the release notes under a "State
Version Changes" section, explaining what behavior changes for users who set
their state version to the new release.
### Backporting
Stable branches get bug fixes and security updates, but usually not new modules
or features. When backporting:
1. Use `git cherry-pick -x <commit>` to preserve the original commit reference
2. Test that the backport builds successfully
3. Consider whether the change might affect existing stable users
4. Update the PR/commit message to indicate it's a backport
If a user needs a module backported, they should open an issue explaining the
use case.
+1 -2
View File
@@ -17,5 +17,4 @@ test-install:
HOME=$(shell mktemp -d) NIX_PATH=${NIX_PATH} nix-shell . -A install
format:
# added 2026-03-01
@echo "run \"nix-shell -A dev --run 'just format'\" instead"
./format
+14 -10
View File
@@ -17,7 +17,7 @@ For a systematic overview of Home Manager and its available options, please see:
- [Home Manager manual][manual]
- [Home Manager configuration options][configuration options]
- [3rd party Home Manager option
search](https://home-manager-options.extranix.com/)
search](https://mipmip.github.io/home-manager-option-search/)
If you would like to contribute to Home Manager, then please have a look at
["Contributing" in the manual][contributing].
@@ -25,11 +25,10 @@ If you would like to contribute to Home Manager, then please have a look at
Releases
--------
Home Manager is developed against the `nixpkgs-unstable` branch, which often
causes it to contain tweaks for changes/packages not yet released in stable
[NixOS][].
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-26.05`). These branches get
corresponding to NixOS releases (e.g. `release-23.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.
@@ -46,14 +45,19 @@ and gradually make it more elaborate as you learn.
In some cases Home Manager cannot detect whether it will overwrite a previous
manual configuration. For example, the Gnome Terminal module will write to your
dconf store and cannot tell whether a configuration that is about to be
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 `nixpkgs-unstable` and NixOS version 26.05 (the current
Home Manager targets [NixOS][] unstable and NixOS version 23.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][] 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.
@@ -108,7 +112,7 @@ License
This project is licensed under the terms of the [MIT license](LICENSE).
[#home-manager]: https://webchat.oftc.net/?channels=home-manager
[Nix Flakes]: https://wiki.nixos.org/wiki/Flakes
[Nix Flakes]: https://nixos.wiki/wiki/Flakes
[NixOS]: https://nixos.org/
[Nix]: https://nixos.org/explore.html
[Nixpkgs]: https://github.com/NixOS/nixpkgs
@@ -120,5 +124,5 @@ This project is licensed under the terms of the [MIT license](LICENSE).
[manual nixos install]: https://nix-community.github.io/home-manager/#sec-install-nixos-module
[manual standalone install]: https://nix-community.github.io/home-manager/#sec-install-standalone
[manual]: https://nix-community.github.io/home-manager/
[nix-darwin]: https://github.com/nix-darwin/nix-darwin
[rollbacks]: https://nix-community.github.io/home-manager/index.xhtml#sec-usage-rollbacks
[nix-darwin]: https://github.com/LnL7/nix-darwin
[rollbacks]: https://nix-community.github.io/home-manager/#sec-usage-rollbacks
-2537
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
attribute = "buildbot"
-45
View File
@@ -1,45 +0,0 @@
{
lib,
nix,
runCommand,
}:
let
home-manager =
with lib.fileset;
toSource {
root = ../.;
fileset = (fileFilter (file: file.hasExt "nix") ../.);
};
parseLog = "$TMPDIR/nix-parse.log";
in
runCommand "nix-parse-${nix.name}"
{
nativeBuildInputs = [
nix
];
}
''
export NIX_STORE_DIR=$TMPDIR/store
export NIX_STATE_DIR=$TMPDIR/state
nix-store --init
cd "${home-manager}"
# This will only show the first parse error, not all of them. That's fine, because
# the other CI jobs will report in more detail. This job is about checking parsing
# across different implementations / versions, not about providing the best DX.
# Returning all parse errors requires significantly more resources.
if ! find . -type f -iname '*.nix' | xargs -P $(nproc) nix-instantiate --parse 2> "${parseLog}" > /dev/null; then
cat "${parseLog}" >&2
echo "Parse failed in nix-instantiate." >&2
exit 1
fi
if grep "warning" "${parseLog}"; then
cat "${parseLog}" >&2
echo "Failing due to warnings in stderr" >&2
exit 1
fi
touch $out
''
+15 -42
View File
@@ -1,50 +1,23 @@
{
pkgs ? import <nixpkgs> { },
}:
{ pkgs ? import <nixpkgs> { } }:
let
path = builtins.path {
path = ./.;
name = "home-manager-source";
rec {
docs = let releaseInfo = pkgs.lib.importJSON ./release.json;
in with import ./docs {
inherit pkgs;
inherit (releaseInfo) release isReleaseBranch;
}; {
html = manual.html;
manPages = manPages;
json = options.json;
jsonModuleMaintainers = jsonModuleMaintainers; # Unstable, mainly for CI.
};
nixpkgs = (
import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
n = lock.nodes.nixpkgs.locked;
in
fetchTarball {
url = "https://github.com/${n.owner}/${n.repo}/archive/${n.rev}.tar.gz";
sha256 = n.narHash;
}
) { }
);
in
rec {
docs =
let
releaseInfo = pkgs.lib.importJSON ./release.json;
in
with import ./docs {
inherit pkgs;
inherit (releaseInfo) release isReleaseBranch;
};
{
home-manager = pkgs.callPackage ./home-manager { path = toString ./.; };
inherit manPages jsonModuleMaintainers;
inherit (manual) html htmlOpenTool;
inherit (options) json;
};
home-manager = pkgs.callPackage ./home-manager { inherit path; };
install = pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
install =
pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
nixos = import ./nixos;
lib = import ./lib { inherit (pkgs) lib; };
dev = nixpkgs.callPackage ./home-manager/devShell.nix { };
inherit path;
path = ./.;
}
+101 -255
View File
@@ -1,226 +1,92 @@
{
pkgs,
{ pkgs
# Note, this should be "the standard library" + HM extensions.
lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib,
# Note, this should be "the standard library" + HM extensions.
, lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib
release,
isReleaseBranch,
}:
, release, isReleaseBranch }:
let
# Recursively replace each derivation in the given attribute set
# with the same derivation but with the `outPath` attribute set to
# the string `"\${pkgs.attribute.path}"`. This allows the
# documentation to refer to derivations through their values without
# establishing an actual dependency on the derivation output.
#
# This is not perfect, but it seems to cover a vast majority of use
# cases.
#
# Caveat: even if the package is reached by a different means, the
# path above will be shown and not e.g.
# `${config.services.foo.package}`.
scrubDerivations =
prefixPath: attrs:
let
scrubDerivation =
name: value:
let
pkgAttrName = prefixPath + "." + name;
in
if lib.isAttrs value then
scrubDerivations pkgAttrName value
// lib.optionalAttrs (lib.isDerivation value) {
outPath = "\${${pkgAttrName}}";
}
else
value;
in
lib.mapAttrs scrubDerivation attrs;
nmdSrc = fetchTarball {
url =
"https://git.sr.ht/~rycee/nmd/archive/f18defadcc25e69e95b04493ee02682005472255.tar.gz";
sha256 = "14fazjqbc6sfsxycwadfhcymi37xg5wmrlvg3jb8d4mpbcdwfwz4";
};
nmd = import nmdSrc {
inherit lib;
# The DocBook output of `nixos-render-docs` doesn't have the change
# `nmd` uses to work around the broken stylesheets in
# `docbook-xsl-ns`, so we restore the patched version here.
pkgs = pkgs // {
docbook-xsl-ns =
pkgs.docbook-xsl-ns.override { withManOptDedupPatch = true; };
};
};
# Make sure the used package is scrubbed to avoid actually
# instantiating derivations.
scrubbedPkgsModule = {
imports = [
{
_module.args = {
pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs);
pkgs_i686 = lib.mkForce { };
};
}
];
imports = [{
_module.args = {
pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
pkgs_i686 = lib.mkForce { };
};
}];
};
dontCheckDefinitions = {
_module.check = false;
};
dontCheckDefinitions = { _module.check = false; };
gitHubDeclaration =
user: repo: subpath:
let
urlRef = if isReleaseBranch then "release-${release}" else "master";
in
{
gitHubDeclaration = user: repo: subpath:
let urlRef = if isReleaseBranch then "release-${release}" else "master";
in {
url = "https://github.com/${user}/${repo}/blob/${urlRef}/${subpath}";
name = "<${repo}/${subpath}>";
};
hmPath = toString ./..;
# Keep submodule option docs visible when wrapped in `either` (and therefore
# in `nullOr (either ...)`), which upstream currently omits.
docsLib = lib.extend (
_self: super:
let
mergeEitherSubOptions =
prefix: leftType: rightType:
let
getSubOptionsOrEmpty =
optionType:
let
subOptions = optionType.getSubOptions prefix;
in
if builtins.isAttrs subOptions then subOptions else { };
mkOptionDecl = options: {
_file = "<docs/default.nix>";
pos = null;
inherit options;
};
optionSets = lib.filter (options: options != { }) [
(getSubOptionsOrEmpty leftType)
(getSubOptionsOrEmpty rightType)
];
mergedOptions = lib.foldl' (
acc: options:
if acc == { } then
options
else
(super.mergeOptionDecls prefix [
(mkOptionDecl acc)
(mkOptionDecl options)
]).options
) { } optionSets;
in
mergedOptions;
in
{
types = super.types // {
either =
leftType: rightType:
(super.types.either leftType rightType)
// {
getSubOptions = prefix: mergeEitherSubOptions prefix leftType rightType;
};
};
}
);
buildOptionsDocs =
args@{
modules,
includeModuleSystemOptions ? true,
...
}:
let
# to discourage references from option descriptions and defaults.
poisonModule =
let
poisonAttr = n: {
name = n;
value = abort ''
error: the option documentation has a dependency on the configuration.
You may, for example, have added an option attribute like
default = ''${config.some.value};
Since the default value is included in the Home Manager manual, this
would make the manual depend on the user's configuration.
To avoid this problem in this particular case, consider changing to
default = ''${config.some.value};
defaultText = lib.literalExpression "\\''${config.some.value}";'';
};
in
{ options, ... }:
{
config = lib.listToAttrs (map poisonAttr (lib.filter (n: n != "_module") (lib.attrNames options)));
};
inherit
(
(docsLib.evalModules {
modules = modules ++ [ poisonModule ];
class = "homeManager";
})
)
buildOptionsDocs = args@{ modules, includeModuleSystemOptions ? true, ... }:
let options = (lib.evalModules { inherit modules; }).options;
in pkgs.buildPackages.nixosOptionsDoc ({
options = if includeModuleSystemOptions then
options
;
in
pkgs.buildPackages.nixosOptionsDoc (
{
options = if includeModuleSystemOptions then options else removeAttrs options [ "_module" ];
transformOptions =
opt:
opt
// {
# Clean up declaration sites to not refer to the Home Manager
# source tree.
declarations = map (
decl:
if lib.hasPrefix hmPath (toString decl) then
gitHubDeclaration "nix-community" "home-manager" (
lib.removePrefix "/" (lib.removePrefix hmPath (toString decl))
)
else if decl == "lib/modules.nix" then
# TODO: handle this in a better way (may require upstream
# changes to nixpkgs)
gitHubDeclaration "NixOS" "nixpkgs" decl
else
decl
) opt.declarations;
};
}
// removeAttrs args [
"modules"
"includeModuleSystemOptions"
]
);
else
builtins.removeAttrs options [ "_module" ];
transformOptions = opt:
opt // {
# Clean up declaration sites to not refer to the Home Manager
# source tree.
declarations = map (decl:
if lib.hasPrefix hmPath (toString decl) then
gitHubDeclaration "nix-community" "home-manager"
(lib.removePrefix "/" (lib.removePrefix hmPath (toString decl)))
else if decl == "lib/modules.nix" then
# TODO: handle this in a better way (may require upstream
# changes to nixpkgs)
gitHubDeclaration "NixOS" "nixpkgs" decl
else
decl) opt.declarations;
};
} // builtins.removeAttrs args [ "modules" "includeModuleSystemOptions" ]);
hmOptionsDocs = buildOptionsDocs {
modules =
import ../modules/modules.nix {
lib = docsLib;
inherit pkgs;
check = false;
}
++ [ scrubbedPkgsModule ];
modules = import ../modules/modules.nix {
inherit lib pkgs;
check = false;
} ++ [ scrubbedPkgsModule ];
variablelistId = "home-manager-options";
};
nixosOptionsDocs = buildOptionsDocs {
modules = [
../nixos
scrubbedPkgsModule
dontCheckDefinitions
];
modules = [ ../nixos scrubbedPkgsModule dontCheckDefinitions ];
includeModuleSystemOptions = false;
variablelistId = "nixos-options";
optionIdPrefix = "nixos-opt-";
};
nixDarwinOptionsDocs = buildOptionsDocs {
modules = [
../nix-darwin
scrubbedPkgsModule
dontCheckDefinitions
];
modules = [ ../nix-darwin scrubbedPkgsModule dontCheckDefinitions ];
includeModuleSystemOptions = false;
variablelistId = "nix-darwin-options";
optionIdPrefix = "nix-darwin-opt-";
@@ -230,63 +96,52 @@ let
revision = "release-${release-config.release}";
# Generate the `man home-configuration.nix` package
home-configuration-manual =
pkgs.runCommand "home-configuration-reference-manpage"
{
nativeBuildInputs = [
pkgs.buildPackages.installShellFiles
pkgs.nixos-render-docs
];
allowedReferences = [ "out" ];
}
''
# Generate manpages.
mkdir -p $out/share/man/man5
mkdir -p $out/share/man/man1
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${revision} \
--header ${./home-configuration-nix-header.5} \
--footer ${./home-configuration-nix-footer.5} \
${hmOptionsDocs.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/home-configuration.nix.5
cp ${./home-manager.1} $out/share/man/man1/home-manager.1
'';
pkgs.runCommand "home-configuration-reference-manpage" {
nativeBuildInputs =
[ pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs ];
allowedReferences = [ "out" ];
} ''
# Generate manpages.
mkdir -p $out/share/man/man5
mkdir -p $out/share/man/man1
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${revision} \
--header ${./home-configuration-nix-header.5} \
--footer ${./home-configuration-nix-footer.5} \
${hmOptionsDocs.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/home-configuration.nix.5
cp ${./home-manager.1} $out/share/man/man1/home-manager.1
'';
# Generate the HTML manual pages
home-manager-manual = pkgs.callPackage ./home-manager-manual.nix {
nmd = nmdSrc;
home-manager-options = {
home-manager = {
json = hmOptionsDocs.optionsJSON;
};
nixos = {
json = nixosOptionsDocs.optionsJSON;
};
nix-darwin = {
json = nixDarwinOptionsDocs.optionsJSON;
};
home-manager = hmOptionsDocs.optionsJSON;
nixos = nixosOptionsDocs.optionsJSON;
nix-darwin = nixDarwinOptionsDocs.optionsJSON;
};
inherit revision;
};
html = home-manager-manual;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix { } { inherit html; };
in
{
in {
inherit nmdSrc;
options = {
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable.
json =
pkgs.runCommand "options.json"
{
meta.description = "List of Home Manager options in JSON format";
}
''
mkdir -p $out/{share/doc,nix-support}
cp -a ${hmOptionsDocs.optionsJSON}/share/doc/nixos $out/share/doc/home-manager
substitute \
${hmOptionsDocs.optionsJSON}/nix-support/hydra-build-products \
$out/nix-support/hydra-build-products \
--replace-fail \
'${hmOptionsDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/home-manager"
'';
json = pkgs.runCommand "options.json" {
meta.description = "List of Home Manager options in JSON format";
} ''
mkdir -p $out/{share/doc,nix-support}
cp -a ${hmOptionsDocs.optionsJSON}/share/doc/nixos $out/share/doc/home-manager
substitute \
${hmOptionsDocs.optionsJSON}/nix-support/hydra-build-products \
$out/nix-support/hydra-build-products \
--replace \
'${hmOptionsDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/home-manager"
'';
};
manPages = home-configuration-manual;
@@ -294,21 +149,12 @@ in
manual = { inherit html htmlOpenTool; };
# Unstable, mainly for CI.
jsonModuleMaintainers = pkgs.writeText "hm-module-maintainers.json" (
let
result = lib.evalModules {
modules =
import ../modules/modules.nix {
inherit lib pkgs;
check = false;
}
++ [ scrubbedPkgsModule ];
class = "homeManager";
};
in
builtins.toJSON result.config.meta.maintainers
);
# Unstable, for tests.
_internal = { inherit docsLib; };
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);
}
-45
View File
@@ -1,45 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1779877693,
"narHash": "sha256-NOF9NAREhxr50bbBfVcVOq+ArCMSoe8dP79Pk2uyARk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4100e830e085863741bc69b156ec4ccd53ab5be0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"scss-reset": "scss-reset"
}
},
"scss-reset": {
"flake": false,
"locked": {
"lastModified": 1683906868,
"narHash": "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE=",
"owner": "andreymatin",
"repo": "scss-reset",
"rev": "5a7bd491ac82441e6283fb0d5d54644b913b30c7",
"type": "github"
},
"original": {
"owner": "andreymatin",
"ref": "1.4.2",
"repo": "scss-reset",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
-88
View File
@@ -1,88 +0,0 @@
{
description = "Support developing Home Manager documentation";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
scss-reset = {
url = "github:andreymatin/scss-reset/1.4.2";
flake = false;
};
};
outputs =
{
nixpkgs,
scss-reset,
...
}:
let
supportedSystems = [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
# Note, this should be "the standard library" + HM extensions.
lib = import ../modules/lib/stdlib-extended.nix nixpkgs.lib;
forAllSystems = lib.genAttrs supportedSystems;
flakePkgs = pkgs: {
p-build = pkgs.writeShellScriptBin "p-build" ''
set -euo pipefail
export PATH=${
lib.makeBinPath [
pkgs.coreutils
pkgs.rsass
]
}
tmpfile=$(mktemp -d)
trap "rm -r $tmpfile" EXIT
ln -s "${scss-reset}/build" "$tmpfile/scss-reset"
rsass --load-path="$tmpfile" --style compressed \
./static/style.scss > ./static/style.css
echo "Generated ./static/style.css"
'';
};
releaseInfo = lib.importJSON ../release.json;
in
{
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
fpkgs = flakePkgs pkgs;
in
{
default = pkgs.mkShell {
name = "hm-docs";
packages = [ fpkgs.p-build ];
};
}
);
# Expose the docs outputs
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
docs = import ./default.nix {
inherit pkgs lib;
inherit (releaseInfo) isReleaseBranch release;
};
in
{
inherit (docs) manPages jsonModuleMaintainers;
inherit (docs.manual) html htmlOpenTool;
inherit (docs.options) json;
}
);
};
}
+8
View File
@@ -0,0 +1,8 @@
pre {
padding: 0;
}
pre code.hljs {
border: none;
margin: 0;
}
+42 -67
View File
@@ -1,75 +1,56 @@
{
stdenv,
lib,
callPackage,
mdbook,
python3,
revision,
home-manager-options,
}:
let
outputPath = "share/doc/home-manager";
mdbookOptions = callPackage ./mdbook/options.nix {
manpageUrls = ./manual/manpage-urls.json;
inherit revision;
optionDocs = {
home-manager = {
title = "Home Manager Configuration Options";
path = "home-manager";
prefix = "opt-";
json = "${home-manager-options.home-manager.json}";
};
nixos = {
title = "NixOS Configuration Options";
path = "nixos";
prefix = "nixos-opt-";
json = "${home-manager-options.nixos.json}";
};
nix-darwin = {
title = "nix-darwin Configuration Options";
path = "nix-darwin";
prefix = "nix-darwin-opt-";
json = "${home-manager-options.nix-darwin.json}";
};
};
};
in
stdenv.mkDerivation {
{ stdenv, lib, documentation-highlighter, nmd, revision, home-manager-options
, nixos-render-docs }:
let outputPath = "share/doc/home-manager";
in stdenv.mkDerivation {
name = "home-manager-manual";
nativeBuildInputs = [
mdbook
python3
];
nativeBuildInputs = [ nixos-render-docs ];
src = ./.;
src = ./manual;
buildPhase = ''
runHook preBuild
mkdir -p out/media
mkdir -p source
python3 ${./mdbook/convert-markup.py} "$src/manual" source
python3 ${./mdbook/convert-markup.py} \
--base-depth 1 \
"$src/release-notes" \
source/release-notes
mkdir -p out/highlightjs
cp -t out/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js
cp -r ${mdbookOptions}/options source/options
substituteInPlace ./options.md \
--replace \
'@OPTIONS_JSON@' \
${home-manager-options.home-manager}/share/doc/nixos/options.json
python3 ${./mdbook/substitute-summary.py} \
source/SUMMARY.md \
${mdbookOptions}/summary/home-manager.md \
${mdbookOptions}/summary/nixos.md \
${mdbookOptions}/summary/nix-darwin.md
substituteInPlace ./nixos-options.md \
--replace \
'@OPTIONS_JSON@' \
${home-manager-options.nixos}/share/doc/nixos/options.json
mdbook build source --dest-dir book
substituteInPlace ./nix-darwin-options.md \
--replace \
'@OPTIONS_JSON@' \
${home-manager-options.nix-darwin}/share/doc/nixos/options.json
mkdir -p out
cp -r book/* out/
cp ${nmd}/static/style.css out/style.css
cp -t out/highlightjs ${nmd}/static/highlightjs/tomorrow-night.min.css
cp ${./highlight-style.css} out/highlightjs/highlight-style.css
python3 ${./mdbook/legacy-redirects.py} source out
cp -r ${./release-notes} release-notes
runHook postBuild
nixos-render-docs manual html \
--manpage-urls ./manpage-urls.json \
--revision ${lib.trivial.revisionWithDefault revision} \
--stylesheet style.css \
--stylesheet highlightjs/tomorrow-night.min.css \
--stylesheet highlightjs/highlight-style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
out/index.xhtml
'';
installPhase = ''
@@ -81,11 +62,5 @@ stdenv.mkDerivation {
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
passthru = {
inherit home-manager-options mdbookOptions;
};
meta = {
maintainers = [ lib.maintainers.considerate ];
};
meta = { maintainers = [ lib.maintainers.considerate ]; };
}
+5 -29
View File
@@ -24,12 +24,9 @@
.Cm | generations
.Cm | help
.Cm | news
.Cm | option Oo Fl -recursive Oc Ar option.name
.Cm | option Ar option.name
.Cm | packages
.Cm | remove-generations Ar ID \&...
.Cm | switch
.Op Fl -rollback
.Op Bro Fl c | Fl -specialisation Brc Ar NAME
.Cm | uninstall
.Brc
.Op Fl A Ar attrPath
@@ -48,7 +45,6 @@
.Op Fl -keep-failed
.Op Fl -keep-going
.Op Bro Fl L | Fl -print-build-logs Brc
.Op Fl -log-format
.Op Fl -show-trace
.Op Fl -(no-)substitute
.Op Fl -no-out-link
@@ -101,7 +97,7 @@ Instantiate the configuration and print the resulting derivation\&.
.It Cm edit
.RS 16
Open the home configuration using the editor indicated by \fBVISUAL\fR or \fBEDITOR\fR\&.
Open the home configuration using the editor indicated by \fBEDITOR\fR\&.
.RE
.Pp
@@ -138,14 +134,10 @@ Show news entries in a pager.
.RE
.PP
.It Cm option Oo Fl -recursive Oc Ar option.name
.It Cm option Ar option.name
.RS 4
Inspect the given option name in the home configuration, like
\fBnixos-option\fR(8)\&.
.sp
If the
.Fl -recursive
option is given, print all the values at or below the option name recursively\&.
.RE
.Pp
@@ -163,18 +155,9 @@ sub-command to find suitable generation numbers.
.RE
.Pp
.It Cm switch Oo Fl -rollback Oc Oo Bro Fl c | Fl -specialisation Brc Ar NAME Oc
.It Cm switch
.RS 4
Build and activate the configuration\&.
.sp
If the
.Fl -rollback
option is given, then the build is not done, instead roll back to and
activate the configuration prior to the current configuration\&.
.sp
If the
.Fl -specialisation
option is given, then the named specialisation is activated\&.
.RE
.Pp
@@ -352,13 +335,6 @@ when building from a flake\&.
.RE
.Pp
.It Cm Fl -log-format Ar format
.RS 4
Passed on to
\fBnix-build\fR(1)\&.
.RE
.Pp
.It Cm Fl -show-trace
.RS 4
Passed on to
@@ -420,5 +396,5 @@ Author.
.Sh COPYRIGHT
.br
Copyright \(co 2017\(en2026 Home Manager contributors
Copyright \(co 2017\(en2022 Home Manager contributors
.br
+7 -24
View File
@@ -1,14 +1,6 @@
{
writeShellScriptBin,
makeDesktopItem,
symlinkJoin,
}:
{
html,
pathName ? "home-manager",
projectName ? pathName,
name ? "${pathName}-help",
}:
{ writeShellScriptBin, makeDesktopItem, symlinkJoin }:
{ html, pathName ? "home-manager", projectName ? pathName
, name ? "${pathName}-help" }:
let
helpScript = writeShellScriptBin name ''
set -euo pipefail
@@ -25,14 +17,9 @@ let
if [[ ! -v BROWSER || -z $BROWSER ]]; then
echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1
else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
fi
manualPath="${html}/share/doc/${pathName}/index.html"
if [[ ! -e $manualPath ]]; then
manualPath="${html}/share/doc/${pathName}/index.xhtml"
fi
exec "$BROWSER" "$manualPath"
'';
desktopItem = makeDesktopItem {
@@ -43,11 +30,7 @@ let
exec = "${helpScript}/bin/${name}";
categories = [ "System" ];
};
in
symlinkJoin {
in symlinkJoin {
inherit name;
paths = [
helpScript
desktopItem
];
paths = [ helpScript desktopItem ];
}
-64
View File
@@ -1,64 +0,0 @@
# Summary
- [Preface](preface.md)
- [Introduction to Home Manager](introduction.md)
- [Installing Home Manager](installation.md)
- [Standalone installation](installation/standalone.md)
- [NixOS module](installation/nixos.md)
- [nix-darwin module](installation/nix-darwin.md)
- [Using Home Manager](usage.md)
- [Configuration Example](usage/configuration.md)
- [Rollbacks](usage/rollbacks.md)
- [Keeping your ~ safe from harm](usage/dotfiles.md)
- [Graphical services](usage/graphical.md)
- [GPU on non-NixOS systems](usage/gpu-non-nixos.md)
- [Modular Services](usage/modular-services.md)
- [Updating](usage/updating.md)
- [Upgrading to a new Home Manager release](usage/upgrading.md)
- [Nix Flakes](nix-flakes.md)
- [Prerequisites](nix-flakes/prerequisites.md)
- [Standalone setup](nix-flakes/standalone.md)
- [NixOS module](nix-flakes/nixos.md)
- [nix-darwin module](nix-flakes/nix-darwin.md)
- [flake-parts module](nix-flakes/flake-parts.md)
- [Writing Home Manager Modules](writing-modules.md)
- [Option Types](writing-modules/types.md)
- [Contributing](contributing.md)
- [Getting started](contributing/getting-started.md)
- [Guidelines](contributing/guidelines.md)
- [Release Notes](contributing/release-notes.md)
- [News](contributing/news.md)
- [Tests](contributing/tests.md)
- [Home Manager Internals](internals.md)
- [Activation](internals/activation.md)
- [Third-Party Tools and Extensions](3rd-party.md)
- [Module Collections](3rd-party/collections.md)
- [Frequently Asked Questions (FAQ)](faq.md)
- [Why is there a collision error when switching generation?](faq/collision.md)
- [Why are the session variables not set?](faq/session-variables.md)
- [How to set up a configuration for multiple users/machines?](faq/multiple-users-machines.md)
- [Why do I get an error message about `ca.desrt.dconf` or `dconf.service`?](faq/ca-desrt-dconf.md)
- [How do I install packages from Nixpkgs unstable?](faq/unstable.md)
- [How do I change the package used by a module?](faq/change-package-module.md)
- [Options](options.md)
@HOME_MANAGER_OPTIONS@
@NIXOS_OPTIONS@
@NIX_DARWIN_OPTIONS@
- [Release Notes](release-notes/release-notes.md)
- [Release 26.11](release-notes/rl-2611.md)
- [Release 26.05](release-notes/rl-2605.md)
- [Release 25.11](release-notes/rl-2511.md)
- [Release 25.05](release-notes/rl-2505.md)
- [Release 24.11](release-notes/rl-2411.md)
- [Release 24.05](release-notes/rl-2405.md)
- [Release 23.11](release-notes/rl-2311.md)
- [Release 23.05](release-notes/rl-2305.md)
- [Release 22.11](release-notes/rl-2211.md)
- [Release 22.05](release-notes/rl-2205.md)
- [Release 21.11](release-notes/rl-2111.md)
- [Release 21.05](release-notes/rl-2105.md)
- [Release 20.09](release-notes/rl-2009.md)
- [Release 20.03](release-notes/rl-2003.md)
- [Release 19.09](release-notes/rl-1909.md)
- [Release 19.03](release-notes/rl-1903.md)
- [Release 18.09](release-notes/rl-1809.md)
-11
View File
@@ -1,11 +0,0 @@
[book]
title = "Home Manager Manual"
language = "en"
src = "."
[output.html]
git-repository-url = "https://github.com/nix-community/home-manager"
[output.html.fold]
enable = true
level = 0
+2 -3
View File
@@ -3,8 +3,8 @@
Contributions to Home Manager are very welcome. To make the process as
smooth as possible for both you and the Home Manager maintainers we
provide some guidelines that we ask you to follow. See [Getting
started](contributing/getting-started.md#sec-contrib-getting-started) for information on how to set up
a suitable development environment and [Guidelines](contributing/guidelines.md#sec-guidelines) for
started](#sec-contrib-getting-started) for information on how to set up
a suitable development environment and [Guidelines](#sec-guidelines) for
the actual guidelines.
This text is mainly directed at those who would like to make code
@@ -22,7 +22,6 @@ configuration.
```{=include=} sections
contributing/getting-started.md
contributing/guidelines.md
contributing/release-notes.md
contributing/news.md
contributing/tests.md
```
+2 -2
View File
@@ -8,7 +8,7 @@ how to do this.
Once you have a fork of Home Manager you should create a branch starting
at the most recent `master` branch. Give your branch a reasonably
descriptive name. Commit your changes to this branch and when you are
happy with the result and it fulfills [Guidelines](guidelines.md#sec-guidelines) then
happy with the result and it fulfills [Guidelines](#sec-guidelines) then
push the branch to GitHub and [create a pull
request](https://help.github.com/articles/creating-a-pull-request/).
@@ -21,7 +21,7 @@ the `home-manager` command use it by either
$ home-manager -I home-manager=$HOME/devel/home-manager
```
or, if using [flakes](../nix-flakes/standalone.md#sec-flakes-standalone):
or, if using [flakes](#sec-flakes-standalone):
``` shell
$ home-manager --override-input home-manager ~/devel/home-manager
+21 -92
View File
@@ -58,48 +58,24 @@ YAML, INI, TOML, or even a plain list of key/value pairs then consider
using a `settings` option as described in [Nix RFC
42](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md).
These guidelines describe the minimum option design requirements. Before
submitting a module, compare it against the upstream documentation or
source code and verify that the generated files, services, environment
variables, and command line arguments all match the upstream behavior
you intend to expose.
If a module installs a package, try to make the package option nullable,
for example
``` nix
package = lib.mkPackageOption pkgs "xdg-terminal-exec" { nullable = true; };
```
This lets users keep installation outside Home Manager, for example via
`apt` or because the program is built into macOS, while still using the
module for configuration. Keeping the package non-nullable is fine when
the enabled behavior structurally requires the executable or when
package-less support would make the module significantly more complex.
Avoid generating files for empty settings, null packages, or optional
features that are not configured.
If upstream does not use XDG paths by default but supports changing the
configuration location with an environment variable, for example
`FOO_HOME`, expose a `configDir` option and use it to respect
`home.preferXdgDirectories`.
## Add relevant tests {#sec-guidelines-add-tests}
If at all possible, make sure to add new tests and expand existing tests
so that your change will keep working in the future. See
[Tests](tests.md#sec-tests) for more information about the Home Manager test
[Tests](#sec-tests) for more information about the Home Manager test
suite.
All contributed code *must* pass the test suite.
## Add relevant documentation {#sec-guidelines-module-maintainer}
Many code changes require changing the documentation as well. The
documentation is written in
[Nixpkgs-flavoured Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup).
All text is hosted in Home Manager's Git repository.
Many code changes require changing the documentation as well. Module
options should be documented with [Nixpkgs-flavoured
Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup).
Home Manager is itself documented using a combination of
[DocBook](https://tdg.docbook.org/) and
[AsciiDoc](https://asciidoc.org/). All text is hosted in Home Manager's
Git repository.
The HTML version of the manual containing both the module option
descriptions and the documentation of Home Manager can be generated and
@@ -116,39 +92,9 @@ the man page version of the module options looks good:
``` shell
$ nix-build -A docs.manPages
$ man ./result/share/man/man5/home-configuration.nix.5
$ man ./result/share/man/man5/home-configuration.nix.5.gz
```
## Module Auto-importing {#sec-module-auto-importing}
Home Manager automatically imports all modules from the `modules/programs/` and
`modules/services/` directories. This auto-importing behavior follows these
rules:
- **Nix files**: All `.nix` files in these directories are automatically
imported
- **Directories**: All subdirectories are automatically imported (typically
containing a `default.nix` file)
- **Exclusions**: Files and directories starting with an underscore (`_`) are
excluded from auto-importing
This allows for flexible module organization:
```
modules/programs/
├── git.nix # Single-file module (imported)
├── firefox/ # Multi-file module (imported)
│ ├── default.nix
│ └── addons.nix
├── _experimental.nix # Excluded (starts with _)
└── _wip/ # Excluded directory (starts with _)
└── newfeature.nix
```
When adding a new module, simply place it in the appropriate directory
(`programs/` for user programs, `services/` for user services) and it will be
automatically discovered and included in the Home Manager module system.
## Add yourself as a module maintainer {#_add_yourself_as_a_module_maintainer}
Every new module *must* include a named maintainer using the
@@ -159,9 +105,6 @@ If you are present in the nixpkgs maintainer list then you can use that
entry. If you are not then you can add yourself to
`modules/lib/maintainers.nix` in the Home Manager project.
As a maintainer you are expected to respond to issues and
pull-requests associated with your module.
Maintainers are encouraged to join the IRC or Matrix channel and
participate when they have opportunity.
@@ -182,16 +125,11 @@ consistent commit message format as described in
If your contribution includes a change that should be communicated to
users of Home Manager then you can add a news entry. The entry must be
formatted as described in [News](news.md#sec-news).
formatted as described in [News](#sec-news).
When new modules are added a news entry should be included.
News entries and release notes serve different purposes. Release notes
should be updated separately when a change affects users migrating
between stable releases, such as state version default changes, required
migration steps, or broad behavior changes. See
[Release Notes](release-notes.md#sec-contributing-release-notes) and [News](news.md#sec-news)
for more details.
When new modules are added a news entry should be included but you do
not need to create this entry manually. The merging maintainer will
create the entry for you. This is to reduce the risk of merge conflicts.
## Use conditional modules and news {#sec-guidelines-conditional-modules}
@@ -200,16 +138,12 @@ of the supported platforms. The most common example of platform specific
modules are those that define systemd user services, which only works on
Linux systems.
If you add a module that is platform specific then make sure the module
guards platform-specific configuration with an appropriate condition, for
example `pkgs.stdenv.hostPlatform.isLinux` or
`pkgs.stdenv.hostPlatform.isDarwin`. Modules in `modules/programs/` and
`modules/services/` are auto-imported, so the platform condition should live
in the module behavior and in any platform-specific tests rather than in a
separate module discovery call.
If you add a module that is platform specific then make sure to include
a condition in the `loadModule` function call. This will make the module
accessible only on systems where the condition evaluates to `true`.
Similarly, if you are adding a news entry then it should be shown only
to users that may find it relevant, see [News](news.md#sec-news) for a
to users that may find it relevant, see [News](#sec-news) for a
description of conditional news.
## Mind the license {#sec-guidelines-licensing}
@@ -232,11 +166,6 @@ 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.
Keep commits atomic and separated by concern. For example, a new
maintainer entry should be a separate first commit, and a shared module
should be committed separately from integrations in existing modules.
Pull requests should not include merge commits or fixup commits.
The commit messages should follow the [seven
rules](https://chris.beams.io/posts/git-commit/#seven-rules), except for
\"Capitalize the subject line\". We also ask you to include the affected
@@ -277,10 +206,10 @@ a long description if you wish.
## Code Style {#sec-code-style}
The code in Home Manager is formatted by the [treefmt](https://treefmt.com) tool
and the formatting is checked in the pull request tests. Run `nix fmt` or
`treefmt` (with required formatters which can be found in `treefmt.toml` in your
`$PATH`) inside the project repository before submitting your pull request.
The code in Home Manager is formatted by the
[nixfmt](https://github.com/serokell/nixfmt/) tool and the formatting is
checked in the pull request tests. Run the `format` tool inside the
project repository before submitting your pull request.
Keep lines at a reasonable width, ideally 80 characters or less. This
also applies to string literals.
+10 -34
View File
@@ -6,40 +6,21 @@ associated news entry. In general, a news entry should only be added for
truly noteworthy news. For example, a bug fix or new option does
generally not need a news entry.
Release notes and news entries serve different purposes. A news entry is
shown during Home Manager activation and is useful for day-to-day
communication about noteworthy changes, such as a new module, a new
feature, or a specific deprecation. Release notes are read from the
website documentation and should summarize what users need to know before
or during a stable-release upgrade. See
[Release Notes](release-notes.md#sec-contributing-release-notes) for guidance on changes
that affect stable-release upgrades.
If you do have a change worthy of a news entry then please add one in
[`news`](https://github.com/nix-community/home-manager/blob/master/modules/misc/news)
[`news.nix`](https://github.com/nix-community/home-manager/blob/master/modules/misc/news.nix)
but you should follow some basic guidelines:
- Use the included news entry generator to create a news entry file:
- The entry timestamp should be in ISO-8601 format having \"+00:00\"
as time zone. For example, \"2017-09-13T17:10:14+00:00\". A suitable
timestamp can be produced by the command
``` shell
$ nix run .#create-news-entry
$ date --iso-8601=second --universal
```
Alternatively, you can directly use the script:
``` shell
$ nix-shell -A dev --run modules/misc/news/create-news-entry.sh
```
This will create a new file inside the `modules/misc/news` directory
with some placeholder information that you can edit.
- The entry condition should be as specific as possible for changes
affecting existing functionality. For example, if you are changing
or deprecating a specific option then you could restrict the news to
those users who actually use this option. Prefer a targeted
condition over skipping useful news only to avoid notifying
unaffected users.
- The entry condition should be as specific as possible. For example,
if you are changing or deprecating a specific option then you could
restrict the news to those users who actually use this option.
- Wrap the news message so that it will fit in the typical terminal,
that is, at most 80 characters wide. Ideally a bit less.
@@ -65,10 +46,6 @@ but you should follow some basic guidelines:
A new module is available: 'services.foo'.
Since this news announces newly available functionality, its
condition should not require `config.services.foo.enable`; otherwise
users who may want the new module will not see the news.
If the module is platform specific, e.g., a service module using
systemd, then a condition like
@@ -76,6 +53,5 @@ but you should follow some basic guidelines:
condition = hostPlatform.isLinux;
```
should be added to avoid showing the news on unsupported platforms.
Use the `create-news-entry` generator described above to scaffold
this entry as part of your contribution.
should be added. If you contribute a module then you don't need to
add this entry, the merger will create an entry for you.
-24
View File
@@ -1,24 +0,0 @@
# Release Notes {#sec-contributing-release-notes}
Home Manager release notes are published as part of the website documentation in
`docs/release-notes/rl-*.md`. They are intended for users migrating from one
stable release to another.
A change should be mentioned in the release notes when it affects migration
between stable releases. This includes changes that require user action or
awareness during an upgrade, such as:
- breaking changes;
- default changes guarded by `home.stateVersion`;
- required migration steps;
- broad behavior changes across platform or integration boundaries;
- compatibility changes that can affect existing configurations.
Do not use the presence or absence of a news entry to decide whether a change
belongs in the release notes. A change can require a news entry, a release note,
both, or neither.
When preparing a release, review the commits since the previous stable release
and update the upcoming release note file with the migration impact. Prefer
concise user-facing descriptions that name the affected option paths and explain
required action.
+8 -222
View File
@@ -6,247 +6,33 @@ the form of \"golden tests\" where, for example, a generated
configuration file is compared to a known correct file.
It is relatively easy to create tests by modeling the existing tests,
found in the `tests` project directory.
## Writing Basic Tests {#sec-tests-basic}
Home Manager tests use the **NMT** framework, which provides
a set of assertion functions to verify that modules generate the expected files
and configurations. Tests are written as Nix expressions that define both the
Home Manager configuration and the test assertions.
### Test Structure {#sec-tests-structure}
A basic test file structure looks like:
```nix
{
# Home Manager configuration
programs.myprogram = {
enable = true;
settings = {
option = "value";
};
};
# NMT test script with assertions
nmt.script = ''
assertFileExists "home-files/.config/myprogram/config.toml"
assertFileContent "home-files/.config/myprogram/config.toml" ${./expected-config.toml}
'';
}
```
### Test Organization {#sec-tests-organization}
Tests are organized in the `tests` directory structure:
- `tests/modules/programs/myprogram/default.nix` - Lists all test cases for the module
- `tests/modules/programs/myprogram/basic-configuration.nix` - A basic test case
- `tests/modules/programs/myprogram/expected-config.toml` - Expected output file
The `default.nix` file should list all test cases:
```nix
{
myprogram-basic-configuration = ./basic-configuration.nix;
myprogram-empty-settings = ./empty-settings.nix;
}
```
Prefer keeping related assertions in as few test files as practical.
Exercising several cases in one evaluation keeps the test suite cheaper
to evaluate and reduces maintenance burden. Split cases into separate
files when they need incompatible module configuration, platform
conditions, expected assertion failures, or otherwise cannot share one
evaluation.
### Common NMT Assertions {#sec-tests-assertions}
NMT provides several assertion functions:
- `assertFileExists "path"` - Verify a file was created
- `assertPathNotExists "path"` - Verify a file was NOT created
- `assertFileContent "path" expected-file` - Compare file contents
- `assertFileRegex "path" "regex"` - Check file matches regex
For a full reference to the functions available in test scripts, you can look at NMT's
found in the `tests` project directory. For a full reference to the
functions available in test scripts, you can look at NMT's
[bash-lib](https://git.sr.ht/~rycee/nmt/tree/master/item/bash-lib).
### Practical Examples {#sec-tests-examples}
Here are some real-world examples of common test patterns:
**Testing that a configuration file is generated:**
```nix
{
programs.alacritty = {
enable = true;
settings.font.size = 12;
};
nmt.script = ''
assertFileExists "home-files/.config/alacritty/alacritty.yml"
assertFileContains "home-files/.config/alacritty/alacritty.yml" "size: 12"
'';
}
```
**Testing that no files are created when disabled:**
```nix
{
programs.alacritty.enable = false;
nmt.script = ''
assertPathNotExists "home-files/.config/alacritty"
'';
}
```
**Testing exact file content against expected output:**
```nix
{
programs.fastfetch = {
enable = true;
settings.display.color = "blue";
};
nmt.script =
let
configFile = "home-files/.config/fastfetch/config.jsonc";
in
''
assertFileExists "${configFile}"
assertFileContent "${configFile}" ${./expected-config.jsonc}
'';
}
```
**Testing multiple conditions in one test:**
```nix
{
programs.myprogram = {
enable = true;
configFile = "custom.conf";
extraConfig = "debug = true";
};
nmt.script = ''
assertFileExists "home-files/.config/myprogram/custom.conf"
assertFileRegex "home-files/.config/myprogram/custom.conf" "debug = true"
assertFileRegex "home-files/.config/myprogram/custom.conf" "^# Generated by Home Manager"
'';
}
```
### Platform-Specific Tests {#sec-tests-platform-specific}
When a module is platform-specific (Linux-only or Darwin-only), the test's `default.nix`
file should use `lib.optionalAttrs` to conditionally expose tests based on the platform.
This prevents evaluation errors on unsupported platforms during the test suite runs.
**Linux-only module tests:**
```nix
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
rofi-valid-config = ./valid-config.nix;
rofi-custom-theme = ./custom-theme.nix;
}
```
**Darwin-only module tests:**
```nix
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
sketchybar-basic = ./basic-configuration.nix;
sketchybar-lua-config = ./lua-config.nix;
}
```
For cross-platform modules that have packages which need to be stubbed on Darwin,
add the package names to `tests/darwinScrublist.nix` to prevent build failures
during cross-platform test runs.
On Linux, packages are automatically scrubbed by the test infrastructure,
so tests should normally use the module's default package. Use
`test.stubs` or `config.lib.test.mkStubPackage` only when the automatic
scrubbing does not model the behavior that the test needs, such as a
package with additional files or a non-default executable layout.
## Using the tests command {#sec-tests-command}
Home Manager provides a convenient `tests` command for discovering and running tests:
``` shell
# List all available tests
$ nix run .#tests -- -l
# List tests matching a pattern
$ nix run .#tests -- -l alacritty
# Run all tests matching a pattern
$ nix run .#tests -- alacritty
# Run a specific test
$ nix run .#tests -- test-alacritty-empty-settings
# List integration tests
$ nix run .#tests -- -t -l
# Run all integration tests
$ nix run .#tests -- -t integration-test-
# Interactive test selection (requires fzf)
$ nix run .#tests -- -i
# Pass additional nix build flags
$ nix run .#tests -- alacritty -- --verbose
```
Integration tests are only exposed on Linux. On other platforms, integration
test discovery may report no matching tests.
## Manual test commands {#sec-tests-manual}
For advanced usage or CI environments, you can also run tests manually using nix build commands.
The full Home Manager test suite can be run by executing
``` shell
$ nix-build --pure --option allow-import-from-derivation false tests -A build.all
$ nix-shell --pure tests -A run.all
```
in the project root. List all test cases through
``` shell
$ nix run .#tests -- -l
$ nix-shell --pure tests -A list
```
and run an individual test, for example `alacritty-empty-settings`,
through
``` shell
$ nix-build --pure tests --option allow-import-from-derivation false -A build.alacritty-empty-settings
$ 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` file,
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.
``` shell
$ nix build .#test-all
```
or
``` shell
$ nix build .#test-alacritty-empty-settings
```
Some tests may be marked with `enableLegacyIfd`, those may be run by run with e.g.
``` shell
$ nix-build --pure tests --arg enableLegacyIfd true -A build.mytest
$ nix develop --ignore-environment .#all
```
+1 -1
View File
@@ -6,5 +6,5 @@ faq/session-variables.md
faq/multiple-users-machines.md
faq/ca-desrt-dconf.md
faq/unstable.md
faq/change-package-module.md
faq/override-package-module.md
```
-117
View File
@@ -1,117 +0,0 @@
# How do I change the package used by a module? {#_how_do_i_change_the_package_used_by_a_module}
By default Home Manager will install the package provided by your chosen
`nixpkgs` channel but occasionally you might end up needing to change
this package. This can typically be done in two ways.
1. If the module provides a `package` option, such as
`programs.beets.package`, then this is the recommended way to
perform the change. For example,
``` nix
programs.beets.package = pkgs.beets.override { pluginOverrides = { beatport.enable = false; }; };
```
See [Nix pill 17](https://nixos.org/guides/nix-pills/nixpkgs-overriding-packages.html)
for more information on package overrides. Alternatively, if you want
to use the `beets` package from Nixpkgs unstable, then a configuration like
``` nix
{ pkgs, config, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
programs.beets.package = pkgsUnstable.beets;
# …
}
```
should work OK. With flakes, pass the unstable package set as
described in
[How do I install packages from Nixpkgs unstable?](unstable.md#_how_do_i_install_packages_from_nixpkgs_unstable)
and then use the extra module argument:
``` nix
{ pkgsUnstable, ... }:
{
programs.beets.package = pkgsUnstable.beets;
# …
}
```
2. If no `package` option is available then you can typically change
the relevant package using an
[overlay](https://nixos.org/nixpkgs/manual/#chap-overlays).
For example, if you want to use the `programs.skim` module but use
the `skim` package from Nixpkgs unstable, then a configuration like
``` nix
{ pkgs, config, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
programs.skim.enable = true;
nixpkgs.overlays = [
(_final: _prev: {
skim = pkgsUnstable.skim;
})
];
# …
}
```
should work OK.
The same Home Manager overlay works in a flake-based standalone
configuration if `pkgsUnstable` is passed to the Home Manager
module:
``` nix
{ pkgsUnstable, ... }:
{
programs.skim.enable = true;
nixpkgs.overlays = [
(_final: _prev: {
skim = pkgsUnstable.skim;
})
];
# …
}
```
This also works when Home Manager is used as a NixOS or nix-darwin
module without `home-manager.useGlobalPkgs = true`. If
`home-manager.useGlobalPkgs = true` is enabled, Home Manager uses
the system package set and the `nixpkgs.*` options inside Home
Manager are disabled. In that case, put the overlay in the system
configuration instead, for example:
``` nix
{ pkgsUnstable, ... }:
{
nixpkgs.overlays = [
(_final: _prev: {
skim = pkgsUnstable.skim;
})
];
}
```
In a flake-based NixOS or nix-darwin configuration, pass
`pkgsUnstable` to `nixosSystem` or `darwinSystem` with
`specialArgs`.
+1 -1
View File
@@ -43,5 +43,5 @@ The solution is typically to uninstall the package from the environment
using `nix-env --uninstall` and reattempt the Home Manager generation
switch.
You could also opt to uninstall *all* of the packages from your profile
You could also opt to unistall *all* of the packages from your profile
with `nix-env --uninstall '*'`.
@@ -0,0 +1,44 @@
# How do I override the package used by a module? {#_how_do_i_override_the_package_used_by_a_module}
By default Home Manager will install the package provided by your chosen
`nixpkgs` channel but occasionally you might end up needing to change
this package. This can typically be done in two ways.
1. If the module provides a `package` option, such as
`programs.beets.package`, then this is the recommended way to
perform the override. For example,
``` nix
programs.beets.package = pkgs.beets.override { enableCheck = true; };
```
2. If no `package` option is available then you can typically override
the relevant package using an
[overlay](https://nixos.org/nixpkgs/manual/#chap-overlays).
For example, if you want to use the `programs.skim` module but use
the `skim` package from Nixpkgs unstable, then a configuration like
``` nix
{ pkgs, config, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
programs.skim.enable = true;
nixpkgs.overlays = [
(self: super: {
skim = pkgsUnstable.skim;
})
];
# …
}
```
should work OK.
+1 -4
View File
@@ -17,11 +17,8 @@ way. In Bash and Z shell this can be done by adding
to your `.profile` and `.zshrc` files, respectively. The
`hm-session-vars.sh` file should work in most Bourne-like shells. For
fish shell, it is possible to source it using [the foreign-env
plugin](https://github.com/oh-my-fish/plugin-foreign-env) or using the builtin
[babelfish](https://github.com/bouk/babelfish)-translated variables:
plugin](https://github.com/oh-my-fish/plugin-foreign-env)
``` bash
fenv source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" > /dev/null
# or
source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.fish"
```
+7 -82
View File
@@ -3,20 +3,22 @@
If you are using a stable version of Nixpkgs but would like to install
some particular packages from Nixpkgs unstable -- or some other channel
-- then you can import the unstable Nixpkgs and refer to its packages
within your configuration.
With channels, something like
within your configuration. Something like
``` nix
{ pkgs, config, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
home.packages = [
pkgsUnstable.foo
];
# …
}
```
@@ -30,82 +32,5 @@ $ nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
$ nix-channel --update
```
With flakes, add another Nixpkgs input and pass its packages to your
Home Manager modules. For example, a standalone Home Manager flake can
define the following. Replace 25.11 with the release branch your
configuration follows.
``` nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager/release-25.11";
};
outputs =
{ nixpkgs, nixpkgs-unstable, home-manager, ... }:
let
# Replace this with the system of your Home Manager configuration.
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
pkgsUnstable = nixpkgs-unstable.legacyPackages.${system};
in
{
homeConfigurations.jdoe = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit pkgsUnstable; };
modules = [ ./home.nix ];
};
};
}
```
and then use the extra argument in `home.nix`:
``` nix
{ pkgsUnstable, ... }:
{
home.packages = [
pkgsUnstable.foo
];
}
```
When Home Manager is used as a NixOS or nix-darwin module, pass the
extra package set with `home-manager.extraSpecialArgs` in the system
configuration:
``` nix
outputs =
{ nixpkgs, nixpkgs-unstable, home-manager, ... }:
let
# Replace this with the system of your NixOS or nix-darwin configuration.
system = "x86_64-linux";
in
{
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
home-manager.nixosModules.home-manager
({ config, ... }: {
home-manager.extraSpecialArgs = {
pkgsUnstable = import nixpkgs-unstable {
inherit system;
config = config.nixpkgs.config;
overlays = config.nixpkgs.overlays;
};
# If you use a stock Nixpkgs configuration, you can use:
# pkgsUnstable = nixpkgs-unstable.legacyPackages.${system};
};
})
];
};
};
```
The nix-darwin setup is the same pattern with
`darwin.lib.darwinSystem` and
`home-manager.darwinModules.home-manager`.
Note, the package will not be affected by any package overrides,
overlays, etc.
+6 -6
View File
@@ -6,26 +6,26 @@ Home Manager can be used in three primary ways:
NixOS and Darwin, this is the only available choice. It is also
recommended for people on NixOS or Darwin that want to manage their
home directory independently of the system as a whole. See
[Standalone installation](installation/standalone.md#sec-install-standalone) for instructions
[Standalone installation](#sec-install-standalone) for instructions
on how to perform this installation.
2. As a module within a NixOS system configuration. This allows the
user profiles to be built together with the system when running
`nixos-rebuild`. See [NixOS module](installation/nixos.md#sec-install-nixos-module) for a
`nixos-rebuild`. See [NixOS module](#sec-install-nixos-module) for a
description of this setup.
3. As a module within a
[nix-darwin](https://github.com/nix-darwin/nix-darwin/) system
[nix-darwin](https://github.com/LnL7/nix-darwin/) system
configuration. This allows the user profiles to be built together
with the system when running `darwin-rebuild`. See [nix-darwin
module](installation/nix-darwin.md#sec-install-nix-darwin-module) for a description of this
module](#sec-install-nix-darwin-module) for a description of this
setup.
:::{.note}
In this chapter we describe how to install Home Manager in the standard
way using channels. If you prefer to use [Nix
Flakes](https://wiki.nixos.org/wiki/Flakes) then please see the instructions
in [nix flakes](nix-flakes.md#ch-nix-flakes).
Flakes](https://nixos.wiki/wiki/Flakes) then please see the instructions
in [nix flakes](#ch-nix-flakes).
:::
```{=include=} sections
+14 -27
View File
@@ -2,12 +2,12 @@
Home Manager provides a module that allows you to prepare user
environments directly from the
[nix-darwin](https://github.com/nix-darwin/nix-darwin/) configuration file,
[nix-darwin](https://github.com/LnL7/nix-darwin/) configuration file,
which often is more convenient than using the `home-manager` tool.
To make the nix-darwin 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
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
``` shell
@@ -15,10 +15,10 @@ $ nix-channel --add https://github.com/nix-community/home-manager/archive/master
$ nix-channel --update
```
and if you follow a Nixpkgs version 26.05 channel, you can run
and if you follow a Nixpkgs version 23.11 channel, you can run
``` shell
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-26.05.tar.gz home-manager
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
$ nix-channel --update
```
@@ -28,9 +28,9 @@ It is then possible to add
imports = [ <home-manager/nix-darwin> ];
```
to your nix-darwin `configuration.nix` file, which will introduce a
`home-manager.users` option whose type is an attribute set that maps
user names to Home Manager configurations.
to your nix-darwin `configuration.nix` file, which will introduce a new
NixOS option called `home-manager` whose type is an attribute set that
maps user names to Home Manager configurations.
For example, a nix-darwin configuration may include the lines
@@ -45,16 +45,13 @@ home-manager.users.eve = { pkgs, ... }: {
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "26.05";
home.stateVersion = "23.11";
};
```
and after a `darwin-rebuild switch` the user eve's environment should
include a basic Bash configuration and the packages atool and httpie.
Home Manager activation runs as part of nix-darwin activation for each
configured user.
If you do not plan on having Home Manager manage your shell
configuration then you must add either
@@ -106,23 +103,13 @@ Nixpkgs.
:::
:::{.note}
Home Manager passes extra module arguments to each
`home-manager.users.<name>` module:
Home Manager will pass `osConfig` as a module argument to any modules
you create. This contains the system's nix-darwin configuration.
``` nix
{ lib, pkgs, osConfig, darwinConfig, osClass, modulesPath, ... }:
{ lib, pkgs, osConfig, ... }:
```
Here `osConfig` contains the system's nix-darwin configuration and
`darwinConfig` is a Darwin-specific alias for the same value. The `lib`
argument is Home Manager's extended library. You can pass additional module
arguments with `home-manager.extraSpecialArgs`.
:::
:::{.note}
Use `home-manager.sharedModules` to add Home Manager modules to every user
declared under `home-manager.users`.
:::
Once installed you can see [Using Home Manager](../usage.md#ch-usage) for a more detailed
Once installed you can see [Using Home Manager](#ch-usage) for a more detailed
description of Home Manager and how to use it.
+11 -61
View File
@@ -17,10 +17,10 @@ $ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/m
$ sudo nix-channel --update
```
and if you follow a Nixpkgs version 26.05 channel, you can run
and if you follow a Nixpkgs version 23.11 channel, you can run
``` shell
$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-26.05.tar.gz home-manager
$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
$ sudo nix-channel --update
```
@@ -34,31 +34,6 @@ to your system `configuration.nix` file, which will introduce a new
NixOS option called `home-manager.users` whose type is an attribute set
that maps user names to Home Manager configurations.
Alternatively, home-manager installation can be done declaratively through configuration.nix using the following syntax:
```nix
{ config, pkgs, lib, ... }:
let
home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-26.05.tar.gz;
in
{
imports =
[
(import "${home-manager}/nixos")
];
users.users.eve.isNormalUser = true;
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "26.05";
};
}
```
For example, a NixOS configuration may include the lines
``` nix
@@ -67,15 +42,9 @@ home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "26.05"; # Please read the comment before changing.
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "23.11";
};
```
@@ -85,21 +54,12 @@ httpie.
:::{.note}
If `nixos-rebuild switch` does not result in the environment you expect,
then the service to inspect depends on the activation mode.
By default, Home Manager activates each configured user during boot and
system rebuilds through a NixOS system service:
you can take a look at the output of the Home Manager activation script
output using
``` shell
$ systemctl status "home-manager-$USER.service"
```
If `home-manager.startAsUserService = true` is set, Home Manager instead
activates through the user's systemd service:
``` shell
$ systemctl --user status home-manager.service
```
:::
If you do not plan on having Home Manager manage your shell
@@ -153,23 +113,13 @@ Nixpkgs.
:::
:::{.note}
Home Manager passes extra module arguments to each
`home-manager.users.<name>` module:
Home Manager will pass `osConfig` as a module argument to any modules
you create. This contains the system's NixOS configuration.
``` nix
{ lib, pkgs, osConfig, nixosConfig, osClass, modulesPath, ... }:
{ lib, pkgs, osConfig, ... }:
```
Here `osConfig` contains the system's NixOS configuration and `nixosConfig`
is a NixOS-specific alias for the same value. The `lib` argument is Home
Manager's extended library. You can pass additional module arguments with
`home-manager.extraSpecialArgs`.
:::
:::{.note}
Use `home-manager.sharedModules` to add Home Manager modules to every user
declared under `home-manager.users`.
:::
Once installed you can see [Using Home Manager](../usage.md#ch-usage) for a more detailed
Once installed you can see [Using Home Manager](#ch-usage) for a more detailed
description of Home Manager and how to use it.
+3 -3
View File
@@ -19,10 +19,10 @@
$ nix-channel --update
```
and if you follow a Nixpkgs version 26.05 channel you can run
and if you follow a Nixpkgs version 23.11 channel you can run
``` shell
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-26.05.tar.gz home-manager
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
$ nix-channel --update
```
@@ -71,5 +71,5 @@ checkout of the repository then you can use the
[home-manager.path](#opt-programs.home-manager.path) option to specify the absolute
path to the repository.
Once installed you can see [Using Home Manager](../usage.md#ch-usage) for a more detailed
Once installed you can see [Using Home Manager](#ch-usage) for a more detailed
description of Home Manager and how to use it.
-11
View File
@@ -1,11 +0,0 @@
# Home Manager Internals {#ch-internals}
This chapter collects some documentation about the internal workings
of Home Manager. The information here is mostly aimed to developers of
Home Manager and those who do non-trivial integration with Home
Manager.
```{=include=} sections
internals/activation.md
```
-40
View File
@@ -1,40 +0,0 @@
# Activation {#sec-internals-activation}
Activating a Home Manager configuration ensures that the built
configuration is introduced into the user's environment. The
activation is performed by a suitably named script
{command}`activate`. This script is generated as part of the
configuration build and is placed in the root of the build output.
The activation script is implemented in the Bash language and consists
of initialization code followed by a number of _activation script
blocks_. These blocks are specified using the
[home.activation](#opt-home.activation) option. The blocks may have
dependencies among themselves and the generated activation script will
contain the blocks serialized such that the dependencies are
satisfied. A dependency cycle causes a failure when the configuration
is built.
Historically, the activation script has been responsible for creating
a new generation of the `home-manager` Nix profile. The more modern
way, however, is to let the _activation driver_ that is, the
software calling the activation script manage the profile. Indeed,
in some cases we may not have a `home-manager` profile at all! This is
the case when Home Manager is used as a NixOS or nix-darwin module, in
these cases the system profile will contain references to the
corresponding Home Manager configurations.
Note, to maintain backwards compatibility, the old activation script
behavior is still the default. To choose the new mode of operation you
have to call the activation script with the command line option
`--driver-version 1`. The old behavior is available using
`--driver-version 0`, or simply omit it entirely.
Unfortunately, driver software need to support both modes of operation
for the time being since a user may wish to activate an old generation
that contains an activation script that does not support
`--driver-version`. To determine whether support is available, check
the {file}`gen-version` file in the configuration build output root.
If the file is missing then the activation script does not support
`--driver-version`. If the file exists and contains the integer 1 or
higher, then `--driver-version 1` is supported.
-32
View File
@@ -1,32 +0,0 @@
# Introduction to Home Manager {#ch-introduction}
Home Manager is a [Nix](https://nix.dev/)-powered tool for reproducible management of the contents of users' home directories.
This includes programs, configuration files, environment variables and, well… arbitrary files.
The following example snippet of Nix code:
```nix
programs.git = {
enable = true;
userEmail = "joe@example.org";
userName = "joe";
};
```
would make available to a user the `git` executable and man pages and a configuration file `~/.config/git/config`:
```ini
[user]
email = "joe@example.org"
name = "joe"
```
Since Home Manager is implemented in Nix, it provides several benefits:
- Contents are reproducible — a home will be the exact same every time it is built, unless of course, an intentional change is made.
This also means you can have the exact same home on different hosts.
- Significantly faster and more powerful than various backup strategies.
- Unlike "dotfiles" repositories, Home Manager supports specifying programs, as well as their configurations.
- Supported by <http://cache.nixos.org/>, so that you don't have to build from source.
- If you do want to build some programs from source, there is hardly a tool more useful than Nix for that, and the build instructions can be neatly integrated in your Home Manager usage.
- Infinitely composable, so that values in different configuration files and build instructions can share a source of truth.
- Connects you with the [most extensive](https://repology.org/repositories/statistics/total) and [most up-to-date](https://repology.org/repositories/statistics/newest) software package repository on earth, [Nixpkgs](https://github.com/NixOS/nixpkgs).
+1 -3
View File
@@ -1,6 +1,6 @@
# Home Manager Manual {#home-manager-manual}
## Version 26.11 (unstable)
## Version 24.05 (unstable)
```{=include=} preface
@@ -8,13 +8,11 @@ preface.md
```
```{=include=} parts
introduction.md
installation.md
usage.md
nix-flakes.md
writing-modules.md
contributing.md
internals.md
3rd-party.md
faq.md
```
+9 -30
View File
@@ -1,7 +1,7 @@
# Nix Flakes {#ch-nix-flakes}
Home Manager is compatible with [Nix
Flakes](https://wiki.nixos.org/wiki/Flakes). But please be aware that this
Flakes](https://nixos.wiki/wiki/Flakes). But please be aware that this
support is still experimental and may change in backwards
incompatible ways.
@@ -12,45 +12,24 @@ flake in three ways:
NixOS and Darwin, this is the only available choice. It is also
recommended for people on NixOS or Darwin that want to manage their
home directory independently of the system as a whole. See
[Standalone setup](nix-flakes/standalone.md#sec-flakes-standalone) for instructions on how
[Standalone setup](#sec-flakes-standalone) for instructions on how
to perform this installation.
2. As a module within a NixOS system configuration. This allows the
user profiles to be built together with the system when running
`nixos-rebuild`. See [NixOS module](nix-flakes/nixos.md#sec-flakes-nixos-module) for a
`nixos-rebuild`. See [NixOS module](#sec-flakes-nixos-module) for a
description of this setup.
3. As a module within a [nix-darwin](https://github.com/nix-darwin/nix-darwin/)
system configuration. This allows the user profiles to be built
together with the system when running `darwin-rebuild`. See
[nix-darwin module](nix-flakes/nix-darwin.md#sec-flakes-nix-darwin-module) for a
description of this setup.
Advanced users may want Home Manager's `nixpkgs` input to follow the
same Nixpkgs input as the rest of their flake. This avoids a second
Nixpkgs input and makes Home Manager use the same pinned Nixpkgs source
revision as the rest of the configuration:
``` nix
home-manager.inputs.nixpkgs.follows = "nixpkgs";
```
This removes the compatibility assumption between Home Manager and the
Nixpkgs revision in Home Manager's own lock file, so use it carefully,
especially when tracking unstable branches.
This does not by itself make Home Manager use the same `pkgs` value as
your NixOS or nix-darwin system. In NixOS and nix-darwin module setups,
`home-manager.useGlobalPkgs = true` controls that behavior by making
Home Manager modules receive the system `pkgs` value. When
`home-manager.useGlobalPkgs` is enabled, configure Nixpkgs overlays and
configuration at the system level instead of through Home Manager
`nixpkgs.*` options.
3. This allows the user profiles to be built together with the system
when running `darwin-rebuild`. See [nix-darwin
module](#sec-flakes-nix-darwin-module) for a description of this
setup.
```{=include=} sections
nix-flakes/prerequisites.md
nix-flakes/standalone.md
nix-flakes/nixos.md
nix-flakes/nix-darwin.md
nix-flakes/flake-parts.md
```
-63
View File
@@ -1,63 +0,0 @@
# flake-parts module {#sec-flakes-flake-parts-module}
When using [flake-parts](https://flake.parts) you may wish to import Home
Manager's flake module, `flakeModules.home-manager`.
```nix
{
description = "flake-parts configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs@{
flake-parts,
home-manager,
nixpkgs,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
# Import home-manager's flake module
inputs.home-manager.flakeModules.home-manager
];
flake = {
# Reusable Home Manager module.
homeModules.bash= { pkgs, ... }: {
programs.bash = {
enable = true;
shellAliases = {
ll = "ls -l";
};
};
home.packages = [ pkgs.hello ];
};
# Concrete Home Manager configuration.
homeConfigurations.alice = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
inputs.self.homeModules.bash
{
home.username = "alice";
home.homeDirectory = "/home/alice";
home.stateVersion = "25.11";
}
];
};
};
# See flake.parts for more features, such as `perSystem`
};
}
```
The flake module defines the `flake.homeModules` and `flake.homeConfigurations`
options, allowing them to be properly merged if they are defined in multiple
modules.
If you are only defining `homeModules` and/or `homeConfigurations` once in a
single module, flake-parts should work fine without importing
`flakeModules.home-manager`.
+9 -21
View File
@@ -8,10 +8,11 @@ to that of NixOS. The `flake.nix` would be:
description = "Darwin configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
darwin.url = "github:nix-darwin/nix-darwin";
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, ... }: {
@@ -24,8 +25,10 @@ to that of NixOS. The `flake.nix` would be:
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.jdoe = ./home.nix;
home-manager.users.jdoe = import ./home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
];
};
@@ -34,23 +37,8 @@ to that of NixOS. The `flake.nix` would be:
}
```
Use `home-manager.extraSpecialArgs` to pass arguments from your flake to
`home.nix` and any imported Home Manager modules. For example, the
configuration above makes the complete `inputs` attrset available to modules,
so they can declare arguments such as `{ inputs, ... }:`.
The lower-level mechanism behind this is `_module.args`. Set
`_module.args.<name>` from inside a module only when you need to provide a
module argument from within the module graph itself. For values that originate
outside the module graph, such as flake inputs, prefer
`home-manager.extraSpecialArgs`.
Use `home-manager.sharedModules` for Home Manager modules or settings that
should be imported by every user declared in `home-manager.users`.
The Home Manager configuration is also rebuilt with the nix-darwin
generations. The rebuild command here may be
`darwin-rebuild switch --flake ~/.config/darwin`.
and it is also rebuilt with the nix-darwin generations. The rebuild
command here may be `darwin-rebuild switch --flake <flake-uri>`.
You can use the above `flake.nix` as a template in `~/.config/darwin` by
+7 -21
View File
@@ -8,8 +8,9 @@ be as follows:
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
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, ... }: {
@@ -22,8 +23,10 @@ be as follows:
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.jdoe = ./home.nix;
home-manager.users.jdoe = import ./home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
];
};
@@ -32,27 +35,10 @@ be as follows:
}
```
Use `home-manager.extraSpecialArgs` to pass arguments from your flake to
`home.nix` and any imported Home Manager modules. For example, the
configuration above makes the complete `inputs` attrset available to modules,
so they can declare arguments such as `{ inputs, ... }:`.
The lower-level mechanism behind this is `_module.args`. Set
`_module.args.<name>` from inside a module only when you need to provide a
module argument from within the module graph itself. For values that originate
outside the module graph, such as flake inputs, prefer
`home-manager.extraSpecialArgs`.
Use `home-manager.sharedModules` for Home Manager modules or settings that
should be imported by every user declared in `home-manager.users`.
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
``` shell
$ nixos-rebuild switch --flake /etc/nixos
```
`nixos-rebuild switch --flake <flake-uri>`.
You can use the above `flake.nix` as a template in `/etc/nixos` by
+7 -2
View File
@@ -8,7 +8,12 @@
and rebuild your system.
``` nix
nix.settings.experimental-features = "nix-command flakes";
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
```
- If you are not using NixOS, add the following to `nix.conf`
@@ -33,5 +38,5 @@
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 [Configuration Example](../usage/configuration.md#sec-usage-configuration) for
Manager from the flake. See [Configuration Example](#sec-usage-configuration) for
introduction about writing a Home Manager configuration.
+11 -39
View File
@@ -11,44 +11,15 @@ then to generate and activate a basic configuration run the command
$ nix run home-manager/master -- init --switch
```
For Nixpkgs or NixOS version 26.05 run
For Nixpkgs or NixOS version 23.11 run
``` shell
$ nix run home-manager/release-26.05 -- init --switch
$ nix run home-manager/release-23.11 -- init --switch
```
This will generate a `flake.nix` and a `home.nix` file in
`~/.config/home-manager`, creating the directory if it does not exist.
If you need to pass additional values from your flake to `home.nix` or any
imported Home Manager modules, use `extraSpecialArgs` in the call to
`home-manager.lib.homeManagerConfiguration`:
``` nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs = inputs@{ nixpkgs, home-manager, ... }: {
homeConfigurations.jdoe = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs; };
modules = [ ./home.nix ];
};
};
}
```
Any attribute in `extraSpecialArgs` becomes a module argument, so `home.nix`
or imported modules can declare arguments such as `{ inputs, ... }:`.
The lower-level mechanism behind this is `_module.args`. Set
`_module.args.<name>` from inside a module only when you need to provide a
module argument from within the module graph itself. For values that originate
outside the module graph, such as flake inputs, prefer `extraSpecialArgs`.
If you omit the `--switch` option then the activation will not happen.
This is useful if you want to inspect and edit the configuration before
activating it.
@@ -59,7 +30,7 @@ $ # Edit files in ~/.config/home-manager
$ nix run home-manager/$branch -- init --switch
```
Where `$branch` is one of `master` or `release-26.05`.
Where `$branch` is one of `master` or `release-23.11`.
After the initial activation has completed successfully then building
and activating your flake-based configuration is as simple as
@@ -78,13 +49,14 @@ $ home-manager switch --flake ~/hmconf
```
::: {.note}
The flake inputs are not automatically updated by Home Manager. Update
the lock file with `nix flake update` before switching if you want to
use newer input revisions.
The flake inputs are not automatically updated by Home Manager. You need
to use the standard `nix flake update` command for that.
If you only want to update specific flake inputs, name them explicitly,
for example `nix flake update nixpkgs home-manager`.
If you only want to update a single flake input, then the command
`nix flake lock --update-input <input>` can be used.
These commands assume that your current directory is the flake. If not,
pass the flake path or URI with `--flake <flake-uri>`.
You can also pass flake-related options such as `--recreate-lock-file`
or `--update-input <input>` to `home-manager` when building or
switching, and these options will be forwarded to `nix build`. See the
[NixOS Wiki page](https://nixos.wiki/wiki/Flakes) for details.
:::
+1 -4
View File
@@ -43,7 +43,7 @@ option will state the expected type, for
[programs.emacs.enable](#opt-programs.emacs.enable) you will see "Type: boolean". You
there also find information about the default value and a description of
the option. You can find the complete option documentation in
[Home Manager Configuration Options](options.md#ch-options) or directly in the terminal by running
[Home Manager Configuration Options](#ch-options) or directly in the terminal by running
``` shell
man home-configuration.nix
@@ -59,8 +59,5 @@ usage/configuration.md
usage/rollbacks.md
usage/dotfiles.md
usage/graphical.md
usage/gpu-non-nixos.md
usage/modular-services.md
usage/updating.md
usage/upgrading.md
```
+2 -2
View File
@@ -20,7 +20,7 @@ A fresh install of Home Manager will generate a minimal
# 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 = "26.05";
home.stateVersion = "23.11";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
@@ -65,7 +65,7 @@ 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 = "26.05";
home.stateVersion = "23.11";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
-133
View File
@@ -34,136 +34,3 @@ Activating checkLinkTargets
Existing file '/home/jdoe/.config/git/config' is in the way
Please move the above files and try again
```
This error is about a file that Home Manager wants to manage as a
symbolic link in your home directory. It is separate from package
profile collisions, which usually mention `installPackages` or a
`collision between .../bin/...` path. For package collisions, see
[Why is there a collision error when switching generation?](../faq/collision.md#_why_is_there_a_collision_error_when_switching_generation).
## Resolving file collisions {#sec-usage-dotfiles-collisions}
The safest resolution is to inspect the existing path, move any
settings you want Home Manager to manage into your configuration, and
remove or move the unmanaged file before switching again.
For a standalone Home Manager installation, you can ask Home Manager to
move unmanaged non-symlink paths out of the way during activation:
``` shell
home-manager switch -b backup
```
With the command above, a colliding `~/.config/git/config` is moved to
`~/.config/git/config.backup` before Home Manager links the managed
file. If the backup path already exists then activation still aborts, so
choose an extension whose backup path does not already exist.
Standalone activation can also run a custom command for each collision:
``` shell
home-manager switch -B trash-put
```
The command receives the colliding path as an argument and must move or
remove that path. If both `-B` and `-b` are set, the custom command takes
precedence; the command may still use the
`HOME_MANAGER_BACKUP_EXT` environment variable set by `-b`.
When Home Manager is used as a NixOS or nix-darwin module, configure the
corresponding module options instead of passing standalone command line
flags:
``` nix
{
home-manager.backupFileExtension = "backup";
}
```
or
``` nix
{
home-manager.backupCommand = "${pkgs.trash-cli}/bin/trash-put";
}
```
If both {option}`home-manager.backupCommand` and
{option}`home-manager.backupFileExtension` are set, the command takes
precedence. The extension is still exported to the command as
`HOME_MANAGER_BACKUP_EXT`, so the command can use it when implementing
its own backup naming. With
{option}`home-manager.backupFileExtension`, Home Manager refuses to
replace an existing backup path unless
{option}`home-manager.overwriteBackup` is enabled:
``` nix
{
home-manager.backupFileExtension = "backup";
home-manager.overwriteBackup = true;
}
```
::: {.warning}
{option}`home-manager.overwriteBackup` allows activation to clobber
existing backup files. Only enable it when those backup paths are
disposable.
:::
For individual files, many file options also support `force = true`:
``` nix
{
home.file.".config/example" = {
source = ./example;
force = true;
};
}
```
This skips the collision check for the affected target and lets Home
Manager replace the existing file or link. Use it sparingly; it can
silently delete local changes.
Backup commands and backup extensions are intended for unmanaged
non-symlink paths. If the colliding target is an unmanaged symbolic
link, move it manually or use `force = true` after checking that the
link target is safe to replace.
## Advanced file behavior {#sec-usage-dotfiles-advanced}
The notes below apply to {option}`home.file` and to options based on the
same file type, such as {option}`xdg.configFile`.
When a file source is a directory, {option}`home.file.<name>.recursive`
changes how the directory is linked. With the default `recursive =
false`, the target is one symbolic link to the source directory. With
`recursive = true`, Home Manager creates a matching directory tree and
links each leaf file into it.
Recursive directory linking has special overlap behavior. A direct
duplicate target, such as two managed files both targeting `foo`, is an
error. If a recursively linked directory provides `foo/bar` and another
managed file also targets `foo/bar`, Home Manager keeps the recursive
file by default and ignores the overlapping regular file.
The {option}`home.file.<name>.onChange` hook runs after the new files
are linked. For recursive file entries, the hook is always run, so it
should be written to be safe even when no leaf file actually changed.
Normally a path assigned to {option}`home.file.<name>.source` is copied
or linked through the Nix store. To make Home Manager create a link to a
live path outside the store, use
`config.lib.file.mkOutOfStoreSymlink`:
``` nix
{ config, ... }:
{
home.file.".config/example".source =
config.lib.file.mkOutOfStoreSymlink ./example;
}
```
This is useful when the target should follow changes to a mutable file
or directory outside the store.
-203
View File
@@ -1,203 +0,0 @@
# GPU on non-NixOS systems {#sec-usage-gpu-non-nixos}
To access the GPU, programs need access to OpenGL and Vulkan libraries. While
this works transparently on NixOS, it does not on other Linux systems. There are
two options:
1. Recommended: modify the host system slightly so that the graphics libraries
can be found where programs from Nixpkgs can find them.
2. Wrap programs from Nixpkgs in an environment which tells them where to find
graphics libraries.
The first option is very clean because the needed modifications to the host OS
are small. However, it does require root/sudo access to the system, which may
not be available. The second approach avoids that. However, it injects libraries
from Nixpkgs into the environment of wrapped programs, which can make it
impossible to launch programs of the host OS from wrapped programs.
## When sudo is available: fixing the host OS {#sec-usage-gpu-sudo}
The {option}`targets.genericLinux.gpu` module is automatically enabled whenever
the option {option}`targets.genericLinux.enable` is set (unless
[NixGL](#sec-usage-gpu-nosudo) is used instead), which is recommended for
non-NixOS Linux distributions in any case. The module can also be explicitly
enabled by setting {option}`targets.genericLinux.gpu.enable`.
This module builds a directory containing GPU libraries. When activating the
home configuration by `home-manager switch`, the host system is examined: for
compatibility with NixOS, these libraries need to be placed in
`/run/opengl-driver`. If this directory does not exist, or contains a different
set of libraries, the activation script will print a warning such as
```text
Activating checkExistingGpuDrivers
GPU drivers require an update, run
sudo /nix/store/HASH-non-nixos-gpu/bin/non-nixos-gpu-setup
```
Because the `/run` directory is volatile and disappears on reboot, libraries
cannot be simply copied or linked there. The `non-nixos-gpu-setup` script
installs a
[`tmpfiles.d`](https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html)
config which ensures that the drivers are linked to `/run/opengl-driver` on
boot. Home Manager will always check and warn you when this setup needs to be
refreshed.
If you ever wish to uninstall these drivers, all you need to do is
```sh
sudo rm /run/opengl-driver
sudo rm /etc/tmpfiles.d/non-nixos-gpu.conf
```
### GPU offloading {#sec-usage-gpu-offloading}
You can use the {option}`targets.genericLinux.nixGL.prime.installScript` option.
It installs the `prime-offload` script which is configured through options under
{option}`targets.genericLinux.nixGL.prime`. This functionality is independent
from the rest of NixGL and can be used when
{option}`targets.genericLinux.nixGL.packages` is left `null`, which it should be
when using drivers from `/run/opengl-driver`.
### Nvidia drivers {#sec-usage-gpu-nvidia}
If you need to include the proprietary Nvidia drivers, the process is a bit more
involved. You need to:
1. Determine the exact version used by the host system. Example: `550.163.01`
1. Fetch that version of the drivers from Nvidia and calculate their hash.
Example:
```sh
nix store prefetch-file \
https://download.nvidia.com/XFree86/Linux-x86_64/550.163.01/NVIDIA-Linux-x86_64-550.163.01.run
```
Attention: the version and architecture are present twice. If you are on an
ARM system, replace `x86_64` with `aarch64`.
1. Put this information into your home configuration. Example:
```nix
targets.genericLinux.gpu.nvidia = {
enable = true;
version = "550.163.01";
sha256 = "sha256-74FJ9bNFlUYBRen7+C08ku5Gc1uFYGeqlIh7l1yrmi4=";
};
```
::: {.warning}
The Nvidia driver version **must** match the host system. This means that you
must pay attention when upgrading the system and update the home configuration
as well.
:::
## No root access: wrapping programs {#sec-usage-gpu-nosudo}
The wrapping approach is facilitated by
[NixGL](https://github.com/nix-community/nixGL), which can be integrated into
Home Manager.
::: {.warning}
This approach can cause issues when a wrapped program from Nixpkgs executes a
program from the host. For example, Firefox from Nixpkgs must be wrapped by
NixGL in order for graphical acceleration to work. If you then download a PDF
file and open it in a PDF viewer that is not installed from Nixpkgs but is
provided by the host distribution, there may be issues. Because Firefox's
environment injects libraries from NixGL, they are inherited by the PDF viewer,
and unless they are the same or compatible version as the libraries on the host,
the viewer will not work. This problem manifests more often with Vulkan because
it needs a larger set of injected libraries than OpenGL.
The problem typically manifests with errors similar to
```text
/nix/store/HASH-gcc-12.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.31' not found
```
:::
To enable the integration, import NixGL into your home configuration, either as
a channel, or as a flake input passed via `extraSpecialArgs`. Then, set the
`targets.genericLinux.nixGL.packages` option to the package set provided by
NixGL.
Once integration is enabled, it can be used in two ways: as Nix functions for
wrapping programs installed via Home Manager, and as shell commands for running
programs installed by other means (such as `nix shell`). In either case, there
are several wrappers available. They can be broadly categorized
- by vendor: as Mesa (for Free drivers of all vendors) and Nvidia (for
Nvidia-specific proprietary drivers).
- by GPU selection: as primary and secondary (offloading).
For example, the `mesa` wrapper provides support for running programs on the
primary GPU for Intel, AMD and Nouveau drivers, while the `mesaPrime` wrapper
does the same for the secondary GPU.
**Note:** when using Nvidia wrappers together with flakes, your home
configuration will not be pure and needs to be built using `home-manager switch
--impure`. Otherwise, the build will fail, complaining about missing attribute
`currentTime`.
Wrapper functions are available under `config.lib.nixGL.wrappers`. However, it
can be more convenient to use the `config.lib.nixGL.wrap` alias, which can be
configured to use any of the wrappers. It is intended to provide a customization
point when the same home configuration is used across several machines with
different hardware. There is also the `config.lib.nixGL.wrapOffload` alias for
two-GPU systems.
Another convenience is that all wrapper functions are always available. However,
when `targets.genericLinux.nixGL.packages` option is unset, they are no-ops.
This allows them to be used even when the home configuration is used on NixOS
machines. The exception is the `prime-offload` script which ignores
`targets.genericLinux.nixGL.packages` and is installed into the environment
whenever `targets.genericLinux.nixGL.prime.installScript` is set. This script,
which can be used to start a program on a secondary GPU, does not depend on
NixGL and is useful on NixOS systems as well.
Below is an abbreviated example for an Optimus laptop that makes use of both
Mesa and Nvidia wrappers, where the latter is used in dGPU offloading mode. It
demonstrates how to wrap `mpv` to run on the integrated Intel GPU, wrap FreeCAD
to run on the Nvidia dGPU, and how to install the wrapper scripts. It also wraps
Xonotic to run on the dGPU, but uses the wrapper function directly for
demonstration purposes.
```nix
{ config, lib, pkgs, nixgl, ... }:
{
targets.genericLinux.nixGL = {
packages = nixgl.packages;
defaultWrapper = "mesa";
offloadWrapper = "nvidiaPrime";
installScripts = [ "mesa" "nvidiaPrime" ];
};
programs.mpv = {
enable = true;
package = config.lib.nixGL.wrap pkgs.mpv;
};
home.packages = [
(config.lib.nixGL.wrapOffload pkgs.freecad)
(config.lib.nixGL.wrappers.nvidiaPrime pkgs.xonotic)
];
}
```
The above example assumes a flake-based setup where `nixgl` was passed from the
flake. When using channels, the example would instead begin with
```nix
{ config, lib, pkgs, ... }:
{
targets.genericLinux.nixGL.packages = import <nixgl> { inherit pkgs; };
# The rest is the same as above
...
```
-119
View File
@@ -1,119 +0,0 @@
# Modular Services {#sec-usage-modular-services}
Home Manager supports nixpkgs
[modular services](https://nixos.org/manual/nixos/unstable/#modular-services)
under [](#opt-home.services). This is the Home Manager analog to the
NixOS `system.services` namespace: each entry is an abstract service
sourced from `<nixpkgs/lib/services/lib.nix>` with the upstream portable
systemd module loaded into it, so service modules shipped with packages
(e.g. `pkgs.<name>.passthru.services.default`) drop in unchanged --
the same module evaluates on NixOS and on Home Manager.
A minimal example -- run mpd as a user service:
```nix
{ pkgs, ... }: {
home.services.mpd = {
process.argv = [ "${pkgs.mpd}/bin/mpd" "--no-daemon" ];
};
}
```
This produces `~/.config/systemd/user/mpd.service` with `ExecStart` set
to the mpd binary and `WantedBy=default.target`.
Each service exposes the upstream NixOS-style schema: [`process.argv`],
`systemd.lib`, `systemd.mainExecStart`, `systemd.service`,
`systemd.services`, `systemd.sockets`. Lifted units are translated from
NixOS-style attrs (`wantedBy`, `serviceConfig`, `unitConfig`,
`environment`, ...) into the section-based INI shape
(`{ Unit; Service; Install; }`) that Home Manager's
[](#opt-systemd.user.services) consumes. Only common keys are mapped
explicitly; uncommon options remain reachable via `unitConfig`,
`serviceConfig`, or `socketConfig`.
Sub-services (nested `services.<sub>` inside another service) and their
units are dashed under the parent service name. The empty unit key
`""` denotes the service's *primary* unit (lifted to a unit named
after the service itself); [`process.argv`] becomes the default
`ExecStart` for that unit, which defaults to `WantedBy=default.target`.
## Reusing upstream package modules {#sec-usage-modular-services-upstream}
Modular services exposed by packages under
`pkgs.<name>.passthru.services.default` can be imported directly.
For example, `pkgs.php`'s [`php-fpm`]:
```nix
{ pkgs, ... }: {
home.services."php-fpm" = {
imports = [ pkgs.php.passthru.services.default ];
configData."php-fpm.conf".source = builtins.elemAt config.home.services.php-fpm.process.argv 2;
php-fpm.settings.mypool = {
listen = "127.0.0.1:9000";
# FIXME: required by upstream modular service, but ignored when run as user
"user" = "";
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
};
};
}
```
Some packages ship modules written for system services that include
directives the user-session manager cannot honour (`DynamicUser`,
`AmbientCapabilities`, ...). The unit is still generated with those
directives -- user systemd silently ignores what it cannot apply.
`WantedBy=multi-user.target` is automatically normalized to
`WantedBy=default.target`. Other directives can be overridden per
service:
```nix
home.services."tunnel" = {
imports = [ pkgs.ghostunnel.passthru.services.default ];
# ...
systemd.services."tunnel".serviceConfig.DynamicUser = lib.mkForce false;
};
```
## Configuration data {#sec-usage-modular-services-configdata}
Each service can declare configuration files via `configData.<name>`.
These are materialized at `$XDG_CONFIG_HOME/home-services/<service>/<name>`
(mirroring how NixOS lifts `configData` to `environment.etc`), with the
absolute path injected back into `configData.<name>.path` so the service
can refer to its files at a stable location:
```nix
{ config, ... }:
{
home.services.demo = {
process.argv = [ "/bin/myapp" "--config" config.home.services.demo.configData."app.toml".path ];
configData."app.toml".text = ''
port = 1234
'';
};
}
```
The store paths of all enabled `configData` entries are automatically
added to the primary unit's `X-Reload-Triggers`, so `home-manager switch`
restarts the service whenever any of its configuration files change. To
reload instead of restart, override `X-SwitchMethod`:
```nix
home.services.demo.systemd.services."".unitConfig.X-SwitchMethod = "reload";
```
## Scope notes {#sec-usage-modular-services-scope}
Home Manager mirrors the surface of nixpkgs' portable systemd module:
services and sockets only. Other unit kinds Home Manager supports
natively under [](#opt-systemd.user.services) (timers, paths, mounts, ...)
are intentionally not modeled on `home.services` until upstream grows them,
to keep both surfaces aligned.
[`process.argv`]: https://nixos.org/manual/nixos/unstable/#service-opt-process.argv
[`php-fpm`]: https://nixos.org/manual/nixos/stable/options#opt-_imports_=___pkgs.php.services.default___
+23 -36
View File
@@ -1,45 +1,32 @@
# Rollbacks {#sec-usage-rollbacks}
When you perform a `home-manager switch` and discover a problem then
it is possible to _roll back_ to the previous version of your
configuration using `home-manager switch --rollback`. This will turn
the previous configuration into the current configuration.
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
::: {.example #ex-rollback-scenario}
### Home Manager Rollback
1. Run `home-manager generations` to determine which generation you
wish to rollback to:
Imagine you have just updated Nixpkgs and switched to a new Home
Manager configuration. You discover that a package update included in
your new configuration has a bug that was not present in the previous
configuration.
``` shell
$ home-manager generations
2018-01-04 11:56 : id 765 -> /nix/store/kahm1rxk77mnvd2l8pfvd4jkkffk5ijk-home-manager-generation
2018-01-03 10:29 : id 764 -> /nix/store/2wsmsliqr5yynqkdyjzb1y57pr5q2lsj-home-manager-generation
2018-01-01 12:21 : id 763 -> /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
2017-12-29 21:03 : id 762 -> /nix/store/6c0k1r03fxckql4vgqcn9ccb616ynb94-home-manager-generation
2017-12-25 18:51 : id 761 -> /nix/store/czc5y6vi1rvnkfv83cs3rn84jarcgsgh-home-manager-generation
```
You can then run `home-manager switch --rollback` to recover your
previous configuration, which includes the working version of the
package.
2. Copy the Nix store path of the generation you chose, e.g.,
To see what happened above we can observe the list of Home Manager
generations before and after the rollback:
/nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
``` shell
$ home-manager generations
2024-01-04 11:56 : id 765 -> /nix/store/kahm1rxk77mnvd2l8pfvd4jkkffk5ijk-home-manager-generation (current)
2024-01-03 10:29 : id 764 -> /nix/store/2wsmsliqr5yynqkdyjzb1y57pr5q2lsj-home-manager-generation
2024-01-01 12:21 : id 763 -> /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
2023-12-29 21:03 : id 762 -> /nix/store/6c0k1r03fxckql4vgqcn9ccb616ynb94-home-manager-generation
2023-12-25 18:51 : id 761 -> /nix/store/czc5y6vi1rvnkfv83cs3rn84jarcgsgh-home-manager-generation
for generation 763.
$ home-manager switch --rollback
Starting home manager activation
3. Run the `activate` script inside the copied store path:
$ home-manager generations
2024-01-04 11:56 : id 765 -> /nix/store/kahm1rxk77mnvd2l8pfvd4jkkffk5ijk-home-manager-generation
2024-01-03 10:29 : id 764 -> /nix/store/2wsmsliqr5yynqkdyjzb1y57pr5q2lsj-home-manager-generation (current)
2024-01-01 12:21 : id 763 -> /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
2023-12-29 21:03 : id 762 -> /nix/store/6c0k1r03fxckql4vgqcn9ccb616ynb94-home-manager-generation
2023-12-25 18:51 : id 761 -> /nix/store/czc5y6vi1rvnkfv83cs3rn84jarcgsgh-home-manager-generation
```
:::
``` shell
$ /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation/activate
Starting home manager activation
```
+3 -75
View File
@@ -1,64 +1,8 @@
# Updating {#sec-updating}
Updating means moving to a newer revision of the Home Manager branch
that your configuration already follows. For example, a configuration
using `release-25.11` can update to a newer revision of `release-25.11`
without changing release branches.
If you want to move from one release branch to another, such as
`release-25.05` to `release-25.11`, or between a release branch and
`master`, see
[Upgrading to a new Home Manager release](upgrading.md#sec-upgrade-release).
## Flake-Based Configurations {#sec-updating-flakes}
Flake inputs are pinned in `flake.lock`, and Home Manager will keep using
the pinned revisions until you update that lock file.
To update all inputs in the flake:
``` shell
$ nix flake update
```
To update only specific inputs, name them explicitly:
``` shell
$ nix flake update home-manager nixpkgs
```
These commands assume that your current directory is the flake. If not,
pass the flake path or URI with `--flake <flake-uri>`.
After updating the lock file, rebuild with the command for your
installation method.
For a standalone Home Manager flake:
``` shell
$ home-manager switch --flake .
```
For Home Manager as a NixOS module:
``` shell
$ sudo nixos-rebuild switch --flake .
```
For Home Manager as a nix-darwin module:
``` shell
$ darwin-rebuild switch --flake .
```
## Channel-Based Configurations {#sec-updating-channels}
Channels are mutable references outside the Home Manager configuration
itself. Updating a channel moves it to a newer revision of the same
channel or branch.
For a standalone Home Manager channel installation, update the user's
channels and then switch:
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.
``` shell
$ nix-channel --update
@@ -66,19 +10,3 @@ $ nix-channel --update
unpacking channels...
$ home-manager switch
```
For Home Manager as a NixOS module, update the root user's Home Manager
channel and rebuild the system:
``` shell
$ sudo nix-channel --update home-manager
$ sudo nixos-rebuild switch
```
For Home Manager as a nix-darwin module, update the Home Manager channel
used by your nix-darwin configuration and rebuild the system:
``` shell
$ nix-channel --update home-manager
$ darwin-rebuild switch
```
-202
View File
@@ -1,202 +0,0 @@
# Upgrading to a new Home Manager release {#sec-upgrade-release}
## Overview {#sec-upgrade-release-overview}
When moving your configuration to a new Nixpkgs release branch, you
should also move Home Manager to the matching release branch. On NixOS
this usually means upgrading Home Manager together with NixOS. On
standalone and nix-darwin installations, match Home Manager to the
Nixpkgs branch used by your configuration. The examples below use 25.11;
replace this with the release branch you are upgrading to.
If your configuration follows `nixos-unstable` or `nixpkgs-unstable`,
use Home Manager's `master` branch.
## Understanding Home Manager Versioning {#sec-upgrade-release-understanding-versioning}
Home Manager follows NixOS release cycles and provides corresponding branches:
- **release-\<version\>**: Stable branch for the matching NixOS or
Nixpkgs release, such as `release-25.11`.
- **master**: Development branch (tracks nixpkgs-unstable)
:::{.note}
Use the Home Manager branch that matches the Nixpkgs branch used to
evaluate your Home Manager configuration. For stable NixOS
configurations, this is normally the same as your NixOS version.
:::
## Flake-Based Installation {#sec-upgrade-release-understanding-flake}
If you are using Home Manager with Nix flakes, update your `nixpkgs` and
`home-manager` inputs together:
```nix
{
description = "Home Manager configuration";
inputs = {
# Match the Nixpkgs branch to the release you are using.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
home-manager = {
# Match the Home Manager branch to the Nixpkgs branch above.
url = "github:nix-community/home-manager/release-25.11";
};
};
outputs = { nixpkgs, home-manager, ... }: {
homeConfigurations."yourusername" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ ./home.nix ];
};
};
}
```
For `nixos-unstable` or `nixpkgs-unstable`, use the `master` branch
instead:
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
};
};
}
```
Then update the lock file and rebuild using the command for your
installation method.
For a standalone Home Manager flake:
``` shell
$ nix flake update
$ home-manager switch --flake .
```
For Home Manager as a NixOS module:
``` shell
$ nix flake update
$ sudo nixos-rebuild switch --flake .
```
For Home Manager as a nix-darwin module:
``` shell
$ nix flake update
$ darwin-rebuild switch --flake .
```
These commands assume that your current directory is the flake. If not,
pass the flake path or URI with `--flake <flake-uri>`.
## Channel-Based Installation {#sec-upgrade-release-understanding-channel}
For a standalone channel-based installation, first verify your current
Home Manager channel:
``` shell
$ nix-channel --list
```
The entry identifies the Home Manager branch currently in use. For
example:
```
home-manager https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz
```
Update the Home Manager channel to the branch matching your Nixpkgs
release, then switch:
``` shell
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz home-manager
$ nix-channel --update
$ home-manager switch
```
When Home Manager is installed as a NixOS module with channels, update
the root user's Home Manager channel and rebuild the system:
``` shell
$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz home-manager
$ sudo nix-channel --update
$ sudo nixos-rebuild switch
```
When Home Manager is installed as a nix-darwin module with channels,
update the Home Manager channel used by your nix-darwin configuration
and rebuild the system:
``` shell
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz home-manager
$ nix-channel --update
$ darwin-rebuild switch
```
## State Version Management {#sec-upgrade-release-state-version}
:::{.warning}
Careful updating your `home.stateVersion` when upgrading Home Manager.
:::
The `stateVersion` should remain set to the Home Manager release you
first used for this home configuration.
```nix
{
# Example: if this home configuration was first created on 24.11.
home.stateVersion = "24.11";
}
```
**Why?** The `stateVersion` ensures backward compatibility and
prevents breaking changes from affecting your existing configuration.
**Remember:** Channel or flake input version is not the same as state
version. Update Home Manager, keep `home.stateVersion` unchanged, and
only change it after reading the release notes and migrating any
affected configuration.
## Troubleshooting {#sec-upgrade-release-state-troubleshooting}
### Common Issues {#sec-upgrade-release-state-troubleshooting-common-issues}
Check the [Home Manager Release Notes](../release-notes/release-notes.md#ch-release-notes) for breaking changes.
1. **Version Mismatch Warning**: If you see warnings about version
mismatches, ensure your Home Manager branch matches the Nixpkgs
branch used by your configuration. For NixOS stable releases, this
usually means matching your NixOS version.
1. **Module Changes**: Modules are constantly being updated with new
features to keep up with changes in upstream packaging or to fix
bugs and add features. If you have an unexpected change, check if
there was something noted in the release notes or news entries.
1. **Channel Not Found**: If `nix-channel --list` shows no channels,
you might be using a different installation method, such as flakes,
or Home Manager may be imported through your system configuration.
### Verification {#sec-upgrade-release-state-troubleshooting-verification}
After upgrading, verify the installation:
``` shell
$ home-manager --version
```
This should show the Home Manager version or indicate that it is using
the expected release branch.
## Additional Resources {#sec-upgrade-release-resources}
- [NixOS Stable Release Notes](https://nixos.org/manual/nixos/stable/release-notes)
- [Home Manager Release Notes](../release-notes/release-notes.md#ch-release-notes)
+1 -1
View File
@@ -4,7 +4,7 @@ Overall the basic option types are the same in Home Manager as NixOS. A
few Home Manager options, however, make use of custom types that are
worth describing in more detail. These are the option types `dagOf` and
`gvariant` that are used, for example, by
[programs.ssh.settings](#opt-programs.ssh.settings) and [dconf.settings](#opt-dconf.settings).
[programs.ssh.matchBlocks](#opt-programs.ssh.matchBlocks) and [dconf.settings](#opt-dconf.settings).
[]{#sec-option-types-dag}`hm.types.dagOf`
-231
View File
@@ -1,231 +0,0 @@
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import html
import re
import shutil
import sys
from pathlib import Path
SIMPLE_ROLES = (
"command",
"component",
"description",
"file",
"index",
"system",
"type",
)
HEADING_ANCHOR = re.compile(r"^(#{1,6}\s+)(.*)\s+\{#([^}]+)\}\s*$")
INLINE_ANCHOR = re.compile(r"\[\]\{#([^}]+)\}")
OPTION_ROLE = re.compile(r"(?<![$`])\{option\}`([^`]*)`")
SIMPLE_ROLE = re.compile(r"(?<![$`])\{(" + "|".join(SIMPLE_ROLES) + r")\}`([^`]*)`")
OPTION_LINK = re.compile(
r"\[(?P<label>[^\]]*)\]\(#(?P<anchor>(?:opt|nixos-opt|nix-darwin-opt)-[^)]+)\)"
)
LEFTOVER_ROLE = re.compile(
r"(?<![$`])\{(" + "|".join(("option", *SIMPLE_ROLES)) + r")\}`[^`]*`"
)
FENCE = re.compile(r"^\s*(`{3,})(.*)$")
FENCE_CLOSE = re.compile(r"^\s*`{3,}\s*$")
ADMONITION_OPEN = re.compile(r"^\s*:::\s*\{\.(note|warning|example)\}\s*$")
ADMONITION_CLOSE = re.compile(r"^\s*:::\s*$")
DEEP_SPLIT_NAMESPACES = {"programs", "services"}
def option_target(anchor: str, current_file: Path, base_depth: int) -> str:
if anchor.startswith("nix-darwin-opt-"):
option = anchor.removeprefix("nix-darwin-opt-")
option = option.replace("<", "_").replace(">", "_")
anchor = f"nix-darwin-opt-{option}"
base = "options/nix-darwin"
elif anchor.startswith("nixos-opt-"):
option = anchor.removeprefix("nixos-opt-")
option = option.replace("<", "_").replace(">", "_")
anchor = f"nixos-opt-{option}"
base = "options/nixos"
else:
option = anchor.removeprefix("opt-")
option = option.replace("<", "_").replace(">", "_")
anchor = f"opt-{option}"
base = "options/home-manager"
page_parts = option_page_parts(option)
prefix = "../" * (base_depth + len(current_file.parent.parts))
return f"{prefix}{base}/{'/'.join(page_parts)}.md#{anchor}"
def option_page_parts(option_name: str) -> list[str]:
parts = option_name.split(".")
namespace = parts[0]
if namespace in DEEP_SPLIT_NAMESPACES and len(parts) > 1:
return parts[:2]
return [namespace]
def option_label(anchor: str) -> str:
if anchor.startswith("nix-darwin-opt-"):
return anchor.removeprefix("nix-darwin-opt-")
if anchor.startswith("nixos-opt-"):
return anchor.removeprefix("nixos-opt-")
return anchor.removeprefix("opt-")
def markdown_label(value: str) -> str:
return value.replace("<", "&lt;").replace(">", "&gt;")
def convert_inline(line: str, current_file: Path, base_depth: int) -> str:
line = line.replace("index.xhtml", "index.html")
line = INLINE_ANCHOR.sub(
lambda match: f'<a id="{html.escape(match.group(1), quote=True)}"></a>',
line,
)
line = OPTION_ROLE.sub(
lambda match: (
f"[{markdown_label(match.group(1))}]"
f"({option_target(f'opt-{match.group(1)}', current_file, base_depth)})"
),
line,
)
line = OPTION_LINK.sub(
lambda match: (
f"[{markdown_label(match.group('label') or option_label(match.group('anchor')))}]"
f"({option_target(match.group('anchor'), current_file, base_depth)})"
),
line,
)
return SIMPLE_ROLE.sub(lambda match: f"`{match.group(2)}`", line)
def convert_heading(line: str, current_file: Path, base_depth: int) -> str:
match = HEADING_ANCHOR.match(line)
if match is None:
return convert_inline(line, current_file, base_depth)
prefix, title, anchor = match.groups()
return (
f'<a id="{html.escape(anchor, quote=True)}"></a>\n'
f"{prefix}{convert_inline(title, current_file, base_depth)}"
)
def is_include_fence(line: str) -> tuple[bool, str]:
match = FENCE.match(line)
if match is None:
return False, ""
info = match.group(2).strip()
return info.startswith(("{=include=}", "include")), match.group(1)
def convert_markdown(
text: str,
source: Path,
current_file: Path,
base_depth: int,
) -> str:
output: list[str] = []
in_code_fence = False
code_fence = ""
in_include = False
include_fence = ""
in_admonition = False
for raw_line in text.splitlines(keepends=True):
line = raw_line[:-1] if raw_line.endswith("\n") else raw_line
newline = "\n" if raw_line.endswith("\n") else ""
if in_include:
if FENCE_CLOSE.match(line) and len(line.strip()) >= len(include_fence):
in_include = False
include_fence = ""
continue
if in_code_fence:
output.append(raw_line)
if FENCE_CLOSE.match(line) and len(line.strip()) >= len(code_fence):
in_code_fence = False
code_fence = ""
continue
include, fence = is_include_fence(line)
if include:
in_include = True
include_fence = fence
continue
fence_match = FENCE.match(line)
if fence_match is not None:
in_code_fence = True
code_fence = fence_match.group(1)
output.append(raw_line)
continue
if in_admonition:
if ADMONITION_CLOSE.match(line):
in_admonition = False
continue
converted = convert_inline(line, current_file, base_depth)
output.append(f"> {converted}{newline}" if converted else ">\n")
continue
admonition = ADMONITION_OPEN.match(line)
if admonition is not None:
in_admonition = True
output.append(f"> **{admonition.group(1).title()}**\n")
continue
output.append(convert_heading(line, current_file, base_depth) + newline)
if in_include:
raise ValueError(f"{source}: unterminated include block")
converted = "".join(output)
if LEFTOVER_ROLE.search(converted):
raise ValueError(f"{source}: unconverted NixOS-render-docs role remains")
if "```{=include=}" in converted:
raise ValueError(f"{source}: unconverted include block remains")
return converted
def convert_tree(source: Path, destination: Path, base_depth: int) -> None:
for path in source.rglob("*"):
if not path.is_file():
continue
target = destination / path.relative_to(source)
target.parent.mkdir(parents=True, exist_ok=True)
if path.suffix == ".md":
text = path.read_text(encoding="utf-8")
target.write_text(
convert_markdown(text, path, path.relative_to(source), base_depth),
encoding="utf-8",
)
else:
shutil.copy2(path, target)
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--base-depth", type=int, default=0)
parser.add_argument("source", type=Path)
parser.add_argument("destination", type=Path)
args = parser.parse_args()
if not args.source.is_dir():
print(f"missing source directory: {args.source}", file=sys.stderr)
return 1
args.destination.mkdir(parents=True, exist_ok=True)
convert_tree(args.source, args.destination, args.base_depth)
return 0
if __name__ == "__main__":
raise SystemExit(main())
-132
View File
@@ -1,132 +0,0 @@
#!/usr/bin/env python3
import html
import json
import re
import sys
from pathlib import Path
ANCHOR = re.compile(r'<a id="([^"]+)"></a>')
SPECIAL_PAGES = {
Path("manual.md"): "index.html",
Path("preface.md"): "index.html",
Path("options.md"): "options/home-manager/index.html",
Path("nixos-options.md"): "options/nixos/index.html",
Path("nix-darwin-options.md"): "options/nix-darwin/index.html",
}
OPTION_PREFIXES = {
"opt-": "options/home-manager",
"nixos-opt-": "options/nixos",
"nix-darwin-opt-": "options/nix-darwin",
}
ROUTER = """
(function () {
var h = location.hash || "", a = h.slice(1), t = __DEFAULT__;
var m = __ANCHORS__, p = __PREFIXES__;
function o(a) {
for (var k in p) {
if (a.indexOf(k) !== 0) continue;
var s = a.slice(k.length).replace(/[<>]/g, "_").split("."), q = s[0];
if ((q === "programs" || q === "services") && s.length > 1) q += "/" + s[1];
return p[k] + "/" + q + ".html";
}
return null;
}
if (a) t = Object.prototype.hasOwnProperty.call(m, a) ? m[a] : o(a) || t;
if (t === null) return;
var n = t + (location.search || "") + h;
var c = location.pathname.split("/").pop() + location.search + h;
if (n !== c) location.replace(n);
}());
""".strip()
def page_for(source, path):
relative = path.relative_to(source)
return SPECIAL_PAGES.get(relative, relative.with_suffix(".html").as_posix())
def anchors_for(source, roots):
anchors = {}
for root in roots:
files = [root] if root.is_file() else sorted(root.rglob("*.md"))
for path in files:
page = page_for(source, path)
for anchor in ANCHOR.findall(path.read_text(encoding="utf-8")):
anchors.setdefault(anchor, page)
return anchors
def script(default, anchors):
js = (
ROUTER.replace("__DEFAULT__", json.dumps(default))
.replace(
"__ANCHORS__", json.dumps(anchors, sort_keys=True, separators=(",", ":"))
)
.replace("__PREFIXES__", json.dumps(OPTION_PREFIXES, separators=(",", ":")))
)
return "\n".join(
[
" <script>",
" //<![CDATA[",
*[f" {line}" for line in js.splitlines()],
" //]]>",
" </script>",
]
)
def write_redirect(output, name, destination, anchors=None):
escaped = html.escape(destination, quote=True)
(output / name).write_text(
f"""<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
{script(destination, anchors or {})}
<meta http-equiv="refresh" content="0; url={escaped}" />
<link rel="canonical" href="{escaped}" />
<title>Redirecting...</title>
</head>
<body>
<p>Redirecting to <a href="{escaped}">{escaped}</a>.</p>
</body>
</html>
""",
encoding="utf-8",
)
def inject_root_router(output, anchors):
index = output / "index.html"
text = index.read_text(encoding="utf-8")
index.write_text(text.replace("<head>", f"<head>\n{script(None, anchors)}", 1))
def main():
source, output = map(Path, sys.argv[1:])
manual_roots = [
path
for path in source.iterdir()
if path.name != "options" and (path.is_dir() or path.suffix == ".md")
]
manual_anchors = anchors_for(source, manual_roots)
release_anchors = anchors_for(source, [source / "release-notes"])
inject_root_router(output, manual_anchors)
for name, destination, anchors in [
("index.xhtml", "index.html", manual_anchors),
("options.html", "options/home-manager/index.html", {}),
("options.xhtml", "options/home-manager/index.html", {}),
("nixos-options.xhtml", "options/nixos/index.html", {}),
("nix-darwin-options.xhtml", "options/nix-darwin/index.html", {}),
("release-notes.xhtml", "release-notes/release-notes.html", release_anchors),
]:
write_redirect(output, name, destination, anchors)
if __name__ == "__main__":
main()
-23
View File
@@ -1,23 +0,0 @@
{
pkgs,
optionDocs,
manpageUrls,
revision,
}:
pkgs.runCommand "home-manager-mdbook-options"
{
nativeBuildInputs = [
pkgs.buildPackages.nixos-render-docs
pkgs.buildPackages.python3
];
optionDocsJson = builtins.toJSON optionDocs;
passAsFile = [ "optionDocsJson" ];
}
''
python3 ${./render-options.py} \
"$optionDocsJsonPath" \
${manpageUrls} \
${revision} \
"$out"
''
-221
View File
@@ -1,221 +0,0 @@
#!/usr/bin/env python3
from __future__ import annotations
import json
import re
import subprocess
import sys
from pathlib import Path
OPTION_LINK = re.compile(
r"\[(?P<label>[^\]]*)\]\(#(?P<anchor>(?:opt|nixos-opt|nix-darwin-opt)-[^)]+)\)"
)
OPTION_HREF = re.compile(r'href="#(?P<anchor>(?:opt|nixos-opt|nix-darwin-opt)-[^"]+)"')
DEEP_SPLIT_NAMESPACES = {"programs", "services"}
def option_label(anchor: str) -> str:
if anchor.startswith("nix-darwin-opt-"):
return anchor.removeprefix("nix-darwin-opt-")
if anchor.startswith("nixos-opt-"):
return anchor.removeprefix("nixos-opt-")
return anchor.removeprefix("opt-")
def option_target(anchor: str, current_file: Path) -> str:
if anchor.startswith("nix-darwin-opt-"):
option = anchor.removeprefix("nix-darwin-opt-")
base = "options/nix-darwin"
elif anchor.startswith("nixos-opt-"):
option = anchor.removeprefix("nixos-opt-")
base = "options/nixos"
else:
option = anchor.removeprefix("opt-")
base = "options/home-manager"
page_parts = option_page_parts(option)
prefix = "../" * len(current_file.parent.parts)
return f"{prefix}{base}/{'/'.join(page_parts)}.md#{anchor}"
def rewrite_option_links(text: str, current_file: Path) -> str:
text = OPTION_LINK.sub(
lambda match: (
f"[{match.group('label') or option_label(match.group('anchor'))}]"
f"({option_target(match.group('anchor'), current_file)})"
),
text,
)
return OPTION_HREF.sub(
lambda match: f'href="{option_target(match.group("anchor"), current_file)}"',
text,
)
def namespace_for(option_name: str) -> str:
return option_name.split(".", 1)[0]
def option_page_parts(option_name: str) -> list[str]:
parts = option_name.split(".")
namespace = parts[0]
if namespace in DEEP_SPLIT_NAMESPACES and len(parts) > 1:
return parts[:2]
return [namespace]
def option_group_for(option_name: str) -> str:
return "/".join(option_page_parts(option_name))
def render_namespace(
options: dict[str, object],
destination: Path,
manpage_urls: Path,
revision: str,
anchor_prefix: str,
current_file: Path,
) -> None:
destination.parent.mkdir(parents=True, exist_ok=True)
source = destination.with_suffix(".json")
source.write_text(json.dumps(options, sort_keys=True), encoding="utf-8")
subprocess.run(
[
"nixos-render-docs",
"options",
"commonmark",
"--manpage-urls",
str(manpage_urls),
"--revision",
revision,
"--anchor-style",
"legacy",
"--anchor-prefix",
anchor_prefix,
str(source),
str(destination),
],
check=True,
)
source.unlink()
destination.write_text(
rewrite_option_links(destination.read_text(encoding="utf-8"), current_file),
encoding="utf-8",
)
def write_doc(
name: str,
doc: dict[str, str],
manpage_urls: Path,
revision: str,
output: Path,
) -> None:
options_json = Path(doc["json"]) / "share/doc/nixos/options.json"
options = json.loads(options_json.read_text(encoding="utf-8"))
grouped: dict[str, dict[str, object]] = {}
for option_name, option in options.items():
group = option_group_for(option_name)
grouped.setdefault(group, {})[option_name] = option
doc_dir = output / "options" / doc["path"]
doc_dir.mkdir(parents=True, exist_ok=True)
groups = sorted(grouped)
namespaces = sorted({group.split("/", 1)[0] for group in groups})
nested = {
namespace: sorted(
group for group in groups if group.startswith(f"{namespace}/")
)
for namespace in namespaces
}
index = [
f"# {doc['title']}\n",
"\n",
"Generated from Home Manager option definitions.\n",
"\n",
"## Namespaces\n",
"\n",
]
for namespace in namespaces:
if nested[namespace]:
index.append(f"- [{namespace}]({namespace}/index.md)\n")
else:
index.append(f"- [{namespace}]({namespace}.md)\n")
(doc_dir / "index.md").write_text("".join(index), encoding="utf-8")
summary_dir = output / "summary"
summary_dir.mkdir(parents=True, exist_ok=True)
summary = [f" - [{doc['title']}](options/{doc['path']}/index.md)\n"]
for namespace in namespaces:
if nested[namespace]:
namespace_index = doc_dir / namespace / "index.md"
namespace_index.parent.mkdir(parents=True, exist_ok=True)
namespace_index.write_text(
"".join(
[
f"# {namespace}\n",
"\n",
"## Modules\n",
"\n",
*(
f"- [{group.split('/', 1)[1]}]({group.split('/', 1)[1]}.md)\n"
for group in nested[namespace]
),
]
),
encoding="utf-8",
)
summary.append(
f" - [{namespace}](options/{doc['path']}/{namespace}/index.md)\n"
)
for group in nested[namespace]:
module_name = group.split("/", 1)[1]
summary.append(
f" - [{module_name}](options/{doc['path']}/{namespace}/{module_name}.md)\n"
)
else:
summary.append(
f" - [{namespace}](options/{doc['path']}/{namespace}.md)\n"
)
for group in groups:
page = doc_dir / f"{group}.md"
current_file = Path("options") / doc["path"] / f"{group}.md"
render_namespace(
grouped[group],
page,
manpage_urls,
revision,
doc["prefix"],
current_file,
)
(summary_dir / f"{name}.md").write_text("".join(summary), encoding="utf-8")
def main() -> int:
if len(sys.argv) != 5:
print(
"usage: render-options.py OPTION_DOCS MANPAGE_URLS REVISION OUT",
file=sys.stderr,
)
return 1
option_docs = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))
manpage_urls = Path(sys.argv[2])
revision = sys.argv[3]
output = Path(sys.argv[4])
for name, doc in option_docs.items():
write_doc(name, doc, manpage_urls, revision, output)
return 0
if __name__ == "__main__":
raise SystemExit(main())
-32
View File
@@ -1,32 +0,0 @@
#!/usr/bin/env python3
from __future__ import annotations
import sys
from pathlib import Path
def main() -> int:
if len(sys.argv) != 5:
print(
"usage: substitute-summary.py SUMMARY HM_SUMMARY NIXOS_SUMMARY DARWIN_SUMMARY",
file=sys.stderr,
)
return 1
summary = Path(sys.argv[1])
replacements = {
"@HOME_MANAGER_OPTIONS@": Path(sys.argv[2]).read_text(encoding="utf-8"),
"@NIXOS_OPTIONS@": Path(sys.argv[3]).read_text(encoding="utf-8"),
"@NIX_DARWIN_OPTIONS@": Path(sys.argv[4]).read_text(encoding="utf-8"),
}
text = summary.read_text(encoding="utf-8")
for needle, replacement in replacements.items():
text = text.replace(needle, replacement.rstrip())
summary.write_text(text, encoding="utf-8")
return 0
if __name__ == "__main__":
raise SystemExit(main())
-15
View File
@@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Redirecting&hellip;</title>
<meta charset="utf-8">
<link rel="canonical" href="options.xhtml">
<noscript><meta http-equiv="refresh" content="0; url=options.xhtml"></noscript>
</head>
<body>
<h1>Redirecting&hellip;</h1>
<script>
window.location.href = "options.xhtml" + (window.location.search || "") + (window.location.hash || "");
</script>
</body>
</html>
+2 -7
View File
@@ -1,14 +1,9 @@
# Release Notes {#ch-release-notes}
This section lists the release notes for stable versions of Home Manager and the
current unstable version.
This section lists the release notes for stable versions of Home Manager
and the current unstable version.
```{=include=} chapters
rl-2611.md
rl-2605.md
rl-2511.md
rl-2505.md
rl-2411.md
rl-2405.md
rl-2311.md
rl-2305.md
+1 -1
View File
@@ -71,7 +71,7 @@ This release has the following notable changes:
no longer packages compton, and instead packages the (mostly)
compatible fork called picom.
- The list form of the `programs.ssh.matchBlocks` option has
- The list form of the [programs.ssh.matchBlocks](#opt-programs.ssh.matchBlocks) option has
been deprecated and configurations requiring match blocks in a
defined order should switch to using DAG entries instead. For
example, a configuration
+1 -7
View File
@@ -36,7 +36,7 @@ This release has the following notable changes:
optionally also activate it. The recommended installation method for
a standalone Home Manager setup with Nix flakes uses this new
command. The standard installation method remains the same but uses
the new command internally. See [sec-flakes-standalone](../nix-flakes/standalone.md#sec-flakes-standalone) for
the new command internally. See [sec-flakes-standalone](#sec-flakes-standalone) for
more.
## State Version Changes {#sec-release-23.05-state-version-changes}
@@ -57,9 +57,3 @@ changes are only active if the `home.stateVersion` option is set to
now default to `true` which is consistent with the default values
for those options used by `i3` and `sway`.
- The [](#opt-programs.swaylock.enable) option now defaults to `false`
and must be explicitly enabled. Previously, it would be implicitly
enabled when `programs.swaylock.settings` was non-empty. Users with
`home.stateVersion` set to earlier versions will continue to get the
old implicit behavior.
+3 -75
View File
@@ -1,6 +1,7 @@
# Release 24.05 {#sec-release-24.05}
The 24.05 release branch became stable in May, 2024.
This is the current unstable branch and the information in this section
is therefore not final.
## Highlights {#sec-release-24.05-highlights}
@@ -9,83 +10,10 @@ This release has the following notable changes:
- The `.release` file in the Home Manager project root has been
removed. Please use the `release.json` file instead.
- The {command}`home-manager uninstall` command has been reworked to,
hopefully, be more robust. The new implementation makes use of a new
Boolean configuration option [uninstall](#opt-uninstall) that can
also be used in a pure Nix Flake setup.
Specifically, if you are using a Flake only installation, then you
can clean up a Home Manager installation by adding
``` nix
uninstall = true;
```
to your existing configuration and then build and activate. This
will override any other configuration and cause, for example, the
removal of all managed files.
Please be very careful when enabling this option since activating
the built configuration will not only remove the managed files but
_all_ Home Manager state from your user environment. This includes
removing all your historic Home Manager generations!
- The use of `$DRY_RUN_CMD` and `$DRY_RUN_NULL` in activation script
blocks is now deprecated. Instead use the new shell function
{command}`run`. In most cases it is sufficient to replace
`$DRY_RUN_CMD` by {command}`run`. For example, if your configuration
currently contains
```nix
home.activation.reportChanges = config.lib.dag.entryAnywhere ''
if [[ -v oldGenPath ]]; then
$DRY_RUN_CMD nix store diff-closures $oldGenPath $newGenPath
fi
'';
```
then you are now encouraged to change to
```nix
home.activation.reportChanges = config.lib.dag.entryAnywhere ''
if [[ -v oldGenPath ]]; then
run nix store diff-closures $oldGenPath $newGenPath
fi
'';
```
See the description of [home.activation](#opt-home.activation) for
more. The deprecated variables will continue to work for now but
their use may in the future trigger a warning message and eventually
they may be removed entirely.
- Similarly, the use of `$VERBOSE_ECHO` in activation script blocks is
deprecated. Instead use the new shell function
{command}`verboseEcho`. That is,
```nix
home.activation.doThing = config.lib.dag.entryAnywhere ''
$VERBOSE_ECHO "Doing the thing"
''
```
should now be expressed
```nix
home.activation.doThing = config.lib.dag.entryAnywhere ''
verboseEcho "Doing the thing"
''
```
See the description of [home.activation](#opt-home.activation) for
more. The deprecated variable will continue to work for now but its
use may in the future trigger a warning message and eventually it
may be removed entirely.
## State Version Changes {#sec-release-24.05-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
\"24.05\" or later.
- There was no state version change in this release.
- Nothing, yet.
-31
View File
@@ -1,31 +0,0 @@
# Release 24.11 {#sec-release-24.11}
The 24.11 release branch became stable in November, 2024.
## Highlights {#sec-release-24.11-highlights}
This release has the following notable changes:
- The swayidle module behavior has changed. Specifically, swayidle was
previously always called with a `-w` flag. This flag is now moved to
the default
[services.swayidle.extraArgs](#opt-services.swayidle.extraArgs)
value to make it optional.
Your configuration may break if you already set this option and also
rely on the flag being automatically added. To resolve this, please
add `-w` to your assignment of
[services.swayidle.extraArgs](#opt-services.swayidle.extraArgs).
- Support for Boolean values in the option
[programs.eza.icons](#opt-programs.eza.icons) is deprecated for
future removal. The new value for `true` is `"auto"`, and for
`false` it is `null`.
## State Version Changes {#sec-release-24.11-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
\"24.11\" or later.
- There was no state version change in this release.
-34
View File
@@ -1,34 +0,0 @@
# Release 25.05 {#sec-release-25.05}
The 25.05 release branch became stable in May, 2025.
## Highlights {#sec-release-25.05-highlights}
This release has the following notable changes:
- The [](#opt-systemd.user.startServices) option now defaults to
`true`, meaning that services will automatically be restarted as
needed when activating a configuration.
Further, the `"legacy"` alternative has been removed and will now
result in an evaluation error if used.
The `"suggest"` alternative will remain for a while longer but may
also be deprecated for removal in the future.
- The Home Manager test suite has been removed from the main Nix Flake
since it caused unnecessary evaluations and downloads. Instead the
tests are available through a Nix Flake file inside the `tests`
directory. See [Tests](../contributing/tests.md#sec-tests) for example commands.
## State Version Changes {#sec-release-25.05-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
\"25.05\" or later.
- The [](#opt-programs.git.signing.format) option no longer defaults to
`"openpgp"`. Users who use Git signing with GPG should explicitly set
this option to `"openpgp"` to maintain the previous behavior. Users
with `home.stateVersion` set to earlier versions will continue to get
the `"openpgp"` default for backwards compatibility.
-89
View File
@@ -1,89 +0,0 @@
# Release 25.11 {#sec-release-25.11}
The 25.11 release branch became stable in November, 2025.
## Highlights {#sec-release-25.11-highlights}
This release has the following notable changes:
- Updating the `home-manager` Nix profile inside the activation script
now deprecated. The profile update is instead the responsibility of
the software calling the activation script, such as the
`home-manager` tool.
The legacy behavior remains the default for backwards compatibility
but may emit a deprecation warning in the future and in the longer
term removed all together. If you have developed tooling that
directly call the generated activation script, then you are
encouraged to adapt to the new behavior. See the
[Activation](../internals/activation.md#sec-internals-activation) section in the manual for
details on how to call the activation script.
- The `home-manager switch` command now offers a `--rollback` option.
When given, the switch performs a rollback to the Home Manager
generation prior to the current before activating. While it was
previously possible to accomplish this by manually activating an old
generation, it always created a new profile generation. The new
behavior mirrors the behavior of `nixos-rebuild switch --rollback`.
See the [Rollbacks](../usage/rollbacks.md#sec-usage-rollbacks) section for more.
- The `home-manager switch` command now offers a
`--specialisation NAME` option. When given, the switch activates the
named specialisation. While it was previously possible to accomplish
this by manually running the specialisation `activate` script it was
quite cumbersome and always created a new profile generation. The
new behavior mirrors the behavior of `nixos-rebuild switch
--specialisation`.
- When using Home Manager as a NixOS or nix-darwin module we
previously created an unnecessary `home-manager` per-user "shadow
profile" for the user. This no longer happens. You can restore the
old behavior by adding
``` nix
home-manager.enableLegacyProfileManagement = true;
```
to your configuration. This option is likely to be deprecated in the
future.
- By default, Home Manager imports all modules, which leads to
increased evaluation time. Some users may wish to only import the
modules they actually use. To accommodate this, a new option
`home-manager.minimal` has been added. When this option is enabled,
Home Manager will only import the basic set of modules it requires
to function. Other modules will have to be enabled manually, like
this:
```nix
imports = [
"${modulesPath}/programs/fzf.nix"
];
```
This entrypoint is only recommended for advanced users, who are
comfortable maintaining a personal list of modules to import.
- The use of `services.syncthing.tray` as a Boolean option was removed
after being deprecated in 2021. You are now expected to use
[](#opt-services.syncthing.tray.enable) to enable the Syncthing tray
service.
## State Version Changes {#sec-release-25.11-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
\"25.11\" or later.
- The `programs.password-store.settings` option does not set
`{ PASSWORD_STORE_DIR = $XDG_DATA_HOME/password-store; }` anymore by its
default value. This will revert to the default behaviour of the program,
namely `$HOME/.password-store` to be used as the store path.
- On macOS, [](#opt-targets.darwin.copyApps.enable) is now enabled by
default instead of [](#opt-targets.darwin.linkApps.enable). This means
applications from `home.packages` will be copied to
`~/Applications/Home Manager Apps` rather than symlinked, making them
work properly with Spotlight. Users with `home.stateVersion` set to
earlier versions will continue to use `linkApps` by default.
-189
View File
@@ -1,189 +0,0 @@
# Release 26.05 {#sec-release-26.05}
The 26.05 release branch became stable in May, 2026.
## Highlights {#sec-release-26.05-highlights}
This release has the following notable changes:
- Home Manager now supports RFC 42-style SSH configuration through
[](#opt-programs.ssh.settings). The legacy `programs.ssh.matchBlocks` format
is deprecated and migrated automatically.
- The new `home-manager.startAsUserService` option runs user activation on
demand at login instead of doing all setup during system boot, which helps on
systems where home directories are mounted later (for example, pam_mount).
- New options were added for `services.podman.useDefaultMachine` and podman
machine management on Darwin.
- The [](#opt-programs.rclone.enable) module now supports launchd-backed config,
mount, and serve agents on Darwin. The new
`programs.rclone.remotes.<name>.serve` option can manage `rclone serve`
sidecar services on both Linux and Darwin. On non-systemd platforms,
`programs.rclone.requiresUnit` is read-only and always `null` because there is
no systemd ordering unit to depend on.
- The Syncthing credentials flow now uses `services.syncthing.guiCredentials`
instead of the removed `services.syncthing.passwordFile` option.
- Firefox extensions are now managed per-profile through the
`programs.firefox.profiles.<name>.extensions.packages` and
`programs.firefox.profiles.<name>.extensions.settings` options. The top-level
`programs.firefox.extensions = [ ... ]` list was removed; migrate it to
`programs.firefox.profiles.<name>.extensions.packages`.
- Thunderbird now supports `accounts.email.accounts.<name>.ews`, the
`outlook.office365.com-ews` account flavor, declarative language packs, and
enterprise policies. Thunderbird accounts using the `outlook.office365.com`
flavor now default IMAP and SMTP authentication to OAuth2 when the account
does not set an authentication method explicitly.
- A new `systemd.user.packages` option provides a user-level equivalent of
`systemd.packages` for installing unit files from packages.
- WezTerm now supports declarative configuration via
[](#opt-programs.wezterm.settings). Settings are expressed as a Nix attribute
set and serialized to Lua using `lib.generators.toLua`. Raw Lua expressions
such as `wezterm.font` and `wezterm.action.*` can be embedded using
`lib.generators.mkLuaInline`. The existing
[](#opt-programs.wezterm.extraConfig) option remains fully supported and can
be combined with [](#opt-programs.wezterm.settings).
- The [](#opt-programs.anki.uiScale) option now expects a value in the range
1.02.0, previously it erroneously expected values in the range `0.01.0`.
Anki sync options moved from `programs.anki.sync.*` to
`programs.anki.profiles."User 1".sync.*`, and
`programs.anki.sync.passwordFile` is migrated to
`programs.anki.profiles."User 1".sync.keyFile`.
- New [](#opt-home.services) namespace for nixpkgs
[modular services](https://nixos.org/manual/nixos/unstable/#modular-services).
Service modules shipped with packages (e.g.
`pkgs.<name>.passthru.services.default`) drop in unchanged and are lifted to
user systemd units. See [Modular Services](../usage/modular-services.md#sec-usage-modular-services) for
details.
- Dedicated modules were added for several VSCode forks (`programs.cursor`,
`programs.vscodium`, `programs.windsurf`, `programs.kiro`, and
`programs.antigravity`), built from a shared `mkVscodeModule` factory. Each
fork can now be configured independently and simultaneously. Users who
previously selected a fork by setting `programs.vscode.package` should migrate
to the matching module; the `programs.vscode.pname` option was removed.
- The AI coding-assistant modules ([](#opt-programs.claude-code.enable),
[](#opt-programs.codex.enable), and [](#opt-programs.opencode.enable)) now
share a unified `context` option for providing global instructions. The
previous per-module options (`claude-code.memory`,
`codex.custom-instructions`, and `opencode.rules`) are deprecated and migrated
automatically. MCP server configuration via `programs.mcp.servers` was also
extended to more assistant and editor modules through an
`enableMcpIntegration` option.
- The `programs.man` module was split so the man viewer can be selected through
the [](#opt-programs.man.man-db.enable) and
[](#opt-programs.man.mandoc.enable) submodules, which are mutually exclusive.
- The `programs.neovim.extraLuaConfig` option was renamed to
[](#opt-programs.neovim.initLua). Home Manager now writes generated Lua
initialization to {file}`$XDG_CONFIG_HOME/nvim/init.lua` by default. If you
manage that file outside Home Manager, set
[](#opt-programs.neovim.sideloadInitLua) to `true` to load the generated Lua
through the Neovim wrapper instead.
- A new `sshAuthSock` module manages the `SSH_AUTH_SOCK`
environment variable. It is implicitly configured by the
SSH-agent-providing modules (e.g. `services.ssh-agent`, `services.gpg-agent`).
The old `services.ssh-agent.enable{Bash,Zsh,Fish,Nushell}Integration` options
were removed; shell initialization is now provided through `sshAuthSock`.
- A new [](#opt-services.pipewire.enable) module provides client-side
configuration for PipeWire, WirePlumber, and the PulseAudio/JACK compatibility
layers. It does not install or manage the PipeWire daemon itself.
- The `services.swww` module was renamed to [](#opt-services.awww.enable)
following the upstream project rename. The `enable`, `package`, and
`extraArgs` options are migrated automatically from `services.swww.*` to
`services.awww.*`.
- Several modules dropped their freeform `extraConfig` escape hatches in favor
of RFC 42-style `settings`: `programs.aerospace.extraConfig` (and
`userSettings`) and `programs.aria2.extraConfig` were removed.
`programs.mise.settings` was renamed to `programs.mise.globalConfig.settings`.
The `programs.eww.configDir` and
`programs.eww.enable{Bash,Zsh,Fish}Integration` options were removed; use
[](#opt-programs.eww.yuckConfig) and [](#opt-programs.eww.scssConfig) for
declarative Eww config files. The `programs.niriswitcher` options were also
removed.
- Darwin integration received several behavior changes. Home Manager launchd
agents now wait for `/nix/store` before starting and use
`launchctl bootout --wait` when replacing agents. nix-darwin activations now
propagate dry-run mode into Home Manager user activations. On Darwin, Home
Manager also exports `TERMINFO_DIRS` so terminfo entries from Home
Manager-installed packages are visible to shells.
- The [](#opt-nix.assumeXdg) option was added for installations where Nix is
configured to use XDG base directories outside Home Manager. Home Manager also
detects `osConfig.nix.settings.use-xdg-base-directories` when deciding where
to place declarative channel entries.
## State Version Changes {#sec-release-26.05-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 \"26.05\" or later.
- The [](#opt-gtk.gtk4.theme) option does not mirror [](#opt-gtk.theme) by
default anymore.
- The [](#opt-programs.zsh.dotDir) option now defaults to the XDG configuration
directory (usually `~/.config/zsh`) when [](#opt-xdg.enable) is true.
- The [](#opt-programs.yazi.shellWrapperName) option now defaults to `y` instead
of `yy`.
- The [](#opt-xdg.userDirs.setSessionVariables) option now defaults to `false`
instead of `true`.
- The [](#opt-xdg.userDirs.extraConfig) option no longer accepts keys of the
form `XDG_<name>_DIR`, they should be now be just the name. For example, if
you had the key `XDG_DESKTOP_DIR` before, you should now use the key
`DESKTOP`. Home Manager 26.05 introduced a warning when the `XDG_<name>_DIR`
form is used.
- The [](#opt-programs.man.package) option now defaults to `null` on Darwin
because the GNU `man` from nixpkgs ships `apropos`/`man -k` and
`whatis`/`man -f` binaries that don't work on Darwin. Nix-installed manual
pages still work with macOS's built-in `man` via
[](#opt-home.extraOutputsToInstall).
- The options [](#opt-programs.neovim.withPython3) and
[](#opt-programs.neovim.withRuby) now default to `false` following nixpkgs.
- Neovim plugin `config` fragments are assumed to be Lua by default through
`programs.neovim.plugins.<name>.type = "lua"`, instead of the previous `viml`
default.
- On Linux, `programs.firefox.configPath` now defaults to
`"${config.xdg.configHome}/mozilla/firefox"`, instead of the legacy
`".mozilla/firefox"`.
- The [](#opt-wayland.windowManager.hyprland.configType) option now defaults to
`"lua"`, instead of the legacy `"hyprlang"`. Set
`wayland.windowManager.hyprland.configType = "hyprlang"` to keep generating
{file}`$XDG_CONFIG_HOME/hypr/hyprland.conf`.
- The [](#opt-programs.docker-cli.configDir) option now defaults to
`"${config.xdg.configHome}/docker"` when [](#opt-xdg.enable) is true, instead
of `~/.docker`. Similarly, [](#opt-services.colima.profiles) now sets
`$DOCKER_HOST` for the default context.
- The [](#opt-services.home-manager.autoUpgrade.preSwitchCommands) option now
defaults to an empty list. Previously, when
[](#opt-services.home-manager.autoUpgrade.useFlake) was `true`, it defaulted
to `[ "nix flake update" ]`. Set `preSwitchCommands = [ "nix flake update" ]`
to keep updating flake inputs before each automatic switch.
- The [](#opt-programs.mergiraf.enableGitIntegration) and
[](#opt-programs.mergiraf.enableJujutsuIntegration) options now default to
`false`, so the integrations must be enabled explicitly.
-35
View File
@@ -1,35 +0,0 @@
# Release 26.11 {#sec-release-26.11}
This is the current unstable branch and the information in this
section is therefore not final.
## Highlights {#sec-release-26.11-highlights}
This release has the following notable changes:
- The [](#opt-programs.uv.enable) module can now install uv-managed Python
versions and tools through the new `programs.uv.python.versions`,
`programs.uv.python.default`, and `programs.uv.tool.packages` options. Unpinned
entries track the latest release on each activation while pinned ones stay put,
and `programs.uv.python.prune` / `programs.uv.tool.prune` make the managed set
fully declarative by removing versions and tools that are no longer listed.
- On Darwin, Home Manager launchd agents now support
[](#opt-launchd.agents._name_.domain) to choose either the user's GUI or
background launchd domain. Agents use the GUI domain by default. Set the
domain to `user` for agents that should run without an active graphical login
session.
## State Version Changes {#sec-release-26.11-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
"26.11" or later.
- The KDL options under `programs.zellij` will now correctly escape backslashes
in string values. For example, the Nix string `"\\"` will now correctly
generate the KDL string `"\\"`. Previously, this would have generated `"\"`,
which is invalid KDL. The following options are affected:
- `programs.zellij.settings`
- `programs.zellij.themes`
- `programs.zellij.layouts`
-33
View File
@@ -1,33 +0,0 @@
// Add permalink anchors to section headings.
document.addEventListener("DOMContentLoaded", function () {
var NS = "http://www.w3.org/1999/xhtml";
var headings = document.querySelectorAll("h1, h2, h3, h4");
for (var i = 0; i < headings.length; i++) {
var h = headings[i];
// Skip headings inside note/warning boxes (those h3s are icon containers).
if (h.closest("div.note") || h.closest("div.warning")) {
continue;
}
// The id may live on the heading itself or on a child <a id="...">.
var id = h.id;
if (!id) {
var child = h.querySelector("a[id]");
if (child) {
id = child.id;
}
}
if (!id) {
continue;
}
var a = document.createElementNS(NS, "a");
a.setAttribute("class", "anchor-link");
a.setAttribute("href", "#" + id);
a.setAttribute("aria-label", "Permalink");
a.textContent = "\u00B6";
h.appendChild(a);
}
});
-7
View File
File diff suppressed because one or more lines are too long
-348
View File
@@ -1,348 +0,0 @@
:root {
--nmd-color0: #0A3E68;
--nmd-color1: #268598;
--nmd-color2: #B8D09E;
--nmd-color3: #F6CF5E;
--nmd-color4: #EC733B;
--nmd-color-info: #167cb9;
--nmd-color-warn: #ff6700;
}
// Copied from Tailwind CSS.
$color-gray-50: #F9FAFB;
$color-gray-100: #F3F4F6;
$color-gray-200: #E5E7EB;
$color-gray-300: #D1D5DB;
$color-gray-400: #9CA3AF;
$color-gray-500: #6B7280;
$color-gray-600: #4B5563;
$color-gray-700: #374151;
$color-gray-800: #1F2937;
$color-gray-900: #111827;
$color-blue-50: #EFF6FF;
$color-blue-100: #DBEAFE;
$color-blue-200: #BFDBFE;
$color-blue-300: #93C5FD;
$color-blue-400: #60A5FA;
$color-blue-500: #3B82F6;
$color-blue-600: #2563EB;
$color-blue-700: #1D4ED8;
$color-blue-800: #1E40AF;
$color-blue-900: #1E3A8A;
@use 'scss-reset/reset';
@mixin boxed {
background: $color-gray-50;
margin: 2rem 16px;
padding: 10px;
border: 1px solid $color-gray-200;
border-radius: 4px;
box-shadow: 4px 4px 8px $color-gray-200;
@media (prefers-color-scheme: dark) {
background: $color-gray-800;
border-color: black;
box-shadow: 4px 4px 8px black;
}
}
@mixin margined {
margin: 0.9rem 0;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
body {
background: white;
color: $color-gray-900;
max-width: min(100ch, 1024px);
margin: 0 auto;
padding: 10px;
font-family: 'Lucida Sans', Arial, sans-serif;
font-size: 16px;
line-height: 1.4em;
@media (prefers-color-scheme: dark) {
background: $color-gray-900;
color: $color-gray-50;
}
}
h1, h2, h3, h4 {
color: var(--nmd-color0);
font-family: "Lato", sans-serif;
font-weight: 300;
line-height: 1.125;
@media (prefers-color-scheme: dark) {
color: var(--nmd-color4);
}
}
h1 {
font-size: 48px;
font-weight: 300;
margin: 4rem 0 1.5rem;
}
h2 {
font-size: 32px;
font-weight: 300;
margin: 2rem 0 1rem;
}
h3 {
font-size: 20px;
font-weight: 400;
margin: 0.5rem 0.25rem;
}
h4 {
font-weight: 400;
margin: 0.5rem 0.25rem;
}
// Permalink anchor shown on heading hover.
.anchor-link {
opacity: 0;
font-size: 0.65em;
margin-left: 0.3em;
text-decoration: none;
color: $color-gray-400;
transition: opacity 0.15s ease-in-out;
vertical-align: middle;
@media (prefers-color-scheme: dark) {
color: $color-gray-500;
}
}
h1:hover .anchor-link,
h2:hover .anchor-link,
h3:hover .anchor-link,
h4:hover .anchor-link {
opacity: 1;
}
// Never show anchors on note/warning icon headings.
div.note .anchor-link,
div.warning .anchor-link {
display: none;
}
p {
@include margined;
}
a {
color: var(--nmd-color0); //$color-secondary-1-3;
text-decoration: underline;
text-underline-offset: 3px;
&:visited {
color: var(--nmd-color1);
}
&:hover {
color: var(--nmd-color1);
}
@media (prefers-color-scheme: dark) {
color: var(--nmd-color3);
&:visited {
color: var(--nmd-color2);
}
&:hover {
color: var(--nmd-color4);
}
}
}
code {
font-size: 90%;
}
span.command {
font-size: 90%;
font-family: monospace;
}
em {
font-style: italic;
}
strong {
font-weight: bold;
}
pre {
@include boxed;
font-size: 90%;
margin-bottom: 1.5rem;
padding: 6px;
overflow: auto;
// The callout markers should not be selectable.
span img {
user-select: none;
}
}
pre:has(code) {
padding: 0;
}
td, th {
padding: 2px 5px;
&:first-child {
padding-left: 0;
}
&:last-child {
padding-right: 0;
}
}
dt {
margin: 1.2rem 0 0.8rem;
}
dd {
margin-left: 2rem;
}
div.book {
}
ul {
@include margined;
padding-left: 30px;
list-style: disc;
}
ol {
@include margined;
padding-left: 30px;
list-style: decimal;
}
li {
@include margined;
padding-left: 5px;
}
.navheader, .navfooter {
hr {
margin: 1rem 0;
background: $color-gray-200;
@media (prefers-color-scheme: dark) {
background: $color-gray-600;
}
}
a {
text-decoration: none;
}
}
div.titlepage {
margin: 40px 0;
hr {
display: none;
}
}
div.toc {
@include boxed;
a {
text-decoration: none;
}
}
div.note, div.warning {
@include boxed;
font-style: italic;
h3 {
float: right;
margin: 0 0 1rem 1rem;
width: 42px;
height: 42px;
content: url();
}
h3 + p {
margin-top: 0;
}
p {
min-height: 42px;
}
}
div.note {
h3 {
background-color: var(--nmd-color-info);
// From https://tabler-icons.io/i/info-square-rounded
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 8h.01'%3E%3C/path%3E%3Cpath d='M11 12h1v4h1'%3E%3C/path%3E%3Cpath d='M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 8h.01'%3E%3C/path%3E%3Cpath d='M11 12h1v4h1'%3E%3C/path%3E%3Cpath d='M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z'%3E%3C/path%3E%3C/svg%3E");
}
}
div.warning {
h3 {
background-color: var(--nmd-color-warn);
// From https://tabler-icons.io/i/alert-triangle
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 9v2m0 4v.01'%3E%3C/path%3E%3Cpath d='M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 9v2m0 4v.01'%3E%3C/path%3E%3Cpath d='M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75'%3E%3C/path%3E%3C/svg%3E");
}
}
.term {
font-weight: 300;
}
.docbook .xref img[src^=images\/callouts\/],
.screen img,
.programlisting img {
width: 1em;
}
.calloutlist img {
width: 1.3em;
}
/** The console prompt, e.g., `$` and `#` should not be selectable. */
.programlisting.language-shell .hljs-meta.prompt_ {
user-select: none;
}
@import 'tomorrow.min.css';
@media (prefers-color-scheme: dark) {
@import 'tomorrow-night.min.css';
}
-7
View File
@@ -1,7 +0,0 @@
/*!
Theme: Tomorrow Night
Author: Chris Kempson (http://chriskempson.com)
License: ~ MIT (or more permissive) [via base16-schemes-source]
Maintainer: @highlightjs/core-team
Version: 2021.09.0
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#ccc;background:#2d2d2d}.hljs ::selection,.hljs::selection{background-color:#515151;color:#ccc}.hljs-comment{color:#999}.hljs-tag{color:#b4b7b4}.hljs-operator,.hljs-punctuation,.hljs-subst{color:#ccc}.hljs-operator{opacity:.7}.hljs-bullet,.hljs-deletion,.hljs-name,.hljs-selector-tag,.hljs-template-variable,.hljs-variable{color:#f2777a}.hljs-attr,.hljs-link,.hljs-literal,.hljs-number,.hljs-symbol,.hljs-variable.constant_{color:#f99157}.hljs-class .hljs-title,.hljs-title,.hljs-title.class_{color:#fc6}.hljs-strong{font-weight:700;color:#fc6}.hljs-addition,.hljs-code,.hljs-string,.hljs-title.class_.inherited__{color:#9c9}.hljs-built_in,.hljs-doctag,.hljs-keyword.hljs-atrule,.hljs-quote,.hljs-regexp{color:#6cc}.hljs-attribute,.hljs-function .hljs-title,.hljs-section,.hljs-title.function_,.ruby .hljs-property{color:#69c}.diff .hljs-meta,.hljs-keyword,.hljs-template-tag,.hljs-type{color:#c9c}.hljs-emphasis{color:#c9c;font-style:italic}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-meta .hljs-string{color:#a3685a}.hljs-meta .hljs-keyword,.hljs-meta-keyword{font-weight:700}
-7
View File
@@ -1,7 +0,0 @@
/*!
Theme: Tomorrow
Author: Chris Kempson (http://chriskempson.com)
License: ~ MIT (or more permissive) [via base16-schemes-source]
Maintainer: @highlightjs/core-team
Version: 2021.09.0
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#4d4d4c;background:#fff}.hljs ::selection,.hljs::selection{background-color:#d6d6d6;color:#4d4d4c}.hljs-comment{color:#8e908c}.hljs-tag{color:#969896}.hljs-operator,.hljs-punctuation,.hljs-subst{color:#4d4d4c}.hljs-operator{opacity:.7}.hljs-bullet,.hljs-deletion,.hljs-name,.hljs-selector-tag,.hljs-template-variable,.hljs-variable{color:#c82829}.hljs-attr,.hljs-link,.hljs-literal,.hljs-number,.hljs-symbol,.hljs-variable.constant_{color:#f5871f}.hljs-class .hljs-title,.hljs-title,.hljs-title.class_{color:#eab700}.hljs-strong{font-weight:700;color:#eab700}.hljs-addition,.hljs-code,.hljs-string,.hljs-title.class_.inherited__{color:#718c00}.hljs-built_in,.hljs-doctag,.hljs-keyword.hljs-atrule,.hljs-quote,.hljs-regexp{color:#3e999f}.hljs-attribute,.hljs-function .hljs-title,.hljs-section,.hljs-title.function_,.ruby .hljs-property{color:#4271ae}.diff .hljs-meta,.hljs-keyword,.hljs-template-tag,.hljs-type{color:#8959a8}.hljs-emphasis{color:#8959a8;font-style:italic}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-meta .hljs-string{color:#a3685a}.hljs-meta .hljs-keyword,.hljs-meta-keyword{font-weight:700}
-46
View File
@@ -1,46 +0,0 @@
{
lib,
flake-parts-lib,
moduleLocation,
...
}:
let
inherit (lib)
mapAttrs
mkOption
types
;
in
{
options = {
flake = flake-parts-lib.mkSubmoduleOptions {
homeConfigurations = mkOption {
type = types.lazyAttrsOf types.raw;
default = { };
description = ''
Instantiated Home Manager configurations.
`homeConfigurations` is for specific installations. If you want to expose
reusable configurations, add them to `homeModules` in the form of modules, so
that you can reference them in this or another flake's `homeConfigurations`.
'';
};
homeModules = mkOption {
type = types.lazyAttrsOf types.deferredModule;
default = { };
apply = mapAttrs (
k: v: {
_class = "homeManager";
_file = "${toString moduleLocation}#homeModules.${k}";
imports = [ v ];
}
);
description = ''
Home Manager modules.
You may use this for reusable pieces of configuration, service modules, etc.
'';
};
};
};
}
Generated
+4 -4
View File
@@ -2,16 +2,16 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1783604885,
"narHash": "sha256-tzMgSkV7kljEkqIjlgV6F+n+xD+/a35Db8bs7a4BFAo=",
"lastModified": 1702312524,
"narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "767b0d3ec98a143ad9ed7dfc0d5553510ac27133",
"rev": "a9bf124c46ef298113270b1f84a164865987a91c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
+94 -220
View File
@@ -1,32 +1,29 @@
{
description = "Home Manager for Nix";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{
self,
nixpkgs,
...
}:
outputs = { self, nixpkgs, ... }:
{
nixosModules = rec {
home-manager = ./nixos;
home-manager = import ./nixos;
default = home-manager;
};
# deprecated in Nix 2.8
nixosModule = self.nixosModules.default;
darwinModules = rec {
home-manager = ./nix-darwin;
default = home-manager;
};
flakeModules = rec {
home-manager = ./flake-module.nix;
home-manager = import ./nix-darwin;
default = home-manager;
};
# unofficial; deprecated in Nix 2.8
darwinModule = self.darwinModules.default;
templates = {
default = self.templates.standalone;
standalone = {
path = ./templates/standalone;
description = "Standalone setup";
};
nixos = {
path = ./templates/nixos;
description = "Home Manager as a NixOS module,";
@@ -35,224 +32,101 @@
path = ./templates/nix-darwin;
description = "Home Manager as a nix-darwin module,";
};
standalone = {
path = ./templates/standalone;
description = "Standalone setup";
};
};
lib = import ./lib { inherit (nixpkgs) lib; };
}
// (
let
supportedSystems = [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
defaultTemplate = self.templates.standalone;
forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
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
forAllPkgs = forSystems nixpkgs.lib.systems.flakeExposed;
- 'configuration',
- 'username',
- 'homeDirectory'
- 'stateVersion',
- 'extraModules', and
- 'system'
forSupportedPkgs = forSystems supportedSystems;
have been removed. Instead use the arguments 'pkgs' and
'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.html#sec-release-22.11-highlights
'';
forCI = nixpkgs.lib.genAttrs [
"aarch64-darwin"
"x86_64-linux"
];
throwForRemovedArgs = v:
let
used = builtins.filter (n: (args.${n} or null) != null) [
"configuration"
"username"
"homeDirectory"
"stateVersion"
"extraModules"
"system"
];
msg = msgForRemovedArg + ''
releaseInfo = nixpkgs.lib.importJSON ./release.json;
docsFor =
pkgs:
import ./docs {
Deprecated args passed: ''
+ builtins.concatStringsSep " " used;
in lib.throwIf (used != [ ]) msg v;
in throwForRemovedArgs (import ./modules {
inherit pkgs lib check extraSpecialArgs;
configuration = { ... }: {
imports = modules
++ [{ programs.home-manager.path = toString ./.; }];
nixpkgs = {
config = nixpkgs.lib.mkDefault pkgs.config;
inherit (pkgs) overlays;
};
};
});
};
} // (let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
tests = import ./tests { inherit pkgs; };
in tests.run);
formatter = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in pkgs.linkFarm "format" [{
name = "bin/format";
path = ./format;
}]);
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
releaseInfo = nixpkgs.lib.importJSON ./release.json;
docs = import ./docs {
inherit pkgs;
inherit (releaseInfo) release isReleaseBranch;
};
hmPkg = pkgs.callPackage ./home-manager { path = toString ./.; };
testChunks =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
# Create chunked test packages for better CI parallelization
tests = import ./tests {
inherit pkgs;
enableBig = true;
};
allTests = lib.attrNames tests.build;
# Remove 'all' from the test list as it's a meta-package
filteredTests = lib.filter (name: name != "all") allTests;
# NOTE: Just a starting value, we can tweak this to find a good value.
targetTestsPerChunk = 50;
numChunks = lib.max 1 (
builtins.ceil ((builtins.length filteredTests) / (targetTestsPerChunk * 1.0))
);
chunkSize = builtins.ceil ((builtins.length filteredTests) / (numChunks * 1.0));
makeChunk =
chunkNum: testList:
let
start = (chunkNum - 1) * chunkSize;
end = lib.min (start + chunkSize) (builtins.length testList);
chunkTests = lib.sublist start (end - start) testList;
chunkAttrs = lib.genAttrs chunkTests (name: tests.build.${name});
in
pkgs.symlinkJoin {
name = "test-chunk-${toString chunkNum}";
paths = lib.attrValues chunkAttrs;
passthru.tests = chunkTests;
};
in
lib.listToAttrs (
lib.genList (
i: lib.nameValuePair "test-chunk-${toString (i + 1)}" (makeChunk (i + 1) filteredTests)
) numChunks
);
integrationTests =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
in
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux (
let
tests = import ./tests/integration { inherit pkgs lib; };
renameTestPkg = n: v: lib.nameValuePair "integration-${n}" v;
in
lib.mapAttrs' renameTestPkg (lib.removeAttrs tests [ "all" ])
);
buildTests =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
testPackages = let
tests = import ./tests { inherit pkgs; };
renameTestPkg = n: nixpkgs.lib.nameValuePair "test-${n}";
in
nixpkgs.lib.mapAttrs' renameTestPkg tests.build;
renameTestPkg = n: lib.nameValuePair "test-${n}";
in lib.mapAttrs' renameTestPkg tests.build;
in {
default = hmPkg;
home-manager = hmPkg;
buildTestsNoBig =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
tests = import ./tests {
inherit pkgs;
enableBig = false;
};
in
{
test-all-enableBig-false-enableLegacyIfd-false = tests.build.all;
};
docs-html = docs.manual.html;
docs-json = docs.options.json;
docs-manpages = docs.manPages;
} // testPackages);
buildTestsNoBigIfd =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
tests = import ./tests {
inherit pkgs;
enableBig = false;
enableLegacyIfd = true;
};
in
{
test-all-enableBig-false-enableLegacyIfd-true = tests.build.all;
};
integrationTestPackages =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
tests = import ./tests/integration { inherit pkgs lib; };
renameTestPkg = n: lib.nameValuePair "integration-test-${n}";
in
lib.mapAttrs' renameTestPkg tests;
in
{
formatter = forSupportedPkgs (pkgs: pkgs.callPackage ./home-manager/formatter.nix { });
# TODO: increase buildbot testing scope
buildbot = forCI (
system:
let
docs = docsFor nixpkgs.legacyPackages.${system};
allIntegrationTests = integrationTests system;
workingIntegrationTests = nixpkgs.lib.filterAttrs (
name: _:
nixpkgs.lib.elem name [
"integration-nixos-basics"
"integration-nixos-legacy-profile-management"
]
) allIntegrationTests;
in
(testChunks system)
// workingIntegrationTests
// {
docs-html = docs.manual.html;
docs-json = docs.options.json;
docs-jsonModuleMaintainers = docs.jsonModuleMaintainers;
docs-manpages = docs.manPages;
}
);
packages = forAllPkgs (
pkgs:
let
docs = docsFor pkgs;
hmPkg = pkgs.callPackage ./home-manager { path = "${self}"; };
in
{
default = hmPkg;
home-manager = hmPkg;
}
// nixpkgs.lib.optionalAttrs (nixpkgs.lib.elem pkgs.stdenv.hostPlatform.system supportedSystems) {
ci-parse = pkgs.callPackage ./ci/parse.nix { nix = pkgs.nixVersions.latest; };
ci-parse-lix = pkgs.callPackage ./ci/parse.nix {
nix = pkgs.lixPackageSets.latest.lix;
};
create-news-entry = pkgs.writeShellScriptBin "create-news-entry" ''
./modules/misc/news/create-news-entry.sh
'';
tests = pkgs.callPackage ./tests/package.nix {
flake = self;
inputOverrides = {
inherit nixpkgs;
};
};
docs-html = docs.manual.html;
docs-htmlOpenTool = docs.manual.htmlOpenTool;
docs-json = docs.options.json;
docs-jsonModuleMaintainers = docs.jsonModuleMaintainers;
docs-manpages = docs.manPages;
}
);
devShells = forSupportedPkgs (pkgs: {
default = pkgs.callPackage ./home-manager/devShell.nix { };
});
legacyPackages = forSupportedPkgs (
pkgs:
let
inherit (pkgs.stdenv.hostPlatform) system;
in
(buildTests system)
// (integrationTestPackages system)
// (buildTestsNoBig system)
// (buildTestsNoBigIfd system)
// (testChunks system)
// (integrationTests system)
);
}
);
defaultPackage = forAllSystems (system: self.packages.${system}.default);
});
}

Some files were not shown because too many files have changed in this diff Show More