16 ms·
NixOS 18.03 Released
- malvosenior 9y agoI really want to love Nix and have installed it multiple times. It's non-standard file layout gets me every time though. Something as simple as `#!/bin/bash` not working is problematic for me. I also find that trying to install anything not included in the Nix package manager is pretty much impossible (building from source...). Please correct me if I'm Nix-ing wrong.
- tathougies 9y agoYou shouldn't be using /bin/bash anyway. The proper she-bang is '#!/usr/bin/env bash', which works on nix. The location of bash in /bin/ is actually not standard at all, despite some linux distributions doing that. In particular, the BSDs also do not have bash in /bin. This is why using '/usr/bin/env bash' is more portable
- wereHamster 9y agoBut is `/usr/bin/env` standard?
- satbyy 9y agoConversely, Python's PEP394 explicitly discourages `/usr/bin/env python`, so there's that. (I know why the PEP says so, just pointing out that it differs from Nix style)
- adamtulinius 9y agoThe PEP doesn't even mention /usr/bin/env. Look for yourself: https://www.python.org/dev/peps/pep-0394/ https://www.python.org/dev/peps/pep-0394/
- muxator 9y agoI've always mechanically written '#!/bin/bash' as my shebang for bash script, while I normally use '#!/usr/bin/env python' for python scripts. In retrospect, that sounds obviously incoherent. I would like to know if there is some common practice/standard around using '/usr/bin/env' in shebangs. Could you please elaborate more?
- eikenberry 9y ago> /usr/bin/env That won't work everywhere either as the location of 'env' is not a fixed standard either. Eg. In some *nix's its at /bin/env.
- pxc 9y agoWhat modern/surviving Unix-likes don't have even a symlink in `/usr/bin/env`? I'm not 100% sure on all of these, but every one of the dozens of Linux distros I've used has `/usr/bin/env`. macOS has it, and it looks like FreeBSD does, too, and so does NetBSD. Who are the oddballs? Does it include any of the free Unices?
- pxc 9y ago(I'm not trying to be shitty; I'd really like to know. I spent some time Googling about conventions for the `env` command, and examples of incompatible systems. The only ones I found were two old, proprietary Unices. I got tired of searching and was hoping someone who knows a few examples offhand could help me out.)
- eridius 9y agoIncidentally, macOS, whose CLI is derived from BSD, does in fact have /bin/bash.
- jbboehr 9y agoThere is a `/bin/sh` and `/usr/bin/env` provided - so you can use `/usr/bin/env bash`. There is also this function which may be necessary for certain software: https://nixos.org/nixpkgs/manual/#sec-fhs-environments https://nixos.org/nixpkgs/manual/#sec-fhs-environments You can compile some software manually in place using, for example, `nix-shell -p libssh2 -p zlib` without having to write a derivation. However, without writing a derivation, it may cease to function after a garbage collection or an upgrade. Writing a derivation isn't too bad, here's one for one of my repos: https://github.com/jbboehr/handlebars.c/blob/master/derivation.nix https://github.com/jbboehr/handlebars.c/blob/master/derivati...
- vertex-four 9y agoSure - you're Nixing wrong. Not to worry, it actually takes ages to figure out how to Nix right - there's not enough documentation on the matter. The correct way to get almost anything installed is to write a Nix package, and install that. This is actually remarkably easy in comparison to other package managers - you write the package definition in a single file, normally just having to set the source code location and list its dependencies, and you can make it available to install with nix-env by adding it to a packageOverrides declaration in ~/.config/nixpkgs/config.nix. The "stdenv" build system that nixpkgs uses will automatically install anything that can be configured via "./configure && make && make install" - cmake is supported just by listing that as a build dependency. Stuff written in scripting languages is more fiddly, but the nixpkgs documentation usually has examples. The downside is that a significant amount of the time, libraries written in scripting languages aren't packaged either, and you wind up packaging half a dozen libraries just to get some tool working. The <X>2nix tools can be useful in these cases to generate a package definition.
- malvosenior 9y agoThank you for the awesome reply (and everyone else). This is precisely the issue I have though: > The downside is that a significant amount of the time, libraries written in scripting languages aren't packaged either, and you wind up packaging half a dozen libraries just to get some tool working. I've gone down this path a few times and days later when I still don't have the original thing I wanted working installed, then I sort of give up. I realize there are many benefits to Nix and I really enjoy them but I've switched to using Arch for practical reasons. I really, really miss the declarative reproducible style though.
- vertex-four 9y agoWhat I wind up doing while developing is just creating a nix-shell with my native dependencies, and using pip/cargo/whatever inside that. It's not the "proper" way of doing things - you wouldn't want to install a tool long-term that way - but it's useful for one-off things or while you're playing around. I've used npm2nix and cargo2nix a couple of times with success - they generate package sets from the relevant sources.
- zimbatm 9y agoPlease don't down-vote criticism. This is a real feedback which I am sure applies to a lot of new-comers.
- mirap 9y agoCan someone explain what is NixOS designed for? (ELI5 please)
- k__ 9y agoReproducible OS setups. Like Docker, but it uses install scripts instead of layered images.
- agumonkey 9y agoand an actual solid language instead of a sequence of whatever
- aidenn0 9y agoAnd it does a lot more work to prevent you from shooting yourself in the foot. Docker scripts that e.g. clone a remote and build from the HEAD are not reproducible. Another example would be downloading fancysoftware-latest.tgz Nixos will have you either pull from a specific git commit, or will hash the sources, so the default behavior is reproducible.
- nextos 9y agoReproducibility. In a nutshell, it's a purely functional Linux distribution. That means all changes you make to your system are non-destructive. For example, you can always roll back to a previous OS state, which is represented by a hash computed from all packages installed, and all options you've set. In turn, package hashes are computed from the package sources and all inputs (buildtime and runtime package dependencies).
- mwexler 9y agoEach time I hear about NixOS, I am immediately thankful that someone modernized the underlying OS for Nixie clocks (http://nixieshop.com/ http://nixieshop.com/). Then I come back to reality.
- jbboehr 9y agoBrings a bunch of fixes to building Rust packages, and it can even be used with the Rust nightly from the Mozilla nixpkgs overlay like this: let defaultPkgs = import <nixpkgs> {}; defaultRust = defaultPkgs.latest.rustChannels.nightly.rust; defaultCargo = defaultPkgs.latest.rustChannels.nightly.cargo; defaultBuildRustPackage = defaultPkgs.callPackage (import <nixpkgs/pkgs/build-support/rust>) { rust = { rustc = defaultRust; cargo = defaultCargo; }; }; in { pkgs ? defaultPkgs, rust ? defaultRust, buildRustPackage ? defaultBuildRustPackage }: pkgs.callPackage ./derivation.nix { inherit rust buildRustPackage; }
- adamtulinius 9y agoRunning it locally. Looking forward to switching our K8s cluster to 18.03. Contact me if you want to work with NixOS and K8s in Denmark/Copenhagen. Mail on profile page.
- a012 9y agoI was tempting to install NixOS on my PC but found out their installation method is fully involved of dozens of manual steps [1]. And I feel exhausted just reading their guide, so I don't want to try at all. 1 - https://nixos.org/nixos/manual/index.html#sec-installation https://nixos.org/nixos/manual/index.html#sec-installation
- fhood 9y ago> The NixOS installer doesn’t do any partitioning or formatting yet, so you need to do that yourself. Use the following commands: Wow, you are not kidding. Edit: I could swear this comment was originally replying to someone.
- Froyoh 9y agoConfiguring your partitions and storage is scary and dangerous
- adamtulinius 9y agoOn the flip side a friend of mine can literally reinstall her OS from backup in about 15 minutes, including all applications and their configuration.
- adamtulinius 9y agoWoops, was meant as reply to the GP.
- nextos 9y agoWhy? It's very simple. But if you're afraid of CLI tools, you can always partition with GParted.
- peller 9y agoTo each their own I guess. I strongly prefer their method. It let's me set up my system exactly how I want without having to fight with some GUI installer to make sure it doesn't do anything stupid. And hey, you might even learn a thing or two about how an OS works - partitions, boot loaders, init systems, it's all really quite important to understand when things go wrong and you need to recover your system manually.
- xelxebar 9y agoIn this vein, are there some people here who use Guix as their daily driver? I'd be interested in hearing experiences, comparisons, etc. I have both nix and guix stores on my (voidlinux) system just trying them out. Package availability seems quite different between the two, and guix feels like it's heavier or slower, but I am biased to guix's shepard instead of systemd.
- jbboehr 9y agoNot what the OP asked, but: Initially, I really wanted to use Guix over Nix, but Nix is more mature with more packages, maintainers, and features. Last I checked, for example, there was no equivalent of a channel or overlay in Guix. Their npm importer was also not released, whereas Nix has a very usable node2nix. Having done virtually no functional programming, learning Guile Scheme was also a barrier to me, but the Nix expression language felt a lot more natural for whatever reason. It's unfortunate - I'm very interested in the work in reproducible builds and substitutions Guix has done, maybe it'll take off at some point or those features will be integrated into NixOS.
- ymse 9y agoGuix has an overlay facility called $GUIX_PACKAGE_PATH[0]. Packages found there will take precedence over distribution packages. As an end user you don't really need to know Scheme. The OS configuration and package definitions are very "DSL-like", but you do have the full power of Scheme available. [0] https://www.gnu.org/software/guix/manual/guix.html#Package-Modules https://www.gnu.org/software/guix/manual/guix.html#Package-M...
- deleted 9y ago[deleted]
- rekado 9y agoI use GuixSD on all my systems---servers, workstations, laptops. I also use Guix on a 200+ node bioinformatics HPC cluster at the institute where I work.
- bogomipz 9y agoI am curious how or where NixOS fits in a a cloud or IaaS environment. I feel like AMIs and containers address the reproducible builds problem and blue/green deploys the rollback issue. Could NIXOS still be complimentary in an AWS/AMI environment?
- hollerith 9y agoYou can have thousands of packages in a single Nixos installation and if 200 of those packages directly or indirectly depend on some library L, you usually only need one copy of L to fulfill those 200 dependencies. In contrast, if you put each package in its own container or VM, then you end up with 200 copies of L. So, the different technologies have different strengths and weaknesses. One weakness of Nix is that it is harder for most people to learn or to understand than containers or VMs are. Some people use Nix or Nixos as part of their process for building containers or VM images. (I wonder whether there is any build system that uses containers instead of file names containing cryptographic hashes (like Nix does) or chroots (like Arch Build system does) to "enforce package isolation" during building.)
- bogomipz 9y agoThanks for the replies and the links. Makes sense. Cheers.
- Nullabillity 9y agoYes. NixOS can be set up to output a ready-to-run AMI with your customizations, as well as any other kind of image. For example, there are official binaries at https://nixos.org/nixos/download.html https://nixos.org/nixos/download.html, which I believe are built by https://github.com/NixOS/nixpkgs/blob/master/nixos/maintainers/scripts/ec2/create-amis.sh https://github.com/NixOS/nixpkgs/blob/master/nixos/maintaine.... You can then either replace the images as needed, or redeploy in place. NixOps can also automatically create and destroy EC2 VMs, EBS disks, and so on for you, based on your NixOS config. NixOps also makes it very easy to set up a local copy of your network using Virtualbox. Personally I use a common baseline image that is preseeded with my SSH key, and then deploy whatever setup I need using NixOps. You can read more about that approach at https://nixos.wiki/wiki/Virtualization_in_NixOS https://nixos.wiki/wiki/Virtualization_in_NixOS.
- theonemind 9y agoImmutability seems like the best thing for a package manager. Do any other packaging systems have interesting “killer features”? I’ve heard of PiSi for Pardus, and Conary for rPath/Foresight, but honestly, I can’t quite keep track of the state of the art.
- WindowsFon4life 9y ago"OS" is so misleading.
- colemickens 9y agoHow's that?