From ea331093bb0e61c4ca9c60e61c44483039f47ef3 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Thu, 12 Dec 2024 01:49:42 +0100 Subject: [PATCH] Add luminance and external monitor kernel modules --- modules/common/linux/default.nix | 20 ++++++++++---------- nki-home/audio/default.nix | 2 +- nki-home/audio/sdac.conf.json | 19 +++++++++++++++++++ nki-home/audio/sdac.lua | 2 +- overlay.nix | 10 ++++++++++ 5 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 nki-home/audio/sdac.conf.json diff --git a/modules/common/linux/default.nix b/modules/common/linux/default.nix index 2fae826..3b53a0d 100644 --- a/modules/common/linux/default.nix +++ b/modules/common/linux/default.nix @@ -26,15 +26,13 @@ let }; }; - graphics = { config, ... }: { - hardware = - if config.system.nixos.release == "24.05" then { - opengl.enable = true; - opengl.driSupport32Bit = true; - } else { - graphics.enable = true; - graphics.enable32Bit = true; - }; + graphics = { config, pkgs, ... }: { + hardware.graphics.enable = true; + hardware.graphics.enable32Bit = true; + # Monitor backlight + hardware.i2c.enable = true; + services.ddccontrol.enable = true; + environment.systemPackages = [ pkgs.luminance pkgs.ddcutil ]; }; accounts = { pkgs, ... }: mkIf (config.common.linux.enable && !pkgs.stdenv.isAarch64) { @@ -88,7 +86,7 @@ let enable = true; # defaults (no need to be set unless modified) quantum = 32; - rate = 48000; + rate = 44100; }; security.rtkit.enable = true; @@ -240,6 +238,8 @@ in "wheel" # Enable ‘sudo’ for the user. "plugdev" # Enable openrazer-daemon privileges "audio" + "video" + "input" ]; shell = pkgs.fish; }; diff --git a/nki-home/audio/default.nix b/nki-home/audio/default.nix index 99a7463..2d149c8 100644 --- a/nki-home/audio/default.nix +++ b/nki-home/audio/default.nix @@ -1,5 +1,5 @@ { config, pkgs, lib, ... }: { environment.etc = { - "wireplumber/main.lua.d/51-sdac.lua".source = ./sdac.lua; + "wireplumber/wireplumber.conf.d/51-sdac.conf".source = ./sdac.conf.json; }; } diff --git a/nki-home/audio/sdac.conf.json b/nki-home/audio/sdac.conf.json new file mode 100644 index 0000000..489eb9f --- /dev/null +++ b/nki-home/audio/sdac.conf.json @@ -0,0 +1,19 @@ +monitor.alsa.rules = [ + { + matches = [ + { + device.name = "alsa_output.usb-Grace_Design_SDAC-00.*" + } + ] + actions = { + update-props = { + # audio.format = "S24_3LE" + audio.rate = 88200 + api.alsa.period-size = 2 + api.alsa.headroom = 0 + api.alsa.disable-batch = true + } + } + } +] + diff --git a/nki-home/audio/sdac.lua b/nki-home/audio/sdac.lua index 2c172d6..fcf6d7b 100644 --- a/nki-home/audio/sdac.lua +++ b/nki-home/audio/sdac.lua @@ -6,7 +6,7 @@ rule = { }, apply_properties = { ["audio.format"] = "S24_3LE", - ["audio.rate"] = 96000, + ["audio.rate"] = 44100, ["api.alsa.period-size"] = 2, ["api.alsa.headroom"] = 0, ["api.alsa.disable-batch"] = true diff --git a/overlay.nix b/overlay.nix index 6a7a134..4ad7209 100644 --- a/overlay.nix +++ b/overlay.nix @@ -75,6 +75,14 @@ let builtins.seq (final.lib.assertMsg (prev.vikunja.version == "0.24.5") "Vikunja probably doesn't need custom versions anymore") (final.callPackage ./packages/common/vikunja.nix { }); + + luminance = prev.luminance.overrideAttrs (attrs: { + nativeBuildInputs = attrs.nativeBuildInputs ++ [ final.wrapGAppsHook ]; + buildInputs = attrs.buildInputs ++ [ final.glib ]; + postInstall = attrs.postInstall + '' + glib-compile-schemas $out/share/glib-2.0/schemas + ''; + }); }; overlay-libs = final: prev: { @@ -125,3 +133,5 @@ in # Bug fixes ] # we assign the overlay created before to the overlays of nixpkgs. + +