depot/pkgs/by-name/am/amber-lang/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

69 lines
1.5 KiB
Nix

{
lib,
fetchFromGitHub,
rustPlatform,
bc,
util-linux,
makeWrapper,
runCommand,
amber-lang,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "amber-lang";
version = "0.3.5-alpha";
src = fetchFromGitHub {
owner = "amber-lang";
repo = "amber";
rev = version;
hash = "sha256-wf0JNWNliDGNvlbWoatPqDKmVaBzHeCKOvJWuE9PnpQ=";
};
cargoHash = "sha256-6T4WcQkCMR8W67w0uhhN8W0FlLsrTUMa3/xRXDtW4Es=";
preConfigure = ''
substituteInPlace src/compiler.rs \
--replace-fail 'Command::new("/usr/bin/env")' 'Command::new("env")'
'';
nativeBuildInputs = [ makeWrapper ];
nativeCheckInputs = [
bc
# 'rev' in generated bash script of test
# tests::validity::variable_ref_function_invocation
util-linux
];
checkFlags = [
"--skip=tests::extra::download"
"--skip=tests::formatter::all_exist"
];
postInstall = ''
wrapProgram "$out/bin/amber" --prefix PATH : "${lib.makeBinPath [ bc ]}"
'';
passthru = {
updateScript = nix-update-script { };
tests.run = runCommand "amber-lang-eval-test" { nativeBuildInputs = [ amber-lang ]; } ''
diff -U3 --color=auto <(amber -e 'echo "Hello, World"') <(echo 'Hello, World')
touch $out
'';
};
meta = with lib; {
description = "Programming language compiled to bash";
homepage = "https://amber-lang.com";
license = licenses.gpl3Plus;
mainProgram = "amber";
maintainers = with maintainers; [
cafkafk
uncenter
aleksana
];
platforms = platforms.unix;
};
}