infra/nix/default.nix
Stefan Junker 89c9f9e606 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.
2020-10-18 20:26:32 +02:00

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}
'';
}