-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.nix
56 lines (45 loc) · 1.37 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
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
let
version = "0.1";
src = with lib;
let cacheFilter = f: (all (pfx: baseNameOf f != pfx)
# filter those out
[ "_site" "_cache" "dist" "release.nix" ]);
in traceVal (builtins.filterSource
(f: t: cacheFilter f && cleanSourceFilter f t)
./.);
jbovlaste = fetchFromGitHub {
owner = "lojbanistan";
repo = "jbovlaste-dicts";
rev = "6660473b38da3dfa8a9c75febfd3dbb7f7ff5f0a";
sha256 = "1483y3il0r2hw5ylkxpz0p7ga8x1vwi3migyirhkgan2gznqyk48";
};
# generate .nix from cabal file
nixfile = runCommand "lojbanistan-de.nix" {} ''
${haskellPackages.cabal2nix}/bin/cabal2nix ${src} > $out
'';
hp = haskellPackages.override {
overrides = self: super: {
# hakyll site generator
lojbanistan-sitegen = self.callPackage nixfile {};
};
};
bin = "${hp.lojbanistan-sitegen}/bin/lojbanistan-de";
in
stdenv.mkDerivation {
name = "lojbanistan.de-${version}";
inherit src;
# Wir müssen die Locale vom site-generator übernehmen, damit
# Dateien für den Seitengenerator richtig eingelesen werden (utf-8).
inherit (hp.lojbanistan-sitegen) LOCALE_ARCHIVE LANG;
buildPhase = ''
# erstmal nur Deutsch
cp ${jbovlaste}/de.xml ./jbovlaste.xml
${bin} build
'';
installPhase = ''
mkdir $out
echo cp -r ./_site/* $out
'';
}