{ 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` rev = (builtins.getAttr channel channelVersions); name = "nixpkgs-channels-${channel}"; }; nix_path = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [ [ "nixpkgs" (mkChannelSource "channelsNixosStable") ] [ "nixos" (mkChannelSource "channelsNixosStable") ] [ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ] [ "channels-nixos-unstable" (mkChannelSource "channelsNixosUnstable") ] ]; in (import (mkChannelSource "channelsNixosStable") {}).writeText "channels.rc" '' export NIX_PATH=${nix_path} ''; }