add krops trick about channels
parent
0653440b3d
commit
4726f98d85
|
@ -456,3 +456,45 @@ Now you can just have to call the `nix-prefetch-git` command
|
|||
and the commit reference will be updated, and is fixed.
|
||||
|
||||
This should also make it simpler to maintain different channels on different machines.
|
||||
|
||||
## Use Packages from other channels
|
||||
|
||||
It is very easy to install packages from different channels.
|
||||
|
||||
For example add `nixpkgs-unstable` the same way you add `nixpkgs`.
|
||||
|
||||
```nix
|
||||
source = lib.evalSource [
|
||||
{
|
||||
nixpkgs.git = {
|
||||
ref = "nixos-18.09";
|
||||
url = https://github.com/NixOS/nixpkgs-channels;
|
||||
};
|
||||
nixpkgs-unstable.git = {
|
||||
ref = "nixos-unstable";
|
||||
url = https://github.com/NixOS/nixpkgs-channels;
|
||||
};
|
||||
nixos-config.file = toString ./configuration.nix;
|
||||
}
|
||||
];
|
||||
```
|
||||
|
||||
To install a package from the `unstable` channel you just have to import the channel
|
||||
and call the packages from there.
|
||||
|
||||
```nix
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
unstable = import <nixpkgs-unstable> {};
|
||||
in {
|
||||
environment.systemPackages = [
|
||||
|
||||
# install gimp from stable channel
|
||||
pkgs.gimp
|
||||
|
||||
# install inkscape from unstable channel
|
||||
unstable.inkscape
|
||||
|
||||
];
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue