News for hackers. Stuff that matters.
Re:Nix is the ultimate DevOps toolkit by chaorace on Friday April 09, 2021 @09:13AM (#26750105)
Agreed, but perhaps they should officially adopt home-manager then? It felt strange to me that the best way to be using nix was a separate community project.
Re:Nix is the ultimate DevOps toolkit by tnzm on Friday April 09, 2021 @09:16AM (#26750140)
I don't use nix-env or home-manager. On my NixOS workstation everything (outside of nix-shells) is installed via environment.systemPackages. And I do wish there was an easy way to add stuff to install packages without rebuilding the whole system - I guess that's what nix-env is for but if I went with that I would the "single editable config file that you can put in VCS" aspect. I think nix-env uses profiles, which are implemented collection of symlinks to the Nix store - guess I could still version those...?
Re:Nix is the ultimate DevOps toolkit by danieldk on Friday April 09, 2021 @09:38AM (#26750402)
Re:Nix is the ultimate DevOps toolkit by chriswarbo on Friday April 09, 2021 @09:42AM (#26750446)
You can define a package that contains a bunch of other things, e.g. I use packages like 'devCli', 'netGui', etc. (I actually put these in my systemPackages on NixOS and nix-darwin, but they would also work with nix-env)

http://chriswarbo.net/git/nix-config/git/branches/master/ove...

Re:Nix is the ultimate DevOps toolkit by otabdeveloper4 on Friday April 09, 2021 @10:44AM (#26751181)
At the moment the happy path for Nix is using it in the same space that Docker is used now - for providing reproducible dev/prod environments for server backends. (And in fact Docker and Nix complement and play nice with each other.)

You could theoretically use Nix for managing user apps too, but that's a niche use case and (as you found out) not in a working state.

Re:Nix is the ultimate DevOps toolkit by jpe90 on Friday April 09, 2021 @11:14AM (#26751547)
So for the happy path, are you declaring the entire development toolchain on a project by project basis? Any chance you have some recommended resources that show the way you're using it? I was hoping to use it for Haskell but I'd love to see a guide targeted to new users that shows what you're describing.
Re:Nix is the ultimate DevOps toolkit by otabdeveloper4 on Friday April 09, 2021 @03:07PM (#26754710)
Yeah, each project has its own default.nix that might look something like this:

    {
      pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/cd63096.tar.gz") { }
    } :
    with pkgs;
    let
      mypackage = callPackage ./mypackage.nix { stdenv = stdenv; python = python3; };
    in
    dockerTools.buildImage {
      contents = [ mypackage ];
    }
You then write a package definition in mypackage.nix, following the template of packaging things in nixpkgs.

(Dev environments work in a similar fashion except with mkShell instead of dockerTools.buildImage.)

I haven't used Nix flakes but I think it develops this simple idea further.