diff --git a/hosts/lilith-pad/hardware-configuration.nix b/hosts/lilith-pad/hardware-configuration.nix index 64629674..5df571e2 100644 --- a/hosts/lilith-pad/hardware-configuration.nix +++ b/hosts/lilith-pad/hardware-configuration.nix @@ -1 +1,38 @@ -{...}: {} +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/080fa116-424e-4079-a2a6-658a230e2721"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/40E8-A12D"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/audio.nix b/system/audio.nix new file mode 100644 index 00000000..3bb65d47 --- /dev/null +++ b/system/audio.nix @@ -0,0 +1,10 @@ +{...}: { + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # jack.enable = true; + }; +} diff --git a/system/bluetooth.nix b/system/bluetooth.nix new file mode 100644 index 00000000..6dc8d175 --- /dev/null +++ b/system/bluetooth.nix @@ -0,0 +1,3 @@ +{...}: { + hardware.bluetooth.enable = true; +} diff --git a/system/boot.nix b/system/boot.nix new file mode 100644 index 00000000..b7012fca --- /dev/null +++ b/system/boot.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/system/btrfs.nix b/system/btrfs.nix new file mode 100644 index 00000000..c0384249 --- /dev/null +++ b/system/btrfs.nix @@ -0,0 +1,10 @@ +{...}: { + services.btrfs.autoScrub = { + enable = true; + interval = "Fri 07:00"; + fileSystems = [ + "/persistent" + "/nix" + ]; + }; +} diff --git a/system/env.nix b/system/env.nix new file mode 100644 index 00000000..db7d0053 --- /dev/null +++ b/system/env.nix @@ -0,0 +1,6 @@ +{...}: { + environment.variables = { + EDITOR = "hx"; + VISUAL = "hx"; + }; +} diff --git a/system/fonts.nix b/system/fonts.nix new file mode 100644 index 00000000..6bedb43c --- /dev/null +++ b/system/fonts.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + fonts.packages = with pkgs; [ + (nerdfonts.override {fonts = ["JetBrainsMono"];}) + ]; +} diff --git a/system/networking.nix b/system/networking.nix new file mode 100644 index 00000000..6f5daca9 --- /dev/null +++ b/system/networking.nix @@ -0,0 +1,26 @@ +{conf, ...}: { + networking.hostName = conf.hostname; + networking.networkmanager = { + enable = true; + wifi.macAddress = "random"; + ethernet.macAddress = "random"; + }; + + networking.firewall = { + enable = true; + + allowedTCPPorts = [ + 22 # ssh + 22000 # syncthing + ]; + + extraCommands = '' + ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN + ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN + ''; + extraStopCommands = '' + ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true + ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true + ''; + }; +} diff --git a/system/nix.nix b/system/nix.nix new file mode 100644 index 00000000..747a2ab0 --- /dev/null +++ b/system/nix.nix @@ -0,0 +1,15 @@ +{nixpkgs, ...}: { + nixPath = ["nixpkgs=${nixpkgs}"]; + gc = { + automatic = true; + dates = "05:30"; + options = "--delete-older-than 7d"; + + settings = { + keep-outputs = true; + auto-optimise-store = true; + experimental-features = ["nix-command" "flakes"]; + trusted-users = ["root" "@wheel"]; + }; + }; +} diff --git a/system/persistence.nix b/system/persistence.nix new file mode 100644 index 00000000..1c372f3c --- /dev/null +++ b/system/persistence.nix @@ -0,0 +1,39 @@ +{ + conf, + impermanence, + ... +}: { + imports = [impermanence.nixosModule]; + + environment.persistence."/persist/data" = { + hideMounts = true; + directories = [ + "/etc/NetworkManager/system-connections" + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/var/lib/bluetooth" + ]; + files = []; + + users.${conf.user} = (import ../home/persistence.nix).data; + }; + + environment.persistence."/persist/cache" = { + hideMounts = true; + directories = [ + "/root/.cache/nix" + "/var/lib/btrfs" + "/var/lib/nixos" + "/var/lib/systemd/backlight" + "/var/lib/systemd/timers" + "/var/log" + ]; + files = [ + "/etc/machine-id" + ]; + + users.${conf.user} = (import ../home/persistence.nix).cache; + }; +} diff --git a/system/steam.nix b/system/steam.nix new file mode 100644 index 00000000..57a2e2db --- /dev/null +++ b/system/steam.nix @@ -0,0 +1,14 @@ +{ + lib, + config, + ... +}: { + options.gaming.enable = lib.mkEnableOption "Enable gaming"; + + config = lib.mkIf config.gaming.enable { + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + }; + }; +}