Nix: init

This commit is contained in:
Mihai Fufezan 2023-12-28 23:11:34 +02:00
parent 57fdf6038e
commit ff594625a1
No known key found for this signature in database
3 changed files with 86 additions and 0 deletions

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1702645756,
"narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View File

@ -0,0 +1,37 @@
{
description = "The official implementation library for the hypr config language";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = {
self,
nixpkgs,
...
}: let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
# Add more systems if they are supported
"x86_64-linux"
"aarch64-linux"
];
pkgsFor = nixpkgs.legacyPackages;
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
overlays.default = _: prev: {
hyprlang = prev.callPackage ./nix/default.nix {
stdenv = prev.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
packages = genSystems (system:
(self.overlays.default null pkgsFor.${system})
// {default = self.packages.${system}.hyprlang;});
formatter = genSystems (system: pkgsFor.${system}.alejandra);
};
}

22
nix/default.nix Normal file
View File

@ -0,0 +1,22 @@
{
lib,
stdenv,
cmake,
version ? "git",
}:
stdenv.mkDerivation {
pname = "hyprlang";
inherit version;
src = ../.;
nativeBuildInputs = [cmake];
doCheck = true;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprlang";
description = "The official implementation library for the hypr config language";
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
}