-
Notifications
You must be signed in to change notification settings - Fork 6
/
default.nix
108 lines (100 loc) · 3.71 KB
/
default.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
100
101
102
103
104
105
106
107
108
{pkgs ? import <nixpkgs> {}}:
let
# Pin nixpkgs version down by default, but allow building with another version
nixpkgs = import (pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "fb94afad504cae198ef496df796e74680cb303e6";
sha256 = "sha256-Wu5gDD9VwQVcryavYLcf1OEWU4kD76hrBcMd8NoEHT8=";
}) {};
ghcjs = nixpkgs.haskell.packages.ghcjs.extend (final: previous: {
# Ghcjs is not compatible with Aeson 2
aeson = final.aeson_1_5_6_0;
miso = final.mkDerivation {
pname = "miso";
version = "1.8.2";
src = nixpkgs.fetchFromGitHub {
owner = "dmjio";
repo = "miso";
rev = "15886bd01725a551354f37cf804ebea5f9e36fa3";
sha256 = "sha256-NjhAcTshjiVhY1DmRYdeZyBxFPR69bhlDRM28D0zkpE=";
};
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = with final; [
aeson base bytestring containers ghcjs-base http-api-data
http-types network-uri scientific servant text transformers
unordered-containers vector file-embed jsaddle lucid tagsoup
];
executableHaskellDepends = with final; [
aeson base bytestring containers ghcjs-base http-api-data
http-types network-uri QuickCheck quickcheck-instances scientific
servant text transformers unordered-containers vector
];
homepage = "http://github.com/dmjio/miso";
description = "A tasty Haskell front-end framework";
license = nixpkgs.lib.licenses.bsd3;
};
# Freezes on test run
MissingH = previous.MissingH.overrideAttrs (prev: {doCheck = false;});
# Exits through OOM
tagsoup = previous.tagsoup.overrideAttrs (prev: {doCheck = false;});
# Freezes on test run
text-short = previous.text-short.overrideAttrs (prev: {doCheck = false;});
# Test failure
unliftio = previous.unliftio.overrideAttrs (pref: {doCheck = false;});
# Freezes on test run
vector = previous.vector.overrideAttrs (prev: {doCheck = false;});
});
in
with ghcjs;
let
glualint-lib-src =
nixpkgs.fetchgit {
url = "https://github.com/FPtje/GLuaFixer.git";
rev = "41276b38c984b16d7db690475319d3230f82bc45";
sha256 = "sha256-ndcIJUYPq6mjQBmalnRrO2Zn+UNa6XlVXaPSSA9oc4g=";
};
# Only build the library, because the executable is not compatible with GHC 8.10, which is the
# basis of GHCJS.
glualint-lib = with nixpkgs.haskell.lib; dontHaddock (doJailbreak ((callPackage glualint-lib-src { }).overrideAttrs (prev: {
postPatch = ''
${prev.postPatch}
awk '/executable glualint/{exit} 1' glualint.cabal > tmp
mv tmp glualint.cabal
rm -rf app
'';
})));
glualint-web-styles = callPackage ./styles { };
drv = { mkDerivation, base, ghcjs-base, glualint-lib, lens, miso, stdenv}:
mkDerivation {
pname = "glualint-web";
version = "0.1.0.0";
src = nixpkgs.lib.cleanSourceWith rec {
name = "glualint-web-src";
src = ./.;
filter = path: type: let
relativePath = nixpkgs.lib.removePrefix (toString src + "/") path;
srcWhitelist = [
"src(/.*)?"
"cabal\.config"
".*\.cabal"
"LICENSE"
".*\.hs"
];
in builtins.any (r: builtins.match r relativePath != null) srcWhitelist;
};
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base ghcjs-base glualint-lib lens miso
];
description = "Clientside web version of glualint";
license = nixpkgs.lib.licenses.gpl2;
postInstall = ''
echo "Generating CSS file"
${glualint-web-styles}/bin/glualint-web-styles > $out/bin/glualint-web.jsexe/styles.css
'';
};
in
callPackage drv { inherit glualint-lib miso; }