Nix: init

This commit is contained in:
Mihai Fufezan 2024-03-09 01:46:16 +02:00
parent 2bf4f66f05
commit ae1ee8ea7e
No known key found for this signature in database
4 changed files with 184 additions and 0 deletions

80
flake.lock Normal file
View File

@ -0,0 +1,80 @@
{
"nodes": {
"hyprlang": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1709914708,
"narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": "nixpkgs",
"systems": "systems_2"
}
},
"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"
}
},
"systems_2": {
"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
}

39
flake.nix Normal file
View File

@ -0,0 +1,39 @@
{
description = "The hyprland cursor format, library and utilities";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
hyprlang = {
url = "github:hyprwm/hyprlang";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
systems,
...
} @ inputs: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [default];
});
in {
overlays = import ./nix/overlays.nix {inherit inputs lib;};
packages = eachSystem (system: {
default = self.packages.${system}.hyprcursor;
inherit (pkgsFor.${system}) hyprcursor;
});
checks = eachSystem (system: self.packages.${system});
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
};
}

42
nix/default.nix Normal file
View File

@ -0,0 +1,42 @@
{
lib,
stdenv,
cmake,
pkg-config,
cairo,
hyprlang,
librsvg,
libzip,
version ? "git",
}:
stdenv.mkDerivation {
pname = "hyprcursor";
inherit version;
src = ../.;
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
cairo
hyprlang
librsvg
libzip
];
outputs = [
"bin"
"dev"
"lib"
];
meta = {
homepage = "https://github.com/hyprwm/hyprcursor";
description = "The hyprland cursor format, library and utilities";
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
mainProgram = "hyprcursor";
};
}

23
nix/overlays.nix Normal file
View File

@ -0,0 +1,23 @@
{
lib,
inputs,
}: let
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
default = inputs.self.overlays.hyprcursor;
hyprcursor = lib.composeManyExtensions [
inputs.hyprlang.overlays.default
(final: prev: {
hyprcursor = prev.callPackage ./default.nix {
stdenv = prev.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (inputs.self.lastModifiedDate or "19700101")) + "_" + (inputs.self.shortRev or "dirty");
inherit (final) hyprlang;
};
})
];
}