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/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..72189a8 --- /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; [ + libX11 + libXrandr + libXcursor + libXext + libXi + libXinerama + libXrender + libXfixes + libxcb + libXau + 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 + ] + }" + ''; +}