mirror of
https://github.com/hyprwm/hyprlang.git
synced 2024-12-22 01:49:49 +01:00
Nix: fix the overlay and re-export properly (#26)
* flake: made systems overrideable * flake: do not use legacyPackages * flake: add overlay named hyprlang * flake: overlays: do not recurse with rec * flake: overlays: only use drvs from final fixpoint * flake: packages: correctly eval own overlay
This commit is contained in:
parent
bbf5c30b0c
commit
f4466367ef
2 changed files with 41 additions and 18 deletions
18
flake.lock
18
flake.lock
|
@ -18,7 +18,23 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
41
flake.nix
41
flake.nix
|
@ -1,38 +1,45 @@
|
|||
{
|
||||
description = "The official implementation library for the hypr config language";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
systems,
|
||||
}: let
|
||||
inherit (nixpkgs) lib;
|
||||
genSystems = lib.genAttrs [
|
||||
# Add more systems if they are supported
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
pkgsFor = nixpkgs.legacyPackages;
|
||||
eachSystem = lib.genAttrs (import systems);
|
||||
pkgsFor = eachSystem (system:
|
||||
import nixpkgs {
|
||||
localSystem.system = system;
|
||||
overlays = with self.overlays; [hyprlang];
|
||||
});
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
in {
|
||||
overlays.default = _: prev: rec {
|
||||
hyprlang = prev.callPackage ./nix/default.nix {
|
||||
stdenv = prev.gcc13Stdenv;
|
||||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
overlays = {
|
||||
default = self.overlays.hyprlang;
|
||||
hyprlang = final: prev: {
|
||||
hyprlang = final.callPackage ./nix/default.nix {
|
||||
stdenv = final.gcc13Stdenv;
|
||||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
};
|
||||
hyprlang-with-tests = final.hyprlang.override {doCheck = true;};
|
||||
};
|
||||
hyprlang-with-tests = hyprlang.override {doCheck = true;};
|
||||
};
|
||||
|
||||
packages = genSystems (system:
|
||||
(self.overlays.default null pkgsFor.${system})
|
||||
// {default = self.packages.${system}.hyprlang;});
|
||||
packages = eachSystem (system: {
|
||||
default = self.packages.${system}.hyprlang;
|
||||
inherit (pkgsFor.${system}) hyprlang hyprlang-with-tests;
|
||||
});
|
||||
|
||||
formatter = genSystems (system: pkgsFor.${system}.alejandra);
|
||||
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue