infra/nix/default.nix

35 lines
1.2 KiB
Nix
Raw Normal View History

{ versionsPath }:
let
channelVersions = (import versionsPath);
mkChannelSource = channel:
let
channelVersion = builtins.getAttr channel channelVersions;
in builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "nixpkgs-channels-${channel}";
url = if builtins.hasAttr "url" channelVersion
then channelVersion."url"
else "https://github.com/NixOS/nixpkgs-channels/"
;
ref = (builtins.getAttr channel channelVersions)."ref";
rev = (builtins.getAttr channel channelVersions)."rev";
};
nixPath = 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") ]
[ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ]
[ "home-manager-module" (mkChannelSource "homeManagerModule") ]
];
pkgs = import (mkChannelSource "channelsNixosStable") {};
in
{
inherit nixPath;
channelSources = pkgs.writeText "channels.rc" ''
export NIX_PATH=${nixPath}
'';
}