-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support nix run
#200
Comments
Can be done with poetry2nix if #368 gets merged ( |
I have a nearly complete flake.nix for this in my poetry2nix Branch. It would also solve #415 and #422. Please note that the icon and application name only appear if the application has been installed into the system. A .desktop file is then available, which will also be used when starting from the devShell. I think error: A definition for option `environment.systemPackages."[definition 1-entry 3]"' is not of type `package'. Definition values:
- In `/nix/store/ajvaxx5hvdhcdr3r9f0wpww61b05x9i2-source/configuration.nix':
{
program = "/nix/store/6srq67rl2fnawd9q4ikm6npqgx8nbg17-python3.12-tagstudio-9.3.2/bin/tagstudio";
type = "app";
} When providing a derivation with The only remaining problem is that I have to add However, if you install the Flake into the system, you get this error: Traceback (most recent call last):
File "/nix/store/lkih98vq66kb3cfw3j961bln7wd30843-python3.12-tagstudio-9.3.2/bin/..tagstudio-wrapped-wrapped", line 6, in <module>
from tagstudio.tag_studio import main
File "/nix/store/lkih98vq66kb3cfw3j961bln7wd30843-python3.12-tagstudio-9.3.2/lib/python3.12/site-packages/tagstudio/tag_studio.py", line 8, in <module>
from src.cli.ts_cli import CliDriver # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/lkih98vq66kb3cfw3j961bln7wd30843-python3.12-tagstudio-9.3.2/lib/python3.12/site-packages/tagstudio/src/cli/ts_cli.py", line 32, in <module>
from src.qt.helpers.file_opener import open_file
File "/nix/store/lkih98vq66kb3cfw3j961bln7wd30843-python3.12-tagstudio-9.3.2/lib/python3.12/site-packages/tagstudio/src/qt/helpers/file_opener.py", line 13, in <module>
from PySide6.QtWidgets import QLabel
ModuleNotFoundError: No module named 'PySide6.QtWidgets' The installed application can still be used with It would of course be better to be able to do without So if anyone finds a simple solution for this, let me know. The following commands are available to start the application from the devShell:
|
I got it working now. It can be executed directly with Runnable from devShell:
Installable in a System Flake: flake.nix {
description = "System Flake";
inputs = {
# ...
nix-tagstudio = {
url = "github:zierf/TagStudio/poetry2nix";
#inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, nixos-hardware, ... } @inputs:
# ...
} configuration.nix { pkgs, pkgs-stable, inputs, ... }:
# ...
environment.systemPackages = with pkgs; [
inputs.nix-tagstudio.packages."${pkgs.system}".tagstudio
# ...
];
# ... Possibly a working template for the handle I have kept the dependency list small so that end users are not dragging in too many different packages with their own dependency tree. Apart from Poetry2Nix there are no dependencies that would fundamentally break the flake if they stopped working. I have also kept the dependencies pinned with the The poetry2nix Issue #1191 has at least shown a possible override that uses the working PySide6 package from nixpkgs. It's not perfect, but it seems that the standard override of poetry2nix now needs a subsequent correction. overrides = defaultPoetryOverrides.${system}.extend (final: prev: {
# Overrides for PySide6
pyside6 = final.pkgs.python312.pkgs.pyside6;
#shiboken6 = final.pkgs.python3.pkgs.shiboken6;
}); While experimenting around, I also built a kind of minimal example for a flake with usable PySide6. It's called poetry2nix_pyside6, if anyone is interested. It was quite a journey to gather all the necessary information, especially since everything is so scattered. Maybe the example project will be useful again for a better overlay that doesn't need the PySide6 package from the nixpkgs. But at the moment I don't know what that should look like. |
@zierf works for me, good job. Are those 4GiB of dependencies really necessary? |
Thanks for testing, your feedback has a valid point! You can find out more about the structure of the inputs using the command The following declaration would have allowed to use the existing nixpkgs during installation via the system Flake. poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-tagstudio = {
url = "github:zierf/TagStudio/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.poetry2nix.follows = "poetry2nix";
}; Here is a bit more information about this topic and how it works: However, this is still very cumbersome and ugly, especially when using a lot of imported flakes. You would have to check all the dependencies of the packages and (if necessary) manually import them again so that they follow your own nixpkgs, only to then finally put them back into the package you actually wanted in the first place. I have now made another change so that everything in the flake follows the nixpkgs specified in the inputs at top of the file. Since poetry2nix is the only significant dependency, it now follows the pinned packages. After making a change to the Flake, you can immediately see whether poetry2nix can still produce a successful build with the locked nixpkgs. The main thing is that the Flake is consistent in itself at the end. However, at the top level I will not be adding a After my last change, you can now manually override the package pinning at any time in the parent importing flake with only one nix-tagstudio = {
url = "github:zierf/TagStudio/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
}; Don't forget to run Can't wait for Poetry #368 to be merged. |
@zierf I've built with and without Here is my nixos diffs: without follows, with follows. Still 1GiB of space... It looks like qt.full accounts for most of the size. I'm also confused about the xorg dependency (I'm under wayland). |
Removing I use Wayland myself, but Apart from that, we should not forget that TagStudio could potentially be run in XWayland at any time. Due to the override of PySide6 from the Nix packages, most of the previously explicitly listed dependencies no longer seem to be necessary, at least for I still think that the optimal solution would be having proper overrides, but I don't know what they are missing. The |
@zierf nice! now diff looks resonable: only qt and python. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Great, I'm glad it's in usable condition now! I made a small correction for the devShell only containing Poetry, adjusted a few things for the .desktop file and added a meta attribute. But no significant changes to the underlying program. Maybe at some point I'll move parts of the flake into an extra default.nix and shell.nix. What I would really like to see is an updated version of the official PySide6-Overrides in poetry2nix. It would round things off, but doesn't stop us from having a working flake.
Not sure exactly what this is supposed to tell us without further references or explanations. |
Allow people to run
nix run github:TagStudioDev/TagStudio
to build and run the app.The text was updated successfully, but these errors were encountered: