-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflake.nix
More file actions
141 lines (128 loc) · 5.17 KB
/
Copy pathflake.nix
File metadata and controls
141 lines (128 loc) · 5.17 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
nixConfig.substituters = [
"https://cache.nixos.org"
"https://stackage-infrastructure.cachix.org"
];
nixConfig.trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"stackage-infrastructure.cachix.org-1:R3E1FYE8IKCNbUWCvVhsnlLJ4FC6onEQLhQX2kY0ufQ="
];
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
nixpkgs-2311.url = "github:nixos/nixpkgs/nixos-23.11";
# LTS 15.6 (GHC 8.8.3)
nixpkgs-2009.url = "github:nixos/nixpkgs/nixos-20.09";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
hackage-mirror-tool = {
url = "github:commercialhaskell/hackage-mirror-tool";
flake = false;
};
};
outputs = inputs@{ self, hackage-mirror-tool, ... }: {
nixosModules.system-common = ./modules/system-common.nix;
nixosModules.zettarepl-target = ./modules/zettarepl-target.nix;
nixosModules.stackage-curator = ./stackage-builder/nixos-modules/stackage-curator.nix;
nixosModules.hackage-metadata-refresh = ./stackage-builder/nixos-modules/hackage-metadata-refresh.nix;
nixosModules.stackage-server = ./stackage-builder/nixos-modules/stackage-server.nix;
nixosModules.casa-server = ./stackage-builder/nixos-modules/casa-server.nix;
nixosModules.zfs-dataset-metrics = ./modules/zfs-dataset-metrics.nix;
nixosModules.monitoring-prometheus = ./modules/monitoring-prometheus.nix;
nixosModules.service-watchdog = ./modules/service-watchdog.nix;
nixosModules.ghc-perf-import = ./modules/ghc-perf-import.nix;
nixosModules.hf-cert-1 = {
imports = [
./hf-cert-1
self.nixosModules.system-common
inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops
# haskell-certification module imported by deployment repo
];
};
##
## HACKAGE MIRROR
##
# FIXME extract from flake.nix, as above
# Same as the other overlay, this is only exposed because it can be. It's
# just used to define the hackage-mirror-tool package.
overlays.hackage-mirror-tool =
let
myPackage = "hackage-mirror-tool";
hsOverlay = pkgs: self: super:
let
# FIXME: Remove this pin when amazonka releases a version higher than 2.0
# which has this change included:
# https://github.com/brendanhay/amazonka/pull/977
amazonkaRepo = {
url = "https://github.com/brendanhay/amazonka.git";
rev = "85e0289f8dc23c54b00f7f1a09845be7e032a1eb";
};
in {
amazonka-core = pkgs.haskell.lib.compose.overrideSrc
{ src = "${builtins.fetchGit amazonkaRepo}/lib/amazonka-core"; }
super.amazonka-core;
# Jailbreak to get around my amazonka>2.0 failsafe
${myPackage} = pkgs.haskell.lib.compose.doJailbreak
(self.callCabal2nix myPackage hackage-mirror-tool {});
};
in final: prev: {
myHaskellPackages = prev.haskellPackages.override {
overrides = hsOverlay final;
};
};
packages.x86_64-linux.hackage-mirror-tool =
let
myPkgs = import inputs.nixpkgs-2311 {
system = "x86_64-linux"; overlays = [ self.overlays.hackage-mirror-tool ];
};
in myPkgs.myHaskellPackages.hackage-mirror-tool;
# Make a service out of hackage-mirror-tool. It doesn't have a loop built
# in, which means we get to control it with systemd (which I appreciate).
nixosModules.hackage-mirror = import ./stackage-builder/nixos-modules/hackage-mirror.nix {
hackage-mirror-tool-app = self.packages.x86_64-linux.hackage-mirror-tool;
};
##
## CASA SERVER
##
# FIXME extract from flake.nix, as above
# Just used to define the casa package.
overlays.casa =
let
myPackage = "casa";
hsOverlay = pkgs: self: super: {
${myPackage} = pkgs.haskell.lib.buildStackProject {
name = myPackage;
src = builtins.fetchGit {
url = "https://github.com/commercialhaskell/${myPackage}.git";
rev = "9ce3ae6653120ca00b898c193ee5c9955b697d34";
};
ghc = pkgs.haskell.compiler.ghc8107;
buildInputs = [ pkgs.zlib pkgs.git pkgs.postgresql ];
# FIXME: Shifting the tests to lts-15.6 proved too much work, so
# I've disabled them.
checkPhase = "";
};
};
in final: prev: {
myHaskellPackages = prev.haskellPackages.override {
overrides = hsOverlay final;
};
};
packages.x86_64-linux.casa =
let
myPkgs = import inputs.nixpkgs-2009 {
system = "x86_64-linux"; overlays = [ self.overlays.casa ];
};
in myPkgs.myHaskellPackages.casa;
devShells.x86_64-linux.default = inputs.nixpkgs.legacyPackages.x86_64-linux.mkShell {
buildInputs = [ inputs.sops-nix.packages.x86_64-linux.default ];
};
checks."x86_64-linux".test-vm = inputs.nixpkgs.legacyPackages."x86_64-linux".callPackage ./test-os.nix { inherit self inputs; };
};
}