bkkhack / hacknights

A meta-repository for finding hack night birds-of-a-feather and tracking what we learn.
https://waffle.io/bkkhack/hacknights
15 stars 4 forks source link

Learn and refactor some Nix expressions #155

Closed b123400 closed 8 years ago

b123400 commented 8 years ago

Nix is a pure functional package manager, I am trying to learn the language configure my NixOS server with it

ches commented 8 years ago

I believe @jean has some experience with Nix and @aljones15 with NixOS, if you didn't find them already they can probably help :smiley:

b123400 commented 8 years ago

Wow cool! Not sure where can I them... I am sitting at table orange! (No permission to move card)

aljones15 commented 8 years ago

hey I have not done a full build script like you have, but I have done plenty of dev enviroments and what you seemed to have been asking for a dev env. To be honest I don't think I'm anywhere near your level, but is there a tutorial or any documentation you used to construct that nix build script? the dev enviroment stuff is here: https://nixos.org/wiki/Development_Environments

I have one for python2, python3, lein / clojure, scala, node and a few others. I just use a default.nix file and then do nix-shell inside the dir. anyways if you have any resources I could use to learn the nix build scripts the way you do that would be awesome. I would love to be able to make build scripts and contribute to nix's packages.

b123400 commented 8 years ago

I mainly followed the Nix manual to learn the syntax / language and how to build a simple package, but that is too simple for any deployment. The most useful "tutorial" I have is actually searching on Github and see how others did it, this github repo taught me how to setup a ghost blog with npm dependencies properly setup, and here's my configuration if you are interested :)

For writing build script, there are some utility functions in nixpkgs that handle common scenario pretty well, and code sample can be easily found on Github with search query like this~ https://github.com/search?q=buildStackProject+language%3Anix&type=Code

I also find this blog post useful for understanding how configuration on NixOS works.


I am not sure if I am looking for development environment. In nix-shell, you can read/write files to wherever you want, for example stack build can download and cache codes somewhere, the files will be available next time. However in a build environment, the derivation is not allowed to read/write files to a path outside the build or output folder. I am not sure how is it enforced, but I once tried to write a file to /root/foo for debug purpose, it stops me with an error like `impure path detected". Without caching means really slow deployment, development is fine though.

aljones15 commented 8 years ago

thanks for the help and good luck. yeah I haven't had any issues with writing. I will look into the links provided! Thanks. Andrew

scherrey commented 8 years ago

Is there a Nix based distro that does not use systemd? If so I would very much like to give it a shot. I know you can put Nix anywhere but I'd really like to find a distro where it is core and not bolted on but also does not use systemd.

thanx,

-- Ben

aljones15 commented 8 years ago

scherry try asking in nix chat. you want it to use openrc then?

https://nixos.org/nixos/support.html

scherrey commented 8 years ago

Yeah I just asked in irc. I don't care what the alternative init system is so long as it is not systemd. Right now I run funtoo because it has a configuration that completely eliminates systemd. I don't recommend it for the faint of heart however. Keeping the system stable through source upgrades is quite painful. Nix would certainly help address that.

jean commented 8 years ago

I think Asko Soukka's posts on Nix are very interesting: http://datakurre.pandala.org/search/label/nix See e.g. http://datakurre.pandala.org/2015/07 announcing https://github.com/datakurre/collective.recipe.nix for deriving Nix packages from Python egg definitions.

jean . .. .... //\oo///\

jean commented 8 years ago

Guix uses "GNU Shepherd"

It isn't based on Nix, it's a parallel implementation of the same concepts, using Guile.

On Fri, Oct 28, 2016 at 3:32 PM, Ben Scherrey notifications@github.com wrote:

Is there a Nix based distro that does not use systemd? If so I would very much like to give it a shot. I know you can put Nix anywhere but I'd really like to find a distro where it is core and not bolted on but also does not use systemd.

thanx,

-- Ben

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bkkhack/hacknights/issues/155#issuecomment-256865806, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFLQN3I_0Z4dVBp1MmT7IChyJt-36ngks5q4bMlgaJpZM4KiU9e .

jean . .. .... //\oo///\