Commit Graph

13 Commits

Author SHA1 Message Date
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 5f50a8c39a
nix: upgrade interpreter from 2.11.1 to 2.14.1
This is a mild upgrade that should not cause any controversy.

You can read about changes here:
- https://nixos.org/manual/nix/stable/release-notes/rl-2.12.html
- https://nixos.org/manual/nix/stable/release-notes/rl-2.13.html
- https://nixos.org/manual/nix/stable/release-notes/rl-2.14.html

Relevant `infra-ci` change:
- https://github.com/status-im/infra-ci/commit/e4e9796f

The simplest way to upgrade to `2.14` your version locally is using:
```sh
nix-channel --update
nix-env -iA nixpkgs.nixVersions.nix_2_14 nixpkgs.cacert
sudo systemctl daemon-reload
sudo systemctl restart nix-daemon
```
For MacOS the instructions are a bit different:
https://nixos.org/manual/nix/stable/installation/upgrading.html

Keep in mind you should use `nixpkgs.nixVersions.nix_2_14` instead
of just `nixpkgs.nix` to avoid getting newer than `2.14`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-19 10:58:56 +02:00
Jakub Sokołowski 17bb87bb87
nix: upgrade from 2.8.0 to 2.11.1
This also includes the fix for too low `LimitNOFILE`:
https://github.com/NixOS/nix/pull/6553

https://github.com/NixOS/nix/releases/tag/2.11.1

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-09-20 19:03:10 +02:00
Jakub Sokołowski 777d0581ce
nix: upgrade from 2.6.1 to 2.8.0
Minor upgrade done to match the version deployed in CI due to a bug
with `nix-copy-closure` which broken Nix cache jobs:
https://github.com/status-im/infra-ci/issues/49

This will not force upgrade on developes, nor require any `make nix-purge`.
If however and upgrade is wanted it can be simply done with `nix upgrade-nix`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-05-07 11:24:58 +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
Jakub Sokołowski da76200433
nix: fix setup.sh script when running on MacOS
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-04-11 11:10:28 +02:00
Jakub Sokołowski f9d697dd2e
nix: upgrade Nix 2.3.6 to 2.3.12
This should also fix issues with MacOS sandboxing:
```
sandbox-exec: execvp() of '/nix/store/...-bash-4.4-p23/bin/bash' failed: Operation not permitted
```
https://github.com/cachix/install-nix-action/issues/15

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2021-06-15 17:49:27 +02:00
Jakub Sokołowski 2862f4c772
nix: upgrade 2.3.4 > 2.3.6
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-06-22 16:33:55 +02:00
Jakub Sokołowski e1eda363e6
nix: upgrade 2.3.2 > 2.3.4
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-04-24 11:18:49 +02:00
Jakub Sokołowski 918b03d459
nix: move nix-purge code to nix/scripts/purge.sh
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-04-21 22:30:33 +02:00
Jakub Sokołowski 17e5fc4dd4
fix detecting NixOS, uname can be deceptive
specifically inside of Docker containers

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-02-25 17:52:23 +01:00
Jakub Sokołowski 46bd2b2e4c
cleanup of shell scripts
Changes:
- Add missing lazy assignment for OS_NAME, fixes double Nix shells
- Moved `scripts/add-nix-gcroots.sh` to `nix/scripts/gcroots.sh`
- Moved Nix package manager setup to `nix/scripts/setup.sh`
- Created `nix/scripts/source.sh` to reuse in all Nix scripts
- Created `STARTING_GUIDE.md` with instructions for contributors
- Created `scripts/colors.sh` for definition of shell colors
- Removed `scripts/setup` in favor of `nix/scripts/setup.sh`
- Removed all of `scripts/lib` since it was useless

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-02-24 19:31:55 +01:00