From deda06423e0848fa2e968616c7b95684aed0237a Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:01:24 +0100 Subject: [PATCH] add portable ssd, fix laptop eval --- flake.nix | 6 ++ modules/collections/laptop.nix | 1 - modules/graphical/default.nix | 1 - modules/graphical/gamemode.nix | 20 ------- modules/graphical/games.nix | 7 +++ modules/graphical/gnome.nix | 11 ++-- modules/hardware/amd-gpu.nix | 12 ++++ modules/hardware/default.nix | 1 + systems/amd-server/configuration.nix | 4 +- systems/laptop/modules/battery.nix | 2 +- systems/pc/configuration.nix | 1 - systems/portable-ssd/configuration.nix | 82 ++++++++++++++++++++++++++ 12 files changed, 115 insertions(+), 33 deletions(-) delete mode 100644 modules/graphical/gamemode.nix create mode 100644 modules/hardware/amd-gpu.nix create mode 100644 systems/portable-ssd/configuration.nix diff --git a/flake.nix b/flake.nix index 741a5da..6994f40 100644 --- a/flake.nix +++ b/flake.nix @@ -222,6 +222,12 @@ disko.nixosModules.disko ]; }; + "portable-ssd" = mkHost { + modules = [ + ./users/kopatz + ./systems/portable-ssd/configuration.nix + ]; + }; }; packages = customPackages.packages; diff --git a/modules/collections/laptop.nix b/modules/collections/laptop.nix index 8fd4994..5eda282 100644 --- a/modules/collections/laptop.nix +++ b/modules/collections/laptop.nix @@ -33,7 +33,6 @@ #android.enable = true; }; #emulators.enable = true; - gamemode.enable = true; gnome.enable = true; hyprland.enable = true; #games.enable = true; diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index 506363d..a6bd541 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -10,7 +10,6 @@ ./awesome.nix ./emulators.nix ./i3.nix - ./gamemode.nix ./games.nix ./gnome.nix ./gnome-settings.nix diff --git a/modules/graphical/gamemode.nix b/modules/graphical/gamemode.nix deleted file mode 100644 index 5ab3291..0000000 --- a/modules/graphical/gamemode.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.custom.graphical.gamemode; -in -{ - options.custom.graphical.gamemode = { - enable = mkEnableOption "Enables gamemode"; - }; - - config = mkIf cfg.enable { - programs.gamemode = { - enable = true; - settings.custom = { - start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; - end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; - }; - }; - }; -} diff --git a/modules/graphical/games.nix b/modules/graphical/games.nix index 56d68cd..fd9b88c 100644 --- a/modules/graphical/games.nix +++ b/modules/graphical/games.nix @@ -17,6 +17,13 @@ in { gamescopeSession.enable = true; extraCompatPackages = with pkgs; [ proton-ge-bin ]; }; + programs.gamemode = { + enable = true; + settings.custom = { + start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; + end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; + }; + }; environment.systemPackages = [ pkgs.mangohud ] ++ optionals cfg.enablePreinstalled (with pkgs; [ #taisei diff --git a/modules/graphical/gnome.nix b/modules/graphical/gnome.nix index af1bb56..92c40d5 100644 --- a/modules/graphical/gnome.nix +++ b/modules/graphical/gnome.nix @@ -24,9 +24,8 @@ in { environment.gnome.excludePackages = (with pkgs; [ gnome-photos gnome-tour + cheese gedit # text editor - ]) ++ (with pkgs.gnome; [ - cheese # webcam tool gnome-music gnome-terminal epiphany # web browser @@ -43,11 +42,11 @@ in { environment.systemPackages = with pkgs; [ wmctrl rofi-wayland - gnome.mutter + mutter adwaita-icon-theme - gnome.gnome-settings-daemon - gnome.gnome-tweaks - gnome.dconf-editor + gnome-settings-daemon + gnome-tweaks + dconf-editor #gruvbox-gtk-theme colloid-icon-theme gnomeExtensions.appindicator diff --git a/modules/hardware/amd-gpu.nix b/modules/hardware/amd-gpu.nix new file mode 100644 index 0000000..b8ecd38 --- /dev/null +++ b/modules/hardware/amd-gpu.nix @@ -0,0 +1,12 @@ +{ lib, config, pkgs, inputs, pkgsVersion, ... }: +let cfg = config.custom.hardware.amd-gpu; +in { + options.custom.hardware.amd-gpu = { + enable = lib.mkEnableOption "Enables amd gpus"; + }; + + config = lib.mkIf cfg.enable { + boot.initrd.kernelModules = [ "amdgpu" ]; + services.xserver.videoDrivers = [ "amdgpu" ]; + }; +} diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix index 35c6d24..64fd1c4 100644 --- a/modules/hardware/default.nix +++ b/modules/hardware/default.nix @@ -1,5 +1,6 @@ { pkgs, config, ... }: { imports = [ + ./amd-gpu.nix ./android.nix ./firmware.nix ./nvidia.nix diff --git a/systems/amd-server/configuration.nix b/systems/amd-server/configuration.nix index ff6f66e..da455b2 100644 --- a/systems/amd-server/configuration.nix +++ b/systems/amd-server/configuration.nix @@ -23,6 +23,7 @@ }; services = { syncthing = { enable = true; }; }; hardware = { + amd-gpu.enable = true; firmware.enable = true; ssd.enable = true; wooting.enable = true; @@ -62,9 +63,6 @@ # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - boot.initrd.kernelModules = [ "amdgpu" ]; - services.xserver.enable = true; - services.xserver.videoDrivers = [ "amdgpu" ]; #zenpower for ryzen boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ]; diff --git a/systems/laptop/modules/battery.nix b/systems/laptop/modules/battery.nix index 314358f..f0b9fa1 100644 --- a/systems/laptop/modules/battery.nix +++ b/systems/laptop/modules/battery.nix @@ -6,7 +6,7 @@ services.system76-scheduler.settings.cfsProfiles.enable = true; services.upower.enable = true; - environment.systemPackages = with pkgs; [ gnome.gnome-power-manager ]; + environment.systemPackages = with pkgs; [ gnome-power-manager ]; # Enable TLP (better than gnomes internal power manager) services.tlp = { diff --git a/systems/pc/configuration.nix b/systems/pc/configuration.nix index 7f6c02e..4f9d92a 100644 --- a/systems/pc/configuration.nix +++ b/systems/pc/configuration.nix @@ -57,7 +57,6 @@ android.enable = true; }; #emulators.enable = true; - gamemode.enable = true; games = { enable = true; enablePreinstalled = true; diff --git a/systems/portable-ssd/configuration.nix b/systems/portable-ssd/configuration.nix new file mode 100644 index 0000000..18ac9da --- /dev/null +++ b/systems/portable-ssd/configuration.nix @@ -0,0 +1,82 @@ +# 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 = [ ../../modules/kernel.nix ]; + + specialisation = { + nvidia = { + inheritParentConfig = true; + configuration = { custom = { hardware = { nvidia.enable = true; }; }; }; + }; + amd-gpu = { + inheritParentConfig = true; + configuration = { custom = { hardware = { amd-gpu.enable = true; }; }; }; + }; + }; + + custom = { + nftables.enable = true; + cli-tools.enable = true; + nix = { + index.enable = true; + ld.enable = true; + settings.enable = true; + }; + hardware = { + firmware.enable = true; + ssd.enable = true; + wooting.enable = true; + }; + graphical = { + audio.enable = true; + sddm.enable = true; + nightlight.enable = true; + i3.enable = true; + xfce.enable = true; + shared.enable = true; + games.enable = true; + }; + }; + mainUser.layout = "de"; + mainUser.variant = ""; + + networking.useDHCP = lib.mkDefault true; + networking.networkmanager.enable = true; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos-ssd"; + fsType = "ext4"; + options = [ "defaults" "noatime" ]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/7395-0541"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + + networking.hostName = "portable-ssd"; # Define your hostname. + nixpkgs.config.permittedInsecurePackages = + [ "electron-28.3.3" "electron-27.3.11" ]; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + git + ]; + + system.stateVersion = "24.11"; # Did you read the comment? + +}