Nixos-rebuild - tmp path not in nix store (?)

I’m doing a nixos-rebuild dry run, and I get this error:

error: path '/tmp/nixos-rebuild.iplwAr/result' is not in the Nix store

What does this mean?

Build command is this:

nixos-rebuild --target-host root@example.com --flake .#example dry-run --impure

The --impure is a little weird, though I don’t know if its relevant. Using that because of another error:

error: cannot look up '<nixpkgs/nixos/modules/profiles/qemu-guest.nix>' in pure evaluation mode (use '--impure' to override)

and that is because of a qemu thing in hardware-configuration.nix, which I think is needed for the linode I’m building for.

1 Like

Change this to "${modulesPath}/profiles/qemu-guest.nix" and of course add modulesPath as a module arg at the top of the file.

But we can’t help with the other error without seeing your config.

Nice, --impure no longer needed.

Here’s the configs. The zknotes commit is master as of this writing

flake.nix:

{
  description = "zknotes system";

  inputs = {
    nixpkgs = { url = "github:nixos/nixpkgs/nixos-24.05"; };
    zknotes = { url = "git+https://github.com/bburdette/zknotes?rev=f8a96d2d5d8031e753f39c025f2ce77bb46e2563&submodules=1"; };
  };

  outputs = inputs:
  {
    nixosConfigurations = {

      zknotes = inputs.nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./configuration.nix
          inputs.zknotes.nixosModules.zknotes
        ];
        specialArgs = { inherit inputs; };
      };
    };
  };
}

configuration.nix:


# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, inputs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  # boot.loader.grub.version = 2;   obsolete
  boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only

  # boot.loader.grub.efiSupport = true;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

  fileSystems."/" =
   { device = "/dev/disk/by-label/nixos"; };

  services.openssh = {
    enable = true;
    settings = {
      PermitRootLogin = "yes";
      PasswordAuthentication = false;
    };
  };

  networking.usePredictableInterfaceNames = false;
  networking.useDHCP = false;
  networking.interfaces.eth0.useDHCP = true;

  # networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Set your time zone.
  # time.timeZone = "Europe/Amsterdam";

  # The global useDHCP flag is deprecated, therefore explicitly set to false here.
  # Per-interface useDHCP will be mandatory in the future, so this generated config
  # replicates the default behaviour.
  # networking.useDHCP = false;
  # networking.interfaces.enp0s5.useDHCP = true;

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Select internationalisation properties.
  # i18n.defaultLocale = "en_US.UTF-8";
  # console = {
  #   font = "Lat2-Terminus16";
  #   keyMap = "us";
  # };

  # Enable the X11 windowing system.
  # services.xserver.enable = true;

  # services.zknotes.enable = true;
  nixpkgs.overlays = [ (final: prev: {
    zknotes = inputs.zknotes.packages.${pkgs.system}.zknotes;
  })];

  services.zknotes = {
    enable = true;
    settings = ''
      ip = "0.0.0.0"
      port = 9400
      createdirs = false
      altmainsite = ["https://zknotes.com"]
      # static_path = "./static/"
      file_tmp_path = "./temp"
      file_path = "./files"
      tauri_mode = false
      [orgauth_config]
      mainsite = "https://www.zknotes.com"
      appname = "zknotes"
      emaildomain = "zknotes.com"
      db = "./zknotes.db"
      admin_email = "bburdette@wat.com"
      error_index_note = 4013
      regen_login_tokens = true
      remote_registration = false
      # login_token_expiration_ms = 15552000000
      email_token_expiration_ms = 86400000
      reset_token_expiration_ms = 86400000
      invite_token_expiration_ms = 86400000
      open_registration = false
      send_emails = true
      non_admin_invite = false
      '';
  };

  services.postfix = {
    enable = true;
    hostname = "zknotes.com";
  };

  security.acme.acceptTerms = true;
  security.acme.defaults.email = "bburdette@wat.com";

  services.nginx = {
    enable = true;

    recommendedProxySettings = true;
    clientMaxBodySize = "2G";

    virtualHosts = {
      "www.zknotes.com" = {
        forceSSL = true;
        enableACME = true;
        locations = {
          "/" = {
            proxyPass = "http://localhost:9400";
          };
        };
      };
      "zknotes.com" = {
        forceSSL = true;
        enableACME = true;
        locations = {
          "/" = {
            proxyPass = "http://localhost:9400";
          };
        };
      };
    };
  };

  users.users.bburdette = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
  };

  # services.postfix = {
  #   enable = true;
  # };

  # Configure keymap in X11
  # services.xserver.layout = "us";
  # services.xserver.xkbOptions = "eurosign:e";

  # Define a user account. Don't forget to set a password with ‘passwd’.
  # users.users.bburdette = {
  #   isNormalUser = true;
  #   extraGroups = [ "wheel" "networkmanager" ]; # Enable ‘sudo’ for the user.
  #   home = "/home/bburdette";
  # };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    helix
    wget
    mtr
    sysstat
    geoipWithDatabase
  ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Open ports in the firewall.
  networking.firewall.allowedTCPPorts = [ 22 80 443 ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "20.09"; # Did you read the comment?

}

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 = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ];
  imports = ["${modulesPath}/profiles/qemu-guest.nix"];

  boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ ];
  boot.extraModulePackages = [ ];

  swapDevices =
    [ { device = "/dev/disk/by-uuid/fd5f4bac-9038-4354-8e76-0772e8b071fd"; }
    ];

  nix.settings.max-jobs = lib.mkDefault 1;
}

The --target seems to be the culprit. This:

nixos-rebuild --target-host root@example.com --flake .#zknotes dry-run

fails with

error: path '/tmp/nixos-rebuild.2KWxZl/result' is not in the Nix store:

But without the --target arg it doesn’t get an error:

nixos-rebuild --flake .#zknotes dry-run

So at least I can get rid of the error. Not sure why that happens though, maybe its a bug?

1 Like