This repository has been archived by the owner on Jan 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
configuration.nix
154 lines (124 loc) · 4.69 KB
/
configuration.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
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
{ lib, ... }:
with lib;
let
pinnedNH =
let
nixpkgs = import ../../external/nixpkgs-stable.nix;
pkgs = import nixpkgs {
config = {};
overlays = [];
};
in import ../../external/nixos-hardware.nix {
inherit (pkgs) fetchpatch runCommand;
};
nasreddineCA = builtins.readFile (builtins.fetchurl {
url = "https://s3-us-west-1.amazonaws.com/nasreddine-infra/ca.crt";
sha256 = "17x45njva3a535czgdp5z43gmgwl0lk68p4mgip8jclpiycb6qbl";
});
enableExpressVPN = builtins.pathExists /yl/private/network-secrets/vpn/client/expressvpn/auth.txt
&& builtins.pathExists /yl/private/network-secrets/vpn/client/expressvpn/ca2.crt
&& builtins.pathExists /yl/private/network-secrets/vpn/client/expressvpn/client.crt
&& builtins.pathExists /yl/private/network-secrets/vpn/client/expressvpn/client.key
&& builtins.pathExists /yl/private/network-secrets/vpn/client/expressvpn/ta.key;
enableNasreddineVPN = builtins.pathExists /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/ca.crt
&& builtins.pathExists /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/public.crt
&& builtins.pathExists /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/private.key
&& builtins.pathExists /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/ta.key;
in {
imports = [
./hardware-configuration.nix
"${pinnedNH}/common/cpu/intel"
"${pinnedNH}/common/pc/laptop"
"${pinnedNH}/common/pc/laptop/ssd"
../../modules/nixos
./home.nix
];
boot.tmpOnTmpfs = true;
# set the default locale and the timeZone
i18n.defaultLocale = "en_US.UTF-8";
time.timeZone = "America/Los_Angeles";
networking.hostName = "hades";
nix.buildMachines =
if builtins.pathExists /yl/private/network-secrets/shabka/hosts/zeus/id_rsa then
[{
hostName = "zeus.home.nasreddine.com";
sshUser = "builder";
sshKey = "/yl/private/network-secrets/shabka/hosts/zeus/id_rsa";
system = "x86_64-linux";
maxJobs = 8;
speedFactor = 2;
supportedFeatures = [ ];
mandatoryFeatures = [ ];
}] else [];
nix.extraOptions = ''
builders-use-substitutes = true
'';
mine.hardware.intel_backlight.enable = true;
mine.printing.enable = true;
mine.useColemakKeyboardLayout = true;
mine.virtualisation.docker.enable = true;
mine.workstation = {
enable = true;
autorandr.enable = true;
keeptruckin.enable = true;
};
mine.openvpn.client.expressvpn = mkIf enableExpressVPN {
enable = true;
auth_user_pass = /yl/private/network-secrets/vpn/client/expressvpn/auth.txt;
ca = /yl/private/network-secrets/vpn/client/expressvpn/ca2.crt;
client_cert = /yl/private/network-secrets/vpn/client/expressvpn/client.crt;
client_key = /yl/private/network-secrets/vpn/client/expressvpn/client.key;
tls_auth = /yl/private/network-secrets/vpn/client/expressvpn/ta.key;
};
mine.hardware.machine = "precision-7530";
# Set the hardware clock to local time to support dual booting with Windows.
time.hardwareClockInLocalTime = true;
# Detect windows Hard Drive
boot.loader.grub.useOSProber = true;
services.logind.extraConfig = ''
HandlePowerKey=suspend
'';
security.pki.certificates = [
nasreddineCA
];
services.snapper = {
configs = {
"code" = {
subvolume = "/yl/code";
};
"home" = {
subvolume = "/home";
};
"private" = {
subvolume = "/yl/private";
};
};
};
services.openvpn.servers = {
client-nasreddine = mkIf enableNasreddineVPN {
autoStart = false;
config = ''
client
dev tun
proto udp
remote vpn.nasreddine.com 1194
nobind
persist-key
persist-tun
ca /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/ca.crt
cert /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/public.crt
key /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/private.key
tls-auth /yl/private/network-secrets/vpn/client/desktop.hades.WaelNasreddine.vpn.nasreddine.com/ta.key 1
verb 1
cipher aes-128-cbc
comp-lzo
'';
updateResolvConf = true;
};
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.09"; # Did you read the comment?
}