-
Notifications
You must be signed in to change notification settings - Fork 12
/
versions.nix
55 lines (49 loc) · 1.32 KB
/
versions.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ pkgs ? import <nixpkgs> {} }:
with pkgs.lib;
let
versions = importJSON ./versions.json;
channels =
mapAttrs (
name: repoInfo:
# Hydra expects fixed length rev ids
assert stringLength repoInfo.rev == 40;
if repoInfo ? url then
pkgs.fetchgit repoInfo // {
name = "${name}-${substring 0 11 repoInfo.rev}";
}
else
pkgs.fetchFromGitHub {
inherit (repoInfo) owner repo rev hash;
name = "${name}-${substring 0 11 repoInfo.rev}";
})
versions;
arrangeChannels =
builtins.toFile "arrange-channels.sh" ''
mkdir $out
set -- ''${channels[@]}
# 1=name 2=path
while [[ -n "$1" && -n "$2" ]]; do
ln -s $2 $out/"$1"
shift 2
done
'';
in
assert channels ? "nixpkgs";
let
pkgs = import channels.nixpkgs {};
in
# export "nixos-18_09" instead of "nixos-18.09" for example
(mapAttrs' (name: val: nameValuePair (replaceStrings [ "." ] [ "_" ] name) val)
channels)
//
{
allUpstreams = builtins.derivation {
args = [ "-e" arrangeChannels ];
builder = pkgs.stdenv.shell;
channels = mapAttrsToList (name: path: "${name} ${path}") channels;
name = "all-upstream-sources";
PATH = with pkgs; makeBinPath [ coreutils ];
preferLocalBuild = true;
system = builtins.currentSystem;
};
}