hyprlang/flake.nix

58 lines
1.6 KiB
Nix
Raw Normal View History

2023-12-28 22:11:34 +01:00
{
description = "The official implementation library for the hypr config language";
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";
};
};
2023-12-28 22:11:34 +01:00
outputs = {
self,
nixpkgs,
systems,
...
} @ inputs: let
2023-12-28 22:11:34 +01:00
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [hyprlang];
});
2023-12-28 22:11:34 +01:00
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
2024-07-18 19:37:19 +02:00
version = lib.removeSuffix "\n" (builtins.readFile ./VERSION);
2023-12-28 22:11:34 +01:00
in {
overlays = {
default = self.overlays.hyprlang;
hyprlang = lib.composeManyExtensions [
inputs.hyprutils.overlays.default
(final: prev: {
hyprlang = final.callPackage ./nix/default.nix {
2024-12-14 12:01:16 +01:00
stdenv = final.gcc14Stdenv;
2024-07-18 19:37:19 +02:00
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
hyprlang-with-tests = final.hyprlang.override {doCheck = true;};
})
];
2023-12-28 22:11:34 +01:00
};
packages = eachSystem (system: {
default = self.packages.${system}.hyprlang;
inherit (pkgsFor.${system}) hyprlang hyprlang-with-tests;
});
2023-12-28 22:11:34 +01:00
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
2023-12-28 22:11:34 +01:00
};
}