remove ivpn-ui

This commit is contained in:
Dmitriy Kholkin 2023-06-27 01:44:04 +03:00
parent 45668a900d
commit 2852da08cb
6 changed files with 1 additions and 273 deletions

42
ci.nix
View File

@ -1,42 +0,0 @@
with builtins;
let
outputs = builtins.getFlake (toString ./.);
pkgs = outputs.inputs.nixpkgs;
isHost = n: pkgs.lib.strings.hasPrefix "host" n;
isDerivation = p: isAttrs p && p ? type && p.type == "derivation";
isBuildable = p: !(p.meta.broken or false);
isCacheable = p: !(p.preferLocalBuild or false);
shouldRecurseForDerivations = p:
isAttrs p && p.recurseForDerivations or false;
nameValuePair = n: v: {
name = n;
value = v;
};
concatMap = builtins.concatMap or (f: xs: concatLists (map f xs));
flattenPkgs = s:
let
f = p:
if shouldRecurseForDerivations p then
flattenPkgs p
else if isDerivation p then
[ p ]
else
[ ];
in concatMap f (attrValues s);
outputsOf = p: map (o: p.${o}) p.outputs;
hostAttrs = outputs.packages.x86_64-linux;
hostPkgs = flattenPkgs (listToAttrs (map (n: nameValuePair n hostAttrs.${n})
(filter (n: isHost n) (attrNames hostAttrs))));
in rec {
buildPkgs = filter isBuildable hostPkgs;
cachePkgs = filter isCacheable buildPkgs;
buildOutputs = concatMap outputsOf buildPkgs;
cacheOutputs = concatMap outputsOf cachePkgs;
}

View File

@ -113,7 +113,6 @@
sharedPatches = patchesPath [
"gitea-208605.patch"
# "ivpn-ui.patch"
"ivpn.patch"
"mullvad-exclude-containers.patch"
"vaultwarden.patch"
@ -223,7 +222,6 @@
# Build the entire system for uploading to attic
host-workstation = self.nixosConfigurations."AMD-Workstation".config.system.build.toplevel;
host-hypervisor = self.nixosConfigurations."Home-Hypervisor".config.system.build.toplevel;
ivpn-ui = pkgs.callPackage ./profiles/packages/ivpn-ui { };
};
};

View File

@ -1,122 +0,0 @@
diff --git a/pkgs/tools/networking/ivpn-ui/default.nix b/pkgs/tools/networking/ivpn-ui/default.nix
new file mode 100644
index 00000000000..7e787879e7c
--- /dev/null
+++ b/pkgs/tools/networking/ivpn-ui/default.nix
@@ -0,0 +1,103 @@
+{ lib
+, buildNpmPackage
+, fetchFromGitHub
+, nodejs_16
+, electron_24
+, jq
+, makeWrapper
+, makeDesktopItem
+, copyDesktopItems
+, ivpn
+, openssl
+, glib
+}:
+
+let
+ buildNpmPackage' = buildNpmPackage.override { nodejs = nodejs_16; };
+ electron = electron_24;
+
+ desktopItem = makeDesktopItem {
+ name = "IVPN";
+ desktopName = "IVPN";
+ comment = "UI interface for IVPN";
+ genericName = "VPN client";
+ exec = "ivpn-ui";
+ icon = "ivpn";
+ type = "Application";
+ startupNotify = true;
+ categories = [ "Network" ];
+ };
+in buildNpmPackage' rec {
+ pname = "ivpn-ui";
+ version = "3.10.23";
+
+ src = fetchFromGitHub {
+ owner = "ivpn";
+ repo = "desktop-app";
+ rev = "v${version}";
+ hash = "sha256-0XIATqidCQdERitYys7Gk0bENRZxdb/A9ieBNsWhbUM=";
+ };
+
+ env = {
+ ELECTRON_OVERRIDE_DIST_PATH = "${electron}/bin";
+ ELECTRON_CACHE = ".cache/electron";
+ ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
+ NODE_OPTIONS = "--openssl-legacy-provider";
+ };
+
+ npmBuildScript = "electron:build";
+ npmDepsHash = "sha256-DEXz/IsQG82f1PdlsabtaPKdj8XoweE121sZcqMZvPo=";
+
+ sourceRoot = "source/ui";
+
+ nativeBuildInputs = [
+ jq
+ makeWrapper
+ copyDesktopItems
+ ];
+
+ desktopItems = [ desktopItem ];
+
+ # electron-builder attempts to download Electron frow web,
+ # so we need to provide a zipped version of Electron.
+ # The version of Electron that we provide may differ from the one
+ # in the package-lock.json file, but it should not cause any problems.
+ preBuild = ''
+ mkdir -p .cache/electron
+ ln -sf ${electron.src} .cache/electron/electron-v$(jq -r '.devDependencies.electron' package.json)-linux-x64.zip
+
+ substituteInPlace src/daemon-client/index.js \
+ --replace "/usr/bin/gsettings" "${glib}/bin/gsettings" \
+ --replace "/usr/bin/ivpn exclude" "${ivpn}/bin/ivpn exclude"
+
+ substituteInPlace src/helpers/main_platform.js \
+ --replace "/usr/bin/openssl" "${openssl}/bin/openssl"
+ '';
+
+ installPhase = ''
+ runHook preInstall
+
+ mkdir -p $out/bin $out/opt/ivpn-ui $out/share/icons/hicolor/scalable/apps
+
+ pushd dist_electron/linux-unpacked
+ cp -r locales resources $out/opt/ivpn-ui
+ cp ivpn-ui $out/bin
+ popd
+
+ cp References/Linux/ui/ivpnicon.svg $out/share/icons/hicolor/scalable/apps/ivpn.svg
+
+ makeWrapper '${electron}/bin/electron' "$out/bin/ivpn-ui" \
+ --add-flags $out/opt/ivpn-ui/resources/app.asar \
+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
+
+ runHook postInstall
+ '';
+
+ meta = with lib; {
+ description = "Official IVPN Desktop app";
+ homepage = "https://www.ivpn.net/apps";
+ changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}";
+ license = licenses.gpl3Only;
+ maintainers = with maintainers; [ ataraxiasjel ];
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e42539e17f7..40f8c43bfa5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1593,6 +1593,8 @@ with pkgs;
inherit (callPackage ../tools/networking/ivpn/default.nix {}) ivpn ivpn-service;
+ ivpn-ui = callPackage ../tools/networking/ivpn-ui { };
+
jobber = callPackage ../tools/system/jobber { };
kanata = callPackage ../tools/system/kanata { };

View File

@ -27,7 +27,6 @@ with lib; {
cassowary-py = inputs.cassowary.packages.${system}.cassowary;
dhcpcd = prev.dhcpcd.override { enablePrivSep = false; };
hoyolab-daily-bot = inputs.hoyolab-daily-bot.packages.${system}.default;
ivpn-ui = prev.callPackage ./packages/ivpn-ui { };
nix-alien = inputs.nix-alien.packages.${system}.nix-alien;
nix-index-update = inputs.nix-alien.packages.${system}.nix-index-update;
prismlauncher = inputs.prismlauncher.packages.${system}.default;
@ -79,7 +78,7 @@ with lib; {
nixpkgs.config = {
allowUnfree = true;
android_sdk.accept_license = true;
# ivpn-ui and vscode-server requires nodejs_16
# vscode-server requires nodejs_16
permittedInsecurePackages = [
"nodejs-16.20.0"
];

View File

@ -1,103 +0,0 @@
{ lib
, buildNpmPackage
, fetchFromGitHub
, nodejs_18
, electron_25
, jq
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, ivpn
, openssl
, glib
}:
let
buildNpmPackage' = buildNpmPackage.override { nodejs = nodejs_18; };
electron = electron_25;
desktopItem = makeDesktopItem {
name = "IVPN";
desktopName = "IVPN";
comment = "UI interface for IVPN";
genericName = "VPN client";
exec = "ivpn-ui";
icon = "ivpn";
type = "Application";
startupNotify = true;
categories = [ "Network" ];
};
in buildNpmPackage' rec {
pname = "ivpn-ui";
version = "3.10.23";
src = fetchFromGitHub {
owner = "ivpn";
repo = "desktop-app";
rev = "v${version}";
hash = "sha256-0XIATqidCQdERitYys7Gk0bENRZxdb/A9ieBNsWhbUM=";
};
env = {
ELECTRON_OVERRIDE_DIST_PATH = "${electron}/bin";
ELECTRON_CACHE = ".cache/electron";
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
NODE_OPTIONS = "--openssl-legacy-provider";
};
npmBuildScript = "electron:build";
npmDepsHash = "sha256-DEXz/IsQG82f1PdlsabtaPKdj8XoweE121sZcqMZvPo=";
sourceRoot = "source/ui";
nativeBuildInputs = [
jq
makeWrapper
copyDesktopItems
];
desktopItems = [ desktopItem ];
# electron-builder attempts to download Electron frow web,
# so we need to provide a zipped version of Electron.
# The version of Electron that we provide may differ from the one
# in the package-lock.json file, but it should not cause any problems.
preBuild = ''
mkdir -p .cache/electron
ln -sf ${electron.src} .cache/electron/electron-v$(jq -r '.devDependencies.electron' package.json)-linux-x64.zip
substituteInPlace src/daemon-client/index.js \
--replace "/usr/bin/gsettings" "${glib}/bin/gsettings" \
--replace "/usr/bin/ivpn exclude" "${ivpn}/bin/ivpn exclude"
substituteInPlace src/helpers/main_platform.js \
--replace "/usr/bin/openssl" "${openssl}/bin/openssl"
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/opt/ivpn-ui $out/share/icons/hicolor/scalable/apps
pushd dist_electron/linux-unpacked
cp -r locales resources $out/opt/ivpn-ui
cp ivpn-ui $out/bin
popd
cp References/Linux/ui/ivpnicon.svg $out/share/icons/hicolor/scalable/apps/ivpn.svg
makeWrapper '${electron}/bin/electron' "$out/bin/ivpn-ui" \
--add-flags $out/opt/ivpn-ui/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
runHook postInstall
'';
meta = with lib; {
description = "Official IVPN Desktop app";
homepage = "https://www.ivpn.net/apps";
changelog = "https://github.com/ivpn/desktop-app/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ ataraxiasjel ];
};
}

View File

@ -7,8 +7,6 @@ in {
config = lib.mkMerge [
(lib.mkIf isIVPN {
# services.ivpn.enable = true;
# home-manager.users.${config.mainuser}.home.packages = [ pkgs.ivpn-ui ];
# startupApplications = [ "${pkgs.ivpn-ui}/bin/ivpn-ui" ];
persist.state.directories = [ "/etc/opt/ivpn" ];
persist.state.homeDirectories = [ ".config/IVPN" ];
})