Giter VIP home page Giter VIP logo

nix-mate's Introduction

nix-mate

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.

Installation

You will need the following installed:

Nix - install instructions

Direnv - install instructions

MacOS

Easy!

brew update && brew install danieljharvey/tools/nix-mate

Ubuntu

Currently no nice packaging available, but binaries can be downloaded from the releases page.

Getting started

Set up a nix-mate project

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.

Adding a package

nix-mate add cowsay

This will make the cowsay binary available whilst you are inside the project directory.

Removing a package

nix-mate remove cowsay

This will remove the cowsay binary from your project directory.

Searching for packages

nix-mate search nodejs

This will show a big list of packages matching that name that you can install.

Versions of nixpkgs

nix-mate uses a pinned version of nixpkgs for installing so that we get the same result every time.

View available versions

To view the available versions of nixpkgs run:

nix-mate tags

This will display all the available versions.

Use a specific version

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.

Use most up to date version

If you'd just prefer to stay up to date, use:

nix-mate update

This will use the newest version.

Pinning to a custom nixpkgs commit

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

Create a Docker image

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

Who is this for?

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.

Releasing a new version

git tag v0.0.1231233
git push origin --tags

Then, fill in the release info on the created page.

nix-mate's People

Contributors

danieljharvey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nix-mate's Issues

Build using Nix

This will make it easier to distribute and install since having Nix installed is a prerequisite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.