Commit Graph

4 Commits

Author SHA1 Message Date
Mario Rodas b5c083300b
treewide: fix typos 2022-12-05 12:58:02 +01:00
Curtis Jiang bb860e3e11
misc: fix nix.conf generation (#2824)
nix/nix.conf should generate if cfg.extraOptions is not empty.
2022-04-17 17:46:26 -04:00
polykernel 32e433d07d
nix: add structural settings (#2718)
Nix permits user level configurations through ~/.config/nix/nix.conf that allow
customization of system-wide settings and behavior. This is beneficial in chroot
environments and for per-user configurations. System level Nix configurations in the
form of /etc/nix/nix.conf can be specified declaratively via the NixOS nix module but as
of currently no counter part exists in home-manager.

This PR is a port of the RFC42 implementation for the NixOS nix module[1]
to home-manager. Non-applicable options have been excluded and the config generation
backends have been tweaked to the backends offered by home-manager. A notable change
from the NixOS module is a mandatory option to specify the Nix binary corresponding
to the version "nix.conf" should be generated against. This is necessary because
the validation phase is dependent on the `nix show-config` subcommand on the host platform.
While it is possible to avoid validation entirely, the lack of type checking was deemed too significant.
In NixOs, the version information can be retrieved from the `package` option itself which
declares the Nix binary system-wide. However in home-manager, there is no pure way to
detect the system Nix version and what state version the "nix.conf" should be generated
against. Thus an option is used to overcome this limitation by forcing the user to
specify the Nix package. Note this interaction can still be automated by forwarding
the system-wide Nix package to the home-manager module if needed.

Three unit tests were added to test the module behavior for the empty settings, the example
settings and the example registry configurations respectively.

[1] - NixOS/nixpkgs#139075
2022-03-17 22:47:32 -04:00
Michael Hoang aa6261bb96
nix: add module (#2623) 2022-01-27 18:58:25 +01:00