This repository has been archived by the owner on Aug 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`: | ||
|