hottext: convert to buildNimPackage

This commit is contained in:
Emery Hemingway 2021-09-02 19:03:01 +02:00
parent 45398d7b54
commit 97d3febd2e
11 changed files with 107 additions and 70 deletions

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "bumpy";
version = "1.0.3";
hash = "sha256-mDmDlhOGoYYjKgF5j808oT2NqRlfcOdLSDE3WtdJFQ0=";
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "chroma";
version = "0.2.5";
hash = "sha256-6lNHpO2aMorgkaPfo6kRcOs9r5R6T/kislVmkeoulw8=";
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "flatty";
version = "0.2.1";
hash = "sha256-TqNnRh2+i6n98ktLRVQxt9CVw17FGLNYq29rJoMus/0=";
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "nimsimd";
version = "1.0.0";
hash = "sha256-kp61fylAJ6MSN9hLYLi7CU2lxVR/lbrNCvZTe0LJLGo=";
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "pixie";
version = "1.1.3";
hash = "sha256-xKIejVxOd19mblL1ZwpJH91dgKQS5g8U08EL8lGGelA=";
}

View File

@ -0,0 +1,17 @@
{ lib, buildNimPackage, fetchNimble, SDL2 }:
buildNimPackage rec {
pname = "sdl2";
version = "2.0.4";
src = fetchNimble {
inherit pname version;
hash = "sha256-Vtcj8goI4zZPQs2TbFoBFlcR5UqDtOldaXSH/+/xULk=";
};
propagatedBuildInputs = [ SDL2 ];
doCheck = true;
meta = {
description = "Nim wrapper for SDL 2.x";
platforms = lib.platforms.linux; # Problems with Darwin.
license = [ lib.licenses.mit ];
};
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "typography";
version = "0.7.9";
hash = "sha256-IYjw3PCp5XzVed2fGGCt9Hb60cxFeF0BUZ7L5PedTLU=";
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "vmath";
version = "1.0.3";
hash = "sha256-zzSKXjuTZ46HTFUs0N47mxEKTKIdS3dwr+60sQYSdn0=";
}

View File

@ -0,0 +1,7 @@
{ fetchNimble }:
fetchNimble {
pname = "zippy";
version = "0.5.6";
hash = "sha256-axp4t9+8TFSpvnATlRKZyuOGLA0e/XKfvrVSwreXpC4=";
}

View File

@ -1,81 +1,30 @@
{ lib, stdenv, fetchurl, fetchFromGitHub, nim, gentium, SDL2, makeDesktopItem }:
{ lib, nimPackages, fetchurl, gentium, makeDesktopItem }:
let
treeformLibs = lib.attrsets.mapAttrsToList (repo: args:
fetchFromGitHub ({
inherit repo;
owner = "treeform";
} // args)) {
bumpy = {
rev = "1.0.3";
sha256 = "sha256-mDmDlhOGoYYjKgF5j808oT2NqRlfcOdLSDE3WtdJFQ0=";
};
chroma = {
rev = "0.2.5";
sha256 = "sha256-6lNHpO2aMorgkaPfo6kRcOs9r5R6T/kislVmkeoulw8=";
};
flatty = {
rev = "0.2.1";
sha256 = "sha256-TqNnRh2+i6n98ktLRVQxt9CVw17FGLNYq29rJoMus/0=";
};
pixie = {
rev = "1.1.3";
sha256 = "sha256-xKIejVxOd19mblL1ZwpJH91dgKQS5g8U08EL8lGGelA=";
};
typography = {
rev = "0.7.9";
sha256 = "sha256-IYjw3PCp5XzVed2fGGCt9Hb60cxFeF0BUZ7L5PedTLU=";
};
vmath = {
rev = "1.0.3";
sha256 = "sha256-zzSKXjuTZ46HTFUs0N47mxEKTKIdS3dwr+60sQYSdn0=";
};
};
nimLibs = treeformLibs ++ [
(fetchFromGitHub {
owner = "nim-lang";
repo = "sdl2";
rev = "v2.0.2";
sha256 = "sha256-Ivx/gxDa2HVDjCVrJVu23i4d0pDzzv+ThmwqNjtkjsA=";
})
(fetchFromGitHub {
owner = "guzba";
repo = "nimsimd";
rev = "1.0.0";
sha256 = "sha256-kp61fylAJ6MSN9hLYLi7CU2lxVR/lbrNCvZTe0LJLGo=";
})
(fetchFromGitHub {
owner = "guzba";
repo = "zippy";
rev = "0.5.6";
sha256 = "sha256-axp4t9+8TFSpvnATlRKZyuOGLA0e/XKfvrVSwreXpC4=";
})
];
in stdenv.mkDerivation rec {
nimPackages.buildNimPackage rec {
pname = "hottext";
version = "1.4";
nimBinOnly = true;
src = fetchurl {
url = "https://git.sr.ht/~ehmry/hottext/archive/v${version}.tar.gz";
sha256 = "sha256-hIUofi81zowSMbt1lUsxCnVzfJGN3FEiTtN8CEFpwzY=";
};
nativeBuildInputs = [ nim ];
buildInputs = [ SDL2 ];
nimFlags = [ "-d:release" ] ++ map (lib: "--path:${lib}/src") nimLibs;
buildInputs = with nimPackages; [
bumpy
chroma
flatty
nimsimd
pixie
sdl2
typography
vmath
zippy
];
HOTTEXT_FONT_PATH = "${gentium}/share/fonts/truetype/GentiumPlus-Regular.ttf";
buildPhase = ''
runHook preBuild
HOME=$TMPDIR
nim $nimFlags compile src/$pname
runHook postBuild
'';
desktopItem = makeDesktopItem {
categories = "Utility;";
comment = meta.description;
@ -84,11 +33,8 @@ in stdenv.mkDerivation rec {
name = pname;
};
installPhase = ''
runHook preInstall
install -Dt $out/bin src/$pname
postInstall = ''
cp -r $desktopItem/* $out
runHook postInstall
'';
meta = with lib; {

View File

@ -9,4 +9,22 @@ lib.makeScope newScope (self:
callPackage ../development/nim-packages/build-nim-package { };
fetchNimble = callPackage ../development/nim-packages/fetch-nimble { };
bumpy = callPackage ../development/nim-packages/bumpy { };
chroma = callPackage ../development/nim-packages/chroma { };
flatty = callPackage ../development/nim-packages/flatty { };
nimsimd = callPackage ../development/nim-packages/nimsimd { };
pixie = callPackage ../development/nim-packages/pixie { };
sdl2 = callPackage ../development/nim-packages/sdl2 { };
typography = callPackage ../development/nim-packages/typography { };
vmath = callPackage ../development/nim-packages/vmath { };
zippy = callPackage ../development/nim-packages/zippy { };
})