I am trying to integrate cargo-doc-live into services-flake, I added cargo-doc-live
for nixci https://github.com/juspay/services-flake/pull/246/commits/7877ddc635eb45ebe0b71f02bc529065f06b6c5f#diff-206b9ce276ab5971a2489d75eb1b12999d4bf3843b7988cbe8d687cfde61dea0R31-R34, it errors out since it's not running the build in the example/cargo-doc-live
directory
the error says:
cargo-doc-live-test> + process-compose --no-server -t=false
cargo-doc-live-test> [cargo-doc-live1-cargo-doc ] error: project root does not exist
any way I could run the nixci in the specified directory instead of top directory of services-flake
?
Srid has marked this topic as unresolved.
@Hao Liu It should not matter from which directory you run nix build <flake-url>
(which is what nixci build
does essentially) on, because nix builds are pure anyway.
error: project root does not exist
Where's this error originating from?
Take a look at how we set project root to the repo root in other places, e.g.: https://github.com/juspay/services-flake/blob/641937bc0f523405fbac4bb89c074de613dcee4d/dev/flake.nix#L26
@Srid this is how I set the projectRoot
in example https://github.com/juspay/services-flake/pull/246/files#diff-1cb9f37420e339a53fbd8b86243c074e2c4a3c93072a31a5ca73133054a63572R26
the error error: project root does not exist
is from cargo-watch when it could find a Rust project to watch on
This is where the flake check is defined: https://github.com/Platonic-Systems/process-compose-flake/blob/main/nix/process-compose/test.nix
Looks we need a cd
there before running pc
More generally, what if our process-compose test
depends on $PWD being set to something? That sounds like a feature request to https://github.com/Platonic-Systems/process-compose-flake repo
you mean instead of hardcoded cd $HOME
, introduce an option to enter a different directory like $PWD
?
Haven't fully thought about it, but yes maybe something like that.
Or it could be something like preHook
option we already have
preHook = ''
cd ${inputs.self}
'';
won't work due to permission issue,
✔ ~/services-flake/example/cargo-doc-live [add-cargo-doc-live|✚ 1…1]
11:07 $ result/bin/cargo-doc-live
+ process-compose --no-server
[cargo-doc-live1-cargo-doc ] [Running 'run-cargo-doc']
[cargo-doc-live1-cargo-doc ] error: Permission denied (os error 13) at path "/nix/store/a0vgclrrfn2svimc56k96m0nm0xvlndi-source/example/cargo-doc-live/targetwM02VI"
preHook = ''
cp -r ${inputs.self} $HOME/project
cd ~/project
'';
Yes, writeShellApplication
uses shellcheck, so the script should conform to it.
ahh, no wonder :)
the same permission issue after copying to my home dir
11:21 $ result/bin/cargo-doc-live
+ process-compose --no-server
[cargo-doc-live1-cargo-doc ] [Running 'run-cargo-doc']
[cargo-doc-live1-cargo-doc ] error: Permission denied (os error 13) at path "/home/hao/project/targetuijuhb"
[cargo-doc-live1-cargo-doc ] Browsersync not running at http://localhost:8009
should I introduce a chown
?
Yes.
chown $USER $HOME/project
won't work ...
and putting preHook
in example/cargo-doc-live/flake.nix
doesn't feel right since the user of the service should not bother to know that :D
chmod -R a+...
Hao Liu said:
and putting
preHook
inexample/cargo-doc-live/flake.nix
doesn't feel right since the user of the service should not bother to know that :D
I suggest doing this by hand then - i.e., write the flake check yourself, and then we can see how it can be abstracted out.
@Srid copying the project to HOME will stop the realtime update from happening since the user is updating the doc in example/cargo-doc-live
while the BrowserSync is watching the folder in HOME
When the flake check is built, where is the user involved?
ahh, indeed, no user will involve at the testing stage
@Hao Liu This preHook
stuff should be added to the test only, of course.
Which is why I suggested further above as to how this may well be a PR to process-compose-flake
But better to add flake check manually, because we don't know yet what the best API design here is.
indeed
Hao Liu said:
indeed
You realize, this commit adds the preHook
stuff to more than the test, right?
i.e., nix run
is impacted too.
yes, should only the checks
to be impacted, right?
The whole point is to fix this test failure, is it not?
error: project root does not exist
This error occurs only in tests, does it not?
yes, it's only there for test
So, do you see how that commit is not doing it only for test?
I reckon I will move this under test package, will read process-compose-flake for how to
I am trying to move it under settings.processes.test
(deleted)
@Srid there doesn't seem to be a way to have a preHook
specifically for test process
Ya, as I said above.
a feature request to process-compose-flake?
Last updated: Oct 12 2024 at 22:45 UTC