Home Explore Blog CI



nix

2nd chunk of `doc/manual/source/release-notes/rl-1.9.md`
ae61ad79176ffa20cc470051da72cfea96287ee802257d610000000100000875
            with import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-14.12.tar.gz) {}; …
        
        (This is not allowed in restricted mode.)

  - `nix-shell` improvements:
    
      - `nix-shell` now has a flag `--run` to execute a command in the
        `nix-shell` environment, e.g. `nix-shell --run make`. This is
        like the existing `--command` flag, except that it uses a
        non-interactive shell (ensuring that hitting Ctrl-C won’t drop
        you into the child shell).
    
      - `nix-shell` can now be used as a `#!`-interpreter. This allows
        you to write scripts that dynamically fetch their own
        dependencies. For example, here is a Haskell script that, when
        invoked, first downloads GHC and the Haskell packages on which
        it depends:
        
            #! /usr/bin/env nix-shell
            #! nix-shell -i runghc -p haskellPackages.ghc haskellPackages.HTTP
            
            import Network.HTTP
            
            main = do
              resp <- Network.HTTP.simpleHTTP (getRequest "http://nixos.org/")
              body <- getResponseBody resp
              print (take 100 body)
        
        Of course, the dependencies are cached in the Nix store, so the
        second invocation of this script will be much faster.

  - Chroot improvements:
    
      - Chroot builds are now supported on Mac OS X (using its sandbox
        mechanism).
    
      - If chroots are enabled, they are now used for all derivations,
        including fixed-output derivations (such as `fetchurl`). The
        latter do have network access, but can no longer access the host
        filesystem. If you need the old behaviour, you can set the
        option `build-use-chroot` to `relaxed`.
    
      - On Linux, if chroots are enabled, builds are performed in a
        private PID namespace once again. (This functionality was lost
        in Nix 1.8.)
    
      - Store paths listed in `build-chroot-dirs` are now automatically
        expanded to their closure. For instance, if you want
        `/nix/store/…-bash/bin/sh` mounted in your chroot as `/bin/sh`,

Title: Nix Release 1.9 - Continued Improvements to Nix-shell and Chroot Support
Summary
Nix release 1.9 enhances `nix-shell` with a `--run` flag and functionality as a `#!`-interpreter for dynamic dependency fetching. Chroot builds are improved with support on macOS, universal usage for all derivations, private PID namespaces on Linux, and automatic expansion of store paths in `build-chroot-dirs`.