From 89ff2f3f67caf2481763d560c3c2f2637881b3c3 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 3 Jan 2025 16:51:50 -0800 Subject: [PATCH] initial commit --- .gitignore | 1 + LICENSE | 19 +++++++++ README.md | 13 ++++++ betterbird-unwrapped.nix | 90 ++++++++++++++++++++++++++++++++++++++++ betterbird.nix | 8 ++++ flake.lock | 27 ++++++++++++ flake.nix | 32 ++++++++++++++ 7 files changed, 190 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 betterbird-unwrapped.nix create mode 100644 betterbird.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b389212 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025 Youwen Wu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..208d260 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Betterbird + +Provides binary releases of [betterbird](http://betterbird.eu/). + +```nix +{ + inputs = { + betterbird.url = "git+https://code.youwen.dev/youwen5/betterbird-flake"; + # recommended + betterbird.inputs.nixpkgs.follows = "nixpkgs"; + }; +} +``` diff --git a/betterbird-unwrapped.nix b/betterbird-unwrapped.nix new file mode 100644 index 0000000..41349ff --- /dev/null +++ b/betterbird-unwrapped.nix @@ -0,0 +1,90 @@ +{ + stdenv, + config, + wrapGAppsHook3, + autoPatchelfHook, + patchelfUnstable, + adwaita-icon-theme, + dbus-glib, + libXtst, + curl, + gtk3, + alsa-lib, + libva, + pciutils, + pipewire, + writeText, + fetchurl, + version, + url, + hash, + ... +}: +let + policies = { + DisableAppUpdate = true; + }; + +in +# policiesJson = writeText "firefox-policies.json" (builtins.toJSON { inherit policies; }); +stdenv.mkDerivation (finalAttrs: { + inherit version; + pname = "betterbird-unwrapped"; + + src = fetchurl { + inherit url hash; + }; + + nativeBuildInputs = [ + wrapGAppsHook3 + autoPatchelfHook + patchelfUnstable + ]; + + buildInputs = [ + gtk3 + alsa-lib + adwaita-icon-theme + dbus-glib + libXtst + ]; + + runtimeDependencies = [ + curl + libva.out + pciutils + ]; + + appendRunpaths = [ + "${pipewire}/lib" + ]; + + installPhase = '' + mkdir -p "$prefix/lib/betterbird-${version}" + cp -r * "$prefix/lib/betterbird-${version}" + + mkdir -p $out/bin + ln -s "$prefix/lib/betterbird-${version}/betterbird" $out/bin/betterbird + + ''; + # mkdir -p "$out/lib/betterbird-${version}/distribution" + # ln -s ${policiesJson} "$out/lib/betterbird-${version}/distribution/policies.json" + + patchelfFlags = [ "--no-clobber-old-sections" ]; + + meta = { + mainProgram = "betterbird"; + description = '' + Betterbird is a fine-tuned version of Mozilla Thunderbird, Thunderbird on steroids, if you will. + ''; + }; + + passthru = { + inherit gtk3; + + libName = "betterbird-${version}"; + binaryName = finalAttrs.meta.mainProgram; + gssSupport = true; + ffmpegSupport = true; + }; +}) diff --git a/betterbird.nix b/betterbird.nix new file mode 100644 index 0000000..010c177 --- /dev/null +++ b/betterbird.nix @@ -0,0 +1,8 @@ +{ + wrapFirefox, + betterbird-unwrapped, + ... +}: +wrapFirefox betterbird-unwrapped { + pname = "betterbird"; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6f88465 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1735834308, + "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8e92e7c --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + description = "Betterbird binaries provided for NixOS"; + + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = + { nixpkgs, ... }: + let + forAllSystems = nixpkgs.lib.genAttrs [ + "x86_64-linux" + ]; + in + { + packages = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + inherit (pkgs) callPackage; + in + rec { + default = betterbird; + betterbird-unwrapped = callPackage ./betterbird-unwrapped.nix { + url = "https://www.betterbird.eu/downloads/LinuxArchive/betterbird-128.5.2esr-bb19.en-US.linux-x86_64.tar.bz2"; + hash = "sha256-eW6pA1GFvsxFh6uckFUmOhtTn9HqhpGuW4iXTk/k+E8="; + version = "128.5.2esr-bb19"; + }; + betterbird = callPackage ./betterbird.nix { inherit betterbird-unwrapped; }; + } + ); + + }; +}