Comment

Comment by lloeki

> how painful was it to learn and get working?

nixpkgs (which you can use on macOS or any Linux distro), quite little, you can get up to speed in 15min as a Homebrew replacement:

    nix-env -qas ruby             # 'q'uery 'a'vailable 'search'
    nix-env -I ruby.              # install by package name (not recommended)
    nix-env -iA nixpkgs.ruby_3_0  # install by "attribute", recommended
    nix-env -q                    # 'q'uery (i.e list installed)
    nix-env -e ruby               # uninstall (like deleting a git ref)
    nix-env -q
    nix-collect-garbage           # cleanup, like `git gc`
    # etc...
And as a general purpose virtualenv/rvm/whatever replacement:

    $ cat shell.nix
    {
      pkgs ? import <nixpkgs> {}, # you can have multiple of these with different names to have e.g a mix of stable and unstable
    }:
    let
      openssl = pkgs.openssl; # just an example of how to set a var
    in pkgs.mkShell {
      buildInputs = [
        openssl
        pkgs.ruby_3_0 # or reference attires directly
      ];
    }
    $ nix-shell
    (nix) $ ruby --version
    ruby 3.0.1p64 (2021-04-05) [x86_64-darwin17]
    (nix) $ openssl version
    OpenSSL 1.1.1k  25 Mar 2021
    (nix) $ exit
    $ openssl version # back to the system one
    LibreSSL 2.8.3
That way it's immediately useful and you can dig in deeper into the concepts as you go, if you want to.

NixOS, it's barely different, only generalised to the whole OS, but it's a bit tougher, because there's this abstraction via configuration that generates e.g systems files or other configurations that you'd operate with directly otherwise on a traditional distro. But the minute you screw things up, having the generation selector to pick and boot on straight in the boot loader you can see the absolutely unparalleled value of the proposition.

parent lloeki 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton