(feat): now using the .deb instead of the .AppImage for nixos
(qol): update hash
This commit is contained in:
parent
b0324fafdf
commit
6225d6f7f0
3 changed files with 113 additions and 28 deletions
103
flake.nix
103
flake.nix
|
|
@ -4,37 +4,100 @@
|
|||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = {nixpkgs, ...}: let
|
||||
systems = ["x86_64-linux" "aarch64-linux"];
|
||||
systems = ["x86_64-linux"];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
version = "0.0.5";
|
||||
x86_64DebHash = "sha256-flC62rhhKyE/yRoNZRwXVHn/vwxE/Klxzj8uWhItDkY=";
|
||||
forgejoBaseUrl = "https://git.methanium.net/tensamin/client/releases/download/${version}";
|
||||
in {
|
||||
packages = forAllSystems (system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
artifact = if system == "aarch64-linux" then "Tensamin-${version}-linux-arm64.AppImage" else "Tensamin-${version}-linux-x86_64.AppImage";
|
||||
appImagePath = /. + builtins.getEnv "TENSAMIN_APPIMAGE";
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
name = "tensamin";
|
||||
desktopName = "Tensamin";
|
||||
exec = "tensamin %U";
|
||||
icon = "tensamin";
|
||||
categories = ["Network"];
|
||||
};
|
||||
wrapAppImage = src:
|
||||
pkgs.appimageTools.wrapType2 {
|
||||
debArtifact = "Tensamin-${version}-linux-amd64.deb";
|
||||
localDebPath = builtins.getEnv "TENSAMIN_DEB";
|
||||
debPath = /. + localDebPath;
|
||||
electronRuntimeLibs = with pkgs; [
|
||||
alsa-lib
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
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";
|
||||
inherit version src;
|
||||
extraInstallCommands = ''
|
||||
install -Dm444 ${desktopItem}/share/applications/tensamin.desktop $out/share/applications/tensamin.desktop
|
||||
inherit version;
|
||||
|
||||
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 {
|
||||
default = wrapAppImage (pkgs.fetchurl {
|
||||
url = "${forgejoBaseUrl}/${artifact}";
|
||||
hash = "sha256-WnDuEnwaZiHKh+1iOD0hU6TuYhGNQH82WxvW7sGdoAo=";
|
||||
defaultPackage = packageDeb (pkgs.fetchurl {
|
||||
url = "${forgejoBaseUrl}/${debArtifact}";
|
||||
hash = x86_64DebHash;
|
||||
});
|
||||
in {
|
||||
default = defaultPackage;
|
||||
|
||||
localPathForDev = wrapAppImage appImagePath;
|
||||
localPathForDev = if localDebPath == "" then defaultPackage else packageDeb debPath;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue