3 ms·
I'll give Nix another go, but I find it hard to just start scrapping things together. For example how would I create a dev environment for a simple Node app, ma
by exdsq 5y ago
I'll give Nix another go, but I find it hard to just start scrapping things together. For example how would I create a dev environment for a simple Node app, managing Yarn dependencies and connections with a postgresql db? These are the sorts of things I'd love tutorials on doing
- chriswarbo 5y agoI'm not a heavy Node user, but I do have a project which happens to use Yarn. Not sure if it's the best approach, but this is how I'm creating the node_modules folder: nixpkgs.yarn2nix-moretea.mkYarnModules { name = "my-project-deps"; pname = "my-project-deps"; version = "1.0"; packageJSON = ../package.json; yarnLock = ../yarn.lock; } I copy things around, invoke commands, etc. using `nixpkgs.runCommand`, which runs shell code (a lot like rules in Make). I'm not sure about postgresql, since I've not used it before: - You could use Nix to install the packages, and manage it yourself. That wouldn't be particularly different from non-Nix setups. - You could install it on NixOS by specifying these options in your config https://github.com/NixOS/nixpkgs/blob/release-21.05/nixos/modules/services/databases/postgresql.nix#L41 https://github.com/NixOS/nixpkgs/blob/release-21.05/nixos/mo... (they're also listed at https://nixos.org/manual/nixos/stable/options https://nixos.org/manual/nixos/stable/options but that page is slow). Of course, that requires NixOS (or a VM). - You could run it in a container/VM, e.g. like https://nix.dev/tutorials/integration-testing-using-virtual-machines https://nix.dev/tutorials/integration-testing-using-virtual-... but that seems a bit more advanced.
- exdsq 5y agoI appreciate the time you put into this response, thanks! I’ll give it a go