diff --git a/lib/home-manager.nix b/lib/home-manager.nix new file mode 100644 index 00000000..42637868 --- /dev/null +++ b/lib/home-manager.nix @@ -0,0 +1,19 @@ +# Custom libraries for home-manager library. +{ lib }: + +{ + /* + Checks if there is the `osConfig` attribute and get the attribute path from + its system configuration. + */ + getOSConfigPath = + # The configuration attribute set of the home-manager configuration. + attrs: + + # A list of strings representing the attribute path. + attrPath: + + # The default value when `attrPath` is missing. + default: + attrs ? osConfig && lib.attrByPath attrPath default attrs; +} diff --git a/lib/images.nix b/lib/images.nix index 6b84f58c..7f0a0dfe 100644 --- a/lib/images.nix +++ b/lib/images.nix @@ -43,7 +43,10 @@ in mkImage = { pkgs ? null, extraModules ? [ ], format ? "iso" }: inputs.nixos-generators.nixosGenerate { inherit pkgs format; - lib = pkgs.lib.extend extendLib; + lib = pkgs.lib.extend (self: super: + import ./. { lib = super; } + // import ./private.nix { lib = self; } + // import ./home-manager.nix { lib = self; }); modules = extraModules; };