-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
99 lines (94 loc) · 3.45 KB
/
flake.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
with nixpkgs.lib;
let
systems = platforms.unix;
forAllSystems = genAttrs systems;
getHaskellPackages = pkgs: pattern: pipe pkgs.haskell.packages [
attrNames
(filter (x: !isNull (strings.match pattern x)))
(sort (x: y: x>y))
(map (x: pkgs.haskell.packages.${x}))
head
];
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; };
haskellPackages = getHaskellPackages pkgs "ghc96.";
results = {
precise-side-effects = haskellPackages.precise-side-effects;
quasar = haskellPackages.quasar;
quasar-examples = haskellPackages.quasar-examples;
quasar-mqtt = haskellPackages.quasar-mqtt;
quasar-network = haskellPackages.quasar-network;
quasar-timer = haskellPackages.quasar-timer;
quasar-web = haskellPackages.quasar-web;
quasar-web-client = pkgs.quasar-web-client;
};
in results // {
default = pkgs.linkFarm "quasar-all" (results // mapAttrs' (k: v: nameValuePair "${k}-doc" (v.doc or pkgs.emptyDirectory)) results);
}
);
overlays.default = final: prev: {
haskell = prev.haskell // {
packageOverrides = hfinal: hprev: prev.haskell.packageOverrides hfinal hprev // {
precise-side-effects = hfinal.callCabal2nix "precise-side-effects" ./precise-side-effects {};
quasar = hfinal.callCabal2nix "quasar" ./quasar {};
quasar-examples = hfinal.callCabal2nix "quasar-examples" ./examples {};
quasar-mqtt = hfinal.callCabal2nix "quasar-mqtt" ./quasar-mqtt {};
quasar-network = hfinal.callCabal2nix "quasar-network" ./quasar-network {};
quasar-timer = hfinal.callCabal2nix "quasar-timer" ./quasar-timer {};
quasar-web =
let srcWithClient = final.runCommand "quasar-web-with-client" {} ''
mkdir $out
cp -r ${./quasar-web}/* $out
chmod +w $out/data
ln -s ${final.quasar-web-client} $out/data/quasar-web-client
'';
in hfinal.callCabal2nix "quasar-web" srcWithClient {};
};
};
quasar-web-client = final.callPackage ./quasar-web-client {};
};
checks = mapAttrs (_k: filterAttrs (k: _v: k != "default")) self.packages;
devShells = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; overlays = [
self.overlays.default
(final: prev: {
quasar-web-client = final.emptyDirectory;
})
]; };
haskellPackages = getHaskellPackages pkgs "ghc96.";
in rec {
default = haskellPackages.shellFor {
packages = hpkgs: [
hpkgs.precise-side-effects
hpkgs.quasar
hpkgs.quasar-examples
hpkgs.quasar-mqtt
hpkgs.quasar-network
hpkgs.quasar-timer
hpkgs.quasar-web
];
nativeBuildInputs = [
pkgs.cabal-install
pkgs.zsh
pkgs.entr
pkgs.ghcid
haskellPackages.haskell-language-server
pkgs.hlint
pkgs.nodejs
pkgs.nodePackages.npm
pkgs.nodePackages.typescript-language-server
pkgs.nodePackages.svelte-language-server
];
};
}
);
};
}