diff --git a/modules/graphical/plasma.nix b/modules/graphical/plasma.nix index f37ea6f..dd0c958 100644 --- a/modules/graphical/plasma.nix +++ b/modules/graphical/plasma.nix @@ -53,7 +53,6 @@ in #}; environment.systemPackages = with pkgs; [ - libsForQt5.bismuth # auto tiling wayland-utils ]; }; diff --git a/systems/dell/configuration.nix b/systems/dell/configuration.nix new file mode 100644 index 0000000..a5995f0 --- /dev/null +++ b/systems/dell/configuration.nix @@ -0,0 +1,127 @@ +{ + config, + pkgs, + inputs, + lib, + ... +}: +let + cec = "${pkgs.v4l-utils}/bin/cec-ctl"; +in +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ./modules/battery.nix + ../../modules/misc/faster-boot-time.nix + ../../modules/misc/kernel.nix + ../../modules/services/ssh.nix + ./disk-config.nix + ]; + + + # after suspend, do `cec-ctl -A | grep cec0 | wc -l`, if >0, do `cec-ctl --standby --to TV` + # similar on wakeup, if present send `cec-ctl --user-control-pressed ui-cmd=power-on-function --to TV` + environment.etc."systemd/system-sleep/sleep-turn-tv-off-on.sh".source = + pkgs.writeShellScript "post-sleep-turn-tv-off.sh" '' + case $1/$2 in + pre/*) + if [ $(${cec} -A | ${pkgs.gnugrep}/bin/grep cec0 | ${pkgs.coreutils}/bin/wc -l) -gt 0 ]; then + ${cec} -C --skip-info + ${cec} --tv --skip-info + ${cec} --standby --skip-info --to TV + echo "Turning TV off!" + ${pkgs.coreutils}/bin/sleep 2 + fi + ;; + post/*) + if [ $(${cec} -A | ${pkgs.gnugrep}/bin/grep cec0 | ${pkgs.coreutils}/bin/wc -l) -gt 0 ]; then + ${cec} --tv --skip-info + ${cec} --skip-info --user-control-pressed ui-cmd=power-on-function --to TV + echo "Turning TV on!" + fi + ;; + esac + ''; + + custom = { + cli-tools.enable = true; + tmpfs.enable = true; + nix = { + settings.enable = true; + }; + hardware = { + firmware.enable = true; + ssd.enable = true; + fingerprint.enable = true; + }; + graphical = { + audio.enable = true; + shared.enable = true; + plasma.enable = true; + sddm.enable = true; + }; + }; + + #todo: extract this + services.xserver = { + xkb.layout = config.mainUser.layout; + xkb.variant = config.mainUser.variant; + enable = true; + }; + + services.blueman.enable = true; + hardware.bluetooth.enable = true; # enables support for Bluetooth + hardware.bluetooth.powerOnBoot = false; # powers up the default Bluetooth controller on boot + boot = { + consoleLogLevel = 3; + initrd.verbose = false; + plymouth.enable = true; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + ]; + }; + + mainUser.layout = "de"; + mainUser.variant = ""; + console.useXkbConfig = true; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "dell"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Enable networking + networking.networkmanager.enable = true; + + #networking.extraHosts = + #'' + # 82.218.12.28 kopatz.ddns.net + #''; + + # Enable touchpad support (enabled default in most desktopManager). + services.xserver.libinput.enable = true; + + security.pki.certificates = [ + '' + -----BEGIN CERTIFICATE----- + MIIBjTCCATKgAwIBAgIRAMVH2+JHZ3wm2fLUlKjTYDswCgYIKoZIzj0EAwIwJDEM + MAoGA1UEChMDS29wMRQwEgYDVQQDEwtLb3AgUm9vdCBDQTAeFw0yMzEyMDgxNDUx + MTZaFw0zMzEyMDUxNDUxMTZaMCQxDDAKBgNVBAoTA0tvcDEUMBIGA1UEAxMLS29w + IFJvb3QgQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATdZBOkNynShXipzhuX + f6dUByD3chNupNWsagYC5AlPRJT9fAeHEIK/bxWkFwRtLBDopWvBu9lHahBgpHc7 + y7rTo0UwQzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAdBgNV + HQ4EFgQU9AVtwipW5HDBLfZRH1KZCnIKCfowCgYIKoZIzj0EAwIDSQAwRgIhAMHj + AipNdhQKIYPvMt/h1uW4xP3NTkitnmshM09+rIasAiEAlSalGddXDkqJBHhPD+Fr + gpuVkfVkA8gQCXNs5F9TnxA= + -----END CERTIFICATE----- + '' + ]; + + system.stateVersion = "25.05"; # Did you read the comment? +} diff --git a/systems/dell/disk-config.nix b/systems/dell/disk-config.nix new file mode 100644 index 0000000..ef94adb --- /dev/null +++ b/systems/dell/disk-config.nix @@ -0,0 +1,43 @@ +# Example to create a bios compatible gpt partition +{ lib, ... }: +{ + disko.devices = { + disk.main = { + device = lib.mkDefault "/dev/nvme0n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + content = { + # LUKS passphrase will be prompted interactively only + type = "luks"; + name = "crypted"; + settings = { + allowDiscards = true; + }; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ "noatime" ]; + + }; + }; + }; + }; + }; + }; + }; +} diff --git a/systems/dell/hardware-configuration.nix b/systems/dell/hardware-configuration.nix new file mode 100644 index 0000000..8c260da --- /dev/null +++ b/systems/dell/hardware-configuration.nix @@ -0,0 +1,52 @@ +# 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.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "uas" "sd_mod" "rtsx_pci_sdmmc" "thunderbolt"]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + ]; + + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + #fileSystems."/" = + # { + # device = "/dev/disk/by-uuid/10537ea5-9d9f-4be8-8509-c7f9c9b978b8"; + # fsType = "ext4"; + # }; + + #fileSystems."/boot" = + # { + # device = "/dev/disk/by-uuid/C163-6BD5"; + # fsType = "vfat"; + # }; + + #swapDevices = + # [{ device = "/dev/disk/by-uuid/3ef4829c-e9ea-4cc0-85a1-bd8e704b9940"; }]; + + # 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.wlp59s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/dell/modules/battery.nix b/systems/dell/modules/battery.nix new file mode 100644 index 0000000..8efe15c --- /dev/null +++ b/systems/dell/modules/battery.nix @@ -0,0 +1,55 @@ +{ config, pkgs, ... }: + +{ + + # Better scheduling for CPU cycles - thanks System76!!! + services.system76-scheduler.settings.cfsProfiles.enable = true; + + services.upower.enable = true; + environment.systemPackages = with pkgs; [ + gnome-power-manager + powertop + ]; + + # Enable TLP (better than gnomes internal power manager) + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + #CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + + RADEON_POWER_PROFILE_ON_AC = "performance"; + RADEON_POWER_PROFILE_ON_BAT = "battery"; + + AMDGPU_ABM_LEVEL_ON_AC = 0; + AMDGPU_ABM_LEVEL_ON_BAT = 2; + + #CPU_MIN_PERF_ON_AC = 0; + #CPU_MAX_PERF_ON_AC = 100; + #CPU_MIN_PERF_ON_BAT = 0; + #CPU_MAX_PERF_ON_BAT = 20; + + #Optional helps save long term battery health + #START_CHARGE_THRESH_BAT0 = 40; # 40 and bellow it starts to charge + #STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging + + }; + }; + + # Disable GNOMEs power management + # 5.5 idle with ff open + services.power-profiles-daemon.enable = false; + + # Enable powertop + #powerManagement.powertop.enable = true; + + # Enable thermald (only necessary if on Intel CPUs) + services.thermald.enable = true; + + # toggle tlp off if this is on + # services.auto-cpufreq.enable = true; +}