versions: bump to 20.09 and improve NIX_PATH assembly

The NIX_PATH assembly now walks over all keys in the given channel
repositories and assembles a NIX_PATH entry from it. Previously it made
assumptions about a set of hardcoded keys being available, which wasn't
ideal as it didn't allow device-entries.
This commit is contained in:
steveej 2020-10-17 15:25:47 +02:00
parent eaad3a11b4
commit 89c9f9e606
15 changed files with 221 additions and 139 deletions

View file

@ -2,28 +2,23 @@
let
channelVersions = (import versionsPath);
mkChannelSource = channel:
mkChannelSource = name:
let
channelVersion = builtins.getAttr channel channelVersions;
channelVersion = builtins.getAttr name channelVersions;
in builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "nixpkgs-channels-${channel}";
url = if builtins.hasAttr "url" channelVersion
then channelVersion."url"
else "https://github.com/NixOS/nixpkgs-channels/"
;
ref = (builtins.getAttr channel channelVersions)."ref";
rev = (builtins.getAttr channel channelVersions)."rev";
inherit name;
inherit (channelVersion) url ref rev;
};
nixPath = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [
[ "nixpkgs" (mkChannelSource "channelsNixosStable") ]
[ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ]
[ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ]
[ "channels-nixos-unstable" (mkChannelSource "channelsNixosUnstable") ]
[ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ]
[ "home-manager-module" (mkChannelSource "homeManagerModule") ]
];
pkgs = import (mkChannelSource "channelsNixosStable") {};
nixPath = builtins.foldl' (path: elemName:
let
elem = builtins.getAttr elemName channelVersions;
elemPath = (mkChannelSource elemName);
suffix = if builtins.hasAttr "suffix" elem then elem.suffix else "";
in
path + ":" + builtins.concatStringsSep "=" [ elemName elemPath ] + suffix
) "" (builtins.attrNames channelVersions);
pkgs = import (mkChannelSource "nixpkgs") {};
in
{