forked from obsidiansystems/obelisk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.nix
80 lines (71 loc) · 2.08 KB
/
release.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ local-self ? import ./. {}
}:
let
inherit (local-self.nixpkgs) lib runCommand nix;
cacheBuildSystems = [ "x86_64-linux" "x86_64-darwin" ];
obeliskPackagesCommon = [
"obelisk-frontend"
"obelisk-route"
"obelisk-executable-config"
];
obeliskPackagesBackend = obeliskPackagesCommon ++ [
"obelisk-asset-manifest"
"obelisk-asset-serve-snap"
"obelisk-backend"
"obelisk-cliapp"
"obelisk-command"
"obelisk-executable-config-inject"
"obelisk-frontend"
"obelisk-run"
"obelisk-route"
"obelisk-selftest"
"obelisk-snap-extras"
];
pnameToAttrs = pkgsSet: pnames:
lib.listToAttrs (map
(name: { inherit name; value = pkgsSet.${name}; })
pnames);
concatDepends = let
extractDeps = x: (x.override {
mkDerivation = drv: {
out = builtins.concatLists [
(drv.buildDepends or [])
(drv.libraryHaskellDepends or [])
(drv.executableHaskellDepends or [])
];
};
}).out;
in pkgAttrs: builtins.concatLists (map extractDeps (builtins.attrValues pkgAttrs));
perPlatform = lib.genAttrs cacheBuildSystems (system: let
obelisk = import ./. { inherit system; };
reflex-platform = obelisk.reflex-platform;
ghc = pnameToAttrs
obelisk.haskellPackageSets.ghc
obeliskPackagesBackend;
ghcjs = pnameToAttrs
obelisk.haskellPackageSets.ghcjs
obeliskPackagesCommon;
cachePackages = builtins.concatLists [
(builtins.attrValues ghc)
(builtins.attrValues ghcjs)
(concatDepends ghc)
(concatDepends ghcjs)
];
command = local-self.command;
serverExeSkeleton = (import ./skeleton {}).exe;
builtSkeleton = (import ./skeleton {}).all;
in {
inherit
command
ghc ghcjs
serverExeSkeleton builtSkeleton;
cache = reflex-platform.pinBuildInputs
"obelisk-${system}"
cachePackages
[command serverExeSkeleton builtSkeleton];
});
metaCache = local-self.pinBuildInputs
"obelisk-everywhere"
(map (a: a.cache) (builtins.attrValues perPlatform))
[];
in perPlatform // { inherit metaCache; }