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