-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
68 lines (68 loc) · 2.4 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/22.05";
utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
zig-binaries.url = "github:mitchellh/zig-overlay";
};
outputs = { self, nixpkgs, utils, nix-filter, zig-binaries }:
{
overlays.zig = import ./zig-overlay.nix { inherit zig-binaries; };
overlays.go = import ./go-overlay.nix;
overlays.debian = import ./debian-overlay.nix;
overlays.windows = import ./windows-overlay.nix;
lib = let patch-pkg-config = import ./patch-pkg-config.nix;
in {
logo_data = ./logo_matrix.txt;
zigOverlayFor = { version, patchArmHeader ? true }:
import ./zig-overlay.nix {
inherit zig-binaries version patchArmHeader;
};
};
} // (utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
packages.articleServer = pkgs.stdenvNoCC.mkDerivation rec {
name = "articleServer";
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
src = ./.;
propagatedBuildInputs = [ pkgs.coreutils pkgs.jekyll ];
SCRIPT = ''
DIR=$(${pkgs.coreutils}/bin/mktemp -d)
cd ${builtins.placeholder "out"}/share
${pkgs.jekyll}/bin/jekyll serve --disable-disk-cache -d "$DIR"
'';
buildPhase = ''
mv article/testing/* article/
mv examples article/
'';
installPhase = ''
mkdir -p $out/{bin,share}
printenv SCRIPT >$out/bin/articleServer
chmod u+x $out/bin/articleServer
cp -r article/* $out/share/
'';
};
packages.articleSources = pkgs.buildEnv {
name = "zicross-article-sources";
paths = [
(nix-filter.lib.filter {
root = ./article;
exclude = [ ./article/testing ];
})
(nix-filter.lib.filter {
root = ./.;
include = [ ./examples ];
exclude = [
(nix-filter.lib.matchExt "lock")
(nix-filter.lib.matchExt "sum")
(nix-filter.lib.matchExt "md")
(nix-filter.lib.matchExt "zig")
(nix-filter.lib.matchExt "go")
(nix-filter.lib.matchExt "c")
];
})
];
};
}));
}