add nix package
This commit is contained in:
parent
b407bbfdee
commit
11ecec5ab3
5 changed files with 65 additions and 23 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -39,3 +39,6 @@ key.properties
|
||||||
|
|
||||||
# Devel Password
|
# Devel Password
|
||||||
password.txt
|
password.txt
|
||||||
|
|
||||||
|
# Nix
|
||||||
|
/result
|
||||||
|
|
@ -39,9 +39,14 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.default = pkgs.callPackage ./linux/nix/package.nix {
|
packages = {
|
||||||
|
default = pkgs.callPackage ./linux/nix/pkg {
|
||||||
src = self;
|
src = self;
|
||||||
};
|
};
|
||||||
|
gomuks = pkgs.callPackage ./linux/nix/pkg/gomuks.nix {
|
||||||
|
src = self;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.callPackage ./linux/nix/devshell.nix { };
|
devShells.default = pkgs.callPackage ./linux/nix/devshell.nix { };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,12 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||||
throw UnsupportedError("Unsupported OS: $targetOS");
|
throw UnsupportedError("Unsupported OS: $targetOS");
|
||||||
}
|
}
|
||||||
|
|
||||||
final buildDir = input.packageRoot.resolve("build/");
|
var libFile = input.packageRoot.resolve(libFileName);
|
||||||
final gomuksBuildDir = input.packageRoot.resolve("gomuks/");
|
final gomuksBuildDir = input.packageRoot.resolve("gomuks/");
|
||||||
final libFile = buildDir.resolve("${targetArch.name}/$libFileName");
|
|
||||||
|
if (!(await File.fromUri(libFile).exists())) {
|
||||||
|
final buildDir = input.packageRoot.resolve("build/");
|
||||||
|
libFile = buildDir.resolve("${targetArch.name}/$libFileName");
|
||||||
|
|
||||||
// goheif/dav1d supported on Android would need to fix upstream
|
// goheif/dav1d supported on Android would need to fix upstream
|
||||||
final tags = targetOS == OS.android ? "goolm,noheic" : "goolm";
|
final tags = targetOS == OS.android ? "goolm,noheic" : "goolm";
|
||||||
|
|
@ -64,7 +67,10 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.exitCode != 0) {
|
if (result.exitCode != 0) {
|
||||||
throw Exception("Failed to build Gomuks shared library\n${result.stderr}");
|
throw Exception(
|
||||||
|
"Failed to build Gomuks shared library\n${result.stderr}",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final generatedFile = "src/third_party/gomuks.g.dart";
|
final generatedFile = "src/third_party/gomuks.g.dart";
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
callPackage,
|
||||||
libclang,
|
libclang,
|
||||||
flutter,
|
flutter,
|
||||||
src,
|
src,
|
||||||
go,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
flutter.buildFlutterApplication {
|
flutter.buildFlutterApplication {
|
||||||
|
|
@ -12,16 +12,13 @@ flutter.buildFlutterApplication {
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
|
cp ${callPackage ./gomuks.nix { inherit src; }}/lib/* .
|
||||||
packageRunCustom nexus generate source/scripts test
|
packageRunCustom nexus generate source/scripts test
|
||||||
packageRun build_runner build
|
packageRun build_runner build
|
||||||
'';
|
'';
|
||||||
|
|
||||||
env.LIBCLANG_PATH = lib.makeLibraryPath [ libclang ];
|
env.LIBCLANG_PATH = lib.makeLibraryPath [ libclang ];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
go
|
|
||||||
];
|
|
||||||
|
|
||||||
autoPubspecLock = src + "/pubspec.lock";
|
autoPubspecLock = src + "/pubspec.lock";
|
||||||
|
|
||||||
gitHashes = {
|
gitHashes = {
|
||||||
31
linux/nix/pkg/gomuks.nix
Normal file
31
linux/nix/pkg/gomuks.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
src,
|
||||||
|
buildGoModule,
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildGoModule (finalAttrs: {
|
||||||
|
pname = "gomuks-ffi";
|
||||||
|
version = "submodule";
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
src = "${src}/gomuks";
|
||||||
|
|
||||||
|
vendorHash = "sha256-zBDfBZqUoHIfZ0AajZEvSBbskjpFB7yIsomt0KYDo7Y=";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
go build -buildmode=c-shared -o libgomuks.so -tags goolm,noheic ./pkg/ffi
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
install -D --mode=0644 libgomuks.so --target-directory $out/lib
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue