DeterminateSystems / nix-installer-action

The Github Action for the Determinate Nix Installer
https://github.com/determinateSystems/nix-installer
GNU Lesser General Public License v2.1
168 stars 16 forks source link

Action should work under nektos/act, in the absence of systemd & docker #63

Open fasterthanlime opened 10 months ago

fasterthanlime commented 10 months ago

What main does at the time I'm opening this is: notice systemd isn't there, try to run docker info and immediately fail because I think either of "docker isn't in PATH" or "docker info" returned a non-zero exit code end up throwing instead of just returning from detectAndForceDockerShim.

On Discord, @grahamc suggested trying v8, which happened to be "after Act workarounds were added" but "before GHE (GitHub Enterprise) stuff was added" and that version does work under act, it's only affected by #62.

Hoverbear commented 10 months ago

This should be resolved on main now! I expect we'll be tagging a new version fairly soon, too.

fasterthanlime commented 9 months ago

This should be resolved on main now! I expect we'll be tagging a new version fairly soon, too.

main seems to have all my issues resolved. thanks so much!

andreabedini commented 9 months ago

Thank you all for working on this! I tried main but I am afraid it is not fully working. The result seems to be halfway between a multi-user (user pool and /nix owned by root) and a single-user setup (no daemon).

Using act, the image ghcr.io/catthehacker/ubuntu:runner-latest and the following workflow

    - uses: DeterminateSystems/nix-installer-action@main
    - run: /nix/nix-installer self-test
      shell: bash

I get

| [command]/tmp/c38d2d29-229e-49a2-96dd-2a5db1ae4ed9 install linux
| `nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
|  INFO Step: Create directory `/nix`
|  INFO Step: Provision Nix
|  INFO Step: Create build users (UID 30000-30032) and group (GID 30000)
|  INFO Step: Configure Nix
|  INFO Step: Create directory `/etc/tmpfiles.d`
|  INFO Step: Leave the Nix daemon unconfigured
|  INFO Step: Remove directory `/nix/temp-install-dir`
| Nix was installed successfully!
| To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`
|

but

[nix-based CI/format]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1-composite-1.sh] user= workdir=
| Error:
|    0: Self test error, install may be only partially functional
|    0: Shell `sh` failed self-test with command `"sh" "-lc" "nix build --no-link --expr \'derivation { name = \"self-test-sh-1705388425111\"; system = \"x86_64-linux\"; builder = \"/bin/sh\"; args = [\"-c\" \"echo hello > \\$out\"]; }\'"`, stderr:
|       error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted
|
|
|       Shell `bash` failed self-test with command `"bash" "-lc" "nix build --no-link --expr \'derivation { name = \"self-test-bash-1705388425133\"; system = \"x86_64-linux\"; builder = \"/bin/sh\"; args = [\"-c\" \"echo hello > \\$out\"]; }\'"`, stderr:
|       error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted
|
|    0:
|
| Location:
|    src/cli/subcommand/self_test.rs:15
|
| Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
| Run with RUST_BACKTRACE=full to include source snippets.
|
| Consider reporting this error using this URL: https://github.com/DeterminateSystems/nix-installer/issues/new?title=%3Cautogenerated-issue%3E&body=%23%23+Error%0A%60%60%60%0AError%3A+%0A+++0%3A+Self+test+error%2C+install+may+be+only+partially+functional%0A+++0%3A+Shell+%60sh%60+failed+self-test+with+command+%60%22sh%22+%22-lc%22+%22nix+build+--no-link+--expr+%5C%27derivation+%7B+name+%3D+%5C%22self-test-sh-1705388425111%5C%22%3B+system+%3D+%5C%22x86_64-linux%5C%22%3B+builder+%3D+%5C%22%2Fbin%2Fsh%5C%22%3B+args+%3D+%5B%5C%22-c%5C%22+%5C%22echo+hello+%3E+%5C%5C%24out%5C%22%5D%3B+%7D%5C%27%22%60%2C+stderr%3A%0A++++++error%3A+could+not+set+permissions+on+%27%2Fnix%2Fvar%2Fnix%2Fprofiles%2Fper-user%27+to+755%3A+Operation+not+permitted%0A%0A%0A++++++Shell+%60bash%60+failed+self-test+with+command+%60%22bash%22+%22-lc%22+%22nix+build+--no-link+--expr+%5C%27derivation+%7B+name+%3D+%5C%22self-test-bash-1705388425133%5C%22%3B+system+%3D+%5C%22x86_64-linux%5C%22%3B+builder+%3D+%5C%22%2Fbin%2Fsh%5C%22%3B+args+%3D+%5B%5C%22-c%5C%22+%5C%22echo+hello+%3E+%5C%5C%24out%5C%22%5D%3B+%7D%5C%27%22%60%2C+stderr%3A%0A++++++error%3A+could+not+set+permissions+on+%27%2Fnix%2Fvar%2Fnix%2Fprofiles%2Fper-user%27+to+755%3A+Operation+not+permitted%0A%0A%0A%60%60%60%0A%0A%23%23+Metadata%0A%7Ckey%7Cvalue%7C%0A%7C--%7C--%7C%0A%7C**version**%7C0.15.1%7C%0A%7C**os**%7Clinux%7C%0A%7C**arch**%7Cx86_64%7C%0A
lucperkins commented 5 months ago

@fasterthanlime Could you try again with a more recent commit? We've overhauled the Action pretty significantly since this was submitted. Significantly enough that if things are still broken there would at least be a different error now 😄