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

update cursor to 0.44.11, add multi-platform support, modify update sh #371260

Closed

Conversation

aspauldingcode
Copy link
Contributor

@aspauldingcode aspauldingcode commented Jan 5, 2025

Supercedes #371208

"Updated code-cursor to 0.44.11.
Added aarch64-linux and both darwin platforms.
Modified passthru Update Script to include mac release catalog"

^ Please summarise the changes you have done and explain why they are necessary here ^

For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
For new packages please briefly describe the package or provide a link to its homepage.
-->

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@aspauldingcode
Copy link
Contributor Author

aspauldingcode commented Jan 5, 2025

I formatted with nixfmt, but I have no idea how to push that change properly? I've just committed with git commit --amend
so there weren't multiple commits, but now I think I messed up somehow? I'm not sure

@aspauldingcode
Copy link
Contributor Author

I think I was supposed to @sarahec
I'm not sure.

I haven't tested on x86_84-darwin or either linux outputs, and I don't know how to test the update script but the mac catalog produced an output and I got the right hashes I think

@sarahec sarahec added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jan 5, 2025
@sarahec
Copy link
Contributor

sarahec commented Jan 5, 2025

You can "squash" your nixfmt commit into the main one, see https://www.geeksforgeeks.org/git-squash/

Then git push --force-with-lease updates the PR with the revised commit

@sarahec
Copy link
Contributor

sarahec commented Jan 5, 2025

What to expect next:

  1. As a first time committer, you'll get asked for multiple small changes. Don't sweat it, it's normal. Expect this PR to take a week or two to be finally finished.
  2. I'm going to go through your commit and request a few changes now. After you make these changes, you'll squash and force-push again.
  3. As a check, can you tell me what nixfmt --version returns? There are multiple versions out there and only one is accepted in nixpkgs.

Also, I want to restructure this a bit. Let me see if can send a commit through to make your life easier.

@sarahec
Copy link
Contributor

sarahec commented Jan 5, 2025

P.S. Go ahead an mark this as a "draft" for now (under reviewers on the PR page) so we don't have multiple reviewers on it yet. We'll mark it "ready for review" when done.

@sarahec
Copy link
Contributor

sarahec commented Jan 6, 2025

All right, I mentioned a refactor.

First step: we normally break apart the "version update" step from the "add new platforms" step. Rather than have you split this into two commits and manage them both, I'm submitting a PR for the update: #371295

