summary refs log tree commit diff
path: root/pkgs/test
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/test')
-rw-r--r--pkgs/test/cc-wrapper/default.nix32
-rw-r--r--pkgs/test/cc-wrapper/multilib.nix4
-rw-r--r--pkgs/test/cuda/cuda-library-samples/default.nix42
-rw-r--r--pkgs/test/cuda/cuda-library-samples/generic.nix70
-rw-r--r--pkgs/test/cuda/cuda-samples/default.nix44
-rw-r--r--pkgs/test/cuda/cuda-samples/generic.nix51
-rw-r--r--pkgs/test/cuda/default.nix24
-rw-r--r--pkgs/test/default.nix17
-rw-r--r--pkgs/test/haskell-shellFor/default.nix24
-rw-r--r--pkgs/test/haskell/default.nix8
-rw-r--r--pkgs/test/haskell/documentationTarball/default.nix21
-rw-r--r--pkgs/test/haskell/setBuildTarget/Bar.hs4
-rw-r--r--pkgs/test/haskell/setBuildTarget/Foo.hs4
-rw-r--r--pkgs/test/haskell/setBuildTarget/Setup.hs2
-rw-r--r--pkgs/test/haskell/setBuildTarget/default.nix43
-rw-r--r--pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal16
-rw-r--r--pkgs/test/haskell/shellFor/default.nix36
-rw-r--r--pkgs/test/haskell/writers/default.nix26
-rw-r--r--pkgs/test/install-shell-files/default.nix125
-rw-r--r--pkgs/test/ld-library-path/default.nix4
-rw-r--r--pkgs/test/patch-shebangs/default.nix80
-rw-r--r--pkgs/test/rust-sysroot/default.nix60
-rw-r--r--pkgs/test/stdenv-inputs/default.nix8
-rw-r--r--pkgs/test/texlive/default.nix167
-rw-r--r--pkgs/test/vim/default.nix63
25 files changed, 915 insertions, 60 deletions
diff --git a/pkgs/test/cc-wrapper/default.nix b/pkgs/test/cc-wrapper/default.nix
index c0c89d63fff..b483372dea0 100644
--- a/pkgs/test/cc-wrapper/default.nix
+++ b/pkgs/test/cc-wrapper/default.nix
@@ -1,11 +1,13 @@
-{ stdenv }:
-with stdenv.lib;
+{ lib, stdenv, glibc }:
+
 let
   # Sanitizers are not supported on Darwin.
   # Sanitizer headers aren't available in older libc++ stdenvs due to a bug
