diff --git a/README.md b/README.md index 96da03e..09f2c37 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,6 @@ * generate home-instance * add unlock-secret to secret-store (secret-tool store --label='keepassxc' keepass unlock) * add certs and keyfiles + +## Hardware specifics + https://github.com/NixOS/nixos-hardware diff --git a/home/config/i3/config b/home/config/i3/config index 75b7ecc..186f2e2 100644 --- a/home/config/i3/config +++ b/home/config/i3/config @@ -234,8 +234,8 @@ bindsym Mod1+space exec --no-startup-id .config/i3/keyboard_layout_toggle.sh exec --no-startup-id .config/i3/keepassxc.sh # autostart other stuff -exec --no-startup-id i3-msg 'workspace 4: comms; exec signal-desktop' -exec --no-startup-id i3-msg 'workspace 4: comms; exec element-desktop' +#exec --no-startup-id i3-msg 'workspace 4: comms; exec signal-desktop' +#exec --no-startup-id i3-msg 'workspace 4: comms; exec element-desktop' # application specific stuff for_window[class="KeePassXC"] floating enable diff --git a/home/config/nixpkgs/autorandr.nix b/home/config/nixpkgs/autorandr.nix index ab9016c..a7117ed 100644 --- a/home/config/nixpkgs/autorandr.nix +++ b/home/config/nixpkgs/autorandr.nix @@ -42,13 +42,15 @@ crtc = 0; position = "3840x0"; mode = "3840x2160"; - dpi = 288; + #dpi = 288; + dpi = 96; }; DP-2 = { enable = true; primary = true; mode = "3840x2160"; - dpi = 144; + #dpi = 144; + dpi = 96; position = "0x0"; }; }; diff --git a/machine/stel-xps/common/cpu/intel/default.nix b/machine/stel-xps/common/cpu/intel/default.nix new file mode 100644 index 0000000..ad945f3 --- /dev/null +++ b/machine/stel-xps/common/cpu/intel/default.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +{ + boot.initrd.kernelModules = [ "i915" ]; + + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + hardware.opengl.extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + intel-media-driver + ]; +} diff --git a/machine/stel-xps/common/cpu/intel/kaby-lake/default.nix b/machine/stel-xps/common/cpu/intel/kaby-lake/default.nix new file mode 100644 index 0000000..e6a2d1c --- /dev/null +++ b/machine/stel-xps/common/cpu/intel/kaby-lake/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ + "i915.enable_fbc=1" + "i915.enable_psr=2" + ]; +} diff --git a/machine/stel-xps/common/cpu/intel/sandy-bridge/default.nix b/machine/stel-xps/common/cpu/intel/sandy-bridge/default.nix new file mode 100644 index 0000000..682815c --- /dev/null +++ b/machine/stel-xps/common/cpu/intel/sandy-bridge/default.nix @@ -0,0 +1,9 @@ +{ + imports = [ ../. ]; + + # Enables RC6, RC6p and RC6pp. + # Last two are only available on Sandy Bridge CPUs (circa 2011). + boot.kernelParams = [ + "i915.enable_rc6=7" + ]; +} diff --git a/machine/stel-xps/common/pc/default.nix b/machine/stel-xps/common/pc/default.nix new file mode 100644 index 0000000..8864de1 --- /dev/null +++ b/machine/stel-xps/common/pc/default.nix @@ -0,0 +1,9 @@ +{ config, lib, ... }: + +{ + boot.blacklistedKernelModules = lib.optionals (!config.hardware.enableRedistributableFirmware) [ + "ath3k" + ]; + + services.xserver.libinput.enable = lib.mkDefault true; +} diff --git a/machine/stel-xps/common/pc/laptop/acpi_call.nix b/machine/stel-xps/common/pc/laptop/acpi_call.nix new file mode 100644 index 0000000..f8c17dc --- /dev/null +++ b/machine/stel-xps/common/pc/laptop/acpi_call.nix @@ -0,0 +1,10 @@ +# acpi_call makes tlp work for newer thinkpads + +{ config, ... }: + +{ + boot = { + kernelModules = [ "acpi_call" ]; + extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; + }; +} diff --git a/machine/stel-xps/common/pc/laptop/default.nix b/machine/stel-xps/common/pc/laptop/default.nix new file mode 100644 index 0000000..9121b5f --- /dev/null +++ b/machine/stel-xps/common/pc/laptop/default.nix @@ -0,0 +1,11 @@ +{ config, lib, ... }: + +{ + imports = [ ../. ]; + + # Gnome 40 introduced a new way of managing power, without tlp. + # However, these 2 services clash when enabled simultaneously. + # https://github.com/NixOS/nixos-hardware/issues/260 + services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") + || !config.services.power-profiles-daemon.enable); +} diff --git a/machine/stel-xps/common/pc/laptop/hdd/default.nix b/machine/stel-xps/common/pc/laptop/hdd/default.nix new file mode 100644 index 0000000..63f29d4 --- /dev/null +++ b/machine/stel-xps/common/pc/laptop/hdd/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: + +{ + imports = [ ../../hdd ]; + + # Hard disk protection if the laptop falls: + services.hdapsd.enable = lib.mkDefault true; +} diff --git a/machine/stel-xps/common/pc/laptop/ssd b/machine/stel-xps/common/pc/laptop/ssd new file mode 120000 index 0000000..e313834 --- /dev/null +++ b/machine/stel-xps/common/pc/laptop/ssd @@ -0,0 +1 @@ +../ssd \ No newline at end of file diff --git a/machine/stel-xps/common/pc/ssd/default.nix b/machine/stel-xps/common/pc/ssd/default.nix new file mode 100644 index 0000000..00922e6 --- /dev/null +++ b/machine/stel-xps/common/pc/ssd/default.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + +{ + boot.kernel.sysctl = { + "vm.swappiness" = lib.mkDefault 1; + }; + + services.fstrim.enable = lib.mkDefault true; +} diff --git a/machine/stel-xps/default.nix b/machine/stel-xps/default.nix index c8bd97f..09cf771 100644 --- a/machine/stel-xps/default.nix +++ b/machine/stel-xps/default.nix @@ -1,5 +1,8 @@ { config, pkgs, ...}: { + imports = [ + ./dell-specific.nix + ]; networking.hostName = "stel-xps"; # define the hostname environment.systemPackages = with pkgs; [ diff --git a/machine/stel-xps/dell-specific.nix b/machine/stel-xps/dell-specific.nix new file mode 100644 index 0000000..bd838a6 --- /dev/null +++ b/machine/stel-xps/dell-specific.nix @@ -0,0 +1,17 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ./common/cpu/intel + ./common/pc/laptop + ./common/pc/laptop/ssd + ]; + + boot.kernelParams = [ "mem_sleep_default=deep" ]; + + # older version break wifi: + # - https://github.com/NixOS/nixos-hardware/issues/173 + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.6") pkgs.linuxPackages_latest; + + services.thermald.enable = true; +} diff --git a/to_system.sh b/to_system.sh index deddaea..e86269b 100755 --- a/to_system.sh +++ b/to_system.sh @@ -6,7 +6,7 @@ cp configuration.nix /etc/nixos/. cp -r programs /etc/nixos/. mkdir -p /etc/nixos/machine for machine in `ls -al machine | grep "^d" | rev | cut -d" " -f1 | rev`; do - cp -r machine/$machine /etc/nixos/machine/. + cp -r machine/${machine} /etc/nixos/machine/ done cp -r ./home/config/* /home/ellmau/.config/.