nix,steveej-t480s-work: introduce pure versioning

This commit is contained in:
steveej 2018-12-17 13:10:06 +01:00
parent 17c8ccb8c2
commit c5c4b160a1
12 changed files with 55 additions and 13 deletions

25
nix/default.nix Normal file
View file

@ -0,0 +1,25 @@
{ 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}
'';
}