nix-setup/configuration.nix
2026-06-05 12:26:27 +02:00

488 lines
14 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Edit this configuration file to define what should be installed
# on your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ pkgs, config, ... }:
let
pkgconfig = import ./nixpkgs-config.nix {};
sources = import ./npins;
pkgs_src = import sources.nixpkgs (pkgconfig);
in
{
# nix.package = pkgs.lix;
nix.settings.trusted-users = ["tudbut"];
nix.buildMachines = [
{
hostName = "aws.tudbut.de";
system = "x86_64-linux";
sshUser = "ubuntu";
# publicHostKey = "LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0KYjNCbGJuTnphQzFyWlhrdGRqRUFBQUFBQkc1dmJtVUFBQUFFYm05dVpRQUFBQUFBQUFBQkFBQUFNd0FBQUF0emMyZ3RaVwpReU5UVXhPUUFBQUNEdktCUjlqNVBCcSt2bDAyalhsRHcyYmVudHhGNkNQRUFvSEVkZGZZRzV5d0FBQUpnQmRFQkNBWFJBClFnQUFBQXR6YzJndFpXUXlOVFV4T1FBQUFDRHZLQlI5ajVQQnErdmwwMmpYbER3MmJlbnR4RjZDUEVBb0hFZGRmWUc1eXcKQUFBRUNFTGI0aGJoa3V4UStSTjNnMnZrRTkvcGM5ekNueXFkOWdyaWFvOC9DbHV1OG9GSDJQazhHcjYrWFRhTmVVUERadAo2ZTNFWG9JOFFDZ2NSMTE5Z2JuTEFBQUFGWEp2YjNSQWFYQXRNVGN5TFRNeExUUTBMVEV5Tmc9PQotLS0tLUVORCBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0K";
}
];
nix.settings.trusted-substituters = [
"ssh://ubuntu@aws.tudbut.de"
];
nix.settings.trusted-public-keys = [
"hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs="
"aws.tudbut.de-1:JxLPlgDiM7A+2+xD2HOweh2/058QSEH4QXOfGmlza3w="
];
nix.distributedBuilds = true;
# remover of the slag
nix.settings.auto-optimise-store = true;
# npins stuff
nix.channel.enable = false;
nix.nixPath = [
"nixpkgs=/etc/static/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix" # ?????????????????????
];
environment.etc = {
"nixpkgs".source = builtins.storePath pkgs_src.path;
};
nixpkgs = pkgconfig;
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./home.nix
./nix-alien.nix
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
helix
micro-full
wget
alacritty
links2
killall
bat
# rustup
pkg-config
clang
nodejs
git
pavucontrol
zip unzip
networkmanagerapplet
libproxy
modemmanager
modem-manager-gui
fastfetch
asciinema
zulu8
ffmpeg-full
imagemagick
zbar
usbutils
revpfw3
arch-install-scripts
proot
inetutils
openjdk17
gnupg
rage
pinentry-qt
wireguard-tools
iftop
pciutils
mesa-demos
xdotool
xorg.xmodmap
actkbd
pulseaudio
screen
mc
(pkgs.callPackage ./packages/edname.nix {})
(pkgs.callPackage ./sl.script.nix {})
(pkgs.callPackage ./startsync.script.nix {})
(pkgs.callPackage ./ssy.script.nix {})
(pkgs.callPackage ./bright.script.nix {})
(pkgs.callPackage ./nix-cmd.script.nix {})
(pkgs.callPackage ./sshpc.script.nix {})
(pkgs.callPackage ./pushfile.script.nix {})
(pkgs.callPackage ./dropfile.script.nix {})
(pkgs.callPackage ./nixos-edit.script.nix {})
(pkgs.callPackage ./quickfhs.script.nix {})
] ++ (import ./special-pkgs.nix { pkgs = pkgs; });
fonts.packages = with pkgs; [
twemoji-color-font
fira-code
monocraft
dejavu_fonts
# google-fonts
iosevka
(
pkgs.stdenv.mkDerivation {
name = "customfonts";
version = "1.0.0";
src = ./customfonts;
installPhase = ''
mkdir -p $out/share/fonts/truetype/customfonts
cp -r ./* $out/share/fonts/truetype/customfonts
'';
}
)
];
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
};
};
programs.virt-manager.enable = true;
boot.kernelPackages = pkgs.linuxPackages_6_18;
boot.extraModulePackages = with config.boot.kernelPackages; [
acpi_call
];
boot.initrd.availableKernelModules = [ "aesni_intel" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" "usblp" "cryptd" ];
zramSwap = {
enable = true;
priority = 100;
algorithm = "lz4";
memoryPercent = 150;
};
programs.fish.enable = true;
programs.htop.enable = true;
programs.firefox.enable = true;
programs.firefox.nativeMessagingHosts.packages = with pkgs; [
tridactyl-native
];
environment.etc = {
"jvms/jdk25".source = pkgs.openjdk25;
"jvms/jdk21".source = pkgs.openjdk21;
"jvms/jdk17".source = pkgs.openjdk17;
"jvms/jdk8".source = pkgs.zulu8;
};
environment.etc."htoprc".text = ''
# Global htop configuration
hide_kernel_threads=1
hide_userland_threads=1
show_thread_names=1
show_program_path=0
highlight_base_name=1
highlight_deleted_exe=1
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=1
show_cpu_usage=1
show_cpu_frequency=1
show_cpu_temperature=1
delay=4
header_layout=two_50_50
column_meters_0=LeftCPUs Memory Swap CPU CPU PressureStallCPUSome PressureStallMemorySome PressureStallIOSome
column_meter_modes_0=1 1 1 3 1 2 2 2
column_meters_1=RightCPUs Tasks LoadAverage Uptime DiskIO NetworkIO NetworkIO
column_meter_modes_1=1 2 2 2 1 1 3
tree_view=1
sort_key=47
tree_sort_key=47
sort_direction=-1
tree_sort_direction=-1
'';
environment.variables = {
_JAVA_AWT_WM_NONREPARENTING = 1;
EDITOR = "hx";
ARANET4_ADDRESS = "D6:80:4F:97:08:17";
DEFAULT_BROWSER = "${pkgs.links2}/bin/links -g";
};
services.udev.packages = with pkgs; [
libwacom
];
services.postgresql.enable = true;
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.davfs2.enable = true;
programs.fuse = {
enable = true;
userAllowOther = true;
};
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.binfmt.emulatedSystems = [ "aarch64-linux" "x86_64-windows" "i686-windows" ];
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
# hardware # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
# hardware config # networking.hostName = "TudbuT-NixX250"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
networking.extraHosts =
''
10.66.66.1 wgexit
10.66.40.1 tnoe
10.31.208.10 club-assistant.ccchh.net
2a0b:6204:e494:2f00::10 ferryman
2a0b:6204:e494:2f00::10 fm
2a01:239:30b:3e00::1:8 impropersalvation
2a01:239:30b:3e00::1:8 ips
2a01:239:30b:3e00::1:10 ridiculer
2a01:239:30b:3e00::1:10 rdc
2a01:239:30b:3e00::1:11 portablethunder
2a01:239:30b:3e00::1:11 ptt
'';
hardware.bluetooth.enable = true;
services.blueman.enable = true;
services.opensnitch = {
enable = false;
settings.DefaultAction = "allow";
rules = {
i2p = rec {
created = "2025-11-14T08:46:04+01:00";
updated = created;
enabled = true;
name = "i2p";
action = "allow";
duration = "always";
operator = {
type = "simple";
data = "i2p";
operand = "user.name";
};
};
no-i2p-dns = {
created = "2025-11-14T09:17:23.000000Z";
name = "no-i2p-dns";
enabled = true;
precedence = true;
action = "reject";
duration = "always";
operator = {
type = "list";
operand = "list";
list = [
{
type = "simple";
operand = "protocol";
data = "udp";
}
{
type = "regexp";
operand = "dest.host";
data = ".*\\.i2p";
}
];
};
};
no-i2p-dns6 = {
created = "2025-11-14T09:17:23.000000Z";
name = "no-i2p-dns6";
enabled = true;
precedence = true;
action = "reject";
duration = "always";
operator = {
type = "list";
operand = "list";
list = [
{
type = "simple";
operand = "protocol";
data = "udp6";
}
{
type = "regexp";
operand = "dest.host";
data = ".*\\.i2p";
}
];
};
};
};
};
systemd.services.ModemManager = {
# enable = true;
enable = false;
wantedBy = [ "multi-user.target" "network.target" ];
};
services.mullvad-vpn.enable = true;
services.mullvad-vpn.package = pkgs.mullvad-vpn;
services.i2p.enable = true;
systemd.user.services."start-autostart" = {
wants = [ "xdg-desktop-autostart.target" ];
script = "echo";
restartTriggers = [];
};
systemd.services.earlyoom.enable = true;
boot.kernel.sysctl."kernel.sysrq" = 1;
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
#console = {
# font = "Lat2-Terminus16";
# keyMap = "de";
# useXkbConfig = true; # use xkb.options in tty.
#;
# services.fprintd.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
hardware.graphics = {
enable = true;
enable32Bit = true;
};
services.xserver.windowManager.i3.enable = true;
programs.i3lock.enable = true;
services.xserver.windowManager.i3.extraPackages = with pkgs; [
dmenu
i3status
libnotify
xss-lock
maim
xclip
# clipit
];
services.xserver.exportConfiguration = true;
services.xserver.videoDrivers = [ "modesetting" ];
# services.xserver.enableTearFree = true;
services.xserver.wacom.enable = true;
services.xserver.xkb.options = "terminate:ctrl_alt_bksp,compose:caps"; # compose:ins for insert key
services.gvfs.enable = true;
services.logind.settings.Login.HandleLidSwitch = "ignore";
services.logind.settings.Login.HandleSuspendKey = "poweroff";
programs.dconf.enable = true;
hardware.nvidia.open = true;
hardware.nvidia.modesetting.enable = true;
systemd.services.restart-display = {
script = ''
killall niri i3 || true
sleep 0.5
killall -9 niri i3 || true
systemctl restart display-manager.service
'';
serviceConfig = {
user = "root";
Type = "oneshot";
};
};
systemd.services.spinner = {
script = ''
sleep 60
#!/bin/sh
for vol in /run/media/tudbut/d659abc0-cdd5-46c1-b48d-efd891a004be /home/tudbut/archival ; do
cd "$vol"
echo spinning "$vol"
while true; do
head -c10 /dev/urandom > .spinner.bin
sleep 60
done &
done
while true; do sleep 10000 ; done
'';
enable = true;
wantedBy = [ "multi-user.target" ];
};
# Configure keymap in X11
services.xserver.xkb.layout = "de";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
services.pulseaudio.enable = false;
# OR
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.tudbut = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ]; # Enable sudo for the user.
};
users.users.amoeba = {
isNormalUser = true;
extraGroups = [ "networkmanager" ];
};
users.defaultUserShell = pkgs.fish;
security.sudo.wheelNeedsPassword = false;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = false;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment?
}