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

nixUnstable: error - disabled experimental feature #80332

Closed
Izorkin opened this issue Feb 17, 2020 · 15 comments
Closed

nixUnstable: error - disabled experimental feature #80332

Izorkin opened this issue Feb 17, 2020 · 15 comments

Comments

@Izorkin
Copy link
Contributor

Izorkin commented Feb 17, 2020

Error work command

nix edit -f ./default.nix mariadb
error: experimental Nix feature 'nix-command' is disabled

And hashes checksums incorrectly

nix build -f ./default.nix mariadb
hash mismatch in fixed-output derivation '/nix/store/g6a6y8ad45wjxcph32kbdlwqkjxach28-mariadb-10.3.20.tar.gz':
  wanted: sha256-QYGPLWhOBgFDtNgpPaRMfwnMZ21xlZQF+E5tyK/7xJI=
  got:    sha256-U4GPLWhOBgFDtNgpPaRMfwnMZ21xlZQF+E5tyK/7xJI=
cannot build derivation '/nix/store/6q15r7j59kapar7cyzmkjgmpnkvgmj2f-mariadb-server-10.3.20.drv': 1 dependencies couldn't be built
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/6q15r7j59kapar7cyzmkjgmpnkvgmj2f-mariadb-server-10.3.20.drv' failed
  • system: "x86_64-linux"
  • host os: Linux 5.5.4-hardened, NixOS, 20.09.git.32bf68122c3 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.4pre7250_94c93437
  • channels(root): "nixos-20.09pre213593.6d881472ef7"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
@Izorkin
Copy link
Contributor Author

Izorkin commented Feb 17, 2020

cc @edolstra

@Izorkin Izorkin changed the title nix: error - disabled experimental feature nixUnstable: error - disabled experimental feature Feb 17, 2020
@edolstra
Copy link
Member

Yes, this is expected. nix is now hidden behind an experimental feature flag. So you need to add experimental-features = nix-command to nix.conf or pass --experimental-features nix-command.

@Izorkin
Copy link
Contributor Author

Izorkin commented Feb 17, 2020

@edolstra thanks, worked with

  nix = {
    extraOptions = ''
      experimental-features = nix-command
    '';
  };

How to fix this sha256 checksumm

  wanted: sha256-QYGPLWhOBgFDtNgpPaRMfwnMZ21xlZQF+E5tyK/7xJI=
  got:    sha256-U4GPLWhOBgFDtNgpPaRMfwnMZ21xlZQF+E5tyK/7xJI=

@edolstra
Copy link
Member

Hm, I can't reproduce the hash mismatch...

@Izorkin
Copy link
Contributor Author

Izorkin commented Feb 17, 2020

@edolstra in branch fc592a5 bad work. In d5bf8b2 correct work.

@Izorkin
Copy link
Contributor Author

Izorkin commented Feb 17, 2020

@edolstra revert this commit - dd7f6b0 - correct worked

@Izorkin
Copy link
Contributor Author

Izorkin commented Feb 18, 2020

@edolstra reproduced in virtual machine:

/etc/nixos/configuration.nix

{ config, pkgs, ... }:
{
  imports = [
    ./hardware-configuration.nix
  ];
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.device = "/dev/sda";
  networking.hostName = "nixos-test";
  networking.useDHCP = false;
  networking.interfaces.ens32.useDHCP = true;
  environment.systemPackages = with pkgs; [
    wget mc htop
  ];
  nix = {
    gc.automatic = false;
    optimise.automatic = true;
    readOnlyStore = true;
    useSandbox = true;
    package = pkgs.nixUnstable;
    extraOptions = ''
      experimental-features = nix-command
    '';
    nixPath = [
      "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs"
      "nixos-config=/etc/nixos/configuration.nix"
      "/nix/var/nix/profiles/per-user/root/channels"
    ];
  };
  services.openssh.enable = true;
  networking.firewall.enable = false;
  users.users.test = {
    isNormalUser = true;
    extraGroups = [ "wheel" ];
  };
  system.stateVersion = "20.03";
}
sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable-small
 nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.20, NixOS, 20.09pre213757.1e0222cd1f6 (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre7250_94c93437`
 - channels(root): `"nixos-20.09pre213757.1e0222cd1f6"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`

@mrkkrp
Copy link
Member

mrkkrp commented Mar 18, 2020

Just FYI the same error is happening on activation of NixOS system after rebuild. The activation step fails:

> sudo nixos-rebuild switch
[sudo] password for mark: 
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
error: experimental Nix feature 'nix-command' is disabled
Activation script snippet 'nix' failed (1)
reloading user units for sddm...
reloading user units for mark...
setting up tmpfiles
warning: error(s) occurred while switching to the new configuration

I do not understand what in my configuration is using this experimental hidden feature. Probably nothing?

@edolstra
Copy link
Member

It's probably

${nix}/bin/nix ping-store --no-net

in nixos/services/misc/nix-daemon.nix.

@mrkkrp
Copy link
Member

mrkkrp commented Mar 19, 2020

@edolstra So what would be the proper fix for this? Replacing this use of the nix command or something else?

@AleXoundOS
Copy link
Contributor

AleXoundOS commented Jul 3, 2020

Experience the same problem with nixos-rebuild when using latest nix on nixos-20.03.

@stale
Copy link

stale bot commented Dec 31, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 31, 2020
@Mic92
Copy link
Member

Mic92 commented Jan 7, 2021

Should be no longer an issue in current maintained nixos versions.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 7, 2021
@Izorkin
Copy link
Contributor Author

Izorkin commented Jan 20, 2021

In nix version 2.4pre20201205_a5d85d0 error not reproduced.

@jeff-hykin
Copy link

jeff-hykin commented Apr 29, 2022

For anyone else getting here, it took me an embarrassingly long time to figure out that CLI command is supposed to literally look like this:

nix --extra-experimental-features nix-command --extra-experimental-features flakes flake lock A_FLAKE_URL

(when trying to do: nix flake lock A_FLAKE_URL)

Not this

nix --extra-experimental-features flake flake lock A_FLAKE_URL

Or this

nix --extra-experimental-features flakes flake lock A_FLAKE_URL

Or this

nix  flake lock A_FLAKE_URL --extra-experimental-features

Or this

nix --extra-experimental-features nix flake lock A_FLAKE_URL 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants