Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental-features is not considered but extra-experimental-features is? #28

Open
FRidh opened this issue Jun 27, 2023 · 10 comments
Open

Comments

@FRidh
Copy link

FRidh commented Jun 27, 2023

I noticed that setting experimental-features in extra-conf has no effect, however, setting extra-experimental-features does. Is this expected behaviour? Could this be because by default it is set to include flakes?

name: "CI using nix"

on:
    push:
      branches:
        - develop
        - main

    pull_request:
      branches:
        - develop
        - main

jobs:
    check:
        runs-on: ubuntu-22.04
        steps:
        - uses: actions/checkout@v3
        - uses: DeterminateSystems/nix-installer-action@main
          with:
            extra-conf: |
              extra-experimental-features = nix-command flakes impure-derivations ca-derivations
        - uses: DeterminateSystems/magic-nix-cache-action@main
        - run: nix flake check
@FRidh FRidh changed the title experimental-features is not considered but extra-experimental-features is experimental-features is not considered but extra-experimental-features is? Jun 27, 2023
@FRidh
Copy link
Author

FRidh commented Jun 27, 2023

Even more interesting. One run with extra-experimental-features succeeded (when I made a PR), and another run (post-merge) running the exact same job failed again with

error: experimental Nix feature 'impure-derivations' is disabled; use '--extra-experimental-features impure-derivations' to override
(use '--show-trace' to show detailed location information)
Error: Process completed with exit code 1.

So it is not just experimental-features but also extra-experimental-features that is not (always) considered.

@Hoverbear Hoverbear mentioned this issue Jun 27, 2023
3 tasks
@Hoverbear
Copy link
Contributor

Hoverbear commented Jun 27, 2023

Trying to reproduce this, I tested with the binary directly:

ana@ephemeral-ubuntu:~/Downloads$ ./nix-installer install --extra-conf "experimental-features = impure-derivations"
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix install plan (v0.9.2-unreleased)
Planner: linux

Configured settings:
* extra_conf: ["experimental-features = impure-derivations"]

Planned actions:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.15.0/nix-2.15.0-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30000-30000) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30000-30000) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Configure Nix daemon related settings with systemd
 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`

ana@ephemeral-ubuntu:~/Downloads$ cat /etc/nix/nix.conf 
# Generated by https://github.com/DeterminateSystems/nix-installer, version 0.9.2-unreleased.
experimental-features = impure-derivations nix-command flakes auto-allocate-uids
build-users-group = nixbld
auto-optimise-store = true
bash-prompt-prefix = (nix:$name)\040
auto-allocate-uids = true
extra-nix-path = nixpkgs=flake:nixpkgs

And using the env:

ana@ephemeral-ubuntu:~/Downloads$ NIX_INSTALLER_EXTRA_CONF="experimental-features = improve-derivations" ./nix-installer install
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix install plan (v0.9.2-unreleased)
Planner: linux

Configured settings:
* extra_conf: ["experimental-features = improve-derivations"]

Planned actions:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.15.0/nix-2.15.0-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30000-30000) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30000-30000) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Configure Nix daemon related settings with systemd
 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`

ana@ephemeral-ubuntu:~/Downloads$ cat /etc/nix/nix.conf 
# Generated by https://github.com/DeterminateSystems/nix-installer, version 0.9.2-unreleased.
build-users-group = nixbld
auto-allocate-uids = true
extra-nix-path = nixpkgs=flake:nixpkgs
experimental-features = improve-derivations nix-command flakes auto-allocate-uids
auto-optimise-store = true
bash-prompt-prefix = (nix:$name)\040

Seems to have worked ok.

However testing in the action seems to not:

image
image

This lead me to consider maybe multiline configs are broken?

ana@ephemeral-ubuntu:~/Downloads$ NEWLINE='
        '
ana@ephemeral-ubuntu:~/Downloads$ NIX_INSTALLER_EXTRA_CONF="experimental-features = impure-derivations${NEWLINE}access-tokens = github.com=***${NEWLINE}trusted-users = root runner" ./nix-installer install
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix install plan (v0.9.2-unreleased)
Planner: linux

Configured settings:
* extra_conf: ["experimental-features = impure-derivations\n        access-tokens = github.com=***\n        trusted-users = root runner"]

Planned actions:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.15.0/nix-2.15.0-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30000-30000) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30000-30000) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Configure Nix daemon related settings with systemd
 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`

ana@ephemeral-ubuntu:~/Downloads$ cat /etc/nix/nix.conf 
# Generated by https://github.com/DeterminateSystems/nix-installer, version 0.9.2-unreleased.
build-users-group = nixbld
trusted-users = root runner
extra-nix-path = nixpkgs=flake:nixpkgs
auto-allocate-uids = true
bash-prompt-prefix = (nix:$name)\040
access-tokens = github.com=***
auto-optimise-store = true
experimental-features = impure-derivations nix-command flakes auto-allocate-uids

Testing in the action, I noticed while this doesn't work:

extra-conf: |
    experimental-features = impure-derivations

This other option is working ok?

extra-conf: "experimental-features = impure-derivations"

This is also working ok.

extra-conf: |-
  experimental-features = impure-derivations

image

Is this some goofy yaml thing???

@Hoverbear Hoverbear self-assigned this Jun 27, 2023
@Hoverbear
Copy link
Contributor

Hoverbear commented Jun 27, 2023

@cole-h and I confirmed this is fixed on our main branch and we were planning to make a new release, so hopefully this will be fixed with that! Expect by Friday it will be fixed.

(EDIT by @cole-h: The commit that fixed this was DeterminateSystems/nix-installer@7c9dfac.)

@FRidh
Copy link
Author

FRidh commented Jun 28, 2023

Is this some goofy yaml thing???

The horror called yaml!

Thank you for looking into this.

@FRidh
Copy link
Author

FRidh commented Jul 2, 2023

Using the override to 0.10.0 for now.

name: "CI using nix"

on:
    push:
      branches:
        - develop
        - main

    pull_request:
      branches:
        - develop
        - main

jobs:
    check:
        runs-on: ubuntu-22.04
        steps:
        - uses: actions/checkout@v3
        - uses: DeterminateSystems/nix-installer-action@main
          with:
            nix-installer-tag: v0.10.0
            extra-conf: |
              extra-experimental-features = nix-command flakes impure-derivations ca-derivations
        - uses: DeterminateSystems/magic-nix-cache-action@main
        - run: nix flake check

@FRidh FRidh closed this as completed Jul 2, 2023
@FRidh
Copy link
Author

FRidh commented Jul 2, 2023

That was not sufficient.

@FRidh FRidh reopened this Jul 2, 2023
@Hoverbear
Copy link
Contributor

May be related to DeterminateSystems/nix-installer#562

@FRidh
Copy link
Author

FRidh commented Jul 26, 2023

Changing from extra-conf: | to extra-conf: |- indeed works. I just made this change and that's good enough for me.

@Hoverbear
Copy link
Contributor

This should be resolved partially by #620

@FRidh
Copy link
Author

FRidh commented Sep 8, 2023

For me it can be closed since the yaml change is fine for me.

@Hoverbear Hoverbear removed their assignment Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants