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 as a installation method #4185
base: main
Are you sure you want to change the base?
Conversation
814dda0
to
e8651e9
Compare
@@ -70,7 +70,7 @@ $sf-floating-input-padding-y: $input-padding-y * 2 !default; | |||
background-color: $input-bg; | |||
padding: 0 0 0 $sf-floating-input-padding-x; | |||
margin-top: $input-border-width; | |||
margin-left: $input-border-width * 2; | |||
margin-left: calc($input-border-width * 2); |
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.
Idk why but sassc is very unhappy unless the line is fixed,
Creates a flake.nix and makes minimal changes to Gemfile.lock to allow usage of `nix develop` to run the project. feat: add docs feat: add helper commands Add `update-deps` command to regenerate `gemset.nix` with gem updates and run usual update commands. Add `setup-db` command to run initial db setup and migration commands. fix: test db setup
My main concern with this (as with the Docker setup) is that each of these that we add in adds additional files to the base directory (which can be overwhelming to new devs) and gives us the illusion that we are officially supporting these installation methods. So if we change the Ruby version, gems, etc. we would have to update these files - but you're the only one who knows how to do that. And if we don't do that, we have an installation method that becomes outdated and loses its value. I wonder if it would make more sense to have this available in the Wiki or docs rather than living in the codebase itself. |
(nods) Getting good advice on how to set things up if you aren't running our core supported environment is definitely something we want, and/but D's right -- if we can't sustain it, it'll be counter-productive in the long run. If we could get a write-up into the wiki about this, though, with a pointer from the read me, and a caveat as to the date it was written -- that would be a goodness! |
This is gonna be kind of a long answer but I want to address all the point since they are definitely valid. General ThoughtsOverall, I can't disagree with the point that any feature you add becomes a support burden. Which is especially concerning when it's a feature you don't have the bandwidth to learn about. That said. I think the impact of any feature like this depends on size of surface area of it's interface. This is a super advanced form of setup that few people will use, so even if it goes out of date the impact will be low. Furthermore, pretty much anyone setting up the repo with Nix probably has the skills to troubleshoot issues. I feel like as long as this is kept away from the casual user it really isn't an issue. Call it unofficial install methods or something. Maybe don't even link to it off the main readme. Why not just give it a shot? Worst case scenario if it gets stale you can just pull it later (I don't think this will be an issue at least until node18 support ends in 2025). All this really needs to be is a few lines added to Specific ResponsesBase Dir pollution
The only file that really needs to be added to the base directory is Also not trying to challenge the statement but out of curiosity is it really that common for new people to be confused by the stuff in the main dir? I feel like there is so much config stuff in there already that 1 file more or less won't affect much. Illusion of Support
What if we either don't include a documentation page for it or mark it as an unofficial install method? Docker Concerns
I actually think there is a massive difference between this and Docker. Nix requires much less compared to the Docker setup because it doesn't have to deal with nearly as many networking shenanigans. If you compare this PR to the docker one, this one doesn't change any of the specs, configs or database.yml. Pretty much all the changes are sequestered to Versioning
This Nix setup uses Gemfile.lock as its source of truth so it would auto-update. Why not throw this in the wiki somewhere?
Technically, this could be done. It does create a large amount of friction because nix wants all files to be in the Git index before it will use them. You end up with this really annoying flow of staging the nix stuff then un-staging it for every commit. |
Just cherry-picking a couple of comments:
The point is we aren't going to know if it's stale or not, and we likely wouldn't think of pulling it.
And if you say that line 15 times, you end up with 15 more files 😁 The point is that if we have Docker-related files, Nix-related files and setup files that use neither, you get more options but also more confusion. Anything that lives in the repo (regardless of how "official" it is) is findable and hence adds to the cognitive load of figuring out how to run the app. And if we don't document it, people will look at it and have no idea why it's there or when/if it's safe to get rid of. Just doing some googling... is there no way to get out of the requirement to have the files in the index? Not 100% sure what this is, but would it help? https://github.com/hercules-ci/gitignore.nix |
Nah. Unfortunately this does the opposite, makes the flake look at less files not more.
It's kinda hard to get phrasing right over text so I was probably unclear. My original comment was more of an aside where I was wondering how often that situation occurs. Like how often does someone say something like: "Hey why is there a Procfile and a Profile.dev"?
That's a very valid point. |
I don't think we've got any statistics, obviously. But I think the important thing to keep in mind is that HE is a very newbie-centric repo - many if not most of our contributors are very junior. Hence why I would err on the side of keeping things clean and simplified rather than giving us more options that would largely benefit more senior developers. Nix being so closely tied to the git repo seems like a very odd decision... wonder if there's some git magic we can do to make your own workflow not quite so painful. |
That is a valid point. I believe that is mainly tied to Nix flakes vs derivations, flakes being newer, more performant but technically unstable. I should explore doing this as a derivation, maybe the workflow becomes easier. 2 followup questions:
|
|
I want to test the setup with nix, since it can be beneficial for me in the long run. Will try to do it in 2-3 months. I think devs with windows os are more prone to set up nix, since it can abstract a bit of the mess when using Linux from wsl. |
I've never used it with WSL. Only as a Linux os/ package manager. If you go whole hog and use it as an OS there are sooo many foot guns. I don't think Ruby is necessarily the best environment for it. I also in general think that this project is a bit of a poor choice for nix (this project takes a potential JavaScript dependencies and uses gems to provide them. The installation of those gems can be a pain in the ass sometimes). I was mainly setting it up for personal use because I have a laptop that wouldn't be able to run it otherwise. Not trying to discourage you. But just warning you that it makes you want to pull your hair out sometimes. On the other hand, sometimes you're missing a dependency and you literally put one line of code in your config file and everything's fixed. |
This works locally for me. I will be dog-fooding it for a bit. But I think its a nice additional method of setup with minimal work and dependencies. I also use NixOS on one of my PCs so I kind of want this. :)
Description
Nix is a cross-platform package manager. It employs a model in which software packages are each installed into unique directories with immutable contents. These directory names correspond to cryptographic hashes that take into account all dependencies of a package, including other packages managed by Nix.
Type of change
Nix
If you have Nix installed you can use the flake.nix configuration file located at the root of the project to build and develop within an environment without needing to install
rvm
,postgresql
or other tools separately.The environment also uses the
gemset.nix
file to automatically download and install all the gems necessary to get the server up and running. This means you will not need runbundle exec
or anybundle
commands.INSTRUCTIONS:
~/.config/nix/nix.conf
or/etc/nix/nix.conf
:cd
into human-essentials.env.example
to.env
and set correct valuesnix develop
and wait for the packages to be downloaded and the environment to be builtupdate-deps
to updategemset.nix
The database will be created when running
nix develop
for the first time. If you did not set up your.env
and database creating failed you can runsetup-db
or userails db:
commands.This will run on Linux and macOS.