Merge pull request #163441 from maralorn/nom-zsh-completion

This commit is contained in:
Martin Weinelt 2022-03-09 22:48:23 +01:00 committed by GitHub
commit f262cec4ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -16,6 +16,7 @@
filepath,
generic-optics,
HUnit,
installShellFiles,
lib,
lock-file,
MemoTrie,
@ -140,11 +141,18 @@ mkDerivation {
maintainers = with lib.maintainers; [maralorn];
passthru.updateScript = ./update.sh;
testTarget = "unit-tests";
buildTools = [installShellFiles];
postInstall = ''
cat > $out/bin/nom-build << EOF
#!${runtimeShell}
${expect}/bin/unbuffer nix-build "\$@" 2>&1 | exec $out/bin/nom
EOF
chmod a+x $out/bin/nom-build
installShellCompletion --zsh --name _nom-build ${
builtins.toFile "completion.zsh" ''
#compdef nom-build
compdef nom-build=nix-build
''
}
'';
}

View file

@ -21,16 +21,29 @@ cat > "$derivation_file" << EOF
# This file has been autogenerate with cabal2nix.
# Update via ./update.sh"
EOF
cabal2nix --extra-arguments expect --extra-arguments runtimeShell --maintainer maralorn "https://github.com/maralorn/nix-output-monitor/archive/refs/tags/${new_version}.tar.gz" | head -n-1 >> "$derivation_file"
cabal2nix \
--extra-arguments expect \
--extra-arguments runtimeShell\
--extra-arguments installShellFiles\
--maintainer maralorn \
"https://github.com/maralorn/nix-output-monitor/archive/refs/tags/${new_version}.tar.gz" \
| head -n-1 >> "$derivation_file"
cat >> "$derivation_file" << EOF
passthru.updateScript = ./update.sh;
testTarget = "unit-tests";
buildTools = [ installShellFiles ];
postInstall = ''
cat > \$out/bin/nom-build << EOF
#!\${runtimeShell}
\${expect}/bin/unbuffer nix-build "\\\$@" 2>&1 | exec \$out/bin/nom
EOF
chmod a+x \$out/bin/nom-build
installShellCompletion --zsh --name _nom-build \${builtins.toFile "completion.zsh" ''
#compdef nom-build
compdef nom-build=nix-build
''}
'';
}
EOF