From 5339994df861bf88b07fbc15952946bd5cb4cf02 Mon Sep 17 00:00:00 2001 From: FabricSoul Date: Wed, 2 Jul 2025 17:25:32 -0400 Subject: [PATCH] update: misc --- flake.lock | 141 ++------------------------ flake.nix | 19 +--- home/fabric/default.nix | 4 +- home/fabric/desktop/desktop.nix | 68 ++++++++++++- home/fabric/desktop/hyprland.nix | 1 + home/fabric/desktop/hyprpanel.nix | 20 ++-- hosts/common/optional/bluetooth.nix | 20 ---- hosts/common/optional/sunshine.nix | 8 ++ hosts/zion/default.nix | 2 + hosts/zion/hardware-configuration.nix | 2 + 10 files changed, 100 insertions(+), 185 deletions(-) create mode 100644 hosts/common/optional/sunshine.nix diff --git a/flake.lock b/flake.lock index 30c05f5..6352bb5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,70 +1,5 @@ { "nodes": { - "ags": { - "inputs": { - "astal": "astal", - "nixpkgs": [ - "hyprpanel", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1744557573, - "narHash": "sha256-XAyj0iDuI51BytJ1PwN53uLpzTDdznPDQFG4RwihlTQ=", - "owner": "aylur", - "repo": "ags", - "rev": "3ed9737bdbc8fc7a7c7ceef2165c9109f336bff6", - "type": "github" - }, - "original": { - "owner": "aylur", - "repo": "ags", - "type": "github" - } - }, - "astal": { - "inputs": { - "nixpkgs": [ - "hyprpanel", - "ags", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1742571008, - "narHash": "sha256-5WgfJAeBpxiKbTR/gJvxrGYfqQRge5aUDcGKmU1YZ1Q=", - "owner": "aylur", - "repo": "astal", - "rev": "dc0e5d37abe9424c53dcbd2506a4886ffee6296e", - "type": "github" - }, - "original": { - "owner": "aylur", - "repo": "astal", - "type": "github" - } - }, - "astal_2": { - "inputs": { - "nixpkgs": [ - "hyprpanel", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1748416910, - "narHash": "sha256-FEQcs58HL8Fe4i7XlqVEUwthjxwvRvgX15gTTfW17sU=", - "owner": "aylur", - "repo": "astal", - "rev": "c1bd89a47c81c66ab5fc6872db5a916c0433fb89", - "type": "github" - }, - "original": { - "owner": "aylur", - "repo": "astal", - "type": "github" - } - }, "fenix": { "inputs": { "nixpkgs": [ @@ -151,11 +86,11 @@ ] }, "locked": { - "lastModified": 1750304462, - "narHash": "sha256-Mj5t4yX05/rXnRqJkpoLZTWqgStB88Mr/fegTRqyiWc=", + "lastModified": 1751476662, + "narHash": "sha256-eX6wMGQjaTzedR6lz2IpEnAMgLcuQLQezBJNil7yG3s=", "owner": "nix-community", "repo": "home-manager", - "rev": "863842639722dd12ae9e37ca83bcb61a63b36f6c", + "rev": "9347c61bc0cbed0d2062b930144c2cbd557f9189", "type": "github" }, "original": { @@ -165,26 +100,6 @@ "type": "github" } }, - "hyprpanel": { - "inputs": { - "ags": "ags", - "astal": "astal_2", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1750386831, - "narHash": "sha256-oREAoOQeAExqWMkw2r3BJfiaflh7QwHFkp8Qm0qDu6o=", - "owner": "jas-singhfsu", - "repo": "hyprpanel", - "rev": "d563cdb1f6499d981901336bd0f86303ab95c4a5", - "type": "github" - }, - "original": { - "owner": "jas-singhfsu", - "repo": "hyprpanel", - "type": "github" - } - }, "ixx": { "inputs": { "flake-utils": [ @@ -215,27 +130,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1748370509, - "narHash": "sha256-QlL8slIgc16W5UaI3w7xHQEP+Qmv/6vSNTpoZrrSlbk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "4faa5f5321320e49a78ae7848582f684d64783e9", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1750215678, - "narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=", + "lastModified": 1751382304, + "narHash": "sha256-p+UruOjULI5lV16FkBqkzqgFasLqfx0bihLBeFHiZAs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192", + "rev": "d31a91c9b3bee464d054633d5f8b84e17a637862", "type": "github" }, "original": { @@ -246,22 +145,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1750215678, - "narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1710272261, "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", @@ -287,11 +170,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1750345447, - "narHash": "sha256-yOuSSfI4xovXQpSkZUK02CBcY1f0Nvm0RhnUN8xn2rY=", + "lastModified": 1751463146, + "narHash": "sha256-mjrw7PTbdScg9tg/oghQYwsGfa2ZcSb14V6qcvl1rN8=", "owner": "nix-community", "repo": "nixvim", - "rev": "6a1a348ab1f00bd32d2392b5c2fc72489c699af3", + "rev": "30d8be8628330bc5baa064e0dac904a574558b17", "type": "github" }, "original": { @@ -328,7 +211,7 @@ "inputs": { "fenix": "fenix", "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "systems": "systems_4" }, "locked": { @@ -348,9 +231,7 @@ "root": { "inputs": { "home-manager": "home-manager", - "hyprpanel": "hyprpanel", - "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable", + "nixpkgs": "nixpkgs", "nixvim": "nixvim", "openapi-tui": "openapi-tui" } diff --git a/flake.nix b/flake.nix index 304c9b5..9df5526 100644 --- a/flake.nix +++ b/flake.nix @@ -3,19 +3,12 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; home-manager = { url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs"; }; - hyprpanel = { - url = "github:jas-singhfsu/hyprpanel"; - # inputs.nixpkgs.follows = "nixpkgs"; - # inputs.home-manager.follows = "home-manager"; # Add this line - }; - nixvim = { url = "github:nix-community/nixvim/main"; # If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-"` @@ -29,16 +22,13 @@ outputs = { self, nixpkgs, - nixpkgs-unstable, home-manager, nixvim, - hyprpanel, openapi-tui, ... }: let lib = nixpkgs.lib; pkgs = nixpkgs.legacyPackages."x86_64-linux"; - pkgsUnstable = nixpkgs-unstable.legacyPackages."x86_64-linux"; in { nixosConfigurations = { tatara = lib.nixosSystem { @@ -58,17 +48,12 @@ homeConfigurations.fabric = home-manager.lib.homeManagerConfiguration { inherit pkgs; extraSpecialArgs = { - inherit nixvim hyprpanel openapi-tui; + inherit nixvim openapi-tui; # deleted hyprpanel }; modules = [ - { - nixpkgs.overlays = [ - hyprpanel.overlay - ]; - } ./home/fabric/default.nix nixvim.homeManagerModules.nixvim - hyprpanel.homeManagerModules.hyprpanel + # hyprpanel.homeManagerModules.hyprpanel ]; }; }; diff --git a/home/fabric/default.nix b/home/fabric/default.nix index f38b9af..15fce26 100644 --- a/home/fabric/default.nix +++ b/home/fabric/default.nix @@ -1,6 +1,6 @@ { nixvim, - hyprpanel, + # hyprpanel, pkgs, pkgsUnstable, config, @@ -126,7 +126,7 @@ zsh pavucontrol wofi - hyprpanel + # hyprpanel alejandra rustup tmuxPlugins.sensible diff --git a/home/fabric/desktop/desktop.nix b/home/fabric/desktop/desktop.nix index 093631a..4393d7f 100644 --- a/home/fabric/desktop/desktop.nix +++ b/home/fabric/desktop/desktop.nix @@ -1,6 +1,70 @@ -{...}: { +{pkgs, ...}: let + # 1. Define the smart launcher script for QQ + qq-launcher = pkgs.writeShellScriptBin "launch-qq.sh" '' + #!/bin/sh + # Define the name for our persistent container + CONTAINER_NAME="qq-persistent" + + # Ensure the host directory for QQ's config exists + mkdir -p "$HOME/.config/qq-docker" + + # Check if the container is already running + if [ "$(${pkgs.docker}/bin/docker ps -q -f name=$CONTAINER_NAME)" ]; then + echo "Container is running. Sending activation signal via D-Bus..." + # This command asks the QQ application's D-Bus service to execute its 'show' method. + # The service name and path are educated guesses based on common Qt app behavior. + ${pkgs.docker}/bin/docker exec --user user "$CONTAINER_NAME" \ + qdbus com.tencent.QQ /MainApplication show + exit 0 + fi + + # Check if the container exists but is stopped + if [ "$(${pkgs.docker}/bin/docker ps -a -q -f name=$CONTAINER_NAME)" ]; then + # If stopped, just start it + echo "Starting existing, stopped QQ container..." + ${pkgs.docker}/bin/docker start "$CONTAINER_NAME" + exit 0 + fi + + # If the container does not exist at all, create it for the first time + echo "Container not found. Creating and starting new QQ container..." + ${pkgs.docker}/bin/docker run \ + -d \ + --name "$CONTAINER_NAME" \ + --user $(id -u):$(id -g) \ + --network=default \ + -e DISPLAY \ + -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \ + -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ + -e QT_QPA_PLATFORM=wayland \ + -e DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \ + -e GTK_IM_MODULE=fcitx \ + -e QT_IM_MODULE=fcitx \ + -e XMODIFIERS=@im=fcitx \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=$DISPLAY \ + -e XDG_SESSION_TYPE=wayland \ + --ipc=host \ + -v "$HOME/.config/qq-docker:/home/user/.config" \ + -v "$XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR:rw" \ + -v "/dev/dri:/dev/dri:rw" \ + -v "$HOME/xdg-open-proxy:/usr/bin/xdg-open:ro" \ + -v "/etc/machine-id:/etc/machine-id:ro" \ + --security-opt="no-new-privileges" \ + --cap-drop="ALL" \ + qq-isolated + ''; +in { + home.packages = [qq-launcher]; xdg.desktopEntries = { - # The name of the entry. This becomes the filename, e.g., "firefox-private.desktop" + # 2. Declaratively create the .desktop file + "qq-docker" = { + name = "QQ (Docker)"; + comment = "Run QQ inside a secure Docker container"; + exec = "launch-qq.sh"; + type = "Application"; + }; + discord = { # The name that will appear in Wofi name = "Discord"; diff --git a/home/fabric/desktop/hyprland.nix b/home/fabric/desktop/hyprland.nix index da8fa11..15757bd 100644 --- a/home/fabric/desktop/hyprland.nix +++ b/home/fabric/desktop/hyprland.nix @@ -92,6 +92,7 @@ ]; monitor = [ "DP-3, 3440x1440@144.00HZ, 0x0, 1" + "DP-5, 3440x1440@144.00HZ, 0x0, 1" ]; }; }; diff --git a/home/fabric/desktop/hyprpanel.nix b/home/fabric/desktop/hyprpanel.nix index f673cb4..86edf5b 100644 --- a/home/fabric/desktop/hyprpanel.nix +++ b/home/fabric/desktop/hyprpanel.nix @@ -1,16 +1,11 @@ # home/fabric/desktop/hyprpanel.nix -{ - config, - pkgs, - hyprpanel, - ... -}: { +{pkgs, ...}: { # Wayland settings for hyprpanel - wayland.windowManager.hyprland.settings = { - exec-once = [ - "${pkgs.hyprpanel}/bin/hyprpanel" - ]; - }; + # wayland.windowManager.hyprland.settings = { + # exec-once = [ + # "${pkgs.hyprpanel}/bin/hyprpanel" + # ]; + # }; programs.hyprpanel = { # Enable the module. @@ -19,9 +14,6 @@ # Add to Hyprland config # hyprland.enable = true; - # Fix the overwrite issue - overwrite.enable = false; - # Configure and theme options settings = { # Configure bar layouts for monitors diff --git a/hosts/common/optional/bluetooth.nix b/hosts/common/optional/bluetooth.nix index 7d4cda2..8cc5a1b 100644 --- a/hosts/common/optional/bluetooth.nix +++ b/hosts/common/optional/bluetooth.nix @@ -7,26 +7,6 @@ hardware.bluetooth = { enable = true; powerOnBoot = true; - settings.General = { - experimental = true; # show battery - - # https://www.reddit.com/r/NixOS/comments/1ch5d2p/comment/lkbabax/ - # for pairing bluetooth controller - Privacy = "device"; - JustWorksRepairing = "always"; - Class = "0x000100"; - FastConnectable = true; - }; }; services.blueman.enable = true; - - hardware.xpadneo.enable = true; # Enable the xpadneo driver for Xbox One wireless controllers - - boot = { - extraModulePackages = with config.boot.kernelPackages; [xpadneo]; - extraModprobeConfig = '' - options bluetooth disable_ertm=Y - ''; - # connect xbox controller - }; } diff --git a/hosts/common/optional/sunshine.nix b/hosts/common/optional/sunshine.nix new file mode 100644 index 0000000..b64aa65 --- /dev/null +++ b/hosts/common/optional/sunshine.nix @@ -0,0 +1,8 @@ +{...}: { + services.sunshine = { + enable = true; + autoStart = true; + capSysAdmin = true; + openFirewall = true; + }; +} diff --git a/hosts/zion/default.nix b/hosts/zion/default.nix index 8790fe5..427bce0 100644 --- a/hosts/zion/default.nix +++ b/hosts/zion/default.nix @@ -16,6 +16,8 @@ ../common/optional/steam.nix ../common/optional/flatpak.nix ../common/optional/fcitx5.nix + ../common/optional/bluetooth.nix + ../common/optional/sunshine.nix ]; # Bootloader diff --git a/hosts/zion/hardware-configuration.nix b/hosts/zion/hardware-configuration.nix index 1caa980..add8519 100644 --- a/hosts/zion/hardware-configuration.nix +++ b/hosts/zion/hardware-configuration.nix @@ -16,6 +16,8 @@ boot.initrd.kernelModules = []; boot.kernelModules = ["kvm-amd"]; + hardware.enableRedistributableFirmware = true; + # Firmware packages hardware.firmware = with pkgs; [ linux-firmware