* home-environment: add `home.sessionVariablesPackage`
Allow the `hm-session-vars.sh` derivation to be referenced from other
modules, e.g. to translate it to fish with babelfish at build time.
* fish: use babelfish for `hm-session-vars.sh`
Translate `hm-session-vars.sh` to fish at system build time,
significantly decreasing shell startup time.
Based on https://github.com/NixOS/nixpkgs/pull/108947 by @kevingriffin.
* PR_TEMPLATE: Note nix3 test method in checklist
Allows for running with the `nixpkgs` from the lock file, as well as
using a more familiar interface for users of the experimental CLI, which
would've avoided me opening #3971.
Also updates the corresponding note in `docs/contributing.adoc` to have
the correct invocation path.
* PR_TEMPLATE: `the experimental CLI` -> `Flakes`
The link to the Nix RFC 42 is invalid. Replace this with a valid link to the
upstream NixOS/rfcs repo, pinning it to the commit that introduced the RFC.
The init command is essentially the old install script but integrated
into the home-manager tool. This simplifies things slightly since we
can use the existing code infrastructure.
The init command is Nix flake aware in the sense that, if we detect
that the user's Nix setup supports flakes, then we also create an
initial `flake.nix` file.
Finally, we update the installation instructions for the Nix flakes
standalone setup to use the new init command.
Zsh completion update provided by Anund <anundm@gmail.com>.
This changes the default configuration location for Home Manager
configurations from
$XDG_CONFIG_HOME/nixpkgs
to
$XDG_CONFIG_HOME/home-manager
The old location is still supported but using it will trigger a
warning message.
Fixes#3640
Install home-manager via `nix run` rather than `nix-build` then running
the activation script out of the store manually.
Co-authored-by: Cédric Barreteau <cbarrete@users.noreply.github.com>
Internally we already managed them per-profile but exposed a global
option to maintain backwards compatibility. The benefit to having
per-profile extensions is quite large though, so it is time to switch.
Users of the global extensions option will get an error message that
indicates how to edit their configuration to work again.
This flag is useful to force Nix to re-fetch cached flakes. Without it,
you cannot deploy from a non-local flake in quick succession, since the
caching causes the flake to not be re-fetched.
- Fix paragraphs in option field texts containing Markdown.
- Fix generation of documentation for options with Markdown in
multiple fields.
- Support AsciiDoc in module option documentation.
When building from a flake, `nix build` hides the build output by
default, with a `-L`/`--print-build-logs` option to show it. Pass this
option along from `home-manager` if the user provides it.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
* flake: Expose tests to allow running purely
The existing way to run tests with `nix-shell` relies on impure usage of
`<nixpkgs>`. This can lead to failures when the local nixpkgs is
incompatible with the locked one. I.e., where CI is passing but a
contributor may experience a failure.
So, expose tests as `devShells.tests` to use the locked nixpkgs and
allow easy invocation via `nix develop`.
* tests: Remove impure path
With Nix 2.10+ and pure evaluation mode e.g.
```
nix run nixpkgs/nixos-unstable#nixVersions.nix_2_10 -- develop -i .#tests.zplug-modules
```
this test would fail with:
> error: the path '~/.customZplugHome' can not be resolved in pure mode
Since the test only cares that it is a path, rather than anything about
its contents, use a dummy empty directory.
Starting with state version 22.11 we completely reset the PATH
variable in the activation script. This is to avoid impurities and
unexpected results if the activation script accidentally uses a
command found in the user's PATH.
* broot: use freeformType for config
* broot: use defaults from upstream
closes#2395
* broot: generate shell function
* broot: add @dermetfan to CODEOWNERS
* broot: rename `config` option to `settings`
* broot: make example more idiomatic
Co-authored-by: Nicolas Berbiche <nic.berbiche@gmail.com>
Co-authored-by: Nicolas Berbiche <nic.berbiche@gmail.com>
If the user has enabled the XDG user directories module then we can
use the XDG music directory in the MPD module. Otherwise we'll leave
the option undefined so that the user is forced to define the
directory to use.
This applies to state version 22.11 and above.
Fixes#3225
- Fix name of file generated by `$ nix-build -A docs.manPages`.
- Note "Capitalize the subject line" as an exception to the seven
rules. Not even the example commit message (closely below this
change) follows this rule.
This brings a few advantages:
- Use of float instead of strings to represent float values,
- Use of structure settings, and
- Better type checking for some settings
Also add thiagokokada as codeowner of picom.
This simplifies the code a bit and avoids using experimental Flake
functionality. If Flakes become stable before NixOS 22.11 then we can
consider having nmd and nmt as Flake inputs. Maybe could then also
avoid the need for flake-compat.
Remove `stateVersion`, `username`, and `homeDirectory` as they can be
set in the configuration directly. Together with the previous commit,
this makes setting `stateVersion` explicitly mandatory.
Also replace `configuration` by `modules`, which expects a list of
Home Manager modules.
Also remove `system` which was made useless by #3028.
Currently we're maintaining a "mock" module made of sink options,
which requires updating whenever the definitions in the
nixos/nix-darwin modules change.
Instead, set `_module.check` to false so that definitions in those
modules are simply ignored.
The user should always explicitly set the state version they wish to
use. Indeed, the configuration generated by the Home Manager install
script has set this option for a long time. This removal should
therefore not affect many users.
* Add flake.lock and clean up flake.nix
Add a lockfile to work around https://github.com/NixOS/nix/issues/6541
(and because it's a good idea anyway).
Also use flake-utils, and restrict ourselves to the five platforms
supported by nixpkgs. Otherwise, the IFD for nmd fails on weird
platforms. This fixes `nix flake check`.
Remove the redundant `apps` output, see https://github.com/nix-community/home-manager/pull/2442#issuecomment-1133670487
* nixos,nix-darwin: factor out into a common module
* nixos,nix-darwin: make `home-managers.users` shallowly visible
Make sure the option is included in the NixOS/nix-darwin manual (but the
HM submodule options aren't).
Also add a static description to the HM submodule type so that we don't need to
evaluate the submodules just to build the option manual. This makes
nixos-search able to index the home-manager flake.
Also clean up some TODOs.
* flake: add nmd and nmt
This avoids having to use `pkgs.fetchFromGitLab` in an IFD, which causes
issues when indexing packages with nixos-search because `pkgs` is
instantiated with every platform.
Before enabling dconf in Home Manager, dconf must be enabled in system
config.
Otherwise it will fail like this:
```
$ home-manager switch
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating dconfSettings
error: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit dconf.service not found.
```
In the manual:
* Add chapter Nix Flakes
* Add links to sections of chapter "Using Home Manager"
In README.md:
* Remove section "Nix Flakes"
* Add manual reference at the buttom of section "Installation"
Specifically,
- include system-wide Nixpkgs channel so `NIX_PATH` solution also
works on multi-user installations;
- additionally link to Nix Discourse reply for more information on
`NIX_PATH`; and
- remove note about relog on NixOS since all the channels in
`~/.nix-defexpr/channels/` are included by default, so the Home
Manager channel should be picked up automatically.
Currently, dot directories and XDG base directories are used
inconsistently in the Home Manager option declarations. This creates
ambiguity for the user as to where the location of the file should be
albeit this is rarely encountered in practice as it is sufficient to
read upstream documentation. The rationale is to make declarations
consistent and make a clear distinction between hardcoded and modular
specifications.
References to ~/.config in relevant nixpkgs modules were untouched as
the location is hardcoded upstream[1]. Furthermore, modules of
programs which do not follow XDG specifications were also untouched.
Generalization of tilde(~) expansions to $HOME were also considered,
however there isn't sufficient rationale despite the use of $HOME
being more universal. The expansion is standardized in POSIX[2] and is
essentially portable across all shells, thus there is no pragmatic
value to introducing the change.
[1] https://github.com/nixos/nixpkgs/blob/master/pkgs/top-level/impure.nix
[2] https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_01