From 739fd62a503e1c24039173b364def89f9e7a5557 Mon Sep 17 00:00:00 2001 From: K900 Date: Thu, 23 Mar 2023 16:46:38 +0300 Subject: [PATCH] treewide: move hidpi settings to another module, make conditional on nixos version --- common/hidpi.nix | 12 ++++++++++++ flake.nix | 1 + gpd/p2-max/default.nix | 6 ++---- gpd/pocket-3/default.nix | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 common/hidpi.nix diff --git a/common/hidpi.nix b/common/hidpi.nix new file mode 100644 index 0000000..1b03085 --- /dev/null +++ b/common/hidpi.nix @@ -0,0 +1,12 @@ +{ lib, pkgs, ... }: +let + # This option is removed from NixOS 23.05 and up + nixosVersion = lib.versions.majorMinor lib.version; + config = if lib.versionOlder nixosVersion "23.05" then { + hardware.video.hidpi.enable = lib.mkDefault true; + } else { + # Just set the console font, don't mess with the font settings + console.font = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz"; + console.earlySetup = lib.mkDefault true; + }; +in config diff --git a/flake.nix b/flake.nix index d58b284..bd5ad10 100644 --- a/flake.nix +++ b/flake.nix @@ -180,6 +180,7 @@ common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix; common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; + common-hidpi = import ./common/hidpi.nix; common-pc = import ./common/pc; common-pc-hdd = import ./common/pc/hdd; common-pc-laptop = import ./common/pc/laptop; diff --git a/gpd/p2-max/default.nix b/gpd/p2-max/default.nix index e2587a7..f311864 100644 --- a/gpd/p2-max/default.nix +++ b/gpd/p2-max/default.nix @@ -1,11 +1,9 @@ -{lib, ...}: { +{ imports = [ ../../common/pc/laptop ../../common/pc/laptop/ssd ../../common/cpu/intel ../../common/cpu/intel/kaby-lake + ../../common/hidpi.nix ]; - - # HiDPI settings - hardware.video.hidpi.enable = lib.mkDefault true; } diff --git a/gpd/pocket-3/default.nix b/gpd/pocket-3/default.nix index 59de138..64417b9 100644 --- a/gpd/pocket-3/default.nix +++ b/gpd/pocket-3/default.nix @@ -5,6 +5,7 @@ in imports = [ ../../common/pc/laptop ../../common/pc/laptop/ssd + ../../common/hidpi.nix ]; # Necessary kernel modules @@ -34,7 +35,6 @@ in }; # More HiDPI settings - hardware.video.hidpi.enable = true; services.xserver.dpi = 280; # Necessary for audio support on the 1195G7 model