-
Notifications
You must be signed in to change notification settings - Fork 70
Add nix flake support #965
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
Conversation
|
Tagging our Nix experts here :) |
keegancsmith
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nix build worked for me. One inline comment about removing default.nix. We should probably follow-up with running nix-build in CI to prevent it breaking.
| flake-compat = { | ||
| url = "github:edolstra/flake-compat"; | ||
| flake = false; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'd remove default.nix and just rely on flake.nix. Then we can remove this input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keegancsmith I'm curious, what would be a downside of keeping default.nix to be compatible with non-flake nix usages? I haven't come across this topic yet so I would like to hear what you think and I can add my thoughts on that too if that's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im personally indifferent to this, but we're not using flake-compat in our main repo either (I believe we should all be using flakes and leaving the old ways behind :p )
|
Would love to have this, my main concern is whos going to keep it up-to-date. Itd need updating every time we bump sg/sg dependency. Alternatively I'm wondering whether we should use gomod2nix here instead? I dont really mind either way as im not overly affected, but it may be a tad more nix-y to have the deps individually entered into the store, but it does add an extra cli step (which is already necessary with vendor checksum, so im not sure what we should do 🤷 ) |
|
@keegancsmith about adding the build in CI, I just tested and you can see the result here - https://github.com/ryuheechul/src-cli/actions/runs/4611207337/jobs/8150611019. What do you think? Also would it be good idea to have this test already if nix build is not officially supported? Because broken build could annoy maintainers if they don't care about nix build. @Strum355 I think those are legitimate concerns and should be addressed for a long term viability. My assumption of that model is followings:
Therefore the burden can be contained in reviewing part only (at least as a start) |
I would probably not have that, as you mentioned because maintainers mightnt care about the nix build. I wish they would, i wish everyone at sourcegraph used nix, but thats not the case today 😄
That seems reasonable to me, I hate to have something that will regularly not work, but people can always pin to a known working version at least 🙂 |
|
@Strum355 thanks and applied the suggestions and tested it via code below! let
rev = "nix";
url = "https://github.com/ryuheechul/src-cli/archive/${rev}.tar.gz";
tarball = fetchTarball url;
at-contrib = tarball + "/contrib";
in
(import at-contrib).defaultSo when it's merged, people can do any of the examples below. # without flake
let
rev = "main";
url = "https://github.com/sourcegraph/src-cli/archive/${rev}.tar.gz";
tarball = fetchTarball url;
at-contrib = tarball + "/contrib";
in
(import at-contrib).defaultor # with flake
{
description = "src-cli flake";
inputs = {
# ...
src-cli.url = "github:sourcegraph/src-cli?dir=contrib";
};
# ...
}or # as a command
nix shell 'github:sourcegraph/src-cli?dir=contrib' -c src |
|
@burmudar how 2 make go-test action run |
Hmmm it's not triggering because it's a fork. I'll see what I can do |
|
@ryuheechul Could you please rebase once #970 is merged. It should fix the stuck action we're seeing on your PR 🙏🏼 |
Co-authored-by: Noah S-C <noah@santschi-cooney.ch>
Head branch was pushed to by a user without write access
|
Thanks for your contribution @ryuheechul! |
* Add nix flake support * Apply suggestions from code review Co-authored-by: Noah S-C <noah@santschi-cooney.ch> * Move nix files to /contrib --------- Co-authored-by: Noah S-C <noah@santschi-cooney.ch>
Currently I don't see src-cli is listed at https://search.nixos.org/packages, it would be nice to be able to install via Nix.
In the meantime, adding these nix files into this repo directly will allow installing via nix flakes similar to how it's done at https://github.com/ryuheechul/hexto256/blob/main/flake.nix.
Installation has been tested with a usage like this one, ryuheechul/dotfiles@4e7fb91.
Test plan
(added by @Strum355)
It was tested manually, and is not part of any critical path