include schemes with varnamcli
This commit is contained in:
parent
24797f9cd1
commit
4d554a7425
3 changed files with 35 additions and 30 deletions
|
@ -14,8 +14,8 @@
|
|||
};
|
||||
|
||||
packages = rec {
|
||||
libgovarnam = pkgs.callPackage ./govarnam/libgovarnam.nix { selected_schemes = [ "ml" ]; };
|
||||
varnam-cli = pkgs.callPackage ./govarnam { inherit libgovarnam; };
|
||||
libgovarnam = pkgs.callPackage ./govarnam/libgovarnam.nix { };
|
||||
varnam-cli = pkgs.callPackage ./govarnam { inherit libgovarnam; selected_schemes = [ "ml" ]; };
|
||||
fcitx5-varnam = pkgs.callPackage ./varnam-fcitx5 { inherit libgovarnam; };
|
||||
};
|
||||
in
|
||||
|
@ -24,11 +24,15 @@
|
|||
devShells.default = pkgs.mkShell {
|
||||
packages = (with pkgs; [
|
||||
go_1_22
|
||||
gopls
|
||||
gnumake
|
||||
meson
|
||||
ninja
|
||||
cmake
|
||||
pkg-config
|
||||
ruby
|
||||
rubyPackages.ffi
|
||||
python3
|
||||
]) ++ (with packages; [ libgovarnam varnam-cli ]);
|
||||
};
|
||||
packages = {
|
||||
|
|
|
@ -1,9 +1,32 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchzip
|
||||
, pkg-config
|
||||
, libgovarnam
|
||||
, makeWrapper
|
||||
, selected_schemes ? [ ]
|
||||
}:
|
||||
|
||||
let
|
||||
schemeShas = import ./schemes.nix;
|
||||
knownSchemes = builtins.attrNames schemeShas;
|
||||
selectedSchemes =
|
||||
if (selected_schemes == [ ])
|
||||
then knownSchemes
|
||||
else
|
||||
let
|
||||
unknown = lib.subtractLists knownSchemes selected_schemes;
|
||||
in
|
||||
if (unknown != [ ])
|
||||
then throw "Unknown scheme(s): ${lib.concatStringsSep " " unknown}"
|
||||
else selected_schemes;
|
||||
schemeSrcs = lib.lists.forEach selectedSchemes (
|
||||
name: (fetchzip {
|
||||
url = schemeShas.${name}.url;
|
||||
sha256 = schemeShas.${name}.sha;
|
||||
})
|
||||
);
|
||||
in
|
||||
buildGoModule rec {
|
||||
pname = "varnam-cli";
|
||||
version = libgovarnam.version;
|
||||
|
@ -14,7 +37,7 @@ buildGoModule rec {
|
|||
|
||||
CGO_ENABLED = 1;
|
||||
|
||||
nativeBuildInputs = [ pkg-config libgovarnam ];
|
||||
nativeBuildInputs = [ pkg-config libgovarnam makeWrapper];
|
||||
buildInputs = [ pkg-config libgovarnam ];
|
||||
|
||||
ldflags = [
|
||||
|
@ -29,7 +52,11 @@ buildGoModule rec {
|
|||
];
|
||||
|
||||
postInstall = ''
|
||||
mv $out/bin/cli $out/bin/varnamcli
|
||||
mkdir -p $out/share/varnam/schemes
|
||||
cp ${toString (lib.lists.forEach schemeSrcs (scheme: "${scheme}/*.vst"))} $out/share/varnam/schemes/
|
||||
|
||||
mv $out/bin/cli $out/bin/.varnamcli
|
||||
makeWrapper $out/bin/.varnamcli $out/bin/varnamcli --set VARNAM_VST_DIR $out/share/varnam/schemes
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -1,30 +1,8 @@
|
|||
{ lib
|
||||
, fetchzip
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, selected_schemes ? [ ]
|
||||
}:
|
||||
|
||||
let
|
||||
schemeShas = import ./schemes.nix;
|
||||
knownSchemes = builtins.attrNames schemeShas;
|
||||
selectedSchemes =
|
||||
if (selected_schemes == [ ])
|
||||
then knownSchemes
|
||||
else
|
||||
let
|
||||
unknown = lib.subtractLists knownSchemes selected_schemes;
|
||||
in
|
||||
if (unknown != [ ])
|
||||
then throw "Unknown scheme(s): ${lib.concatStringsSep " " unknown}"
|
||||
else selected_schemes;
|
||||
schemeSrcs = lib.lists.forEach selectedSchemes (
|
||||
name: (fetchzip {
|
||||
url = schemeShas.${name}.url;
|
||||
sha256 = schemeShas.${name}.sha;
|
||||
})
|
||||
);
|
||||
in
|
||||
buildGoModule rec {
|
||||
pname = "libgovarnam";
|
||||
version = "1.9.1";
|
||||
|
@ -69,10 +47,6 @@ buildGoModule rec {
|
|||
mkdir -p $out/include/${pname}
|
||||
cp *.h $out/include/${pname}/
|
||||
|
||||
mkdir -p $out/share/varnam/schemes
|
||||
echo ${toString (lib.lists.forEach schemeSrcs (scheme: "${scheme}/*.vst"))}
|
||||
cp ${toString (lib.lists.forEach schemeSrcs (scheme: "${scheme}/*.vst"))} $out/share/varnam/schemes/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue