anchor.diff:    buildInputs = [ makeWrapper ] ++ toolsetSubcommands;
   
     installPhase = ''
  -    mkdir -p "$out/bin" "$out/etc"
  +    mkdir -p "$out/bin" "$out/etc/command-wrapper"
       tar -C "$out" -xf "$src" --strip-components=1
       chmod u+w "$out/share"
  +
  +    makeWrapper "$out/libexec/command-wrapper/command-wrapper" \
  +      "$out/bin/command-wrapper" \
  +      --set TERMINFO_DIRS "/etc/terminfo:/lib/terminfo:/usr/share/terminfo" \
  +      --set COMMAND_WRAPPER_SYSTEM_CONFIG_DIR "$out/etc" \
  +      --set COMMAND_WRAPPER_FACADE "$out/bin/command-wrapper"
   
       makeWrapper "$out/libexec/command-wrapper/command-wrapper" \
         "$out/bin/${toolset}" \
         --argv0 "${toolset}" \
         --set TERMINFO_DIRS "/etc/terminfo:/lib/terminfo:/usr/share/terminfo" \
  -      --set COMMAND_WRAPPER_SYSTEM_CONFIG_DIR "$out/libexec/command-wrapper/etc" \
  -      --prefix COMMAND_WRAPPER_PATH : "$out/libexec/command-wrapper" \
  -      --prefix COMMAND_WRAPPER_PATH : "${
  -        lib.makeSearchPath "libexec/${toolset}" toolsetSubcommands
  -      }" \
  -      --prefix COMMAND_WRAPPER_MANPATH : "$out/share/man" \
  -      --prefix COMMAND_WRAPPER_MANPATH : "${
  -        lib.makeSearchPath "share/man" toolsetSubcommands
  -      }"
  +      --set COMMAND_WRAPPER_SYSTEM_CONFIG_DIR "$out/etc" \
  +      --set COMMAND_WRAPPER_FACADE "$out/bin/command-wrapper"
   
  -    mkdir -p "$out/share/bash-completion/completions"
  +    declare -r -A completions=(
  +      [bash]="$out/share/bash-completion/completions/command-wrapper.bash"
  +      [fish]="$out/share/fish/vendor_completions.d/command-wrapper.fish"
  +      [zsh]="$out/share/zsh/vendor_completions/_command-wrapper"
  +    )
  +
  +    for shell in "''${!completions[@]}"; do
  +      completionFile="''${completions[''${shell}]}"
  +      completionDir="$(dirname "''${completionFile}")"
  +      mkdir -p "''${completionDir}"
  +      "$out/libexec/command-wrapper/command-wrapper" \
  +        completion --script --shell="''${shell}" \
  +        --toolset="${toolset}" \
  +        --executable="$out/bin/${toolset}" \
  +        --output="''${completionFile}"
  +    done
  +
  +    declare -r -A dhallLibraries=(
  +      [command-wrapper]="$out/etc/command-wrapper/lib/CommandWrapper"
  +      [exec]="$out/etc/command-wrapper/lib/Exec"
  +      [prelude]="$out/etc/command-wrapper/lib/Prelude"
  +    )
  +
  +    for lib in "''${!dhallLibraries[@]}"; do
  +      libraryFile="''${dhallLibraries[''${lib}]}"
  +      libraryDir="$(dirname "''${libraryFile}")"
  +      mkdir -p "''${libraryDir}"
  +      "$out/libexec/command-wrapper/command-wrapper" \
  +        completion --library --dhall="''${lib}" --import \
  +        > "''${libraryFile}"
  +    done
  +
       "$out/libexec/command-wrapper/command-wrapper" \
  -      completion --script --shell=bash \
  -      --toolset="${toolset}" \
  -      --executable="$out/bin/${toolset}" \
  -      --output="$out/share/bash-completion/completions/command-wrapper.bash"
  -
  -    mkdir -p "$out/share/fish/vendor_completions.d"
  +        completion --library --dhall=command-wrapper --content \
  +        --output=./CommandWrapper
       "$out/libexec/command-wrapper/command-wrapper" \
  -      completion --script --shell=fish \
  -      --toolset="${toolset}" \
  -      --executable="$out/bin/${toolset}" \
  -      --output="$out/share/fish/vendor_completions.d/command-wrapper.fish"
  -
  -    mkdir -p "$out/share/zsh/vendor_completions"
  -    "$out/libexec/command-wrapper/command-wrapper" \
  -      completion --script --shell=zsh \
  -      --toolset="${toolset}" \
  -      --executable="$out/bin/${toolset}" \
  -      --output="$out/share/zsh/vendor_completions/_command-wrapper"
  -
  -    mkdir -p "$out/etc/command-wrapper/lib"
  -    "$out/libexec/command-wrapper/command-wrapper" \
  -      completion --library --dhall=command-wrapper --import \
  -      > "$out/etc/command-wrapper/lib/CommandWrapper"
  -    "$out/libexec/command-wrapper/command-wrapper" \
  -      completion --library --dhall=exec --import \
  -      > "$out/etc/command-wrapper/lib/Exec"
  -    "$out/libexec/command-wrapper/command-wrapper" \
  -      completion --library --dhall=prelude --import \
  -      > "$out/etc/command-wrapper/lib/Prelude"
  +        completion --library --dhall=prelude --content \
  +        --output=./Prelude
  +    mkdir -p "$out/etc/command-wrapper/default"
  +    "$out/libexec/command-wrapper/command-wrapper" config --dhall \
  +      --let="CommandWrapper=./CommandWrapper" --let="Prelude=./Prelude" \
  +      --let="out=\"$out\"" \
  +      --output="$out/etc/command-wrapper/default/constructor.dhall" <<'EOF'
  +    ${defaultConfig toolsetSubcommands}
  +    EOF
  +    "$out/libexec/command-wrapper/command-wrapper" config --dhall-freeze \
  +      --no-remote-only --for-security \
  +      --expression="$out/etc/command-wrapper/default/constructor.dhall" \
  +      --output="$out/etc/command-wrapper/default.dhall"
     '';
   }
  
positive.code:     fetchurl {
        url = let
          repoUrl = "https://github.com/trskop/command-wrapper";
          version = "0.1.0.0-rc3";
        in "${repoUrl}/releases/download/${version}/command-wrapper-${version}.tar.xz";
  
        # This value can be taken from `${url}.sha256sum`, and converted using:
        #
        #   nix-hash --type sha256 --to-base32 "${sha256inBase16}"
        sha256 = "03lf2jysjd45ji0vx7vnxl1b4d0dqs57r07s3lk7hx43c4g2xw8v";
      };
  
    dontUnpack = true;
  
negative.code:       version = toolsetVersion;
      }) subcommands;
  
    toList = subDir: paths:
      if paths == [ ] then
        "[ ] : List Text"
      else
        ''[ "'' + (lib.concatStringsSep ''", "''
          (builtins.map (path: path + "/" + subDir)
            (builtins.filter (x: x != null) paths))) + ''" ] : List Text'';
  
    defaultConfig = paths: ''
      CommandWrapper.ToolsetConfig::{
      , aliases =
            [ CommandWrapper.SubcommandAlias::{
              , alias = "h"
              , description = Some "Shorthand for \"help\"."
              , command = "help"
              }
            , CommandWrapper.SubcommandAlias::{
              , alias = "man"
              , description = Some "Shorthand for \"help --man\"."
              , command = "help"
              , arguments = [ "--man" ]
              }
            ]
          # Prelude.List.map
              Text
              CommandWrapper.SubcommandAlias.Type
              (   λ(_ : Text)
                → CommandWrapper.SubcommandAlias::{
                  , alias = "dhall''${_}"
                  , description = Some "Shorthand for \"config --dhall''${_}\"."
                  , command = "config"
                  , arguments = [ "--dhall''${_}" ]
                  }
              )
              [ ""
              , "-bash"
              , "-diff"
              , "-exec"
              , "-filter"
              , "-format"
              , "-freeze"
              , "-hash"
              , "-lint"
              , "-repl"
              , "-resolve"
              , "-text"
              ]
      , searchPath =
            [ "''${out}/libexec/command-wrapper" ]
          # (${toList "libexec/${toolset}" paths})
      , manPath = [ "''${out}/share/man" ] # (${toList "share/man" paths})
      }
    '';
  
  in stdenv.mkDerivation rec {
    name = "command-wrapper-toolset-${toolset}";
    version = toolsetVersion;
  