Nix: init

This commit is contained in:
Mihai Fufezan 2024-10-13 20:00:20 +03:00
parent 1ba083c4db
commit bbaf81f347
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
4 changed files with 177 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 = "A tiny qt6/qml application to display information about the running system";
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}.hyprsysteminfo;
inherit (pkgsFor.${system}) hyprsysteminfo;
});
};
}

48
nix/default.nix Normal file
View file

@ -0,0 +1,48 @@
{
lib,
stdenv,
cmake,
pkg-config,
hyprutils,
kdePackages,
qt6,
version ? "0",
}: let
inherit (lib.sources) cleanSource cleanSourceWith;
inherit (lib.strings) hasSuffix;
in
stdenv.mkDerivation {
pname = "hyprsysteminfo";
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
];
meta = {
description = "A tiny qt6/qml application to display information about the running system";
homepage = "https://github.com/hyprwm/hyprsysteminfo";
license = lib.licenses.bsd3;
maintainers = [lib.maintainers.fufexan];
mainProgram = "hyprsysteminfo";
platforms = lib.platforms.linux;
};
}

24
nix/overlays.nix Normal file
View file

@ -0,0 +1,24 @@
{
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.hyprsysteminfo;
hyprsysteminfo = lib.composeManyExtensions [
inputs.hyprutils.overlays.default
(final: prev: {
hyprsysteminfo = final.callPackage ./. {
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
};
})
];
}