mirror of
https://github.com/hyprwm/hyprlang.git
synced 2024-11-16 18:25:57 +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": {
|
"root": {
|
||||||
"inputs": {
|
"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";
|
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 = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
...
|
systems,
|
||||||
}: let
|
}: let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
genSystems = lib.genAttrs [
|
eachSystem = lib.genAttrs (import systems);
|
||||||
# Add more systems if they are supported
|
pkgsFor = eachSystem (system:
|
||||||
"x86_64-linux"
|
import nixpkgs {
|
||||||
"aarch64-linux"
|
localSystem.system = system;
|
||||||
];
|
overlays = with self.overlays; [hyprlang];
|
||||||
pkgsFor = nixpkgs.legacyPackages;
|
});
|
||||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||||
(builtins.substring 0 4 longDate)
|
(builtins.substring 0 4 longDate)
|
||||||
(builtins.substring 4 2 longDate)
|
(builtins.substring 4 2 longDate)
|
||||||
(builtins.substring 6 2 longDate)
|
(builtins.substring 6 2 longDate)
|
||||||
]);
|
]);
|
||||||
in {
|
in {
|
||||||
overlays.default = _: prev: rec {
|
overlays = {
|
||||||
hyprlang = prev.callPackage ./nix/default.nix {
|
default = self.overlays.hyprlang;
|
||||||
stdenv = prev.gcc13Stdenv;
|
hyprlang = final: prev: {
|
||||||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
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:
|
packages = eachSystem (system: {
|
||||||
(self.overlays.default null pkgsFor.${system})
|
default = self.packages.${system}.hyprlang;
|
||||||
// {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