formatting

This commit is contained in:
Noa Aarts 2024-06-04 12:13:51 +02:00
parent 4f1351053d
commit 9c28397d38
2 changed files with 354 additions and 347 deletions

View file

@ -4,395 +4,401 @@
{ config, pkgs, inputs, nix-colors, ... }: { config, pkgs, inputs, nix-colors, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [
./hardware-configuration.nix # Include the results of the hardware scan.
../../modules/games/steam.nix ./hardware-configuration.nix
inputs.nix-minecraft.nixosModules.minecraft-servers ../../modules/games/steam.nix
]; inputs.nix-minecraft.nixosModules.minecraft-servers
];
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
# LOVE me some blob # LOVE me some blob
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
hardware.enableAllFirmware = true; hardware.enableAllFirmware = true;
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; modesetting.enable = true;
powerManagement = { powerManagement = {
enable = true; enable = true;
finegrained = false; finegrained = false;
}; };
open = false; open = false;
nvidiaSettings = true; nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta; package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta;
}; };
hardware.opengl = { hardware.opengl = {
enable = true; enable = true;
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
}; };
# Allow unfree packages # Allow unfree packages
nixpkgs.config = { nixpkgs.config = {
allowUnfree = true; allowUnfree = true;
nvidia.acceptLicense = true; nvidia.acceptLicense = true;
}; };
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
networking = { networking = {
hostName = "lambdaOS"; # Define your hostname. hostName = "lambdaOS"; # Define your hostname.
hosts = { hosts = {
"127.0.0.1" = ["images.noa.voorwaarts.nl" "sods.noa.voorwaarts.nl" "noa.voorwaarts.nl" "testing.noa.voorwaarts.nl" ]; "127.0.0.1" = [ "images.noa.voorwaarts.nl" "sods.noa.voorwaarts.nl" "noa.voorwaarts.nl" "testing.noa.voorwaarts.nl" ];
}; };
}; };
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking # Enable networking
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
programs.nm-applet.enable = true; programs.nm-applet.enable = true;
nix = { nix = {
settings = { settings = {
# auto optimise every so often # auto optimise every so often
# auto-optimise-store = true; # auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"]; experimental-features = [ "nix-command" "flakes" ];
substituters = ["https://hyprland.cachix.org" "https://cache.iog.io" "https://cuda-maintainers.cachix.org" ]; substituters = [ "https://hyprland.cachix.org" "https://cache.iog.io" "https://cuda-maintainers.cachix.org" ];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" ]; trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" ];
}; };
optimise.automatic = true; optimise.automatic = true;
gc = { gc = {
automatic = false; automatic = false;
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 7d"; options = "--delete-older-than 7d";
}; };
}; };
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8"; LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8"; LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8"; LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8"; LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8"; LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8"; LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8"; LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8"; LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8"; LC_TIME = "nl_NL.UTF-8";
}; };
# Configure console keymap # Configure console keymap
console.keyMap = "us-acentos"; console.keyMap = "us-acentos";
users.groups.nixpow.members = [ "root" ]; users.groups.nixpow.members = [ "root" ];
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users = { users.users = {
root = { root = {
hashedPassword = "!"; hashedPassword = "!";
}; };
noa = { noa = {
isNormalUser = true; isNormalUser = true;
description = "Noa Aarts"; description = "Noa Aarts";
extraGroups = [ "networkmanager" "wheel" "nixpow" ]; extraGroups = [ "networkmanager" "wheel" "nixpow" ];
hashedPassword = "$6$rounds=512400$Zip3xoK2zcoR4qEL$N13YTHO5tpWfx2nKb1sye.ZPwfoRtMQ5f3YrMZqKzzoFoSSHHJ.l5ulCEa9HygFxZmBtPnwlseFEtl8ERnwF50"; hashedPassword = "$6$rounds=512400$Zip3xoK2zcoR4qEL$N13YTHO5tpWfx2nKb1sye.ZPwfoRtMQ5f3YrMZqKzzoFoSSHHJ.l5ulCEa9HygFxZmBtPnwlseFEtl8ERnwF50";
}; };
}; };
home-manager = { home-manager = {
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs; inherit inputs;
inherit nix-colors; inherit nix-colors;
}; };
users = { users = {
"noa" = import ./home.nix; "noa" = import ./home.nix;
"root" = import ./root.nix; "root" = import ./root.nix;
}; };
}; };
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
zsh zsh
mangohud mangohud
]; ];
# TODO: find list of fonts to install # TODO: find list of fonts to install
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
font-awesome font-awesome
noto-fonts noto-fonts
fira-code fira-code
fira-code-symbols fira-code-symbols
liberation_ttf liberation_ttf
maple-mono-NF maple-mono-NF
]; ];
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
# programs.gnupg.agent = { # programs.gnupg.agent = {
# enable = true; # enable = true;
# enableSSHSupport = true; # enableSSHSupport = true;
# }; # };
programs = { programs = {
zsh.enable = true; zsh.enable = true;
hyprland = { hyprland = {
enable = true; enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland; package = inputs.hyprland.packages.${pkgs.system}.hyprland;
portalPackage = pkgs.xdg-desktop-portal-hyprland; portalPackage = pkgs.xdg-desktop-portal-hyprland;
}; };
nix-ld.enable = true; nix-ld.enable = true;
nix-ld.libraries = with pkgs; [ nix-ld.libraries = with pkgs; [
wayland wayland
]; ];
}; };
modules.games.steam.enable = false; modules.games.steam.enable = false;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
security.rtkit.enable = true; security.rtkit.enable = true;
services = { services = {
pipewire = { pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
}; };
fail2ban = { fail2ban = {
enable = true; enable = true;
maxretry = 5; maxretry = 5;
bantime = "1s"; bantime = "1s";
bantime-increment = { bantime-increment = {
enable = true; enable = true;
formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)"; formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)";
maxtime = "1h"; maxtime = "1h";
overalljails = true; overalljails = true;
}; };
jails = { jails = {
go-login.settings = { go-login.settings = {
enabled = true; enabled = true;
filter = "go-login"; filter = "go-login";
action = ''iptables-multiport[name=HTTP, port="http,https,2000"]''; action = ''iptables-multiport[name=HTTP, port="http,https,2000"]'';
logpath = "/home/noa/Documents/programming/SODS/login.log"; logpath = "/home/noa/Documents/programming/SODS/login.log";
backend = "systemd"; backend = "systemd";
findtime = 600; findtime = 600;
bantime = 600; bantime = 600;
maxretry = 5; maxretry = 5;
}; };
}; };
}; };
greetd = { greetd = {
enable = true; enable = true;
settings = rec { settings = rec {
initial_session = { initial_session = {
command = "${pkgs.hyprland}/bin/Hyprland"; command = "${pkgs.hyprland}/bin/Hyprland";
user = "noa"; user = "noa";
}; };
default_session = initial_session; default_session = initial_session;
}; };
}; };
minecraft-servers = { minecraft-servers = {
enable = false; enable = false;
eula = true; eula = true;
openFirewall = true; openFirewall = true;
servers = { servers = {
"no-flicker" = { "no-flicker" = {
enable = true; enable = true;
package = pkgs.minecraftServers.paper-1_20_4; package = pkgs.minecraftServers.paper-1_20_4;
}; };
}; };
}; };
nginx = { nginx = {
enable = true; enable = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL"; sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
virtualHosts = virtualHosts =
let extra = '' let extra = ''
client_max_body_size 50000M; client_max_body_size 50000M;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_redirect off; proxy_redirect off;
proxy_read_timeout 600s; proxy_read_timeout 600s;
proxy_send_timeout 600s; proxy_send_timeout 600s;
send_timeout 600s;''; send_timeout 600s;'';
in { in
"noa.voorwaarts.nl" = { {
default = true; "noa.voorwaarts.nl" = {
forceSSL = true; default = true;
enableACME = true; forceSSL = true;
enableACME = true;
serverAliases = [ "images.noa.voorwaarts.nl" "sods.noa.voorwaarts.nl" "testing.noa.voorwaarts.nl" ]; };
};
"images.noa.voorwaarts.nl" = { "images.noa.voorwaarts.nl" = {
forceSSL = true; forceSSL = true;
useACMEHost = "noa.voorwaarts.nl"; useACMEHost = "noa.voorwaarts.nl";
extraConfig = extra; extraConfig = extra;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:2283/"; proxyPass = "http://127.0.0.1:2283/";
}; };
}; };
"testing.noa.voorwaarts.nl" = { "testing.noa.voorwaarts.nl" = {
forceSSL = true; forceSSL = true;
useACMEHost = "noa.voorwaarts.nl"; useACMEHost = "noa.voorwaarts.nl";
extraConfig = extra; extraConfig = extra;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:8000/"; proxyPass = "http://127.0.0.1:8000/";
}; };
}; };
"sods.noa.voorwaarts.nl" = { "sods.noa.voorwaarts.nl" = {
forceSSL = true; forceSSL = true;
useACMEHost = "noa.voorwaarts.nl"; useACMEHost = "noa.voorwaarts.nl";
extraConfig = extra; extraConfig = extra;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:2000/"; proxyPass = "http://127.0.0.1:2000/";
}; };
}; };
}; };
}; };
openssh = { openssh = {
enable = true; enable = true;
settings.PasswordAuthentication = false; settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false; settings.KbdInteractiveAuthentication = false;
}; };
syncthing = { syncthing = {
enable = true; enable = true;
user = "noa"; user = "noa";
dataDir = "/home/noa/Sync"; dataDir = "/home/noa/Sync";
configDir = "/home/noa/Sync/.config/syncthing"; configDir = "/home/noa/Sync/.config/syncthing";
}; };
xserver = { xserver = {
enable = true; enable = true;
xkb = { xkb = {
layout = "us"; layout = "us";
variant = "intl"; variant = "intl";
}; };
videoDrivers = [ "nvidia" ]; videoDrivers = [ "nvidia" ];
}; };
flatpak.enable = true; flatpak.enable = true;
}; };
systemd.timers."update-flake" = { systemd.timers."update-flake" = {
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
OnCalendar = "daily"; OnCalendar = "daily";
Persistent = true; Persistent = true;
}; };
}; };
systemd.services."update-flake" = { systemd.services."update-flake" = {
path = with pkgs; [ path = with pkgs; [
git git
openssh openssh
nix nix
nixos-rebuild nixos-rebuild
]; ];
script = '' script = ''
[[ ! -d '/root/nixconf' ]] && cd /root && git clone git@github.com:itepastra/nixconf [[ ! -d '/root/nixconf' ]] && cd /root && git clone git@github.com:itepastra/nixconf
cd /root/nixconf cd /root/nixconf
git pull git pull
nix flake update --commit-lock-file /root/nixconf nix flake update --commit-lock-file /root/nixconf
nixos-rebuild switch --flake . nixos-rebuild switch --flake .
git push git push
''; '';
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
User = "root"; User = "root";
}; };
wants = [ wants = [
"network-online.target" "network-online.target"
]; ];
after = [ after = [
"network-online.target" "network-online.target"
]; ];
}; };
environment.etc = { environment.etc = {
"fail2ban/filter.d/go-login.local".text = pkgs.lib.mkDefault (pkgs.lib.mkAfter '' "fail2ban/filter.d/go-login.local".text = pkgs.lib.mkDefault (pkgs.lib.mkAfter ''
[Definition] [Definition]
failregex=^time= level=WARN msg=".*?" ip=<ADDR> status=4\d\d$ failregex=^time= level=WARN msg=".*?" ip=<ADDR> status=4\d\d$
''); '');
}; };
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;
rootless = { rootless = {
enable = true; enable = true;
setSocketVariable = true; setSocketVariable = true;
}; };
}; };
boot.kernelModules = [ boot.kernelModules = [
"v4l2loopback" "v4l2loopback"
"nct6775" "nct6775"
"k10temp" "k10temp"
]; ];
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1 options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
''; '';
security = { security = {
acme = { acme = {
acceptTerms = true; acceptTerms = true;
defaults.email = "acme@voorwaarts.nl"; defaults.email = "acme@voorwaarts.nl";
}; certs."noa.voorwaarts.nl".extraDomainNames = [
polkit.enable = true; "images.noa.voorwaarts.nl"
}; "sods.noa.voorwaarts.nl"
"testing.noa.voorwaarts.nl"
];
};
polkit.enable = true;
};
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
80 # http 80 # http
443 # https 443 # https
53317 # Localsend 53317 # Localsend
]; ];
networking.firewall.allowedUDPPorts = [ networking.firewall.allowedUDPPorts = [
80 80
443 443
53317 53317
]; ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; # networking.firewall.enable = false;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View file

@ -67,6 +67,7 @@
opam opam
stack stack
cargo cargo
gcc
bend bend