forked from NotAShelf/nyx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployments.nix
63 lines (61 loc) · 1.49 KB
/
deployments.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
{
inputs,
self,
lib,
...
}: let
includedNodes = ["enyo" "helios"];
mkNode = name: cfg: let
inherit (cfg.pkgs.stdenv.hostPlatform) system;
deployLib = inputs.deploy-rs.lib.${system};
in {
# this looks pretty goofy, I should get a simpler domain
# it's actually hostname.namespace.domain.tld but my domain and namespace are the same
hostname = "${name}.notashelf.notashelf.dev";
sshOpts = ["-p" "30"];
skipChecks = true;
# currently only a single profile system
profilesOrder = ["system"];
profiles.system = {
sshUser = "root";
user = "root";
path = deployLib.activate.nixos cfg;
};
};
nodes = lib.mapAttrs mkNode (lib.filterAttrs (name: _: lib.elem name includedNodes) self.nixosConfigurations);
in {
flake = {
deploy = {
autoRollback = true;
magicRollback = true;
inherit nodes;
};
};
perSystem = {
pkgs,
system,
...
}: let
deployPkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.deploy-rs.overlay
(_: prev: {
deploy-rs = {
inherit (pkgs) deploy-rs;
inherit (prev.deploy-rs) lib;
};
})
];
};
in {
# evaluation of deployChecks is slow
# checks = (deployPkgs.deploy-rs.lib.deployChecks self.deploy)
apps.deploy = {
type = "app";
program = pkgs.writeShellScriptBin "deploy" ''
${deployPkgs.deploy-rs.deploy-rs}/bin/deploy --skip-checks
'';
};
};
}