29 lines
856 B
Nix
29 lines
856 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.concatStringsSep ":" (builtins.map (elemName:
|
|
let
|
|
elem = builtins.getAttr elemName channelVersions;
|
|
elemPath = (mkChannelSource elemName);
|
|
suffix = if builtins.hasAttr "suffix" elem then elem.suffix else "";
|
|
in
|
|
builtins.concatStringsSep "=" [ elemName elemPath ] + suffix
|
|
) (builtins.attrNames channelVersions));
|
|
pkgs = import (mkChannelSource "nixpkgs") {};
|
|
in
|
|
|
|
{
|
|
inherit nixPath;
|
|
channelSources = pkgs.writeText "channels.rc" ''
|
|
export NIX_PATH=${nixPath}
|
|
'';
|
|
}
|