diff --git a/flake.nix b/flake.nix index 44be13c..2fd1a43 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Opti NixOS Flake"; + description = "Wekuz's NixOS config"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; @@ -17,15 +17,15 @@ outputs = { nixpkgs, home-manager, disko, ... }: { nixosConfigurations = { - opti = nixpkgs.lib.nixosSystem { + plexy = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./hosts/opti + ./hosts/plexy home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.wekuz = import ./hosts/opti/home.nix; + home-manager.users.wekuz = import ./hosts/plexy/home.nix; } disko.nixosModules.disko ]; diff --git a/hosts/plexy/default.nix b/hosts/plexy/default.nix new file mode 100644 index 0000000..bf88550 --- /dev/null +++ b/hosts/plexy/default.nix @@ -0,0 +1,76 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./hardware-configuration.nix ./disko-config.nix ]; + + nix = { + package = pkgs.nixVersions.stable; + + optimise.automatic = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 2w"; + }; + settings.experimental-features = [ "nix-command" "flakes" ]; + + extraOptions = '' + min-free = 512000000 + max-free = 2000000000 + ''; + }; + + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + timeout = 1; + }; + + nixpkgs.hostPlatform = "x86_64-linux"; + + hardware.graphics = { + enable = true; + extraPackages = with pkgs; [ intel-media-driver intel-vaapi-driver ]; + }; + + time.timeZone = "Europe/Tallinn"; + + networking = { + hostName = "plexy"; + networkmanager.enable = true; + nftables.enable = true; + firewall.allowedTCPPorts = [ 22 80 443 ]; + }; + + services = { + openssh = { + enable = true; + settings.PasswordAuthentication = false; + settings.PermitRootLogin = "no"; + }; + }; + + virtualisation = { + docker = { + enable = true; + autoPrune = { + enable = true; + dates = "weekly"; + randomizedDelaySec = "30min"; + flags = [ "--all" "--volumes" ]; + }; + }; + }; + + environment.variables.EDITOR = "nvim"; + + users.users.wekuz = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "docker" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBs3aPxyJpVGytuVSO3va2WybKNFMR241o8DCJQbBEWV" + ]; + }; + + system.stateVersion = "25.11"; +} diff --git a/hosts/plexy/disko-config.nix b/hosts/plexy/disko-config.nix new file mode 100644 index 0000000..8ddfd7f --- /dev/null +++ b/hosts/plexy/disko-config.nix @@ -0,0 +1,50 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + primary = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + subvolumes = { + "/rootfs" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/"; + }; + "/home" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/home"; + }; + "/home/wekuz" = { }; + "/nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + # TODO: /log + }; + + mountpoint = "/part-root"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/plexy/hardware-configuration.nix b/hosts/plexy/hardware-configuration.nix new file mode 100644 index 0000000..728cc54 --- /dev/null +++ b/hosts/plexy/hardware-configuration.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = + [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/plexy/home.nix b/hosts/plexy/home.nix new file mode 100644 index 0000000..c43e2a1 --- /dev/null +++ b/hosts/plexy/home.nix @@ -0,0 +1,51 @@ +{ pkgs, ... }: + +{ + home.username = "wekuz"; + home.homeDirectory = "/home/wekuz"; + + home.packages = with pkgs; [ + neofetch + + # Utilities + neovim + tmux + zip + xz + unzip + p7zip + zstd + ripgrep + file + which + btop + ncdu + lm_sensors + pciutils + usbutils + smartmontools + + # Networking + mtr + iperf3 + wget + dnsutils + ldns + ethtool + ]; + + programs.git = { + enable = true; + settings = { + user = { + name = "Wekuz"; + email = "wekuz@duck.com"; + }; + init.defaultBranch = "main"; + }; + }; + + programs.zsh = { enable = true; }; + + home.stateVersion = "25.11"; +}