kopia-ui: init at 0.19.0 (#394918)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
diff --git a/public/utils.js b/public/utils.js
|
||||
index 3cd38b63..54152694 100644
|
||||
--- a/public/utils.js
|
||||
+++ b/public/utils.js
|
||||
@@ -17,7 +17,7 @@ const osShortName = function () {
|
||||
|
||||
export function iconsPath() {
|
||||
if (!app.isPackaged) {
|
||||
- return path.join(__dirname, "..", "resources", osShortName, "icons");
|
||||
+ return path.join(__dirname, "..", "..", "icons");
|
||||
}
|
||||
|
||||
return path.join(process.resourcesPath, "icons");
|
||||
@@ -25,26 +25,14 @@ export function iconsPath() {
|
||||
|
||||
export function publicPath() {
|
||||
if (!app.isPackaged) {
|
||||
- return path.join(__dirname, "..", "public");
|
||||
+ return path.join(__dirname, "..", "..", "public");
|
||||
}
|
||||
|
||||
return process.resourcesPath;
|
||||
}
|
||||
|
||||
export function defaultServerBinary() {
|
||||
- if (!app.isPackaged) {
|
||||
- return {
|
||||
- "mac": path.join(__dirname, "..", "..", "dist", "kopia_darwin_amd64", "kopia"),
|
||||
- "win": path.join(__dirname, "..", "..", "dist", "kopia_windows_amd64", "kopia.exe"),
|
||||
- "linux": path.join(__dirname, "..", "..", "dist", "kopia_linux_amd64", "kopia"),
|
||||
- }[osShortName]
|
||||
- }
|
||||
-
|
||||
- return {
|
||||
- "mac": path.join(process.resourcesPath, "server", "kopia"),
|
||||
- "win": path.join(process.resourcesPath, "server", "kopia.exe"),
|
||||
- "linux": path.join(process.resourcesPath, "server", "kopia"),
|
||||
- }[osShortName]
|
||||
+ return "KOPIA"
|
||||
}
|
||||
export function selectByOS(x) {
|
||||
return x[osShortName]
|
||||
@@ -0,0 +1,94 @@
|
||||
{
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub,
|
||||
electron,
|
||||
copyDesktopItems,
|
||||
makeDesktopItem,
|
||||
nix-update-script,
|
||||
makeWrapper,
|
||||
kopia,
|
||||
}:
|
||||
let
|
||||
version = "0.19.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "kopia";
|
||||
repo = "kopia";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-PfxMs9MwoI+4z8vZ1sVlIEal3TOmA06997jWwShNfrE=";
|
||||
};
|
||||
in
|
||||
buildNpmPackage {
|
||||
pname = "kopia-ui";
|
||||
inherit version src;
|
||||
|
||||
sourceRoot = "${src.name}/app";
|
||||
|
||||
npmDepsHash = "sha256-3K5dwAQeAo98rz2gxGw3k/D+VkDJNe5pmAyEo4boetU=";
|
||||
makeCacheWritable = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
copyDesktopItems
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
env = {
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
|
||||
};
|
||||
|
||||
patches = [ ./fix-paths.patch ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace public/utils.js --replace-fail KOPIA ${lib.getExe kopia}
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w ..
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist=electron-dist \
|
||||
-c.electronVersion=${electron.version} \
|
||||
-c.extraMetadata.version=v${version}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/share/kopia
|
||||
cp -r ../dist/kopia-ui/*-unpacked/{locales,resources{,.pak}} $out/share/kopia
|
||||
install -Dm644 $src/icons/kopia.svg $out/share/icons/hicolor/scalable/apps/kopia.svg
|
||||
makeWrapper ${lib.getExe electron} $out/bin/kopia-ui \
|
||||
--prefix PATH : ${lib.makeBinPath [ kopia ]} \
|
||||
--add-flags $out/share/kopia/resources/app.asar \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
|
||||
--inherit-argv0
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "kopia-ui";
|
||||
type = "Application";
|
||||
desktopName = "KopiaUI";
|
||||
comment = "Fast and secure open source backup.";
|
||||
icon = "kopia-ui";
|
||||
exec = "kopia-ui";
|
||||
categories = [ "Utility" ];
|
||||
})
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Cross-platform backup tool with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication";
|
||||
mainProgram = "kopia-ui";
|
||||
homepage = "https://kopia.io";
|
||||
downloadPage = "https://github.com/kopia/kopia";
|
||||
changelog = "https://github.com/kopia/kopia/releases/tag/v${version}";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ blenderfreaky ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user