mirror of
https://github.com/justinwoo/easy-dhall-nix.git
synced 2024-11-26 21:19:42 +01:00
feat(build): allow multiple binaries
I gave in because I wanted to use yaml-to-dhall, so this implements copying multiple binaries.
This commit is contained in:
parent
66da4ffe17
commit
f0270205ee
6 changed files with 22 additions and 15 deletions
21
build.nix
21
build.nix
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, release }:
|
{ pkgs, release }:
|
||||||
|
|
||||||
{ simpleName, binName, attrName }:
|
{ simpleName, binNames, attrName }:
|
||||||
|
|
||||||
let
|
let
|
||||||
release = import ./release.nix;
|
release = import ./release.nix;
|
||||||
|
@ -23,10 +23,23 @@ pkgs.stdenv.mkDerivation rec {
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
||||||
|
${pkgs.lib.concatMapStringsSep "\n" (binName: ''
|
||||||
binPath="$out/bin/${binName}"
|
binPath="$out/bin/${binName}"
|
||||||
install -D -m555 -T "${binName}" "$binPath"
|
install -D -m555 -T "${binName}" "$binPath"
|
||||||
rm "${binName}"
|
rm "${binName}"
|
||||||
|
|
||||||
|
"$binPath" --bash-completion-script "$binPath" > "${binName}.bash"
|
||||||
|
installShellCompletion --bash "${binName}.bash"
|
||||||
|
rm "${binName}.bash"
|
||||||
|
"$binPath" --zsh-completion-script "$binPath" > "${binName}.zsh"
|
||||||
|
installShellCompletion --zsh "${binName}.zsh"
|
||||||
|
rm "${binName}.zsh"
|
||||||
|
"$binPath" --fish-completion-script "$binPath" > "${binName}.fish"
|
||||||
|
installShellCompletion --fish "${binName}.fish"
|
||||||
|
rm "${binName}.fish"
|
||||||
|
'') binNames}
|
||||||
|
|
||||||
# check that we didn’t forget any files (maybe a new binary was added)
|
# check that we didn’t forget any files (maybe a new binary was added)
|
||||||
if [ ! -z "$(${pkgs.lr}/bin/lr -1 -t 'depth == 1' .)" ]; then
|
if [ ! -z "$(${pkgs.lr}/bin/lr -1 -t 'depth == 1' .)" ]; then
|
||||||
echo "still some files remaining!" >&2
|
echo "still some files remaining!" >&2
|
||||||
|
@ -34,11 +47,5 @@ pkgs.stdenv.mkDerivation rec {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$binPath" --bash-completion-script "$binPath" > "${binName}.bash"
|
|
||||||
installShellCompletion --bash "${binName}.bash"
|
|
||||||
"$binPath" --zsh-completion-script "$binPath" > "${binName}.zsh"
|
|
||||||
installShellCompletion --zsh "${binName}.zsh"
|
|
||||||
"$binPath" --fish-completion-script "$binPath" > "${binName}.fish"
|
|
||||||
installShellCompletion --fish "${binName}.fish"
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
||||||
simpleName = "dhall-bash-simple";
|
simpleName = "dhall-bash-simple";
|
||||||
binName = "dhall-to-bash";
|
binNames = [ "dhall-to-bash" ];
|
||||||
attrName = "dhall-bash";
|
attrName = "dhall-bash";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
||||||
simpleName = "dhall-lsp-simple";
|
simpleName = "dhall-lsp-simple";
|
||||||
binName = "dhall-lsp-server";
|
binNames = [ "dhall-lsp-server" ];
|
||||||
attrName = "dhall-lsp-server";
|
attrName = "dhall-lsp-server";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
||||||
simpleName = "dhall-nix-simple";
|
simpleName = "dhall-nix-simple";
|
||||||
binName = "dhall-to-nix";
|
binNames = [ "dhall-to-nix" ];
|
||||||
attrName = "dhall-nix";
|
attrName = "dhall-nix";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
||||||
simpleName = "dhall-simple";
|
simpleName = "dhall-simple";
|
||||||
binName = "dhall";
|
binNames = [ "dhall" ];
|
||||||
attrName = "dhall";
|
attrName = "dhall";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
|
||||||
simpleName = "dhall-yaml-simple";
|
simpleName = "dhall-yaml-simple";
|
||||||
binName = "dhall-to-yaml-ng";
|
binNames = [ "dhall-to-yaml-ng" "yaml-to-dhall" ];
|
||||||
attrName = "dhall-yaml";
|
attrName = "dhall-yaml";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue