-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.nix
385 lines (302 loc) · 8.8 KB
/
home.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
{
config,
lib,
...
}:
let
username = builtins.getEnv "USER";
homeDirectory = builtins.getEnv "HOME";
isNixOS = builtins.pathExists "/etc/NIXOS";
colorscheme = import ./colorscheme.nix;
nixGLPrefix = if isNixOS then "" else "${channels.nixpkgs-unstable.nixGL.auto.nixGLDefault}/bin/nixGL ";
channels = (import ./channels.nix).channels;
binaryNinjaURL = import ./binary-ninja/binary-ninja-url.nix;
binaryNinjaConfig = import ./binary-ninja/config.nix {
inherit channels binaryNinjaURL;
};
# Packages to build, as they are not on NixPkgs
customPackages = {
de4dot = channels.nixpkgs-unstable.callPackage ./de4dot/de4dot.nix { };
redress = channels.nixpkgs-unstable.callPackage ./redress/redress.nix { };
webcrack = channels.nixpkgs-unstable.callPackage ./webcrack/webcrack.nix { };
frida-tools = channels.nixpkgs-unstable.callPackage ./dependencies/frida-tools.nix { };
decompylepp = channels.nixpkgs-unstable.callPackage ./decompylepp/decompylepp.nix { };
detect-it-easy = channels.nixpkgs-unstable.callPackage ./detect-it-easy/detect-it-easy.nix { };
net-reactor-slayer = channels.nixpkgs-unstable.callPackage ./net-reactor-slayer/net-reactor-slayer.nix { };
# Python Packages
capa = channels.nixpkgs-unstable.callPackage ./capa/capa.nix { };
speakeasy = channels.nixpkgs-unstable.callPackage ./speakeasy/speakeasy.nix { };
binary-refinery = channels.nixpkgs-unstable.callPackage ./binary-refinery/binary-refinery.nix { };
donut-decryptor = channels.nixpkgs-unstable.callPackage ./donut-decryptor/donut-decryptor.nix { };
dncil = channels.nixpkgs-unstable.callPackage ./dependencies/dncil.nix { };
binary-ninja = channels.nixpkgs-unstable.callPackage ./binary-ninja/binary-ninja.nix {
binaryNinjaUrl = binaryNinjaURL.binaryNinjaUrl;
binaryNinjaHash = binaryNinjaURL.binaryNinjaHash;
pythonEnv = binaryNinjaConfig.pythonEnv;
};
};
# Work-specific
fileExists = path: if builtins.pathExists path then import path { inherit channels lib; } else {};
workConfig = fileExists ./work/work.nix;
# Python Environments
pythonEnvs = import ./python/venvs.nix { inherit channels customPackages; binaryNinjaEnv = binaryNinjaConfig.pythonEnv; };
in
{
imports = [
channels.nixvim.homeManagerModules.nixvim
# Window Manager
(import ./i3/i3.nix { inherit channels config lib nixGLPrefix; })
# Git
(import (if builtins.pathExists ./work/git/git.nix then ./work/git/git.nix else ./git/git.nix) { inherit channels; } )
# Terminal Setup
(import ./tmux/tmux.nix { inherit channels; })
# (import ./kitty/kitty.nix { inherit channels colorscheme; })
# (import ./alacritty/alacritty.nix { inherit channels colorscheme; })
(import ./yazi/yazi.nix { inherit channels config colorscheme workConfig nixGLPrefix; })
(import ./zsh/zsh.nix { inherit lib channels customPackages workConfig nixGLPrefix colorscheme; })
(import ./neovim/neovim.nix { inherit channels homeDirectory; })
(import ./rofi/rofi.nix { inherit channels config; })
(import ./contour/settings.nix { inherit channels config lib; })
(import ./contour/contour.nix { inherit channels lib colorscheme; })
(import ./zoxide/zoxide.nix { inherit channels; })
./zathura/zathura.nix
./malwoverview/malwoverview.nix
# Services
(import ./picom/picom.nix { inherit channels; })
binaryNinjaConfig.binaryNinjaConfig
# Program Setup
(import ./firefox/firefox.nix { inherit channels lib; })
];
programs.home-manager = {
enable = true;
path = "${channels.nixpkgs-unstable.home-manager.src}";
};
home = {
username = username;
homeDirectory = homeDirectory;
packages = (with channels.nixpkgs-unstable // customPackages; [
# VM tools
open-vm-tools
# Backup File Manager
nautilus
# Touchpad
libinput-gestures
wmctrl
xdotool
# Display
brightnessctl
# Nix-specific tools
nurl
nix-init
node2nix
nuget-to-nix
i3
i3status-rust
# Needed by i3status-rust
xorg.setxkbmap
# Find pressed key
xorg.xev
# kitty
# alacritty
contour
tmux
git
zsh-fast-syntax-highlighting
oh-my-zsh
thefuck
tealdeer
man-pages
man-pages-posix
_7zz
(hiPrio bat)
ouch
htop
glances
neofetch
glow
obsidian
lxqt.screengrab
# RSS
nom
# Web
#firefox
# Social
discord
# Utilities
xclip
xsel
xdragon
jless
p7zip
unar
lsd
zoxide
fzf
fd
ripgrep
jq
yazi
hexyl
rofi
inxi
ffmpegthumbnailer
mediainfo
exiftool
unar
file
poppler
#shared-mime-info
lazygit
poetry
flatpak # TODO: Make declarative
gcc
zig
rustup
rustlings
typescript
nodejs_22
sqlitebrowser
## Malware Analysis
# Triage
malwoverview
# Binary Analysis
detect-it-easy
binary-ninja
frida-tools
flare-floss
imhex
capa
upx
yara-x
yaralyzer
# Family-Specific
donut-decryptor
# InnoSetup
innoextract
# Networking
wireshark
# JavaScript
webcrack
# Java
jadx
# .NET
avalonia-ilspy
ilspycmd
de4dot
net-reactor-slayer
# Go
goresym
redress
# Python
decompylepp
# Android
apktool
# Emulation
speakeasy
# TODO
# rustbinsign (+rustup) - This should be possible w/ poetry?
# IDR
# Custom Python environment
(channels.nixpkgs-unstable.python312.withPackages (ps: with channels.nixpkgs-unstable.python312Packages; [
pip
setuptools
wheel
# Regex
exrex
# Networking
requests
flask
netifaces
mitmproxy
# Binary Analysis
binary-refinery
frida-python
construct
# .NET
dnfile
dncil
# Emulation
unicorn
capstone
] ++ (workConfig.home.pythonPackages or [])))
# qilling
# mkyara (?)
# pycdc
# view8
# bindiff (?)
# innoump
# Containers
dive
distrobox
# podman is broken on nix at the moment, if not on NixOS
# podman
# podman-tui
# podman-compose
# Fonts
(nerdfonts.override { fonts = [ "CascadiaCode" ]; })
]) ++ (workConfig.home.packages or []) ++ (if !isNixOS then [ channels.nixpkgs-unstable.nixGL.auto.nixGLDefault ] else []);
# Create symlinks to the Python venvs in ~/.virtualenvs
activation.buildPythonEnvs = lib.mkAfter ''
echo "Building Python environments..."
${lib.concatStringsSep "\n" (map (env:
''
VENV_DIR="${config.home.homeDirectory}/.virtualenvs/${env.name}"
# Ensure the environment directory exists
mkdir -p "$VENV_DIR"
# Remove any existing symlinks
find "$VENV_DIR" -maxdepth 1 -type l -exec rm -f {} \;
# Create a symlink to the Python environment
ln -sf ${env.pythonEnv} "$VENV_DIR"
# Create a symlink to the Python binary
mkdir -p "$VENV_DIR/bin"
ln -sf ${env.pythonEnv}/bin/python "$VENV_DIR/bin/python"
''
) pythonEnvs.envs)}
'';
sessionVariables = {
EDITOR = "nvim";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
XDG_DATA_DIRS = "$HOME/.nix-profile/share:$XDG_DATA_DIRS";
FONTCONFIG_PATH = "$HOME/.nix-profile/share/fonts/truetype";
PATH = "$PATH:$HOME/.local/bin";
};
file.".xsessionrc" = {
text = ''
#!/bin/sh
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
export XDG_DATA_DIRS="$HOME/.nix-profile/share:$XDG_DATA_DIRS"
export XDG_DATA_DIRS="$HOME/.local/share:$XDG_DATA_DIRS"
export FONTCONFIG_PATH="$HOME/.nix-profile/etc/fonts"
'';
executable = true;
};
file.".local/share/applications/i3.desktop" = {
text = ''
[Desktop Entry]
Name=i3
Comment=improved dynamic tiling window manager
Exec=${homeDirectory}/.nix-profile/bin/i3
Type=Application
'';
executable = false;
};
file.".local/bin/DRAG_TO_VM" = {
text = ''
#!${channels.nixpkgs-unstable.zsh}/bin/zsh
dragon --target | while read dst
do
cp "''${dst//file:\/\//}" .
done
'';
executable = true;
};
stateVersion = "23.11";
};
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
};
}