summaryrefslogtreecommitdiff
path: root/A nice way to test flake output.md
blob: cddf7127ee690b9130c6d570e31e94c7eaa38039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
tags:
  - nix
---
Flakes are described in [[Basic building blocks of Nix]].

A way to test flake outputs is by loading the flake in nix-repl and then using `:b` which builds a derivation. I learnt about `:b` from [this Nix Pill](https://nixos.org/guides/nix-pills/06-our-first-derivation.html).

```
box main 7s
❯ nix repl
Nix 2.24.14
Type :? for help.
nix-repl> :lf .
Added 13 variables.

nix-repl> outputs.packages.x86_64-linux.default
«derivation /nix/store/g8y3gdd2rr2j5awx8p75ih0k072571yr-box.drv»

nix-repl> :b outputs.packages.x86_64-linux.default
error: builder for '/nix/store/g8y3gdd2rr2j5awx8p75ih0k072571yr-box.drv' failed with exit code 1;
       last 9 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/gli7ljgsva1wchy3h4n2lmvs1rfssl40-source
       > source root is source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > failed to initialize build cache at /homeless-shelter/.cache/go-build: mkdir /homeless-shelter: permission denied
       For full logs, run 'nix log /nix/store/g8y3gdd2rr2j5awx8p75ih0k072571yr-box.drv'.
[0 built (1 failed)]
nix-repl>

```