Install things! Delete them again! Install them again! Delete them again! It's up to you!
Nix Mate is a (very much WIP) terminal front end to the Nix Package Manager. It allows clean installation of per-project dependencies.
You will need the following installed:
Nix - install instructions
Direnv - install instructions
Easy!
brew update && brew install danieljharvey/tools/nix-mate
Currently no nice packaging available, but binaries can be downloaded from the releases page.
mkdir my-excellent-project
cd my-excellent-project
nix-mate init
This will setup a new project in this folder. Direnv will probably ask you to run direnv allow
at this point, so go for it.
nix-mate add cowsay
This will make the cowsay
binary available whilst you are inside the project
directory.
nix-mate remove cowsay
This will remove the cowsay
binary from your project directory.
nix-mate search nodejs
This will show a big list of packages matching that name that you can install.
nix-mate
uses a pinned version of nixpkgs for installing so that we get the
same result every time.
To view the available versions of nixpkgs run:
nix-mate tags
This will display all the available versions.
You can choose to use a version using:
nix-mate set-version <version-number>
# for example
nix-mate set-version 19.03
This will update your project to use this new version.
If you'd just prefer to stay up to date, use:
nix-mate update
This will use the newest version.
First, you will need to get the git hash for the commit you wish to use at nixpkgs. Then run
nix-mate pin <commit-hash>
# for example
nix-mate pin 1f795f9f44607cc5bec70d1300150bfefcef2aae
We can create and load a Docker image containing your project dependencies by
running nix-mate docker
. This will create an image called
<project-name>:latest
. This command creates Linux-based images, so if you are
using MacOS, you will need to install https://github.com/nix-community/linuxkit-nix
Install as follows:
# install linux-kit
nix-env -i /nix/store/jgq3savsyyrpsxvjlrz41nx09z7r0lch-linuxkit-builder
# remove old config
rm -rf ~/.cache/nix-linuxkit-builder
# setup linux-kit
nix-linuxkit-configure
# add linuxkit ssh config to local ssh config
sudo cat /var/root/.ssh/nix-linuxkit-ssh-config >> ~/.ssh/config
This project is for users that would usually install project dependencies with brew
or apt-get
and would like a declarative way to do this per-project.
If you're already familiar with Nix-the-language, then this project isn't for you. If you're happy creating your own shell.nix
files etc and want more control, then there are great tools like lorri out there for just this.
git tag v0.0.1231233
git push origin --tags
Then, fill in the release info on the created page.