diff --git a/README.md b/README.md index a68c5c2..cccbf79 100644 --- a/README.md +++ b/README.md @@ -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 { }; - + - +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 = "git@github.com: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 {}; + 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`: