1. 44
  1.  

  2. 7

    Similarly: some commands are invoked like nix run, some are nix-shell. I don’t know why.

    In case anyone is wondering, this is two generations of nix. nix-shell, nix-build and friends are the old commands, but they’re still around because the nix 2 commands, nix build, nix run, etc. are still experimental and incomplete. I believe that the nix build style are intended to replace the others, but only once all they cover all the functionality available in the older commands and people are happy with the interface they present. Judging by the length of time since the initial nix 2.0, it’s not super high priority and/or they want to make sure it’s right.

    1. 4

      Prepared to get moldy produce thrown at me for lacking “power user” cred, but — does anyone have a “friendly” UI for managing this stuff? At least the basics of it? Might be difficult to make since it’d be over a Turing-complete language, of course; but it might be a nice way to ease into the NixOS world and also to learn about it by watching what the UI changes in the underlying files.

      1. 6

        I haven’t tried it out, but https://github.com/pmiddend/nixos-manager looks very promising!

        1. 1

          define “friendly” * genuinely curious as a daily NixOS user

          1. 1

            Something like the nixos-manager that infinisil posted looks to be exactly what I had in mind. I’m curious to dabble some with NixOS because it just seems so obviously “the way things should be” but I’m not motivated at the moment to pour days of learning into it.

        2. 2

          Personally, my current sweet spot is Nix + home-manager on Ubuntu (or OSX). This way whatever I want, I can first try pulling from Nix, but if not available, I can easily fall back to apt-get (or brew). And with home-manager, my dotfiles are now easily shared between multiple machines (except Windows ones, unfortunately). Though I do recognize the issue with “slow feedback loop on editor config tweaking”. In my case, I guess my vim config is comfortable enough, and I’m used to it enough, that I’m not modifying it too often nowadays.

          I do however sorely miss managing services etc. with Nix when I’m on Ubuntu. As such, I currently want to try and experiment if I can get anywhere with using parts of NixOS over other Linux distros.

          I’m also happy to see that some of the common issues with Nix are starting to get recognized and acknowledged (as a notable breakthrough, apparently the Nix docs were recently migrated to Markdown!); though how much time will pass until those observations bear real fruit is yet to be seen.

          All in all, from what I see, I’m starting to get this exciting feeling that Nix is slowly gaining some momentum, and I’m noticing some super interesting undercurrents; though to make it clear, it’s still this kind of, somewhat hard to put in words, “early stage momentum among not-yet-mainstream technologies”. But as much as I was not so sure about this before, I’m starting to think it is now orienting in a direction that may lead it to a breakthrough into mainstream eventually. (I mean, not necessarily the Java/C# kind of mainstream — more like the Go language kind of mainstream: i.e. the point where some Java/C#-mainstream people notice it enough to start calling it “some newfangled fringe technology”…)

          1. 2

            I wonder if it really makes sense to use home-manager for single user systems? Or rather, I haven’t tried this, I think it actually doesn’t make sense, and I wonder if folks can confirm/reject my suspicions.

            My understanding is that home-manager achieves two somewhat orthogonal goals:

            • First, it manages user-packages (as opposed to system-wide packages)
            • Second, it manages dotfiles

            Using home manager, you can install packages without sudo, and they will be available only for your user and won’t be available for root, for example. I think this makes a ton of sense in multi-user systems, where you don’t want to give sudo access to. But for a personal laptop, it seems like there’s little material difference between adding a package to global configuration.nix vs adding it to home-manager’s per-user analogue?

            For dotfiles, the need to switch configs to update them seems like it adds a lot of friction. I don’t see why this is better than just storing the dotfiles themselves in a git repo and symlinking them (or just making ~ a git repository with git clone my-dotfiles-repo --separate-git-dir ~/config-repo trick).

            Am I overlooking some of the benefits of home-manager?

            1. 6

              Post author here! I find it conceptually nicer to be able to shove most of my config in my ‘per-user’ configuration, as opposed to a bunch of separate dotfiles that I then have to manage the symlinking for myself.

              The friction is definitely a downside, but most of my config I update infrequently enough that it doesn’t matter, and a lot of programs will have a “use this as the config file” option; my mechanism for tweaking kitty is to grab the config file path by looking at ps, copy it into /tmp/kitty.conf, run kitty -c /tmp/kitty.conf until I’m happy, then copy my changes back into my config.

              I do agree that doing per-user installation isn’t super useful on a single-user system. This is why I have /etc/nixos owned by my non-root user, so I don’t have to sudo every time I want to edit it (though I do still have to sudo to rebuild the changes).

              1. 2

                I would like to thank you for the post, I’m totally copying the autorandr and awesome setup (and a bunch of other things too =])

              2. 4

                What is neat with managing dotfiles with Nix is to be able to reference derivations. You need to run autorandr as part of script? Just say ${pkgs.autorandr}/bin/autorandr and it won’t clutter your path.

                1. 2

                  My understanding is that home-manager achieves two somewhat orthogonal goals:

                  As @vbernat said, they are not completely orthogonal, since you can refer to files in (package) output paths in configuration files, which is really nice.

                  I think this makes a ton of sense in multi-user systems, where you don’t want to give sudo access to. But for a personal laptop, it seems like there’s little material difference between adding a package to global configuration.nix vs adding it to home-manager’s per-user analogue?

                  For me, the large benefit is that I can use home-manager on both NixOS and non-NixOS systems. E.g., in my previous job I used several Ubuntu compute nodes. By using home-manager, I could have exactly the same user environment as my NixOS machines.

                  1. 2

                    home-manager has a complexity cost so that needs to be weighed in for sure.

                    Typically the vim config can get complicated because it has to be adjusted to work between various environments. Since home-manager provides both the package and config, this is much simplified. I remember having to tune vim constantly before.