diff --git a/.gitignore b/.gitignore index 0638531..1cc5d0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ **/*~ **/#*.*# **/.#*.* + +**/.pre-commit-config.yaml +**/result diff --git a/computers/toothless/default.nix b/computers/toothless/default.nix new file mode 100644 index 0000000..86b5b8e --- /dev/null +++ b/computers/toothless/default.nix @@ -0,0 +1,83 @@ +{pkgs, ...}: { + imports = [ + ./hardware-configuration.nix + ./disks.nix + ]; + + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + services = { + displayManager.sddm = { + wayland = { + enable = true; + compositor = "kwin"; + }; + extraPackages = [ + pkgs.where-is-my-sddm-theme + ]; + enable = true; + theme = "where_is_my_sddm_theme"; + }; + + desktopManager.plasma6 = { + enable = true; + enableQt5Integration = false; + notoPackage = pkgs.noto-fonts-lgc-plus; + }; + + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + wireplumber.enable = true; + }; + + xserver.xkb = { + layout = "us"; + options = "eurosign:e,ctrl:nocaps"; + }; + + libinput.enable = true; + openssh.enable = true; + }; + + programs = { + git = { + enable = true; + config = { + user = { + name = "Artur Manuel"; + email = "balkenix@outlook.com"; + signingKey = "~/.ssh/id_ed25519"; + }; + }; + }; + neovim.enable = true; + chromium.enable = true; + }; + + environment.systemPackages = builtins.attrValues { + inherit + (pkgs) + nil + statix + deadnix + chromium + alejandra + wget + ; + }; + + networking.networkmanager.enable = true; + time.timeZone = "Europe/London"; + i18n.defaultLocale = "en_GB.UTF-8"; + system.stateVersion = "24.11"; +} diff --git a/computers/toothless/disks.nix b/computers/toothless/disks.nix new file mode 100644 index 0000000..9707152 --- /dev/null +++ b/computers/toothless/disks.nix @@ -0,0 +1,67 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-id/nvme-WDC_PC_SN520_SDAPNUW-256G-1014_20270F804683"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["defaults"]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "utero"; + passwordFile = "/tmp/secret.key"; # Interactive + settings = { + allowDiscards = true; + }; + content = { + type = "btrfs"; + extraArgs = ["-f"]; + subvolumes = { + "/@root" = { + mountpoint = "/"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "/@home" = { + mountpoint = "/home"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "/@nix" = { + mountpoint = "/nix"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "/@swap" = { + mountpoint = "/.swapvol"; + swap.swapfile.size = "8G"; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/computers/toothless/hardware-configuration.nix b/computers/toothless/hardware-configuration.nix new file mode 100644 index 0000000..50fc1bb --- /dev/null +++ b/computers/toothless/hardware-configuration.nix @@ -0,0 +1,28 @@ +# 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, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + # 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.enp8s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/lib/default.nix b/lib/default.nix index 047f7d0..f667258 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -10,7 +10,7 @@ modules = extraModules ++ [ - ./computers/${host} + ../computers/${host} ({config, ...}: { config = { nix = {