# What's new in Nix 2.8.0 - 2.12.0? # TODO: - [ ] @tomberek @djacu @compare videos so that they match in: - resolution - placement of camera - 372.0000 px - 209.0000 px - share OBS settings - font size in terminal (nix run nixpkgs#gotty -- -w bash) - level of audio needs to be similar ``` nix run nixpkgs#gotty -- -w bash tmux docker run -ti nixos/nix:2.11.0 docker run -ti nixos/nix:2.8.0 export NIX_CONFIG='extra-experimental-features = nix-command flakes' ``` - [ ] @garbas provide dropbox place to share things - [ ] Plan the intro and outro and meet to record it (https://vdo.ninja/) - [x] @garbas reconstruct the intro/outro ## (0.5min) Intro - [dan]: Hi, I am Daniel Baker. Welcome to the next installment of the Nix release videos. This is a summary of several releases 2.8 through 2.12 - [tom]: My name Tom Bereknyei and I'm exicited to provide an introduction to the new features and progress for the Nix project overall. - [dan]: I hope you will find this visual walkthrough informative. Sadly, we are covering only the highlights of the mentioned releases. If we missed anything, please let us know in the comments below. - [tom]: there's a lot to cover, so let's get started ## 2.8.0, 2.8.1 ### (1min) `nix fmt` command @djacu New experimental command: `nix fmt`, which applies a formatter defined by the `formatter.<system>` flake output to the Nix expressions in a flake. examples in ~/nix/demo ``` nix fmt --help nix fmt cat file.nix {a=1;b=2;c=3;} nix fmt ./file.nix ``` ### (1min) impure derivations @tomberek: New experimental feature: *impure derivations*. These are derivations that can produce a different result every time they're built. Here is an example: ```nix stdenv.mkDerivation { name = "impure"; __impure = true; # marks this derivation as impure buildCommand = "date > $out"; } ``` Running `nix build` twice on this expression will build the derivation twice, producing two different content-addressed store paths. Like fixed-output derivations, impure derivations have access to the network. Only fixed-output derivations and impure derivations can depend on an impure derivation. In 2.12.0 <nix/fetchurl.nix> now accepts an additional argument impure which defaults to false. If it is set to true, the hash and sha256 arguments will be ignored and the resulting derivation will have __impure set to true, making it an impure derivation. * @tomberek Completions & Suggestions https://github.com/NixOS/nix/pull/6128 * Shell completion improvements * respect `--override-flake` * tilde expansion with flake fragments * follow symlinks * completions for `--update-input` https://github.com/NixOS/nix/pull/6216 * Add some suggestions to the evaluator https://github.com/NixOS/nix/pull/6244 * nix-env: Add a suggestion for when there's a name collision in channels ## 2.9.0, 2.9.1, 2.9.2 ### (2min) Debugger () @tomberek ## 2.10.0, 2.10.1, 2.10.2, 2.10.3, 2.10.4 ### (0.5min) nix search has a new flag --exclude to filter out packages. * @djacu ``` nix search nixpkgs requests nix search nixpkgs requests --exclude python nix search nixpkgs requests --exclude 'python|perl' ``` ### (0.5min) nix-portable * @tomberek On Linux, if /nix doesn’t exist and cannot be created and you’re not running as root, Nix will automatically use ~/.local/share/nix/root as a chroot store. This enables non-root users to download the statically linked Nix binary and have it work out of the box, e.g. - note, will not work on Darwin - grab a VM of Debian/Arch/etc and show how a user can try out Nix easily - does this work for users with wheel priviledges? - log in to a machine without priviledges ``` ls ~/.local/share/nix/root/nix/store ``` conceptually: `nix --store /home/tom/.local/share/nix/root` % ~/nix run nixpkgs#hello warning: '/nix' does not exists, so Nix will use '/home/ubuntu/.local/share/nix/root' as a chroot store Hello, world! n Linux, if /nix doesn't exist and cannot be created and you're not running as root, Nix will automatically use ~/.local/share/nix/root as a chroot store. This enables non-root users to download the statically linked Nix binary and have it work out of the box, e.g. # ~/nix run nixpkgs#hello warning: '/nix' does not exists, so Nix will use '/home/ubuntu/.local/share/nix/root' as a chroot store Hello, world! ### (0.5min) Trace verbose @djacu ``` [tom@tframe:~/nix]$ nix eval --expr 'builtins.traceVerbose "warning: hello!" 1' 1 [tom@tframe:~/nix]$ nix eval --expr 'builtins.traceVerbose "warning: hello!" 1' --option trace-verbose true trace: warning: hello! 1 ``` ## 2.11.0, 2.11.1 ## 2.12.0 * lots of documentations fixes * nix shell inside nix develop follows $SHELL -> https://github.com/NixOS/nix/pull/7010 This is not working, but maybe it should * Add Fish suport to the Nix installer #7014 ## Outro ### maybe do performance comparision between versions @tomberek will ask penne to maybe do it ``` chrt -f 10 \ taskset -c 1 hyperfine --warmup 2 --runs 20 \ taskset -c 2,3 nix eval --raw --impure --expr 'with import <nixpkgs/nixos> {}; system' ``` ### compare number of contributors between versions @garbas needs to find a scrript from last time rev range for -> 2.8.0: `69c6fb12eea414382f0b945c0d6c574c43c7c9a3...ad7c99ef20dff74a65d6c8ac2a2c42f538e0a1dd` 33 -> 2.9.0: `de13b445730e94a24690fed6480f86a5f9c102c8...ee57f91413c9d01f1027eccbe01f7706c94919ac` 37 -> 2.10.0: `d046eb1463fad967d47cc5becfe5b7a08b5adfa8...929ab5b195cb063f7f38e7d6aceb262aaabbeee0` 63 -> 2.11.0: `57cf36f81e4f00ed7c67f159f2de11978470563f...b0488a29dc7401e5ecd9221215da5ea9879e56d6` 1 -> 2.12.0: `08dcd22582d65e73f29df79b3765e76cea8f3314...0b25446f2e20233a32b67796eb776a2193866627` 53 ### Summer of Nix 2022 (Thank you NGI) a lot of bug fixes landed # Nix 2.12 - Linux builds are run in user namespace - uid-range system-feature - auto-allocate-uids - use-cgroups - nix build --json - builtins.readFile is better ## outro @tomberek: And that's the last feature for now. Yesterday was the release for 2.12 and is the last release scheduled for the year. This contains a large number of documentation and stability fixes. NixOS 22.11 release that just happened will have 2.11. The Nix repo itself will always have the latest releases available. As always, let us know if there are additional changes you are excitied about. Please "thumbs-up" any issues or PRs in the Nix repo to bring it to the attention of the Nix maintenance team. @dan: These releases would not be possible without all the hard work done by the contributors. We also want to thank the users for bug reports, example usages, ideas, and for making the Nix community a better place. Thank you! [tom+dan]: **Wave!**