Document how to get started on GitLab (#841)

This commit is contained in:
Ana Hobden 2024-02-09 13:54:51 -08:00 committed by GitHub
parent 15802f0730
commit 58303b5598
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,7 +10,7 @@ A fast, friendly, and reliable tool to help you use Nix with Flakes everywhere.
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
``` ```
The `nix-installer` has successfully completed over 1,000,000 installs in a number of environments, including [Github Actions](#as-a-github-action): The `nix-installer` has successfully completed over 2,000,000 installs in a number of environments, including [Github Actions](#as-a-github-action) and [GitLab](#on-gitlab):
| Platform | Multi User | `root` only | Maturity | | Platform | Multi User | `root` only | Maturity |
|------------------------------|:------------------:|:-----------:|:-----------------:| |------------------------------|:------------------:|:-----------:|:-----------------:|
@ -136,6 +136,24 @@ jobs:
run: nix build . run: nix build .
``` ```
### On GitLab
GitLab CI runners are typically Docker based and run as the `root` user. This means `systemd` is not present, so the `--init none` option needs to be passed to the Linux planner.
On the default [GitLab.com](https://gitlab.com/) runners, `nix` can be installed and used like so:
```yaml
test:
script:
- curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --no-confirm --init none
- . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
- nix run nixpkgs#hello
- nix profile install nixpkgs#hello
- hello
```
If you are using different runners, the above example may need to be adjusted.
### Without systemd (Linux only) ### Without systemd (Linux only)
> **Warning** > **Warning**