tests: refactor
This commit is contained in:
parent
8a6bd41baa
commit
d7a0cbefe5
12 changed files with 184 additions and 127 deletions
63
tests/mk-test-configuration-dot-nix.nix
Normal file
63
tests/mk-test-configuration-dot-nix.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
}: let
|
||||
stdenv = stdenvNoCC;
|
||||
|
||||
mkDynixConfigurationDotNix = finalAttrs: {
|
||||
name,
|
||||
configuration,
|
||||
}: assert lib.isStringLike configuration; let
|
||||
self = finalAttrs.finalPackage;
|
||||
in {
|
||||
name = "configuration-dot-nix-for-${name}";
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
preferLocalBuild = true;
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
#outputs = [ "out" "modules" ];
|
||||
outputs = [ "out" ];
|
||||
modulesOut = "${placeholder "out"}/share/nixos";
|
||||
#modulesOut = "${placeholder "modules"}/share/nixos/modules";
|
||||
|
||||
baseConfiguration = configuration;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm a=r "$baseConfiguration" "$modulesOut/test-configuration.nix"
|
||||
install -Dm a=r "${./dynix-vm-configuration.nix}" "$modulesOut/dynix-vm-configuration.nix"
|
||||
|
||||
echo "/** GENERATED BY mk-test-configuration-dot-nix! */" >> "$modulesOut/configuration.nix"
|
||||
echo "{ ... }:" >> "$modulesOut/configuration.nix"
|
||||
echo >> "$modulesOut/configuration.nix"
|
||||
echo >> "$modulesOut/configuration.nix"
|
||||
echo "{" >> "$modulesOut/configuration.nix"
|
||||
echo " imports = [" >> "$modulesOut/configuration.nix"
|
||||
echo " ./test-configuration.nix" >> "$modulesOut/configuration.nix"
|
||||
echo " ./dynix-vm-configuration.nix" >> "$modulesOut/configuration.nix"
|
||||
echo " ./hardware-configuration.nix" >> "$modulesOut/configuration.nix"
|
||||
echo " ];" >> "$modulesOut/configuration.nix"
|
||||
echo "}" >> "$modulesOut/configuration.nix"
|
||||
|
||||
#mkdir -p "$out"
|
||||
#cp -r --reflink=auto "$modulesOut/"* "$out/"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
modulesPath = self.out + "/share/nixos";
|
||||
configuration = self.out + "/share/nixos/configuration.nix";
|
||||
};
|
||||
|
||||
meta = {
|
||||
#outputsToInstall = [ "modules" ];
|
||||
};
|
||||
};
|
||||
in lib.extendMkDerivation {
|
||||
constructDrv = stdenv.mkDerivation;
|
||||
extendDrvArgs = mkDynixConfigurationDotNix;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue