2023-04-14 11:12:45 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
2023-09-12 12:46:44 +00:00
|
|
|
myData,
|
2023-04-14 11:12:45 +00:00
|
|
|
...
|
2024-07-29 12:39:54 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-03-04 12:53:50 +00:00
|
|
|
cfg = config.mj;
|
2024-07-29 12:39:54 +00:00
|
|
|
in
|
|
|
|
{
|
2023-04-14 11:12:45 +00:00
|
|
|
imports = [
|
2023-07-20 03:58:47 +00:00
|
|
|
./sshd
|
|
|
|
./unitstatus
|
2023-07-20 12:02:38 +00:00
|
|
|
./users
|
2023-04-14 11:12:45 +00:00
|
|
|
];
|
|
|
|
|
2023-07-20 12:02:38 +00:00
|
|
|
options.mj = with lib.types; {
|
2023-04-14 11:12:45 +00:00
|
|
|
stateVersion = lib.mkOption {
|
2023-07-20 12:02:38 +00:00
|
|
|
type = str;
|
2023-04-14 11:12:45 +00:00
|
|
|
example = "22.11";
|
|
|
|
description = "The NixOS state version to use for this system";
|
|
|
|
};
|
2023-07-20 12:02:38 +00:00
|
|
|
|
2023-04-14 11:12:45 +00:00
|
|
|
timeZone = lib.mkOption {
|
2023-07-20 12:02:38 +00:00
|
|
|
type = str;
|
2023-04-14 11:12:45 +00:00
|
|
|
example = "Europe/Vilnius";
|
|
|
|
description = "Time zone for this system";
|
|
|
|
};
|
2024-03-04 12:53:50 +00:00
|
|
|
|
2024-07-29 12:39:54 +00:00
|
|
|
username = lib.mkOption { type = str; };
|
2024-03-07 11:08:40 +00:00
|
|
|
|
2023-04-14 11:12:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2024-03-06 10:48:27 +00:00
|
|
|
boot = {
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/83694#issuecomment-605657381
|
2024-03-13 12:32:34 +00:00
|
|
|
kernel.sysctl = {
|
|
|
|
"kernel.sysrq" = "438";
|
|
|
|
"kernel.perf_event_paranoid" = "-1";
|
2024-03-13 12:37:04 +00:00
|
|
|
"kernel.kptr_restrict" = "0";
|
2024-03-13 12:32:34 +00:00
|
|
|
};
|
2024-03-06 10:48:27 +00:00
|
|
|
|
2024-05-30 14:25:54 +00:00
|
|
|
kernelPackages = lib.mkDefault pkgs.linuxPackages;
|
2024-03-13 14:19:00 +00:00
|
|
|
|
2025-01-18 20:37:04 +00:00
|
|
|
supportedFilesystems = [
|
|
|
|
"btrfs"
|
|
|
|
"ext4"
|
|
|
|
];
|
2024-03-06 10:48:27 +00:00
|
|
|
};
|
2024-01-13 21:39:49 +00:00
|
|
|
|
2024-03-06 10:48:27 +00:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
2024-03-06 08:37:59 +00:00
|
|
|
|
2023-09-14 08:30:14 +00:00
|
|
|
hardware.enableRedistributableFirmware = true;
|
2023-09-14 07:53:01 +00:00
|
|
|
|
2024-03-04 12:53:50 +00:00
|
|
|
time.timeZone = cfg.timeZone;
|
2023-04-14 11:12:45 +00:00
|
|
|
|
2023-09-12 12:46:44 +00:00
|
|
|
mj.services.friendlyport.ports = [
|
|
|
|
{
|
2024-07-29 12:39:54 +00:00
|
|
|
subnets = [ myData.subnets.tailscale.cidr ];
|
|
|
|
tcp = [ config.services.iperf3.port ];
|
|
|
|
udp = [ config.services.iperf3.port ];
|
2023-09-12 12:46:44 +00:00
|
|
|
}
|
|
|
|
];
|
2023-09-11 18:59:43 +00:00
|
|
|
|
2023-04-14 11:12:45 +00:00
|
|
|
i18n = {
|
2023-12-20 15:07:54 +00:00
|
|
|
defaultLocale = "en_US.UTF-8";
|
2024-07-29 12:39:54 +00:00
|
|
|
supportedLocales = [ "all" ];
|
2023-04-14 11:12:45 +00:00
|
|
|
};
|
|
|
|
|
2023-07-20 08:56:08 +00:00
|
|
|
nix = {
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
2023-10-01 21:20:40 +00:00
|
|
|
dates = "weekly";
|
2024-07-30 21:51:35 +00:00
|
|
|
options = "--delete-older-than 7d";
|
2023-07-20 08:56:08 +00:00
|
|
|
};
|
|
|
|
settings = {
|
2024-07-29 12:39:54 +00:00
|
|
|
experimental-features = [
|
|
|
|
"nix-command"
|
|
|
|
"flakes"
|
|
|
|
];
|
|
|
|
trusted-users = [ cfg.username ];
|
2023-07-20 08:56:08 +00:00
|
|
|
};
|
|
|
|
};
|
2023-04-14 11:12:45 +00:00
|
|
|
|
2024-03-04 12:53:50 +00:00
|
|
|
system.stateVersion = cfg.stateVersion;
|
2023-04-14 11:12:45 +00:00
|
|
|
|
|
|
|
security = {
|
|
|
|
sudo = {
|
|
|
|
wheelNeedsPassword = false;
|
|
|
|
execWheelOnly = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
2024-07-29 12:39:54 +00:00
|
|
|
systemPackages =
|
|
|
|
with pkgs;
|
2024-03-07 11:08:40 +00:00
|
|
|
lib.mkMerge [
|
|
|
|
[
|
2024-06-10 11:28:07 +00:00
|
|
|
bc
|
2024-03-07 11:08:40 +00:00
|
|
|
jc # parse different formats and command outputs to json
|
|
|
|
jq # parse, format and query json documents
|
2024-03-27 13:42:53 +00:00
|
|
|
yq
|
2025-01-26 15:34:58 +00:00
|
|
|
xz
|
2024-03-07 11:08:40 +00:00
|
|
|
pv # pipe viewer for progressbars in pipes
|
|
|
|
bat # "bat - cat with wings", cat|less with language highlight
|
|
|
|
duf # nice disk usage output
|
|
|
|
git
|
2024-04-08 06:33:17 +00:00
|
|
|
lz4
|
2024-04-03 14:43:20 +00:00
|
|
|
fio
|
2024-03-07 11:08:40 +00:00
|
|
|
htop
|
|
|
|
file # file duh
|
|
|
|
host # look up host info
|
|
|
|
tree # tree duh
|
|
|
|
lsof # lsof yay
|
|
|
|
rage # encrypt-decrypt
|
|
|
|
ncdu # disk usage navigator
|
2024-08-01 11:05:10 +00:00
|
|
|
btdu
|
2024-03-07 11:08:40 +00:00
|
|
|
lshw
|
|
|
|
entr
|
|
|
|
cloc
|
|
|
|
poop # hopefully poof some day
|
2025-01-26 15:34:58 +00:00
|
|
|
pigz
|
|
|
|
zstd
|
2024-06-11 06:27:13 +00:00
|
|
|
flex
|
|
|
|
bison
|
2024-03-25 11:20:46 +00:00
|
|
|
s-tui # stress and monitor cpu
|
2025-01-26 15:34:58 +00:00
|
|
|
unrar
|
2024-06-04 13:23:50 +00:00
|
|
|
iotop
|
2024-05-22 10:31:36 +00:00
|
|
|
wdiff
|
2024-03-07 11:08:40 +00:00
|
|
|
tokei
|
|
|
|
sshfs
|
|
|
|
pwgen
|
2024-06-03 08:31:45 +00:00
|
|
|
below # tracking cgroups
|
2024-03-21 07:37:32 +00:00
|
|
|
mdadm
|
2025-01-26 15:34:58 +00:00
|
|
|
zopfli
|
|
|
|
brotli
|
2024-09-29 20:51:01 +00:00
|
|
|
bindfs
|
2024-08-24 17:05:31 +00:00
|
|
|
spiped
|
2024-03-07 11:08:40 +00:00
|
|
|
parted
|
|
|
|
bloaty
|
|
|
|
dhcpcd
|
|
|
|
hdparm
|
|
|
|
sdparm
|
|
|
|
procps
|
2024-06-05 21:15:46 +00:00
|
|
|
unison
|
2025-02-16 20:56:41 +00:00
|
|
|
usbtop
|
2024-06-03 06:35:57 +00:00
|
|
|
vmtouch
|
2024-03-07 11:08:40 +00:00
|
|
|
vimv-rs
|
|
|
|
sysstat
|
|
|
|
ripgrep
|
|
|
|
ethtool
|
|
|
|
gettext
|
2024-10-29 20:16:49 +00:00
|
|
|
exiftool
|
2024-07-31 06:10:23 +00:00
|
|
|
bpftrace
|
2024-03-07 11:08:40 +00:00
|
|
|
keyutils
|
2024-03-07 12:18:17 +00:00
|
|
|
libkcapi
|
2024-03-07 11:08:40 +00:00
|
|
|
usbutils
|
|
|
|
pciutils
|
|
|
|
bsdgames
|
|
|
|
parallel
|
|
|
|
yamllint
|
|
|
|
binutils
|
2024-09-05 19:51:15 +00:00
|
|
|
dos2unix
|
2024-05-16 06:09:06 +00:00
|
|
|
patchelf
|
2025-01-26 15:34:58 +00:00
|
|
|
compsize
|
2025-01-23 09:04:34 +00:00
|
|
|
p7zip-rar
|
2024-03-07 11:08:40 +00:00
|
|
|
hyperfine
|
|
|
|
stress-ng
|
|
|
|
dmidecode
|
|
|
|
moreutils
|
2024-12-30 20:39:50 +00:00
|
|
|
sloccount
|
2024-03-07 11:08:40 +00:00
|
|
|
cryptsetup
|
|
|
|
lm_sensors
|
2024-05-10 20:02:01 +00:00
|
|
|
inotify-info
|
|
|
|
inotify-tools
|
2024-03-07 11:08:40 +00:00
|
|
|
smartmontools
|
|
|
|
unixtools.xxd
|
|
|
|
bcachefs-tools
|
2025-01-26 15:34:58 +00:00
|
|
|
ghostty.terminfo
|
2024-06-30 21:14:25 +00:00
|
|
|
sqlite-interactive
|
2024-03-07 11:08:40 +00:00
|
|
|
|
|
|
|
# networking
|
|
|
|
wol
|
|
|
|
dig
|
|
|
|
nmap
|
|
|
|
wget
|
|
|
|
btop
|
|
|
|
ngrep
|
|
|
|
iftop
|
|
|
|
whois
|
|
|
|
ipset
|
2024-04-12 11:57:56 +00:00
|
|
|
shfmt
|
2024-03-07 11:08:40 +00:00
|
|
|
iperf3
|
|
|
|
jnettop
|
|
|
|
openssl
|
|
|
|
tcpdump
|
|
|
|
testssl
|
|
|
|
dnsutils
|
2024-10-10 02:23:28 +00:00
|
|
|
curlHTTP3
|
2024-03-07 11:08:40 +00:00
|
|
|
bandwhich
|
2024-05-14 13:52:32 +00:00
|
|
|
bridge-utils
|
2024-03-07 11:08:40 +00:00
|
|
|
speedtest-cli
|
|
|
|
nix-output-monitor
|
|
|
|
|
2025-01-23 09:12:24 +00:00
|
|
|
config.boot.kernelPackages.perf
|
2025-02-05 20:20:46 +00:00
|
|
|
config.boot.kernelPackages.vm-tools
|
2025-02-19 18:52:49 +00:00
|
|
|
|
|
|
|
# non-virtual
|
|
|
|
powerstat
|
2025-02-05 20:20:46 +00:00
|
|
|
config.boot.kernelPackages.cpupower
|
2024-03-07 11:08:40 +00:00
|
|
|
]
|
2025-01-23 09:04:34 +00:00
|
|
|
(lib.mkIf (pkgs.stdenv.hostPlatform.system == "x86_64-linux") [ wrk2 ])
|
2024-03-07 11:08:40 +00:00
|
|
|
];
|
2023-04-14 11:12:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
programs = {
|
2024-06-05 11:35:29 +00:00
|
|
|
nano.enable = false;
|
2023-04-14 11:12:45 +00:00
|
|
|
mtr.enable = true;
|
2023-11-22 16:09:15 +00:00
|
|
|
bcc.enable = true;
|
2023-08-15 04:09:11 +00:00
|
|
|
|
2023-08-18 20:45:13 +00:00
|
|
|
tmux = {
|
|
|
|
enable = true;
|
|
|
|
keyMode = "vi";
|
2023-10-09 06:42:11 +00:00
|
|
|
historyLimit = 1000000;
|
2023-08-18 20:45:13 +00:00
|
|
|
};
|
|
|
|
|
2023-08-18 20:33:56 +00:00
|
|
|
neovim = {
|
|
|
|
enable = true;
|
|
|
|
vimAlias = true;
|
|
|
|
defaultEditor = true;
|
|
|
|
};
|
2023-04-14 11:12:45 +00:00
|
|
|
};
|
2023-07-26 11:10:22 +00:00
|
|
|
|
2023-08-24 20:49:21 +00:00
|
|
|
networking.firewall.logRefusedConnections = false;
|
|
|
|
|
2025-02-20 08:56:56 +00:00
|
|
|
systemd.services.dbus = {
|
|
|
|
restartIfChanged = false;
|
|
|
|
reloadIfChanged = lib.mkForce false;
|
|
|
|
};
|
2025-02-20 07:53:08 +00:00
|
|
|
|
2023-07-26 11:10:22 +00:00
|
|
|
services = {
|
2023-10-24 11:30:48 +00:00
|
|
|
iperf3.enable = true;
|
2024-10-21 10:12:42 +00:00
|
|
|
atd.enable = true;
|
2023-10-24 11:30:48 +00:00
|
|
|
|
2023-08-24 14:14:57 +00:00
|
|
|
chrony = {
|
|
|
|
enable = true;
|
2024-07-29 12:39:54 +00:00
|
|
|
servers = [ "time.cloudflare.com" ];
|
2023-08-24 14:14:57 +00:00
|
|
|
};
|
|
|
|
|
2023-07-26 11:10:22 +00:00
|
|
|
locate = {
|
|
|
|
enable = true;
|
2023-11-27 15:54:44 +00:00
|
|
|
package = pkgs.plocate;
|
2023-07-26 11:10:22 +00:00
|
|
|
localuser = null;
|
2024-08-11 14:46:34 +00:00
|
|
|
prunePaths = [ "/home/.btrfs" ];
|
2023-07-26 11:10:22 +00:00
|
|
|
};
|
|
|
|
};
|
2023-04-14 11:12:45 +00:00
|
|
|
};
|
|
|
|
}
|