I would like to have you review it.

  1. Click on code-cursor: 0.44.9 -> 0.44.11 #371295 to go to its PR page.
  2. Look at the title: code-cursor: 0.44.9 -> 0.44.11. This is the team standard for naming PRs: the package name, colon, then what you changed. Go ahead and update the title on your PR when you have a chance.
  3. You would normally look at the template in the description showing what I changed, tested, etc. Since this is a simple update, I just gave a note on how I updated, built, and tested it.
  4. Look down at the box below listing all of the checks. You would normally wait until all of these pass. (If any fail, it's up to the submitter to fix.)
  5. Now look above the description. There's a series of tabs -- Conversation | Commits | Checks | Files Changed. Click on Files Changed
  6. You'll see a diff of what changed. You can make comments, but let's not worry about this now.
  7. Click the "review changes" dropdown and select approve then submit. You've approved your first PR! (Sometimes reviewers will include a comment such as "LGTM" for "Looks Good To Me")
  8. Then we wait until one of the committers comes along and merges it. A simple version bump with very few comments normally gets merged pretty quickly.

Once this merges, I'll tell you how to get the changes into your branch. (Hint, you update nixpkgs then rebase on top of that to bring your branch up to date.)

(We'll get to managing multiple commits in a PR later. One step at a time! You'll want to add your name to the list of maintainers soon and we'll use it as the example.)

Copy link
Contributor

@sarahec sarahec left a comment

Choose a reason for hiding this comment

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

A few easy changes to get you started. Once you make these, commit the changes locally, squash them into the previous commit, then force push.

fi
'';

meta = {
meta = with lib; {
Copy link
Contributor

Choose a reason for hiding this comment

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

with lib is deprecated, please remove and refer to lib inline (as per the original file).

Background: https://discourse.nixos.org/t/why-are-there-so-many-ways-to-reference-lib-and-do-they-matter/2920

@aspauldingcode
Copy link
Contributor Author

3. can you tell me what nixfmt --version returns

nixfmt --version
nixfmt nixpkgs-unstable-2024-12-04

@aspauldingcode aspauldingcode marked this pull request as draft January 6, 2025 02:36
@aspauldingcode
Copy link
Contributor Author

aspauldingcode commented Jan 6, 2025

Hi, am I supposed to be pressing the "Sync Fork > Update Branch" GUI button on github? or am I supposed to leave that alone since we are on a different branch now?

I want to merge those with a squash, so I ran git rebase -i HEAD~3 and I got many overwhelming things to look at
Screenshot 2025-01-05 at 6 45 43 PM
Screenshot 2025-01-05 at 7 01 15 PM

I apologize I have no idea what I'm supposed to be doing on this local branch and my fork.
I'll be following your help =)

@sarahec
Copy link
Contributor

sarahec commented Jan 6, 2025

nixfmt nixpkgs-unstable-2024-12-04

Looks good to me!

@sarahec
Copy link
Contributor

sarahec commented Jan 6, 2025

I want to merge those with a squash, so I ran git rebase -i HEAD~3 and I got many overwhelming things to look at

Let's imagine you've pressed "sync fork" on Github. Now your master branch is up to date with nixpkgs:master and your branch is still behind it.

Next, use git rebase master to shift your branch to start at the top of nixpkgs:master. If anyone made a change in nixpkgs that affects your branch, git will try to merge those automatically (or give you notes in your files showing the before/after changes. In that case, edit your files to bring them up to date then run git rebase --continue)

Note that the CONTRIBUTING.md file says git fetch upstream master. This does the same thing as the sync fork button.

OK, so about the screen you saw:

  1. git rebase -i triggers an interactive rebase. Git opens an editor with a list of changes. Each change has a keyword in front: "pick" means "commit", "skip" means "don't commit", and "squash" means "merge into the commit below".
  2. `So "git squash" means is the same as "git rebase -i" plus changing the first keyword to "squash" -- it combines the two commits into one.
  3. "git rebase -i HEAD~3" means "I want to back up three commits and rebase (add the recent commits from another branch, usually master, before that point)"

You only need rebase -i if you need to squash commits or re-order them. Let's say you want to add your name to maintainers/maintainer-list.nix. (I recommend you do this, it gives you some extra powers around PRs). So you make the change and commit it, and now you have:

Add aspauldingcode to maintainers
update cursor to 0.44.11, add multi-platform-support...

You may want to flip the order of these -- maintainers first, then cursor updates, as you're changing the cursor code more often. So you run git rebase -i HEAD~3 and see:

pick 12345 Add aspauldingcode to maintainers
pick 67890 update cursor to 0.44.11, add multi-platform-support
pick ABCDE ...something else...

If you switch the first two lines and save the file, you'll switch the order of the commits:

pick 67890 update cursor to 0.44.11, add multi-platform-support
pick 12345 Add aspauldingcode to maintainers
pick ABCDE ...something else...

Now any squashes happen to the top of the list.

Remember to git push --force-with-lease when you`re done to publish the update.

Fixing the mixed up merge

Send me the output of git status please and we'll figure it out

@lucasew
Copy link
Contributor

lucasew commented Jan 6, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 371260


x86_64-linux

❌ 1 package failed to build:
  • code-cursor

@sarahec
Copy link
Contributor

sarahec commented Jan 7, 2025

Hi Alex, just checking in. I assume school has you busy. I'll be here when you want to continue work on this.

@aspauldingcode
Copy link
Contributor Author

Hi Alex, just checking in. I assume school has you busy. I'll be here when you want to continue work on this.

Hi,
Yes, sorry. I can work on it incrementally. I want to continue until this merges =)

I'm reading your previous message to fully comprehend.

@github-actions github-actions bot added the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Jan 7, 2025
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 7, 2025
@aspauldingcode
Copy link
Contributor Author

Fixing the mixed up merge

Send me the output of git status please and we'll figure it out

Here:
https://paste.ee/p/CCemC
I am currently up-to-date on master, I think(?) but my changes have pushed to my fork. and, I don't know how to push the fork changes to the upstream if they're made to be in one squashed commit @sarahec

@aspauldingcode
Copy link
Contributor Author

aspauldingcode commented Jan 7, 2025

I've added myself to maintainers list. I'm hesitent to try but I'm going to run a git push --force-with-lease and see what happens

@sarahec
Copy link
Contributor

sarahec commented Jan 7, 2025

Your merge and push look good. We still have some changes to make, but you navigated the first git hurdles.

Let's take a moment to sort out the commits. Looking at master...aspauldingcode:nixpkgs:cursor-add-platforms I see five commits:

Notice that I have them with the newest commit first. That's the order you'll see in a git rebase --interactive

Here's what reviewers expect to see:

This combines all of the code-cursor changes into one commit that is newer than the maintainers change. I also rewrote the names into the nixpkgs standard.

You do it like this:

  1. git rebase -i HEAD~6 (five commits plus one more back)
  2. It opens an editor (usually vi) with a list like this (the numbers will be different):
pick 12345 formatted, removed with lib
pick 23456 add aspauldingcode to contributors list
pick 34567 Merge branch 'NixOS:master' into cursor-add-platforms
pick 45678 Merge branch 'NixOS:master' into cursor-add-platforms
pick 56789 update cursor to 0.44.11, add multi-platform support, modify update sh
pick 67890 ...something else...
  1. First, edit the list to group all the package.nix edits together:
pick 12345 formatted, removed with lib
pick 34567 Merge branch 'NixOS:master' into cursor-add-platforms
pick 45678 Merge branch 'NixOS:master' into cursor-add-platforms
pick 56789 update cursor to 0.44.11, add multi-platform support, modify update sh
pick 23456 add aspauldingcode to contributors list
pick 67890 ...something else...
  1. Don't exit the editor yet. Notice how you're changing the maintainers list then working on package.nix? This is what you want. Now let's combine all the package.nix changes by changing "pick" (keep this commit) to "squash" (merge it into its parent, keeping all of the names):
squash 12345 formatted, removed with lib
squash 34567 Merge branch 'NixOS:master' into cursor-add-platforms
squash 45678 Merge branch 'NixOS:master' into cursor-add-platforms
pick 56789 update cursor to 0.44.11, add multi-platform support, modify update sh
pick 23456 add aspauldingcode to contributors list
pick 67890 ...something else...
  1. Now save it. You'll be asked to edit the commit message. Change it to a single entry: code-cursor: add multi-platform support. Save it. (If you're asked to edit the contributors message, change it to maintainers: add aspauldingcode)
  2. Look at git log to see if your commits now make sense. If they don't, you can run an interactive rebase again to fix it.

What's next

Extracting update.sh

Once you have this down to two commits in the right order, I'd like you to move update.sh into its own file (named update.sh). You then change the passthru setting from passthru.updateScript = writeScript "update.sh" '' to passthru.updateScript = ./update.sh and save this as a commit named something like "extract update.sh". You'll want to do an interactive rebase after that to swap your package.nix work on top of this.

Why? The whole derivation is getting a bit long and hard to read. We can simplify it by separating the update script into its own file.

Fixing the source version update

You'll want to construct all four URLs and their corresponding hashes as shell variables (example: L86URL="value") then call update-source-version code-cursor "$version" "$LX86HASH" "$LX86URL" --source-key=sources."x84_64-Linux and so on for the other three versions.

The goal is for this to be an "all or nothing" update -- either we get good downloads for all platforms on this version and do the update or we skip it for now.

Other than that, I'm confident the rest should be minor fixes.

P.S. We will also need to rebase this atop master again, but let's wait until you've done the steps above.

@aspauldingcode
Copy link
Contributor Author

git rebase -i HEAD~6 (five commits plus one more back)

Screenshot 2025-01-07 at 3 43 55 PM

for me I get this first

@sarahec
Copy link
Contributor

sarahec commented Jan 8, 2025

That looks like you're working in master. Did you remember to switch to your branch first? (git switch cursor-add-platform)

@aspauldingcode
Copy link
Contributor Author

The bottom left says I am in cursor add platforms branch

@sarahec
Copy link
Contributor

sarahec commented Jan 11, 2025

Apologies for the silence, I had a ghastly stomach bug.

Can you run this and let me know what you see?

git switch cursor-add-platforms
git log -n 8

This will show the last eight commits in the branch. (Here's the documentation: https://git-scm.com/docs/git-log)

@aspauldingcode
Copy link
Contributor Author

Can you run this and let me know what you see?

git switch cursor-add-platforms
git log -n 8
  ~/nixpkgs  ⎇ cursor-add-platforms ≡  zsh  git switch cursor-add-platforms
Already on 'cursor-add-platforms'
Your branch is up to date with 'origin/cursor-add-platforms'.
   ~/nixpkgs  ⎇ cursor-add-platforms ≡  zsh  git log -n 8
commit aaa1625d3ce3c0b9f973693b207a11128e78f63a (HEAD -> cursor-add-platforms, origin/cursor-add-platforms)
Author: aspauldingcode <[email protected]>
Date:   Tue Jan 7 14:34:45 2025 -0800

    formatted, removed with lib

commit 14b5340c91a129c6ac436eda6f8a21125b688bdf
Author: aspauldingcode <[email protected]>
Date:   Tue Jan 7 14:26:26 2025 -0800

    add aspauldingcode to contributors list

commit bfc3d5c74825e839497f7948509fbb533c8959d6
Merge: d95d8ffb9ac2 1944a966101b
Author: Alex S. <[email protected]>
Date:   Sun Jan 5 18:39:51 2025 -0800

    Merge branch 'NixOS:master' into cursor-add-platforms

commit 1944a966101bd15e055bf2d04378b96d0ed9f2bf
Merge: ecd810c4cc90 2567fe09866a
Author: Wael Nasreddine <[email protected]>
Date:   Sun Jan 5 18:19:25 2025 -0800

    build-bazel-package: added rm of extra local folders for toolchain configuration in latest bazel versions. (#370242)

commit ecd810c4cc90890229ef353a12fb384c47ee75c3
Merge: c14d641d9d72 4e5ba7e99710
Author: David McFarland <[email protected]>
Date:   Sun Jan 5 21:06:05 2025 -0400

    dotnet: improve language coverage of passthru.tests for dotnet sdks (#370789)

commit c14d641d9d72fe00ce1f85bffb090268920b9ab6
Merge: 8691f7f4e689 b412d42add9d
Author: Ryan Hendrickson <[email protected]>
Date:   Sun Jan 5 19:52:10 2025 -0500

    yakut: fix dependencies (#287779)

commit 8691f7f4e689ff0689e85f433db7af75060f1fc5
Merge: 4a1315c9e01a d059c2208db9
Author: Peder Bergebakken Sundt <[email protected]>
Date:   Mon Jan 6 01:51:52 2025 +0100

    lightburn: 1.6.04 -> 1.7.04 (#370314)

commit 4a1315c9e01a9ade21311e62115293b3edb02a73
Merge: 5a58822a1843 adf1393ce30d
Author: Ryan Hendrickson <[email protected]>
Date:   Sun Jan 5 19:46:33 2025 -0500

    libvisio: 0.1.7 -> 0.1.8 (#351035)
(END)

@sarahec
Copy link
Contributor

sarahec commented Jan 12, 2025

That looks good. One more check (a trick I just looked up):
git log master..cursor-add-platforms

This shows only the changes on your branch.

I'm assuming that this part is your branch:

commit aaa1625d3ce3c0b9f973693b207a11128e78f63a (HEAD -> cursor-add-platforms, origin/cursor-add-platforms)
Author: aspauldingcode <[email protected]>
Date:   Tue Jan 7 14:34:45 2025 -0800

    formatted, removed with lib

commit 14b5340c91a129c6ac436eda6f8a21125b688bdf
Author: aspauldingcode <[email protected]>
Date:   Tue Jan 7 14:26:26 2025 -0800

    add aspauldingcode to contributors list

commit bfc3d5c74825e839497f7948509fbb533c8959d6
Merge: d95d8ffb9ac2 1944a966101b
Author: Alex S. <[email protected]>
Date:   Sun Jan 5 18:39:51 2025 -0800

    Merge branch 'NixOS:master' into cursor-add-platforms

Can you run git log master..cursor-add-platforms for me to check the contents of your branch? It looks like you may have gotten master mixed into your branch.

(I'm trying to get us back to a place where you can combine the commits into two: adding yourself to the maintainers and the cursor-specific changes)

@sarahec
Copy link
Contributor

sarahec commented Jan 12, 2025

Since we're stuck struggling with git, and I would like to get you through the PR process (so you can see the whole thing), let's do this:

  1. Bring master up to date
  2. Create a new branch with just your edit to nix-maintainers.nix
  3. Submit it as a PR.
git switch master
git fetch upstream master
git checkout -b add-aspaulding

Then edit the maintainers file again (sorry), save it, and push your changes. Then create a PR from that and let me know about it so I can approve.

After that, we can finish the multi-platform support.

Also, I'm going to push some changes to code-cursor so the update script knows how to handle multiple platforms (with co-authoring credit to you) and it will help to have you in the maintainers file.

@aspauldingcode
Copy link
Contributor Author

Can you run git log master..cursor-add-platforms for me

https://paste.ee/p/iwoQNhNz

I think this is what happened:
I forked the nixpkgs repo
I made a change on master of fork
tried to revert that change on master of fork
then I made a branch
made changes to that branch
the whole thing was still messed up

should I maybe start over with a fresh fork? the only file I've changed is contributors and the cursor package

@aspauldingcode aspauldingcode closed this by deleting the head repository Jan 13, 2025
@aspauldingcode
Copy link
Contributor Author

#373489

@aspauldingcode aspauldingcode mentioned this pull request Jan 13, 2025
13 tasks
@sarahec
Copy link
Contributor

sarahec commented Jan 13, 2025

I think this is what happened: I forked the nixpkgs repo I made a change on master of fork tried to revert that change on master of fork then I made a branch made changes to that branch the whole thing was still messed up

should I maybe start over with a fresh fork? the only file I've changed is contributors and the cursor package

That would explain the state of the branch. The fresh fork is a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants