Skip to content

lriesebos/nix-sandbox

Repository files navigation

Nix sandbox

This project is a sandbox for Nix development. Additionally, some Nix resources are also listed here.

Installation

Nix can be installed by following the instructions on the Nix package manager installation website.

For single-user installations, add the following configuration to ~/.config/nix/nix.conf to enable flakes:

experimental-features = nix-command flakes
bash-prompt-prefix = (nix)

For multi-user installations, the same configuration needs to be added to /etc/nix/nix.conf.

Now Nix flakes should be available on your system. The default Nix development environment can be started using the nix develop command in a directory with a flake.nix file.

Updates

From the Nix manual:

Single-user installations of Nix should run this:

nix-channel --update; nix-env --install --attr nixpkgs.nix nixpkgs.cacert

Multi-user Nix users on Linux should run this with sudo:

sudo -i nix-channel --update && sudo -i nix-env --install --attr nixpkgs.nix nixpkgs.cacert && sudo systemctl daemon-reload && sudo systemctl restart nix-daemon

Multi-user Nix users on MacOS can upgrade Nix by running:

sudo -i sh -c 'nix-channel --update && nix-env --install --attr nixpkgs.nix && launchctl remove org.nixos.nix-daemon && launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist'

Resources

The following resources might be useful when writing Nix:

Useful projects:

Tools

Hash for fetchgit

Nix pkgs.fetchgit requires a sha256 hash. The best way to obtain this hash is by using the nix-prefetch-git command and provide the link and git ref (e.g. commit hash or tag) as arguments. For example:

nix-prefetch-git https://gitlab.com/duke-artiq/dax.git v6.7

See the Nix environment below.

{ pkgs ? import <nixpkgs> { } }:

pkgs.mkShell {
  buildInputs = [
    pkgs.nix-prefetch-git
  ];
}

Cache

Potential alternatives for a Nix cache (instead of Hydra) are:

About

A personal sandbox for playing around with Nix

Resources

Stars

Watchers

Forks

Languages