diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..35817e7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + inputs.hyprland.url = "github:hyprwm/Hyprland"; + + outputs = { + self, + hyprland, + }: let + inherit (hyprland.inputs) nixpkgs; + genPerSystem = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system}); + in { + packages = genPerSystem (system: pkgs: { + default = pkgs.callPackage ./plugin.nix { + inherit (hyprland.packages.${system}) hyprland; + }; + }); + + devShells = genPerSystem (system: pkgs: { + default = pkgs.mkShell { + name = "hyprland-plugin-shell"; + shellHook = '' + meson setup build --reconfigure + # clangd has different flags than gcc because... why not? + sed -e 's/c++23/c++2b/g' ./build/compile_commands.json > ./compile_commands.json + ''; + + # Note: gcc needs to be specified or else an older version might be used + # TODO: maybe using gcc13Stdenv.mkShell would fix this? + nativeBuildInputs = with pkgs; [gcc13 meson pkg-config ninja]; + buildInputs = [hyprland.packages.${system}.hyprland]; + inputsFrom = [ + hyprland.packages.${system}.hyprland + self.packages.${system}.default + ]; + }; + }); + }; +} diff --git a/plugin.nix b/plugin.nix new file mode 100644 index 0000000..6285b4c --- /dev/null +++ b/plugin.nix @@ -0,0 +1,28 @@ +{ + lib, + gcc13Stdenv, + meson, + ninja, + pkg-config, + hyprland, +}: let + version = builtins.readFile ./VERSION; +in + gcc13Stdenv.mkDerivation { + pname = "example"; + inherit version; + src = ./.; + + nativeBuildInputs = + hyprland.nativeBuildInputs + ++ [ninja meson pkg-config]; + + buildInputs = [hyprland] ++ hyprland.buildInputs; + + meta = with lib; { + homepage = "https://example.com"; + description = "Example hyprland plugin"; + license = licenses.bsd3; + platforms = platforms.linux; + }; + }