Nix: init

This commit is contained in:
Mihai Fufezan 2024-04-20 13:40:18 +03:00
parent 80c764615c
commit 516cf4ef20
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
3 changed files with 114 additions and 0 deletions

43
flake.lock Normal file
View file

@ -0,0 +1,43 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1713537308,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"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
}

44
flake.nix Normal file
View file

@ -0,0 +1,44 @@
{
description = "A Hyprland version of wayland-scanner in and for C++";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
};
outputs = {
self,
nixpkgs,
systems,
}: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [hyprwayland-scanner];
});
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
overlays = {
default = self.overlays.hpyrwayland-scanner;
hyprwayland-scanner = final: prev: {
hyprwayland-scanner = final.callPackage ./nix/default.nix {
stdenv = final.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
};
packages = eachSystem (system: {
default = self.packages.${system}.hyprwayland-scanner;
inherit (pkgsFor.${system}) hyprwayland-scanner;
});
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
};
}

27
nix/default.nix Normal file
View file

@ -0,0 +1,27 @@
{
lib,
stdenv,
cmake,
pkg-config,
pugixml,
version ? "git",
doCheck ? false,
}:
stdenv.mkDerivation {
pname = "hyprwayland-scanner";
inherit version doCheck;
src = ../.;
nativeBuildInputs = [
cmake
pkg-config
pugixml
];
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprwayland-scanner";
description = "A Hyprland version of wayland-scanner in and for C++";
license = licenses.bsd3;
platforms = platforms.linux;
};
}