feat: provide a flake.nix to build with Nix - #104
Conversation
|
Thank you. I guess the files in another workspace you're referring to are one of or both the So once this is ready, would we add it on the downloads page? https://tattoy.sh/download |
|
Yes, you'll get another way to run tattoy, notably |
|
Note that the error I get is: |
|
Is there a convenient command to try this out? I think it should be fixed now if running from latest |
73d2036 to
c00adf3
Compare
|
If you have Nix, you can just run I have rebased to make it work, but some tests are failing: Maybe we could just not run e2e tests if they require a working terminal? |
|
I got it to build and saw the same error as you! Okay so that error is simply because the Now I see a new error when it runs the tests. Some of the tests require the debug build of Tattoy, as they're end to end tests that test the CLI application itself. Do you know if its possible to run |
|
Oh BTW the end to end tests don't need a working terminal, they're all run in memory. |
c00adf3 to
9e0f40f
Compare
|
I have tried |
|
Ok step by step! I see those errors too: It looks like basically all the e2e tests are failing, so it's probably something simple but underlying. I tried |
|
You should have a Use |
|
Thanks for that. I've discovered something interesting: the tests pass with So thanks to those commands I was also able to run |
|
There's actually a proper nixpkg in the works now! NixOS/nixpkgs#428828 Will that replace this flake here or be based on it? Or are there other good reasons to have both? |
|
We can keep both. The one here is useful for people wanting the latest version. The one in nixpkgs will be used by most users. |
9e0f40f to
97a483e
Compare
|
I have pushed an update for you to tweak. I don't know exactly how |
|
Great, thanks. It needs |
|
Yes, we cannot do that this way. It needs to be "locked". You cannot access internet while building. |
| checkPhase = '' | ||
| runHook preCheck | ||
| cargo build --all | ||
| cargo nextest run | ||
| runHook postCheck | ||
| ''; |
There was a problem hiding this comment.
I wonder if there's a way to encode this without adding a custom checkPhase. I tried
cargoTestFlags = [ "--workspace" ];
checkType = "debug";
useNextest = true;
but this fails more of the e2e tests (12 instead of 10). I'm not really sure why.
There was a problem hiding this comment.
From my understanding, the end to end tests are using the generated binary, which is not rebuilt when using just these flags. But we can move cargo build --all to the precheck hook.
The old `send_command` now just sends all the characters of the command individually. And so there's a new command, `send_command_with_osc_paste()` that retains the old behaviour. This should fix a lot of the tests failing inside Nix. Relates to tattoy-org/tattoy#104.
The old `send_command` now just sends all the characters of the command individually. And so there's a new command, `send_command_with_osc_paste()` that retains the old behaviour. This should fix a lot of the tests failing inside Nix. Relates to tattoy-org/tattoy#104.
|
I've pushed a fix to main branch that gets most of the e2e tests back. It was a very curious issue, for some reason Tattoy's PTY process that gets started under Nix doesn't parse out OSC paste codes (which are used to paste the end to end test commands). I never even knew that PTY processes cared about ANSI codes, I thought that was all handled by the terminal emulator. So that just leaves the gpu tests now. For them to pass they either need access to a real GPU or a software GPU like LLVMPipe https://docs.mesa3d.org/drivers/llvmpipe.html How important is it that a Nix package runs all the end to end tests? |
|
We could try with |
One can use `nix build .`. On NixOS, there is only `/bin/sh` and `/usr/bin/env` outside the `/nix` directory, so some invocations of bash and env were updated for that. This would help for tattoy-org#100.
97a483e to
10b7fad
Compare
|
I have pushed an updated version, but I wasn't able to fully build from my laptop due to space constraint. I have added |
|
So I can now get all the tests to pass in I just thought as well, we should add the flake build as a member of the test matrix in Github Actions. Do you have any experience of that? |
|
checking out head of this branch, I get: When I run outside the sandbox: I get two failing tests: Any chance you ran into these @tombh ?
I think if you add |
|
Yes, that's exactly what I run into. So I'm assuming that the GPU tests fail just because they can't connect to the GPU device and that the e2e tests fail because of the way |
You can keep the build directory with
I can do that. |
|
I have added a commit to build on GitHub CI. |
|
Maybe we could disable the failing tests for now and add that as a separate issue? Would love to see this merged! |
|
We could certainly do that! But the reason I haven't is that we've already disabled the tests on the Nix package: https://search.nixos.org/packages?channel=unstable&show=tattoy&query=tattoy I'd assumed that gave us the time to really dig into the underlying reason for the test failures. You see I think Nix is revealing a very interesting side of TTYs that I haven't understood yet, so I'm keen to learn from the failures. Or put another way: if there's already a Nix way to install Tattoy, then the urgency to merge this PR is lower. I could be totally be misunderstanding something though, please let me know. BTW I've not been working on Tattoy recently, it's not just this PR. But I have big plans, so I'll be back soon! |
One can use
nix build ..Unfortunately, it does not work as one of the dependency is referencing a file from another workspace and I lack any experience with Rust or Nix packaging for Rust, so I don't know how to fix that.
Also, I made it Linux-only, but it would be possible to add support for MacOS.
This would help for #100.