Questions tagged [nix]

Nix is a purely functional package manager.

Nix is a purely functional package manager. This means that it treats packages like values in purely functional programming languages such as Haskell — they are built by functions that don’t have side-effects, and they never change after they have been built.

Home page: http://nixos.org/nix

770 questions
85
votes
2 answers

When and how should default.nix, shell.nix and release.nix be used?

One of the first types of Nix expression one encounters when learning how to use the Nix package manager is default.nix; on the wonderful NixOS IRC channel I learned of the existence of shell.nix and release.nix as well. I got the impression that -…
Ixxie
  • 1,393
  • 1
  • 9
  • 17
37
votes
2 answers

What is the meaning of sha256 in nixpkgs.fetchgit? Where does the value come from?

I would like to add a package from github, just like in the example below, but I do not know where can I get the sha256 hash needed (as shown below) for any given github source. Can someone explain please where is the sha256 coming from and how can…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
37
votes
1 answer

How to get cabal and nix work together

As far as I understood, Nix is alternative for cabal sandbox. I finally managed to install Nix, but I still don't understand how it can replace a sandbox. I understand you don't need cabal using Nix and the wrapped version of GHC; however if you…
mb14
  • 22,276
  • 7
  • 60
  • 102
26
votes
1 answer

When does a Nix path type make it into the Nix store when converted to a string and when not?

I have noticed in the past that in nix, a ./myfile.txt path type seems to sometimes evaluate to /home/myuser/mydir/myfile.txt, and sometimes to /nix/store/55j24v9qwdarikv7kd3lc0pvxdr9r2y8-myfile.txt. I would like to understand exactly when which…
nh2
  • 24,526
  • 11
  • 79
  • 128
25
votes
1 answer

Build versus Runtime Dependencies in Nix

I am just starting to get to grips with Nix, so apologies if I missed the answer to my question in the docs. I want to use Nix to setup a secure production machine with the minimal set of libraries and executables. I don't want any compilers or…
Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
25
votes
1 answer

How do I use the new haskell-ng infrastructure on NixOS?

How do I setup a simple Haskell development environment on NixOS using the new haskell-ng infrastructure?
rzetterberg
  • 10,146
  • 4
  • 44
  • 54
24
votes
1 answer

What does `nix-darwin` provide?

I am new to nix world, and I use Mac OS X. I've just installed nix on my MacBook and want to use nix to manage some packages like Emacs instead of Homebrew. I've found this repo: https://github.com/LnL7/nix-darwin , and I am curious: What this repo…
cmal
  • 2,062
  • 1
  • 18
  • 35
21
votes
1 answer

how to add NixOS unstable channel declaratively in configuration.nix

The NixOS cheatsheet describes how to install packages from unstable in configuration.nix. It starts off by saying to add the unstable channel like so: $ sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable $ sudo nix-channel…
illabout
  • 3,517
  • 1
  • 18
  • 39
18
votes
3 answers

NixOS: Setting the default channel in configuration.nix

How do I set the default channel in NixOS's /etc/configuration.nix? There is a command to set it and rebuild with sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable sudo nixos-rebuild switch -I…
Jacob Wang
  • 4,411
  • 5
  • 29
  • 43
16
votes
1 answer

How can I combine two lists in Nix?

I've currently got a list defined as: environment.systemPackages = with pkgs; [ acpi ag alacritty audacity awscli bash breeze-gtk cabal-install ]; How would I go about defining two lists and then…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
16
votes
3 answers

What is the purpose of nix-instantiate? What is a store-derivation?

In the manual it is written : The command nix-instantiate generates store derivations from (high-level) Nix expressions. But what are store derivations ? The manual says the following about store derivations : A description of a build action.…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
15
votes
1 answer

How can I nix-env install a derivation from a nix expression file?

I've got a default.nix file that builds a derivation (at least my understanding of it). { nixpkgs ? import {}, compiler ? "ghc864" } : nixpkgs.pkgs.haskell.packages.${compiler}.callCabal2nix "bhoogle" (./.) {} I can successfully nix-build…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
14
votes
2 answers

How to uninstall Nix

I've installed Nix into an Ubuntu WSL installation. I now want to uninstall it. The manual states to simply "rm -rf /nix". Nix adds itself to $PATH and the manual makes mention of a Nix daemon. Surely there are other parts of my system that Nix has…
Rebs
  • 4,169
  • 2
  • 30
  • 34
14
votes
2 answers

What nix channel is subscribed to by default

I installed the nix package manager on my machine (macOS 10.12.6 Sierra) several weeks ago. I want to update mylocal nixpkgs collection to bring it in sync with any upstream updates in the channel. My understanding is that this can be achieved by…
b73
  • 1,377
  • 2
  • 14
  • 25
14
votes
1 answer

How to build a docker container with nix?

I have a Nix package I'd like to bundle up into a docker container. Specifically, I want to use Nix as a more expressive alternative to a Dockerfile to have faster (non-linear) image builds. I've found documentation on dockerTools.buildImage but I'd…
nh2
  • 24,526
  • 11
  • 79
  • 128
1
2 3
51 52