From 68fdd07f2e20fd8ef3c8e113d6222f2bf6b1ba6f Mon Sep 17 00:00:00 2001 From: boyreau Date: Thu, 28 May 2026 11:30:05 +0200 Subject: [PATCH] my config --- bootloader.nix | 36 ++++++++++++ configuration.nix | 114 +++++++++++++++++++++++++++++++++++++ hardware-configuration.nix | 39 +++++++++++++ hardware.nix | 51 +++++++++++++++++ security.nix | 10 ++++ 5 files changed, 250 insertions(+) create mode 100644 bootloader.nix create mode 100644 configuration.nix create mode 100644 hardware-configuration.nix create mode 100644 hardware.nix create mode 100644 security.nix diff --git a/bootloader.nix b/bootloader.nix new file mode 100644 index 0000000..e010f83 --- /dev/null +++ b/bootloader.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +{ + boot = { + loader = { + grub = { + enable = true; + efiSupport = true; + efiInstallAsRemovable = true; + enableCryptodisk = true; + device = "nodev"; + extraConfig = '' + source (crypto0)/os/arch/boot/grub/grub.cfg + ''; + }; + efi.efiSysMountPoint = "/boot/efi"; + }; + initrd = { + luks = { + devices.safe = { + device = "/dev/disk/by-uuid/16fe9b20-c31d-4b51-9b06-670713597c07"; + preLVM = true; + bypassWorkqueues = true; + }; + }; + systemd = { + initrdBin = with pkgs; [ + cryptsetup + ]; + }; + kernelModules = [ "cryptd" "uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1" ]; + availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "rtsx_pci_sdmmc" "dm_crypt" "crypto_user" ]; + supportedFilesystems = [ "btrfs" "vfat" "luks" ]; + }; + }; +} diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..149a65d --- /dev/null +++ b/configuration.nix @@ -0,0 +1,114 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./security.nix + ./hardware-configuration.nix + ./hardware.nix + ./bootloader.nix + + ]; + + nixpkgs.config.allowUnfree = true; + + networking.hostName = "niczos"; # Define your hostname. + networking.networkmanager.enable = true; + time.timeZone = "Europe/Paris"; + i18n.defaultLocale = "en_US.UTF-8"; + + virtualisation.waydroid = { + enable = true; + package = pkgs.waydroid-nftables; + }; + + programs.steam.enable = true; + + services.pipewire = { + enable = true; + audio.enable = true; + pulse.enable = true; + alsa = { + enable = true; + }; + wireplumber.enable = true; + }; + security = { + rtkit.enable = true; + wrappers = { + waydroid = { + source = "${pkgs.waydroid}/bin/waydroid"; + capabilities = "cap_net_admin=ep"; + enable = true; + owner = "root"; + group = "root"; + program = "waydroid"; + }; + }; + }; + + systemd = { + defaultUnit = "graphical.target"; + services."getty@tty1" = { + overrideStrategy = "asDropin"; + serviceConfig.ExecStart = ["" "@${pkgs.util-linux}/sbin/agetty agetty --login-program ${config.services.getty.loginProgram} --autologin zo --noclear --keep-baud %I 115200,38400,9600 $TERM"]; + }; + }; + + users.users.zo = { + isNormalUser = true; + extraGroups = [ "wheel" "audio" "video" "network" ]; + packages = [ pkgs.home-manager ]; + shell = pkgs.bash; + }; + + # List packages installed in system profile. + # You can use https://search.nixos.org/ to find more packages (and options). + environment.systemPackages = with pkgs; [ + curl + wget + cryptsetup + ]; + + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-color-emoji + liberation_ttf + fira-code + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + proggyfonts + ]; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # 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 = "26.05"; # Did you read the comment? + +} + diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..0a57cdc --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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.kernelParams = [ "i915.modeset=1" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.blacklistedKernelModules = [ "nouveau" ]; + + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/mapper/safe"; + fsType = "btrfs"; + options = [ "subvol=os/nix" ]; + }; + + fileSystems."/mnt/games" = { + device = "/dev/mapper/safe"; + fsType = "btrfs"; + options = [ "ssd" "lazytime" "subvol=game" ]; + }; + + fileSystems."/boot/efi" = + { + device = "/dev/disk/by-uuid/4FD7-458E"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hardware.nix b/hardware.nix new file mode 100644 index 0000000..47c9b1d --- /dev/null +++ b/hardware.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, ... }: + +{ + services.xserver.videoDrivers = [ "nvidia" ]; + + services.printing.enable = true; + services.printing.drivers = [ pkgs.epson-escpr pkgs.epsonscan2 ]; + + hardware = { + enableRedistributableFirmware = lib.mkDefault true; + + ########## Printers and scanners ########## + sane.enable = true; + + ######### nVidia Quadro RTX 3000m ######### + graphics.enable = true; + nvidia = { + open = false; # Not compatible with current GPU (nvidia quadro 3000) + modesetting.enable = false; + powerManagement.enable = false; # GPU too old + powerManagement.finegrained = false; # GPU too old + nvidiaSettings = true; + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + ########################################### + bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + # Shows battery charge of connected devices on supported + # Bluetooth adapters. Defaults to 'false'. + Experimental = true; + FastConnectable = true; + }; + Policy = { + AutoEnable = true; + }; + }; + }; + }; + + services.thermald.enable = lib.mkDefault true; + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; +} diff --git a/security.nix b/security.nix new file mode 100644 index 0000000..79f87e5 --- /dev/null +++ b/security.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: + +{ + networking.nftables.enable = true; + networking.firewall = { + enable = true; + allowedTCPPorts = [ ]; + allowedUDPPortRanges = [ ]; + }; +}