This commit is contained in:
Alois 2026-07-21 11:39:28 +02:00
commit f41cf7cfa4
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24

View file

@ -6,19 +6,24 @@
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = {
outputs =
{
self,
nixpkgs,
rust-overlay,
...
}: let
}:
let
systems = [ "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
version = "0.0.10";
x86_64DebHash = "sha256-9s47HyPJf/6yA6XGgKBJ+60gTXLTV/jvE2tS/Fth8zA=";
x86_64DebHash = "sha256-VVKkZ9yQ7BoLnYnCf5OSHcrakoBNfUx/uWxBmm3gBZE=";
forgejoBaseUrl = "https://git.methanium.net/tensamin/client/releases/download/${version}";
in {
packages = forAllSystems (system: let
in
{
packages = forAllSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
@ -69,7 +74,8 @@
libXtst
libxcb
];
packageDeb = src:
packageDeb =
src:
pkgs.stdenv.mkDerivation {
pname = "tensamin";
inherit version src;
@ -100,37 +106,44 @@
mkdir -p "$out/bin"
makeWrapper "$out/opt/Tensamin/tensamin" "$out/bin/tensamin"
substituteInPlace "$out/share/applications/tensamin.desktop" \
substituteInPlace "$out/share/applications/Tensamin.desktop" \
--replace-fail "Exec=/opt/Tensamin/tensamin" "Exec=tensamin"
runHook postInstall
'';
};
defaultPackage = packageDeb (pkgs.fetchurl {
defaultPackage = packageDeb (
pkgs.fetchurl {
url = "${forgejoBaseUrl}/${debArtifact}";
hash = x86_64DebHash;
});
}
);
localDebPath = builtins.getEnv "TENSAMIN_DEB";
localPathPackage =
if localDebPath == ""
then
if localDebPath == "" then
pkgs.writeShellScriptBin "tensamin" ''
echo "Set TENSAMIN_DEB to a local .deb path and run with --impure." >&2
exit 1
''
else
packageDeb (builtins.path {
packageDeb (
builtins.path {
path = localDebPath;
name = debArtifact;
});
in {
}
);
in
{
default = defaultPackage;
tensamin = defaultPackage;
electron = defaultPackage;
localPathForDev = localPathPackage;
});
}
);
devShells = forAllSystems (system: let
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
@ -188,7 +201,10 @@
toolsVersion = "26.1.1";
platformToolsVersion = "35.0.2";
buildToolsVersions = [ buildToolsVersion ];
platformVersions = ["35" "36"];
platformVersions = [
"35"
"36"
];
includeSources = false;
includeSystemImages = false;
includeNDK = true;
@ -196,7 +212,10 @@
useGoogleAPIs = false;
};
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-src" "rust-analyzer"];
extensions = [
"rust-src"
"rust-analyzer"
];
targets = [
"aarch64-linux-android"
"armv7-linux-androideabi"
@ -206,23 +225,37 @@
];
};
commonDeps = [rustToolchain pkgs.wasm-pack pkgs.lld];
commonDeps = [
rustToolchain
pkgs.wasm-pack
pkgs.lld
];
appImageToolsArchive = pkgs.fetchurl {
url = "https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage@1.0.3/appimage-tools-runtime-20251108.tar.gz";
hash = "sha256-hAIaeO4hSub9M6LWKpK6JVQt0QvIa/EXqbLQu6ROdmU=";
};
appImageTools = pkgs.runCommand "electron-builder-appimage-tools-nix" {nativeBuildInputs = [pkgs.gnutar pkgs.gzip];} ''
appImageTools =
pkgs.runCommand "electron-builder-appimage-tools-nix"
{
nativeBuildInputs = [
pkgs.gnutar
pkgs.gzip
];
}
''
mkdir -p "$out"
tar -xzf ${appImageToolsArchive} --strip-components=1 -C "$out"
rm -f "$out/mksquashfs" "$out/desktop-file-validate"
ln -s ${pkgs.squashfsTools}/bin/mksquashfs "$out/mksquashfs"
ln -s ${pkgs.desktop-file-utils}/bin/desktop-file-validate "$out/desktop-file-validate"
'';
in rec {
in
rec {
default = electron;
electron = pkgs.mkShell {
packages = with pkgs;
packages =
with pkgs;
[
nodejs_22
corepack_22
@ -245,7 +278,8 @@
xz
p7zip
]
++ electronRuntimeLibs ++ commonDeps;
++ electronRuntimeLibs
++ commonDeps;
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath electronRuntimeLibs}:$LD_LIBRARY_PATH"
@ -266,7 +300,8 @@
};
tauri = pkgs.mkShell {
buildInputs = with pkgs;
buildInputs =
with pkgs;
[
jdk17
gradle
@ -340,6 +375,7 @@
fi
'';
};
});
}
);
};
}