This commit is contained in:
zack 2024-11-06 13:40:30 -05:00
parent e2ee24b57a
commit e04e38d68b
No known key found for this signature in database
GPG key ID: 5F873416BCF59F35
7 changed files with 177 additions and 53 deletions

23
flake.lock generated
View file

@ -51,16 +51,17 @@
"systems": "systems_3" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1730406489, "lastModified": 1730405189,
"narHash": "sha256-5OolxaZm+dWYHTok8GrsKA+p67zDVFItzVVKXHnMssw=", "narHash": "sha256-Q9TZKW4z5lmDFBK+eTrTIbKy6Ksx7OaBSPWH0+4fkfY=",
"owner": "Kirottu", "owner": "anyrun-org",
"repo": "anyrun", "repo": "anyrun",
"rev": "fab3e12be42bd9d18d330907655dac1a0b6a84f3", "rev": "a808e6d801d9e216a0c077a003fba22cfc3a1990",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "Kirottu", "owner": "anyrun-org",
"repo": "anyrun", "repo": "anyrun",
"rev": "a808e6d801d9e216a0c077a003fba22cfc3a1990",
"type": "github" "type": "github"
} }
}, },
@ -172,11 +173,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1730394842, "lastModified": 1730424076,
"narHash": "sha256-g2OJ2m0lhavtek1wGkn0Bj3VCnvzE3GmtLEY3SJaYoM=", "narHash": "sha256-C7fGtktmYk3ZQn/sFSPvRWod2DRZuZzzEmVhkaf0Qoc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "cedccfff0d6e1fb9c62f77fb4e05169256219eca", "rev": "a0196e4a9da85a7f06d9f79110e70d97e57cfbed",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1413,11 +1414,11 @@
"nixpkgs": "nixpkgs_10" "nixpkgs": "nixpkgs_10"
}, },
"locked": { "locked": {
"lastModified": 1730410240, "lastModified": 1730425081,
"narHash": "sha256-PL7RGHRo0fyukX4TRKmtYb5fDA6hCL0Wg8jnSbDL0Zk=", "narHash": "sha256-c8JK1Zuc9QjfLfbnAEtB3uHz5pd+RMgMiR263TEtwAs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs-wayland", "repo": "nixpkgs-wayland",
"rev": "b96564c7722abb8cfff2fae01cef9d6819fca259", "rev": "968d7a95604a2ec252ce9912199dfa9ec6410ff0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -24,7 +24,7 @@
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
resume.url = "git+https://git.zoeys.computer/zoey/resume"; resume.url = "git+https://git.zoeys.computer/zoey/resume";
anyrun.url = "github:Kirottu/anyrun"; anyrun.url = "github:anyrun-org/anyrun/a808e6d801d9e216a0c077a003fba22cfc3a1990";
anyrun.inputs.nixpkgs.follows = "nixpkgs"; anyrun.inputs.nixpkgs.follows = "nixpkgs";
ags.url = "github:Aylur/ags"; ags.url = "github:Aylur/ags";
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";

View file

@ -86,6 +86,8 @@
pkgs.thunderbird pkgs.thunderbird
pkgs.custom.enc
pkgs.mongodb-compass pkgs.mongodb-compass
pkgs.postman pkgs.postman
pkgs.mosh pkgs.mosh

View file

@ -12,14 +12,14 @@ in {
enable = mkBoolOpt false "Enable Kitty Term"; enable = mkBoolOpt false "Enable Kitty Term";
fonts = { fonts = {
normal = mkStringOpt "JetBrainsMonoNL Nerd Font Mono Bold" "Normal Font"; # normal = mkStringOpt "ZedMono Nerd Font Mono Bold" "Normal Font";
bold = mkStringOpt "JetBrainsMonoNL Nerd Font Mono ExtraBold" "Bold Font"; # bold = mkStringOpt "ZedMono Nerd Font Mono ExtraBold" "Bold Font";
italic = mkStringOpt "JetBrainsMonoNL Nerd Font Mono Bold Italic" "Italic Font"; # italic = mkStringOpt "ZedMono Nerd Font Mono Bold Italic" "Italic Font";
bold_italic = mkStringOpt "JetBrainsMonoNL Nerd Font Mono ExtraBold Italic" "Bold Italic Font"; # bold_italic = mkStringOpt "ZedMono Nerd Font Mono ExtraBold Italic" "Bold Italic Font";
# normal = mkStringOpt "Iosevka Bold" "Normal Font"; normal = mkStringOpt "Iosevka Bold" "Normal Font";
# bold = mkStringOpt "Iosevka ExtraBold" "Bold Font"; bold = mkStringOpt "Iosevka ExtraBold" "Bold Font";
# italic = mkStringOpt "Iosevka Bold Italic" "Italic Font"; italic = mkStringOpt "Iosevka Bold Italic" "Italic Font";
# bold_italic = mkStringOpt "Iosevka ExtraBold Italic" "Bold Italic Font"; bold_italic = mkStringOpt "Iosevka ExtraBold Italic" "Bold Italic Font";
}; };
}; };

View file

@ -40,7 +40,7 @@ in {
exportGlyphNames = true exportGlyphNames = true
[buildPlans.IosevkaCustom.variants] [buildPlans.IosevkaCustom.variants]
inherits = "ss01" inherits = "ss14"
''; '';
}) })
noto-fonts noto-fonts

58
packages/enc/default.nix Normal file
View file

@ -0,0 +1,58 @@
{
writeShellScriptBin,
gnupg,
neovim,
coreutils,
wl-clipboard,
xclip,
}:
writeShellScriptBin "enc" ''
#!${coreutils}/bin/env zsh
# Check if recipients were provided
if [[ $# -eq 0 ]]; then
echo "Usage: $0 recipient1@example.com [recipient2@example.com ...]"
exit 1
fi
# Create a temporary file
temp_file=$(${coreutils}/bin/mktemp)
trap "${coreutils}/bin/rm -f $temp_file" EXIT
# Create recipient arguments for gpg
recipients=()
for recipient in "$@"; do
recipients+=("-r" "$recipient")
done
# Open neovim with the temp file
${neovim}/bin/nvim \
-c "set noswapfile" \
-c "set filetype=" \
"$temp_file"
# Check if the temp file has content after nvim closes
if [[ -s "$temp_file" ]]; then
# Encrypt the content with gpg and copy to clipboard
if [[ -n "$WAYLAND_DISPLAY" ]]; then
${gnupg}/bin/gpg --encrypt \
--armor \
--trust-model always \
"''${recipients[@]}" \
"$temp_file" | ${wl-clipboard}/bin/wl-copy
echo "Encrypted content copied to Wayland clipboard"
elif [[ -n "$DISPLAY" ]]; then
${gnupg}/bin/gpg --encrypt \
--armor \
--trust-model always \
"''${recipients[@]}" \
"$temp_file" | ${xclip}/bin/xclip -selection clipboard
echo "Encrypted content copied to X11 clipboard"
else
echo "No display detected, cannot copy to clipboard"
exit 1
fi
else
echo "No content was saved, exiting."
fi
''

View file

@ -1,3 +1,20 @@
# pname = "zen-browser-unwrapped";
# version = "715b6df2fb8171336adc8712668a5e8458f7749b";
#
# src = fetchFromGitHub {
# owner = "zen-browser";
# repo = "desktop";
# rev = "${version}";
# leaveDotGit = true;
# fetchSubmodules = true;
# hash = "sha256-0+x2XoZyMdzP1beJvUSeM/QnFyQ+FSuGIatHh1mtBaw=";
# };
#
# firefoxVersion = (lib.importJSON "${src}/surfer.json").version.version;
# firefoxSrc = fetchurl {
# url = "mirror://mozilla/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.xz";
# hash = "sha256-XAMbVywdpyZnfi/5e2rVp+OyM4em/DljORy1YvgKXkg=";
# };
{ {
buildNpmPackage, buildNpmPackage,
buildPackages, buildPackages,
@ -100,13 +117,13 @@
}: let }: let
surfer = buildNpmPackage { surfer = buildNpmPackage {
pname = "surfer"; pname = "surfer";
version = "1.4.21"; version = "1.5.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "zen-browser"; owner = "zen-browser";
repo = "surfer"; repo = "surfer";
rev = "7f6da82ec44d210875b9a9c40b2169df0c88ff44"; rev = "50af7094ede6e9f0910f010c531f8447876a6464";
hash = "sha256-QfckIXxg5gUNvoofM39ZEiKkYV62ZJduHKVd171HQBw="; hash = "sha256-wmAWg6hoICNHfoXJifYFHmyFQS6H22u3GSuRW4alexw=";
}; };
patches = [./surfer-dont-check-update.patch]; patches = [./surfer-dont-check-update.patch];
@ -135,9 +152,11 @@
llvmPackages.stdenv.cc.override {bintools = buildPackages.rustc.llvmPackages.bintools;} llvmPackages.stdenv.cc.override {bintools = buildPackages.rustc.llvmPackages.bintools;}
); );
inherit (pkgsCross) wasi32;
wasiSysRoot = runCommand "wasi-sysroot" {} '' wasiSysRoot = runCommand "wasi-sysroot" {} ''
mkdir -p "$out"/lib/wasm32-wasi mkdir -p "$out"/lib/wasm32-wasi
for lib in ${pkgsCross.wasi32.llvmPackages.libcxx}/lib/*; do for lib in ${wasi32.llvmPackages.libcxx}/lib/*; do
ln -s "$lib" "$out"/lib/wasm32-wasi ln -s "$lib" "$out"/lib/wasm32-wasi
done done
''; '';
@ -145,27 +164,32 @@
firefox-l10n = fetchFromGitHub { firefox-l10n = fetchFromGitHub {
owner = "mozilla-l10n"; owner = "mozilla-l10n";
repo = "firefox-l10n"; repo = "firefox-l10n";
rev = "cb528e0849a41c961f7c1ecb9e9604fc3167e03e"; rev = "9d639cd79d6b73081fadb3474dd7d73b89732e7b";
hash = "sha256-KQtSLDDPo6ffQwNs937cwccMasUJ/bnBFjY4LxrNGFg="; hash = "sha256-+2JCaPp+c2BRM60xFCeY0pixIyo2a3rpTPaSt1kTfDw=";
}; };
in in
buildStdenv.mkDerivation rec { buildStdenv.mkDerivation (finalAttrs: {
pname = "zen-browser-unwrapped"; pname = "zen-browser-unwrapped";
version = "1.0.1-a.13"; version = "1.0.1-t.17";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "zen-browser"; owner = "zen-browser";
repo = "desktop"; repo = "desktop";
rev = "${version}"; rev = "715b6df2fb8171336adc8712668a5e8458f7749b";
leaveDotGit = true; hash = "sha256-0+x2XoZyMdzP1beJvUSeM/QnFyQ+FSuGIatHh1mtBaw=";
fetchSubmodules = true; fetchSubmodules = true;
hash = "sha256-z1YIdulvzkbSa266RZwBbYbeHqY22RvdHAdboR9uqig=";
}; };
firefoxVersion = (lib.importJSON "${src}/surfer.json").version.version; # DO NOT UPDATE THE FIREFOX VERSION MANUALLY!
#
# Both `firefoxVersion` and `firefoxSrc` are managed by the `update.sh` script.
# The Firefox version is specified by `zen-browser` in the `surfer.json` file.
#
# We need to manually set the version here to avoid IFD.
firefoxVersion = "132.0.1";
firefoxSrc = fetchurl { firefoxSrc = fetchurl {
url = "mirror://mozilla/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.xz"; url = "mirror://mozilla/firefox/releases/${finalAttrs.firefoxVersion}/source/firefox-${finalAttrs.firefoxVersion}.source.tar.xz";
hash = "sha256-en3z+Xc3RT76okPKnbr5XQ8PgzxdyK+stXBO4W7wYNA="; hash = "sha256-XAMbVywdpyZnfi/5e2rVp+OyM4em/DljORy1YvgKXkg=";
}; };
SURFER_COMPAT = generic; SURFER_COMPAT = generic;
@ -189,7 +213,7 @@ in
surfer surfer
unzip unzip
wrapGAppsHook3 wrapGAppsHook3
lib.custom.pkgs-unstable.xorg.xvfb xorg.xvfb
] ]
++ lib.optionals crashreporterSupport [ ++ lib.optionals crashreporterSupport [
dump_syms dump_syms
@ -260,12 +284,6 @@ in
libxkbcommon libxkbcommon
]; ];
configureScript = writeShellScript "configureMozconfig" ''
for flag in $@; do
echo "ac_add_options $flag" >> mozconfig
done
'';
configureFlags = configureFlags =
[ [
"--disable-bootstrap" "--disable-bootstrap"
@ -304,17 +322,49 @@ in
(lib.enableFeature enableDebugSymbols "debug-symbols") (lib.enableFeature enableDebugSymbols "debug-symbols")
]; ];
configureScript = writeShellScript "configureMozconfig" ''
for flag in $@; do
echo "ac_add_options $flag" >> mozconfig
done
'';
# To the person reading this wondering what is going on here, this is what
# happens when a build process relies on Git. Normally you would use `fetchgit`
# with `leaveDotGit = true`, however that leads to reproducibility issues, so
# instead we create our own Git repo with a single commit.
#
# `surfer` (the build tool made for zen-browser) uses git to read the latest
# HEAD commit, `git apply`, and likely a few other operations.
preConfigure = '' preConfigure = ''
export LLVM_PROFDATA=llvm-profdata
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
export WASM_CC=${pkgsCross.wasi32.stdenv.cc}/bin/${pkgsCross.wasi32.stdenv.cc.targetPrefix}cc
export WASM_CXX=${pkgsCross.wasi32.stdenv.cc}/bin/${pkgsCross.wasi32.stdenv.cc.targetPrefix}c++
export ZEN_RELEASE=1
surfer ci --brand alpha --display-version ${version}
export HOME="$TMPDIR" export HOME="$TMPDIR"
git config --global user.email "nixbld@localhost" git config --global user.email "nixbld@localhost"
git config --global user.name "nixbld" git config --global user.name "nixbld"
install -D ${firefoxSrc} .surfer/engine/firefox-${firefoxVersion}.source.tar.xz
# Initialize git repo and handle submodules properly
git init
git config --global init.defaultBranch main
# Force add all files including submodules
git add -A -f
# Initialize and update submodules if they exist
if [ -f .gitmodules ]; then
git submodule init
git submodule update --init --recursive
fi
# Commit all changes including submodule state
git commit -m 'nixpkgs' -a --allow-empty
export LLVM_PROFDATA=llvm-profdata
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
export WASM_CC=${wasi32.stdenv.cc}/bin/${wasi32.stdenv.cc.targetPrefix}cc
export WASM_CXX=${wasi32.stdenv.cc}/bin/${wasi32.stdenv.cc.targetPrefix}c++
export ZEN_RELEASE=1
surfer ci --brand alpha --display-version ${finalAttrs.version}
install -D ${finalAttrs.firefoxSrc} .surfer/engine/firefox-${finalAttrs.firefoxVersion}.source.tar.xz
surfer download surfer download
surfer import surfer import
patchShebangs engine/mach engine/build engine/tools patchShebangs engine/mach engine/build engine/tools
@ -322,20 +372,26 @@ in
preBuild = '' preBuild = ''
cp -r ${firefox-l10n} l10n/firefox-l10n cp -r ${firefox-l10n} l10n/firefox-l10n
for lang in $(cat ./l10n/supported-languages); do for lang in $(cat ./l10n/supported-languages); do
rsync -av --progress l10n/firefox-l10n/"$lang"/ l10n/"$lang" --exclude .git rsync -av --progress l10n/firefox-l10n/"$lang"/ l10n/"$lang" --exclude .git
done done
sh scripts/copy-language-pack.sh en-US sh scripts/copy-language-pack.sh en-US
for lang in $(cat ./l10n/supported-languages); do for lang in $(cat ./l10n/supported-languages); do
sh scripts/copy-language-pack.sh "$lang" sh scripts/copy-language-pack.sh "$lang"
done done
Xvfb :2 -screen 0 1024x768x24 & Xvfb :2 -screen 0 1024x768x24 &
export DISPLAY=:2 export DISPLAY=:2
''; '';
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
surfer build surfer build
runHook postBuild runHook postBuild
''; '';
@ -348,15 +404,22 @@ in
description = "Firefox based browser with a focus on privacy and customization"; description = "Firefox based browser with a focus on privacy and customization";
homepage = "https://www.zen-browser.app/"; homepage = "https://www.zen-browser.app/";
license = lib.licenses.mpl20; license = lib.licenses.mpl20;
maintainers = with lib.maintainers; [matthewpi]; maintainers = with lib.maintainers; [
platforms = lib.platforms.unix; matthewpi
titaniumtown
];
platforms = ["x86_64-linux"];
}; };
enableParallelBuilding = true; enableParallelBuilding = true;
requiredSystemFeatures = ["big-parallel"]; requiredSystemFeatures = ["big-parallel"];
passthru = { passthru = {
binaryName = meta.mainProgram; updateScript = ./update.sh;
# These values are used by `wrapFirefox`.
# ref; `pkgs/applications/networking/browsers/firefox/wrapper.nix'
binaryName = finalAttrs.meta.mainProgram;
inherit alsaSupport; inherit alsaSupport;
inherit jackSupport; inherit jackSupport;
inherit pipewireSupport; inherit pipewireSupport;
@ -367,4 +430,4 @@ in
inherit gtk3; inherit gtk3;
inherit wasiSysRoot; inherit wasiSysRoot;
}; };
} })