Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
brodul authored and kamilchm committed Sep 8, 2017
1 parent 4a275ea commit 2b0f2e5
Showing 1 changed file with 12 additions and 36 deletions.
48 changes: 12 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,42 +236,18 @@ Our project will be called `influxdb-demo` and this demo will be using the [infl
**Note**: The resulting binary will be in `/nix/store/9k4v7rhs5606fyia8mb341k71m3yrcbq-go1.7-influxdb-demo-20161030-718c85c-bin`.


12. Adapting `default.nix` to be used with `nix-shell`

In order to use `nix-shell` you need to pass the newly created `buildDeps` to `deps.nix`:

diff --git a/default.nix b/default.nix
index 8fa7d91..d3dd797 100644
--- a/default.nix
+++ b/default.nix
@@ -1,5 +1,8 @@
-# This file was generated by go2nix.
-{ stdenv, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn }:
+with import <nixpkgs> { };
+
+let
+ buildDeps = with pkgs; [stdenv buildGoPackage fetchgit fetchhg fetchbzr fetchsvn];
+in
buildGoPackage rec {
name = "influxdb-demo-${version}";
@@ -8,15 +11,5 @@ buildGoPackage rec {
goPackagePath = "github.com/qknight/influxdb-demo";
- src = fetchgit {
- inherit rev;
- url = "[email protected]:qknight/influxdb-demo.git";
- sha256 = "0csbqcnncklimysgcbxlj190bynx1ppvyxvl5viz40fvbcj4l8xb";
- };
-
- goDeps = ./deps.nix;
-
- # TODO: add metadata https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes
- meta = {
- };
+ goDeps = with buildDeps; ./deps.nix;
}
12. Enabling `nix-shell`

In order to use `nix-shell` you need to create a `shell.nix` file:

```nix
let
pkgs = import <nixpkgs> {};
in pkgs.callPackage ./default.nix {}
```
That will pass the derivations for `stdenv, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn` into your package derivation. It will use `nixpkgs` (your current channel).
After you updated the `default.nix` you can now use `nix-shell`:
Expand Down

0 comments on commit 2b0f2e5

Please sign in to comment.