This repository has been archived by the owner on Dec 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
nix-verify.sh
58 lines (49 loc) · 1.47 KB
/
nix-verify.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bats
cd $BATS_TMPDIR
@test "Initially nothing should be garbage collected" {
STORE1=`ls -la /nix/store | wc -l`
nix-collect-garbage -d
STORE2=`ls -la /nix/store | wc -l`
[ "$STORE1" == "$STORE2" ]
}
@test "Install hello using nix-env" {
nix-env -iA nixpkgs.hello
[ "`hello`" == "Hello, world!" ]
}
@test "Install hello using nix build" {
STORE1=`ls -la /nix/store | wc -l`
nix build nixpkgs.hello
STORE2=`ls -la /nix/store | wc -l`
[ "`./result/bin/hello`" == "Hello, world!" ]
[ "$STORE1" == "$STORE2" ]
}
@test "Can we update the channel?" {
nix-channel --update
}
@test "Install hello using nix-env after channel update" {
nix-env -iA nixpkgs.hello
[ "`hello`" == "Hello, world!" ]
}
@test "Install hello using nix build after channel update" {
STORE1=`ls -la /nix/store | wc -l`
nix build nixpkgs.hello
STORE2=`ls -la /nix/store | wc -l`
[ "`./result/bin/hello`" == "Hello, world!" ]
[ "$STORE1" == "$STORE2" ]
}
@test "Verify hello installation using nix-build" {
nix-build '<nixpkgs>' -A hello --check
[ "`./result/bin/hello`" == "Hello, world!" ]
}
@test "Test sandbox is disabled" {
cat >tmp.nix <<'EOL'
let
pkgs = import <nixpkgs> {};
in pkgs.runCommand "sandbox-test" { buildInputs = [ pkgs.curl ]; } ''
export SSL_CERT_FILE="\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
curl https://cache.nixos.org/nix-cache-info > $out
''
EOL
nix build -f tmp.nix
[ "`cat result | grep StoreDir`" == "StoreDir: /nix/store" ]
}