mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
home-environment: add home.extraDependencies
This should have the same effect `system.extraDependencies` has in nixpkgs: adds paths to the runtime closure without installing them anywhere. This is useful for preventing garbage collection of packages that are expensive to rebuild. For example: - nixpkgs itself suggests using this for `factorio.src`, which requires a token to fetch. - we can use it to address #6157: avoid needlessly rebuilding completions for packages that do not have any. The implementation mirrors nixpkgs: add a file containing the store paths we want to keep around to the home-manager-generation derivation.
This commit is contained in:
parent
1298a3418b
commit
361ab4484e
1 changed files with 13 additions and 0 deletions
|
|
@ -383,6 +383,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
home.extraDependencies = mkOption {
|
||||||
|
type = types.listOf types.pathInStore;
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
|
A list of paths that should be included in the home
|
||||||
|
closure but generally not visible.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
home.path = mkOption {
|
home.path = mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
description = "The derivation installing the user packages.";
|
description = "The derivation installing the user packages.";
|
||||||
|
|
@ -780,6 +789,8 @@ in
|
||||||
pkgs.runCommand "home-manager-generation"
|
pkgs.runCommand "home-manager-generation"
|
||||||
{
|
{
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
passAsFile = [ "extraDependencies" ];
|
||||||
|
inherit (config.home) extraDependencies;
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
@ -797,6 +808,8 @@ in
|
||||||
ln -s ${config.home-files} $out/home-files
|
ln -s ${config.home-files} $out/home-files
|
||||||
ln -s ${cfg.path} $out/home-path
|
ln -s ${cfg.path} $out/home-path
|
||||||
|
|
||||||
|
cp "$extraDependenciesPath" "$out/extra-dependencies"
|
||||||
|
|
||||||
${cfg.extraBuilderCommands}
|
${cfg.extraBuilderCommands}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue