From 7f829af3570ee94964f5cc75d7f7aaf0df022d75 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Wed, 8 Nov 2023 11:47:14 +0700 Subject: [PATCH] home: neomutt->alot; mpv: add libaribcaption; misc fixes --- home/common/general.nix | 31 ++++++++++++++++++++++++++----- home/common/gui.nix | 13 ++++++++++--- home/common/nvim.nix | 4 ++-- pkgs/default.nix | 25 +++++++++++++++++++++++++ pkgs/libaribcaption/default.nix | 33 +++++++++++++++++++++++++++++++++ system/hosts/router/default.nix | 3 +++ system/hosts/server/akkoma.nix | 11 +++++++++-- 7 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 pkgs/libaribcaption/default.nix diff --git a/home/common/general.nix b/home/common/general.nix index 0c50b60..4744e49 100644 --- a/home/common/general.nix +++ b/home/common/general.nix @@ -83,11 +83,6 @@ }; }; }; - neomutt = { - enable = true; - sidebar.enable = true; - vimKeys = true; - }; home-manager.enable = true; # i only use this as a login shell bash = { @@ -160,7 +155,33 @@ # (because I use nix plugins and plugins are nix version-specific) package = pkgs.nix-index-unwrapped; }; + #neomutt = { + # enable = true; + # sidebar.enable = true; + # vimKeys = true; + #}; + alot = { + enable = true; + settings = { + handle_mouse = true; + initial_command = "search tag:inbox AND NOT tag:killed"; + prefer_plaintext = true; + }; + }; + msmtp.enable = true; + notmuch = { + enable = true; + hooks.preNew = '' + ${config.services.mbsync.package}/bin/mbsync --all || ${pkgs.coreutils}/bin/true + ''; + }; + mbsync.enable = true; }; + #services.mbsync.enable = true; + # TODO: see https://github.com/pazz/alot/issues/1632 + home.file.".mailcap".text = '' + text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} -o display_link_number=1 '%s'; nametemplate=%s.html; copiousoutput + ''; systemd.user.timers.nix-index = { Install.WantedBy = [ "timers.target" ]; diff --git a/home/common/gui.nix b/home/common/gui.nix index aa1a16a..f17f508 100644 --- a/home/common/gui.nix +++ b/home/common/gui.nix @@ -178,10 +178,17 @@ input-default-bindings = false; }; # profiles = { }; - package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override { + package = pkgs.wrapMpv ((pkgs.mpv-unwrapped.override { # webp support - ffmpeg_5 = pkgs.ffmpeg_5-full; - }) { + ffmpeg_5 = pkgs.ffmpeg-custom; + }).overrideAttrs (old: { + patches = old.patches or [] ++ [ + (pkgs.fetchpatch { + url = "https://github.com/mpv-player/mpv/pull/11648.patch"; + hash = "sha256-rp5VxVD74dY3w5rKct1BwFbruxpHsGk8zwtkkhdJovM="; + }) + ]; + })) { scripts = with pkgs.mpvScripts; [ thumbnail mpris diff --git a/home/common/nvim.nix b/home/common/nvim.nix index b3f4e0b..456e23d 100644 --- a/home/common/nvim.nix +++ b/home/common/nvim.nix @@ -105,7 +105,7 @@ BufReadPre = DEFUN (SET vim.o.foldmethod "syntax"); BufEnter = { buf, ... }: LET (vim.filetype.match { inherit buf; }) (filetype: [ - (IF (APPLY OR (map (EQ filetype) [ "gitcommit" "markdown" ])) ( + (IF (APPLY OR (map (EQ filetype) [ "gitcommit" "markdown" "mail" ])) ( LET vim.o.colorcolumn (old_colorcolumn: [ (SET vim.o.colorcolumn "73") (vim.api.nvim_create_autocmd "BufLeave" { @@ -118,7 +118,7 @@ }) ]) )) - (IF (EQ filetype "markdown") ( + (IF (APPLY OR (map (EQ filetype) [ "markdown" "mail" ])) ( (SET (IDX vim.bo buf).textwidth 72) )) ]); diff --git a/pkgs/default.nix b/pkgs/default.nix index ac0e95c..86dead0 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -67,8 +67,33 @@ in /*ghidra = pkgs.ghidra.overrideAttrs (old: { patches = old.patches ++ [ ./ghidra-stdcall.patch ]; });*/ + ffmpeg-custom = (pkgs'.ffmpeg_6-full.override { + withCuda = false; + withCudaLLVM = false; + withNvdec = false; + withNvenc = false; + }).overrideAttrs (old: { + version = "unstable-20231031"; + src = pkgs'.fetchgit { + url = "https://git.ffmpeg.org/ffmpeg.git"; + rev = "4e5f3e6b8e1132354eed810dfdadf87f45c5de27"; + hash = "sha256-fiWkU9fK8qPmxl2MOADKdlFf6XjHGKFhi8uaWltphCE="; + }; + patches = [ ]; + postPatch = '' + ${old.postPatch or ""} + substituteInPlace libavutil/hwcontext_vulkan.c \ + --replace FF_VK_KHR_VIDEO_DECODE_QUEUE FF_VK_EXT_VIDEO_DECODE_QUEUE \ + --replace FF_VK_KHR_VIDEO_DECODE_H264 FF_VK_EXT_VIDEO_DECODE_H264 \ + --replace FF_VK_KHR_VIDEO_DECODE_H265 FF_VK_EXT_VIDEO_DECODE_H265 \ + --replace FF_VK_KHR_VIDEO_DECODE_AV1 FF_VK_EXT_VIDEO_DECODE_AV1 + ''; + buildInputs = old.buildInputs ++ [ pkgs'.libaribcaption ]; + configureFlags = old.configureFlags ++ [ "--enable-libaribcaption" ]; + }); gimp = callPackage ./gimp { inherit (pkgs) gimp; }; home-daemon = callPackage ./home-daemon { }; + libaribcaption = callPackage ./libaribcaption { }; # pin version looking-glass-client = pkgs.looking-glass-client.overrideAttrs (old: { version = "B6"; diff --git a/pkgs/libaribcaption/default.nix b/pkgs/libaribcaption/default.nix new file mode 100644 index 0000000..354b300 --- /dev/null +++ b/pkgs/libaribcaption/default.nix @@ -0,0 +1,33 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake + +, fontconfig +, freetype +}: + +stdenv.mkDerivation rec { + pname = "libaribcaption"; + version = "1.1.1"; + + src = fetchFromGitHub { + owner = "xqq"; + repo = "libaribcaption"; + rev = "v${version}"; + hash = "sha256-x6l0ZrTktSsqfDLVRXpQtUOruhfc8RF3yT991UVZiKA="; + }; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]; + + buildInputs = lib.optionals (!stdenv.isDarwin) [ fontconfig freetype ]; + + meta = with lib; { + description = "Portable ARIB STD-B24 Caption Decoder/Renderer"; + homepage = "https://github.com/xqq/libaribcaption"; + license = licenses.mit; + maintainers = with maintainers; [ chayleaf ]; + }; +} diff --git a/system/hosts/router/default.nix b/system/hosts/router/default.nix index 9043c21..5e6aa97 100644 --- a/system/hosts/router/default.nix +++ b/system/hosts/router/default.nix @@ -905,6 +905,9 @@ in { extraOptions = "-i ${netAddresses.lan4} -p 6969 -P 6969 -p 80"; }; + # I only have 2GB RAM, so Unbound is killed during peak system load without this option + zramSwap.enable = true; + impermanence.directories = [ # for wireguard key { directory = /secrets; mode = "0000"; } diff --git a/system/hosts/server/akkoma.nix b/system/hosts/server/akkoma.nix index 7f44ee7..a8148bd 100644 --- a/system/hosts/server/akkoma.nix +++ b/system/hosts/server/akkoma.nix @@ -16,7 +16,9 @@ in { services.postgresql.extraPlugins = with config.services.postgresql.package.pkgs; [ tsja ]; - services.akkoma = { + services.akkoma = let + inherit ((pkgs.formats.elixirConf { }).lib) mkRaw; + in { enable = true; dist.extraFlags = [ "+sbwt" "none" @@ -48,11 +50,15 @@ in { account_approval_required = true; }; config.":pleroma"."Pleroma.Repo" = { - adapter = (pkgs.formats.elixirConf { }).lib.mkRaw "Ecto.Adapters.Postgres"; + adapter = mkRaw "Ecto.Adapters.Postgres"; username = "akkoma"; password._secret = "/secrets/akkoma/postgres_password"; database = "akkoma"; hostname = "localhost"; + prepare = mkRaw ":named"; + parameters.plan_cache_mode = "force_custom_plan"; + timeout = 30000; + connect_timeout = 10000; }; config.":web_push_encryption".":vapid_details" = { subject = "mailto:webmaster-akkoma@${cfg.domainName}"; @@ -60,6 +66,7 @@ in { private_key._secret = "/secrets/akkoma/push_private_key"; }; config.":joken".":default_signer"._secret = "/secrets/akkoma/joken_signer"; + # config.":logger".":ex_syslogger".level = ":debug"; nginx = { quic = true; enableACME = true;