A modern, delicious implementation of the Nix package manager, focused on correctness, usability, and growth — and committed to doing right by its community
Find a file
Rebecca Turner e2a1f79490 Add repl-overlays
Adds a `repl-overlays` option, which specifies files that can overlay
and modify the top-level bindings in `nix repl`. For example, with the
following contents in `~/.config/nix/repl.nix`:

    info: final: prev: let
      optionalAttrs = predicate: attrs:
        if predicate
        then attrs
        else {};
    in
      optionalAttrs (prev ? legacyPackages && prev.legacyPackages ? ${info.currentSystem})
      {
        pkgs = prev.legacyPackages.${info.currentSystem};
      }

We can run `nix repl` and use `pkgs` to refer to `legacyPackages.${currentSystem}`:

    $ nix repl --repl-overlays ~/.config/nix/repl.nix nixpkgs
    Nix 2.21.0pre20240309_4111bb6
    Type :? for help.
    Loading installable 'flake:nixpkgs#'...
    Added 5 variables.
    Loading 'repl-overlays'...
    Added 6 variables.
    nix-repl> pkgs.bash
    «derivation /nix/store/g08b5vkwwh0j8ic9rkmd8mpj878rk62z-bash-5.2p26.drv»

Change-Id: Ic12e0f2f210b2f46e920c33088dfe1083f42391a
2024-03-29 19:35:39 -07:00
.github
clang-tidy
config
contrib
doc Add repl-overlays 2024-03-29 19:35:39 -07:00
m4
maintainers
meson
misc
mk
perl
scripts
src Add repl-overlays 2024-03-29 19:35:39 -07:00
tests Add repl-overlays 2024-03-29 19:35:39 -07:00
.clang-format
.dir-locals.el
.editorconfig
.envrc
.gitignore
.version
boehmgc-coroutine-sp-fallback.diff
boehmgc-traceable_allocator-public.diff
configure.ac
CONTRIBUTING.md
COPYING
default.nix
docker.nix
flake.lock
flake.nix
local.mk
Makefile
Makefile.config.in
meson.build
meson.options
package.nix
precompiled-headers.h
README.md
shell.nix

Nix

Open Collective supporters Test

Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Please refer to the Nix manual for more details.

Installation

On Linux and macOS the easiest way to install Nix is to run the following shell command (as a user other than root):

$ curl -L https://nixos.org/nix/install | sh

Information on additional installation methods is available on the Nix download page.

Building And Developing

See our Hacking guide in our manual for instruction on how to to set up a development environment and build Nix from source.

Additional Resources

License

Nix is released under the LGPL v2.1.