Skip to content

Commit

Permalink
Nix: use mkHyprlandPlugin from nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Mar 7, 2024
1 parent 8d3a070 commit 93c9328
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 70 deletions.
8 changes: 3 additions & 5 deletions borders-plus-plus/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
lib,
stdenv,
hyprland,
hyprlandPlugins,
}:
stdenv.mkDerivation {
pname = "borders-plus-plus";
hyprlandPlugins.mkHyprlandPlugin {
pluginName = "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";
Expand Down
8 changes: 3 additions & 5 deletions csgo-vulkan-fix/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
lib,
stdenv,
hyprland,
hyprlandPlugins,
}:
stdenv.mkDerivation {
pname = "csgo-vulkan-fix";
hyprlandPlugins.mkHyprlandPlugin {
pluginName = "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";
Expand Down
49 changes: 30 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 56 additions & 26 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,66 @@
{
description = "Hyprland Plugins";

inputs.hyprland.url = "github:hyprwm/Hyprland";
inputs = {
hyprland.url = "github:hyprwm/Hyprland";
systems.follows = "hyprland/systems";
};

outputs = {
self,
hyprland,
systems,
...
}: let
inherit (hyprland.inputs) nixpkgs;
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);

outputs = inputs: let
inherit (inputs.hyprland.inputs) nixpkgs;
withPkgsFor = fn: nixpkgs.lib.genAttrs (builtins.attrNames inputs.hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [hyprland-plugins];
});
in {
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 {};
packages = eachSystem (system: {
inherit (pkgsFor.${system}) borders-plus-plus csgo-vulkan-fix hyprbars hyprtrails hyprwinwrap;
});

checks = withPkgsFor (system: pkgs: inputs.self.packages.${system});
overlays = {
default = self.overlays.hyprland-plugins;
mkHyprlandPlugin = lib.composeManyExtensions [
hyprland.overlays.default
(final: prev: {
hyprlandPlugins =
prev.hyprlandPlugins
// {
mkHyprlandPlugin = prev.hyprlandPlugins.mkHyprlandPlugin final.hyprland;
};
})
];
hyprland-plugins = lib.composeManyExtensions [
self.overlays.mkHyprlandPlugin
(final: prev: let
inherit (final) callPackage;
in {
borders-plus-plus = callPackage ./borders-plus-plus {};
csgo-vulkan-fix = callPackage ./csgo-vulkan-fix {};
hyprbars = callPackage ./hyprbars {};
hyprtrails = callPackage ./hyprtrails {};
hyprwinwrap = callPackage ./hyprwinwrap {};
})
];
};

devShells = withPkgsFor (system: pkgs: {
default = pkgs.mkShell.override {stdenv = pkgs.gcc13Stdenv;} {
name = "hyprland-plugins";
buildInputs = [inputs.hyprland.packages.${system}.hyprland];
inputsFrom = [inputs.hyprland.packages.${system}.hyprland];
};
});
checks = eachSystem (system: self.packages.${system});

devShells = eachSystem (system:
with pkgsFor.${system}; {
default = mkShell.override {stdenv = gcc13Stdenv;} {
name = "hyprland-plugins";
buildInputs = [hyprland.packages.${system}.hyprland];
inputsFrom = [hyprland.packages.${system}.hyprland];
};
});
};
}
8 changes: 3 additions & 5 deletions hyprbars/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
lib,
stdenv,
hyprland,
hyprlandPlugins,
}:
stdenv.mkDerivation {
pname = "hyprbars";
hyprlandPlugins.mkHyprlandPlugin {
pluginName = "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";
Expand Down
8 changes: 3 additions & 5 deletions hyprtrails/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
lib,
stdenv,
hyprland,
hyprlandPlugins,
}:
stdenv.mkDerivation {
pname = "hyprtrails";
hyprlandPlugins.mkHyprlandPlugin {
pluginName = "hyprtrails";
version = "0.1";
src = ./.;

inherit (hyprland) nativeBuildInputs;

buildInputs = [hyprland] ++ hyprland.buildInputs;

meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Smooth trails behind moving windows for Hyprland";
Expand Down
8 changes: 3 additions & 5 deletions hyprwinwrap/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
lib,
stdenv,
hyprland,
hyprlandPlugins,
}:
stdenv.mkDerivation {
pname = "hyprwinwrap";
hyprlandPlugins.mkHyprlandPlugin {
pluginName = "hyprwinwrap";
version = "0.1";
src = ./.;

inherit (hyprland) nativeBuildInputs;

buildInputs = [hyprland] ++ hyprland.buildInputs;

meta = with lib; {
homepage = "https://github.com/hyprwm/hyprland-plugins";
description = "Hyprland version of xwinwrap";
Expand Down

0 comments on commit 93c9328

Please sign in to comment.