-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration-laptop.nix
168 lines (140 loc) · 3.86 KB
/
configuration-laptop.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
155
156
157
158
159
160
161
162
163
164
165
166
167
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, inputs, ... }:
let
pa-volume = pkgs.writeScript "pa-volume" ''
#!${pkgs.bash}/bin/bash
for sink in $(${pkgs.pulseaudio}/bin/pactl list sinks | grep "Sink #" | cut -b7-);
do
${pkgs.pulseaudio}/bin/pactl -- set-sink-volume $sink $1%
done
'';
pa-mute = pkgs.writeScript "pa-mute" ''
#!${pkgs.bash}/bin/bash
for sink in $(${pkgs.pulseaudio}/bin/pactl list sinks | grep "Sink #" | cut -b7-);
do
${pkgs.pulseaudio}/bin/pactl -- set-sink-mute $sink toggle;
done
'';
secrets = inputs.secrets.secrets;
in {
nixpkgs.config.allowUnfree = true;
imports =
[ # Include the results of the hardware scan.
./hardware-configuration-laptop.nix
./pkgs.nix
./environment.nix
./users.nix
./services.nix
./openvpn.nix
./hosts.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot = {
enable = true;
memtest86.enable = true;
};
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_5_10;
boot.kernel.sysctl = {
"net.ipv4.ip_default_ttl" = 65;
"kernel.perf_event_paranoid" = 1;
"net.ipv4.ip_nonlocal_bind" = 1;
};
nixpkgs.config.permittedInsecurePackages = [
"openssl-1.0.2u"
];
hardware.opengl.driSupport32Bit = true;
programs = {
# steam.enable = true;
adb.enable = true;
};
zramSwap = {
enable = true;
numDevices = 12;
memoryPercent = 100;
};
security.wrappers = {
ubridge = {
source = "${pkgs.ubridge}/bin/ubridge";
capabilities = "cap_net_admin,cap_net_raw=ep";
};
};
networking = {
hostName = "laptop";
useDHCP = false;
interfaces.wlan0.useDHCP = true;
interfaces.enp3s0f4u1.useDHCP = true;
wireless = {
iwd.enable = true;
# enable = true;
networks = {
"${secrets.home_wifi_ssid}" = {
psk = secrets.home_wifi_pass;
priority = 0;
};
"${secrets.smart_wifi_ssid}" = {
psk = secrets.smart_wifi_pass;
priority = 100;
};
"JuicySmoke" = {
psk = "juicysmoke";
priority = 50;
};
};
};
};
programs.light.enable = true;
services.acpid = {
enable = true;
logEvents = true;
acEventCommands = ''
# ac_adapter ACPI0003:00 00000080 00000000
export PATH=${pkgs.gawk}/bin:${pkgs.linuxPackages_5_10.cpupower}/bin:$PATH
AC_STATUS=$(echo $1 | awk '{print $4}')
if [[ $AC_STATUS == 00000001 ]]; then
cpupower frequency-set --max 2100000 --governor performance
else
cpupower frequency-set --max 1400000 --governor powersave
fi
'';
};
services.openvpn.servers = {
mj = {
config = "config /etc/openvpn/mj.conf";
autoStart = true;
updateResolvConf = true;
};
nh = {
config = "config /etc/openvpn/nh.conf";
autoStart = true;
updateResolvConf = true;
};
};
services.xserver = {
enable = true;
displayManager = {
defaultSession = "none+i3";
#lightdm.greeters.pantheon.enable = true;
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu polybarFull i3lock-fancy i3lock-fancy-rapid
];
};
synaptics.enable = true;
};
nix = {
gc.automatic = true;
gc.options = "--delete-older-than 14d";
requireSignedBinaryCaches = false;
package = pkgs.nixUnstable;
extraOptions = ''
binary-caches = https://cache.nixos.org/
experimental-features = nix-command flakes
'';
};
system.stateVersion = "20.03"; # Did you read the comment?
}