-  sanitizersWorking =
-       (stdenv.cc.isClang && versionAtLeast (getVersion stdenv.cc.name) "5.0.0")
-    || (stdenv.cc.isGNU && stdenv.isLinux);
+  sanitizersWorking = !stdenv.hostPlatform.isMusl && (
+    (stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "5.0.0")
+    || (stdenv.cc.isGNU && stdenv.isLinux)
+  );
+  staticLibc = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib";
 in stdenv.mkDerivation {
   name = "cc-wrapper-test";
 
@@ -21,13 +23,25 @@ in stdenv.mkDerivation {
     $CXX -o cxx-check ${./cxx-main.cc}
     ./cxx-check
 
-    ${optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
+    ${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
       printf "checking whether compiler can build with CoreFoundation.framework... " >&2
       mkdir -p foo/lib
       $CC -framework CoreFoundation -o core-foundation-check ${./core-foundation-main.c}
       ./core-foundation-check
     ''}
 
+
+    ${lib.optionalString (!stdenv.isDarwin) ''
+      printf "checking whether compiler builds valid static C binaries... " >&2
+      $CC ${staticLibc} -static -o cc-static ${./cc-main.c}
+      ./cc-static
+      ${lib.optionalString (stdenv.cc.isGNU && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "8.0.0") ''
+        printf "checking whether compiler builds valid static pie C binaries... " >&2
+        $CC ${staticLibc} -static-pie -o cc-static-pie ${./cc-main.c}
+        ./cc-static-pie
+      ''}
+    ''}
+
     printf "checking whether compiler uses NIX_CFLAGS_COMPILE... " >&2
     mkdir -p foo/include
     cp ${./foo.c} foo/include/foo.h
@@ -37,7 +51,7 @@ in stdenv.mkDerivation {
     printf "checking whether compiler uses NIX_LDFLAGS... " >&2
     mkdir -p foo/lib
     $CC -shared \
-      ${optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
+      ${lib.optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
       -DVALUE=42 \
       -o foo/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
       ${./foo.c}
@@ -53,7 +67,7 @@ in stdenv.mkDerivation {
     $CXX -I std-include -nostdinc++ -o nostdinc-main++ ${./nostdinc-main.c}
     ./nostdinc-main++
 
-    ${optionalString sanitizersWorking ''
+    ${lib.optionalString sanitizersWorking ''
       printf "checking whether sanitizers are fully functional... ">&2
       $CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
       ./sanitizers
@@ -62,5 +76,5 @@ in stdenv.mkDerivation {
     touch $out
   '';
 
-  meta.platforms = platforms.all;
+  meta.platforms = lib.platforms.all;
 }
diff --git a/pkgs/test/cc-wrapper/multilib.nix b/pkgs/test/cc-wrapper/multilib.nix
index 5ea50b5eb26..828ad67f6c8 100644
--- a/pkgs/test/cc-wrapper/multilib.nix
+++ b/pkgs/test/cc-wrapper/multilib.nix
@@ -1,4 +1,4 @@
-{ stdenv }:
+{ lib, stdenv }:
 
 stdenv.mkDerivation {
   name = "cc-multilib-test";
@@ -33,5 +33,5 @@ stdenv.mkDerivation {
     touch $out
   '';
 
-  meta.platforms = stdenv.lib.platforms.x86_64;
+  meta.platforms = lib.platforms.x86_64;
 }
diff --git a/pkgs/test/cuda/cuda-library-samples/default.nix b/pkgs/test/cuda/cuda-library-samples/default.nix
new file mode 100644
index 00000000000..91095fbd3ac
--- /dev/null
+++ b/pkgs/test/cuda/cuda-library-samples/default.nix
@@ -0,0 +1,42 @@
+{ callPackage
+, cudatoolkit_10_1, cudatoolkit_10_2
+, cudatoolkit_11_0, cudatoolkit_11_1, cudatoolkit_11_2
+, cutensor_cudatoolkit_10_1, cutensor_cudatoolkit_10_2
+, cutensor_cudatoolkit_11_0, cutensor_cudatoolkit_11_1, cutensor_cudatoolkit_11_2
+}:
+
+rec {
+
+  cuda-library-samples_cudatoolkit_10_1 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_1;
+    cutensor_cudatoolkit = cutensor_cudatoolkit_10_1;
+  };
+
+  cuda-library-samples_cudatoolkit_10_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_2;
+    cutensor_cudatoolkit = cutensor_cudatoolkit_10_2;
+  };
+
+  cuda-library-samples_cudatoolkit_10 =
+    cuda-library-samples_cudatoolkit_10_2;
+
+  ##
+
+  cuda-library-samples_cudatoolkit_11_0 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_0;
+    cutensor_cudatoolkit = cutensor_cudatoolkit_11_0;
+  };
+
+  cuda-library-samples_cudatoolkit_11_1 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_1;
+    cutensor_cudatoolkit = cutensor_cudatoolkit_11_1;
+  };
+
+  cuda-library-samples_cudatoolkit_11_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_2;
+    cutensor_cudatoolkit = cutensor_cudatoolkit_11_2;
+  };
+
+  cuda-library-samples_cudatoolkit_11 =
+    cuda-library-samples_cudatoolkit_11_2;
+}
diff --git a/pkgs/test/cuda/cuda-library-samples/generic.nix b/pkgs/test/cuda/cuda-library-samples/generic.nix
new file mode 100644
index 00000000000..f1ce243bfa6
--- /dev/null
+++ b/pkgs/test/cuda/cuda-library-samples/generic.nix
@@ -0,0 +1,70 @@
+{ lib, stdenv, fetchFromGitHub
+, cmake, addOpenGLRunpath
+, cudatoolkit
+, cutensor_cudatoolkit
+}:
+
+let
+  rev = "5aab680905d853bce0dbad4c488e4f7e9f7b2302";
+  src = fetchFromGitHub {
+    owner = "NVIDIA";
+    repo = "CUDALibrarySamples";
+    inherit rev;
+    sha256 = "0gwgbkq05ygrfgg5hk07lmap7n7ampxv0ha1axrv8qb748ph81xs";
+  };
+  commonAttrs = {
+    version = lib.strings.substring 0 7 rev + "-" + lib.versions.majorMinor cudatoolkit.version;
+    nativeBuildInputs = [ cmake addOpenGLRunpath ];
+    buildInputs = [ cudatoolkit ];
+    enableParallelBuilding = true;
+    postFixup = ''
+      for exe in $out/bin/*; do
+        addOpenGLRunpath $exe
+      done
+    '';
+    meta = {
+      description = "examples of using libraries using CUDA";
+      longDescription = ''
+        CUDA Library Samples contains examples demonstrating the use of
+        features in the math and image processing libraries cuBLAS, cuTENSOR,
+        cuSPARSE, cuSOLVER, cuFFT, cuRAND, NPP and nvJPEG.
+      '';
+      license = lib.licenses.bsd3;
+      maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
+    };
+  };
+in
+
+{
+  cublas = stdenv.mkDerivation (commonAttrs // {
+    pname = "cuda-library-samples-cublas";
+
+    src = "${src}/cuBLASLt";
+  });
+
+  cusolver = stdenv.mkDerivation (commonAttrs // {
+    pname = "cuda-library-samples-cusolver";
+
+    src = "${src}/cuSOLVER";
+
+    sourceRoot = "cuSOLVER/gesv";
+  });
+
+  cutensor = stdenv.mkDerivation (commonAttrs // {
+    pname = "cuda-library-samples-cutensor";
+
+    src = "${src}/cuTENSOR";
+
+    cmakeFlags = [
+      "-DCUTENSOR_EXAMPLE_BINARY_INSTALL_DIR=${builtins.placeholder "out"}/bin"
+    ];
+
+    # CUTENSOR_ROOT is double escaped
+    postPatch = ''
+      substituteInPlace CMakeLists.txt \
+        --replace "\''${CUTENSOR_ROOT}/include" "${cutensor_cudatoolkit.dev}/include"
+    '';
+
+    CUTENSOR_ROOT = cutensor_cudatoolkit;
+  });
+}
diff --git a/pkgs/test/cuda/cuda-samples/default.nix b/pkgs/test/cuda/cuda-samples/default.nix
new file mode 100644
index 00000000000..1a361c57214
--- /dev/null
+++ b/pkgs/test/cuda/cuda-samples/default.nix
@@ -0,0 +1,44 @@
+{ callPackage
+, cudatoolkit_10_0, cudatoolkit_10_1, cudatoolkit_10_2
+, cudatoolkit_11_0, cudatoolkit_11_1, cudatoolkit_11_2
+}:
+
+rec {
+  ##
+
+  cuda-samples_cudatoolkit_10_0 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_0;
+    sha256 = "1zvh4xsdyc59m87brpcmssxsjlp9dkynh4asnkcmc3g94f53l0jw";
+  };
+
+  cuda-samples_cudatoolkit_10_1 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_1;
+    sha256 = "1s8ka0hznrni36ajhzf2gqpdrl8kd8fi047qijxks5l2abc093qd";
+  };
+
+  cuda-samples_cudatoolkit_10_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_2;
+    sha256 = "01p1innzgh9siacpld6nsqimj8jkg93rk4gj8q4crn62pa5vhd94";
+  };
+
+  cuda-samples_cudatoolkit_10 = cuda-samples_cudatoolkit_10_2;
+
+  ##
+
+  cuda-samples_cudatoolkit_11_0 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_0;
+    sha256 = "1n3vjc8c7zdig2xgl5fppavrphqzhdiv9m9nk6smh4f99fwi0705";
+  };
+
+  cuda-samples_cudatoolkit_11_1 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_1;
+    sha256 = "1kjixk50i8y1bkiwbdn5lkv342crvkmbvy1xl5j3lsa1ica21kwh";
+  };
+
+  cuda-samples_cudatoolkit_11_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_2;
+    sha256 = "1p1qjvfbm28l933mmnln02rqrf0cy9kbpsyb488d1haiqzvrazl1";
+  };
+
+  cuda-samples_cudatoolkit_11 = cuda-samples_cudatoolkit_11_2;
+}
diff --git a/pkgs/test/cuda/cuda-samples/generic.nix b/pkgs/test/cuda/cuda-samples/generic.nix
new file mode 100644
index 00000000000..2e3dcc8891f
--- /dev/null
+++ b/pkgs/test/cuda/cuda-samples/generic.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv, fetchFromGitHub
+, pkg-config, addOpenGLRunpath
+, sha256, cudatoolkit
+}:
+
+let
+  pname = "cuda-samples";
+  version = lib.versions.majorMinor cudatoolkit.version;
+in
+
+stdenv.mkDerivation {
+  inherit pname version;
+
+  src = fetchFromGitHub {
+    owner = "NVIDIA";
+    repo = pname;
+    rev = "v${version}";
+    inherit sha256;
+  };
+
+  nativeBuildInputs = [ pkg-config addOpenGLRunpath ];
+
+  buildInputs = [ cudatoolkit ];
+
+  enableParallelBuilding = true;
+
+  preConfigure = ''
+    export CUDA_PATH=${cudatoolkit}
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 -t $out/bin bin/${stdenv.hostPlatform.parsed.cpu.name}/${stdenv.hostPlatform.parsed.kernel.name}/release/*
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    for exe in $out/bin/*; do
+      addOpenGLRunpath $exe
+    done
+  '';
+
+  meta = {
+    description = "Samples for CUDA Developers which demonstrates features in CUDA Toolkit";
+    # CUDA itself is proprietary, but these sample apps are not.
+    license = lib.licenses.bsd3;
+    maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
+  };
+}
diff --git a/pkgs/test/cuda/default.nix b/pkgs/test/cuda/default.nix
new file mode 100644
index 00000000000..aac52e6a4f5
--- /dev/null
+++ b/pkgs/test/cuda/default.nix
@@ -0,0 +1,24 @@
+{ callPackage }:
+
+rec {
+  cuda-samplesPackages = callPackage ./cuda-samples { };
+  inherit (cuda-samplesPackages)
+    cuda-samples_cudatoolkit_10
+    cuda-samples_cudatoolkit_10_0
+    cuda-samples_cudatoolkit_10_1
+    cuda-samples_cudatoolkit_10_2
+    cuda-samples_cudatoolkit_11
+    cuda-samples_cudatoolkit_11_0
+    cuda-samples_cudatoolkit_11_1
+    cuda-samples_cudatoolkit_11_2;
+
+  cuda-library-samplesPackages = callPackage ./cuda-library-samples { };
+  inherit (cuda-library-samplesPackages)
+    cuda-library-samples_cudatoolkit_10
+    cuda-library-samples_cudatoolkit_10_1
+    cuda-library-samples_cudatoolkit_10_2
+    cuda-library-samples_cudatoolkit_11
+    cuda-library-samples_cudatoolkit_11_0
+    cuda-library-samples_cudatoolkit_11_1
+    cuda-library-samples_cudatoolkit_11_2;
+}
diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix
index c248eebaec3..ebf732839ce 100644
--- a/pkgs/test/default.nix
+++ b/pkgs/test/default.nix
@@ -22,11 +22,13 @@ with pkgs;
   cc-wrapper-libcxx-9 = callPackage ./cc-wrapper { stdenv = llvmPackages_9.libcxxStdenv; };
   stdenv-inputs = callPackage ./stdenv-inputs { };
 
-  haskell-shellFor = callPackage ./haskell-shellFor { };
+  haskell = callPackage ./haskell { };
 
   cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
   cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; };
 
+  install-shell-files = callPackage ./install-shell-files {};
+
   kernel-config = callPackage ./kernel.nix {};
 
   ld-library-path = callPackage ./ld-library-path {};
@@ -35,9 +37,22 @@ with pkgs;
 
   cross = callPackage ./cross {};
 
+  rustCustomSysroot = callPackage ./rust-sysroot {};
+  buildRustCrate = callPackage ../build-support/rust/build-rust-crate/test { };
+  importCargoLock = callPackage ../build-support/rust/test/import-cargo-lock { };
+
+  vim = callPackage ./vim {};
+
   nixos-functions = callPackage ./nixos-functions {};
 
   patch-shebangs = callPackage ./patch-shebangs {};
 
+  texlive = callPackage ./texlive {};
+
+  cuda = callPackage ./cuda { };
+
+  trivial = callPackage ../build-support/trivial-builders/test.nix {};
+  trivial-overriding = callPackage ../build-support/trivial-builders/test-overriding.nix {};
+
   writers = callPackage ../build-support/writers/test.nix {};
 }
diff --git a/pkgs/test/haskell-shellFor/default.nix b/pkgs/test/haskell-shellFor/default.nix
deleted file mode 100644
index 1b3de999d22..00000000000
--- a/pkgs/test/haskell-shellFor/default.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ stdenv, haskellPackages, cabal-install }:
-
-haskellPackages.shellFor {
-  packages = p: [ p.database-id-class p.constraints-extras ];
-  nativeBuildInputs = [ cabal-install ];
-  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
-  unpackPhase = ''
-    sourceRoot=$(pwd)/scratch
-    mkdir -p "$sourceRoot"
-    cd "$sourceRoot"
-    tar -xf ${haskellPackages.database-id-class.src}
-    tar -xf ${haskellPackages.constraints-extras.src}
-    cp ${builtins.toFile "cabal.project" "packages: database-id-class* constraints-extras*"} cabal.project
-  '';
-  buildPhase = ''
-    export HOME=$(mktemp -d)
-    mkdir -p $HOME/.cabal
-    touch $HOME/.cabal/config
-    cabal v2-build --offline --verbose database-id-class constraints-extras --ghc-options="-O0 -j$NIX_BUILD_CORES"
-  '';
-  installPhase = ''
-    touch $out
-  '';
-}
diff --git a/pkgs/test/haskell/default.nix b/pkgs/test/haskell/default.nix
new file mode 100644
index 00000000000..03e4f346155
--- /dev/null
+++ b/pkgs/test/haskell/default.nix
@@ -0,0 +1,8 @@
+{ lib, callPackage }:
+
+lib.recurseIntoAttrs {
+  shellFor = callPackage ./shellFor { };
+  documentationTarball = callPackage ./documentationTarball { };
+  setBuildTarget = callPackage ./setBuildTarget { };
+  writers = callPackage ./writers { };
+}
diff --git a/pkgs/test/haskell/documentationTarball/default.nix b/pkgs/test/haskell/documentationTarball/default.nix
new file mode 100644
index 00000000000..e3214fb49fe
--- /dev/null
+++ b/pkgs/test/haskell/documentationTarball/default.nix
@@ -0,0 +1,21 @@
+{ pkgs, haskellPackages }:
+
+let
+  drv = haskellPackages.vector;
+  docs = pkgs.haskell.lib.documentationTarball drv;
+
+in pkgs.runCommand "test haskell.lib.documentationTarball" {
+  meta = {
+    inherit (docs.meta) platforms;
+  };
+} ''
+  tar xvzf "${docs}/${drv.name}-docs.tar.gz"
+
+  # Check for Haddock html
+  find "${drv.name}-docs" | grep -q "Data-Vector.html"
+
+  # Check for source html
+  find "${drv.name}-docs" | grep -q  "src/Data.Vector.html"
+
+  touch "$out"
+''
diff --git a/pkgs/test/haskell/setBuildTarget/Bar.hs b/pkgs/test/haskell/setBuildTarget/Bar.hs
new file mode 100644
index 00000000000..010014082c7
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/Bar.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Bar!"
diff --git a/pkgs/test/haskell/setBuildTarget/Foo.hs b/pkgs/test/haskell/setBuildTarget/Foo.hs
new file mode 100644
index 00000000000..fec7bb11fe6
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/Foo.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Foo!"
diff --git a/pkgs/test/haskell/setBuildTarget/Setup.hs b/pkgs/test/haskell/setBuildTarget/Setup.hs
new file mode 100644
index 00000000000..9a994af677b
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/pkgs/test/haskell/setBuildTarget/default.nix b/pkgs/test/haskell/setBuildTarget/default.nix
new file mode 100644
index 00000000000..5a8391d0886
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/default.nix
@@ -0,0 +1,43 @@
+{ pkgs, haskellPackages }:
+
+let
+  # This can be regenerated by running `cabal2nix .` in the current directory.
+  pkgDef =
+    { mkDerivation, base, lib }:
+      mkDerivation {
+        pname = "haskell-setBuildTarget";
+        version = "0.1.0.0";
+        src = ./.;
+        isLibrary = false;
+        isExecutable = true;
+        executableHaskellDepends = [ base ];
+        license = lib.licenses.bsd3;
+      };
+
+  drv = haskellPackages.callPackage pkgDef {};
+
+  test  = target: excluded:
+    let only = pkgs.haskell.lib.setBuildTarget drv target;
+    in ''
+         if [[ ! -f "${only}/bin/${target}" ]]; then
+           echo "${target} was not built"
+           exit 1
+         fi
+
+         if [[ -f "${only}/bin/${excluded}" ]]; then
+           echo "${excluded} was built, when it should not have been"
+           exit 1
+         fi
+     '';
+
+in
+pkgs.runCommand "test haskell.lib.setBuildTarget" {
+  meta = {
+    inherit (drv.meta) platforms;
+  };
+} ''
+  ${test "foo" "bar"}
+  ${test "bar" "foo"}
+  touch "$out"
+''
+
diff --git a/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal b/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal
new file mode 100644
index 00000000000..7395e139451
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal
@@ -0,0 +1,16 @@
+cabal-version:       >=1.10
+name:                haskell-setBuildTarget
+version:             0.1.0.0
+author:              Isaac Shapira
+maintainer:          fresheyeball@protonmail.com
+build-type:          Simple
+
+executable foo
+  main-is:             Foo.hs
+  build-depends:       base
+  default-language:    Haskell2010
+
+executable bar
+  main-is:             Bar.hs
+  build-depends:       base
+  default-language:    Haskell2010
diff --git a/pkgs/test/haskell/shellFor/default.nix b/pkgs/test/haskell/shellFor/default.nix
new file mode 100644
index 00000000000..04f5e045361
--- /dev/null
+++ b/pkgs/test/haskell/shellFor/default.nix
@@ -0,0 +1,36 @@
+{ lib, writeText, haskellPackages, cabal-install }:
+
+(haskellPackages.shellFor {
+  packages = p: [ p.constraints p.linear ];
+  nativeBuildInputs = [ cabal-install ];
+  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
+  unpackPhase = ''
+    sourceRoot=$(pwd)/scratch
+    mkdir -p "$sourceRoot"
+    cd "$sourceRoot"
+    tar -xf ${haskellPackages.constraints.src}
+    tar -xf ${haskellPackages.linear.src}
+    cp ${writeText "cabal.project" "packages: constraints* linear*"} cabal.project
+  '';
+  buildPhase = ''
+    export HOME=$(mktemp -d)
+    mkdir -p $HOME/.cabal
+    touch $HOME/.cabal/config
+    cabal v2-build --offline --verbose constraints linear --ghc-options="-O0 -j$NIX_BUILD_CORES"
+  '';
+  installPhase = ''
+    touch $out
+  '';
+}).overrideAttrs (oldAttrs: {
+  meta =
+    let
+      oldMeta = oldAttrs.meta or {};
+      oldMaintainers = oldMeta.maintainers or [];
+      additionalMaintainers = with lib.maintainers; [ cdepillabout ];
+      allMaintainers = oldMaintainers ++ additionalMaintainers;
+    in
+    oldMeta // {
+      maintainers = allMaintainers;
+      inherit (cabal-install.meta) platforms;
+    };
+})
diff --git a/pkgs/test/haskell/writers/default.nix b/pkgs/test/haskell/writers/default.nix
new file mode 100644
index 00000000000..f05fda4bc73
--- /dev/null
+++ b/pkgs/test/haskell/writers/default.nix
@@ -0,0 +1,26 @@
+# Wrap only the haskell-related tests from tests.writers
+# in their own derivation for Hydra CI in the haskell-updates
+# jobset. Can presumably removed as soon as tests.writers is
+# always green on darwin as well:
+# https://github.com/NixOS/nixpkgs/issues/126182
+{ runCommand, tests }:
+
+let
+  inherit (tests.writers)
+    writeTest
+    bin
+    simple
+    path
+    ;
+in
+
+runCommand "test-haskell-writers" {
+  meta = {
+    inherit (tests.writers.meta) platforms;
+  };
+} ''
+  ${writeTest "success" "test-haskell-bin-writer" "${bin.haskell}/bin/${bin.haskell.name}"}
+  ${writeTest "success" "test-haskell-simple-writer" simple.haskell}
+  ${writeTest "success" "test-haskell-path-writer" path.haskell}
+  touch $out
+''
diff --git a/pkgs/test/install-shell-files/default.nix b/pkgs/test/install-shell-files/default.nix
new file mode 100644
index 00000000000..aef5acc1de6
--- /dev/null
+++ b/pkgs/test/install-shell-files/default.nix
@@ -0,0 +1,125 @@
+{ lib, runCommandLocal, recurseIntoAttrs, installShellFiles }:
+
+let
+  runTest = name: env: buildCommand:
+    runCommandLocal "install-shell-files--${name}" ({
+      nativeBuildInputs = [ installShellFiles ];
+      meta.platforms = lib.platforms.all;
+    } // env) buildCommand;
+in
+
+recurseIntoAttrs {
+  # installManPage
+
+  install-manpage = runTest "install-manpage" {} ''
+    mkdir -p doc
+    echo foo > doc/foo.1
+    echo bar > doc/bar.2.gz
+    echo baz > doc/baz.3
+
+    installManPage doc/*
+
+    cmp doc/foo.1 $out/share/man/man1/foo.1
+    cmp doc/bar.2.gz $out/share/man/man2/bar.2.gz
+    cmp doc/baz.3 $out/share/man/man3/baz.3
+  '';
+  install-manpage-outputs = runTest "install-manpage-outputs" {
+    outputs = [ "out" "man" "devman" ];
+  } ''
+    mkdir -p doc
+    echo foo > doc/foo.1
+    echo bar > doc/bar.3
+
+    installManPage doc/*
+
+    # assert they didn't go into $out
+    [[ ! -f $out/share/man/man1/foo.1 && ! -f $out/share/man/man3/bar.3 ]]
+
+    # foo.1 alone went into man
+    cmp doc/foo.1 ''${!outputMan:?}/share/man/man1/foo.1
+    [[ ! -f ''${!outputMan:?}/share/man/man3/bar.3 ]]
+
+    # bar.3 alone went into devman
+    cmp doc/bar.3 ''${!outputDevman:?}/share/man/man3/bar.3
+    [[ ! -f ''${!outputDevman:?}/share/man/man1/foo.1 ]]
+
+    touch $out
+  '';
+
+  # installShellCompletion
+
+  install-completion = runTest "install-completion" {} ''
+    echo foo > foo
+    echo bar > bar
+    echo baz > baz
+    echo qux > qux.zsh
+    echo quux > quux
+
+    installShellCompletion --bash foo bar --zsh baz qux.zsh --fish quux
+
+    cmp foo $out/share/bash-completion/completions/foo
+    cmp bar $out/share/bash-completion/completions/bar
+    cmp baz $out/share/zsh/site-functions/_baz
+    cmp qux.zsh $out/share/zsh/site-functions/_qux
+    cmp quux $out/share/fish/vendor_completions.d/quux
+  '';
+  install-completion-output = runTest "install-completion-output" {
+    outputs = [ "out" "bin" ];
+  } ''
+    echo foo > foo
+
+    installShellCompletion --bash foo
+
+    # assert it didn't go into $out
+    [[ ! -f $out/share/bash-completion/completions/foo ]]
+
+    cmp foo ''${!outputBin:?}/share/bash-completion/completions/foo
+
+    touch $out
+  '';
+  install-completion-name = runTest "install-completion-name" {} ''
+    echo foo > foo
+    echo bar > bar
+    echo baz > baz
+
+    installShellCompletion --bash --name foobar.bash foo --zsh --name _foobar bar --fish baz
+
+    cmp foo $out/share/bash-completion/completions/foobar.bash
+    cmp bar $out/share/zsh/site-functions/_foobar
+    cmp baz $out/share/fish/vendor_completions.d/baz
+  '';
+  install-completion-inference = runTest "install-completion-inference" {} ''
+    echo foo > foo.bash
+    echo bar > bar.zsh
+    echo baz > baz.fish
+
+    installShellCompletion foo.bash bar.zsh baz.fish
+
+    cmp foo.bash $out/share/bash-completion/completions/foo.bash
+    cmp bar.zsh $out/share/zsh/site-functions/_bar
+    cmp baz.fish $out/share/fish/vendor_completions.d/baz.fish
+  '';
+  install-completion-cmd = runTest "install-completion-cmd" {} ''
+    echo foo > foo.bash
+    echo bar > bar.zsh
+    echo baz > baz.fish
+    echo qux > qux.fish
+
+    installShellCompletion --cmd foobar --bash foo.bash --zsh bar.zsh --fish baz.fish --name qux qux.fish
+
+    cmp foo.bash $out/share/bash-completion/completions/foobar.bash
+    cmp bar.zsh $out/share/zsh/site-functions/_foobar
+    cmp baz.fish $out/share/fish/vendor_completions.d/foobar.fish
+    cmp qux.fish $out/share/fish/vendor_completions.d/qux
+  '';
+  install-completion-fifo = runTest "install-completion-fifo" {} ''
+    installShellCompletion \
+      --bash --name foo.bash <(echo foo) \
+      --zsh --name _foo <(echo bar) \
+      --fish --name foo.fish <(echo baz)
+
+    [[ $(<$out/share/bash-completion/completions/foo.bash) == foo ]] || { echo "foo.bash comparison failed"; exit 1; }
+    [[ $(<$out/share/zsh/site-functions/_foo) == bar ]] || { echo "_foo comparison failed"; exit 1; }
+    [[ $(<$out/share/fish/vendor_completions.d/foo.fish) == baz ]] || { echo "foo.fish comparison failed"; exit 1; }
+  '';
+}
diff --git a/pkgs/test/ld-library-path/default.nix b/pkgs/test/ld-library-path/default.nix
index bda3f0be84a..74c52cef253 100644
--- a/pkgs/test/ld-library-path/default.nix
+++ b/pkgs/test/ld-library-path/default.nix
@@ -1,4 +1,4 @@
-{ stdenv }:
+{ lib, stdenv }:
 
 # This tests that libraries listed in LD_LIBRARY_PATH take precedence over those listed in RPATH.
 
@@ -84,5 +84,5 @@ in stdenv.mkDerivation {
     touch $out
   '';
 
-  meta.platforms = stdenv.lib.platforms.linux;
+  meta.platforms = lib.platforms.linux;
 }
diff --git a/pkgs/test/patch-shebangs/default.nix b/pkgs/test/patch-shebangs/default.nix
index 3e68d96004f..5c49787eee3 100644
--- a/pkgs/test/patch-shebangs/default.nix
+++ b/pkgs/test/patch-shebangs/default.nix
@@ -1,26 +1,70 @@
-{ stdenv, runCommand }:
+{ lib, stdenv, runCommand }:
 
 let
-  bad-shebang = stdenv.mkDerivation {
-    name         = "bad-shebang";
-    dontUnpack = true;
-    installPhase = ''
-      mkdir -p $out/bin
-      echo "#!/bin/sh" > $out/bin/test
-      echo "echo -n hello" >> $out/bin/test
-      chmod +x $out/bin/test
-    '';
+  tests = {
+    bad-shebang = stdenv.mkDerivation {
+      name         = "bad-shebang";
+      dontUnpack = true;
+      installPhase = ''
+        mkdir -p $out/bin
+        echo "#!/bin/sh" > $out/bin/test
+        echo "echo -n hello" >> $out/bin/test
+        chmod +x $out/bin/test
+      '';
+      passthru = {
+        assertion = "grep -v '^#!/bin/sh' $out/bin/test > /dev/null";
+      };
+    };
+
+    ignores-nix-store = stdenv.mkDerivation {
+      name = "ignores-nix-store";
+      dontUnpack = true;
+      installPhase = ''
+        mkdir -p $out/bin
+        echo "#!$NIX_STORE/path/to/sh" > $out/bin/test
+        echo "echo -n hello" >> $out/bin/test
+        chmod +x $out/bin/test
+      '';
+      passthru = {
+        assertion = "grep \"^#!$NIX_STORE/path/to/sh\" $out/bin/test > /dev/null";
+      };
+    };
   };
 in runCommand "patch-shebangs-test" {
-  passthru = { inherit bad-shebang; };
-  meta.platforms = stdenv.lib.platforms.all;
+  passthru = { inherit (tests) bad-shebang ignores-nix-store; };
+  meta.platforms = lib.platforms.all;
 } ''
-  printf "checking whether patchShebangs works properly... ">&2
-  if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then
-    echo "yes" >&2
-    touch $out
-  else
-    echo "no" >&2
+  validate() {
+    local name=$1
+    local testout=$2
+    local assertion=$3
+
+    echo -n "... $name: " >&2
+
+    local rc=0
+    (out=$testout eval "$assertion") || rc=1
+
+    if [ "$rc" -eq 0 ]; then
+      echo "yes" >&2
+    else
+      echo "no" >&2
+    fi
+
+    return "$rc"
+  }
+
+  echo "checking whether patchShebangs works properly... ">&2
+
+  fail=
+  ${lib.concatStringsSep "\n" (lib.mapAttrsToList (_: test: ''
+    validate "${test.name}" "${test}" ${lib.escapeShellArg test.assertion} || fail=1
+  '') tests)}
+
+  if [ "$fail" ]; then
+    echo "failed"
     exit 1
+  else
+    echo "succeeded"
+    touch $out
   fi
 ''
diff --git a/pkgs/test/rust-sysroot/default.nix b/pkgs/test/rust-sysroot/default.nix
new file mode 100644
index 00000000000..a5a1596504f
--- /dev/null
+++ b/pkgs/test/rust-sysroot/default.nix
@@ -0,0 +1,60 @@
+{ lib, rust, rustPlatform, fetchFromGitHub }:
+
+let
+  mkBlogOsTest = target: rustPlatform.buildRustPackage rec {
+    name = "blog_os-sysroot-test";
+
+    src = fetchFromGitHub {
+        owner = "phil-opp";
+        repo = "blog_os";
+        rev = "4e38e7ddf8dd021c3cd7e4609dfa01afb827797b";
+        sha256 = "0k9ipm9ddm1bad7bs7368wzzp6xwrhyfzfpckdax54l4ffqwljcg";
+    };
+
+    cargoSha256 = "1x8iwgy1irgfkv2yjkxm6479nwbrk82b0c80jm7y4kw0s32r01lg";
+
+    inherit target;
+
+    RUSTFLAGS = "-C link-arg=-nostartfiles";
+
+    # Tests don't work for `no_std`. See https://os.phil-opp.com/testing/
+    doCheck = false;
+
+    meta = with lib; {
+        description = "Test for using custom sysroots with buildRustPackage";
+        maintainers = with maintainers; [ aaronjanse ];
+        platforms = lib.platforms.x86_64;
+    };
+  };
+
+  # The book uses rust-lld for linking, but rust-lld is not currently packaged for NixOS.
+  # The justification in the book for using rust-lld suggests that gcc can still be used for testing:
+  # > Instead of using the platform's default linker (which might not support Linux targets),
+  # > we use the cross platform LLD linker that is shipped with Rust for linking our kernel.
+  # https://github.com/phil-opp/blog_os/blame/7212ffaa8383122b1eb07fe1854814f99d2e1af4/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md#L157
+  targetContents = {
+    "llvm-target" = "x86_64-unknown-none";
+    "data-layout" = "e-m:e-i64:64-f80:128-n8:16:32:64-S128";
+    "arch" = "x86_64";
+    "target-endian" = "little";
+    "target-pointer-width" = "64";
+    "target-c-int-width" = "32";
+    "os" = "none";
+    "executables" = true;
+    "linker-flavor" = "gcc";
+    "panic-strategy" = "abort";
+    "disable-redzone" = true;
+    "features" = "-mmx,-sse,+soft-float";
+  };
+
+in {
+  blogOS-targetByFile = mkBlogOsTest (builtins.toFile "x86_64-blog_os.json" (builtins.toJSON targetContents));
+  blogOS-targetByNix = let
+    plat = lib.systems.elaborate { config = "x86_64-none"; } // {
+      rustc = {
+        config = "x86_64-blog_os";
+        platform = targetContents;
+      };
+    };
+    in mkBlogOsTest (rust.toRustTargetSpec plat);
+}
diff --git a/pkgs/test/stdenv-inputs/default.nix b/pkgs/test/stdenv-inputs/default.nix
index 4db10e75086..6a2e441d019 100644
--- a/pkgs/test/stdenv-inputs/default.nix
+++ b/pkgs/test/stdenv-inputs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv }:
+{ lib, stdenv }:
 
 let
   foo = stdenv.mkDerivation {
@@ -12,7 +12,7 @@ let
       chmod +x $out/bin/foo
       cp ${./foo.c} $out/include/foo.h
       $CC -shared \
-        ${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/libfoo.dylib"} \
+        ${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/libfoo.dylib"} \
         -o $out/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
         ${./foo.c}
     '';
@@ -30,7 +30,7 @@ let
       chmod +x $out/bin/bar
       cp ${./bar.c} $dev/include/bar.h
       $CC -shared \
-        ${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,$dev/lib/libbar.dylib"} \
+        ${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$dev/lib/libbar.dylib"} \
         -o $dev/lib/libbar${stdenv.hostPlatform.extensions.sharedLibrary} \
         ${./bar.c}
     '';
@@ -64,5 +64,5 @@ stdenv.mkDerivation {
     touch $out
   '';
 
-  meta.platforms = stdenv.lib.platforms.all;
+  meta.platforms = lib.platforms.all;
 }
diff --git a/pkgs/test/texlive/default.nix b/pkgs/test/texlive/default.nix
new file mode 100644
index 00000000000..2444334f526
--- /dev/null
+++ b/pkgs/test/texlive/default.nix
@@ -0,0 +1,167 @@
+{ lib, runCommandNoCC, fetchurl, file, texlive, writeShellScript }:
+
+{
+  chktex = runCommandNoCC "texlive-test-chktex" {
+    nativeBuildInputs = [
+      (with texlive; combine { inherit scheme-infraonly chktex; })
+    ];
+    input = builtins.toFile "chktex-sample.tex" ''
+      \documentclass{article}
+      \begin{document}
+        \LaTeX is great
+      \end{document}
+    '';
+  } ''
+    chktex -v -nall -w1 "$input" 2>&1 | tee "$out"
+    grep "One warning printed" "$out"
+  '';
+
+  dvipng = lib.recurseIntoAttrs {
+    # https://github.com/NixOS/nixpkgs/issues/75605
+    basic = runCommandNoCC "texlive-test-dvipng-basic" {
+      nativeBuildInputs = [ file texlive.combined.scheme-medium ];
+      input = fetchurl {
+        name = "test_dvipng.tex";
+        url = "http://git.savannah.nongnu.org/cgit/dvipng.git/plain/test_dvipng.tex?id=b872753590a18605260078f56cbd6f28d39dc035";
+        sha256 = "1pjpf1jvwj2pv5crzdgcrzvbmn7kfmgxa39pcvskl4pa0c9hl88n";
+      };
+    } ''
+      cp "$input" ./document.tex
+
+      latex document.tex
+      dvipng -T tight -strict -picky document.dvi
+      for f in document*.png; do
+        file "$f" | tee output
+        grep PNG output
+      done
+
+      mkdir "$out"
+      mv document*.png "$out"/
+    '';
+
+    # test dvipng's limited capability to render postscript specials via GS
+    ghostscript = runCommandNoCC "texlive-test-ghostscript" {
+      nativeBuildInputs = [ file (with texlive; combine { inherit scheme-small dvipng; }) ];
+      input = builtins.toFile "postscript-sample.tex" ''
+        \documentclass{minimal}
+        \begin{document}
+          Ni
+          \special{ps:
+            newpath
+            0 0 moveto
+            7 7 rlineto
+            0 7 moveto
+            7 -7 rlineto
+            stroke
+            showpage
+          }
+        \end{document}
+      '';
+      gs_trap = writeShellScript "gs_trap.sh" ''
+        exit 1
+      '';
+    } ''
+      cp "$gs_trap" ./gs
+      export PATH=$PWD:$PATH
+      # check that the trap works
+      gs && exit 1
+
+      cp "$input" ./document.tex
+
+      latex document.tex
+      dvipng -T 1in,1in -strict -picky document.dvi
+      for f in document*.png; do
+        file "$f" | tee output
+        grep PNG output
+      done
+
+      mkdir "$out"
+      mv document*.png "$out"/
+    '';
+  };
+
+  # https://github.com/NixOS/nixpkgs/issues/75070
+  dvisvgm = runCommandNoCC "texlive-test-dvisvgm" {
+    nativeBuildInputs = [ file texlive.combined.scheme-medium ];
+    input = builtins.toFile "dvisvgm-sample.tex" ''
+      \documentclass{article}
+      \begin{document}
+        mwe
+      \end{document}
+    '';
+  } ''
+    cp "$input" ./document.tex
+
+    latex document.tex
+    dvisvgm document.dvi -n -o document_dvi.svg
+    cat document_dvi.svg
+    file document_dvi.svg | grep SVG
+
+    pdflatex document.tex
+    dvisvgm -P document.pdf -n -o document_pdf.svg
+    cat document_pdf.svg
+    file document_pdf.svg | grep SVG
+
+    mkdir "$out"
+    mv document*.svg "$out"/
+  '';
+
+  texdoc = runCommandNoCC "texlive-test-texdoc" {
+    nativeBuildInputs = [
+      (with texlive; combine {
+        inherit scheme-infraonly luatex texdoc;
+        pkgFilter = pkg: lib.elem pkg.tlType [ "run" "bin" "doc" ];
+      })
+    ];
+  } ''
+    texdoc --version
+
+    texdoc --debug --list texdoc | tee "$out"
+    grep texdoc.pdf "$out"
+  '';
+
+  # test that language files are generated as expected
+  hyphen-base = runCommandNoCC "texlive-test-hyphen-base" {
+    hyphenBase = lib.head texlive.hyphen-base.pkgs;
+    schemeFull = texlive.combined.scheme-full;
+    schemeInfraOnly = texlive.combined.scheme-infraonly;
+  } ''
+    mkdir -p "$out"/{scheme-infraonly,scheme-full}
+
+    # create language files with no hyphenation patterns
+    cat "$hyphenBase"/tex/generic/config/language.us >language.dat
+    cat "$hyphenBase"/tex/generic/config/language.us.def >language.def
+    cat "$hyphenBase"/tex/generic/config/language.us.lua >language.dat.lua
+
+    cat >>language.dat.lua <<EOF
+    }
+    EOF
+
+    cat >>language.def <<EOF
+    %%% No changes may be made beyond this point.
+
+    \uselanguage {USenglish}             %%% This MUST be the last line of the file.
+    EOF
+
+    for fname in language.{dat,def,dat.lua} ; do
+      diff --ignore-matching-lines='^\(%\|--\) Generated by ' -u \
+        {"$hyphenBase","$schemeFull"/share/texmf}/tex/generic/config/"$fname" \
+        | tee "$out/scheme-full/$fname.patch"
+      diff --ignore-matching-lines='^\(%\|--\) Generated by ' -u \
+        {,"$schemeInfraOnly"/share/texmf/tex/generic/config/}"$fname" \
+        | tee "$out/scheme-infraonly/$fname.patch"
+    done
+  '';
+
+  # test that fmtutil.cnf is fully regenerated on scheme-full
+  fmtutilCnf = runCommandNoCC "texlive-test-fmtutil.cnf" {
+    kpathsea = lib.head texlive.kpathsea.pkgs;
+    schemeFull = texlive.combined.scheme-full;
+  } ''
+    mkdir -p "$out"
+
+    diff --ignore-matching-lines='^# Generated by ' -u \
+      {"$kpathsea","$schemeFull"/share/texmf}/web2c/fmtutil.cnf \
+      | tee "$out/fmtutil.cnf.patch"
+  '';
+}
diff --git a/pkgs/test/vim/default.nix b/pkgs/test/vim/default.nix
new file mode 100644
index 00000000000..cb3953a63f5
--- /dev/null
+++ b/pkgs/test/vim/default.nix
@@ -0,0 +1,63 @@
+{ vimUtils, vim_configurable, writeText, vimPlugins
+, lib, fetchFromGitHub
+, pkgs
+}:
+let
+  inherit (vimUtils) buildVimPluginFrom2Nix;
+
+  packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
+
+in
+  pkgs.recurseIntoAttrs (rec {
+  vim_empty_config = vimUtils.vimrcFile { beforePlugins = ""; customRC = ""; };
+
+  ### vim tests
+  ##################
+  vim_with_vim2nix = vim_configurable.customize {
+    name = "vim"; vimrcConfig.vam.pluginDictionaries = [ "vim-addon-vim2nix" ];
+  };
+
+  # test cases:
+  test_vim_with_vim_nix_using_vam = vim_configurable.customize {
+   name = "vim-with-vim-addon-nix-using-vam";
+    vimrcConfig.vam.pluginDictionaries = [{name = "vim-nix"; }];
+  };
+
+  test_vim_with_vim_nix_using_pathogen = vim_configurable.customize {
+    name = "vim-with-vim-addon-nix-using-pathogen";
+    vimrcConfig.pathogen.pluginNames = [ "vim-nix" ];
+  };
+
+  test_vim_with_vim_nix_using_plug = vim_configurable.customize {
+    name = "vim-with-vim-addon-nix-using-plug";
+    vimrcConfig.plug.plugins = with vimPlugins; [ vim-nix ];
+  };
+
+  test_vim_with_vim_nix = vim_configurable.customize {
+    name = "vim-with-vim-addon-nix";
+    vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
+  };
+
+  # regression test for https://github.com/NixOS/nixpkgs/issues/53112
+  # The user may have specified their own plugins which may not be formatted
+  # exactly as the generated ones. In particular, they may not have the `pname`
+  # attribute.
+  test_vim_with_custom_plugin = vim_configurable.customize {
+    name = "vim_with_custom_plugin";
+    vimrcConfig.vam.knownPlugins =
+      vimPlugins // ({
+        vim-trailing-whitespace = buildVimPluginFrom2Nix {
+          name = "vim-trailing-whitespace";
+          src = fetchFromGitHub {
+            owner = "bronson";
+            repo = "vim-trailing-whitespace";
+            rev = "4c596548216b7c19971f8fc94e38ef1a2b55fee6";
+            sha256 = "0f1cpnp1nxb4i5hgymjn2yn3k1jwkqmlgw1g02sq270lavp2dzs9";
+          };
+          # make sure string dependencies are handled
+          dependencies = [ "vim-nix" ];
+        };
+      });
+    vimrcConfig.vam.pluginDictionaries = [ { names = [ "vim-trailing-whitespace" ]; } ];
+  };
+})