Live data from Hacker News

NixOS Linux

nixos.org

71–80 of 82 posts

Re: NixOS Linux

#71
post #9

The big idea in Nix is the view that the filesystem is like mutable memory in a programming language. You wouldn't give access to memory raw without any safeguards. (Typical package managers can just arbitrarily dump files or remove files) It takes a structured approach. Laying over a graph database on top of your filesystem which is read-only typically. This helps provide guarantees and also every application has it…

I find android way much simpler. On android every app has its own data and app directories, and you can uninstall, clear data or clear cache of apps safely. I know this method doesn't work out of the box with traditional desktop software that assumes a Unix like filesystem hierarchy. But Nix doesn't work out-of-the-box as well. I would be interested to know what other advantages Nix / GUIX bring in practical terms.

Re: NixOS Linux

#72

I played with NixOS and am willing to admit that it was too difficult. It's probably great for devops, but it's just slightly too rigid for my own personal use. Let me give an example: let's say you want to use xmonad on top of Plasma. NixOS doesn't have any simple way to configure that. You have the mutually exclusive options for one or the other, basically. I know Nix is powerful enough to do this, if I wanted to g…

> xmonad on top of Plasma I gave up on XMonad + Gnome before I switched from Ubuntu to NixOS 6-7 years ago. Does XMonad + KDE work? I would love to get such combos working in NixOS / home-manager. (We also need to bite the bullet and get X-less Wayland working properly. I think I might be tempted to plan everything out at once so we don't get conflicting refactors or too much complexity.)

Plasma (on X) generally works very good with other WM. Here's how to use i3: https://github.com/avivace/dotfiles

Re: NixOS Linux

#73
post #9

The big idea in Nix is the view that the filesystem is like mutable memory in a programming language. You wouldn't give access to memory raw without any safeguards. (Typical package managers can just arbitrarily dump files or remove files) It takes a structured approach. Laying over a graph database on top of your filesystem which is read-only typically. This helps provide guarantees and also every application has it…

I find android way much simpler. On android every app has its own data and app directories, and you can uninstall, clear data or clear cache of apps safely. I know this method doesn't work out of the box with traditional desktop software that assumes a Unix like filesystem hierarchy. But Nix doesn't work out-of-the-box as well. I would be interested to know what other advantages Nix / GUIX bring in practical terms.

Nix is far more than just an app with its own directory (Which is also the flatpack & snap approach):

A little not exhaustive list of features that Nix provides:

- Not only an 'app installer'. It is a fully feature functional build system where reproducible builds are guaranteed (This is unique with GUIX up to my knowledge) on any linux distribution. Safe-reliable distributed builds are also possible.

- Fine grain de-duplication of dependencies (libraries, frameworks) to save disk space

- Safe, unprivileged installation of binaries in a multi-user environment on a single machine.

- Atomic upgrade and rollback

- Allow multiple variations of the same package with different options & versions installed in parallel without any risk of conflict

- Solves definitively all ABI breaks problem you encounter on traditional package manager, even with shared library.

Re: NixOS Linux

#74

I played with NixOS and am willing to admit that it was too difficult. It's probably great for devops, but it's just slightly too rigid for my own personal use. Let me give an example: let's say you want to use xmonad on top of Plasma. NixOS doesn't have any simple way to configure that. You have the mutually exclusive options for one or the other, basically. I know Nix is powerful enough to do this, if I wanted to g…

> NixOS doesn't have any simple way to configure that.

It's been a long time since I last used XMonad, but wouldn't the following configuration suffice?

    services.xserver = {
      enable = true;
      displayManager.sddm.enable = true;
      desktopManager.plasma5.enable = true;
      windowManager.xmonad.enable = true;
    };
Even if there isn't an official NixOS option to configure things the way you want, you can always put whatever configuration you like with the "environment.etc" option. For example, the following configuration would create a file in /etc/example/example.conf with the line "name=value".

    environment.etc."example/example.conf" = ''
      name=value
    '';

Re: NixOS Linux

#75

I tried to use nixOS as a desktop system. Using a special command (nix-shell) whenever I needed to do development things (e.g. Rust builds) was not my idea of fun. Some other things, like overriding GDM's monitors.xml file, were pretty much impossible to do. Maybe it's better if you just use it as a base for servers / containers.

> Some other things, like overriding GDM's monitors.xml file, were pretty much impossible to do.

Quite the contrary. Nix makes it easy to override contents of files, even those that are part of a package. Some things to look for are: "mkForce" for NixOS modules; "override", "overrideAttrs", "symlinkJoin", and "meta.priority" for Nix packages.

Re: NixOS Linux

#76

I tried to use nixOS as a desktop system. Using a special command (nix-shell) whenever I needed to do development things (e.g. Rust builds) was not my idea of fun. Some other things, like overriding GDM's monitors.xml file, were pretty much impossible to do. Maybe it's better if you just use it as a base for servers / containers.

Has the container situation improved? Last time I looked (quite some time ago) I couldn’t find an official or community blessed container to base anything on.

A nix derivation can be converted directly into a docker image, you don't need a docker file at all. It's actually very simple and quite intuitive.

I wrote a blog post about doing this with python, but it's straightforward to generalise.

https://sotelo.dev/blog/nix-for-pythonistas

Re: NixOS Linux

#77
post #3

I've been using linux based operating systems for 20+ years and I decided to give NixOS a try recently. I had read the install was "difficult" but I found it very straightforward. The configuration system very easy to understand and work with. I think this is actually the perfect distro for a "one off" home server because configuration management is built in so it is easy to rebuild my server from the backup of a sin…

The install is "difficult" in the sense that there is no wizard-style installer like many other distros have. You can install e.g. Ubuntu or Mint without knowing what a disk partition is. You need to have at least some vague idea of what a disk partition is to install NixOS.

It's much easier than most manually-configured installs (e.g. gentoo) though, because pretty much everything other than partitioning the disks has a default, so you need to make fewer decisions at install time.

Re: NixOS Linux

#78
post #14

Earlier quoted context omitted.

> Using a special command (nix-shell) whenever I needed to do development things (e.g. Rust builds) was not my idea of fun. Funny you should mention that, because that's exactly what got me using Nix everywhere :). I've always hated installing tools and libraries globally—what if I need a different version for a future project?—so I like tools that sandbox as much as possible like virtualenv, cargo, cabal... etc. But…

Out of interest, how does this work if using something like Visual Studio Code or some other IDE?

Not who you're replying to, but I just launch the IDE from the shell. e.g. for running qtcreator:

  nix-shell -p qtcreator qt5Full gnumake gcc gdb cmake
If I need other libraries in there, I can add them to it. I don't use direnv/lorri, but I assume you would have to relaunch the IDE in the case of adding more dependencies, unless the IDE has nix-shell integration (like an emacs user mentions in a sibling comment).

I made a different way of setting up a development environment[1] that would probably work just as well for e.g. VSCode, that doesn't require restarting the IDE. I did this for lisp development, where dynamically loading libraries during development is fairly idiomatic; it took me about 15 minutes to write, and could probably be adapted for other IDEs as well.

1: https://git.sr.ht/~jasom/nix-lisp-dev/tree

Re: NixOS Linux

#79

Can anyone talk to if nixos can reasonably be used to run a desktop setup?

I run Nix on my workstation and on my laptop, and have been doing so for a couple of years.

Most of the issues I ran into were just nix being different from other distros I use, so I did have to relearn a few things.

The remainder of the issues are the sorts of things one runs into with a non-rolling release distro. For example, a program I use got a feature I want last September. I'm going to have to wait until March for it to hit stable, since NixOS is on a September/March biannual release schedule.

The good news is that I am running the latest version of that package just fine now; Nix lets you install "overlays" of the package system into your home directory (or globally), and I just copied the package definition into the overlay, updated the URL and SHA256 sum to point to the new version and it "just worked."

Downside of course is when I upgrade to NixOS 21.03 (the march release), I'll have to remember to remove my overlay version of the package, or I'll be frozen on that version. There may be some fancy way to work around this which I haven't discovered, but since I have like 1 or 2 packages in that state at any time, I just manually do it when I upgrade.

Re: NixOS Linux

#80

I played with NixOS and am willing to admit that it was too difficult. It's probably great for devops, but it's just slightly too rigid for my own personal use. Let me give an example: let's say you want to use xmonad on top of Plasma. NixOS doesn't have any simple way to configure that. You have the mutually exclusive options for one or the other, basically. I know Nix is powerful enough to do this, if I wanted to g…

Don't bother with NixOS then. Just use the nix package manager on Arch. You get declarative package management with nix shells, and you can take that configuration with you to any linux distro, or even macos. I think it's fantastic that we have a declarative, deterministic, idempotent package manager that works across all these OSs. I've used it happily for years now without ever bothering to try NixOS.

That's my other issue. Nixpkgs just isn't as rich as AUR. I'm willing to use mostly nix OR mostly pacman, but not some 50/50 split of both, which is what the current situation tempts. I'd be extremely pleased if there were some sort of adapter plugin that let nix manage external packages so that I'm not forced to choose.
Post reply on HN