cleanup derivations
This commit is contained in:
parent
b5a37173b0
commit
f3374e0e31
4 changed files with 80 additions and 39 deletions
16
flake.nix
16
flake.nix
|
@ -12,23 +12,27 @@
|
|||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
packages = rec {
|
||||
libgovarnam = pkgs.callPackage ./govarnam/libgovarnam.nix { };
|
||||
varnam-cli = pkgs.callPackage ./govarnam { inherit libgovarnam; };
|
||||
fcitx5-varnam = pkgs.callPackage ./varnam-fcitx5 { inherit libgovarnam; };
|
||||
};
|
||||
in
|
||||
{
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
packages = (with pkgs; [
|
||||
go_1_22
|
||||
gnumake
|
||||
meson
|
||||
ninja
|
||||
cmake
|
||||
pkg-config
|
||||
];
|
||||
]) ++ (with packages; [ libgovarnam ]);
|
||||
};
|
||||
packages = rec {
|
||||
libgovarnam = pkgs.callPackage ./govarnam/default.nix { };
|
||||
varnam-cli = pkgs.callPackage ./govarnam/default.nix { cli = true; };
|
||||
fcitx5-varnam = pkgs.callPackage ./varnam-fcitx5 { inherit libgovarnam; };
|
||||
packages = {
|
||||
inherit (packages) libgovarnam varnam-cli fcitx5-varnam;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, pkg-config
|
||||
, cli ? false
|
||||
, libgovarnam
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "libgovarnam";
|
||||
pname = "varnam-cli";
|
||||
version = "1.9.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
|
@ -21,46 +21,26 @@ buildGoModule rec {
|
|||
|
||||
CGO_ENABLED = 1;
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
nativeBuildInputs = [ pkg-config libgovarnam ];
|
||||
|
||||
buildPhase =
|
||||
let buildcli = ''go build -o varnamcli -ldflags "-s -w -X 'github.com/varnamproject/govarnam/govarnam.BuildString=${version} (\#0000000 1970-01-01T00:00:00+0000)' -X 'github.com/varnamproject/govarnam/govarnam.VersionString=${version}'" ./cli'';
|
||||
in ''
|
||||
runHook preInstall
|
||||
|
||||
go build -tags "fts5" -buildmode=c-shared -ldflags "-s -w -X 'github.com/varnamproject/govarnam/govarnam.BuildString=${version} (\#0000000 1970-01-01T00:00:00+0000)' -X 'github.com/varnamproject/govarnam/govarnam.VersionString=${version}' -extldflags "-Wl,-soname,${pname}.so.1,--version-script,${src}/govarnam.syms"" -o ${pname}.so .
|
||||
${lib.optionalString cli "${buildcli}"}
|
||||
ldflags = [
|
||||
"-w"
|
||||
"-s"
|
||||
"-X 'github.com/varnamproject/govarnam/govarnam.BuildString=${version} (\#0000000 1970-01-01T00:00:00+0000)'"
|
||||
"-X 'github.com/varnamproject/govarnam/govarnam.VersionString=${version}'"
|
||||
];
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/lib
|
||||
cp ${pname}.so $out/lib/${pname}.so.${version}
|
||||
ln -s $out/lib/${pname}.so.${version} $out/lib/${pname}.so
|
||||
ln -s $out/lib/${pname}.so.${version} $out/lib/${pname}.so.1
|
||||
|
||||
mkdir -p $out/lib/pkgconfig
|
||||
cp govarnam.pc.in $out/lib/pkgconfig/govarnam.pc
|
||||
sed -i "s#@INSTALL_PREFIX@#$out/lib#g" $out/lib/pkgconfig/govarnam.pc
|
||||
|
||||
mkdir -p $out/include/${pname}
|
||||
cp *.h $out/include/${pname}/
|
||||
|
||||
${lib.optionalString cli "install -Dt $out/bin varnamcli"}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
subPackages = [
|
||||
"cli"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Easily type Indic languages on computer and mobile. GoVarnam is a cross-platform transliteration library. Manglish -> Malayalam, Thanglish -> Tamil, Hinglish -> Hindi plus another 10 languages. GoVarnam is a near-Go port of libvarnam";
|
||||
homepage = "https://github.com/varnamproject/govarnam";
|
||||
license = lib.licenses.agpl3Only;
|
||||
maintainers = with lib.maintainers; [ adtya ];
|
||||
pkgConfigModules = [ "libgovarnam" ];
|
||||
|
||||
};
|
||||
}
|
||||
|
|
58
govarnam/libgovarnam.nix
Normal file
58
govarnam/libgovarnam.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "libgovarnam";
|
||||
version = "1.9.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "varnamproject";
|
||||
repo = "govarnam";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-7SYdeOMgc8VBx0rsu6tWGND9mq0Td1VeGmZrpfsWsVE=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
vendorHash = "sha256-a7m2THvdi17muJI6p6OVX9cBMcmocYwju29beG2H8CY=";
|
||||
|
||||
CGO_ENABLED = 1;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
go build -tags "fts5" -buildmode=c-shared -ldflags "-s -w -X 'github.com/varnamproject/govarnam/govarnam.BuildString=${version} (\#0000000 1970-01-01T00:00:00+0000)' -X 'github.com/varnamproject/govarnam/govarnam.VersionString=${version}' -extldflags "-Wl,-soname,${pname}.so.1,--version-script,${src}/govarnam.syms"" -o ${pname}.so .
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/lib
|
||||
cp ${pname}.so $out/lib/${pname}.so.${version}
|
||||
ln -s $out/lib/${pname}.so.${version} $out/lib/${pname}.so
|
||||
ln -s $out/lib/${pname}.so.${version} $out/lib/${pname}.so.1
|
||||
|
||||
mkdir -p $out/lib/pkgconfig
|
||||
cp govarnam.pc.in $out/lib/pkgconfig/govarnam.pc
|
||||
sed -i "s#@INSTALL_PREFIX@#$out#g" $out/lib/pkgconfig/govarnam.pc
|
||||
sed -i "s#@VERSION@#${version}#g" $out/lib/pkgconfig/govarnam.pc
|
||||
|
||||
mkdir -p $out/include/${pname}
|
||||
cp *.h $out/include/${pname}/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
||||
meta = {
|
||||
description = "Easily type Indic languages on computer and mobile. GoVarnam is a cross-platform transliteration library. Manglish -> Malayalam, Thanglish -> Tamil, Hinglish -> Hindi plus another 10 languages. GoVarnam is a near-Go port of libvarnam";
|
||||
homepage = "https://github.com/varnamproject/govarnam";
|
||||
license = lib.licenses.agpl3Only;
|
||||
maintainers = with lib.maintainers; [ adtya ];
|
||||
pkgConfigModules = [ pname ];
|
||||
|
||||
};
|
||||
}
|
|
@ -75,7 +75,6 @@ stdenv.mkDerivation rec {
|
|||
homepage = "https://github.com/varnamproject/varnam-fcitx5";
|
||||
license = lib.licenses.gpl3Only;
|
||||
maintainers = with lib.maintainers; [ adtya ];
|
||||
mainProgram = "varnam-fcitx5";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue