+11
flake.nix
+11
flake.nix
···
100
100
];
101
101
target = "spindle.alpha.tangled.sh";
102
102
};
103
+
104
+
knot1 = {
105
+
modules = [
106
+
tangled.nixosModules.knot
107
+
./hosts/knot1/services/knot.nix
108
+
./hosts/knot1/services/nginx.nix
109
+
];
110
+
target = "knot1.alpha.tangled.sh";
111
+
};
103
112
};
104
113
in
105
114
{
···
109
118
pds = mkHost "pds" hosts.pds.modules;
110
119
nixery = mkHost "nixery" hosts.nixery.modules;
111
120
spindle = mkHost "spindle" hosts.spindle.modules;
121
+
knot1 = mkHost "knot1" hosts.knot1.modules;
112
122
};
113
123
114
124
# colmena uses this
···
131
141
pds = mkColmenaHost "pds" hosts.pds.target hosts.pds.modules;
132
142
nixery = mkColmenaHost "nixery" hosts.nixery.target hosts.nixery.modules;
133
143
spindle = mkColmenaHost "spindle" hosts.spindle.target hosts.spindle.modules;
144
+
knot1 = mkColmenaHost "knot1" hosts.knot1.target hosts.knot1.modules;
134
145
};
135
146
};
136
147
}
+57
hosts/knot1/configuration.nix
+57
hosts/knot1/configuration.nix
···
1
+
{ modulesPath
2
+
, lib
3
+
, pkgs
4
+
, ...
5
+
} @ args:
6
+
{
7
+
imports = [
8
+
(modulesPath + "/installer/scan/not-detected.nix")
9
+
(modulesPath + "/profiles/qemu-guest.nix")
10
+
./disk-config.nix
11
+
];
12
+
boot.loader.grub = {
13
+
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
14
+
# devices = [ ];
15
+
efiSupport = true;
16
+
efiInstallAsRemovable = true;
17
+
};
18
+
19
+
networking.hostName = "knot1-ams";
20
+
services = {
21
+
openssh.enable = true;
22
+
};
23
+
24
+
25
+
nix = {
26
+
extraOptions = ''
27
+
experimental-features = nix-command flakes ca-derivations
28
+
warn-dirty = false
29
+
keep-outputs = false
30
+
'';
31
+
};
32
+
33
+
environment.systemPackages = map lib.lowPrio [
34
+
pkgs.curl
35
+
pkgs.gitMinimal
36
+
];
37
+
38
+
users.users.tangler = {
39
+
extraGroups = [ "networkmanager" "wheel" "docker" ];
40
+
openssh.authorizedKeys.keys = args.commonArgs.sshKeys;
41
+
isNormalUser = true;
42
+
};
43
+
44
+
security.sudo.extraRules = [
45
+
{
46
+
users = [ "tangler" ];
47
+
commands = [
48
+
{
49
+
command = "ALL";
50
+
options = [ "NOPASSWD" ];
51
+
}
52
+
];
53
+
}
54
+
];
55
+
56
+
system.stateVersion = "25.05";
57
+
}
+56
hosts/knot1/disk-config.nix
+56
hosts/knot1/disk-config.nix
···
1
+
# Example to create a bios compatible gpt partition
2
+
{ lib, ... }:
3
+
{
4
+
disko.devices = {
5
+
disk.disk1 = {
6
+
device = lib.mkDefault "/dev/vda";
7
+
type = "disk";
8
+
content = {
9
+
type = "gpt";
10
+
partitions = {
11
+
boot = {
12
+
name = "boot";
13
+
size = "1M";
14
+
type = "EF02";
15
+
};
16
+
esp = {
17
+
name = "ESP";
18
+
size = "500M";
19
+
type = "EF00";
20
+
content = {
21
+
type = "filesystem";
22
+
format = "vfat";
23
+
mountpoint = "/boot";
24
+
};
25
+
};
26
+
root = {
27
+
name = "root";
28
+
size = "100%";
29
+
content = {
30
+
type = "lvm_pv";
31
+
vg = "pool";
32
+
};
33
+
};
34
+
};
35
+
};
36
+
};
37
+
lvm_vg = {
38
+
pool = {
39
+
type = "lvm_vg";
40
+
lvs = {
41
+
root = {
42
+
size = "100%FREE";
43
+
content = {
44
+
type = "filesystem";
45
+
format = "ext4";
46
+
mountpoint = "/";
47
+
mountOptions = [
48
+
"defaults"
49
+
];
50
+
};
51
+
};
52
+
};
53
+
};
54
+
};
55
+
};
56
+
}
+11
hosts/knot1/services/knot.nix
+11
hosts/knot1/services/knot.nix
+35
hosts/knot1/services/nginx.nix
+35
hosts/knot1/services/nginx.nix
···
1
+
{
2
+
services.nginx = {
3
+
enable = true;
4
+
virtualHosts = {
5
+
"knot1.alpha.tangled.sh" = {
6
+
forceSSL = true;
7
+
enableACME = true;
8
+
locations."/" = {
9
+
proxyPass = "http://127.0.0.1:5555";
10
+
11
+
extraConfig = ''
12
+
proxy_set_header X-Forwarded-For $remote_addr;
13
+
proxy_set_header Host $host;
14
+
proxy_set_header X-Real-IP $remote_addr;
15
+
proxy_set_header X-Forwarded-Proto $scheme;
16
+
'';
17
+
};
18
+
locations."/events" = {
19
+
proxyPass = "http://127.0.0.1:5555";
20
+
extraConfig = ''
21
+
proxy_set_header X-Forwarded-For $remote_addr;
22
+
proxy_set_header Host $host;
23
+
proxy_set_header Upgrade $http_upgrade;
24
+
proxy_set_header Connection "upgrade";
25
+
'';
26
+
};
27
+
};
28
+
};
29
+
};
30
+
security.acme = {
31
+
acceptTerms = true;
32
+
defaults.email = "team@tangled.org";
33
+
};
34
+
networking.firewall.allowedTCPPorts = [ 80 443 ];
35
+
}