Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 59 lines 1.3 kB view raw
1{ lib, stdenv, fetchFromGitHub, janet }: 2 3let 4 platformFiles = { 5 aarch64-darwin = "macos_config.janet"; 6 aarch64-linux = "linux_config.janet"; 7 x86_64-darwin = "macos_config.janet"; 8 x86_64-linux = "linux_config.janet"; 9 }; 10 11 platformFile = platformFiles.${stdenv.hostPlatform.system}; 12 13in 14stdenv.mkDerivation rec { 15 pname = "jpm"; 16 version = "1.1.0"; 17 18 src = fetchFromGitHub { 19 owner = "janet-lang"; 20 repo = pname; 21 rev = "v${version}"; 22 sha256 = "sha256-lPB4jew6RkJlDp8xOQ4YA9MkgLBImaBHcvv4WF/sLRc="; 23 }; 24 25 # `auto-shebangs true` gives us a shebang line that points to janet inside the 26 # jpm bin folder 27 postPatch = '' 28 substituteInPlace configs/${platformFile} \ 29 --replace 'auto-shebang true' 'auto-shebang false' \ 30 --replace /usr/local $out 31 ''; 32 33 dontConfigure = true; 34 35 buildInputs = [ janet ]; 36 37 dontBuild = true; 38 39 installPhase = '' 40 runHook preInstall 41 42 mkdir -p $out/{lib/janet,share/man/man1} 43 44 janet bootstrap.janet configs/${platformFile} 45 46 runHook postInstall 47 ''; 48 49 doInstallCheck = true; 50 51 installCheckPhase = '' 52 $out/bin/jpm help 53 ''; 54 55 meta = janet.meta // { 56 description = "Janet Project Manager for the Janet programming language"; 57 platforms = lib.attrNames platformFiles; 58 }; 59}