Skip to content
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

Add dev helper and docs #574

Merged
merged 7 commits into from
Jan 18, 2023
Merged

Add dev helper and docs #574

merged 7 commits into from
Jan 18, 2023

Conversation

erikarvstedt
Copy link
Collaborator

Fixes #557.


if [[ ! -e src ]]; then
echo "Cloning fort-nix/nix-bitcoin"
git clone https://github.com/fort-nix/nix-bitcoin src
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After cloning, don't you want to cd into it?

It seems to me that all this cloning (or not) etc. might just confuse people. Generally I would expect people who run it to already have gtt cloned the repo manually. And then having that as pre-condition can be used to double check if the CWD is correct etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After cloning, don't you want to cd into it?

No, the setup script simply clones the nix-bitcoin repo to dir src, without later changing its contents.

Generally I would expect people who run it to already have git cloned the repo manually

Yes, but if the script moved/renamed the user's existing files, it would be even more confusing.
Users can simply replace the cloned repo with their local clone.

The dev env layout is very opinionated; it's what I prefer for creating auxiliary scripts/notes/resources for a public repo.
But I'm very interested in suggestions on how to improve it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev env layout is very opinionated; it's what I prefer for creating auxiliary scripts/notes/resources for a public repo.
But I'm very interested in suggestions on how to improve it.

Just thinking aloud, I'm not even all that familiar with nix-bitcoin, or generally developing strictly Nix-focused project (as opposed to a Rust project, that just uses Nix for building and tooling).

Generally if the project includes it's own tests and dev-env integration, I would expect git clone <project-repo> && cd <project> && nix develop (or direnv) to just set up everything for me (add binaries to the $PATH, create some repo-scoped configs and so on).

Copy link
Collaborator Author

@erikarvstedt erikarvstedt Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking aloud

Highly appreciated, thanks!

create some repo-scoped configs

Yeah, like our scenarios.nix file. How exactly would you implement this? Where would these files be created? (Note that they must be placed in a separate repo).
Adding an extra dir in the repo (another approach that I've used in the past) complicates repo-wide search (and replace), because the extra content is included.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you can develop nix-bitcoin just fine by simply running test/run-tests.sh and editing tests.nix.
I'll mention this in the docs.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, like our scenarios.nix file. How exactly would you implement this? Where would these files be created? (Note that they must be placed in a separate repo).

Oh, I don't really understand how these works, but generally for files like these it's "if they don't exist, copy/ln from a template of some kind and have them in .gitignore". Like here

The "must be placed in a separate repo" seems quite confusing to me, but I wouldn't spend too much time explaining it to me. :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be placed in a separate repo

Sorry, that was misleading. What I meant is that files like scenarios.nix should be put under version control, but, obviously, in an extra repo. This extra repo could simply be located inside the nix-bitcoin repo, but this has some downsides, as mentioned above.

dev/create-dev-env.sh Outdated Show resolved Hide resolved
dev/README.md Show resolved Hide resolved
@erikarvstedt erikarvstedt force-pushed the dev-docs branch 3 times, most recently from 652a277 to 3d74fb5 Compare December 13, 2022 10:25
dev/dev-env/create.sh Outdated Show resolved Hide resolved
Copy link
Member

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of cool stuff. Thanks! Left a few comments.

dev/dev-env/dev-shell.nix Outdated Show resolved Hide resolved
dev/dev.sh Outdated
Comment on lines 1 to 9
#―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
# Access nix-bitcoin flake packages

nb() {
nix build --no-link --print-out-paths --print-build-logs "$@"
}

# A package defined by nix-bitcoin
nb .#joinmarket
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we run (parts of) the new shell scripts in ci?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past, I've failed to directly run extra-container on the Cirrus CI node. I'll investigate this further and maybe later add tests for the dev scripts.

dev/dev-env/create.sh Outdated Show resolved Hide resolved
dev/dev-env/dev-shell.nix Show resolved Hide resolved
dev/dev-env/create.sh Show resolved Hide resolved
dev/dev-features.sh Outdated Show resolved Hide resolved
dev/dev-features.sh Show resolved Hide resolved
dev/dev-features.sh Outdated Show resolved Hide resolved
dev/dev-env/template-scenarios.nix Show resolved Hide resolved
dev/dev-features.sh Show resolved Hide resolved
@erikarvstedt erikarvstedt force-pushed the dev-docs branch 3 times, most recently from 8faa337 to 04ebece Compare December 20, 2022 18:26
This removes a source of implicit state and guarantees that regular
calls to `run-tests.sh` always run the builtin tests.
Previously, an incomplete clightning unit was always created because
attr `clightning` was always defined in option attrset `systemd.services`.
Move line next to `services.lnd` config for clarity.
@erikarvstedt
Copy link
Collaborator Author

Rebased to master.

dev/dev.sh Outdated Show resolved Hide resolved
dev/topics/rtl.sh Outdated Show resolved Hide resolved
dev/dev-env/template-scenarios.nix Show resolved Hide resolved
dev/dev-env/create.sh Show resolved Hide resolved
@jonasnick
Copy link
Member

LGTM now. Feel free to squash.

Copy link
Member

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b4d7e1a

@jonasnick jonasnick merged commit 84fc4d4 into fort-nix:master Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add developer docs
3 participants