-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
96 lines (93 loc) · 2.44 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
95
96
{
inputs = {
nixpkgs = {
# url = "github:NixOS/nixpkgs/nixos-unstable-small";
url = "github:NixOS/nixpkgs/nixos-unstable";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
dns = {
url = "github:nix-community/dns.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
redlib = {
url = "github:redlib-org/redlib";
flake = false; # (using as source for pkgs.redlib)
};
uptime-kuma = {
url = "github:louislam/uptime-kuma/2.0.0-beta.1";
flake = false;
};
};
outputs = inputs@{ self, nixpkgs, deploy-rs, dns, ... }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
specialArgs = {
inherit self inputs system dns;
};
mkNixosSystem = host: extraModules: (
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = specialArgs // {
inherit host;
};
modules = [
{ networking.hostName = host; }
./hosts/${host}/configuration.nix
./secrets/schema.nix
./secrets/credentials.nix
./modules/base
] ++ extraModules;
}
);
mkDeployProfile = hostname: host: {
inherit hostname;
sshUser = "nixos";
user = "root";
profiles.system.path =
deploy-rs.lib.${system}.activate.nixos
self.nixosConfigurations.${host};
};
in {
nixosConfigurations = {
oci1 = mkNixosSystem "oci1" [
{
cfg.services = {
dns-server.enable = true;
file-server-endpoint.enable = true;
webdav-endpoint.enable = true;
kanidm.enable = true;
uptime-kuma.enable = true;
};
}
];
oci2 = mkNixosSystem "oci2" [
{
cfg.services = {
dns-server.enable = true;
redlib.enable = true;
# nitter.enable = true; # TODO fix; borked
ntfy.enable = true;
};
}
];
};
# deploy-rs configuration
deploy.nodes = {
oci1 = mkDeployProfile "oci1.girl.pp.ua" "oci1";
oci2 = mkDeployProfile "oci2.girl.pp.ua" "oci2";
};
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy)
deploy-rs.lib;
# dev shells
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
pkgs.deploy-rs
git-crypt
];
};
};
}