From dc11d965957fd488d7cd974b259ddfdda9b61dd6 Mon Sep 17 00:00:00 2001 From: azikx Date: Tue, 22 Oct 2024 18:37:36 +0900 Subject: [PATCH] =?UTF-8?q?update=20=EF=8C=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.lock | 64 ++---- flake.nix | 5 +- home/programs/cli/helix/binds.nix | 5 +- home/programs/cli/yazi/binds.nix | 20 ++ home/programs/custom-pkgs/ayugram/default.nix | 212 ++++++++++++++++++ home/programs/custom-pkgs/default.nix | 12 +- home/programs/gui/pkgs.nix | 2 +- home/programs/misc/nwg.nix | 18 +- 8 files changed, 273 insertions(+), 65 deletions(-) create mode 100644 home/programs/custom-pkgs/ayugram/default.nix diff --git a/flake.lock b/flake.lock index b0d3dbe..810b4c4 100644 --- a/flake.lock +++ b/flake.lock @@ -35,19 +35,18 @@ }, "ayugram-desktop": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1728599021, - "narHash": "sha256-smnxp3ceDH/DFIy0ANm8E1WC78UoC0LKTtl90EynJjc=", - "owner": "kaeeraa", + "lastModified": 1729536995, + "narHash": "sha256-hGEP6lUG91rBLPlgXxBxW6GlHldR8inZddRXt2mHzm0=", + "owner": "ayugram-port", "repo": "ayugram-desktop", - "rev": "f126f1529ffd818905232ad6054d21999c2a2cdd", + "rev": "fcc6ed09b3caf2a20f6379abf1fdb8088a818b07", "type": "github" }, "original": { - "owner": "kaeeraa", + "owner": "ayugram-port", "ref": "release", "repo": "ayugram-desktop", "type": "github" @@ -121,7 +120,7 @@ }, "firefox-addons": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": [ "nixpkgs" ] @@ -191,24 +190,6 @@ } }, "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { "locked": { "lastModified": 1629284811, "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", @@ -223,7 +204,7 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_2": { "inputs": { "systems": [ "stylix", @@ -244,9 +225,9 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_3": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1710146030, @@ -418,7 +399,7 @@ "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": "nixpkgs_2", "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems_2", + "systems": "systems", "xdph": "xdph" }, "locked": { @@ -774,11 +755,11 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", "nixpkgs": "nixpkgs_4", - "systems": "systems_3", + "systems": "systems_2", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-tmux": "tinted-tmux" @@ -798,21 +779,6 @@ } }, "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_2": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -827,7 +793,7 @@ "type": "github" } }, - "systems_3": { + "systems_2": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -842,7 +808,7 @@ "type": "github" } }, - "systems_4": { + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -966,7 +932,7 @@ }, "yazi": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_3", "nixpkgs": "nixpkgs_5", "rust-overlay": "rust-overlay" }, diff --git a/flake.nix b/flake.nix index 38b2ab4..c815220 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,8 @@ nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; # ONE LINE SOFTWARE - ayugram-desktop.url = "github:kaeeraa/ayugram-desktop/release?submodules=1"; + ayugram-desktop.url = + "github:ayugram-port/ayugram-desktop/release?submodules=1"; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; zen-browser.url = "github:0xc000022070/zen-browser-flake"; stylix.url = "github:danth/stylix"; @@ -37,8 +38,6 @@ url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; }; - - # HYPRlAND hyprfocus = { url = "github:pyt0xic/hyprfocus"; inputs.hyprland.follows = "hyprland"; diff --git a/home/programs/cli/helix/binds.nix b/home/programs/cli/helix/binds.nix index 4e2587c..d57f54c 100644 --- a/home/programs/cli/helix/binds.nix +++ b/home/programs/cli/helix/binds.nix @@ -5,11 +5,10 @@ Y = "yank_to_clipboard"; D = "delete_selection_noyank"; space = { - space = "file_picker"; - c = "toggle_comments"; + space = "file_picker_in_current_directory"; f = "file_picker_in_current_directory"; F = "file_picker"; - b = { + "b: Buffers" = { b = "buffer_picker"; n = ":buffer-next"; p = ":buffer-previous"; diff --git a/home/programs/cli/yazi/binds.nix b/home/programs/cli/yazi/binds.nix index e5e48e0..d9dd58e 100644 --- a/home/programs/cli/yazi/binds.nix +++ b/home/programs/cli/yazi/binds.nix @@ -60,6 +60,11 @@ run = "select_all --state=true"; desc = "Select all"; } + { + on = [ "%" ]; + run = "select_all --state=true"; + desc = "Select all"; + } { on = [ "v" "r" ]; run = "select_all --state=none"; @@ -143,6 +148,21 @@ run = "cd --interactive"; desc = "Change directory"; } + { + on = [ "g" "e" ]; + run = "arrow 99999999"; + desc = "Move cursor to the bottom"; + } + { + on = [ "g" "n" ]; + run = "tab_switch 1 --relative"; + desc = "Switch to the next tab"; + } + { + on = [ "g" "p" ]; + run = "tab_switch 1 --relative"; + desc = "Switch to the previous tab"; + } { on = [ "g" "f" ]; run = "cd ~/.flake"; diff --git a/home/programs/custom-pkgs/ayugram/default.nix b/home/programs/custom-pkgs/ayugram/default.nix new file mode 100644 index 0000000..25e46b1 --- /dev/null +++ b/home/programs/custom-pkgs/ayugram/default.nix @@ -0,0 +1,212 @@ +{ pkgs, lib, stdenv, fetchFromGitHub, callPackage, pkg-config, cmake, ninja +, python3, wrapQtAppsHook, qtbase, qtwayland, qtsvg, qtimageformats, gtk3, boost +, fmt, libdbusmenu, lz4, xxHash, ffmpeg, openalSoft, minizip, libopus, alsa-lib +, libpulseaudio, pipewire, range-v3, tl-expected, hunspell, webkitgtk_6_0 +, jemalloc, rnnoise, protobuf, abseil-cpp, microsoft-gsl, rlottie, darwin +, libicns, nix-update-script, libXtst, libclang, clang, ada, glib-networking +, libXi, libXfixes, libXrandr, libXrender, libXext, libXcomposite, libXdamage +, glib, pcre, pcre-cpp, openssl, libjpeg, gobject-introspection, }: + +let + tg_owt = callPackage ./lib/tg_owt.nix { + inherit stdenv; # oh no, stdenv + inherit pkgs; + abseil-cpp = abseil-cpp.override { cxxStandard = "20"; }; + }; +in stdenv.mkDerivation (finalAttrs: { + pname = "ayugram-desktop"; + version = "5.6.3"; + + src = fetchFromGitHub { + owner = "AyuGram"; + repo = "AyuGramDesktop"; + rev = "5.6.3"; + + fetchSubmodules = true; + hash = "sha256-7KmXA3EDlCszoUfQZg3UsKvfRCENy/KLxiE08J9COJ8="; + }; + + patches = [ ./patch/desktop.patch ] ++ lib.optionals stdenv.isDarwin [ + ./patch/macos.patch + ./patch/macos-opengl.patch + ]; + + postPatch = lib.optionalString stdenv.isLinux '' + for file in \ + Telegram/ThirdParty/libtgvoip/os/linux/AudioInputALSA.cpp \ + Telegram/ThirdParty/libtgvoip/os/linux/AudioOutputALSA.cpp \ + Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp \ + Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp + do + substituteInPlace "$file" \ + --replace '"libasound.so.2"' '"${alsa-lib}/lib/libasound.so.2"' \ + --replace '"libpulse.so.0"' '"${libpulseaudio}/lib/libpulse.so.0"' \ + --replace '"libwebkitgtk-6.0.so.4"' '"${webkitgtk_6_0}/lib/libwebkitgtk-6.0.so.4"' + done + '' + lib.optionalString stdenv.isDarwin '' + substituteInPlace Telegram/lib_webrtc/webrtc/platform/mac/webrtc_environment_mac.mm \ + --replace kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster + ''; + + # Wrapping the inside of the app bundles, avoiding double-wrapping + dontWrapQtApps = stdenv.isDarwin; + + nativeBuildInputs = + [ cmake ninja pkg-config python3 wrapQtAppsHook clang libclang pkg-config ]; + + buildInputs = [ + qtbase + qtsvg + qtimageformats + boost + lz4 + xxHash + ffmpeg + openalSoft + minizip + libopus + range-v3 + tl-expected + rnnoise + protobuf + tg_owt + microsoft-gsl + rlottie + pcre + pcre-cpp + libXtst + openssl + libjpeg + libopus + ffmpeg + libXdamage + ada + gobject-introspection + ]; + + propagatedBuildInputs = lib.optionals stdenv.isLinux [ + qtwayland + gtk3 + glib-networking + fmt + libdbusmenu + alsa-lib + libpulseaudio + pipewire + hunspell + webkitgtk_6_0 + jemalloc + tg_owt + glib + libXi + libXcomposite + libXdamage + libXext + libXfixes + libXrender + libXrandr + libXtst + pipewire + ]; + + darwinFrameworks = lib.optionals stdenv.isDarwin + (with darwin.apple_sdk_11_0.frameworks; [ + Cocoa + CoreFoundation + CoreServices + CoreText + CoreGraphics + CoreMedia + OpenGL + AudioUnit + ApplicationServices + Foundation + AGL + Security + SystemConfiguration + Carbon + AudioToolbox + VideoToolbox + VideoDecodeAcceleration + AVFoundation + CoreAudio + CoreVideo + CoreMediaIO + QuartzCore + AppKit + CoreWLAN + WebKit + IOKit + GSS + MediaPlayer + IOSurface + Metal + NaturalLanguage + LocalAuthentication + libicns + ]); + + # On darwin, we need to use lld as the linker, as otherwise the linking step + # will fail due to missing symbols. + makeFlags = lib.optionalString stdenv.isDarwin "NIX_CFLAGS_LINK=-fuse-ld=lld"; + + cmakeFlags = [ + "-Ddisable_autoupdate=ON" + "-DTDESKTOP_API_ID=2040" + "-DTDESKTOP_API_HASH=b18441a1ff607e10a989891a5462e627" + "-DDESKTOP_APP_USE_GTK3=ON" + "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF" + "-DDESKTOP_APP_DISABLE_SCUDO=ON" + "-DCMAKE_BUILD_TYPE=Release" + "-DCMAKE_CXX_FLAGS=-O3" + "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" + "-DCMAKE_GENERATOR=Ninja" + ]; + + preBuild = lib.optionalString stdenv.isLinux '' + export GI_GIR_PATH=${webkitgtk_6_0}/share/gir-1.0 + export tg_owt_DIR=${tg_owt}/share/cmake/tg_owt + ''; + + installPhase = lib.optionalString stdenv.isDarwin '' + mkdir -p $out/Applications + cp -r ${finalAttrs.meta.mainProgram}.app $out/Applications + ln -s $out/Applications/${finalAttrs.meta.mainProgram}.app/Contents/MacOS/${finalAttrs.meta.mainProgram} $out/bin/${finalAttrs.meta.mainProgram} + ''; + + postFixup = lib.optionalString stdenv.isLinux '' + wrapProgram $out/bin/${finalAttrs.meta.mainProgram} \ + --prefix GIO_EXTRA_MODULES : ${glib-networking}/lib/gio/modules \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ webkitgtk_6_0 ]} + '' + lib.optionalString stdenv.isDarwin '' + wrapQtApp $out/Applications/${finalAttrs.meta.mainProgram}.app/Contents/MacOS/${finalAttrs.meta.mainProgram} + ''; + + passthru = { + inherit tg_owt; + updateScript = nix-update-script { }; + }; + + meta = with lib; { + mainProgram = "ayugram-desktop"; + + # inherit from AyuGramDesktop + description = + "Desktop Telegram client with good customization and Ghost mode."; + license = licenses.gpl3Only; + platforms = lib.platforms.all; + homepage = "https://ayugram.one"; + changelog = + "https://github.com/Ayugram/AyuGramDesktop/releases/tag/v${version}"; + maintainers = with maintainers; [ azikx kaeeraa hand7 shawty ]; + broken = stdenv.isDarwin; # temporary + badPlatforms = [ stdenv.isDarwin ]; + downloadPage = + "https://github.com/Ayugram/AyuGramDesktop/releases/tag/v${version}"; + longDescription = '' + AyuGram is a fork of Telegram Desktop with a focus on + customization. It includes features like a customizable + interface, Ghost mode, and more. + ''; + }; +}) diff --git a/home/programs/custom-pkgs/default.nix b/home/programs/custom-pkgs/default.nix index 783b944..5558024 100644 --- a/home/programs/custom-pkgs/default.nix +++ b/home/programs/custom-pkgs/default.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { - home.packages = with pkgs; - [ - (callPackage ./anicliru/anicli-ru.nix { }) - # (callPackage ./vivaldi/default.nix { }) - # (callPackage ./torrserver/default.nix { }) - ]; + home.packages = with pkgs; [ + (callPackage ./anicliru/anicli-ru.nix { }) + (callPackage ./ayugram/default.nix.nix { }) + # (callPackage ./vivaldi/default.nix { }) + # (callPackage ./torrserver/default.nix { }) + ]; } diff --git a/home/programs/gui/pkgs.nix b/home/programs/gui/pkgs.nix index 0b84950..8b1fe11 100644 --- a/home/programs/gui/pkgs.nix +++ b/home/programs/gui/pkgs.nix @@ -29,6 +29,6 @@ }) inputs.zen-browser.packages."${system}".specific - inputs.ayugram-desktop.packages.${pkgs.system}.default + # inputs.ayugram-desktop.packages.${pkgs.system}.ayugram-desktop ]; } diff --git a/home/programs/misc/nwg.nix b/home/programs/misc/nwg.nix index b5b02da..519c6a0 100644 --- a/home/programs/misc/nwg.nix +++ b/home/programs/misc/nwg.nix @@ -1,6 +1,18 @@ -{ pkgs, config, lib, ... }: { +{ config, ... }: { xdg.configFile = with config.lib.stylix.colors; { - "nwg-drawer/drawer.css".text = - " window {\n background-color: #${base00};\n color: #eeeeee;\n }\n \n button {\n color: #${base04};\n background-color: #${base00};\n }\n \n button:hover {\n color: #${base04};\n background-color: #${base01};\n }\n"; + "nwg-drawer/drawer.css".text = '' + window { + color = #${base06}; + background-color: #${base00}; + } + button { + color: #${base04}; + background-color: #${base00}; + } + button:hover { + color: #${base04}; + background-color: #${base01}; + } + ''; }; }