fix: pass home specialArgs to home in nixos module
This commit is contained in:
parent
9b718da230
commit
11476c3b90
4 changed files with 14 additions and 8 deletions
|
|
@ -9,7 +9,7 @@ inputs @ {
|
||||||
|
|
||||||
cfg = config.snowfallorg;
|
cfg = config.snowfallorg;
|
||||||
|
|
||||||
# @NOTE(jakehamilton): The module system chokes if it finds `osConfig` named in the module arguments
|
# NOTE: The module system chokes if it finds `osConfig` named in the module arguments
|
||||||
# when being used in standalone home-manager. To remedy this, we have to refer to the arguments set directly.
|
# when being used in standalone home-manager. To remedy this, we have to refer to the arguments set directly.
|
||||||
os-user-home = inputs.osConfig.users.users.${cfg.name}.home or null;
|
os-user-home = inputs.osConfig.users.users.${cfg.name}.home or null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ in {
|
||||||
config = mkOption {
|
config = mkOption {
|
||||||
# HM-compatible options taken from:
|
# HM-compatible options taken from:
|
||||||
# https://github.com/nix-community/home-manager/blob/0ee5ab611dc1fbb5180bd7d88d2aeb7841a4d179/nixos/common.nix#L14
|
# https://github.com/nix-community/home-manager/blob/0ee5ab611dc1fbb5180bd7d88d2aeb7841a4d179/nixos/common.nix#L14
|
||||||
# @NOTE(jakehamilton): This has been adapted to support documentation generation without
|
# NOTE: This has been adapted to support documentation generation without
|
||||||
# having home-manager options fully declared.
|
# having home-manager options fully declared.
|
||||||
type = types.submoduleWith {
|
type = types.submoduleWith {
|
||||||
specialArgs =
|
specialArgs =
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@ in {
|
||||||
home = rec {
|
home = rec {
|
||||||
# Modules in home-manager expect `hm` to be available directly on `lib` itself.
|
# Modules in home-manager expect `hm` to be available directly on `lib` itself.
|
||||||
home-lib =
|
home-lib =
|
||||||
# @NOTE(jakehamilton): This prevents an error during evaluation if the input does
|
# NOTE: This prevents an error during evaluation if the input does
|
||||||
# not exist.
|
# not exist.
|
||||||
if user-inputs ? home-manager
|
if user-inputs ? home-manager
|
||||||
then
|
then
|
||||||
snowfall-lib.internal.system-lib.extend
|
snowfall-lib.internal.system-lib.extend
|
||||||
(final: prev:
|
(final: prev:
|
||||||
# @NOTE(jakehamilton): This order is important, this library's extend and other utilities must write
|
# NOTE: This order is important, this library's extend and other utilities must write
|
||||||
# _over_ the original `system-lib`.
|
# _over_ the original `system-lib`.
|
||||||
snowfall-lib.internal.system-lib
|
snowfall-lib.internal.system-lib
|
||||||
// prev
|
// prev
|
||||||
|
|
@ -90,7 +90,7 @@ in {
|
||||||
}: let
|
}: let
|
||||||
user-metadata = split-user-and-host name;
|
user-metadata = split-user-and-host name;
|
||||||
|
|
||||||
# @NOTE(jakehamilton): home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
# NOTE: home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
||||||
pkgs = user-inputs.self.pkgs.${system}.${channelName} // {lib = home-lib;};
|
pkgs = user-inputs.self.pkgs.${system}.${channelName} // {lib = home-lib;};
|
||||||
lib = home-lib;
|
lib = home-lib;
|
||||||
in
|
in
|
||||||
|
|
@ -115,7 +115,7 @@ in {
|
||||||
|
|
||||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
|
|
||||||
# @NOTE(jakehamilton): home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
# NOTE: home-manager has trouble with `pkgs` recursion if it isn't passed in here.
|
||||||
inherit pkgs lib;
|
inherit pkgs lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -294,7 +294,7 @@ in {
|
||||||
}: let
|
}: let
|
||||||
host-matches = created-user.specialArgs.host == host;
|
host-matches = created-user.specialArgs.host == host;
|
||||||
|
|
||||||
# @NOTE(jakehamilton): To conform to the config structure of home-manager, we have to
|
# NOTE: To conform to the config structure of home-manager, we have to
|
||||||
# remap the options coming from `snowfallorg.user.<name>.home.config` since `mkAliasDefinitions`
|
# remap the options coming from `snowfallorg.user.<name>.home.config` since `mkAliasDefinitions`
|
||||||
# does not let us target options within a submodule.
|
# does not let us target options within a submodule.
|
||||||
wrap-user-options = user-option:
|
wrap-user-options = user-option:
|
||||||
|
|
@ -333,6 +333,12 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = mkDefault user-name;
|
name = mkDefault user-name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# NOTE: specialArgs are not propagated by Home-Manager without this.
|
||||||
|
# However, not all specialArgs values can be set when using `_module.args`.
|
||||||
|
_module.args =
|
||||||
|
builtins.removeAttrs (users.users.${name}.specialArgs or {})
|
||||||
|
["options" "config" "lib" "pkgs" "specialArgs"];
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# @NOTE(jakehamilton): The order of these entries matters. We search them
|
# NOTE: The order of these entries matters. We search them
|
||||||
# from start to finish and only match based on whether they appear in a
|
# from start to finish and only match based on whether they appear in a
|
||||||
# system target. This means that entries like "vm" would match all cases
|
# system target. This means that entries like "vm" would match all cases
|
||||||
# of "vm-bootloader", "vm-no-gui", and "vmware". To avoid this mismatch,
|
# of "vm-bootloader", "vm-no-gui", and "vmware". To avoid this mismatch,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue