add initial pluginBuilder

This commit is contained in:
Mihai Fufezan 2023-08-16 22:28:45 +03:00
parent efd7a19069
commit 205ef4d7f8
No known key found for this signature in database
7 changed files with 83 additions and 45 deletions

44
all.nix Normal file
View File

@ -0,0 +1,44 @@
{
builder,
lib,
}:
lib.mapAttrs (n: v: builder v) {
borders-plus-plus = {
pname = "borders-plus-plus";
version = "0.1";
src = ./.;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland borders-plus-plus plugin";
license = licenses.bsd3;
platforms = platforms.linux;
};
};
csgo-vulkan-fix = {
pname = "csgo-vulkan-fix";
version = "0.1";
src = ./.;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland CS:GO Vulkan fix";
license = licenses.bsd3;
platforms = platforms.linux;
};
};
hyprbars = {
pname = "hyprbars";
version = "0.1";
src = ./.;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland window title plugin";
license = licenses.bsd3;
platforms = platforms.linux;
};
};
}

View File

@ -1,17 +1,8 @@
{
lib,
stdenv,
hyprland,
}:
stdenv.mkDerivation {
lib: {
pname = "borders-plus-plus";
version = "0.1";
src = ./.;
inherit (hyprland) nativeBuildInputs;
buildInputs = [hyprland] ++ hyprland.buildInputs;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland borders-plus-plus plugin";

View File

@ -1,17 +1,8 @@
{
lib,
stdenv,
hyprland,
}:
stdenv.mkDerivation {
lib: {
pname = "csgo-vulkan-fix";
version = "0.1";
src = ./.;
inherit (hyprland) nativeBuildInputs;
buildInputs = [hyprland] ++ hyprland.buildInputs;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland CS:GO Vulkan fix";

View File

@ -7,22 +7,23 @@
self,
hyprland,
}: let
inherit (hyprland.inputs) nixpkgs;
withPkgsFor = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
inherit (hyprland.inputs) nixpkgs systems;
inherit (nixpkgs) lib;
inherit (import ./lib) pluginBuilder;
withPkgsFor = fn: lib.genAttrs (import systems) (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;
};
packages = withPkgsFor (system: pkgs: let
builder = pluginBuilder hyprland pkgs.gcc13Stdenv;
in {
borders-plus-plus = builder (import ./borders-plus-plus lib);
csgo-vulkan-fix = builder (import ./csgo-vulkan-fix lib);
hyprbars = builder (import ./hyprbars lib);
});
legacyPackages = withPkgsFor (system: pkgs: let
builder = pluginBuilder hyprland pkgs.stdenv;
in {
all = import ./all.nix {inherit builder lib;};
});
devShells = withPkgsFor (system: pkgs: {

View File

@ -1,17 +1,8 @@
{
lib,
stdenv,
hyprland,
}:
stdenv.mkDerivation {
lib: {
pname = "hyprbars";
version = "0.1";
src = ./.;
inherit (hyprland) nativeBuildInputs;
buildInputs = [hyprland] ++ hyprland.buildInputs;
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland window title plugin";

17
lib/builder.nix Normal file
View File

@ -0,0 +1,17 @@
hyprland: stdenv: {
pname,
version ? "dirty",
src,
buildInputs ? [],
meta ? {},
}: let
hl = hyprland.packages.${stdenv.hostPlatform.system}.default;
in
stdenv.mkDerivation {
inherit pname version src;
inherit (hl) nativeBuildInputs;
buildInputs = hl.buildInputs ++ [hl.dev] ++ buildInputs;
inherit meta;
}

3
lib/default.nix Normal file
View File

@ -0,0 +1,3 @@
{
pluginBuilder = import ./builder.nix;
}