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 nix flake #1908

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

fidgetingbits
Copy link
Contributor

Adds a flake I have been using for development on a Nix box, which I've confirmed works to run pre-commit linting, correctly installs plugins, can debug extension, etc.

Checklist

  • [-] I have added tests
  • [-] I have updated the docs and cheatsheet
  • [-] I have not broken the cheatsheet

flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
@pokey
Copy link
Member

pokey commented Sep 27, 2023

Sorry I'm not familiar with nix flake. What is this PR doing?

1 similar comment
@pokey

This comment was marked as duplicate.

@fidgetingbits
Copy link
Contributor Author

Nix flakes are basically packaging management files (written in the nix functional programming language) that projects can add that allow the nix package manager to automatically setup a shell environment of locked packages, without globally installing them. So basically someone can just activate the flake development environment and everything needed to develop/build is automatically installed there.

Assuming a project is something actually packaged like an installable tool, you can also have the flake describe how to build the package for you so you can install/run it. Not sure how that works for vscode extension installation in nix and didn't bother looking yet.

Nix is used for package package management by Mac (replacement for homebrew) and Linux users wanting fully reproducible environments, and also is what NixOS is centered around using.

I'm doing the cursorless hacking from a NixOS setup, so just threw it together and figured I'd send a PR in case it would be useful for other nix users that might hack on cursorless in the future. That said, I totally appreciate if you don't want to add this :D

flake.nix Outdated Show resolved Hide resolved
@pokey
Copy link
Member

pokey commented Sep 29, 2023

Reproducibility is my middle name. I'll have a look

@auscompgeek
Copy link
Member

I did try out this PR on x86 macOS, and it appears to work as expected, with the known caveat that if you run VSCode within a nix environment then the command server and Talon command client will fail to find each other.

I'll admit I didn't test it for too long though, and still need to check the pre-commit hook installed correctly (but that looks correct 😅)

@fidgetingbits
Copy link
Contributor Author

Is that known caveat detailed anywhere? Is it Mac specific? I don't have that problem on NixOS afaik, as I've been using talon/cursorless for the development.

The pre-commit hooks seemed to install for me and run fine when I sent the other PRs but definitely worth someone else verifying.

@auscompgeek
Copy link
Member

auscompgeek commented Sep 29, 2023

I noted it somewhere once I worked out the mismatching $TMPDIR was the issue. Might be mentioned in the talonhub/community issues.

Edit: here we are: talonhub/community#966 (comment)

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

I am going to completely defer to @auscompgeek to review this one, as I'm way out of my depth. I left one comment tho to give the appearance of being useful / competent 🤓

flake.nix Outdated Show resolved Hide resolved
@fidgetingbits
Copy link
Contributor Author

Since I just had to force push again (I seem to do this a lot in my PRs), I'm curious if someone can tell me the trick to merge upstream changes into the PR branch without it triggering like a thousand file updates? I don't seem to easily find an explanation of what I'm missing, but you folks presumably know. I do know about the button in the github interface, but presumably there is some "right" cli way

@auscompgeek
Copy link
Member

I think you're just seeing GitHub's eventual consistency behaviour? I see 1 commit with 3 files changed, which I presume is expected.

@fidgetingbits
Copy link
Contributor Author

I think you're just seeing GitHub's eventual consistency behaviour? I see 1 commit with 3 files changed, which I presume is expected.

Hrm, I'll look into what that is.

But in this case it's only the 3 files changed because I force pushed. I did a soft reset back to a shared commit with upstream, rebase, then apply a new commit with all my changes and force push.

@pokey
Copy link
Member

pokey commented Mar 11, 2024

@auscompgeek are you happy with this PR? As mentioned above I don't know enough about nix to be a competent reviewer here

flake.nix Outdated Show resolved Hide resolved
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.

None yet

3 participants