mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 23:02:27 +00:00
* Allow conflicting packages to be kept in a user environment, and
allow switching between them (NIX-80). Example: two versions of Pan: $ nix-env -q pan pan-0.128 pan-0.14.2.91 $ readlink $(which pan) /nix/store/l38jrbilw269drpjkx7kinhrxj6fjh59-pan-0.14.2.91/bin/pan At most one of them can be active any given time. Assuming than 0.14.2.91 is active, you can active 0.128 as follows: $ nix-env --set-flag active false pan-0.14.2.91 $ nix-env --set-flag active true pan-0.128 $ readlink $(which pan) /nix/store/nziqwnlzy7xl385kglxhg75pfl5i936n-pan-0.128/bin/pan More flags to follow.
This commit is contained in:
parent
b7f0f65c19
commit
3d05166086
@ -108,10 +108,15 @@ sub addPkg {
|
|||||||
|
|
||||||
|
|
||||||
# Symlink to the packages that have been installed explicitly by the user.
|
# Symlink to the packages that have been installed explicitly by the user.
|
||||||
my @args = split ' ', $ENV{"derivations"};
|
my @paths = split ' ', $ENV{"derivations"};
|
||||||
|
my @active = split ' ', $ENV{"active"};
|
||||||
|
|
||||||
foreach my $pkgDir (sort @args) {
|
die if scalar @paths != scalar @active;
|
||||||
addPkg($pkgDir, 0);
|
|
||||||
|
for (my $n = 0; $n < scalar @paths; $n++) {
|
||||||
|
my $pkgDir = $paths[$n];
|
||||||
|
my $isActive = $active[$n];
|
||||||
|
addPkg($pkgDir, 0) if $isActive ne "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,4 +6,7 @@ derivation {
|
|||||||
builder = ./builder.pl;
|
builder = ./builder.pl;
|
||||||
derivations = derivations;
|
derivations = derivations;
|
||||||
manifest = manifest;
|
manifest = manifest;
|
||||||
|
|
||||||
|
# !!! grmbl, need structured data for passing this in a clean way.
|
||||||
|
active = map (x: if x ? meta && x.meta ? active then x.meta.active else "true") derivations;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user