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
+80-36
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ more decentralized way.
14
14
NUR automatically check its list of repositories and perform evaluation checks
15
15
before it propagated the updates.
16
16
17
-
## How to use
17
+
## Installation
18
18
19
19
First include NUR in your `packageOverrides`:
20
20
@@ -23,9 +23,9 @@ To make NUR accessible for your login user, add the following to `~/.config/nixp
23
23
```nix
24
24
{
25
25
packageOverrides = pkgs: {
26
-
nur = pkgs.callPackage (import (builtins.fetchGit {
27
-
url = "https://github.com/nix-community/NUR";
28
-
})) {};
26
+
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
27
+
inherit pkgs;
28
+
};
29
29
};
30
30
}
31
31
```
@@ -35,13 +35,28 @@ For NixOS add the following to your `/etc/nixos/configuration.nix`:
35
35
```nix
36
36
{
37
37
nixpkgs.config.packageOverrides = pkgs: {
38
-
nur = pkgs.callPackage (import (builtins.fetchGit {
39
-
url = "https://github.com/nix-community/NUR";
40
-
})) {};
38
+
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
39
+
inherit pkgs;
40
+
};
41
41
};
42
42
}
43
43
```
44
44
45
+
### Pinning
46
+
47
+
Using `builtins.fetchTarball` without a sha256 will only cache the download for 1 hour by default, so you need internet access almost every time you build something. You can pin the version if you don't want that:
48
+
49
+
```nix
50
+
builtins.fetchTarball {
51
+
# Get the revision by choosing a version from https://github.com/nix-community/NUR/commits/master
Then packages can be used or installed from the NUR namespace.
46
61
47
62
```console
@@ -62,7 +77,7 @@ or
62
77
63
78
```console
64
79
# configuration.nix
65
-
environment.systemPackages = [
80
+
environment.systemPackages = with pkgs; [
66
81
nur.repos.mic92.inxi
67
82
];
68
83
```
@@ -73,19 +88,39 @@ for its content.
73
88
***NUR does not check repository for malicious content on a regular base and it is
74
89
recommend to check expression before installing them.***
75
90
91
+
### Using modules overlays or library functions on NixOS
92
+
93
+
If you intend to use modules, overlays or library functions in your NixOS configuration.nix, you need to take care to not introduce infinite recursion. Specifically, you need to import NUR like this in the modules:
Check out the [github page](https://github.com/nix-community/nur-update#nur-update-endpoint) for further details
212
260
213
-
## Git submodules
261
+
###Git submodules
214
262
215
263
To fetch git submodules in repositories set `submodules`:
216
264
@@ -225,49 +273,43 @@ To fetch git submodules in repositories set `submodules`:
225
273
}
226
274
```
227
275
228
-
<!--
229
-
This currently does not work as advertised at least for modules
276
+
### NixOS modules, overlays and library function support
230
277
231
-
## Conventions for NixOS modules, overlays and library functions
278
+
It is also possible to define more than just packages. In fact any Nix expression can be used.
232
279
233
280
To make NixOS modules, overlays and library functions more discoverable,
234
281
we propose to put them in their own namespace within the repository.
235
282
This allows us to make them later searchable, when the indexer is ready.
236
283
237
-
Put all NixOS modules in the `modules` attribute of your repository:
284
+
285
+
#### Providing NixOS modules
286
+
287
+
NixOS modules should be placed in the `modules` attribute:
238
288
239
289
```nix
240
-
# default.nix
241
-
{
242
-
modules = ./import modules;
290
+
{ pkgs }: {
291
+
modules = import ./modules;
243
292
}
244
293
```
245
294
246
295
```nix
247
296
# modules/default.nix
248
297
{
249
-
example-module = ./import example-module.nix;
298
+
example-module = import ./example-module.nix;
250
299
}
251
300
```
252
301
253
302
An example can be found [here](https://github.com/Mic92/nur-packages/tree/master/modules).
254
303
255
-
The resulting module can be then added to `imports = [];` within `configuration.nix`:
256
-
257
-
```nix
258
-
# /etc/nixos/configuration.nix
259
-
{...}: {
260
-
imports = [ nur.repos.mic92.modules.transocks ];
261
-
}
262
-
```
304
+
#### Providing Overlays
263
305
264
306
For overlays use the `overlays` attribute:
265
307
266
308
```nix
267
309
# default.nix
268
310
{
269
311
overlays = {
270
-
hello-overlay = ./import hello-overlay;
312
+
hello-overlay = import ./hello-overlay;
271
313
};
272
314
}
273
315
```
@@ -293,10 +335,12 @@ The result can be used like this:
293
335
}
294
336
```
295
337
296
-
Put reusable nix functions that are intend for public use in the `lib` attribute:
338
+
#### Providing library functions
339
+
340
+
Put reusable nix functions that are intend for public use in the `lib` attribute. Make sure to use the given `lib` argument instead of `pkgs.lib` if you depend on nixpkgs functions.
0 commit comments