Merge pull request #261153 from cafkafk/cafk-cbmbasic-init

authored by

Artturi and committed by
GitHub
67a126e5 5b87022c

+65
+65
pkgs/by-name/cb/cbmbasic/package.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , runCommand 5 + }: 6 + 7 + stdenv.mkDerivation (finalAttrs: { 8 + pname = "cbmbasic"; 9 + version = "unstable-2022-12-18"; 10 + 11 + src = fetchFromGitHub { 12 + owner = "mist64"; 13 + repo = "cbmbasic"; 14 + rev = "352a313313dd0a15a47288c8f8031b54ac8c92a2"; 15 + hash = "sha256-aA/ivRap+aDd2wi6KWXam9eP/21lOn6OWTeZ4i/S9Bs="; 16 + }; 17 + 18 + installPhase = '' 19 + runHook preInstall 20 + 21 + mkdir -p $out/bin/ 22 + mv cbmbasic $out/bin/ 23 + 24 + runHook postInstall 25 + ''; 26 + 27 + # NOTE: cbmbasic uses microsoft style linebreaks `\r\n`, and testing has to 28 + # accommodate that, else you get very cryptic diffs 29 + passthru = { 30 + tests.run = runCommand "cbmbasic-test-run" { 31 + nativeBuildInputs = [finalAttrs.finalPackage]; 32 + } '' 33 + echo '#!${lib.getExe finalAttrs.finalPackage}' > helloI.bas; 34 + echo 'PRINT"Hello, World!"' >> helloI.bas; 35 + chmod +x helloI.bas 36 + 37 + diff -U3 --color=auto <(./helloI.bas) <(echo -e "Hello, World!\r"); 38 + 39 + echo '#!/usr/bin/env cbmbasic' > hello.bas; 40 + echo 'PRINT"Hello, World!"' >> hello.bas; 41 + chmod +x hello.bas 42 + 43 + diff -U3 --color=auto <(cbmbasic ./hello.bas) <(echo -e "Hello, World!\r"); 44 + 45 + touch $out; 46 + ''; 47 + }; 48 + 49 + meta = with lib; { 50 + description = "Portable version of Commodore's version of Microsoft BASIC 6502 as found on the Commodore 64"; 51 + longDescription = '' 52 + "Commodore BASIC" (cbmbasic) is a 100% compatible version of Commodore's 53 + version of Microsoft BASIC 6502 as found on the Commodore 64. You can use 54 + it in interactive mode or pass a BASIC file as a command line parameter. 55 + 56 + This source does not emulate 6502 code; all code is completely native. On 57 + a 1 GHz CPU you get about 1000x speed compared to a 1 MHz 6502. 58 + ''; 59 + homepage = "https://github.com/mist64/cbmbasic"; 60 + license = licenses.bsd2; 61 + maintainers = [ maintainers.cafkafk ]; 62 + mainProgram = "cbmbasic"; 63 + platforms = platforms.all; 64 + }; 65 + })