feat: windows-devshell
This commit is contained in:
44
test/package/windows-devshell/default.nix
Normal file
44
test/package/windows-devshell/default.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{ system, inputs, self, pkgs }:
|
||||
let
|
||||
lib = inputs.nixpkgs.lib;
|
||||
|
||||
windowsDevShellStandalone = self.packages.${system}.windows-devshell-standalone;
|
||||
|
||||
mkTest = testName: testDrv: pkgs.runCommand "windows-devshell-test-${testName}"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.coreutils pkgs.gnugrep ];
|
||||
windowsDevShellStandalone = windowsDevShellStandalone;
|
||||
} ''
|
||||
${builtins.readFile self.legacyPackages.${system}.helpers.posix-shell.log}
|
||||
test=${testDrv}
|
||||
${builtins.readFile ./launch.sh}
|
||||
mkdir -p "$out"
|
||||
'';
|
||||
|
||||
testDir = builtins.readDir ./test;
|
||||
testDrvs =
|
||||
lib.mapAttrs' (n: v:
|
||||
lib.nameValuePair (lib.removeSuffix ".sh" n) v
|
||||
) (lib.filterAttrs (_: v: v != null)
|
||||
(lib.mapAttrs (n: t:
|
||||
if t == "directory" then
|
||||
pkgs.runCommand "test-${n}" {} ''
|
||||
if ! [ -f ${./test + "/${n}" + /run.sh} ]; then
|
||||
echo "no run.sh in test/${n}"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$out"
|
||||
cp -r ${./test + "/${n}"}/* "$out/"
|
||||
chmod +x "$out/run.sh"
|
||||
''
|
||||
else if lib.hasSuffix ".sh" n then
|
||||
pkgs.runCommand "test-${lib.removeSuffix ".sh" n}" {} ''
|
||||
mkdir -p "$out"
|
||||
install -Dm755 ${./test + "/${n}"} "$out/run.sh"
|
||||
''
|
||||
else
|
||||
null
|
||||
) testDir));
|
||||
|
||||
in
|
||||
(lib.mapAttrs' (name: drv: lib.nameValuePair "windows-${name}" (mkTest "windows-${name}" drv)) testDrvs)
|
||||
Reference in New Issue
Block a user