diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c7f1642 --- /dev/null +++ b/flake.lock @@ -0,0 +1,67 @@ +{ + "nodes": { + "hyprutils": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1727300645, + "narHash": "sha256-OvAtVLaSRPnbXzOwlR1fVqCXR7i+ICRX3aPMCdIiv+c=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "3f5293432b6dc6a99f26aca2eba3876d2660665c", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "hyprutils": "hyprutils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..13e6d17 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Hyprland QT/qml utility apps"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; + + hyprutils = { + url = "github:hyprwm/hyprutils"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.systems.follows = "systems"; + }; + }; + + outputs = { + self, + nixpkgs, + systems, + ... + } @ inputs: let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import systems); + pkgsFor = eachSystem ( + system: + import nixpkgs { + localSystem = system; + overlays = [self.overlays.default]; + } + ); + in { + overlays = import ./nix/overlays.nix {inherit inputs self lib;}; + + packages = eachSystem (system: { + default = self.packages.${system}.hyprland-qtutils; + inherit (pkgsFor.${system}) hyprland-qtutils; + }); + }; +} diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..8cffe9f --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,52 @@ +{ + lib, + stdenv, + cmake, + pkg-config, + hyprutils, + kdePackages, + pciutils, + qt6, + version ? "0", +}: let + inherit (lib.sources) cleanSource cleanSourceWith; + inherit (lib.strings) hasSuffix makeBinPath; +in + stdenv.mkDerivation { + pname = "hyprland-qtutils"; + inherit version; + + src = cleanSourceWith { + filter = name: _type: let + baseName = baseNameOf (toString name); + in + ! (hasSuffix ".nix" baseName); + src = cleanSource ../.; + }; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + hyprutils + kdePackages.kirigami-addons + qt6.qtbase + qt6.qtsvg + qt6.qtwayland + ]; + + preFixup = '' + qtWrapperArgs+=(--prefix PATH : "${makeBinPath [pciutils]}") + ''; + + meta = { + description = "Hyprland QT/qml utility apps"; + homepage = "https://github.com/hyprwm/hyprland-qtlibs"; + license = lib.licenses.bsd3; + maintainers = [lib.maintainers.fufexan]; + platforms = lib.platforms.linux; + }; + } diff --git a/nix/overlays.nix b/nix/overlays.nix new file mode 100644 index 0000000..cff7bd9 --- /dev/null +++ b/nix/overlays.nix @@ -0,0 +1,25 @@ +{ + inputs, + self, + lib, +}: let + mkDate = longDate: (lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]); + date = mkDate (self.lastModifiedDate or "19700101"); + version = lib.removeSuffix "\n" (builtins.readFile ../VERSION); +in { + default = self.overlays.hyprland-qtutils; + + hyprland-qtutils = lib.composeManyExtensions [ + inputs.hyprutils.overlays.default + (final: prev: { + hyprland-qtutils = final.callPackage ./. { + stdenv = final.gcc14Stdenv; + version = "${version}+date=${date}_${self.shortRev or "dirty"}"; + }; + }) + ]; +}