diff --git a/flake.lock b/flake.lock index 171866f..eae4902 100644 --- a/flake.lock +++ b/flake.lock @@ -633,11 +633,11 @@ ] }, "locked": { - "lastModified": 1744430215, - "narHash": "sha256-TJ+qDke9oB6PvMboWYdLM2zHAsqSFHXNN8tnqmQUJQs=", + "lastModified": 1744433833, + "narHash": "sha256-lj1Hc/Z8fZhtchkPANZU2eN5lKOJ0MrlQ0lVVN0lN98=", "ref": "refs/heads/main", - "rev": "0599972821936ef4bfd5b1fd876de5dd4fb0c852", - "revCount": 100, + "rev": "1136fbf3d3afff7377c5516d0b92d2c5dbd2c1e1", + "revCount": 101, "type": "git", "url": "https://git.sapphic.engineer/noe/noe.sh" }, diff --git a/nixos/features/nvidia-no-vrr.nix b/nixos/features/nvidia-no-vrr.nix index 1719dfe..27af95f 100644 --- a/nixos/features/nvidia-no-vrr.nix +++ b/nixos/features/nvidia-no-vrr.nix @@ -2,8 +2,8 @@ let nvidia = config.hardware.nvidia.package; vrr-off = pkgs.writeScriptBin "vrr-off" '' - #!/bin/sh - nvidia-settings -a AllowVRR=0 + #!${pkgs.stdenv.shell} + ${nvidia}/bin/nvidia-settings -a AllowVRR=0 ''; in { config = { diff --git a/nixos/hosts/aerial/default.nix b/nixos/hosts/aerial/default.nix index 2bbeaf1..382a4a2 100644 --- a/nixos/hosts/aerial/default.nix +++ b/nixos/hosts/aerial/default.nix @@ -16,6 +16,8 @@ ../../features/tailscale.nix ../../features/telemetry ../../features/wine.nix + + ./scarlett-air.nix ]; home-manager.users.noe = import ../../../home-manager/noe/hosts/aerial.nix; @@ -45,8 +47,8 @@ networking.firewall.allowedUDPPorts = [ 42069 ]; networking.nameservers = lib.mkForce [ - # "100.80.255.88" "10.100.69.69" - # "10.0.0.1" + "10.0.0.1" ]; + } diff --git a/nixos/hosts/aerial/scarlett-air.nix b/nixos/hosts/aerial/scarlett-air.nix new file mode 100644 index 0000000..d5135d0 --- /dev/null +++ b/nixos/hosts/aerial/scarlett-air.nix @@ -0,0 +1,44 @@ +{ pkgs, ... }: let + amixer = "${pkgs.alsa-utils}/bin/amixer"; + script = pkgs.writeScriptBin "scarlett-air" '' + #!${pkgs.stdenv.shell} + which=0 + controlName="" + + find_control() { + for i in /dev/snd/controlC*; do + r=$(${amixer} controls -c $which | grep "name='Line In 2 Air Capture Enum'") + + if [[ -z $r ]]; then + ((which++)) + continue + fi + + echo "found: $r" + + controlName=$r + done + } + + for n in {1..30}; do + find_control + if [[ -z $controlName ]]; then + echo "control not found this loop, waiting..." + sleep 1s + continue + fi + + ${amixer} cset -c $which "$controlName" 2 && exit 0 + done + ''; +in { + systemd.user.services.scarlett-air = { + enable = true; + wantedBy = [ "graphical-session.target" ]; + description = "Enables yellow Air on the DAC"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${script}/bin/scarlett-air"; + }; + }; +}