Commit Graph

5 Commits

Author SHA1 Message Date
Jakub Sokołowski 1503f6b250
nix: use Darwin stat command explicitly
Otherwise if in Nix context we can accidentally use GNU stat which
results in a different output due to different command line flags:
```
[nix-shell:~/status-mobile]$ stat -Lf "%Sg" "/nix/store"
stat: cannot read file system information for '%Sg': No such file or directory
  File: "/nix/store"
    ID: 10000110000001a Namelen: ?       Type: apfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 242837545  Free: 199242283  Available: 199242283
Inodes: Total: 7971454780 Free: 7969691320
```
And it should be just owner group name or ID. Which in turn results in:
```
Unknown Nix installtion type!
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-27 13:25:41 +02:00
Jakub Sokołowski 5e6d488a3e
nix: fix cache usage by modifying global config
Otherwise Nix produces warnings like this:
```
warning: ignoring untrusted substituter 'https://nix-cache.status.im/', you are not a trusted user.
```
Since adding users to `trusted-users` essentially gives them `root`:

>Adding a user to trusted-users is essentially equivalent to giving that user root access to the system.
> — https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-trusted-users

A more kosher approach might be to just add the cache config itself globally.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-23 18:02:38 +02:00
Jakub Sokołowski 93cf54919f
nix: add upgrade script for Nix interpreter
Now developers can upgrade to current Nix version using just:
```sh
make nix-upgrade
```
For manual instructions see:
https://nixos.org/manual/nix/stable/installation/upgrading.html

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-19 12:21:00 +02:00
Jakub Sokołowski b2695e0b24
nix: fix purge.sh script on Darwin platform
Darwin lacks `userdel` and Nix users don't appear in `/etc/passwd`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-05-16 20:18:23 +02:00
Jakub Sokołowski 0311983751
ci: upgrade Nix from 2.3.12 to 2.6.1
Due to changes in how Nix handles Git refs we need to specify
`refs/tags/` prefix in `package.json` to avoid the following error:
```
fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6
error: program 'git' failed with exit code 128
```

I also had to rewrite some logic in `nix/scripts/source.sh` in order to
take account of single-user and multi-user installations.
We default to multi-user for Darwin, but not for any other OS due to
discovered issues with `nix-daemon` socket on Arch and open file limits.

I also rewrote `nix/scripts/setup.sh` and `/nix/scripts/purge.sh` to support
different types of installations. Both single-user and multi-user, as some
operating systems have issues with multi-user installations.

Resolves: https://github.com/status-im/status-react/issues/12832
Depends on: https://github.com/status-im/status-jenkins-lib/pull/37

Related changes:
* https://github.com/status-im/infra-ci/commit/84947b9f
* https://github.com/status-im/infra-ci/commit/bb98f5f3
* https://github.com/status-im/infra-ci/commit/f75d524d
* https://github.com/status-im/infra-ci/commit/d1fc92cd
* https://github.com/status-im/infra-ci/commit/87c4091e
* https://github.com/status-im/infra-ci/commit/8d6b6b3f
* https://github.com/status-im/infra-ci/commit/c4f13285
* https://github.com/status-im/infra-ci/commit/38ac698d

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-04-11 12:26:54 +02:00