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

Support subflakes betterer #9

Merged
merged 6 commits into from
Jul 7, 2023
Merged

Support subflakes betterer #9

merged 6 commits into from
Jul 7, 2023

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Jun 29, 2023

If you set the upload-name to whatever (i.e.
NixOS/nixos-subflake-lib), set the repo to the actual GitHub repo (i.e. NixOS/nixpkgs), the directory (i.e. ./lib), and finally the git_root (i.e. .) to get a nxfr tarball that contained only the Nixpkgs lib subflake.

This replaces the old mirrored-for with the repo input, but also makes it more extensible / usable for e.g subflakes.


todo: test that this works with existing repos (aka update configs and see if it still works)

required: true
default: null
mirrored-for:
Copy link
Member Author

@cole-h cole-h Jun 29, 2023

Choose a reason for hiding this comment

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

Because we replace mirrored-for, I think we'll also need to bump the nxfr version to v6 -- it's no longer in the meta (for obvious reasons), but was replaced by the repo field which is the upstream repo e.g. in case you use NixOS/nixpkgs-subflake-lib as the upload-name.

Not the best solution, happy to rework it, but it "works".

Base automatically changed from cole/ds-965-nxfr-dont-volunteer-a-lockfile-when-uploading to revert-5-revert-4-hoverbear/ds-944-rewrite-flakehub-push-in-rust June 30, 2023 14:20
@@ -87,7 +97,7 @@ impl NixfrPushCli {
github_token.clone()
} else {
std::env::var("GITHUB_TOKEN")
.wrap_err("Could not determine Github token, pass `--github-token`, or set either `NIXFR_PUSH_GITHUB_TOKEN` or `GITHUB_TOKEN`")?
.wrap_err("Could not determine Github token, pass `--github-token`, or set either `NXFR_PUSH_GITHUB_TOKEN` or `GITHUB_TOKEN`")?
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh my god

@cole-h cole-h force-pushed the betterer-subflakes branch 2 times, most recently from a278b16 to 545f58e Compare June 30, 2023 14:53
Base automatically changed from revert-5-revert-4-hoverbear/ds-944-rewrite-flakehub-push-in-rust to main June 30, 2023 17:20
If you set the `upload-name` to whatever (i.e.
`NixOS/nixos-subflake-lib`), set the `repo` to the actual GitHub repo
(i.e. `NixOS/nixpkgs`), the `directory` (i.e. `./lib`), and finally the
`git_root` (i.e. `.`) to get a nxfr tarball that contained only the
Nixpkgs lib subflake.

This replaces the old `mirrored-for` with the `repo` input, but also
makes it more extensible / usable for e.g subflakes.
@cole-h cole-h marked this pull request as ready for review July 3, 2023 16:21
} else {
Some(v)
#[derive(Clone, Debug)]
pub struct OptionString(pub Option<String>);
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to use a function (clap says Fn(&str) -> Result<T, E> would work), but clap threw an error about trying to downcast:

Message:  Mismatch between definition and access of `tag`. Could not downcast to alloc::string::String, need to downcast to core::option::Option<alloc::string::String>

This was the next best thing, makes it so we get our Nones as early as possible (and now there's no way to mess it up by e.g. forgetting to convert).

Copy link
Contributor

Choose a reason for hiding this comment

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

I bumped into this too before, super annoying.

@@ -163,14 +208,16 @@ impl NixfrPushCli {
source = tracing::field::Empty,
)
)]
#[allow(clippy::too_many_arguments)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Edit the clippy.toml and set it to the right number :)

@@ -9,7 +9,7 @@ use crate::Visibility;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub(crate) struct ReleaseMetadata {
pub(crate) description: Option<String>,
pub(crate) mirrored_for: Option<String>,
pub(crate) repo: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

This will require an update to nxfr

Copy link
Member Author

Choose a reason for hiding this comment

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

@Hoverbear Hoverbear self-requested a review July 4, 2023 15:34
@Hoverbear
Copy link
Contributor

Hoverbear commented Jul 4, 2023

Removing my approval as I want to see the PR based off this get merged to it first.

…nxfr-and-nxfr-push-release-metadata

Sort metadata, add mirrored param back
src/cli/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: Ana Hobden <[email protected]>
src/cli/mod.rs Outdated Show resolved Hide resolved
@cole-h cole-h merged commit 3c11583 into main Jul 7, 2023
5 checks passed
@cole-h cole-h deleted the betterer-subflakes branch July 7, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants