flake(system): use system nixpkgs config in home-manager
This allows for setting overlays at the home level while also inheriting the global nixpkgs configuration. This should theoretically work exactly like useGlobalPkgs while still allowing for flexibility at the home level. See nix-community/home-manager#6172
This commit is contained in:
parent
d8723c0f3d
commit
cab0e3e023
@ -186,9 +186,25 @@ in {
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inheritStateVersionModule = {lib, ...}: {
|
||||
perUserDefaultsModule = {lib, ...}: {
|
||||
config = {
|
||||
# previously, home-manager inherited stateVersion from
|
||||
# nixos in a really hacky way that depended on the wrapper
|
||||
# function. this should preserve that behavior in a much
|
||||
# safer way by directly setting it in a module. ideally, it
|
||||
# should probably be set manually, but I want to maintain
|
||||
# backwards compatibility for now.
|
||||
home.stateVersion = lib.mkDefault config.system.stateVersion;
|
||||
|
||||
# pass the system nixpkgs config as defaults for the
|
||||
# home-manager nixpkgs config. useGlobalPkgs prevents
|
||||
# setting overlays at the home level; this allows for doing
|
||||
# that while inheriting the system overlays.
|
||||
nixpkgs = {
|
||||
config = mapAttrs (n: v: lib.mkDefault v) config.nixpkgs.config;
|
||||
# mkOrder 900 is after mkBefore but before default order
|
||||
overlays = lib.mkOrder 900 config.nixpkgs.overlays;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
@ -197,14 +213,8 @@ in {
|
||||
homeManagerModuleInner
|
||||
];
|
||||
|
||||
# previously, home-manager inherited stateVersion from nixos in
|
||||
# a really hacky way that depended on the wrapper function.
|
||||
# this should preserve that behavior in a much safer way by
|
||||
# directly setting it in a module. ideally, it should probably
|
||||
# be set manually, but I want to maintain backwards
|
||||
# compatibility for now
|
||||
options.home-manager.users = lib.mkOption {
|
||||
type = with lib.types; attrsOf (submodule inheritStateVersionModule);
|
||||
type = with lib.types; attrsOf (submodule perUserDefaultsModule);
|
||||
};
|
||||
};
|
||||
in
|
||||
|
@ -68,8 +68,8 @@ in rec {
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
useGlobalPkgs = lib.mkDefault false;
|
||||
useUserPackages = lib.mkDefault true;
|
||||
backupFileExtension = "hm.bak";
|
||||
inherit users;
|
||||
extraSpecialArgs = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user