diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e767e73 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +hardware-configuration.nix +flake.lock +result/ diff --git a/application-configuration.nix b/application-configuration.nix new file mode 100644 index 0000000..bc2714d --- /dev/null +++ b/application-configuration.nix @@ -0,0 +1,34 @@ +{ lib, pkgs, ... }: +{ + nixpkgs.config.allowBroken = true; + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "obsidian" + + "minecraft-launcher" + + "steam-run" + "steam-original" + "steam" + + "nvidia-x11" + "nvidia-settings" + ]; + + users.users.caleb.packages = with pkgs; [ + minecraft + firefox + keepassxc + obsidian + qalculate-qt + isoimagewriter + libreoffice-qt + polymc + signal-desktop + tor-browser-bundle-bin + yubikey-manager-qt + ]; + + services.pcscd.enable = true; + + programs.steam.enable = true; +} diff --git a/bootloader-configuration.nix b/bootloader-configuration.nix new file mode 100644 index 0000000..bcda25b --- /dev/null +++ b/bootloader-configuration.nix @@ -0,0 +1,10 @@ +{ ... }: +{ + boot = { + kernelParams = [ "quiet" ]; + loader = { + timeout = 0; + efi.canTouchEfiVariables = true; + }; + }; +} diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..e35ba49 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,92 @@ +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./application-configuration.nix + ./bootloader-configuration.nix + ./hardware-configuration.nix + ./networking-configuration.nix + ./power-configuration.nix + ./zephyrus-configuration.nix + ]; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; + + # Enable the kde plasma + services = { + xserver.enable = true; + desktopManager.plasma6.enable = true; + displayManager.sddm = { + enable = true; + }; + }; + + # Enable sound + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Define a user account. + users.users.caleb = { + isNormalUser = true; + description = "caleb"; + extraGroups = [ "networkmanager" "wheel" ]; + hashedPassword = "$y$j9T$v6EDyPW8C/K.Th4xg8MHL/$tA67k6U0kLtafTNNW2DM7j.xObjPSaZFQ4e/beBX7g2"; + }; + + # disable sudo password for wheel + security.sudo.wheelNeedsPassword = false; + + environment.systemPackages = with pkgs; [ + appimage-run + git + protontricks + steam-run + winetricks + wineWowPackages.stable + vim + wget + ]; + + # Enable CUPS printing + services.printing = { + enable = true; + drivers = [ pkgs.brlaser ]; + }; + + # enable flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # 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.11"; # Did you read the comment? + +} + diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..28f24f6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + # secure boot + lanzaboote = { + url = "github:nix-community/lanzaboote/v0.4.1"; + + # Optional but recommended to limit the size of your system closure. + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # polymc + polymc.url = "github:PolyMC/PolyMC"; + }; + + outputs = { self, nixpkgs, lanzaboote, polymc, ... }: { + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + + modules = [ + ./configuration.nix + lanzaboote.nixosModules.lanzaboote + + ({ pkgs, lib, ... }: { + environment.systemPackages = [ + # For debugging and troubleshooting Secure Boot. + pkgs.sbctl + ]; + + nixpkgs.overlays = [ polymc.overlay ]; + + # Lanzaboote currently replaces the systemd-boot module. + # This setting is usually set to true in configuration.nix + # generated at installation time. So we force it to false + # for now. + boot = { + initrd.systemd.enable = true; + loader.systemd-boot.enable = lib.mkForce false; + + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + }; + }) + ]; + }; + }; + }; +} diff --git a/networking-configuration.nix b/networking-configuration.nix new file mode 100644 index 0000000..7481df3 --- /dev/null +++ b/networking-configuration.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + # Enable networking and bluetooth + networking = { + hostName = "laptop"; + networkmanager = { + enable = true; + wifi.macAddress = "random"; + }; + }; + hardware.bluetooth.enable = true; + + # Enable tailscale + services.tailscale.enable = true; +} diff --git a/power-configuration.nix b/power-configuration.nix new file mode 100644 index 0000000..4fda177 --- /dev/null +++ b/power-configuration.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + #powerManagement.powertop.enable = true; + + boot.kernelParams = [ "vm.dirty_writeback_centisecs=1500" ]; +} diff --git a/zephyrus-configuration.nix b/zephyrus-configuration.nix new file mode 100644 index 0000000..aeb30b5 --- /dev/null +++ b/zephyrus-configuration.nix @@ -0,0 +1,47 @@ +{ pkgs, lib, ... }: +{ + # Configure basic system settings: + boot = { + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "mem_sleep_default=deep" + "pcie_aspm.policy=powersupersave" + ]; + }; + + # Enable asus tools + services = { + supergfxd.enable = true; + asusd = { + enable = true; + enableUserService = true; + }; + fwupd.enable = true; + }; + + # Enable Open GL and Nvidia + hardware = { + graphics = { + enable = true; + enable32Bit = true; + }; + }; + + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement = { + enable = true; + finegrained = true; + }; + nvidiaSettings = true; + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + amdgpuBusId = "PCI:101:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; +}