You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+12-19
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ You need the `-n` to stop hoogle from trying to use https locally. You will need
65
65
66
66
### Add external tool to `default.nix`
67
67
68
-
The sources you pull down with `niv` are accessible under `sources.<name>`. Its a derivation with the attributes you need to fetch the source, not the source itself. If you want to pull in a source you need to either give it to a function that knows how to fetch the contents like `callCabal2nix` or if the source has a `default.nix` you can import it directly, like so: `import sources.niv {}`.
68
+
The sources you pull down with `niv` are accessible under `sources.<name>` (fyi: `<name>` is the key in `sources.json`). However, that is a derivation with the attributes you need to fetch the source, not the source itself. If you want to pull in a source you need to either give it to a function that knows how to fetch the contents like `callCabal2nix` or if the source has a `default.nix` you can import it directly, like so: `import sources.<name> {}`.
69
69
70
70
---
71
71
@@ -77,7 +77,7 @@ in
77
77
inherit exe;
78
78
inherit docker;
79
79
### Added here
80
-
src = import sources.niv {};
80
+
src = import sources.<name> {};
81
81
}
82
82
83
83
```
@@ -93,7 +93,7 @@ On the other hand here is an example with `callCabal2nix` adding the specific ve
Note: I am building `ghcid` with `haskellPackages` not `myHaskellPackages`. If the tool fails to build you might want to either use a different package set or modify one yourself so the tool has the right dependencies.
@@ -170,21 +170,9 @@ This will not only add `extra` to your project, but also build the documentation
170
170
171
171
### Override dependency in `default.nix`
172
172
173
-
If you want to override a dependency you add it like we did above with `extra`, just make sure the name is identical to what is in the package set. As you would expect, the name in the package set is the same as the name on Hackage. There are a few packages with multiple versions, like `zip` and `zip_1_4_1`.
173
+
If you want to override a dependency you add it like we did above with `extra`, just make sure the name is identical to what is in the package set. As you would expect, the name in the package set is the same as the name on Hackage. However, there are a few packages with multiple versions, like `zip` and `zip_1_4_1`.
174
174
175
-
If you want to see exactly what is in your modified package set add this to your `default.nix` :
176
-
177
-
```
178
-
in
179
-
if pkgs.lib.inNixShell then shell else {
180
-
inherit exe;
181
-
inherit docker;
182
-
### Added here
183
-
inherit myHaskellPackages;
184
-
}
185
-
```
186
-
187
-
Then call `nix repl default.nix` and you will get this:
175
+
If you want to see exactly what is in your modified package run `nix repl default.nix` and you will get this:
188
176
189
177
```
190
178
@@ -200,7 +188,12 @@ Then you can tab complete to see what is in `myHaskellPackages`
200
188
nix-repl> myHaskellPackages.ex<tab>
201
189
```
202
190
203
-
Note: the reason we don't have this attribute added by default is you really only need this for debugging and wouldn't want your continuous integration to build the package set as an output of your project.
191
+
This is also the best way to find out what versions of libraries are in a package set. Instead of having to add them to your cabal file to find out the version you can just view the version attribute. Again in `nix repl`
0 commit comments