-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: Add cargo-doc-live #246
base: main
Are you sure you want to change the base?
Conversation
@srid I've got an error when I try to run
|
nix/cargo-doc-live_test.nix
Outdated
{ pkgs, ... }: { | ||
services.cargo-doc-live."cargo-doc-live1" = { | ||
enable = true; | ||
crateName = "simple"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there's no crate named simple
in this PR? This is probably why the PR is failing.
Also, the CI never terminates after those |
079ba71
to
3695662
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also want to add the new example to nixci
configuration of the top-level flake.nix
so it builds in the CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a ./example/cargo-doc-live/README.md
that explains how to run it?
example/cargo-doc-live/flake.nix
Outdated
# `process-compose.foo` will add a flake package output called "foo". | ||
# Therefore, this will add a default package that you can build using | ||
# `nix build` and run using `nix run`. | ||
process-compose."default" = { ... }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process-compose."default" = { ... }: | |
process-compose."cargo-doc-live" = { ... }: |
(The default package is usually the Rust package itself)
nix/cargo-doc-live.nix
Outdated
|
||
src = lib.mkOption { | ||
type = types.path; | ||
description = "The src of the cargo"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a default
value.
nix/cargo-doc-live.nix
Outdated
|
||
src = lib.mkOption { | ||
type = types.path; | ||
description = "The src of the cargo"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description = "The src of the cargo"; | |
description = "Path to the cargo project root"; |
nix/cargo-doc-live.nix
Outdated
default = { | ||
processes = | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The {
in line 34 is indented inconsistently with the rest of the project (e.g.: see {
in line 32). You should fix this in similar other places as well.
nix/cargo-doc-live.nix
Outdated
let | ||
browser-sync = lib.getExe pkgs.nodePackages.browser-sync; | ||
cargo-watch = lib.getExe pkgs.cargo-watch; | ||
cargo = lib.getExe pkgs.cargo; | ||
in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are in runtimeInputs
already, we don't need these and can just reference the executables as is in the script text, no?
nix/cargo-doc-live.nix
Outdated
runtimeInputs = with pkgs; [ nodePackages.browser-sync ]; | ||
text = | ||
'' | ||
${lib.getExe pkgs.nodePackages.browser-sync} start --port ${toString config.port} --ss target/doc -s target/doc \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${lib.getExe pkgs.nodePackages.browser-sync} start --port ${toString config.port} --ss target/doc -s target/doc \ | |
browser-sync start --port ${toString config.port} --ss target/doc -s target/doc \ |
doc/cargo-doc-live.md
Outdated
@@ -0,0 +1,40 @@ | |||
# cargo-doc-live | |||
|
|||
[cargo-doc-live] is live server version of `cargo doc`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use the 1st paragraph and video from https://github.com/srid/cargo-doc-live in here?
doc/cargo-doc-live.md
Outdated
|
||
{#crateName} | ||
|
||
### The crate to use when opening docs in browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know our docs elsewhere are more of skeleton, but we should get into the practice of fleshing out when writing new docs. Can you add some paragraphs to all these sections?
#217