diff --git a/SwarselSystems.org b/SwarselSystems.org index adcdd64..2ac4b80 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -297,10 +297,6 @@ When setting this option normally, the password would normally be written world- inputs = { }; }; nix-topology.url = "github:oddlama/nix-topology"; - scenefx = { - url = "github:wlrfx/scenefx"; - inputs.nixpkgs.follows = "nixpkgs"; - }; #+end_src ** let :PROPERTIES: @@ -852,6 +848,8 @@ My work machine. Built for more security, this is the gold standard of my config }; hardware = { + enableAllFirmware = true; + cpu.amd.updateMicrocode = true; amdgpu = { opencl.enable = true; amdvlk = { @@ -863,23 +861,23 @@ My work machine. Built for more security, this is the gold standard of my config programs.fw-fanctrl = { enable = true; - config = { - defaultStrategy = "lazy"; - strategies = { - "lazy" = { - fanSpeedUpdateFrequency = 5; - movingAverageInterval = 30; - speedCurve = [ - { temp = 0; speed = 15; } - { temp = 50; speed = 15; } - { temp = 65; speed = 25; } - { temp = 70; speed = 35; } - { temp = 75; speed = 50; } - { temp = 85; speed = 100; } - ]; - }; - }; - }; + # config = { + # defaultStrategy = "lazy"; + # strategies = { + # "lazy" = { + # fanSpeedUpdateFrequency = 5; + # movingAverageInterval = 30; + # speedCurve = [ + # { temp = 0; speed = 15; } + # { temp = 50; speed = 15; } + # { temp = 65; speed = 25; } + # { temp = 70; speed = 35; } + # { temp = 75; speed = 50; } + # { temp = 85; speed = 100; } + # ]; + # }; + # }; + # }; }; networking = { @@ -892,7 +890,14 @@ My work machine. Built for more security, this is the gold standard of my config services = { fwupd.enable = true; udev.extraRules = '' + # Make Framework 16 Ethernet Module work reliably ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20" + + # disable Wakup on Framework Laptop 16 Keyboard + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", ATTR{power/wakeup}="disabled" + + # disable Wakup on Framework Laptop 16 Numpad Module + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0014", ATTR{power/wakeup}="disabled" ''; }; @@ -913,14 +918,11 @@ My work machine. Built for more security, this is the gold standard of my config isNixos = true; flakePath = "/home/swarsel/.dotfiles"; cpuCount = 16; - # temperatureHwmon = { - # isAbsolutePath = true; - # path = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; - # input-filename = "temp1_input"; - # }; - # ------ ----- - # | DP-4 | |eDP-1| - # ------ ----- + temperatureHwmon = { + isAbsolutePath = true; + path = "/sys/devices/virtual/thermal/thermal_zone0/"; + input-filename = "temp4_input"; + }; startup = [ { command = "nextcloud --background"; } { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } @@ -998,7 +1000,7 @@ My work machine. Built for more security, this is the gold standard of my config mode = "1280x720"; scale = "1"; position = "10000,10000"; # i.e. this screen is inaccessible by moving the mouse - workspace = "12:S"; + workspace = "14:T"; output = "DP-4"; }; }; @@ -1041,6 +1043,7 @@ My work machine. Built for more security, this is the gold standard of my config } + #+end_src ***** hardware-configuration @@ -1049,25 +1052,45 @@ My work machine. Built for more security, this is the gold standard of my config :END: #+begin_src nix :tangle hosts/nixos/nbl-imba-2/hardware-configuration.nix - { config, lib, modulesPath, ... }: + { config, pkgs, lib, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + # Fix Wlan after suspend or Hibernate + environment.etc."systemd/system-sleep/fix-wifi.sh".source = + pkgs.writeShellScript "fix-wifi.sh" '' + case $1/$2 in + pre/*) + ${pkgs.kmod}/bin/modprobe -r mt7921e mt792x_lib mt76 + echo 1 > /sys/bus/pci/devices/0000:04:00.0/remove + ;; + + post/*) + ${pkgs.kmod}/bin/modprobe mt7921e + echo 1 > /sys/bus/pci/rescan + ;; + esac + ''; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "cryptd" "usbhid" "sd_mod" "r8152" ]; - boot.initrd.kernelModules = [ ]; + boot.initrd.kernelModules = [ "sg" ]; boot.kernelModules = [ "kvm-amd" ]; - # Fix screen flickering issue at the cost of battery life (disable PSR and PSR-SU, keep PR enabled) - # TODO: figure out if this is worth it - # test PSR/PR state with 'sudo grep '' /sys/kernel/debug/dri/0000*/eDP-2/*_capability' - # ref: - # https://old.reddit.com/r/framework/comments/1goh7hc/anyone_else_get_this_screen_flickering_issue/ - # https://www.reddit.com/r/NixOS/comments/1hjruq1/graphics_corruption_on_kernel_6125_and_up/ - # https://gitlab.freedesktop.org/drm/amd/-/issues/3797 - boot.kernelParams = [ "amdgpu.dcdebugmask=0x410" ]; + boot.kernelParams = [ + "mem_sleep_default=deep" + "amd_pstate=passive" + # Fix screen flickering issue at the cost of battery life (disable PSR and PSR-SU, keep PR enabled) + # TODO: figure out if this is worth it + # test PSR/PR state with 'sudo grep '' /sys/kernel/debug/dri/0000*/eDP-2/*_capability' + # ref: + # https://old.reddit.com/r/framework/comments/1goh7hc/anyone_else_get_this_screen_flickering_issue/ + # https://www.reddit.com/r/NixOS/comments/1hjruq1/graphics_corruption_on_kernel_6125_and_up/ + # https://gitlab.freedesktop.org/drm/amd/-/issues/3797 + "amdgpu.dcdebugmask=0x410" + ]; boot.extraModulePackages = [ ]; boot.initrd.luks.devices."cryptroot" = { @@ -2415,7 +2438,7 @@ This app checks for different apps that I keep around in the scratchpad for quic #+begin_src shell :tangle scripts/swarselzellij.sh KITTIES=$(($(pgrep -P 1 kitty | wc -l) - 1)) - if [[ $KITTIES -lt 1 ]]; then + if ((KITTIES < 1)); then exec kitty -o confirm_os_window_close=0 zellij attach --create main else exec kitty -o confirm_os_window_close=0 zellij attach --create "temp $KITTIES" @@ -2604,21 +2627,10 @@ This utility checks if there are updated packages in nixpkgs-unstable. It does s #+begin_src shell :tangle scripts/screenshare.sh SHARESCREEN="$(nix eval --raw ~/.dotfiles#nixosConfigurations."$(hostname)".config.home-manager.users."$(whoami)".swarselsystems.sharescreen)" - touch /tmp/screenshare.state - STATE=$(< /tmp/screenshare.state) - - if [[ $STATE != "1" ]]; then - wl-mirror "$SHARESCREEN" & - sleep 0.1 - swaymsg output "$SHARESCREEN" mode "$SWARSEL_LO_RES" - echo 1 > /tmp/screenshare.state - swaymsg '[app_id=at.yrlf.wl_mirror] move to workspace 12:S' - swaymsg '[app_id=at.yrlf.wl_mirror] fullscreen' - else - swaymsg output "$SHARESCREEN" mode "$SWARSEL_HI_RES" - echo 0 > /tmp/screenshare.state - swaymsg '[app_id=at.yrlf.wl_mirror] kill' - fi + wl-mirror "$SHARESCREEN" & + sleep 0.1 + swaymsg '[app_id=at.yrlf.wl_mirror] move to workspace 14:T' + swaymsg '[app_id=at.yrlf.wl_mirror] fullscreen' #+end_src @@ -3543,157 +3555,6 @@ This script allows for quick git branch switching. #+end_src -**** swayfxoki - - -#+begin_src nix :tangle pkgs/swayfxoki/default.nix - { - lib, - fetchFromGitHub, - stdenv, - systemd, - meson, - replaceVars, - swaybg, - ninja, - pkg-config, - gdk-pixbuf, - librsvg, - wayland-protocols, - libdrm, - libinput, - cairo, - pango, - wayland, - libGL, - libxkbcommon, - pcre2, - cmake, - json_c, - libevdev, - scdoc, - scenefx, - wayland-scanner, - xcbutilwm, - wlroots_0_18, - testers, - nixosTests, - # Used by the NixOS module: - isNixOS ? false, - enableXWayland ? true, - systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, - trayEnabled ? systemdSupport, - ... - }: - - stdenv.mkDerivation (finalAttrs: { - inherit - enableXWayland - isNixOS - systemdSupport - trayEnabled - ; - - pname = "swayfx-unwrapped"; - version = "0.5"; - - src = fetchFromGitHub { - owner = "WillPower3309"; - repo = "swayfx"; - tag = "0.5"; - hash = "sha256-gdab7zkjp/S7YVCP1t/OfOdUXZRwNvNSuRFGWEJScF8="; - }; - - patches = - [ - ./load-configuration-from-etc.patch - - (replaceVars ./fix-paths.patch { - inherit swaybg; - }) - ]; - - strictDeps = true; - depsBuildBuild = [ pkg-config ]; - - nativeBuildInputs = [ - meson - ninja - pkg-config - scdoc - wayland-scanner - cmake - ]; - - buildInputs = [ - cairo - gdk-pixbuf - json_c - libdrm - libevdev - libGL - libinput - librsvg - libxkbcommon - pango - pcre2 - scenefx - wayland - wayland-protocols - (wlroots_0_18.override { inherit (finalAttrs) enableXWayland; }) - ] ++ lib.optionals finalAttrs.enableXWayland [ xcbutilwm ]; - - mesonFlags = - let - inherit (lib.strings) mesonEnable mesonOption; - - # The "sd-bus-provider" meson option does not include a "none" option, - # but it is silently ignored iff "-Dtray=disabled". We use "basu" - # (which is not in nixpkgs) instead of "none" to alert us if this - # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761 - # assert trayEnabled -> systemdSupport && dbusSupport; - - sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; - in - [ - (mesonOption "sd-bus-provider" sd-bus-provider) - (mesonEnable "tray" finalAttrs.trayEnabled) - ]; - - passthru = { - tests = { - basic = nixosTests.swayfx; - version = testers.testVersion { - package = finalAttrs.finalPackage; - command = "sway --version"; - version = "swayfx version ${finalAttrs.version}"; - }; - }; - }; - - meta = { - description = "Sway, but with eye candy!"; - homepage = "https://github.com/WillPower3309/swayfx"; - changelog = "https://github.com/WillPower3309/swayfx/releases/tag/${finalAttrs.version}"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ - ricarch97 - ]; - platforms = lib.platforms.linux; - mainProgram = "sway"; - - longDescription = '' - Fork of Sway, an incredible and one of the most well established Wayland - compositors, and a drop-in replacement for the i3 window manager for X11. - SwayFX adds extra options and effects to the original Sway, such as rounded corners, - shadows and inactive window dimming to bring back some of the Picom X11 - compositor functionality, which was commonly used with the i3 window manager. - ''; - }; - }) - -#+end_src - **** project #+begin_src shell :tangle scripts/project.sh @@ -3782,6 +3643,112 @@ AppImage version of mgba in which the lua scripting works. #+end_src +**** swarsel-navidrome + + +#+begin_src nix :tangle pkgs/swarsel-navidrome/default.nix + { + buildGo123Module, + buildPackages, + fetchFromGitHub, + fetchNpmDeps, + lib, + nodejs, + npmHooks, + pkg-config, + stdenv, + ffmpeg-headless, + taglib, + zlib, + nixosTests, + nix-update-script, + ffmpegSupport ? true, + ... + }: + + buildGo123Module rec { + pname = "navidrome"; + version = "0.55.1"; + + src = fetchFromGitHub { + owner = "navidrome"; + repo = "navidrome"; + rev = "v${version}"; + hash = "sha256-74sN2qZVjsD5i3BkJKYcpL3vZsVIg0H5RI70oRdZpi0="; + }; + + vendorHash = "sha256-bI0iDhATvNylKnI81eeUpgsm8YqySPyinPgBbcO0y4I="; + + npmRoot = "ui"; + + npmDeps = fetchNpmDeps { + inherit src; + sourceRoot = "${src.name}/ui"; + hash = "sha256-PaE1xcZX9wZRcKeqQCXbdhi4cIBWBL8ZQdww6AOB7sQ="; + }; + + nativeBuildInputs = [ + buildPackages.makeWrapper + nodejs + npmHooks.npmConfigHook + pkg-config + ]; + + overrideModAttrs = oldAttrs: { + nativeBuildInputs = lib.filter (drv: drv != npmHooks.npmConfigHook) oldAttrs.nativeBuildInputs; + preBuild = null; + }; + + buildInputs = [ + taglib + zlib + ]; + + ldflags = [ + "-X github.com/navidrome/navidrome/consts.gitSha=${src.rev}" + "-X github.com/navidrome/navidrome/consts.gitTag=v${version}" + ]; + + CGO_CFLAGS = lib.optionals stdenv.cc.isGNU [ "-Wno-return-local-addr" ]; + + postPatch = '' + patchShebangs ui/bin/update-workbox.sh + ''; + + preBuild = '' + make buildjs + ''; + + tags = [ + "netgo" + ]; + + postFixup = lib.optionalString ffmpegSupport '' + wrapProgram $out/bin/navidrome \ + --prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]} + ''; + + passthru = { + tests.navidrome = nixosTests.navidrome; + updateScript = nix-update-script { }; + }; + + meta = { + description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic"; + mainProgram = "navidrome"; + homepage = "https://www.navidrome.org/"; + license = lib.licenses.gpl3Only; + sourceProvenance = with lib.sourceTypes; [ fromSource ]; + maintainers = with lib.maintainers; [ + aciceri + squalus + ]; + # Broken on Darwin: sandbox-exec: pattern serialization length exceeds maximum (NixOS/nix#4119) + broken = stdenv.hostPlatform.isDarwin; + }; + } +#+end_src + *** Overlays (additions, overrides, nixpkgs-stable) :PROPERTIES: :CUSTOM_ID: h:5e3e21e0-57af-4dad-b32f-6400af9b7aab @@ -3811,7 +3778,7 @@ When adding a new entry here, do not forget to add it in the default output of t }; # mgba = final.swarsel-mgba; - swayfx-unwrapped = final.swayfxoki; + navidrome = final.swarsel-navidrome; retroarch = prev.retroarch.withCores (cores: with cores; [ snes9x # snes @@ -3851,7 +3818,6 @@ When adding a new entry here, do not forget to add it in the default output of t // (inputs.nur.overlays.default final prev) // (inputs.emacs-overlay.overlay final prev) // (inputs.nix-topology.overlays.default final prev) - // (inputs.scenefx.overlays.insert final prev) // (inputs.nixgl.overlay final prev); } @@ -6234,32 +6200,56 @@ I am using distrobox to quickly circumvent isses that I cannot immediately solve This turns off the display when the lid is closed. #+begin_src nix :tangle profiles/nixos/common/lid.nix - _: - { - services.logind = { - lidSwitch = "suspend"; - lidSwitchDocked = "ignore"; +_: +{ + services.logind = { + lidSwitch = "suspend"; + lidSwitchDocked = "ignore"; + }; + services.acpid = { + enable = true; + handlers.lidClosed = { + event = "button/lid \\w+ close"; + action = '' + cat /sys/class/backlight/amdgpu_bl1/device/enabled + if grep -Fxq disabled /sys/class/backlight/amdgpu_bl1/device/enabled + then + echo "Lid closed. Disabling fprintd." + systemctl stop fprintd + ln -s /dev/null /run/systemd/transient/fprintd.service + systemctl daemon-reload + fi + ''; }; - services.acpid = { - enable = true; - lidEventCommands = - '' - export PATH=$PATH:/run/current-system/sw/bin - export WAYLAND_DISPLAY=wayland-1 - export XDG_RUNTIME_DIR=/run/user/1000 - export SWAYSOCK=$(ls /run/user/1000/sway-ipc.* | head -n 1) - - LID_STATE=$(cat /proc/acpi/button/lid/*/state | grep -q closed && echo "closed" || echo "open") - DOCKED=$(swaymsg -t get_outputs | grep -q 'HDMI\|DP' && echo "docked" || echo "undocked") - - if [ "$LID_STATE" == "closed" ] && [ "$DOCKED" == "docked" ]; then - swaymsg output eDP-2 disable - else - swaymsg output eDP-2 enable - fi - ''; + handlers.lidOpen = { + event = "button/lid \\w+ open"; + action = '' + if ! $(systemctl is-active --quiet fprintd); then + echo "Lid open. Enabling fprintd." + rm -f /run/systemd/transient/fprintd.service + systemctl daemon-reload + systemctl start fprintd + fi + ''; }; - } + lidEventCommands = + '' + export PATH=$PATH:/run/current-system/sw/bin + export WAYLAND_DISPLAY=wayland-1 + export XDG_RUNTIME_DIR=/run/user/1000 + export SWAYSOCK=$(ls /run/user/1000/sway-ipc.* | head -n 1) + + LID_STATE=$(cat /proc/acpi/button/lid/*/state | grep -q closed && echo "closed" || echo "open") + DOCKED=$(swaymsg -t get_outputs | grep -q 'HDMI\|DP' && echo "docked" || echo "undocked") + + if [ "$LID_STATE" == "closed" ] && [ "$DOCKED" == "docked" ]; then + swaymsg output eDP-2 disable + else + swaymsg output eDP-2 enable + fi + ''; + }; +} #+end_src **** Low battery notification @@ -6715,9 +6705,10 @@ Here we just define some aliases for rebuilding the system, and we allow some in MPVCommandTemplate = "mpv --audio-device=%d --no-audio-display --pause %f"; Jukebox = { Enabled = true; - Default = "pch"; + Default = "default"; Devices = [ - [ "pch" "alsa/sysdefault:CARD=PCH" ] + # use mpv --audio-device=help to get these + [ "default" "alsa/sysdefault:CARD=PCH" ] ]; }; # Switch using --impure as these credential files are not stored within the flake @@ -8680,8 +8671,9 @@ This holds packages that I can use as provided, or with small modifications (as # wayland stuff wtype wl-clipboard - wl-mirror + stable.wl-mirror wf-recorder + kanshi # screenshotting tools grim @@ -8819,7 +8811,6 @@ It is very convenient to have SSH aliases in place for machines that I use. This ServerAliveInterval 20 ''; matchBlocks = { - # Local machines "pfsense" = { hostname = "192.168.1.1"; user = "root"; @@ -8834,7 +8825,7 @@ It is very convenient to have SSH aliases in place for machines that I use. This }; "sync" = { hostname = "193.122.53.173"; - user = "root"; #this is a oracle vm server but needs root due to nixos-infect + user = "root"; }; "songdiver" = { hostname = "89.168.100.65"; @@ -8844,10 +8835,6 @@ It is very convenient to have SSH aliases in place for machines that I use. This hostname = "46.232.248.161"; user = "root"; }; - "efficient" = { - hostname = "g0.complang.tuwien.ac.at"; - user = "ep01427399"; - }; }; }; } @@ -8873,6 +8860,7 @@ This section has been notably empty ever since switching to stylix. Only Emacs i targets = { emacs.enable = false; waybar.enable = false; + sway.useWallpaper = false; }; } config.swarselsystems.stylix); @@ -10574,7 +10562,7 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded Currently, I am too lazy to explain every option here, but most of it is very self-explaining in any case. #+begin_src nix :tangle profiles/home/common/sway.nix - { config, lib, ... }: + { self, config, lib, ... }: let inherit (config.swarselsystems) monitors; workplaceSets = lib.mapAttrs' lib.swarselsystems.eachOutput monitors; @@ -10679,6 +10667,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se "${modifier}+Ctrl+Shift+r" = "exec swarsel-displaypower"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+r" = "mode resize"; + # "${modifier}+Return" = "exec kitty"; "${modifier}+Return" = "exec swarselzellij"; "${modifier}+Print" = "exec screenshare"; # "XF86AudioRaiseVolume" = "exec pa 5%"; @@ -10704,7 +10693,15 @@ Currently, I am too lazy to explain every option here, but most of it is very se }; }; defaultWorkspace = "workspace 1:一"; - output = lib.mapAttrs' lib.swarselsystems.eachMonitor monitors; + # output = lib.mapAttrs' lib.swarselsystems.eachMonitor monitors; + output = { + "${config.swarselsystems.sharescreen}" = { + bg = "${self}/wallpaper/lenovowp.png ${config.stylix.imageScalingMode}"; + }; + "Philips Consumer Electronics Company PHL BDM3270 AU11806002320" = { + bg = "${self}/wallpaper/standwp.png ${config.stylix.imageScalingMode}"; + }; + }; input = config.swarselsystems.standardinputs; workspaceOutputAssign = workplaceOutputs; startup = config.swarselsystems.startup ++ [ @@ -10737,6 +10734,8 @@ Currently, I am too lazy to explain every option here, but most of it is very se { title = "^Add$"; } { title = "^Picture-in-Picture$"; } { title = "Syncthing Tray"; } + { title = "^spotifytui$"; } + { title = "^kittyterm$"; } { app_id = "vesktop"; } { window_role = "pop-up"; } { window_role = "bubble"; } @@ -10866,12 +10865,97 @@ Currently, I am too lazy to explain every option here, but most of it is very se seat * hide_cursor 2000 + exec kanshi + exec_always kill -1 $(pidof kanshi) + + bindswitch --locked lid:on exec kanshictl switch lidclosed + bindswitch --locked lid:off exec kanshictl switch lidopen + ${swayfxSettings} "; }; } #+end_src +**** Kanshi + + +#+begin_src nix :tangle profiles/home/common/kanshi.nix + { config, ... }: + { + services.kanshi = { + enable = true; + settings = [ + { + # laptop screen + output = { + criteria = config.swarselsystems.sharescreen; + mode = config.swarselsystems.highResolution; + scale = 1.0; + }; + } + { + # home main screen + output = { + criteria = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320"; + scale = 1.0; + mode = "2560x1440"; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = "eDP-2"; + status = "enable"; + scale = 1.0; + } + ]; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "enable"; + scale = 1.7; + position = "2560,0"; + } + { + criteria = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320"; + scale = 1.0; + mode = "2560x1440"; + position = "0,0"; + } + ]; + }; + } + { + profile = { + name = "lidclosed"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "disable"; + position = "2560,0"; + } + { + criteria = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320"; + scale = 1.0; + mode = "2560x1440"; + position = "0,0"; + } + ]; + }; + } + ]; + }; + } +#+end_src + **** gpg-agent :PROPERTIES: :CUSTOM_ID: h:7d384e3b-1be7-4644-b304-ada4af0b692b @@ -11066,7 +11150,7 @@ The rest of the settings is at [[#h:fb3f3e01-7df4-4b06-9e91-aa9cac61a431][gaming The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]. Here, I am setting up the different firefox profiles that I need for the SSO sites that I need to access at work as well as a few ssh shorthands. #+begin_src nix :tangle profiles/home/optional/work.nix :noweb yes - { config, pkgs, lib, ... }: + { self, config, pkgs, lib, ... }: { home.packages = with pkgs; [ stable.teams-for-linux @@ -11086,6 +11170,21 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]] DOCUMENT_DIR_PRIV = lib.mkForce "${config.home.homeDirectory}/Documents/Private"; DOCUMENT_DIR_WORK = lib.mkForce "${config.home.homeDirectory}/Documents/Work"; }; + + wayland.windowManager.sway.config = { + output = { + "Applied Creative Technology Transmitter QUATTRO201811" = { + bg = "${self}/wallpaper/navidrome.png ${config.stylix.imageScalingMode}"; + }; + "Hewlett Packard HP Z24i CN44250RDT" = { + bg = "${self}/wallpaper/op6wp.png ${config.stylix.imageScalingMode}"; + }; + "HP Inc. HP 732pk CNC4080YL5" = { + bg = "${self}/wallpaper/botanicswp.png ${config.stylix.imageScalingMode}"; + }; + }; + }; + programs = { git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at"; @@ -11184,6 +11283,124 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]] }; }; + services = { + kanshi = { + settings = [ + { + # seminary room + output = { + criteria = "Applied Creative Technology Transmitter QUATTRO201811"; + scale = 1.0; + mode = "1280x720"; + }; + } + { + # work main screen + output = { + criteria = "HP Inc. HP 732pk CNC4080YL5"; + scale = 1.0; + mode = "3840x2160"; + }; + } + { + # work side screen + output = { + criteria = "Hewlett Packard HP Z24i CN44250RDT"; + scale = 1.0; + mode = "1920x1200"; + transform = "270"; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "enable"; + scale = 1.5; + position = "1462,0"; + } + { + criteria = "HP Inc. HP 732pk CNC4080YL5"; + scale = 1.4; + mode = "3840x2160"; + position = "-1280,0"; + } + { + criteria = "Hewlett Packard HP Z24i CN44250RDT"; + scale = 1.0; + mode = "1920x1200"; + transform = "90"; + position = "-2480,0"; + } + ]; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "enable"; + scale = 1.7; + position = "2560,0"; + } + { + criteria = "Applied Creative Technology Transmitter QUATTRO201811"; + scale = 1.0; + mode = "1280x720"; + position = "10000,10000"; + } + ]; + }; + } + { + profile = { + name = "lidclosed"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "disable"; + } + { + criteria = "HP Inc. HP 732pk CNC4080YL5"; + scale = 1.4; + mode = "3840x2160"; + position = "-1280,0"; + } + { + criteria = "Hewlett Packard HP Z24i CN44250RDT"; + scale = 1.0; + mode = "1920x1200"; + transform = "270"; + position = "-2480,0"; + } + ]; + }; + } + { + profile = { + name = "lidclosed"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "disable"; + } + { + criteria = "Applied Creative Technology Transmitter QUATTRO201811"; + scale = 1.0; + mode = "1280x720"; + position = "10000,10000"; + } + ]; + }; + } + ]; + }; + }; + xdg = { mimeApps = { defaultApplications = { diff --git a/checks/default.nix b/checks/default.nix index 4830423..daf6bad 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -3,7 +3,6 @@ pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { src = "${self}"; hooks = { - check-added-large-files.enable = true; check-case-conflicts.enable = true; check-executables-have-shebangs.enable = true; check-shebang-scripts-are-executable.enable = false; diff --git a/flake.lock b/flake.lock index abef9fc..36978f3 100644 --- a/flake.lock +++ b/flake.lock @@ -446,11 +446,11 @@ ] }, "locked": { - "lastModified": 1741730296, - "narHash": "sha256-WR983BGc2wSc8ks8C2Tq/eevkRJ9oiYnBQ6ykgoXtms=", + "lastModified": 1741868525, + "narHash": "sha256-jikLF3o6cmIwTq3BNE1KZADzL/OprjACoVkrJEKf8hQ=", "owner": "TamtamHero", "repo": "fw-fanctrl", - "rev": "c80945681dabb6bc57bc3e113e850294582d6d38", + "rev": "f97a5e9447c6def10f097d8dbd449ebb4e3ed253", "type": "github" }, "original": { @@ -1378,7 +1378,6 @@ "nswitch-rcm-nix": "nswitch-rcm-nix", "nur": "nur", "pre-commit-hooks": "pre-commit-hooks_2", - "scenefx": "scenefx", "sops-nix": "sops-nix", "stylix": "stylix", "systems": "systems_3", @@ -1427,26 +1426,6 @@ "type": "github" } }, - "scenefx": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1740440098, - "narHash": "sha256-kcK57JKbQ+tr0W10ipe2yGvWa9nJD+mLCMo3w2sp8AQ=", - "owner": "wlrfx", - "repo": "scenefx", - "rev": "1775286a04a3c60d6b15221693586ac8174a0b88", - "type": "github" - }, - "original": { - "owner": "wlrfx", - "repo": "scenefx", - "type": "github" - } - }, "scss-reset": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index f1317b7..5b0deef 100644 --- a/flake.nix +++ b/flake.nix @@ -76,10 +76,6 @@ inputs = { }; }; nix-topology.url = "github:oddlama/nix-topology"; - scenefx = { - url = "github:wlrfx/scenefx"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = inputs@{ self diff --git a/hosts/nixos/nbl-imba-2/default.nix b/hosts/nixos/nbl-imba-2/default.nix index e760801..7ce02cb 100644 --- a/hosts/nixos/nbl-imba-2/default.nix +++ b/hosts/nixos/nbl-imba-2/default.nix @@ -45,6 +45,8 @@ in }; hardware = { + enableAllFirmware = true; + cpu.amd.updateMicrocode = true; amdgpu = { opencl.enable = true; amdvlk = { @@ -56,23 +58,23 @@ in programs.fw-fanctrl = { enable = true; - config = { - defaultStrategy = "lazy"; - strategies = { - "lazy" = { - fanSpeedUpdateFrequency = 5; - movingAverageInterval = 30; - speedCurve = [ - { temp = 0; speed = 15; } - { temp = 50; speed = 15; } - { temp = 65; speed = 25; } - { temp = 70; speed = 35; } - { temp = 75; speed = 50; } - { temp = 85; speed = 100; } - ]; - }; - }; - }; + # config = { + # defaultStrategy = "lazy"; + # strategies = { + # "lazy" = { + # fanSpeedUpdateFrequency = 5; + # movingAverageInterval = 30; + # speedCurve = [ + # { temp = 0; speed = 15; } + # { temp = 50; speed = 15; } + # { temp = 65; speed = 25; } + # { temp = 70; speed = 35; } + # { temp = 75; speed = 50; } + # { temp = 85; speed = 100; } + # ]; + # }; + # }; + # }; }; networking = { @@ -85,7 +87,14 @@ in services = { fwupd.enable = true; udev.extraRules = '' + # Make Framework 16 Ethernet Module work reliably ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20" + + # disable Wakup on Framework Laptop 16 Keyboard + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", ATTR{power/wakeup}="disabled" + + # disable Wakup on Framework Laptop 16 Numpad Module + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0014", ATTR{power/wakeup}="disabled" ''; }; @@ -106,14 +115,11 @@ in isNixos = true; flakePath = "/home/swarsel/.dotfiles"; cpuCount = 16; - # temperatureHwmon = { - # isAbsolutePath = true; - # path = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; - # input-filename = "temp1_input"; - # }; - # ------ ----- - # | DP-4 | |eDP-1| - # ------ ----- + temperatureHwmon = { + isAbsolutePath = true; + path = "/sys/devices/virtual/thermal/thermal_zone0/"; + input-filename = "temp4_input"; + }; startup = [ { command = "nextcloud --background"; } { command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; } @@ -191,7 +197,7 @@ in mode = "1280x720"; scale = "1"; position = "10000,10000"; # i.e. this screen is inaccessible by moving the mouse - workspace = "12:S"; + workspace = "14:T"; output = "DP-4"; }; }; diff --git a/hosts/nixos/nbl-imba-2/hardware-configuration.nix b/hosts/nixos/nbl-imba-2/hardware-configuration.nix index 2bbca72..fb00dab 100644 --- a/hosts/nixos/nbl-imba-2/hardware-configuration.nix +++ b/hosts/nixos/nbl-imba-2/hardware-configuration.nix @@ -1,22 +1,42 @@ -{ config, lib, modulesPath, ... }: +{ config, pkgs, lib, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + # Fix Wlan after suspend or Hibernate + environment.etc."systemd/system-sleep/fix-wifi.sh".source = + pkgs.writeShellScript "fix-wifi.sh" '' + case $1/$2 in + pre/*) + ${pkgs.kmod}/bin/modprobe -r mt7921e mt792x_lib mt76 + echo 1 > /sys/bus/pci/devices/0000:04:00.0/remove + ;; + + post/*) + ${pkgs.kmod}/bin/modprobe mt7921e + echo 1 > /sys/bus/pci/rescan + ;; + esac + ''; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "cryptd" "usbhid" "sd_mod" "r8152" ]; - boot.initrd.kernelModules = [ ]; + boot.initrd.kernelModules = [ "sg" ]; boot.kernelModules = [ "kvm-amd" ]; - # Fix screen flickering issue at the cost of battery life (disable PSR and PSR-SU, keep PR enabled) - # TODO: figure out if this is worth it - # test PSR/PR state with 'sudo grep '' /sys/kernel/debug/dri/0000*/eDP-2/*_capability' - # ref: - # https://old.reddit.com/r/framework/comments/1goh7hc/anyone_else_get_this_screen_flickering_issue/ - # https://www.reddit.com/r/NixOS/comments/1hjruq1/graphics_corruption_on_kernel_6125_and_up/ - # https://gitlab.freedesktop.org/drm/amd/-/issues/3797 - boot.kernelParams = [ "amdgpu.dcdebugmask=0x410" ]; + boot.kernelParams = [ + "mem_sleep_default=deep" + "amd_pstate=passive" + # Fix screen flickering issue at the cost of battery life (disable PSR and PSR-SU, keep PR enabled) + # TODO: figure out if this is worth it + # test PSR/PR state with 'sudo grep '' /sys/kernel/debug/dri/0000*/eDP-2/*_capability' + # ref: + # https://old.reddit.com/r/framework/comments/1goh7hc/anyone_else_get_this_screen_flickering_issue/ + # https://www.reddit.com/r/NixOS/comments/1hjruq1/graphics_corruption_on_kernel_6125_and_up/ + # https://gitlab.freedesktop.org/drm/amd/-/issues/3797 + "amdgpu.dcdebugmask=0x410" + ]; boot.extraModulePackages = [ ]; boot.initrd.luks.devices."cryptroot" = { diff --git a/overlays/default.nix b/overlays/default.nix index 45dba8a..ab7a586 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -17,7 +17,7 @@ let }; # mgba = final.swarsel-mgba; - swayfx-unwrapped = final.swayfxoki; + navidrome = final.swarsel-navidrome; retroarch = prev.retroarch.withCores (cores: with cores; [ snes9x # snes @@ -57,7 +57,6 @@ in // (inputs.nur.overlays.default final prev) // (inputs.emacs-overlay.overlay final prev) // (inputs.nix-topology.overlays.default final prev) - // (inputs.scenefx.overlays.insert final prev) // (inputs.nixgl.overlay final prev); } diff --git a/pkgs/swarsel-navidrome/default.nix b/pkgs/swarsel-navidrome/default.nix new file mode 100644 index 0000000..e78ab6e --- /dev/null +++ b/pkgs/swarsel-navidrome/default.nix @@ -0,0 +1,99 @@ +{ buildGo123Module +, buildPackages +, fetchFromGitHub +, fetchNpmDeps +, lib +, nodejs +, npmHooks +, pkg-config +, stdenv +, ffmpeg-headless +, taglib +, zlib +, nixosTests +, nix-update-script +, ffmpegSupport ? true +, ... +}: + +buildGo123Module rec { + pname = "navidrome"; + version = "0.55.1"; + + src = fetchFromGitHub { + owner = "navidrome"; + repo = "navidrome"; + rev = "v${version}"; + hash = "sha256-74sN2qZVjsD5i3BkJKYcpL3vZsVIg0H5RI70oRdZpi0="; + }; + + vendorHash = "sha256-bI0iDhATvNylKnI81eeUpgsm8YqySPyinPgBbcO0y4I="; + + npmRoot = "ui"; + + npmDeps = fetchNpmDeps { + inherit src; + sourceRoot = "${src.name}/ui"; + hash = "sha256-PaE1xcZX9wZRcKeqQCXbdhi4cIBWBL8ZQdww6AOB7sQ="; + }; + + nativeBuildInputs = [ + buildPackages.makeWrapper + nodejs + npmHooks.npmConfigHook + pkg-config + ]; + + overrideModAttrs = oldAttrs: { + nativeBuildInputs = lib.filter (drv: drv != npmHooks.npmConfigHook) oldAttrs.nativeBuildInputs; + preBuild = null; + }; + + buildInputs = [ + taglib + zlib + ]; + + ldflags = [ + "-X github.com/navidrome/navidrome/consts.gitSha=${src.rev}" + "-X github.com/navidrome/navidrome/consts.gitTag=v${version}" + ]; + + CGO_CFLAGS = lib.optionals stdenv.cc.isGNU [ "-Wno-return-local-addr" ]; + + postPatch = '' + patchShebangs ui/bin/update-workbox.sh + ''; + + preBuild = '' + make buildjs + ''; + + tags = [ + "netgo" + ]; + + postFixup = lib.optionalString ffmpegSupport '' + wrapProgram $out/bin/navidrome \ + --prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]} + ''; + + passthru = { + tests.navidrome = nixosTests.navidrome; + updateScript = nix-update-script { }; + }; + + meta = { + description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic"; + mainProgram = "navidrome"; + homepage = "https://www.navidrome.org/"; + license = lib.licenses.gpl3Only; + sourceProvenance = with lib.sourceTypes; [ fromSource ]; + maintainers = with lib.maintainers; [ + aciceri + squalus + ]; + # Broken on Darwin: sandbox-exec: pattern serialization length exceeds maximum (NixOS/nix#4119) + broken = stdenv.hostPlatform.isDarwin; + }; +} diff --git a/pkgs/swayfxoki/default.nix b/pkgs/swayfxoki/default.nix deleted file mode 100644 index 5d14a9e..0000000 --- a/pkgs/swayfxoki/default.nix +++ /dev/null @@ -1,143 +0,0 @@ -{ lib -, fetchFromGitHub -, stdenv -, systemd -, meson -, replaceVars -, swaybg -, ninja -, pkg-config -, gdk-pixbuf -, librsvg -, wayland-protocols -, libdrm -, libinput -, cairo -, pango -, wayland -, libGL -, libxkbcommon -, pcre2 -, cmake -, json_c -, libevdev -, scdoc -, scenefx -, wayland-scanner -, xcbutilwm -, wlroots_0_18 -, testers -, nixosTests -, # Used by the NixOS module: - isNixOS ? false -, enableXWayland ? true -, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd -, trayEnabled ? systemdSupport -, ... -}: - -stdenv.mkDerivation (finalAttrs: { - inherit - enableXWayland - isNixOS - systemdSupport - trayEnabled - ; - - pname = "swayfx-unwrapped"; - version = "0.5"; - - src = fetchFromGitHub { - owner = "WillPower3309"; - repo = "swayfx"; - tag = "0.5"; - hash = "sha256-gdab7zkjp/S7YVCP1t/OfOdUXZRwNvNSuRFGWEJScF8="; - }; - - patches = - [ - ./load-configuration-from-etc.patch - - (replaceVars ./fix-paths.patch { - inherit swaybg; - }) - ]; - - strictDeps = true; - depsBuildBuild = [ pkg-config ]; - - nativeBuildInputs = [ - meson - ninja - pkg-config - scdoc - wayland-scanner - cmake - ]; - - buildInputs = [ - cairo - gdk-pixbuf - json_c - libdrm - libevdev - libGL - libinput - librsvg - libxkbcommon - pango - pcre2 - scenefx - wayland - wayland-protocols - (wlroots_0_18.override { inherit (finalAttrs) enableXWayland; }) - ] ++ lib.optionals finalAttrs.enableXWayland [ xcbutilwm ]; - - mesonFlags = - let - inherit (lib.strings) mesonEnable mesonOption; - - # The "sd-bus-provider" meson option does not include a "none" option, - # but it is silently ignored iff "-Dtray=disabled". We use "basu" - # (which is not in nixpkgs) instead of "none" to alert us if this - # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761 - # assert trayEnabled -> systemdSupport && dbusSupport; - - sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; - in - [ - (mesonOption "sd-bus-provider" sd-bus-provider) - (mesonEnable "tray" finalAttrs.trayEnabled) - ]; - - passthru = { - tests = { - basic = nixosTests.swayfx; - version = testers.testVersion { - package = finalAttrs.finalPackage; - command = "sway --version"; - version = "swayfx version ${finalAttrs.version}"; - }; - }; - }; - - meta = { - description = "Sway, but with eye candy!"; - homepage = "https://github.com/WillPower3309/swayfx"; - changelog = "https://github.com/WillPower3309/swayfx/releases/tag/${finalAttrs.version}"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ - ricarch97 - ]; - platforms = lib.platforms.linux; - mainProgram = "sway"; - - longDescription = '' - Fork of Sway, an incredible and one of the most well established Wayland - compositors, and a drop-in replacement for the i3 window manager for X11. - SwayFX adds extra options and effects to the original Sway, such as rounded corners, - shadows and inactive window dimming to bring back some of the Picom X11 - compositor functionality, which was commonly used with the i3 window manager. - ''; - }; -}) diff --git a/pkgs/swayfxoki/fix-paths.patch b/pkgs/swayfxoki/fix-paths.patch deleted file mode 100644 index a937cc4..0000000 --- a/pkgs/swayfxoki/fix-paths.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/sway/config.c -+++ b/sway/config.c -@@ -276,7 +276,7 @@ - - if (!(config->active_bar_modifiers = create_list())) goto cleanup; - -- if (!(config->swaybg_command = strdup("swaybg"))) goto cleanup; -+ if (!(config->swaybg_command = strdup("@swaybg@/bin/swaybg"))) goto cleanup; - - if (!(config->config_chain = create_list())) goto cleanup; - config->current_config_path = NULL; diff --git a/pkgs/swayfxoki/load-configuration-from-etc.patch b/pkgs/swayfxoki/load-configuration-from-etc.patch deleted file mode 100644 index f98826d..0000000 --- a/pkgs/swayfxoki/load-configuration-from-etc.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 92283df3acbffa5c1bb21f23cdd686113d905114 Mon Sep 17 00:00:00 2001 -From: Patrick Hilhorst -Date: Wed, 31 Mar 2021 21:14:13 +0200 -Subject: [PATCH] Load configs from /etc but fallback to /nix/store - -This change will load all configuration files from /etc, to make it easy -to override them, but fallback to /nix/store/.../etc/sway/config to make -Sway work out-of-the-box with the default configuration on non NixOS -systems. - -Original patch by Michael Weiss, updated for Sway 1.6 by Patrick Hilhorst - -Co-authored-by: Michael Weiss ---- - meson.build | 3 ++- - sway/config.c | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index b7a29660..8ae8ceb3 100644 ---- a/meson.build -+++ b/meson.build -@@ -164,7 +164,8 @@ if scdoc.found() - endforeach - endif - --add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') -+add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') -+add_project_arguments('-DNIX_SYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') - - version = '"@0@"'.format(meson.project_version()) - git = find_program('git', native: true, required: false) -diff --git a/sway/config.c b/sway/config.c -index 76b9ec08..fb5b51aa 100644 ---- a/sway/config.c -+++ b/sway/config.c -@@ -374,7 +374,8 @@ static char *get_config_path(void) { - { .prefix = home, .config_folder = ".i3"}, - { .prefix = config_home, .config_folder = "i3"}, - { .prefix = SYSCONFDIR, .config_folder = "sway"}, -- { .prefix = SYSCONFDIR, .config_folder = "i3"} -+ { .prefix = SYSCONFDIR, .config_folder = "i3"}, -+ { .prefix = NIX_SYSCONFDIR, .config_folder = "sway"}, - }; - - size_t num_config_paths = sizeof(config_paths)/sizeof(config_paths[0]); --- -2.30.1 diff --git a/profiles/home/common/kanshi.nix b/profiles/home/common/kanshi.nix new file mode 100644 index 0000000..2a4ba89 --- /dev/null +++ b/profiles/home/common/kanshi.nix @@ -0,0 +1,73 @@ +{ config, ... }: +{ + services.kanshi = { + enable = true; + settings = [ + { + # laptop screen + output = { + criteria = config.swarselsystems.sharescreen; + mode = config.swarselsystems.highResolution; + scale = 1.0; + }; + } + { + # home main screen + output = { + criteria = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320"; + scale = 1.0; + mode = "2560x1440"; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = "eDP-2"; + status = "enable"; + scale = 1.0; + } + ]; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "enable"; + scale = 1.7; + position = "2560,0"; + } + { + criteria = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320"; + scale = 1.0; + mode = "2560x1440"; + position = "0,0"; + } + ]; + }; + } + { + profile = { + name = "lidclosed"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "disable"; + position = "2560,0"; + } + { + criteria = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320"; + scale = 1.0; + mode = "2560x1440"; + position = "0,0"; + } + ]; + }; + } + ]; + }; +} diff --git a/profiles/home/common/packages.nix b/profiles/home/common/packages.nix index 65a4032..316970b 100644 --- a/profiles/home/common/packages.nix +++ b/profiles/home/common/packages.nix @@ -131,8 +131,9 @@ # wayland stuff wtype wl-clipboard - wl-mirror + stable.wl-mirror wf-recorder + kanshi # screenshotting tools grim diff --git a/profiles/home/common/ssh.nix b/profiles/home/common/ssh.nix index 23aafc7..dae7787 100644 --- a/profiles/home/common/ssh.nix +++ b/profiles/home/common/ssh.nix @@ -8,7 +8,6 @@ _: ServerAliveInterval 20 ''; matchBlocks = { - # Local machines "pfsense" = { hostname = "192.168.1.1"; user = "root"; @@ -23,7 +22,7 @@ _: }; "sync" = { hostname = "193.122.53.173"; - user = "root"; #this is a oracle vm server but needs root due to nixos-infect + user = "root"; }; "songdiver" = { hostname = "89.168.100.65"; @@ -33,10 +32,6 @@ _: hostname = "46.232.248.161"; user = "root"; }; - "efficient" = { - hostname = "g0.complang.tuwien.ac.at"; - user = "ep01427399"; - }; }; }; } diff --git a/profiles/home/common/stylix.nix b/profiles/home/common/stylix.nix index 354172a..8e04231 100644 --- a/profiles/home/common/stylix.nix +++ b/profiles/home/common/stylix.nix @@ -6,6 +6,7 @@ targets = { emacs.enable = false; waybar.enable = false; + sway.useWallpaper = false; }; } config.swarselsystems.stylix); diff --git a/profiles/home/common/sway.nix b/profiles/home/common/sway.nix index b68a024..3d511eb 100644 --- a/profiles/home/common/sway.nix +++ b/profiles/home/common/sway.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ self, config, lib, ... }: let inherit (config.swarselsystems) monitors; workplaceSets = lib.mapAttrs' lib.swarselsystems.eachOutput monitors; @@ -103,6 +103,7 @@ in "${modifier}+Ctrl+Shift+r" = "exec swarsel-displaypower"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+r" = "mode resize"; + # "${modifier}+Return" = "exec kitty"; "${modifier}+Return" = "exec swarselzellij"; "${modifier}+Print" = "exec screenshare"; # "XF86AudioRaiseVolume" = "exec pa 5%"; @@ -128,7 +129,15 @@ in }; }; defaultWorkspace = "workspace 1:一"; - output = lib.mapAttrs' lib.swarselsystems.eachMonitor monitors; + # output = lib.mapAttrs' lib.swarselsystems.eachMonitor monitors; + output = { + "${config.swarselsystems.sharescreen}" = { + bg = "${self}/wallpaper/lenovowp.png ${config.stylix.imageScalingMode}"; + }; + "Philips Consumer Electronics Company PHL BDM3270 AU11806002320" = { + bg = "${self}/wallpaper/standwp.png ${config.stylix.imageScalingMode}"; + }; + }; input = config.swarselsystems.standardinputs; workspaceOutputAssign = workplaceOutputs; startup = config.swarselsystems.startup ++ [ @@ -161,6 +170,8 @@ in { title = "^Add$"; } { title = "^Picture-in-Picture$"; } { title = "Syncthing Tray"; } + { title = "^spotifytui$"; } + { title = "^kittyterm$"; } { app_id = "vesktop"; } { window_role = "pop-up"; } { window_role = "bubble"; } @@ -290,6 +301,12 @@ in seat * hide_cursor 2000 + exec kanshi + exec_always kill -1 $(pidof kanshi) + + bindswitch --locked lid:on exec kanshictl switch lidclosed + bindswitch --locked lid:off exec kanshictl switch lidopen + ${swayfxSettings} "; }; diff --git a/profiles/home/optional/work.nix b/profiles/home/optional/work.nix index b3814c9..b61698d 100644 --- a/profiles/home/optional/work.nix +++ b/profiles/home/optional/work.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ self, config, pkgs, lib, ... }: { home.packages = with pkgs; [ stable.teams-for-linux @@ -18,6 +18,21 @@ DOCUMENT_DIR_PRIV = lib.mkForce "${config.home.homeDirectory}/Documents/Private"; DOCUMENT_DIR_WORK = lib.mkForce "${config.home.homeDirectory}/Documents/Work"; }; + + wayland.windowManager.sway.config = { + output = { + "Applied Creative Technology Transmitter QUATTRO201811" = { + bg = "${self}/wallpaper/navidrome.png ${config.stylix.imageScalingMode}"; + }; + "Hewlett Packard HP Z24i CN44250RDT" = { + bg = "${self}/wallpaper/op6wp.png ${config.stylix.imageScalingMode}"; + }; + "HP Inc. HP 732pk CNC4080YL5" = { + bg = "${self}/wallpaper/botanicswp.png ${config.stylix.imageScalingMode}"; + }; + }; + }; + programs = { git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at"; @@ -116,6 +131,124 @@ }; }; + services = { + kanshi = { + settings = [ + { + # seminary room + output = { + criteria = "Applied Creative Technology Transmitter QUATTRO201811"; + scale = 1.0; + mode = "1280x720"; + }; + } + { + # work main screen + output = { + criteria = "HP Inc. HP 732pk CNC4080YL5"; + scale = 1.0; + mode = "3840x2160"; + }; + } + { + # work side screen + output = { + criteria = "Hewlett Packard HP Z24i CN44250RDT"; + scale = 1.0; + mode = "1920x1200"; + transform = "270"; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "enable"; + scale = 1.5; + position = "1462,0"; + } + { + criteria = "HP Inc. HP 732pk CNC4080YL5"; + scale = 1.4; + mode = "3840x2160"; + position = "-1280,0"; + } + { + criteria = "Hewlett Packard HP Z24i CN44250RDT"; + scale = 1.0; + mode = "1920x1200"; + transform = "90"; + position = "-2480,0"; + } + ]; + }; + } + { + profile = { + name = "lidopen"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "enable"; + scale = 1.7; + position = "2560,0"; + } + { + criteria = "Applied Creative Technology Transmitter QUATTRO201811"; + scale = 1.0; + mode = "1280x720"; + position = "10000,10000"; + } + ]; + }; + } + { + profile = { + name = "lidclosed"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "disable"; + } + { + criteria = "HP Inc. HP 732pk CNC4080YL5"; + scale = 1.4; + mode = "3840x2160"; + position = "-1280,0"; + } + { + criteria = "Hewlett Packard HP Z24i CN44250RDT"; + scale = 1.0; + mode = "1920x1200"; + transform = "270"; + position = "-2480,0"; + } + ]; + }; + } + { + profile = { + name = "lidclosed"; + outputs = [ + { + criteria = config.swarselsystems.sharescreen; + status = "disable"; + } + { + criteria = "Applied Creative Technology Transmitter QUATTRO201811"; + scale = 1.0; + mode = "1280x720"; + position = "10000,10000"; + } + ]; + }; + } + ]; + }; + }; + xdg = { mimeApps = { defaultApplications = { diff --git a/profiles/nixos/common/lid.nix b/profiles/nixos/common/lid.nix index b6cf03e..2382db3 100644 --- a/profiles/nixos/common/lid.nix +++ b/profiles/nixos/common/lid.nix @@ -6,6 +6,30 @@ _: }; services.acpid = { enable = true; + handlers.lidClosed = { + event = "button/lid \\w+ close"; + action = '' + cat /sys/class/backlight/amdgpu_bl1/device/enabled + if grep -Fxq disabled /sys/class/backlight/amdgpu_bl1/device/enabled + then + echo "Lid closed. Disabling fprintd." + systemctl stop fprintd + ln -s /dev/null /run/systemd/transient/fprintd.service + systemctl daemon-reload + fi + ''; + }; + handlers.lidOpen = { + event = "button/lid \\w+ open"; + action = '' + if ! $(systemctl is-active --quiet fprintd); then + echo "Lid open. Enabling fprintd." + rm -f /run/systemd/transient/fprintd.service + systemctl daemon-reload + systemctl start fprintd + fi + ''; + }; lidEventCommands = '' export PATH=$PATH:/run/current-system/sw/bin diff --git a/profiles/nixos/server/navidrome.nix b/profiles/nixos/server/navidrome.nix index e308ce1..caf6c6b 100644 --- a/profiles/nixos/server/navidrome.nix +++ b/profiles/nixos/server/navidrome.nix @@ -51,9 +51,10 @@ in MPVCommandTemplate = "mpv --audio-device=%d --no-audio-display --pause %f"; Jukebox = { Enabled = true; - Default = "pch"; + Default = "default"; Devices = [ - [ "pch" "alsa/sysdefault:CARD=PCH" ] + # use mpv --audio-device=help to get these + [ "default" "alsa/sysdefault:CARD=PCH" ] ]; }; # Switch using --impure as these credential files are not stored within the flake diff --git a/programs/zellij/config.kdl.nix b/programs/zellij/config.kdl.nix index 7ae009d..ae0f28a 100644 --- a/programs/zellij/config.kdl.nix +++ b/programs/zellij/config.kdl.nix @@ -5,8 +5,6 @@ default_shell "zsh" copy_on_select true on_force_close "detach" - session_name "main" - attach_to_session true default_layout "default" layout_dir "${config.home.homeDirectory}/.config/zellij/layouts" diff --git a/scripts/screenshare.sh b/scripts/screenshare.sh index 1ba5aea..689d11b 100644 --- a/scripts/screenshare.sh +++ b/scripts/screenshare.sh @@ -1,17 +1,6 @@ SHARESCREEN="$(nix eval --raw ~/.dotfiles#nixosConfigurations."$(hostname)".config.home-manager.users."$(whoami)".swarselsystems.sharescreen)" -touch /tmp/screenshare.state -STATE=$(< /tmp/screenshare.state) - -if [[ $STATE != "1" ]]; then - wl-mirror "$SHARESCREEN" & - sleep 0.1 - swaymsg output "$SHARESCREEN" mode "$SWARSEL_LO_RES" - echo 1 > /tmp/screenshare.state - swaymsg '[app_id=at.yrlf.wl_mirror] move to workspace 12:S' - swaymsg '[app_id=at.yrlf.wl_mirror] fullscreen' -else - swaymsg output "$SHARESCREEN" mode "$SWARSEL_HI_RES" - echo 0 > /tmp/screenshare.state - swaymsg '[app_id=at.yrlf.wl_mirror] kill' -fi +wl-mirror "$SHARESCREEN" & +sleep 0.1 +swaymsg '[app_id=at.yrlf.wl_mirror] move to workspace 14:T' +swaymsg '[app_id=at.yrlf.wl_mirror] fullscreen' diff --git a/scripts/swarselzellij.sh b/scripts/swarselzellij.sh index 96a3f29..fc82258 100644 --- a/scripts/swarselzellij.sh +++ b/scripts/swarselzellij.sh @@ -1,6 +1,6 @@ KITTIES=$(($(pgrep -P 1 kitty | wc -l) - 1)) -if [[ $KITTIES -lt 1 ]]; then +if ((KITTIES < 1)); then exec kitty -o confirm_os_window_close=0 zellij attach --create main else exec kitty -o confirm_os_window_close=0 zellij attach --create "temp $KITTIES" diff --git a/wallpaper/botanicswp.png b/wallpaper/botanicswp.png new file mode 100644 index 0000000..c99fa11 Binary files /dev/null and b/wallpaper/botanicswp.png differ