mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
80 lines
1.8 KiB
Nix
80 lines
1.8 KiB
Nix
{ lib, stdenv
|
|
, fetchzip
|
|
|
|
# update script
|
|
, writeScript
|
|
, coreutils
|
|
, curl
|
|
, gnugrep
|
|
, htmlq
|
|
, nix-update
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "fasmg";
|
|
version = "kl0e";
|
|
|
|
src = fetchzip {
|
|
url = "https://flatassembler.net/fasmg.${version}.zip";
|
|
sha256 = "sha256-qUhsUMwxgUduGz+D8+Dm4EXyh7aiE9lJ1mhvTjHP6Tw=";
|
|
stripRoot = false;
|
|
};
|
|
|
|
buildPhase = let
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
path = {
|
|
x86_64-linux = {
|
|
bin = "fasmg.x64";
|
|
asm = "source/linux/x64/fasmg.asm";
|
|
};
|
|
x86_64-darwin = {
|
|
bin = "source/macos/x64/fasmg";
|
|
asm = "source/macos/x64/fasmg.asm";
|
|
};
|
|
x86-linux = {
|
|
bin = "fasmg";
|
|
asm = "source/linux/fasmg.asm";
|
|
};
|
|
x86-darwin = {
|
|
bin = "source/macos/fasmg";
|
|
asm = "source/macos/fasmg.asm";
|
|
};
|
|
}.${system} or (throw "Unsupported system: ${system}");
|
|
|
|
in ''
|
|
chmod +x ${path.bin}
|
|
./${path.bin} ${path.asm} fasmg
|
|
'';
|
|
|
|
outputs = [ "out" "doc" ];
|
|
|
|
installPhase = ''
|
|
install -Dm755 fasmg $out/bin/fasmg
|
|
|
|
mkdir -p $doc/share/doc/fasmg
|
|
cp docs/*.txt $doc/share/doc/fasmg
|
|
'';
|
|
|
|
passthru.updateScript = writeScript "update-fasmg.sh" ''
|
|
export PATH="${lib.makeBinPath [ coreutils curl gnugrep htmlq nix-update ]}:$PATH"
|
|
version=$(
|
|
curl 'https://flatassembler.net/download.php' \
|
|
| htmlq .links a.boldlink -a href \
|
|
| grep -E '^fasmg\..*\.zip$' \
|
|
| head -n1 \
|
|
| cut -d. -f2
|
|
)
|
|
nix-update fasmg --version "$version"
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "x86(-64) macro assembler to binary, MZ, PE, COFF, and ELF";
|
|
mainProgram = "fasmg";
|
|
homepage = "https://flatassembler.net";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ orivej luc65r ];
|
|
platforms = with platforms; intersectLists (linux ++ darwin) x86;
|
|
};
|
|
}
|