-
Notifications
You must be signed in to change notification settings - Fork 198
/
flake.nix
94 lines (90 loc) · 3.16 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/haskell-updates";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
flake-root.url = "github:srid/flake-root";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
imports = [
inputs.haskell-flake.flakeModule
inputs.flake-root.flakeModule
];
perSystem = { self', system, lib, config, pkgs, ... }: {
apps.default.program = pkgs.writeShellApplication {
name = "run-hackage-server";
runtimeInputs = [ config.packages.default ];
text = ''
if [ ! -d "state" ]; then
hackage-server init --static-dir=datafiles --state-dir=state
else
echo "'state' state-dir already exists"
fi
hackage-server run \
--static-dir=datafiles \
--state-dir=state \
--base-uri=http://127.0.0.1:8080
'';
};
apps.mirror-hackage-server.program = pkgs.writeShellApplication {
name = "mirror-hackage-server";
runtimeInputs = [ config.packages.default ];
text = ''
echo 'Copying packages from real Hackage Server into local Hackage Server.'
echo 'This assumes the local Hackage Server uses default credentials;'
echo 'otherwise, override in nix-default-servers.cfg'
hackage-mirror nix-default-servers.cfg "$@"
'';
};
packages.default = config.packages.hackage-server;
haskellProjects.default = {
settings = {
hackage-server.check = false;
ap-normalize.check = false;
# https://community.flake.parts/haskell-flake/dependency#nixpkgs
tar = { super, ... }:
{ custom = _: super.tar_0_6_3_0; };
hackage-security = { super, ... }:
{ custom = _: super.hackage-security_0_6_2_6; };
};
packages = {
# https://community.flake.parts/haskell-flake/dependency#path
# tls.source = "1.9.0";
};
devShell = {
tools = hp: {
inherit (pkgs)
cabal-install
ghc
# https://github.com/haskell/hackage-server/pull/1219#issuecomment-1597140858
# glibc
icu67
zlib
openssl
# cryptodev
pkg-config
brotli
gd
libpng
libjpeg
fontconfig
freetype
expat
;
};
hlsCheck.enable = false;
};
};
};
};
nixConfig = {
extra-substituters = ["https://hackage-server.cachix.org/"];
extra-trusted-public-keys = [
"hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY="
];
allow-import-from-derivation = "true";
};
}