commit 53f4c9cb29833e777613ce7267cf348b3594337a Author: LordGrimmauld Date: Tue Nov 28 23:24:43 2023 +0100 start versioning current setup diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..862a707 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,70 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./modules/sway.nix + ./modules/localisation.nix + ./modules/users.nix + ./modules/tlp.nix + ./modules/printing.nix + ./modules/network.nix + ./modules/xdg.nix + ./modules/fonts.nix + ./modules/polkit.nix + ./modules/sound.nix + ./modules/tabletdriver.nix + ./modules/xserver.nix + ./modules/system-packages.nix + ./modules/mypackaegsstayinstoreffs.nix + ./modules/opengl.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Enable flatpaks + services.flatpak.enable = true; + + environment.sessionVariables = { + NIXPKGS_ALLOW_UNFREE="1"; + OMP_NUM_THREADS = "12"; + MOZ_ENABLE_WAYLAND="1"; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "unstable"; # "23.05"; # Did you read the comment? + + programs.dconf.enable = true; + +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..7cc1b13 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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") + ./modules/nvidia.nix + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.kernelParams = [ "quiet" ]; # no more explicit modeset since 545 + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D20D-B5B0"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/fonts.nix b/modules/fonts.nix new file mode 100644 index 0000000..6849e60 --- /dev/null +++ b/modules/fonts.nix @@ -0,0 +1,13 @@ +with import {}; +{ + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + font-awesome + noto-fonts-emoji + roboto + liberation_ttf + ]; + fonts.fontDir.enable = true; + +} diff --git a/modules/localisation.nix b/modules/localisation.nix new file mode 100644 index 0000000..699a702 --- /dev/null +++ b/modules/localisation.nix @@ -0,0 +1,26 @@ +with import {}; +{ + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + console.keyMap = "de"; + + services.xserver = { + layout = "de"; + xkbVariant = ""; + }; +} diff --git a/modules/mypackaegsstayinstoreffs.nix b/modules/mypackaegsstayinstoreffs.nix new file mode 100644 index 0000000..bd7cbc6 --- /dev/null +++ b/modules/mypackaegsstayinstoreffs.nix @@ -0,0 +1,13 @@ +with import {}; +{ + users.extraUsers.mypackaegsstayinstoreffs = { + isNormalUser = true; + description = "dummy user to prevent nix gc from clearing out large packages"; + packages = with pkgs; [ + jetbrains.clion + jetbrains.pycharm-community + jetbrains.idea-community + cudatoolkit_11 + ]; + }; +} diff --git a/modules/network.nix b/modules/network.nix new file mode 100644 index 0000000..a5baf88 --- /dev/null +++ b/modules/network.nix @@ -0,0 +1,43 @@ +with import {}; +{ + # 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.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + + networking.hostName = "grimmauld-nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + + # Bluetooth + services.blueman.enable = true; + hardware.bluetooth.enable = true; + + systemd.user.services.mpris-proxy = { + description = "Mpris proxy"; + after = [ "network.target" "sound.target" ]; + wantedBy = [ "default.target" ]; + serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + + environment.systemPackages = with pkgs; [ + wireguard-tools + ]; +} diff --git a/modules/nvidia.nix b/modules/nvidia.nix new file mode 100644 index 0000000..97d481c --- /dev/null +++ b/modules/nvidia.nix @@ -0,0 +1,49 @@ +{ config, pkgs, lib, ... }: +{ +hardware.nvidia = { + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + powerManagement.enable = false; + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + hardware.nvidia.prime = { + sync.enable = true; + + # Make sure to use the correct Bus ID values for your system! + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + + specialisation = { + on-the-go.configuration = { + system.nixos.tags = [ "on-the-go" ]; + powerManagement.cpuFreqGovernor = lib.mkForce "powersave"; + hardware.nvidia = { + prime.offload.enable = lib.mkForce true; + prime.offload.enableOffloadCmd = lib.mkForce true; + prime.sync.enable = lib.mkForce false; + }; + }; + }; +} diff --git a/modules/opengl.nix b/modules/opengl.nix new file mode 100644 index 0000000..9144e63 --- /dev/null +++ b/modules/opengl.nix @@ -0,0 +1,19 @@ +with import {}; +{ + # Enable OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + ]; + }; + + environment.sessionVariables = { + __GL_LOG_MAX_ANISO = "0"; + __GL_SHADER_DISK_CACHE = "1"; + __GL_SYNC_TO_VBLANK = "0"; + __GL_THREADED_OPTIMIZATIONS = "1"; + __GL_VRR_ALLOWED = "1"; + }; +} diff --git a/modules/polkit.nix b/modules/polkit.nix new file mode 100644 index 0000000..892ae3d --- /dev/null +++ b/modules/polkit.nix @@ -0,0 +1,19 @@ +with import {}; +{ + security.polkit.enable = true; + + systemd.user.services.polkit-kde-authentication-agent-1 = { + enable = true; + description = "polkit-kde-authentication-agent-1"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; +} diff --git a/modules/printing.nix b/modules/printing.nix new file mode 100644 index 0000000..b463253 --- /dev/null +++ b/modules/printing.nix @@ -0,0 +1,18 @@ +with import {}; +{ + imports = + [ # Include the results of the hardware scan. + + ]; + + # Enable CUPS to print documents. + services.printing.enable = true; + services.printing.drivers = with pkgs; [ brgenml1lpr brgenml1cupswrapper ]; + services.avahi = { + enable = true; + nssmdns = true; + openFirewall = true; + }; + + hardware.sane.brscan4.enable = true; # enables support for SANE scanners +} diff --git a/modules/sound.nix b/modules/sound.nix new file mode 100644 index 0000000..ef47e11 --- /dev/null +++ b/modules/sound.nix @@ -0,0 +1,22 @@ +with import {}; +{ + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; # osu uses jack + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + environment.systemPackages = with pkgs; [ + pavucontrol + ]; +} diff --git a/modules/sway.nix b/modules/sway.nix new file mode 100644 index 0000000..0aae2bf --- /dev/null +++ b/modules/sway.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, modulesPath, inputs, system, ... }: + +{ + nixpkgs.overlays = [ (final: prev: { sway-unwrapped = prev.sway-unwrapped.overrideAttrs (old: { + src = pkgs.fetchFromGitHub { + owner = "WillPower3309"; + repo = "swayfx"; + rev = "7c75b21933215348f28a2c788b174901ef13e267"; + sha256 = "sha256-SlfJ34TR+QdFPnTpyo/UON9RDxS3MfLU9tOabWHkknQ="; + }; + patches = + let + removePatches = [ + "LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.patch" + ]; + in + builtins.filter + (patch: !builtins.elem (patch.name or null) removePatches) + (old.patches or [ ]); + + });}) + ]; + + + programs.sway = { + enable = true; + wrapperFeatures = { + gtk = true; + base = true; + }; + + extraPackages = with pkgs; [ + swaylock + swayidle + wl-clipboard + wf-recorder + waybar + dmenu + wmenu + ]; + extraOptions = [ + "--unsupported-gpu" + ]; + extraSessionCommands = '' + export XDG_CURRENT_DESKTOP=sway + export SDL_VIDEODRIVER=wayland + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export _JAVA_AWT_WM_NONREPARENTING=1 + export MOZ_ENABLE_WAYLAND=1 + ''; + }; +} diff --git a/modules/system-packages.nix b/modules/system-packages.nix new file mode 100644 index 0000000..0520bea --- /dev/null +++ b/modules/system-packages.nix @@ -0,0 +1,22 @@ +with import {}; +{ + environment.systemPackages = with pkgs; [ + wget + xonsh + tree + git + file + kate + git-lfs + util-linux + btop + kitty + polkit-kde-agent + skanpage + cached-nix-shell + ffmpeg-full + + imagemagick + (import ../scripts.nix) + ]; +} diff --git a/modules/tabletdriver.nix b/modules/tabletdriver.nix new file mode 100644 index 0000000..dcbfaee --- /dev/null +++ b/modules/tabletdriver.nix @@ -0,0 +1,18 @@ +with import {}; +{ + systemd.services.otd-daemon = { + description = "opentabletdriver daemon, a user service to make the gui work"; + after = [ "graphical-session.target" ]; + wantedBy = [ "xdg-desktop-autostart.target" ]; + serviceConfig = { + ExecStart = "${pkgs.opentabletdriver}/bin/otd-daemon"; + Type = "simple"; + }; + }; + + environment.systemPackages = with pkgs; [ + opentabletdriver + ]; + + hardware.opentabletdriver.enable = true; +} diff --git a/modules/template.nix b/modules/template.nix new file mode 100644 index 0000000..89d9179 --- /dev/null +++ b/modules/template.nix @@ -0,0 +1,4 @@ +with import {}; +{ + +} diff --git a/modules/tlp.nix b/modules/tlp.nix new file mode 100644 index 0000000..1121b17 --- /dev/null +++ b/modules/tlp.nix @@ -0,0 +1,24 @@ +with import {}; +{ + services.power-profiles-daemon.enable = false; + services.tlp = { + enable = true; + settings = { + USB_AUTOSUSPEND=1; + USB_EXCLUDE_BTUSB=1; + USB_EXCLUDE_PHONE=1; + SOUND_POWER_SAVE_ON_AC=0; + SOUND_POWER_SAVE_ON_BAT=1; + SATA_LINKPWR_ON_AC="max_performance"; + SATA_LINKPWR_ON_BAT="min_power"; + MAX_LOST_WORK_SECS_ON_BAT=15; + CPU_ENERGY_PERF_POLICY_ON_AC="performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT="power"; + CPU_BOOST_ON_AC=1; + CPU_BOOST_ON_BAT=0; + RUNTIME_PM_ON_AC="on"; + RUNTIME_PM_ON_BAT="auto"; + }; + }; + +} diff --git a/modules/users.nix b/modules/users.nix new file mode 100644 index 0000000..3e187b7 --- /dev/null +++ b/modules/users.nix @@ -0,0 +1,20 @@ +with import {}; +{ + users.users.grimmauld = { + isNormalUser = true; + description = "grimmauld"; + extraGroups = [ "networkmanager" "wheel" "input" "video" "lp" "scanner" ]; + packages = with pkgs; [ + webcord + heroic + plasma-browser-integration + pdfarranger + kwrited + gparted + nmap + ghidra + firefox-esr + spicetify-cli + ]; + }; +} diff --git a/modules/xdg.nix b/modules/xdg.nix new file mode 100644 index 0000000..08adb0a --- /dev/null +++ b/modules/xdg.nix @@ -0,0 +1,16 @@ +with import {}; +{ + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-kde + xdg-desktop-portal-gtk + ]; + }; + + environment.sessionVariables = { + XDG_CONFIG_HOME = "$HOME/.config"; + }; +} diff --git a/modules/xserver.nix b/modules/xserver.nix new file mode 100644 index 0000000..0c8668d --- /dev/null +++ b/modules/xserver.nix @@ -0,0 +1,19 @@ +with import {}; +{ + # Enable the X11 windowing system. + services.xserver = { + enable = true; + videoDrivers = ["nvidia"]; + displayManager = { + sddm.enable = true; + defaultSession = "plasmawayland"; + }; + desktopManager = { + plasma5.enable = true; + xfce.enable = true; + }; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; +} diff --git a/scripts.nix b/scripts.nix new file mode 100644 index 0000000..56cd095 --- /dev/null +++ b/scripts.nix @@ -0,0 +1,9 @@ +with import {}; + +writeShellScriptBin "primerun" '' +export __NV_PRIME_RENDER_OFFLOAD=1 +export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 +export __GLX_VENDOR_LIBRARY_NAME=nvidia +export __VK_LAYER_NV_optimus=NVIDIA_only +exec "$@" +''