(feat): now using the .deb instead of the .AppImage for nixos #13
3 changed files with 113 additions and 28 deletions
|
|
@ -238,10 +238,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
APPIMAGE="$(find releases -maxdepth 1 -type f -name 'Tensamin-*-linux-x86_64.AppImage' -print -quit)"
|
DEB="$(find releases -maxdepth 1 -type f -name 'Tensamin-*-linux-amd64.deb' -print -quit)"
|
||||||
test -n "$APPIMAGE"
|
test -n "$DEB"
|
||||||
|
|
||||||
HASH="$(node -e 'const fs = require("fs"); const crypto = require("crypto"); const file = process.argv[1]; console.log("sha256-" + crypto.createHash("sha256").update(fs.readFileSync(file)).digest("base64"));' "$APPIMAGE")"
|
HASH="$(node -e 'const fs = require("fs"); const crypto = require("crypto"); const file = process.argv[1]; console.log("sha256-" + crypto.createHash("sha256").update(fs.readFileSync(file)).digest("base64"));' "$DEB")"
|
||||||
export HASH
|
export HASH
|
||||||
|
|
||||||
node -e '
|
node -e '
|
||||||
|
|
@ -250,15 +250,37 @@ jobs:
|
||||||
const hash = process.env.HASH;
|
const hash = process.env.HASH;
|
||||||
let content = fs.readFileSync("flake.nix", "utf8");
|
let content = fs.readFileSync("flake.nix", "utf8");
|
||||||
content = content.replace(/version = "[^"]+";/, `version = "${version}";`);
|
content = content.replace(/version = "[^"]+";/, `version = "${version}";`);
|
||||||
content = content.replace(/hash = "sha256-[^"]+";/, `hash = "${hash}";`);
|
content = content.replace(/x86_64DebHash = "sha256-[^"]+";/, `x86_64DebHash = "${hash}";`);
|
||||||
fs.writeFileSync("flake.nix", content);
|
fs.writeFileSync("flake.nix", content);
|
||||||
'
|
'
|
||||||
|
|
||||||
if git diff --quiet -- flake.nix; then
|
if git diff --quiet -- flake.nix; then
|
||||||
echo "flake.nix already has the current release hash."
|
echo "flake.nix already has the current release hash on main."
|
||||||
|
else
|
||||||
|
git add flake.nix
|
||||||
|
git -c user.name="forgejo-actions" -c user.email="forgejo-actions@localhost" commit -m "(qol): update release flake hash"
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch origin dev
|
||||||
|
git worktree add ../dev-flake-update origin/dev
|
||||||
|
cd ../dev-flake-update
|
||||||
|
|
||||||
|
node -e '
|
||||||
|
const fs = require("fs");
|
||||||
|
const version = process.env.TAG;
|
||||||
|
const hash = process.env.HASH;
|
||||||
|
let content = fs.readFileSync("flake.nix", "utf8");
|
||||||
|
content = content.replace(/version = "[^"]+";/, `version = "${version}";`);
|
||||||
|
content = content.replace(/x86_64DebHash = "sha256-[^"]+";/, `x86_64DebHash = "${hash}";`);
|
||||||
|
fs.writeFileSync("flake.nix", content);
|
||||||
|
'
|
||||||
|
|
||||||
|
if git diff --quiet -- flake.nix; then
|
||||||
|
echo "flake.nix already has the current release hash on dev."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git add flake.nix
|
git add flake.nix
|
||||||
git -c user.name="forgejo-actions" -c user.email="forgejo-actions@localhost" commit -m "(qol): update release flake hash"
|
git -c user.name="forgejo-actions" -c user.email="forgejo-actions@localhost" commit -m "(qol): update release flake hash"
|
||||||
git push
|
git push origin HEAD:dev
|
||||||
|
|
|
||||||
103
flake.nix
103
flake.nix
|
|
@ -4,37 +4,100 @@
|
||||||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
outputs = {nixpkgs, ...}: let
|
outputs = {nixpkgs, ...}: let
|
||||||
systems = ["x86_64-linux" "aarch64-linux"];
|
systems = ["x86_64-linux"];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||||
version = "0.0.5";
|
version = "0.0.5";
|
||||||
|
x86_64DebHash = "sha256-flC62rhhKyE/yRoNZRwXVHn/vwxE/Klxzj8uWhItDkY=";
|
||||||
forgejoBaseUrl = "https://git.methanium.net/tensamin/client/releases/download/${version}";
|
forgejoBaseUrl = "https://git.methanium.net/tensamin/client/releases/download/${version}";
|
||||||
in {
|
in {
|
||||||
packages = forAllSystems (system: let
|
packages = forAllSystems (system: let
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {inherit system;};
|
||||||
artifact = if system == "aarch64-linux" then "Tensamin-${version}-linux-arm64.AppImage" else "Tensamin-${version}-linux-x86_64.AppImage";
|
debArtifact = "Tensamin-${version}-linux-amd64.deb";
|
||||||
appImagePath = /. + builtins.getEnv "TENSAMIN_APPIMAGE";
|
localDebPath = builtins.getEnv "TENSAMIN_DEB";
|
||||||
desktopItem = pkgs.makeDesktopItem {
|
debPath = /. + localDebPath;
|
||||||
name = "tensamin";
|
electronRuntimeLibs = with pkgs; [
|
||||||
desktopName = "Tensamin";
|
alsa-lib
|
||||||
exec = "tensamin %U";
|
at-spi2-atk
|
||||||
icon = "tensamin";
|
at-spi2-core
|
||||||
categories = ["Network"];
|
cairo
|
||||||
};
|
cups
|
||||||
wrapAppImage = src:
|
dbus
|
||||||
pkgs.appimageTools.wrapType2 {
|
expat
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
gdk-pixbuf
|
||||||
|
glib
|
||||||
|
gtk3
|
||||||
|
libdrm
|
||||||
|
libgbm
|
||||||
|
libnotify
|
||||||
|
libpulseaudio
|
||||||
|
libuuid
|
||||||
|
libxkbcommon
|
||||||
|
mesa
|
||||||
|
nspr
|
||||||
|
nss
|
||||||
|
pango
|
||||||
|
systemd
|
||||||
|
wayland
|
||||||
|
libX11
|
||||||
|
libXScrnSaver
|
||||||
|
libXcomposite
|
||||||
|
libXcursor
|
||||||
|
libXdamage
|
||||||
|
libXext
|
||||||
|
libXfixes
|
||||||
|
libXi
|
||||||
|
libXrandr
|
||||||
|
libXtst
|
||||||
|
libxcb
|
||||||
|
];
|
||||||
|
packageDeb = src:
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
pname = "tensamin";
|
pname = "tensamin";
|
||||||
inherit version src;
|
inherit version;
|
||||||
extraInstallCommands = ''
|
|
||||||
install -Dm444 ${desktopItem}/share/applications/tensamin.desktop $out/share/applications/tensamin.desktop
|
inherit src;
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
autoPatchelfHook
|
||||||
|
dpkg
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
buildInputs = electronRuntimeLibs;
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
|
||||||
|
unpackPhase = ''
|
||||||
|
runHook preUnpack
|
||||||
|
dpkg-deb -x $src .
|
||||||
|
runHook postUnpack
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r opt $out/
|
||||||
|
cp -r usr/* $out/
|
||||||
|
|
||||||
|
mkdir -p $out/bin
|
||||||
|
makeWrapper $out/opt/Tensamin/tensamin $out/bin/tensamin
|
||||||
|
|
||||||
|
substituteInPlace $out/share/applications/tensamin.desktop \
|
||||||
|
--replace-fail "Exec=/opt/Tensamin/tensamin" "Exec=tensamin"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
defaultPackage = packageDeb (pkgs.fetchurl {
|
||||||
default = wrapAppImage (pkgs.fetchurl {
|
url = "${forgejoBaseUrl}/${debArtifact}";
|
||||||
url = "${forgejoBaseUrl}/${artifact}";
|
hash = x86_64DebHash;
|
||||||
hash = "sha256-WnDuEnwaZiHKh+1iOD0hU6TuYhGNQH82WxvW7sGdoAo=";
|
|
||||||
});
|
});
|
||||||
|
in {
|
||||||
|
default = defaultPackage;
|
||||||
|
|
||||||
localPathForDev = wrapAppImage appImagePath;
|
localPathForDev = if localDebPath == "" then defaultPackage else packageDeb debPath;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tensamin",
|
"name": "tensamin",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
"build:mobile": "cd apps/tauri && bun run build:mobile",
|
"build:mobile": "cd apps/tauri && bun run build:mobile",
|
||||||
"dev:desktop": "cd apps/electron && bun run dev",
|
"dev:desktop": "cd apps/electron && bun run dev",
|
||||||
"build:desktop": "cd apps/electron && bun run package",
|
"build:desktop": "cd apps/electron && bun run package",
|
||||||
"run:desktop": "TENSAMIN_APPIMAGE=\"$PWD/apps/electron/release/Tensamin-0.0.3-linux-x86_64.AppImage\" nix run .#localPathForDev --impure",
|
"run:desktop": "TENSAMIN_DEB=\"$PWD/apps/electron/release/Tensamin-$(node -p \\\"require('./package.json').version\\\")-linux-amd64.deb\" nix run .#localPathForDev --impure",
|
||||||
"delete:mobile": "cd apps/tauri && nix develop --command adb uninstall net.tensamin.client"
|
"delete:mobile": "cd apps/tauri && nix develop --command adb uninstall net.tensamin.client"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue