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.
29 lines
849 B
Nix
29 lines
849 B
Nix
{ versionsPath }:
|
|
|
|
let
|
|
channelVersions = (import versionsPath);
|
|
mkChannelSource = name:
|
|
let
|
|
channelVersion = builtins.getAttr name channelVersions;
|
|
in builtins.fetchGit {
|
|
# Descriptive name to make the store path easier to identify
|
|
inherit name;
|
|
inherit (channelVersion) url ref rev;
|
|
};
|
|
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
|
|
|
|
{
|
|
inherit nixPath;
|
|
channelSources = pkgs.writeText "channels.rc" ''
|
|
export NIX_PATH=${nixPath}
|
|
'';
|
|
}
|