-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
89 lines (80 loc) · 2.84 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
# SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
{
description = "Serokell Nix infrastructure library";
nixConfig.flake-registry = "https://github.com/serokell/flake-registry/raw/master/flake-registry.json";
inputs = {
gitignore-nix = {
url = "github:hercules-ci/gitignore.nix";
flake = false;
};
flake-compat = {
flake = false;
};
get-tested-src = {
url = "github:Kleidukos/get-tested/v0.1.6.0";
flake = false;
};
weeder-src.url = "github:ocharles/weeder";
};
outputs = { self, nixpkgs, gitignore-nix, flake-utils, nix, deploy-rs, haskell-nix, ... }@inputs: let
get-tested = (haskell-nix.legacyPackages.x86_64-linux.haskell-nix.cabalProject {
src = haskell-nix.legacyPackages.x86_64-linux.haskell-nix.haskellLib.cleanGit {
name = "get-tested";
src = inputs.get-tested-src;
};
compiler-nix-name = "ghc944";
}).get-tested.components.exes.get-tested;
in ({
overlay = import ./overlay { inherit inputs; };
lib = import ./lib {
inherit nixpkgs deploy-rs get-tested;
inherit (nixpkgs) lib;
gitignore-nix = import gitignore-nix { inherit (nixpkgs) lib; };
};
darwinModules = {
common = import ./modules/common.nix;
serokell-users = import ./modules/serokell-users-darwin.nix;
wireguard-monitoring = import ./modules/wireguard-monitoring/darwin.nix;
};
nixosModules = {
common = {...}: {
imports = [
./modules/common.nix
./modules/common-non-darwin.nix
];
};
acme-sh = import ./modules/acme-sh.nix;
vault-secrets = import ./modules/vault-secrets.nix;
serokell-users = import ./modules/serokell-users.nix;
hackage-search = import ./modules/services/hackage-search.nix;
nginx = import ./modules/services/nginx.nix;
upload-daemon = import ./modules/services/upload-daemon.nix;
hetzner-cloud = import ./modules/virtualization/hetzner-cloud.nix;
ec2 = import ./modules/virtualization/ec2.nix;
docker = import ./modules/virtualization/docker.nix;
wireguard-monitoring = import ./modules/wireguard-monitoring/default.nix;
postgresql-migration = import ./modules/postgresql-migration.nix;
};
} // flake-utils.lib.eachDefaultSystem (system:
# (pinned nix-unstable version does not support aarch64-darwin)
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ self.overlay ];
};
in with pkgs; {
devShell = mkShell {
buildInputs = [ ];
};
packages = pkgs.lib.optionalAttrs (! lib.hasInfix "darwin" system) {
inherit (pkgs) benchwrapper;
};
checks = {
docker = import ./tests/docker.nix (inputs // { inherit pkgs; });
};
}
));
}