nixpkgs/pkgs/applications/networking/geph/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

168 lines
4 KiB
Nix
Raw Permalink Normal View History

2023-03-09 06:07:44 +01:00
{ lib
, stdenvNoCC
, rustPlatform
, fetchFromGitHub
2023-11-02 10:52:33 +01:00
, buildGoModule
, makeWrapper
, nodePackages
, cacert
2023-11-02 10:52:33 +01:00
, esbuild
, jq
, moreutils
2023-03-09 06:07:44 +01:00
, perl
, pkg-config
, glib
, webkitgtk
, libayatana-appindicator
, cairo
, openssl
}:
let
2024-03-11 14:15:18 +01:00
version = "4.11.0";
2023-03-09 06:07:44 +01:00
geph-meta = with lib; {
description = "A modular Internet censorship circumvention system designed specifically to deal with national filtering.";
homepage = "https://geph.io";
platforms = platforms.linux;
maintainers = with maintainers; [ penalty1083 ];
};
in
{
cli = rustPlatform.buildRustPackage rec {
pname = "geph4-client";
inherit version;
src = fetchFromGitHub {
owner = "geph-official";
repo = pname;
rev = "v${version}";
2024-03-11 14:15:18 +01:00
hash = "sha256-6zii8WxJp++yqTkxejNDta7IW+SG0uPgmnWqX5Oa9PU=";
2023-03-09 06:07:44 +01:00
};
2024-03-11 14:15:18 +01:00
cargoHash = "sha256-WI525ufJxuepRZHyx8tO4K+7WZuM/NlTVNqVMJH6avg=";
2023-03-09 06:07:44 +01:00
nativeBuildInputs = [ perl ];
meta = geph-meta // {
license = with lib.licenses; [ gpl3Only ];
};
};
gui = stdenvNoCC.mkDerivation rec {
pname = "geph-gui";
inherit version;
src = fetchFromGitHub {
owner = "geph-official";
repo = "gephgui-pkg";
2024-03-11 14:15:18 +01:00
rev = "3a6d2fa85603e9ac3d5d6286685d8a8ca792a508";
hash = "sha256-SE1TwYvR3+zwdPxlanq4hovmJsOdCJQzWfSJ6sSyJ5k=";
2023-03-09 06:07:44 +01:00
fetchSubmodules = true;
};
2023-11-02 10:52:33 +01:00
pnpm-deps = stdenvNoCC.mkDerivation {
pname = "${pname}-pnpm-deps";
inherit src version;
2023-03-09 06:07:44 +01:00
sourceRoot = "${src.name}/gephgui-wry/gephgui";
2023-03-09 06:07:44 +01:00
2023-11-02 10:52:33 +01:00
nativeBuildInputs = [
jq
moreutils
nodePackages.pnpm
cacert
2023-11-02 10:52:33 +01:00
];
2023-03-09 06:07:44 +01:00
installPhase = ''
2023-11-02 10:52:33 +01:00
export HOME=$(mktemp -d)
pnpm config set store-dir $out
pnpm install --ignore-scripts
# Remove timestamp and sort the json files
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
2023-03-09 06:07:44 +01:00
'';
2023-11-02 10:52:33 +01:00
dontFixup = true;
outputHashMode = "recursive";
outputHash = "sha256-OKPx5xRI7DWd6m31nYx1biP0k6pcZ7fq7dfVlHda4O0=";
2023-03-09 06:07:44 +01:00
};
2023-11-02 10:52:33 +01:00
gephgui-wry = rustPlatform.buildRustPackage {
2023-03-09 06:07:44 +01:00
pname = "gephgui-wry";
inherit version src;
sourceRoot = "${src.name}/gephgui-wry";
2023-03-09 06:07:44 +01:00
2023-11-02 10:52:33 +01:00
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"tao-0.5.2" = "sha256-HyQyPRoAHUcgtYgaAW7uqrwEMQ45V+xVSxmlAZJfhv0=";
"wry-0.12.2" = "sha256-kTMXvignEF3FlzL0iSlF6zn1YTOCpyRUDN8EHpUS+yI=";
};
};
2023-03-09 06:07:44 +01:00
2023-11-02 10:52:33 +01:00
nativeBuildInputs = [
pkg-config
nodePackages.pnpm
makeWrapper
];
2023-03-09 06:07:44 +01:00
buildInputs = [
glib
webkitgtk
libayatana-appindicator
cairo
openssl
];
2023-11-02 10:52:33 +01:00
ESBUILD_BINARY_PATH = "${lib.getExe (esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.15.10";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-DebmLtgPrla+1UcvOHMnWmxa/ZqrugeRRKXIiJ9LYDk=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
})}";
2023-03-09 06:07:44 +01:00
preBuild = ''
2023-11-02 10:52:33 +01:00
cd gephgui
export HOME=$(mktemp -d)
pnpm config set store-dir ${pnpm-deps}
pnpm install --ignore-scripts --offline
chmod -R +w node_modules
pnpm rebuild
pnpm build
cd ..
2023-03-09 06:07:44 +01:00
'';
};
dontBuild = true;
installPhase = ''
install -Dt $out/bin ${gephgui-wry}/bin/gephgui-wry
install -d $out/share/icons/hicolor
for i in '16' '32' '64' '128' '256'
do
name=''${i}x''${i}
dir=$out/share/icons/hicolor
mkdir -p $dir
mv flatpak/icons/$name $dir
done
install -Dt $out/share/applications flatpak/icons/io.geph.GephGui.desktop
sed -i -e '/StartupWMClass/s/=.*/=gephgui-wry/' $out/share/applications/io.geph.GephGui.desktop
'';
meta = geph-meta // {
license = with lib.licenses; [ unfree ];
};
};
}