From c7492b78d3f442abecc42260b851cf1f3d5d7ce6 Mon Sep 17 00:00:00 2001 From: Dakota Marshall Date: Wed, 24 Apr 2024 15:39:12 -0400 Subject: [PATCH 1/4] Add flake files for working Nix environment --- flake.lock | 27 +++++++++++++++++++++ flake.nix | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..fa6aa60e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1688072080, + "narHash": "sha256-mPsxREerkmDU2m7zi8j19ooc1F9wKPWBJ77S7swXMmI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5a8650469a9f8a1958ff9373bd27fb8e54c4365d", + "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 00000000..ec551544 --- /dev/null +++ b/flake.nix @@ -0,0 +1,70 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs, }: + let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in { + devShells.x86_64-linux.default = pkgs.mkShell { + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ + pkgs.gcc-unwrapped + pkgs.zlib + pkgs.libglvnd + pkgs.glib + pkgs.stdenv.cc.cc + pkgs.fontconfig + pkgs.libxkbcommon + pkgs.xorg.libxcb + pkgs.freetype + pkgs.dbus + pkgs.qt6.qtwayland + pkgs.zstd + ]; + buildInputs = with pkgs; [ + cmake + gdb + zstd + qt6.qtbase + qt6.full + qt6.qtwayland + qtcreator + python310Packages.pip + python310Full + python310Packages.virtualenv # run virtualenv . + # python3Packages.pyqt5 # avoid installing via pip + python310Packages.pyusb # fixes the pyusb 'No backend available' when installed directly via pip + + gcc.cc.libgcc + makeWrapper + bashInteractive + glib + libxkbcommon + freetype + binutils + dbus + coreutils + libGL + libGLU + fontconfig + # wrapQtAppsHook + xorg.libxcb + + + # this is for the shellhook portion + qt6.wrapQtAppsHook + makeWrapper + bashInteractive + ]; + # set the environment variables that Qt apps expect + shellHook = '' + export QT_QPA_PLATFORM=wayland + export LIBRARY_PATH=/usr/lib:/usr/lib64:$LIBRARY_PATH + # export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/ + export QT_PLUGIN_PATH=${pkgs.qt6.qtbase}/${pkgs.qt6.qtbase.qtPluginPrefix} + bashdir=$(mktemp -d) + makeWrapper "$(type -p bash)" "$bashdir/bash" "''${qtWrapperArgs[@]}" + exec "$bashdir/bash" + ''; + }; + }; +} From c4e8d40abe84f90b5e4b16a769e75cb954ef9ded Mon Sep 17 00:00:00 2001 From: Dakota Marshall Date: Wed, 24 Apr 2024 15:39:21 -0400 Subject: [PATCH 2/4] Update bash script to use env for nix support --- TagStudio.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TagStudio.sh b/TagStudio.sh index 82036413..cff969c3 100755 --- a/TagStudio.sh +++ b/TagStudio.sh @@ -1,5 +1,5 @@ -#! /bin/bash +#! /usr/bin/env bash python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt -python tagstudio/tagstudio.py \ No newline at end of file +python tagstudio/tagstudio.py From bc0f8b991ea5ba6ef2ad278d815ae9b47ac4173f Mon Sep 17 00:00:00 2001 From: Dakota Marshall Date: Wed, 24 Apr 2024 15:39:36 -0400 Subject: [PATCH 3/4] Update install documentation for NixOS --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2afe1c0b..3563733f 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,10 @@ With the virtual environment loaded, run the python file at "tagstudio/tagstudio Run the "TagStudio.sh" script, and the program should launch! (Make sure that the script is marked as executable). Note that launching from the script from outside of a terminal will not launch a terminal window with any debug or crash information. If you wish to see this information, just launch the shell script directly from your terminal with `sh TagStudio.sh`. +##### NixOS + +Use the provided `flake.nix` file to create and enter a working environment by running `nix develop`. Then, run the above `TagStudio.sh` script. + ## Usage ### Creating/Opening a Library From 4184848f9ce623a6a6ab32c8f5fec62af6c75706 Mon Sep 17 00:00:00 2001 From: Dakota Marshall Date: Wed, 24 Apr 2024 16:51:06 -0400 Subject: [PATCH 4/4] Update Nix flake pinned hash for python3.12 and QT 6.6.3 support --- flake.lock | 6 +++--- flake.nix | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index fa6aa60e..5dafd370 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1688072080, - "narHash": "sha256-mPsxREerkmDU2m7zi8j19ooc1F9wKPWBJ77S7swXMmI=", + "lastModified": 1712473363, + "narHash": "sha256-TIScFAVdI2yuybMxxNjC4YZ/j++c64wwuKbpnZnGiyU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5a8650469a9f8a1958ff9373bd27fb8e54c4365d", + "rev": "e89cf1c932006531f454de7d652163a9a5c86668", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ec551544..f827ba07 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,8 @@ pkgs.freetype pkgs.dbus pkgs.qt6.qtwayland + pkgs.qt6.full + pkgs.qt6.qtbase pkgs.zstd ]; buildInputs = with pkgs; [ @@ -28,13 +30,12 @@ qt6.full qt6.qtwayland qtcreator - python310Packages.pip - python310Full - python310Packages.virtualenv # run virtualenv . - # python3Packages.pyqt5 # avoid installing via pip - python310Packages.pyusb # fixes the pyusb 'No backend available' when installed directly via pip + python312Packages.pip + python312Full + python312Packages.virtualenv # run virtualenv . + python312Packages.pyusb # fixes the pyusb 'No backend available' when installed directly via pip - gcc.cc.libgcc + libgcc makeWrapper bashInteractive glib @@ -46,7 +47,6 @@ libGL libGLU fontconfig - # wrapQtAppsHook xorg.libxcb