-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.nix
executable file
·221 lines (197 loc) · 5.42 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
{ config, lib, pkgs, ... }:
{
### service
services = {
sshd.enable = true;
getty.autologinUser = lib.mkDefault "nix";
openssh.settings.PermitRootLogin = lib.mkDefault "yes";
xserver.xkbOptions = "caps:escape";
pcscd.enable = true;
};
systemd.services.sync-home = {
# don't touch this
enable = true;
wantedBy = [ "default.target" ];
description = "Copy home contents from iso";
serviceConfig = {
Type = "forking";
ExecStartPre = "${pkgs.rsync}/bin/rsync -r /iso/files/ /home/nix";
ExecStart = "${pkgs.coreutils}/bin/chown -R nix /home/nix";
ExecStartPost = "/run/booted-system/sw/bin/sudo -u nix ${pkgs.coreutils}/bin/chmod -R 710 /home/nix";
ExecStop = "";
};
};
systemd.services.update-channel = {
enable = true;
wantedBy = [ "default.target" ];
after = [ "network.target" "network-online.target" ];
description = "Update channel";
serviceConfig = {
Type = "forking";
ExecStartPre = "${pkgs.nix}/bin/nix-channel --remove nixos";
ExecStart = "${pkgs.nix}/bin/nix-channel --add https://mirrors.tuna.tsinghua.edu.cn/nix-channels/nixos-unstable nixos";
ExecStop = "";
};
};
### network
networking = {
firewall.allowedTCPPorts = [ 22 80 1965 2333 ];
hostName = "nixos";
networkmanager.enable = true;
extraHosts = "140.82.112.3 github.com"; # fuck DNS pollution
};
### misc
time.timeZone = "Asia/Shanghai";
users.users.root.password = "nixos";
users.users.nix = {
password = "nixos";
isNormalUser = true;
home = "/home/nix";
extraGroups = [ "wheel" "disk" "audio" "video" "input" "systemd-journal" "networkmanager" "network" ];
};
environment.interactiveShellInit = ''
export PATH=$PATH:$HOME/bin
export VISUAL=vi
export CLICOLOR=1
export PS1='\[\033]0;\u@\h:\w\007\]\[\033[01;32m\]\u@\h\[\033[01;34m\] \w λ\[\033[00m\] '
alias vim=nvim
alias e='emacs -nw'
alias cls=clear
'';
console.useXkbConfig = true;
sound.enable = true;
hardware = {
pulseaudio.enable = true;
pulseaudio.package = pkgs.pulseaudioFull;
gpgSmartcards.enable = true;
enableAllFirmware = true;
};
security.doas = {
enable = true;
wheelNeedsPassword = false;
};
### pkgs
# https://mirrors.tuna.tsinghua.edu.cn/help/nix/
nix.settings.substituters = [ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" ];
nixpkgs.overlays = [
(import (builtins.fetchTarball {
url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
}))
];
nixpkgs.config = {
packageOverrides = pkgs: {
myRepo = import (builtins.fetchTarball "https://github.com/dongdigua/nur-pkg/archive/master.tar.gz") {
inherit pkgs;
};
};
allowUnfree = true;
};
environment.systemPackages = with pkgs; [
# basic
neovim
git
netcat
curl
doas
psmisc
tmux
# development
gcc
gdb
gnumake
lua
binutils
# util
neofetch
gnupg
age
signify
aria2
rsync
fzf
ranger
testdisk
p7zip
pigz
zstd
htop
ripgrep
findutils
myRepo.w3m-gmi
# fun
nyancat
nethack
offpunk
libsixel
irssi
# not quite official
emacsPgtk
myRepo.bsdtetris
];
programs.light.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = false;
extraSessionCommands = "export WLR_NO_HARDWARE_CURSORS=1 MOZ_ENABLE_WAYLAND=1 TOR_SKIP_LAUNCH=1 TOR_TRANSPROXY=1";
extraPackages = with pkgs; [
# sway addition
waybar
mako
rofi-wayland
activate-linux
grim
slurp
wl-clipboard
foot
light
# tools
(tor-browser-bundle-bin.override {
useHardenedMalloc = false; # https://github.com/NixOS/nixpkgs/issues/146401
# as a replacement of firefox, add 200MiB of tor
# TOR_SKIP_LAUNCH=1 TOR_TRANSPROXY=1 (I set this by default bcause of GFW)
# network.proxy.type -> 0
# network.dns.disabled -> false
})
pcmanfm
ffmpeg-full
gparted
#pandoc ghc is too large
feh
frp
# more dev
elixir # 600MiB, but I must have this
rustup # rust itself is 2GiB
racket-minimal # 400MiB, enough for slideshow? full is 900MiB
# net
v2raya
inetutils
hping
nmap
tcpdump
#ifdef hack
nikto
metasploit
radare2
aircrack-ng
macchanger
freerdp
python310Packages.scapy
#endif
];
};
isoImage.contents = [
{ source = ./.emacs; target = "/files/.emacs"; }
{ source = ./.tmux.conf; target = "/files/.tmux.conf"; }
{ source = ./init.vim; target = "/files/.config/nvim/init.vim"; }
{ source = ./.nethackrc; target = "/files/.nethackrc"; }
{ source = ./sway; target = "/files/.config/sway"; }
{ source = ./waybar; target = "/files/.config/waybar"; }
{ source = ./rofi; target = "/files/.config/rofi"; }
# by downloading
{ source = ./centos9-motif.png; target = "/files/Pictures/wallpaper/sway-bg"; }
{ source = ./internet_collections.org; target = "/files/Documents/internet_collections.org"; }
# fallbacks
{ source = ./fallbacks/min-pkg.el; target = "/files/min-pkg.el"; }
{ source = ./fallbacks/foot.ini; target = "/files/.config/foot/foot.ini"; }
];
}