mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
Fix runInMachine
It requires a writable /nix/store to store the build result. Also, wait until we've reached multi-user.target before doing the build, and do a sync at the end to ensure all data to $out is properly written. http://hydra.nixos.org/build/6496716
This commit is contained in:
parent
e0db0aaa4d
commit
6dafee8d67
@ -176,7 +176,10 @@ rec {
|
|||||||
let
|
let
|
||||||
vm = buildVM { }
|
vm = buildVM { }
|
||||||
[ machine
|
[ machine
|
||||||
{ key = "hostname"; networking.hostName = "client"; }
|
{ key = "run-in-machine";
|
||||||
|
networking.hostName = "client";
|
||||||
|
nix.readOnlyStore = false;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
buildrunner = writeText "vm-build" ''
|
buildrunner = writeText "vm-build" ''
|
||||||
@ -192,9 +195,11 @@ rec {
|
|||||||
|
|
||||||
testscript = ''
|
testscript = ''
|
||||||
startAll;
|
startAll;
|
||||||
|
$client->waitForUnit("multi-user.target");
|
||||||
${preBuild}
|
${preBuild}
|
||||||
$client->succeed("env -i ${pkgs.bash}/bin/bash ${buildrunner} /tmp/xchg/saved-env >&2");
|
$client->succeed("env -i ${pkgs.bash}/bin/bash ${buildrunner} /tmp/xchg/saved-env >&2");
|
||||||
${postBuild}
|
${postBuild}
|
||||||
|
$client->succeed("sync"); # flush all data before pulling the plug
|
||||||
'';
|
'';
|
||||||
|
|
||||||
vmRunCommand = writeText "vm-run" ''
|
vmRunCommand = writeText "vm-run" ''
|
||||||
|
@ -295,7 +295,7 @@ in
|
|||||||
|
|
||||||
boot.initrd.postMountCommands =
|
boot.initrd.postMountCommands =
|
||||||
''
|
''
|
||||||
# Mark this as a NixOS machinex.
|
# Mark this as a NixOS machine.
|
||||||
mkdir -p $targetRoot/etc
|
mkdir -p $targetRoot/etc
|
||||||
echo -n > $targetRoot/etc/NIXOS
|
echo -n > $targetRoot/etc/NIXOS
|
||||||
|
|
||||||
@ -303,7 +303,6 @@ in
|
|||||||
chmod 1777 $targetRoot/tmp
|
chmod 1777 $targetRoot/tmp
|
||||||
|
|
||||||
mkdir -p $targetRoot/boot
|
mkdir -p $targetRoot/boot
|
||||||
mount -o remount,ro $targetRoot/nix/store
|
|
||||||
${optionalString cfg.writableStore ''
|
${optionalString cfg.writableStore ''
|
||||||
mkdir -p /unionfs-chroot/ro-store
|
mkdir -p /unionfs-chroot/ro-store
|
||||||
mount --rbind $targetRoot/nix/store /unionfs-chroot/ro-store
|
mount --rbind $targetRoot/nix/store /unionfs-chroot/ro-store
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
{ nixpkgs ? <nixpkgs>
|
{ system ? builtins.currentSystem }:
|
||||||
, system ? builtins.currentSystem
|
|
||||||
}:
|
|
||||||
|
|
||||||
with import ../lib/testing.nix { inherit system; };
|
with import ../lib/testing.nix { inherit system; };
|
||||||
|
|
||||||
runInMachine {
|
runInMachine {
|
||||||
drv = (import nixpkgs { inherit system; }).aterm;
|
drv = pkgs.patchelf;
|
||||||
machine = { config, pkgs, ... }: { services.sshd.enable = true; };
|
machine = { config, pkgs, ... }: { services.sshd.enable = true; };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user