infra/nix/default.nix

26 lines
1.2 KiB
Nix

{ versionsPath }:
{
channelSources =
let
# channelVersions = (import ((builtins.getEnv "PWD")+"/${dir}/versions.nix"));
channelVersions = (import versionsPath);
mkChannelSource = channel: builtins.fetchGit {
# Descriptive name to make the store path easier to identify
url = "https://github.com/NixOS/nixpkgs-channels/";
# Commit hash for nixos-unstable as of 2018-09-12
# `git ls-remote https://github.com/nixos/nixpkgs-channels nixos-unstable`
ref = (builtins.getAttr channel channelVersions)."ref";
rev = (builtins.getAttr channel channelVersions)."rev";
name = "nixpkgs-channels-${channel}";
};
nix_path = 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") ]
];
in (import (mkChannelSource "channelsNixosStable") {}).writeText "channels.rc" ''
export NIX_PATH=${nix_path}
'';
}