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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
{ config, lib, pkgs, ... }:
let duid = "00:01:00:01:21:a2:4e:a8:d0:bf:9c:45:a6:ec";
in {
imports = [
# ../config/router.nix
# ../config/borg-backup.nix
../config/keycloak.nix
../config/dns.nix
../config/web-server.nix
../config/cgit.nix
];
orbekk.router.enable = true;
orbekk.monitoring-server.enable = true;
orbekk.postfix.enable = true;
orbekk.nextcloud.enable = true;
orbekk.backups.enableServer = true;
orbekk.backups.enableClient = true;
orbekk.vpn.enable = true;
orbekk.bridge.enable = false;
orbekk.zomboid-server.enable = false;
services.tlp.enable = true;
environment.systemPackages = with pkgs; [ ipmitool ];
programs.mosh.enable = true;
orbekk.hledger-web.enable = true;
orbekk.hledger-web.journalFile =
"/var/lib/hledger-web/hledger/anniekj.journal";
services.samba = {
enable = true;
extraConfig = ''
guest account = readonly
map to guest = bad user
'';
shares = {
public = {
path = "/storage/upload";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
"create mask" = "0666";
"directory mask" = "0777";
"force user" = "readonly";
"force group" = "readonly";
};
};
};
services.transmission = {
enable = true;
home = "/storage/upload";
settings.peer-port = 56732;
settings.rpc-bind-address = "0.0.0.0";
settings.rpc-whitelist = "172.20.*.*";
settings.alt-speed-time-enabled = true;
settings.alt-speed-time-begin = 6 * 60; # 06:00
settings.alt-speed-time-end = 23 * 60 + 59; # 23:59
settings.alt-speed-up = 0;
settings.alt-speed-down = 0;
};
systemd.services.transmission.serviceConfig.NetworkNamespacePath = "/var/run/netns/vpn";
users.users.transmission.extraGroups = ["readonly"];
# services.tailscale.enable = true;
# virtualisation.lxd.enable = true;
boot = {
kernelParams = [ "console=tty0" ''console="ttyS0,115200n8"'' ];
loader.grub.extraConfig = ''
GRUB_TERMINAL="serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
serial --speed 115200 --unit=0
terminal_input serial
terminal_output serial
'';
loader.grub.enable = true;
loader.grub.version = 2;
# loader.grub.devices = [ "/dev/sda" "/dev/sdb" ];
loader.grub.mirroredBoots = [
{ devices = [ "/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKEXU9X" ]; path = "/mnt/boot1"; }
{ devices = [ "/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKHV0LS" ]; path = "/mnt/boot2"; }
];
};
networking = { hostName = lib.mkForce "dragon"; };
networking.firewall.enable = false;
networking.interfaces.router-vport.useDHCP = true;
networking.resolvconf.useLocalResolver = false;
networking.dhcpcd.enable = true;
networking.dhcpcd.extraConfig = ''
clientid dragon
'';
# Required to enable password authentication for one user.
security.pam.services.sshd.unixAuth = lib.mkForce true;
services.openssh = {
enable = lib.mkDefault true;
passwordAuthentication = false;
extraConfig = ''
Match User readonly
PasswordAuthentication yes
'';
};
users.users.breakds = {
uid = 1101;
shell = pkgs.bashInteractive;
home = "/home/breakds";
createHome = false;
isNormalUser = true;
description = "Break Yang";
openssh.authorizedKeys.keyFiles = [ ../data/break_rsa.pub ];
};
system.stateVersion = lib.mkForce "17.09";
# hardware-configuration.nix
boot.initrd.availableKernelModules =
[ "ehci_pci" "ahci" "uhci_hcd" "xhci_pci" "usb_storage" "sd_mod" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.tmpOnTmpfs = true;
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-ssd";
fsType = "ext4";
options = [
"noatime,discard"
];
};
fileSystems."/storage" = {
device = "/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKEXU9X-part3";
fsType = "btrfs";
options = [
"subvol=storage,device=/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKHV0LS-part3,device=/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKEXU9X-part3,noatime,discard"
];
};
fileSystems."/home" = {
device = "/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKEXU9X-part3";
fsType = "btrfs";
options = [
"subvol=system/dragon-home,device=/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKHV0LS-part3,device=/dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PCKEXU9X-part3,noatime,discard"
];
};
swapDevices = [ { label = "swap"; } ];
nix.settings.trusted-users = [ "builder" ];
nix.settings.max-jobs = lib.mkDefault 8;
powerManagement.cpuFreqGovernor = "ondemand";
hardware.enableRedistributableFirmware = lib.mkDefault true;
}
|