Nix: simplify building, add checks

This commit is contained in:
Mihai Fufezan 2024-01-28 23:51:54 +02:00
parent 597e29a501
commit 7b5b82f666
No known key found for this signature in database

View file

@ -3,41 +3,33 @@
inputs.hyprland.url = "github:hyprwm/Hyprland";
outputs = {
self,
hyprland,
}: let
inherit (hyprland.inputs) nixpkgs;
withPkgsFor = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
outputs = inputs: let
inherit (inputs.hyprland.inputs) nixpkgs;
withPkgsFor = fn: nixpkgs.lib.genAttrs (builtins.attrNames inputs.hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
in {
packages = withPkgsFor (system: pkgs: {
borders-plus-plus = pkgs.callPackage ./borders-plus-plus {
inherit (hyprland.packages.${system}) hyprland;
stdenv = pkgs.gcc13Stdenv;
};
csgo-vulkan-fix = pkgs.callPackage ./csgo-vulkan-fix {
inherit (hyprland.packages.${system}) hyprland;
stdenv = pkgs.gcc13Stdenv;
};
hyprbars = pkgs.callPackage ./hyprbars {
inherit (hyprland.packages.${system}) hyprland;
stdenv = pkgs.gcc13Stdenv;
};
hyprtrails = pkgs.callPackage ./hyprtrails {
inherit (hyprland.packages.${system}) hyprland;
stdenv = pkgs.gcc13Stdenv;
};
hyprwinwrap = pkgs.callPackage ./hyprwinwrap {
inherit (hyprland.packages.${system}) hyprland;
stdenv = pkgs.gcc13Stdenv;
};
packages = withPkgsFor (system: pkgs: let
hyprland = inputs.hyprland.packages.${system}.hyprland;
buildPlugin = path: extraArgs:
pkgs.callPackage path {
inherit hyprland;
inherit (hyprland) stdenv;
}
// extraArgs;
in {
borders-plus-plus = buildPlugin ./borders-plus-plus {};
csgo-vulkan-fix = buildPlugin ./csgo-vulkan-fix {};
hyprbars = buildPlugin ./hyprbars {};
hyprtrails = buildPlugin ./hyprtrails {};
hyprwinwrap = buildPlugin ./hyprwinwrap {};
});
checks = withPkgsFor (system: pkgs: inputs.self.packages.${system});
devShells = withPkgsFor (system: pkgs: {
default = pkgs.mkShell.override {stdenv = pkgs.gcc13Stdenv;} {
name = "hyprland-plugins";
buildInputs = [hyprland.packages.${system}.hyprland];
inputsFrom = [hyprland.packages.${system}.hyprland];
buildInputs = [inputs.hyprland.packages.${system}.hyprland];
inputsFrom = [inputs.hyprland.packages.${system}.hyprland];
};
});
};