Add instructions for self-hosted NixOS runners #42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I attempted the following:
But this action failed: https://github.com/lovesegfault/nix-config/actions/runs/6496771196/job/17644474420
I could just guard the action with an
if, and expose the host's Nix to the runner, but I wanted to keep things identical to the GitHub-hosted runners, if at all possible.Error
Metadata
I understand you want to keep your actions the same, and presumably you don't actually want our installer to install Nix. Despite that, can you check to see if
sudois installed and in your runner's PATH?Next... what behavior would you like and expect out of this action when Nix is already installed / you're already on NixOS?
I think what I'm asking for might be either impossible or unwise without placing the runner inside a container.
I tried just adding
nixto the runner PATH, but the action still fails: https://github.com/lovesegfault/nix-config/actions/runs/6496992160/job/17645257639What about making the action check whether Nix is already installed/available, and do nothing in that case?
Ah, so it is trying to run
sudo. Specifically the one from security wrappers which is setuid. I'll check with the team and see what is reasonable!Sounds good, please redeem this beer ticket next time we meet: 🎟️
So we've done some work already to detect an existing Nix install, but it is really only looking for a Nix installed by the Determinate Nix Installer:
I think we could add a second check there, like look to see if you're on NixOS or if the
nixbinary is in your PATH. If we do this we should also check to see if flakes are enabled or not, and emit a warning about it if they aren't.That sounds good, I guess checking whether things are enabled is just
nix show-configand then looking at theexperimental-featureskey.I believe there are two issues at play here. I'm going to try to tease them apart.
Issue 1: Installer requires
sudoI'm trying to read between the lines of this issue and it appears you are unwilling or unable to give the
runnerusersudoaccess.Github Actions, according to it's documentation, conventionally has passwordless
sudoaccess. Actions are generally allowed to have this expectation:Since your runner does not appear to conform to this, it is likely you'll experience issues with some other actions as well. I do not think this represents a bug in the
nix-installeror this action. All our supported Nix install methods requirerootand check for it quite early.My suggestion here is to do something like:
Alternatively you could set some environment in the
runneruser and check that (egNIXOS=true).Even if you did add
sudothenix-installerwould fail on NixOS. (See issue 2)Issue 2: Installer will exit with failure on NixOS
Normally the installer (on the
ostreeandlinuxplans) will validate that it is not running on NixOS and error if it is:DeterminateSystems/nix-installer@c79dcb91ae/src/planner/linux.rs (L174-L180)We could consider creating a
nixosplanner however it would be difficult to define what exactly that did. Many modern flakes-only systems do not actually contain aconfiguration.nixor similar, and editing NixOS definitions that may be part of some flake is of considerable complexity.As Graham mentioned, in this case it may be easier for the action to detect it's running on NixOS and essentially do a noop.