Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
base: d6773a361b04
Choose a base ref
...
head repository: NixOS/nix
compare: 888950e408a5
Choose a head ref
  • 16 commits
  • 15 files changed
  • 5 contributors

Commits on Jan 23, 2020

  1. installer: Handle edge case where the nix-daemon is already running o…

    …n the system
    
    On a systemd-based Linux distribution: If the user has previously had multi-user Nix installed on the system, removed it and then reinstalled multi-user Nix again the old nix-daemon.service will still be running when `scripts/install-systemd-multi-user.sh` tries to start it which results in nothing being done and the old daemon continuing its run.
    
    When a normal user then tries to use Nix through the daemon the nix binary will fail to connect to the nix-daemon as it does not belong to the currently installed Nix system. See below for steps to reproduce the issue that motivated this change.
    
    $ sh <(curl https://nixos.org/nix/install) --daemon
    
    $ sudo rm -rf /etc/nix /nix /root/.nix-profile /root/.nix-defexpr /root/.nix-channels /home/nix-installer/.nix-profile /home/nix-installer/.nix-defexpr /home/nix-installer/.nix-channels ~/.nix-channels ~/.nix-defexpr/ ~/.nix-profile /etc/profile.d/nix.sh.backup-before-nix /etc/profile.d/nix.sh; sed -i '/added by Nix installer$/d' ~/.bash_profile
    
    $ unset NIX_REMOTE
    
    $ sh <(curl https://nixos.org/nix/install) --daemon
    
    └$ export NIX_REMOTE=daemon
    
    └$ nix-env -iA nixpkgs.hello
    installing 'hello-2.10'
    error: cannot connect to daemon at '/nix/var/nix/daemon-socket/socket': No such file or directory
    (use '--show-trace' to show detailed location information)
    
    └$ sudo systemctl restart nix-daemon.service
    
    └$ nix-env -iA nixpkgs.hello
    installing 'hello-2.10'
    these paths will be fetched (6.09 MiB download, 27.04 MiB unpacked):
      /nix/store/2g75chlbpxlrqn15zlby2dfh8hr9qwbk-hello-2.10
      /nix/store/aag9d1y4wcddzzrpfmfp9lcmc7skd7jk-glibc-2.27
    copying path '/nix/store/aag9d1y4wcddzzrpfmfp9lcmc7skd7jk-glibc-2.27' from 'https://cache.nixos.org'...
    copying path '/nix/store/2g75chlbpxlrqn15zlby2dfh8hr9qwbk-hello-2.10' from 'https://cache.nixos.org'...
    building '/nix/store/w9adagg6vlikr799nkkqc9la5hbbpgmi-user-environment.drv'...
    created 2 symlinks in user environment
    Rovanion committed Jan 23, 2020
    Copy the full SHA
    a413594 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2020

  1. Copy the full SHA
    46992e7 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2020

  1. Copy the full SHA
    d78141a View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2020

  1. Merge pull request #3328 from Rovanion/nix-daemon-already-running-whe…

    …n-installing-fix
    
    installer: Handle edge case where the nix-daemon is already running on the system
    edolstra committed Feb 19, 2020
    Copy the full SHA
    e3e8ee0 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #3357 from carlosdagos/pure-nix-shell-proxy-env

    Pass through http proxy env vars in pure shell
    edolstra committed Feb 19, 2020
    Copy the full SHA
    2a14c28 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #3332 from Calvin-L/patch-1

    Document that autoconf is a dependency
    edolstra committed Feb 19, 2020
    Copy the full SHA
    2ba67da View commit details
    Browse the repository at this point in the history
  4. nix-shell: clean up the tmpDir and escape variables

    The problem fixed: each nix-shell invocation creates a new temporary
    directory (`/tmp/nix-shell-*`) and never cleans up.
    
    And while I'm here, shellescape all variables inlined into the rcfile.
    See what might happen without escaping:
    
        $ export TZ="';echo pwned'"
        $ nix-shell -p hello --run hello
        pwned
        Hello, world!
    xzfc committed Feb 19, 2020
    Copy the full SHA
    f2a03ac View commit details
    Browse the repository at this point in the history
  5. Merge pull request #3325 from xzfc/clean-tmpdir

    nix-shell: clean up the tmpDir and escape variables
    edolstra committed Feb 19, 2020
    Copy the full SHA
    2e953b5 View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2020

  1. Add backward compatibility default.nix / shell.nix

    This uses https://github.com/edolstra/flake-compat which is a bit more
    general than #3366.
    edolstra committed Feb 25, 2020
    Copy the full SHA
    7cd9859 View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2020

  1. nix dev-shell: Add --command option

    Note: like 'nix run', and unlike 'nix-shell', this takes an argv
    vector rather than a shell command. So
    
      nix dev-shell -c 'echo $PATH'
    
    doesn't work. Instead you need to do
    
      nix dev-shell -c bash -c 'echo $PATH'
    edolstra committed Feb 27, 2020
    Copy the full SHA
    2672a28 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    f443d5c View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    f499d8f View commit details
    Browse the repository at this point in the history
  4. builtins.cache: Cache regular expressions

    The evaluator was spending about 1% of its time compiling a small
    number of regexes over and over again.
    edolstra committed Feb 27, 2020
    Copy the full SHA
    8235693 View commit details
    Browse the repository at this point in the history
  5. Optimise Derivation::unparse()

    In
    
      nix-instantiate --dry-run '<nixpkgs/nixos/release-combined.nix>' -A nixos.tests.simple.x86_64-linux
    
    this reduces time spent in unparse() from 9.15% to 4.31%. The main
    culprit was appending characters one at a time to the destination
    string. Even though the string has enough capacity, push_back() still
    needs to check this on every call.
    edolstra committed Feb 27, 2020
    Copy the full SHA
    b923b2f View commit details
    Browse the repository at this point in the history
  6. Optimize primop calls

    We now parse function applications as a vector of arguments rather
    than as a chain of binary applications, e.g. 'substring 1 2 "foo"' is
    parsed as
    
      ExprCall { .fun = <substring>, .args = [ <1>, <2>, <"foo"> ] }
    
    rather than
    
      ExprApp (ExprApp (ExprApp <substring> <1>) <2>) <"foo">
    
    This allows primops to be called immediately (if enough arguments are
    supplied) without having to allocate intermediate tPrimOpApp values.
    
    On
    
      $ nix-instantiate --dry-run '<nixpkgs/nixos/release-combined.nix>' -A nixos.tests.simple.x86_64-linux
    
    this gives a substantial performance improvement:
    
      user CPU time:      median =      0.9209  mean =      0.9218  stddev =      0.0073  min =      0.9086  max =      0.9340  [rejected, p=0.00000, Δ=-0.21433±0.00677]
      elapsed time:       median =      1.0585  mean =      1.0584  stddev =      0.0024  min =      1.0523  max =      1.0623  [rejected, p=0.00000, Δ=-0.20594±0.00236]
    
    because it reduces the number of tPrimOpApp allocations from 551990 to
    42534 (i.e. only small minority of primop calls are partially
    applied) which in turn reduces time spent in the garbage collector.
    edolstra committed Feb 27, 2020
    Copy the full SHA
    1d74750 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    888950e View commit details
    Browse the repository at this point in the history