tests: fix running tests directly with nix-build

This commit is contained in:
lassulus 2023-01-12 20:26:17 +00:00 committed by lassulus
parent 716988d42e
commit 1b976d803c
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,10 @@
test:
{ pkgs ? import <nixpkgs> { }, ... } @ args:
{ pkgs ? import <nixpkgs> { }
, nixos-anywhere ? pkgs.callPackage ../../src { }
, disko ? "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
, kexec-installer ? builtins.fetchurl "https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-${pkgs.stdenv.hostPlatform.system}.tar.gz"
, ...
}@args:
let
inherit (pkgs) lib;
nixos-lib = import (pkgs.path + "/nixos/lib") { };
@ -9,6 +14,6 @@ in
# speed-up evaluation
defaults.documentation.enable = lib.mkDefault false;
# to accept external dependencies such as disko
node.specialArgs.inputs = args;
node.specialArgs.inputs = { inherit nixos-anywhere disko kexec-installer; };
imports = [ test ];
}).config.result

View File

@ -1,7 +1,7 @@
{ config, lib, pkgs, inputs, ... }:
let
disko = inputs.disko; #or "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix";
kexec-installer = inputs.kexec-installer; # or builtins.fetchurl "https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-${pkgs.stdenv.hostPlatform.system}.tar.gz";
disko = inputs.disko;
kexec-installer = inputs.kexec-installer;
system-to-install = pkgs.nixos [
./system-to-install.nix
disko