mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 02:33:40 +01:00
Improve build process and nix scripts
This commit is contained in:
parent
3924816ba2
commit
c880e0f009
5 changed files with 103 additions and 43 deletions
20
.gitignore
vendored
20
.gitignore
vendored
|
@ -1,4 +1,16 @@
|
|||
build/
|
||||
compile_commands.json
|
||||
.vscode/
|
||||
*.log
|
||||
# build
|
||||
/result
|
||||
/build/
|
||||
/compile_commands.json
|
||||
|
||||
# clangd
|
||||
/.cache
|
||||
|
||||
# direnv
|
||||
/.envrc
|
||||
/.direnv/
|
||||
|
||||
# vscode
|
||||
/.vscode/
|
||||
|
||||
/*.log
|
||||
|
|
51
default.nix
Normal file
51
default.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
hyprland,
|
||||
|
||||
lib,
|
||||
nix-gitignore,
|
||||
keepDebugInfo,
|
||||
stdenv ? (keepDebugInfo hyprland.stdenv),
|
||||
|
||||
cmake,
|
||||
ninja,
|
||||
pkg-config,
|
||||
pango,
|
||||
cairo,
|
||||
|
||||
debug ? false,
|
||||
hlversion ? "git",
|
||||
versionCheck ? true,
|
||||
}: stdenv.mkDerivation {
|
||||
pname = "hy3";
|
||||
version = "hl${hlversion}${lib.optionalString debug "-debug"}";
|
||||
src = nix-gitignore.gitignoreSource [] ./.;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
hyprland.dev
|
||||
pango
|
||||
cairo
|
||||
] ++ hyprland.buildInputs;
|
||||
|
||||
cmakeFlags = lib.optional (!versionCheck) "-DHY3_NO_VERSION_CHECK=ON";
|
||||
|
||||
cmakeBuildType = if debug
|
||||
then "Debug"
|
||||
else "RelWithDebInfo";
|
||||
|
||||
buildPhase = "ninjaBuildPhase";
|
||||
enableParallelBuilding = true;
|
||||
dontStrip = true;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/outfoxxed/hy3";
|
||||
description = "Hyprland plugin for an i3 like manual tiling layout";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
57
flake.nix
57
flake.nix
|
@ -5,51 +5,32 @@
|
|||
|
||||
outputs = { self, hyprland, ... }: let
|
||||
inherit (hyprland.inputs) nixpkgs;
|
||||
hyprlandSystems = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
|
||||
|
||||
hyprlandSystems = fn: nixpkgs.lib.genAttrs
|
||||
(builtins.attrNames hyprland.packages)
|
||||
(system: fn system nixpkgs.legacyPackages.${system});
|
||||
|
||||
props = builtins.fromJSON (builtins.readFile "${hyprland}/props.json");
|
||||
in {
|
||||
packages = hyprlandSystems (system: pkgs: let
|
||||
hyprlandPackage = hyprland.packages.${system}.hyprland;
|
||||
in rec {
|
||||
hy3 = hyprlandPackage.stdenv.mkDerivation {
|
||||
pname = "hy3";
|
||||
version = "0.1";
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = with pkgs; [ cmake pkg-config ];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
hyprlandPackage.dev
|
||||
pango
|
||||
cairo
|
||||
] ++ hyprlandPackage.buildInputs;
|
||||
|
||||
# no noticeable impact on performance and greatly assists debugging
|
||||
cmakeBuildType = "Debug";
|
||||
dontStrip = true;
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
homepage = "https://github.com/outfoxxed/hy3";
|
||||
description = "Hyprland plugin for an i3 / sway like manual tiling layout";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
packages = hyprlandSystems (system: pkgs: rec {
|
||||
hy3 = pkgs.callPackage ./default.nix {
|
||||
hyprland = hyprland.packages.${system}.hyprland;
|
||||
hlversion = props.version;
|
||||
};
|
||||
|
||||
default = hy3;
|
||||
});
|
||||
|
||||
devShells = hyprlandSystems (system: pkgs: {
|
||||
default = pkgs.mkShell.override {
|
||||
stdenv = pkgs.gcc13Stdenv;
|
||||
} {
|
||||
name = "hy3";
|
||||
default = import ./shell.nix {
|
||||
inherit pkgs;
|
||||
hlversion = props.version;
|
||||
hyprland = hyprland.packages.${system}.hyprland-debug;
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
clang-tools_17
|
||||
bear
|
||||
];
|
||||
|
||||
inputsFrom = [ self.packages.${system}.hy3 ];
|
||||
impure = import ./shell.nix {
|
||||
pkgs = import <nixpkgs> {};
|
||||
hlversion = props.version;
|
||||
hyprland = (pkgs.appendOverlays [ hyprland.overlays.hyprland-packages ]).hyprland-debug;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
@ -11,6 +11,6 @@ description = "i3 like tiling for hyprland"
|
|||
authors = ["outfoxxed"]
|
||||
output = "build/libhy3.so"
|
||||
build = [
|
||||
"cmake -DCMAKE_BUILD_TYPE=Release -B build",
|
||||
"cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build",
|
||||
"cmake --build build"
|
||||
]
|
||||
|
|
16
shell.nix
Normal file
16
shell.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
hyprland,
|
||||
pkgs,
|
||||
hlversion ? "git",
|
||||
hy3 ? pkgs.callPackage ./default.nix {
|
||||
inherit hyprland hlversion;
|
||||
versionCheck = false;
|
||||
},
|
||||
}: pkgs.mkShell {
|
||||
inputsFrom = [ hy3 ];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
clang-tools_17
|
||||
bear
|
||||
];
|
||||
}
|
Loading…
Add table
Reference in a new issue