Skip to content

Bugfix for #107. Only update main.go #108

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

firecat53
Copy link
Contributor

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

I was going too fast and thought I needed to update all instances of
version_replaceme, but it only needed to be changed in main.go. I don't think
the inital PR broke anything, but it potentially could.

Sorry for the noise!

How to test?

  • nix build
  • result/bin/newt -version -> check version is output correctly

@oschwartz10612
Copy link
Member

oschwartz10612 commented Aug 17, 2025 via email

@firecat53
Copy link
Contributor Author

firecat53 commented Aug 17, 2025

Ooops...the 2nd two commits I apparently added to this by mistake! I was testing a CI/CD branch and pushed to my main. Should be reset now and the actual bugfix PR is correct and ready to merge.

About the CI/CD - I'll give you what I've come up with so far, but I think it better given my minimal experience with Github Actions and your release process that you create a flow that works for you.

After poking at it for awhile, it seems there are two components:

  1. When the dependabot updates dependencies, the generated PR can trigger a workflow to updated the vendorHash similar to sops-nix. It doesn't run on release, but just on dependency updates. Here's the portion of a workflow I came up with that should work for this project (tested as best as I could on my fork and also using act):
- name: Install Nix 
  uses: DeterminateSystems/nix-installer-action@main

- name: Update vendorHash in flake.nix
  run: |
    # Unset vendorHash
    sed -i 's/vendorHash = .*$/vendorHash = "";/' flake.nix
    # Get the new vendorHash
    NEW_VENDOR_HASH=$(nix build 2>&1 | grep -o 'sha256-[a-zA-Z0-9+/=]*' | tail -1)
    if [ -n "$NEW_VENDOR_HASH" ]; then
      sed -i 's/vendorHash = ""/vendorHash = "'"$NEW_VENDOR_HASH"'"/' flake.nix
      echo "Updated flake.nix vendorHash to $NEW_VENDOR_HASH"
    else
      echo "Warning: Could not determine new vendorHash"
    fi
}

Then the action can use the same Update checksum stanza that is shown in the linked sops-nix action to commit and push the update.

  1. For releases, there should be some kind of release.sh or make release that updates the version in flake.nix and then creates and pushes the tag to trigger the release action. I realized that even with the way we've currently been doing it that the flake updates aren't actually included in the released version but are one commit after. The version has to be changed before the release happens. (edit) The other option I guess would be to always just use the current commit as a version for nix build instead of assigning a version in the flake.

I hope that helps! I'm no Nix guru...just love your project and am trying to make it easier to run on NixOS until it gets added to the Nix packages. Thanks!

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.

2 participants