mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-12-22 09:49:49 +01:00
Nix: Some corrections for overlays (#75)
* flake: use legacyPackages for formatter * nix: separate xdph and share-picker overlays * flake: make systems overrideable * flake: inherit packages from overlaid nixpkgs
This commit is contained in:
parent
42747d267a
commit
9257b0c9b9
3 changed files with 60 additions and 26 deletions
18
flake.lock
18
flake.lock
|
@ -39,7 +39,23 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"hyprland-protocols": "hyprland-protocols",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
40
flake.nix
40
flake.nix
|
@ -4,6 +4,9 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# <https://github.com/nix-systems/nix-systems>
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
|
||||
hyprland-protocols = {
|
||||
url = "github:hyprwm/hyprland-protocols";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -13,41 +16,28 @@
|
|||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
systems,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (nixpkgs) lib;
|
||||
genSystems = lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
pkgsFor = genSystems (system:
|
||||
eachSystem = lib.genAttrs (import systems);
|
||||
pkgsFor = eachSystem (system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
localSystem = system;
|
||||
overlays = [
|
||||
self.overlays.default
|
||||
inputs.hyprland-protocols.overlays.default
|
||||
self.overlays.xdg-desktop-portal-hyprland
|
||||
self.overlays.hyprland-share-picker
|
||||
];
|
||||
});
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
in {
|
||||
overlays.default = final: prev: {
|
||||
xdg-desktop-portal-hyprland = final.callPackage ./nix/default.nix {
|
||||
inherit (final) hyprland-protocols hyprland-share-picker;
|
||||
inherit version;
|
||||
};
|
||||
overlays = import ./nix/overlays.nix {inherit self inputs lib;};
|
||||
|
||||
hyprland-share-picker = final.libsForQt5.callPackage ./nix/hyprland-share-picker.nix {inherit version;};
|
||||
};
|
||||
packages = eachSystem (system: {
|
||||
inherit (pkgsFor.${system}) xdg-desktop-portal-hyprland hyprland-share-picker;
|
||||
default = self.packages.${system}.xdg-desktop-portal-hyprland;
|
||||
});
|
||||
|
||||
packages = genSystems (system:
|
||||
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
|
||||
// {default = self.packages.${system}.xdg-desktop-portal-hyprland;});
|
||||
|
||||
formatter = genSystems (system: pkgsFor.${system}.alejandra);
|
||||
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||
};
|
||||
}
|
||||
|
|
28
nix/overlays.nix
Normal file
28
nix/overlays.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
self,
|
||||
inputs,
|
||||
lib,
|
||||
}: let
|
||||
mkJoinedOverlays = overlays: final: prev:
|
||||
lib.foldl' (attrs: overlay: attrs // (overlay final prev)) {} overlays;
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
in {
|
||||
default = mkJoinedOverlays (with self.overlays; [
|
||||
xdg-desktop-portal-hyprland
|
||||
hyprland-share-picker
|
||||
]);
|
||||
xdg-desktop-portal-hyprland = final: prev: {
|
||||
xdg-desktop-portal-hyprland = final.callPackage ./default.nix {
|
||||
inherit (final) hyprland-protocols hyprland-share-picker;
|
||||
inherit version;
|
||||
};
|
||||
};
|
||||
hyprland-share-picker = final: prev: {
|
||||
hyprland-share-picker = final.libsForQt5.callPackage ./hyprland-share-picker.nix {inherit version;};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue