From 58303b559872b2f8d476d23f1c0496374204b548 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 9 Feb 2024 13:54:51 -0800 Subject: [PATCH] Document how to get started on GitLab (#841) --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b896d0..12c46f8 100644 --- a/README.md +++ b/README.md @@ -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 ``` -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 | |------------------------------|:------------------:|:-----------:|:-----------------:| @@ -136,6 +136,24 @@ jobs: 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) > **Warning**