mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Add system.replaceRuntimeDependencies to quickly replace system dependencies
This commit is contained in:
parent
12f06b3cc3
commit
66ddb1c322
1 changed files with 32 additions and 1 deletions
|
@ -95,7 +95,7 @@ let
|
|||
# kernel, systemd units, init scripts, etc.) as well as a script
|
||||
# `switch-to-configuration' that activates the configuration and
|
||||
# makes it bootable.
|
||||
system = showWarnings (
|
||||
baseSystem = showWarnings (
|
||||
if [] == failed then pkgs.stdenv.mkDerivation {
|
||||
name = "nixos-${config.system.nixosVersion}";
|
||||
preferLocalBuild = true;
|
||||
|
@ -118,6 +118,10 @@ let
|
|||
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
|
||||
} else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
|
||||
|
||||
# Replace runtime dependencies
|
||||
system = fold ({ oldDependency, newDependency }: drv:
|
||||
pkgs.replaceDependency { inherit oldDependency newDependency drv; }
|
||||
) baseSystem config.system.replaceRuntimeDependencies;
|
||||
|
||||
in
|
||||
|
||||
|
@ -184,6 +188,33 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
system.replaceRuntimeDependencies = mkOption {
|
||||
default = [];
|
||||
example = lib.literalExample "[ ({ original = pkgs.openssl; replacement = pkgs.callPackage /path/to/openssl { ... }; }) ]";
|
||||
type = types.listOf (types.submodule (
|
||||
{ options, ... }: {
|
||||
options.original = mkOption {
|
||||
type = types.package;
|
||||
description = "The original package to override.";
|
||||
};
|
||||
|
||||
options.replacement = mkOption {
|
||||
type = types.package;
|
||||
description = "The replacement package.";
|
||||
};
|
||||
})
|
||||
);
|
||||
apply = map ({ original, replacement, ... }: {
|
||||
oldDependency = original;
|
||||
newDependency = replacement;
|
||||
});
|
||||
description = ''
|
||||
List of packages to override without doing a full rebuild.
|
||||
The original derivation and replacement derivation must have the same
|
||||
name length, and ideally should have close-to-identical directory layout.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue