Diff
1diff --git a/.gitignore b/.gitignore
2index 36b6e89cd78ff11ec464460259e820d08e0befe0..58623226a300381c2e92d3a1d661098307ec4be8 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -1,4 +1,16 @@
6-build/
7-compile_commands.json
8-.vscode/
9-*.log
10+# build
11+/result
12+/build/
13+/compile_commands.json
14+
15+# clangd
16+/.cache
17+
18+# direnv
19+/.envrc
20+/.direnv/
21+
22+# vscode
23+/.vscode/
24+
25+/*.log
26diff --git a/default.nix b/default.nix
27new file mode 100644
28index 0000000000000000000000000000000000000000..1925ec5fc022af79a49a982647fe54c1691cea79
29--- /dev/null
30+++ b/default.nix
31@@ -0,0 +1,51 @@
32+{
33+ hyprland,
34+
35+ lib,
36+ nix-gitignore,
37+ keepDebugInfo,
38+ stdenv ? (keepDebugInfo hyprland.stdenv),
39+
40+ cmake,
41+ ninja,
42+ pkg-config,
43+ pango,
44+ cairo,
45+
46+ debug ? false,
47+ hlversion ? "git",
48+ versionCheck ? true,
49+}: stdenv.mkDerivation {
50+ pname = "hy3";
51+ version = "hl${hlversion}${lib.optionalString debug "-debug"}";
52+ src = nix-gitignore.gitignoreSource [] ./.;
53+
54+ nativeBuildInputs = [
55+ cmake
56+ ninja
57+ pkg-config
58+ ];
59+
60+ buildInputs = [
61+ hyprland.dev
62+ pango
63+ cairo
64+ ] ++ hyprland.buildInputs;
65+
66+ cmakeFlags = lib.optional (!versionCheck) "-DHY3_NO_VERSION_CHECK=ON";
67+
68+ cmakeBuildType = if debug
69+ then "Debug"
70+ else "RelWithDebInfo";
71+
72+ buildPhase = "ninjaBuildPhase";
73+ enableParallelBuilding = true;
74+ dontStrip = true;
75+
76+ meta = with lib; {
77+ homepage = "https://github.com/outfoxxed/hy3";
78+ description = "Hyprland plugin for an i3 like manual tiling layout";
79+ license = licenses.gpl3;
80+ platforms = platforms.linux;
81+ };
82+}
83diff --git a/flake.nix b/flake.nix
84index a250f3784f36a829764f4dfa3da2b65a02e571c3..a375308b98bc8c5caa8e69646dfbab4ef69e3f70 100644
85--- a/flake.nix
86+++ b/flake.nix
87@@ -5,51 +5,32 @@
88
89 outputs = { self, hyprland, ... }: let
90 inherit (hyprland.inputs) nixpkgs;
91- hyprlandSystems = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
92- in {
93- packages = hyprlandSystems (system: pkgs: let
94- hyprlandPackage = hyprland.packages.${system}.hyprland;
95- in rec {
96- hy3 = hyprlandPackage.stdenv.mkDerivation {
97- pname = "hy3";
98- version = "0.1";
99- src = ./.;
100-
101- nativeBuildInputs = with pkgs; [ cmake pkg-config ];
102
103- buildInputs = with pkgs; [
104- hyprlandPackage.dev
105- pango
106- cairo
107- ] ++ hyprlandPackage.buildInputs;
108+ hyprlandSystems = fn: nixpkgs.lib.genAttrs
109+ (builtins.attrNames hyprland.packages)
110+ (system: fn system nixpkgs.legacyPackages.${system});
111
112- # no noticeable impact on performance and greatly assists debugging
113- cmakeBuildType = "Debug";
114- dontStrip = true;
115-
116- meta = with pkgs.lib; {
117- homepage = "https://github.com/outfoxxed/hy3";
118- description = "Hyprland plugin for an i3 / sway like manual tiling layout";
119- license = licenses.gpl3;
120- platforms = platforms.linux;
121- };
122+ props = builtins.fromJSON (builtins.readFile "${hyprland}/props.json");
123+ in {
124+ packages = hyprlandSystems (system: pkgs: rec {
125+ hy3 = pkgs.callPackage ./default.nix {
126+ hyprland = hyprland.packages.${system}.hyprland;
127+ hlversion = props.version;
128 };
129-
130 default = hy3;
131 });
132
133 devShells = hyprlandSystems (system: pkgs: {
134- default = pkgs.mkShell.override {
135- stdenv = pkgs.gcc13Stdenv;
136- } {
137- name = "hy3";
138-
139- nativeBuildInputs = with pkgs; [
140- clang-tools_17
141- bear
142- ];
143+ default = import ./shell.nix {
144+ inherit pkgs;
145+ hlversion = props.version;
146+ hyprland = hyprland.packages.${system}.hyprland-debug;
147+ };
148
149- inputsFrom = [ self.packages.${system}.hy3 ];
150+ impure = import ./shell.nix {
151+ pkgs = import <nixpkgs> {};
152+ hlversion = props.version;
153+ hyprland = (pkgs.appendOverlays [ hyprland.overlays.hyprland-packages ]).hyprland-debug;
154 };
155 });
156 };
157diff --git a/hyprpm.toml b/hyprpm.toml
158index 012b379df6f2c7d7328bd6050acceb0c2c3e13bf..b7178b2528f581113c5a0fa8f7f803c4984ba0fa 100644
159--- a/hyprpm.toml
160+++ b/hyprpm.toml
161@@ -11,6 +11,6 @@ description = "i3 like tiling for hyprland"
162 authors = ["outfoxxed"]
163 output = "build/libhy3.so"
164 build = [
165- "cmake -DCMAKE_BUILD_TYPE=Release -B build",
166+ "cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build",
167 "cmake --build build"
168 ]
169diff --git a/shell.nix b/shell.nix
170new file mode 100644
171index 0000000000000000000000000000000000000000..1cd716ece743343db0d4369f32ac248a050ee9c6
172--- /dev/null
173+++ b/shell.nix
174@@ -0,0 +1,16 @@
175+{
176+ hyprland,
177+ pkgs,
178+ hlversion ? "git",
179+ hy3 ? pkgs.callPackage ./default.nix {
180+ inherit hyprland hlversion;
181+ versionCheck = false;
182+ },
183+}: pkgs.mkShell {
184+ inputsFrom = [ hy3 ];
185+
186+ nativeBuildInputs = with pkgs; [
187+ clang-tools_17
188+ bear
189+ ];
190+}