sigil/packages/nic_bus/default.nix

57 lines
1.1 KiB
Nix

# SPDX-License-Identifier: CC0-1.0
{ stdenv, fetchgit, tup }:
let
tupArch = with stdenv.targetPlatform;
if isAarch32 then
"arm"
else if isAarch64 then
"arm64"
else if isx86_32 then
"i386"
else if isx86_64 then
"x86_64"
else
abort "unhandled targetPlatform";
toTupConfig = attrs:
with builtins;
let op = config: name: "${config}CONFIG_${name}=${attrs.${name}} ";
in foldl' op "" (attrNames attrs);
in stdenv.mkDerivation rec {
pname = "nic_bus";
version = "2.0";
src = fetchgit {
url = "https://git.sr.ht/~ehmry/nic_bus";
rev = "v" + version;
sha256 = "DrgZHkUEjkHmSfOqSetGqU/nLl8OqNM0zaJjOout5VY=";
};
nativeBuildInputs = [ tup ];
configurePhase = ''
# Scan repository and generate script
tup init
tup generate buildPhase.sh
'';
buildPhase = ''
pushd .
set -v
source buildPhase.sh
set +v
popd
'';
installPhase = "install -Dm755 {.,$out}/${pname}";
meta = with stdenv.lib; {
license = licenses.agpl3;
maintainers = [ maintainers.ehmry ];
};
}