From 97db6532595c24df31a206a533c579c1015265a0 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 19 Oct 2024 14:43:33 -0400 Subject: [PATCH] flake: reorg outputs (#132) * overlays: init with tablet overlays * flake: add overlays.tablet * overlays.tablet: document * pacifidlog: migrate to overlays.tablet * pacvifidlog: cleanup * overlays: add rofi-bluetooth * flake: output adjustor and hhd-ui * flake: reorg packages and overlays * flake.devShells.default: add nix-update * github: add adjustor and hhd-ui to ci * githuib: test builds * github: undo test change * pkgs: update descriptions * pkgs: reformat --- .github/workflows/nix-build.yml | 34 ++++++++++++++++++++-- common/nix.nix | 11 ++++++- common/overlays.nix | 22 -------------- flake.nix | 28 ++++++++++++------ hosts/fallarbor/default.nix | 1 - hosts/lavaridge/default.nix | 1 - hosts/mauville/default.nix | 1 - hosts/pacifidlog/default.nix | 51 +++++++-------------------------- hosts/rustboro/default.nix | 1 - hosts/slateport/default.nix | 1 - overlays/default.nix | 5 ++++ overlays/rofi-bluetooth.nix | 15 ++++++++++ overlays/tablet.nix | 20 +++++++++++++ pkgs/adjustor.nix | 14 ++++----- pkgs/hhd-ui.nix | 7 +++-- 15 files changed, 123 insertions(+), 89 deletions(-) delete mode 100644 common/overlays.nix create mode 100644 overlays/default.nix create mode 100644 overlays/rofi-bluetooth.nix create mode 100644 overlays/tablet.nix diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 8fe74274..7317e0e0 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -7,7 +7,22 @@ on: - '_img/**' workflow_dispatch: jobs: - default-build: + adjustor-build: + if: contains(github.event.head_commit.message, 'pkgs/') || contains(github.event.head_commit.message, 'flake.nix') || contains(github.event.head_commit.message, 'flake.lock') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + with: + fetch-depth: 1 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: cachix/cachix-action@master + with: + name: alyraffauf + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build default package + run: nix build --accept-flake-config .#packages.x86_64-linux.adjustor + clean-install-build: if: contains(github.event.head_commit.message, 'flake/') || contains(github.event.head_commit.message, 'flake.nix') || contains(github.event.head_commit.message, 'flake.lock') runs-on: ubuntu-latest steps: @@ -21,7 +36,22 @@ jobs: name: alyraffauf authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build default package - run: nix build --accept-flake-config .#packages.x86_64-linux.default + run: nix build --accept-flake-config .#packages.x86_64-linux.clean-install + hd-ui-build: + if: contains(github.event.head_commit.message, 'pkgs/') || contains(github.event.head_commit.message, 'flake.nix') || contains(github.event.head_commit.message, 'flake.lock') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + with: + fetch-depth: 1 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: cachix/cachix-action@master + with: + name: alyraffauf + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build default package + run: nix build --accept-flake-config .#packages.x86_64-linux.hhd-ui fallarbor-build: runs-on: ubuntu-latest steps: diff --git a/common/nix.nix b/common/nix.nix index 0dee0fb7..cd677878 100644 --- a/common/nix.nix +++ b/common/nix.nix @@ -1,4 +1,4 @@ -{ +{self, ...}: { nix = { gc = { automatic = true; @@ -38,4 +38,13 @@ trusted-users = ["aly"]; }; }; + + nixpkgs = { + config.allowUnfree = true; # Allow unfree packages + + overlays = [ + self.overlays.default + self.overlays.rofi-bluetooth + ]; + }; } diff --git a/common/overlays.nix b/common/overlays.nix deleted file mode 100644 index 56688ca7..00000000 --- a/common/overlays.nix +++ /dev/null @@ -1,22 +0,0 @@ -{pkgs, ...}: { - nixpkgs = { - config.allowUnfree = true; # Allow unfree packages - - overlays = [ - (final: prev: { - rofi-bluetooth = - prev.rofi-bluetooth.overrideAttrs - (old: { - version = "unstable-2024-07-25"; - - src = pkgs.fetchFromGitHub { - owner = "alyraffauf"; - repo = old.pname; - rev = "50252e4a9aebe4899a6ef2f7bc11d91b7e4aa8ae"; - sha256 = "sha256-o0Sr3/888L/2KzZZP/EcXx+8ZUzdHB/I/VIeVuJvJks="; - }; - }); - }) - ]; - }; -} diff --git a/flake.nix b/flake.nix index 61254eb1..10accff6 100644 --- a/flake.nix +++ b/flake.nix @@ -112,6 +112,7 @@ git mdformat nh + nix-update ruby sbctl ]) @@ -129,13 +130,6 @@ formatter = forAllSystems ({pkgs}: pkgs.alejandra); - packages = forAllLinuxSystems ({pkgs}: { - default = pkgs.writeShellApplication { - name = "clean-install"; - text = ./flake/clean-install.sh; - }; - }); - homeManagerModules = { default = import ./homeManagerModules self; aly = import ./homes/aly self; @@ -148,7 +142,6 @@ common-locale = import ./common/locale.nix; common-mauville-share = import ./common/samba.nix; common-nix = import ./common/nix.nix; - common-overlays = import ./common/overlays.nix; common-pkgs = import ./common/pkgs.nix; common-tailscale = import ./common/tailscale.nix; common-wifi-profiles = import ./common/wifi.nix; @@ -194,5 +187,24 @@ ]; } ); + + overlays = { + rofi-bluetooth = import ./overlays/rofi-bluetooth.nix; + tablet = import ./overlays/tablet.nix; + default = import ./overlays/default.nix {inherit self;}; + }; + + packages = forAllLinuxSystems ({pkgs}: rec { + default = clean-install; + + adjustor = pkgs.callPackage ./pkgs/adjustor.nix {}; + + clean-install = pkgs.writeShellApplication { + name = "clean-install"; + text = ./flake/clean-install.sh; + }; + + hhd-ui = pkgs.callPackage ./pkgs/hhd-ui.nix {}; + }); }; } diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index fcc3374b..ae2cd70c 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -14,7 +14,6 @@ self.nixosModules.common-locale self.nixosModules.common-mauville-share self.nixosModules.common-nix - self.nixosModules.common-overlays self.nixosModules.common-pkgs self.nixosModules.common-wifi-profiles self.nixosModules.hw-framework-13-intel-11th diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 19e16256..2e68e4e9 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -16,7 +16,6 @@ self.nixosModules.common-locale self.nixosModules.common-mauville-share self.nixosModules.common-nix - self.nixosModules.common-overlays self.nixosModules.common-pkgs self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index 5413205e..0b6197f7 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -18,7 +18,6 @@ in { self.nixosModules.common-base self.nixosModules.common-locale self.nixosModules.common-nix - self.nixosModules.common-overlays self.nixosModules.common-pkgs self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles diff --git a/hosts/pacifidlog/default.nix b/hosts/pacifidlog/default.nix index 26c57069..421f5e09 100644 --- a/hosts/pacifidlog/default.nix +++ b/hosts/pacifidlog/default.nix @@ -5,10 +5,7 @@ lib, self, ... -}: let - adjustor = pkgs.callPackage ./../../pkgs/adjustor.nix {}; - hhd-ui = pkgs.callPackage ./../../pkgs/hhd-ui.nix {}; -in { +}: { imports = [ ./home.nix ./secrets.nix @@ -21,7 +18,6 @@ in { self.nixosModules.common-locale self.nixosModules.common-mauville-share self.nixosModules.common-nix - self.nixosModules.common-overlays self.nixosModules.common-pkgs self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles @@ -47,10 +43,10 @@ in { }; environment = { - systemPackages = [ + systemPackages = with pkgs; [ + heroic hhd-ui - pkgs.heroic - pkgs.lutris + lutris ]; variables.GDK_SCALE = "2"; @@ -68,13 +64,9 @@ in { steam = { enable = true; - - environment = { - STEAM_GAMESCOPE_COLOR_MANAGED = "0"; - }; - autoStart = true; desktopSession = "hyprland"; + environment.STEAM_GAMESCOPE_COLOR_MANAGED = "0"; user = "aly"; }; @@ -82,44 +74,21 @@ in { }; networking.hostName = "pacifidlog"; - - nixpkgs.overlays = [ - (final: prev: { - brave = prev.brave.override {commandLineArgs = "--gtk-version=4 --enable-wayland-ime";}; - - obsidian = prev.obsidian.overrideAttrs (old: { - installPhase = - builtins.replaceStrings ["--ozone-platform=wayland"] - ["--ozone-platform=wayland --enable-wayland-ime"] - old.installPhase; - }); - - vscodium = prev.vscodium.override {commandLineArgs = "--enable-wayland-ime";}; - - webcord = prev.webcord.overrideAttrs (old: { - installPhase = - builtins.replaceStrings ["--ozone-platform-hint=auto"] - ["--ozone-platform-hint=auto --enable-wayland-ime"] - old.installPhase; - }); - }) - ]; - + nixpkgs.overlays = [self.overlays.tablet]; programs.steam.platformOptimizations.enable = true; services = { handheld-daemon = { enable = true; - user = "aly"; package = with pkgs; handheld-daemon.overrideAttrs (oldAttrs: { propagatedBuildInputs = oldAttrs.propagatedBuildInputs - ++ [ - adjustor - ]; + ++ [pkgs.adjustor]; }); + + user = "aly"; }; pipewire.lowLatency = { @@ -130,7 +99,7 @@ in { }; system.stateVersion = "24.11"; - systemd.services.handheld-daemon.path = [hhd-ui pkgs.lsof]; + systemd.services.handheld-daemon.path = with pkgs; [hhd-ui lsof]; zramSwap.memoryPercent = 100; ar = { diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index 2a55cad2..aea2fe95 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -15,7 +15,6 @@ self.nixosModules.common-locale self.nixosModules.common-mauville-share self.nixosModules.common-nix - self.nixosModules.common-overlays self.nixosModules.common-pkgs self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles diff --git a/hosts/slateport/default.nix b/hosts/slateport/default.nix index 7117f4a0..5a2ec990 100644 --- a/hosts/slateport/default.nix +++ b/hosts/slateport/default.nix @@ -13,7 +13,6 @@ self.nixosModules.common-locale self.nixosModules.common-mauville-share self.nixosModules.common-nix - self.nixosModules.common-overlays self.nixosModules.common-pkgs self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 00000000..fefb8d79 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,5 @@ +# Default overlay. +{self}: final: prev: { + adjustor = self.packages.${prev.system}.adjustor; + hhd-ui = self.packages.${prev.system}.hhd-ui; +} diff --git a/overlays/rofi-bluetooth.nix b/overlays/rofi-bluetooth.nix new file mode 100644 index 00000000..7274d344 --- /dev/null +++ b/overlays/rofi-bluetooth.nix @@ -0,0 +1,15 @@ +# My personal fork of rofi-bluetooth. +final: prev: { + rofi-bluetooth = + prev.rofi-bluetooth.overrideAttrs + (old: { + version = "unstable-2024-07-25"; + + src = prev.fetchFromGitHub { + owner = "alyraffauf"; + repo = old.pname; + rev = "50252e4a9aebe4899a6ef2f7bc11d91b7e4aa8ae"; + sha256 = "sha256-o0Sr3/888L/2KzZZP/EcXx+8ZUzdHB/I/VIeVuJvJks="; + }; + }); +} diff --git a/overlays/tablet.nix b/overlays/tablet.nix new file mode 100644 index 00000000..45c00fb7 --- /dev/null +++ b/overlays/tablet.nix @@ -0,0 +1,20 @@ +# Text input fixes for electron apps. +final: prev: { + brave = prev.brave.override {commandLineArgs = "--gtk-version=4 --enable-wayland-ime";}; + + obsidian = prev.obsidian.overrideAttrs (old: { + installPhase = + builtins.replaceStrings ["--ozone-platform=wayland"] + ["--ozone-platform=wayland --enable-wayland-ime"] + old.installPhase; + }); + + vscodium = prev.vscodium.override {commandLineArgs = "--enable-wayland-ime";}; + + webcord = prev.webcord.overrideAttrs (old: { + installPhase = + builtins.replaceStrings ["--ozone-platform-hint=auto"] + ["--ozone-platform-hint=auto --enable-wayland-ime"] + old.installPhase; + }); +} diff --git a/pkgs/adjustor.nix b/pkgs/adjustor.nix index a31b3f98..4bd27593 100644 --- a/pkgs/adjustor.nix +++ b/pkgs/adjustor.nix @@ -9,28 +9,28 @@ python3.pkgs.buildPythonApplication rec { pyproject = true; src = fetchFromGitHub { + hash = "sha256-9ONWKI68Llh36giIS6nVKNrZYmNAGMfwW2vgPMFuwXM="; owner = "hhd-dev"; repo = "adjustor"; rev = "v${version}"; - hash = "sha256-9ONWKI68Llh36giIS6nVKNrZYmNAGMfwW2vgPMFuwXM="; }; propagatedBuildInputs = with python3.pkgs; [ - setuptools - rich - pyroute2 + dbus-python fuse pygobject3 - dbus-python + pyroute2 + rich + setuptools ]; # This package doesn't have upstream tests. doCheck = false; meta = with lib; { + description = "TDP control of AMD Handhelds with handheld-daemon."; homepage = "https://github.com/hhd-dev/adjustor/"; - description = "Allows for TDP control of AMD Handhelds under handheld-daemon support"; - platforms = platforms.linux; license = licenses.mit; + platforms = platforms.linux; }; } diff --git a/pkgs/hhd-ui.nix b/pkgs/hhd-ui.nix index aabb0a93..4c943d40 100644 --- a/pkgs/hhd-ui.nix +++ b/pkgs/hhd-ui.nix @@ -6,16 +6,17 @@ appimageTools.wrapType2 rec { pname = "hhd-ui"; version = "3.2.2"; + src = fetchurl { - url = "https://github.com/hhd-dev/hhd-ui/releases/download/v${version}/${pname}.AppImage"; hash = "sha256-AFFQBhvWUimNW+LZvIf7bTyOX5GEc60kFSUwpsKqG5A="; + url = "https://github.com/hhd-dev/hhd-ui/releases/download/v${version}/${pname}.AppImage"; }; meta = with lib; { + description = "Graphical user interface for Handheld Daemon settings from Steam Big Picture Mode, the Desktop, and the Web."; homepage = "https://github.com/hhd-dev/hhd-ui/"; - description = "A UI app that can manage Handheld Daemon settings from Steam, the Desktop, and the Web."; - platforms = platforms.linux; license = licenses.mit; mainProgram = "hhd-ui"; + platforms = platforms.linux; }; }