Flakes: Difference between revisions

imported>Mic92
imported>Extends
Indicating how to create an overlay on the pkgs attribute to import packages from different channels
Line 288: Line 288:
$ nix build .#hello
$ nix build .#hello
</syntaxHighlight>
</syntaxHighlight>
== Importing packages from multiple channels ==
You can import packages from different packages by creating an overlay on the `pkgs` attribute :
<syntaxHighlight lang=nix>
let
  overlay-unstable = final: prev: {
    unstable = nixpkgs-unstable.legacyPackages.${system}; # considering nixpkgs-unstable is an input registered before.
  };
in nixpkgs.overlays = [ overlay-unstable.unstable ]; # we assign the overlay created before to the overlays of nixpkgs.
</syntaxHighlight>
should make a package accessed through <syntaxHighlight>pkgs.unstable.package</syntaxHighlight>


== See also ==
== See also ==