From 6e980df23fff58cf245567d2ce49834997e3a3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miskolczi=20Rich=C3=A1rd?= Date: Fri, 10 Apr 2026 16:47:51 +0200 Subject: [PATCH] Providing flake for Nix users --- .gitignore | 3 ++- README.md | 28 ++++++++++++++++++++++++++++ default.nix | 37 +++++++++++++++++++++++++++++++++++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 20 ++++++++++++++++++++ 5 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 9c6a298..6c6e3da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .cache/ build/ -.vscode/ \ No newline at end of file +.vscode/ +result diff --git a/README.md b/README.md index 72647d1..907ac50 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,34 @@ You have a few options of obtainting the program. You may install this program [from the AUR.](https://aur.archlinux.org/packages/hyprland-toggle-tiling-git) +### Nix Flake (for Nix users) + +This project provides a Nix flake for reproducible builds and easy installation. + +#### Build the package + +```shell +nix build git+ssh://gitea@typofelho.ddns.net/TypoMustakes/hyprland-toggle-tiling.git +``` + +The binary will be at `./result/bin/htt`. + +#### Add to Home Manager + +1. Add the flake as an input: + +```shell +inputs.htt.url = "git+ssh://gitea@typofelho.ddns.net/TypoMustakes/hyprland-toggle-tiling.git"; +``` + +2. Then include it in your configuration: + +```shell +home.packages = [ + inputs.htt.packages.${pkgs.system}.default +]; +``` + ### Download the release You can also [download the release binary.](https://typofelho.ddns.net/TypoMustakes/hyprland-toggle-tiling/releases) diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..306c5d2 --- /dev/null +++ b/default.nix @@ -0,0 +1,37 @@ +{ pkgs ? import {} }: + +pkgs.stdenv.mkDerivation rec { + pname = "hyprland-toggle-tiling"; + version = "1.4.2"; + + src = pkgs.fetchFromGitHub { + owner = "TypoMustakes"; + repo = "hyprland-toggle-tiling"; + rev = "v${version}"; + sha256 = "sha256-5mI5WiPjSU+/MgvTPNvE6Ck/WBnidaFwW9/xeL7MMWE="; + }; + + nativeBuildInputs = [ + pkgs.cmake + pkgs.pkg-config + ]; + + buildInputs = [ + pkgs.hyprland + pkgs.nlohmann_json + ]; + + cmakeFlags = [ + "-DUSE_SYSTEM_JSON=ON" + ]; + + cmakeBuildType = "Release"; + + meta = with pkgs.lib; { + description = "Toggle tiling and floating modes in Hyprland globally."; + homepage = "https://github.com/TypoMustakes/hyprland-toggle-tiling"; + license = licenses.gpl3Only; + platforms = platforms.linux; + mainProgram = "htt"; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8ec14d2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1775710090, + "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4c1018dae018162ec878d42fec712642d214fdfa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..80ecb3d --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + description = "hyprland-toggle-tiling"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.${system}.default = pkgs.callPackage ./default.nix {}; + apps.${system}.default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/htt"; + }; + }; +}