Merge pull request #29 from Profpatsch/refactor-build.nix

Refactor build.nix
This commit is contained in:
Profpatsch 2020-08-04 22:10:28 +02:00 committed by GitHub
commit da2eab127d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 125 deletions

30
build.nix Normal file
View file

@ -0,0 +1,30 @@
{ pkgs, release }:
{ simpleName, binName, attrName }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec {
name = simpleName;
src = if pkgs.stdenv.isDarwin
then pkgs.fetchzip {
url = release.${"${attrName}-darwin"}.url;
sha256 = release.${"${attrName}-darwin"}.hash;
}
else pkgs.fetchzip {
url = release.${"${attrName}-linux"}.url;
sha256 = release.${"${attrName}-linux"}.hash;
};
installPhase = ''
mkdir -p $out/bin
binPath="$out/bin/${binName}"
install -D -m555 -T ${binName} "$binPath"
mkdir -p $out/etc/bash_completion.d/
"$binPath" --bash-completion-script "$binPath" > "$out/etc/bash_completion.d/${binName}-completion.bash"
'';
}

View file

@ -1,28 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec {
name = "dhall-bash-simple";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchzip {
url = release.dhall-bash-darwin.url;
sha256 = release.dhall-bash-darwin.hash;
}
else pkgs.fetchzip {
url = release.dhall-bash-linux.url;
sha256 = release.dhall-bash-linux.hash;
};
installPhase = ''
mkdir -p $out/bin
DHALL_TO_BASH=$out/bin/dhall-to-bash
install -D -m555 -T dhall-to-bash $DHALL_TO_BASH
mkdir -p $out/etc/bash_completion.d/
$DHALL_TO_BASH --bash-completion-script $DHALL_TO_BASH > $out/etc/bash_completion.d/dhall-to-bash-completion.bash
'';
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
simpleName = "dhall-bash-simple";
binName = "dhall-to-bash";
attrName = "dhall-bash";
}

View file

@ -1,28 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec {
name = "dhall-lsp-simple";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchzip {
url = release.dhall-lsp-server-darwin.url;
sha256 = release.dhall-lsp-server-darwin.hash;
}
else pkgs.fetchzip {
url = release.dhall-lsp-server-linux.url;
sha256 = release.dhall-lsp-server-linux.hash;
};
installPhase = ''
mkdir -p $out/bin
DHALL_LSP=$out/bin/dhall-lsp-server
install -D -m555 -T dhall-lsp-server $DHALL_LSP
mkdir -p $out/etc/bash_completion.d/
$DHALL_LSP --bash-completion-script $DHALL_LSP > $out/etc/bash_completion.d/dhall-lsp-server-completion.bash
'';
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
simpleName = "dhall-lsp-simple";
binName = "dhall-lsp-server";
attrName = "dhall-lsp-server";
}

View file

@ -1,28 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec {
name = "dhall-nix-simple";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchzip {
url = release.dhall-nix-darwin.url;
sha256 = release.dhall-nix-darwin.hash;
}
else pkgs.fetchzip {
url = release.dhall-nix-linux.url;
sha256 = release.dhall-nix-linux.hash;
};
installPhase = ''
mkdir -p $out/bin
DHALL_TO_NIX=$out/bin/dhall-to-nix
install -D -m555 -T dhall-to-nix $DHALL_TO_NIX
mkdir -p $out/etc/bash_completion.d/
$DHALL_TO_NIX --bash-completion-script $DHALL_TO_NIX > $out/etc/bash_completion.d/dhall-to-nix-completion.bash
'';
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
simpleName = "dhall-nix-simple";
binName = "dhall-to-nix";
attrName = "dhall-nix";
}

View file

@ -1,28 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec {
name = "dhall-simple";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchzip {
url = release.dhall-darwin.url;
sha256 = release.dhall-darwin.hash;
}
else pkgs.fetchzip {
url = release.dhall-linux.url;
sha256 = release.dhall-linux.hash;
};
installPhase = ''
mkdir -p $out/bin
DHALL=$out/bin/dhall
install -D -m555 -T dhall $DHALL
mkdir -p $out/etc/bash_completion.d/
$DHALL --bash-completion-script $DHALL > $out/etc/bash_completion.d/dhall-completion.bash
'';
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
simpleName = "dhall-simple";
binName = "dhall";
attrName = "dhall";
}

View file

@ -1,28 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
let
release = import ./release.nix;
in
pkgs.stdenv.mkDerivation rec {
name = "dhall-yaml-simple";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchzip {
url = release.dhall-yaml-darwin.url;
sha256 = release.dhall-yaml-darwin.hash;
}
else pkgs.fetchzip {
url = release.dhall-yaml-linux.url;
sha256 = release.dhall-yaml-linux.hash;
};
installPhase = ''
mkdir -p $out/bin
DHALL_TO_YAML=$out/bin/dhall-to-yaml-ng
install -D -m555 -T dhall-to-yaml-ng $DHALL_TO_YAML
mkdir -p $out/etc/bash_completion.d/
$DHALL_TO_YAML --bash-completion-script $DHALL_TO_YAML > $out/etc/bash_completion.d/dhall-to-yaml-completion.bash
'';
import ./build.nix { inherit pkgs; release = import ./release.nix; } {
simpleName = "dhall-yaml-simple";
binName = "dhall-to-yaml-ng";
attrName = "dhall-yaml";
}