NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.82k stars 363 forks source link

`nixops deploy` attempts to build x86 kernel config on aarch64? #1510

Open wbadart opened 2 years ago

wbadart commented 2 years ago

I'm running NixOS 22.05pre358459.3e072546ea9 (installed from nixos-sd-image-22.05pre356838.2ddea5e3f70-aarch64-linux.img) on a Raspberry Pi 4. Running nixos-rebuild switch locally (on the pi) succeeds.

However, when I copy the config to my laptop and import it in a nixops config like

{
  pi =
    { config, pkgs, ... }:
    { imports = [
        ./pi/configuration.nix
      ];
      deployment.targetHost = "192.168.X.X";
    };
}

and run nixops deploy, it throws:

       > *** Can't find default configuration "arch/x86/configs/bcm2711_defconfig"!

Has anyone encountered something like this before? Thanks!


# pi/configuration.nix
{ config, pkgs, lib, ... }:

let
    ssh_keys = import ./ssh-keys.nix;
  in {
    imports = [
      ./hardware-configuration.nix
      "${fetchTarball { url = "https://github.com/NixOS/nixos-hardware/archive/936e4649098d6a5e0762058cb7687be1b2d90550.tar.gz"; sha256 = "06g0061xm48i5w7gz5sm5x5ps6cnipqv1m483f8i9mmhlz77hvlw"; }}/raspberry-pi/4"

    ];

    fileSystems."/".options = [ "noatime" ];

    networking = {
      hostName = "mypi";
    };

    services.openssh.enable = true;

    users = {
      users.me = {
        isNormalUser = true;
        extraGroups = [ "wheel" ];
        openssh.authorizedKeys.keys = ssh_keys;
      };
      users.root.openssh.authorizedKeys.keys = ssh_keys;
    };

    # Enable GPU acceleration
    hardware.raspberry-pi."4".fkms-3d.enable = true;
  }
# pi/hardware-configuration.nix

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/XXXX";
      fsType = "ext4";
    };

  swapDevices = [ ];

  networking.useDHCP = lib.mkDefault false;
  networking.interfaces.eth0.useDHCP = lib.mkDefault true;
  networking.interfaces.wlan0.useDHCP = lib.mkDefault true;

  powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}
More nixops deploy output:
building
make: Entering directory '/build/source'
make[1]: Entering directory '/build/source/build'
  GEN     Makefile
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
***
*** Can't find default configuration "arch/x86/configs/bcm2711_defconfig"!
***
make[2]: *** [../scripts/kconfig/Makefile:88: bcm2711_defconfig] Error 1
make[1]: *** [/build/source/Makefile:603: bcm2711_defconfig] Error 2
make[1]: Leaving directory '/build/source/build'
make: *** [Makefile:185: __sub-make] Error 2
make: Leaving directory '/build/source'
error: builder for '/nix/store/3baxqfam7n9nb8sw9qpdhr3n43r9vbqr-linux-config-5.10.92-1.20220118.drv' failed with exit code 2;
       last 10 log lines:
       >   HOSTCC  scripts/kconfig/util.o
       >   HOSTLD  scripts/kconfig/conf
       > ***
       > *** Can't find default configuration "arch/x86/configs/bcm2711_defconfig"!
       > ***
       > make[2]: *** [../scripts/kconfig/Makefile:88: bcm2711_defconfig] Error 1
       > make[1]: *** [/build/source/Makefile:603: bcm2711_defconfig] Error 2
       > make[1]: Leaving directory '/build/source/build'
       > make: *** [Makefile:185: __sub-make] Error 2
       > make: Leaving directory '/build/source'
       For full logs, run 'nix log /nix/store/3baxqfam7n9nb8sw9qpdhr3n43r9vbqr-linux-config-5.10.92-1.20220118.drv'.
error: 1 dependencies of derivation '/nix/store/k72p45km2g6j51s54hhryc42pa6nhsji-linux-5.10.92-1.20220118.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5ql2gmy7s8jil2a46c4223n4b7si9dhj-nixos-system-wb-pi-22.05pre358459.3e072546ea9.drv' failed to build
error: 1 dependencies of derivation '/nix/store/akcx0nbv3j6nj78r7p1avib215679igm-nixops-machines.drv' failed to build
Traceback (most recent call last):
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/bin/..nixops-wrapped-wrapped", line 991, in 
    args.op()
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/bin/..nixops-wrapped-wrapped", line 412, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1052, in run_with_notify
    f()
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in 
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1003, in _deploy
    self.configs_path = self.build_configs(dry_run=dry_run, repair=repair, include=include, exclude=exclude)
  File "/nix/store/p7hfw29c36qi5ab7ky6sqkpykcj5imlx-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 671, in build_configs
    raise Exception("unable to build all machine configurations")
Exception: unable to build all machine configurations
roberth commented 2 years ago

We should require a system string for all nodes. We can only assume the default to be wrong. Probably implementable with an assertions on options.nixpkgs.system.highestPrio? Unsetting the default in nixpkgs is not feasible.