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 for dev shell #30967

Merged
merged 15 commits into from
May 22, 2024
Merged

Add nix flake for dev shell #30967

merged 15 commits into from
May 22, 2024

Conversation

6543
Copy link
Member

@6543 6543 commented May 13, 2024

To try it you need nix installed nix-daemon running and your user has to be member of the nix-users group. Or use NixOS.

then by just:

nix develop -c $SHELL

a dedicated development environment with all needed packages will be created.

To try it you need **nix** installed `nix-daemon ` running and your user has to be member of the **nix-users** group. Or use NixOS.

then by just:
```sh
nix develop -c $SHELL
```
a dedicated development environment with all needed packages will be created.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 13, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 13, 2024
@6543 6543 requested a review from techknowlogick May 13, 2024 18:17
@jolheiser
Copy link
Member

This may as well just use eachDefaultSystem

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

we might also consider devbox, as we are already using it for tea https://gitea.com/gitea/tea/pulls/572

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 13, 2024
@6543
Copy link
Member Author

6543 commented May 13, 2024

it looks like devbox use nix anyway ?!?

@6543 6543 requested a review from jolheiser May 13, 2024 19:09
Copy link
Member

@jolheiser jolheiser left a comment

Choose a reason for hiding this comment

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

it looks like devbox use nix anyway ?!?

Yeah, it uses nix under the hood. As mentioned in that PR, it may (or may not) be beneficial for non-nix users as it abstracts over nix.

(I have no real preference, also as noted in that PR I'm more comfortable with nix than devbox so it's 🤷 to me)

flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
6543 and others added 2 commits May 13, 2024 21:26
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
@6543 6543 requested a review from jolheiser May 13, 2024 19:30
flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 13, 2024
6543 and others added 2 commits May 13, 2024 21:52
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
@silverwind
Copy link
Member

well I prefere to have them in here - but for now I can move them out

I'm happy to have them there as long as they are versioned. Unversioned is a problem. Ideally all dependencies should be versioned.

@jolheiser
Copy link
Member

Since we end up invoking them via go run I don't think it would make a big difference, probably fine either way. 👍

@silverwind
Copy link
Member

silverwind commented May 14, 2024

Is there a way to declare dependency versions ranges like go = ~1.22 in flake.nix, or alternatively have flake.lock picture the exact versions? It seems odd to me to have so many unversioned things when the whole point of nix seems to be to have reproducible dependencies.

@jolheiser
Copy link
Member

The flake.lock is what pins the version of nixpkgs. Anyone using this flake will get the same set of dependencies every time until/unless that input is updated.

@silverwind
Copy link
Member

silverwind commented May 14, 2024

The flake.lock is what pins the version of nixpkgs. Anyone using this flake will get the same set of dependencies every time until/unless that input is updated.

Ah, so a nixpkg is basically a snapshot/archive of all dependencies?

@jolheiser
Copy link
Member

nixpkgs refers to https://github.com/NixOS/nixpkgs and the flake.lock in this PR pins it to NixOS/nixpkgs@2057814

@silverwind
Copy link
Member

Some more ideas based on stuff in makefile:

  • gnused
  • python312
  • poetry
  • gzip

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

I'm happy that nix support for local dev is going in, so I won't block if it remains different than tea.

flake.nix Outdated Show resolved Hide resolved
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
@silverwind
Copy link
Member

Do we need to regenerate flake.lock now that we changed the buildInputs?

flake.nix Outdated Show resolved Hide resolved
@6543
Copy link
Member Author

6543 commented May 20, 2024

Do we need to regenerate flake.lock now that we changed the buildInputs?

No

Copy link
Member

@silverwind silverwind left a comment

Choose a reason for hiding this comment

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

I don't understand much on how this works but I hope you do 😆

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 21, 2024
@jolheiser jolheiser added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 21, 2024
@jolheiser jolheiser enabled auto-merge (squash) May 21, 2024 20:27
@jolheiser jolheiser merged commit de6f048 into go-gitea:main May 22, 2024
22 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone May 22, 2024
@6543 6543 deleted the add-dev-flake branch May 22, 2024 00:47
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 22, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 22, 2024
* giteaofficial/main:
  Add nix flake for dev shell (go-gitea#30967)
  [skip ci] Updated translations via Crowdin
  Fix wrong display of recently pushed notification (go-gitea#25812)
  use existing oauth grant for public client (go-gitea#31015)
  Fix automerge will not work because of some events haven't been triggered (go-gitea#30780)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants