Questions tagged [nix]

Questions about Nix, the purely functional package manager and its usage and configuration.

Nix is a purely functional package manager for Linux and other UNIX-like operating systems. It aims to provide reliable and reproducible package management, featuring atomic upgrades and rollbacks, side-by-side installation of multiple versions of a package, multi-user package management and easy setup of build environments.

186 questions
14
votes
4 answers

How do I diagnose a failing nix build?

How do I diagnose a nix build failing? Currently I see output as: nix build -v warning: dumping very large path (> 256 MiB); this may run out of memory building '/nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv'... builder for…
14
votes
4 answers

How to configure a Nix environment, outside of NixOS?

So far, I have been trying out the Nix package manager by nix-env -i installing packages. Now, I would like to manage that with a ~/configuration.nix, like the example here, so that I can version it in my dotfiles. Is there a way to generate this…
Dan R
  • 143
12
votes
1 answer

How do I view information about a package in nix?

How do I get more details about a nix package, e.g. to verify that it actually is what I think it is. In Debian, I would use apt-cache show; but how do I get similar information for nix? A command to show the derivation for an arbitrary package…
jpaugh
  • 329
11
votes
2 answers

Which nix-package provides a given file/binary/command?

How can I figure out which nixpgs-package provides a given file/command, that may not be installed on the system? Other package managers offer this functionality as follows: apt has apt-file rpm has --whatprovides yum has whatprovides Does nix…
10
votes
2 answers

How can I discover and install a specific version of a package?

I have an installation of nix on a Linux system, and I have added the channel nixpkgs-unstable. I can now install packages such as gcc: % nix-env --install gcc installing 'gcc-7.4.0' ... created 78 symlinks in user environment If I look into a…
9
votes
5 answers

How can I reference the store path of a Nix package?

I'd like to add functionality relating to the awscli command completion. In my particular case I need to source the script from /nix/store/hvx7xqvjz7r08nsb9kssh1d9s302v3sp-awscli-1.16.106/share/zsh/site-functions/aws_zsh_completer.sh. How can I get…
6
votes
1 answer

How to clone a private git repository in a nix derivation

{ nixpkgs ? import {} }:nixpkgs.pkgs.fetchgitPrivate { url = "ssh://git@gitlab.com/trycatchchris/blog.git"; rev = "0f5fe7ebf0724eb17aea4141e0cf3f1758a6d716"; sha256 =…
4
votes
1 answer

How to print all available attributes of a Nix expression

To figure out why a repo is failing to build I'd like to enumerate all the available attributes in the source. That is, list every ATTR which fits into nix-build --attr ATTR https://github.com/USER/REPO/tarball/X.Y.Z.
l0b0
  • 51,350
4
votes
1 answer

How to include a specific list of files in `src`?

This derivation seems to include all files in the current directory, recursively, as expected: src = builtins.path { name = pname; path = ./.; }; I'd like to only include a small subset of that; content/index.html and package.json. But my…
l0b0
  • 51,350
4
votes
1 answer

"bash: cannot execute binary file" during nix dockerTools cross-build from MacOS host

A great 2016 blog post described building minimal Docker images with Nix. The below is a simple example taken from that blog post, modified to support Nix 2.0: { pkgs ? import {} }: with pkgs; dockerTools.buildImage { name = "redis"; …
Charles Duffy
  • 1,732
  • 15
  • 22
3
votes
1 answer

How do I setup a default shell for tmux when using nix-shell?

I would like to load up nix-shell with tmux using the fish shell. I've accomplished this by adding to my .nix file: shellHook = '' tmux -f .tmux.conf ''; Then having a .tmux.conf that is just set-option -g default-shell…
3
votes
2 answers

List packages I'm losing by running nix-env --delete-generations

I use NixOS, Nix version 1.10. nix-env, Nix package manager's installation command, creates a new generation every time you install a package. This way different package configurations are stored in separate generations, and you can switch between…
2
votes
1 answer

How to specify `buildPythonPackage` wheel Python versions, ABI, and platform tags?

When using buildPythonPackage the resulting wheel ends up as $dist/${pname}-${version}-py2.py3-none-any.whl. py2.py3 are the Python versions, none is the ABI, and any is the platform. How do I specify these when building the package? The closest…
l0b0
  • 51,350
2
votes
1 answer

List all gc-roots that reference Nix package

I'm trying to remove package X entirely from my /nix/store/, but nix-garbage-collect wont remove it as its probably referenced by some garbage collection root (gc-root) somewhere. Is it possible to list which gc-roots reference a given package X?
Rovanion
  • 959
1
vote
1 answer

How to launch nix-shell with package with a long name

nix-env -iA nixpkgs.python311 it works But when i do a nix-shell -p nixpkgs.python311 or a nix-shell -p python3-3.11.1 visibly there are problem in the name and arg nix-shell -p python3-3.11.1 error: undefined variable 'python3-3' at…
1
2