Fixing GitLab Runner's Home Directory on NixOS

0

If you use gitlab's shell runner on nixos, you might have noticed, it doesnt set the home directory for the gitlab runner user. This effectively makes the applications believe that / is the home directory. If you use ssh or any similar application, this can quickly become a nightmare.

If you want to debug something as gitlab-runner user, this wouldn't also work, and error out with account is not available.

Both of these issues can be fixed simply by adding this entry to /etc/passwd

gitlab-runner:x:63450:63450:GitLab Runner:/var/lib/gitlab-runner:/bin/bash