From 1fcb9e9f59371eb36536ebbe9e25ae78b99830db Mon Sep 17 00:00:00 2001 From: Kumar vaibhav Date: Thu, 12 Mar 2026 15:22:51 +0530 Subject: [PATCH 1/2] sowon: added support for Nixos installation --- README.md | 32 ++++++++++++++++++++++++-------- default.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ shell.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 8 deletions(-) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/README.md b/README.md index 93de6f0..c7e55d3 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,22 @@ $ make $ ./sowon ``` +### Nixos + +- Temporary way + +```sh +nix-build +./result/bin/my-app + +``` + +- Install via User profile + +```sh +nix-env -i -f default.nix +``` + ### MacOS ```console @@ -55,11 +71,11 @@ $ ./sowon ### Key bindings -| Key | Description | -| --- | --- | -| SPACE | Toggle pause | -| = or + | Zoom in | -| - | Zoom out | -| 0 | Zoom 100% | -| F5 | Restart | -| F11 | Fullscreen | +| Key | Description | +| ---------------------------- | ------------ | +| SPACE | Toggle pause | +| = or + | Zoom in | +| - | Zoom out | +| 0 | Zoom 100% | +| F5 | Restart | +| F11 | Fullscreen | diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..b9505e1 --- /dev/null +++ b/default.nix @@ -0,0 +1,43 @@ +{ + pkgs ? import { }, +}: + +pkgs.stdenv.mkDerivation { + pname = "sowon"; + version = "1.0.0"; + + # Point this to the directory containing your binary + src = ./.; + + nativeBuildInputs = [ + pkgs.autoPatchelfHook + ]; + + buildInputs = with pkgs; [ + xorg.libX11 + xorg.libXrandr + xorg.libXcursor + xorg.libXext + xorg.libXi + xorg.libXinerama + xorg.libXrender + xorg.libXfixes + xorg.libxcb + xorg.libXau + xorg.libXdmcp + libGL + stdenv.cc.cc.lib # Provides libstdc++ if needed + glibc + ]; + + installPhase = '' + mkdir -p $out/bin + cp your-executable-name $out/bin/my-app + chmod +x $out/bin/my-app + ''; + + meta = { + description = "A binary patched for NixOS"; + platforms = pkgs.lib.platforms.linux; + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..71ef4a4 --- /dev/null +++ b/shell.nix @@ -0,0 +1,48 @@ +{ + pkgs ? import { }, +}: + +pkgs.mkShell { + name = "sowon"; + + # Packages containing the libraries you listed + buildInputs = with pkgs; [ + libX11 + libXrandr + libXcursor + libXext + libXi + libXinerama + libXrender + libXfixes + libxcb + libXau + libXdmcp + libGL + # Standard C++ and C libraries + stdenv.cc.cc.lib + glibc + ]; + + # This environment variable tells the linker where to find the libs + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${ + with pkgs; + lib.makeLibraryPath [ + libX11 + libXrandr + libXcursor + libXext + libXi + libXinerama + libXrender + libXfixes + libxcb + libXau + libXdmcp + libGL + stdenv.cc.cc.lib + ] + }" + ''; +} From 0544e01373087e4cc5afdd2fe01fc0b57cd90bb5 Mon Sep 17 00:00:00 2001 From: Kumar vaibhav Date: Thu, 12 Mar 2026 15:28:18 +0530 Subject: [PATCH 2/2] removed warning and fixed package-names --- .gitignore | 1 + default.nix | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index e8d8ee5..9a07de6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build/ *.exe .dSYM/ *.gz +result/ diff --git a/default.nix b/default.nix index b9505e1..72189a8 100644 --- a/default.nix +++ b/default.nix @@ -14,17 +14,17 @@ pkgs.stdenv.mkDerivation { ]; buildInputs = with pkgs; [ - xorg.libX11 - xorg.libXrandr - xorg.libXcursor - xorg.libXext - xorg.libXi - xorg.libXinerama - xorg.libXrender - xorg.libXfixes - xorg.libxcb - xorg.libXau - xorg.libXdmcp + libX11 + libXrandr + libXcursor + libXext + libXi + libXinerama + libXrender + libXfixes + libxcb + libXau + libXdmcp libGL stdenv.cc.cc.lib # Provides libstdc++ if needed glibc