Create and activate venv via Nix Flake
When running nix develop to generate a development shell, the python virtual environment will now automatically be created and dependencies from requirements.txt will be installed (and the venv will be activated). Effectively, this moves the setup portion of the TagStudio.sh to the flake and means the setup script for Linux/Mac is no longer needed when using nix. The README has been updated to reflect the new process of nix develop then python3 tagstudio/tag_studio.py.
The python virtualenvironment package has been replaced with venvShellHook, which creates a virtual environment in the directory specified by $venvDir (in this case ./.venv). This also gives the postVenvCreation hook, where pip install is then executed. The previous shellHook needed to be moved to postShellHook to execute after the venv is created. unset SOURCE_DATE_EPOCH is probably not necessary, but is to solve a potential issue between pip and nix and appears in a lot of python flake examples.
This was finished prior to #149 being merged, which appears to have added a dep for libpulse and currently prevents the program from starting successfully via the flake. I'll create pr to fix that (and some other dep issues) soon, but this was bad timing on my part. Converting to draft
Now based on #244
Same as my comment on #224, I've will follow up as soon as I've done a proper test and review, thank you!
Just a heads up, the instructions for running/building from source have been moved from the README to CONTRIBUTING.md
Currently, everything related to the actual creation of the venv works. The main blocker I'm on right now is mypy always fails with [import-not-found] for all third-party libraries, I don't know if that's something fixable or a fundamental broken-on-nix problem.
Thanks for the hard work on this. I'll see if I can figure something out myself for mypy.
Really couldn't figure out a way to get mypy to function without using from nixpkgs repos. For now the versions are the same as in the requirements-dev.txt but will have to see what this might mean when they drift apart.
Really couldn't figure out a way to get mypy to function without using from nixpkgs repos. For now the versions are the same as in the
requirements-dev.txtbut will have to see what this might mean when they drift apart.
I have no experience with NixOS, so sorry if I'm missing something obvious, but why is installation of requirements-dev.txt needed in first place? The dependencies are meant for developers, and in such case you will be most likely cloning the git repo instead of installing it via package manager, no?
Really couldn't figure out a way to get mypy to function without using from nixpkgs repos. For now the versions are the same as in the
requirements-dev.txtbut will have to see what this might mean when they drift apart.I have no experience with NixOS, so sorry if I'm missing something obvious, but why is installation of
requirements-dev.txtneeded in first place? The dependencies are meant for developers, and in such case you will be most likely cloning the git repo instead of installing it via package manager, no?
This is a dev shell for developers to use, on NixOS you cannot just clone a repo and expect that to work and libraries don't exist the same as on a traditional distribution. This dev shell provides the utilities and libraries needed for a working development environment to use on TagStudio. Building and running is something I will cook up at some point for NixOS, which as well needs to be handled in this flake.
This totally got lost with other responsibilities and life events, for which I am at fault for for not giving this the attention it needed sooner. I am going to pull this as-is right now to give me a starting place for a dev shell using devenv which it appears is what the big thing in the Nix development ecosystem is. Be on the lookout for that being merged tonight or sometime tomorrow. I have the template pulled up as a write this, so no excuses from me if that isn't done by then.