Nix Notes

1 Cheat sheet

Date: 2017-05-06

Sources:

bash <(curl https://nixos.org/nix/install)


OR



Important note: on my Debian Jessie system, mktemp requires at least three X's appended to the end of the output file, hence the $(mktemp -d -t mavenXXX) above. Alternatively, you can just drop the template argument altogether. The output of the above command will be a file named project-info.json. Move this some convenient directory inside your project's hierarchy, such as app/. 3.2 Installing pre-built .jars Instead of building Java source code, you could get away with simply installing prebuilt .jars using Nix. Here is a short expression I used to copy the ImageJ 1.51j .jar file into the Nix store. with import <nixpkgs> {}; stdenv.mkDerivation { name = "ij-1.51j"; src = (builtins.toPath ./ij-1.51j.jar); phases = "installPhase"; installPhase = '' mkdir -p$out/java/share
cp -v $src$out/java/share/
'';

meta = {
description = "Open source scientific multidimensional image processing";
homepage = https://imagej.net;
};
}


It's important to specify the phases attribute because stdenv.mkDerivation will attempt to run a build phase by default. This means it will try to run configure, make, make install, etc. on contents of the src attribute. By specifying that we only want an install phase, we can simply copy the .jar to the store.

4 Glossary

The official glossary is located in the Nix documentation here: http://nixos.org/nix/manual/#idm140737315919056