Nix: init

This commit is contained in:
Mihai Fufezan 2024-10-27 17:01:02 +02:00
parent aee8461992
commit 30c855393f
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
4 changed files with 182 additions and 0 deletions

67
flake.lock Normal file
View file

@ -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
}

38
flake.nix Normal file
View file

@ -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;
});
};
}

52
nix/default.nix Normal file
View file

@ -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;
};
}

25
nix/overlays.nix Normal file
View file

@ -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"}";
};
})
];
}