diff options
-rw-r--r-- | lib/default.nix | 26 | ||||
-rw-r--r-- | modules/by-name/me/mergiraf/module.nix | 29 | ||||
-rw-r--r-- | modules/by-name/qu/qutebrowser/module.nix | 22 | ||||
-rw-r--r-- | pkgs/by-name/yt/yt/package.nix | 31 |
4 files changed, 97 insertions, 11 deletions
diff --git a/lib/default.nix b/lib/default.nix index d84ac5e2..1cdbf936 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -7,7 +7,7 @@ # # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{lib}: let +{lib}: rec { /* Converts `number` from a binary number to a decimal one. @@ -101,6 +101,26 @@ else if power > 0 then (base * (pow base (power - 1))) else builtins.throw "Negative powers are not supported"; -in { - inherit binaryToDecimal idFromString pow; + + options = { + /* + Generate an enable option definition, that defaults to true. + + This conveniently allows the composition of a “common” module set. + + # Type + + mkEnable :: String -> AttrSet + + # Arguments + + name + : The name to use in the option description. + */ + mkEnable = name: + (lib.mkEnableOption name) + // { + default = true; + }; + }; } diff --git a/modules/by-name/me/mergiraf/module.nix b/modules/by-name/me/mergiraf/module.nix new file mode 100644 index 00000000..474a0ae3 --- /dev/null +++ b/modules/by-name/me/mergiraf/module.nix @@ -0,0 +1,29 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + libraries, + ... +}: let + cfg = config.soispha.programs.mergiraf; +in { + options.soispha.programs.mergiraf = { + enable = libraries.base.options.mkEnable "mergiraf"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + programs.mergiraf = { + enable = true; + }; + }; + }; +} diff --git a/modules/by-name/qu/qutebrowser/module.nix b/modules/by-name/qu/qutebrowser/module.nix index 4ed7b626..dab06237 100644 --- a/modules/by-name/qu/qutebrowser/module.nix +++ b/modules/by-name/qu/qutebrowser/module.nix @@ -11,10 +11,26 @@ xdg_data_home = config.home-manager.users.soispha.xdg.dataHome; xdg_config_home = config.home-manager.users.soispha.xdg.configHome; - mkQutebrowser = name: + mkQutebrowser = name: let + statusbar_widgets = [ + "keypress" + "text:${name}" + "search_match" + "url" + "scroll" + "history" + "tabs" + "progress" + ]; + + statusbar_widgets_str = + # NOTE(@bpeetz): We need either two layers of escaping or the binary wrapper, as we first inline this + # into the runCommand below, and then into the actual qutebrowser wrapper script. <2025-06-16> + lib.strings.escapeShellArg (builtins.toJSON statusbar_widgets); + in pkgs.runCommandLocal "qutebrowser-${name}" { nativeBuildInputs = [ - pkgs.makeShellWrapper + pkgs.makeBinaryWrapper ]; } '' @@ -26,7 +42,7 @@ --add-flags "${xdg_config_home}/qutebrowser/config.py" \ --add-flags --set \ --add-flags statusbar.widgets \ - --add-flags '["keypress", "text:${name}", "search_match", "url", "scroll", "history", "tabs", "progress"]' + --add-flags ${statusbar_widgets_str} ''; in builtins.filter (val: val != null) (lib.mapAttrsToList (name: value: diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix index 07a0bb3d..c6533158 100644 --- a/pkgs/by-name/yt/yt/package.nix +++ b/pkgs/by-name/yt/yt/package.nix @@ -16,6 +16,7 @@ # buildInputs mpv-unwrapped, python3Packages, + python3, ffmpeg, openssl, libffi, @@ -28,7 +29,7 @@ pkg-config, SDL2, }: let - version = "1.6.0"; + version = "1.6.1"; in rustPlatform.buildRustPackage (finalAttrs: { inherit version; @@ -37,7 +38,7 @@ in src = fetchgit { url = "https://git.foss-syndicate.org/bpeetz/clients/yt"; tag = "v${version}"; - hash = "sha256-i87xssodfVNat/YRWJRMiuNjd1R5T0NRbAzTPxWEIuo="; + hash = "sha256-vVmn0uPQ5t5wcrRbvabD7SOHR2hIjH2NdTE4hJaE3rk="; }; buildInputs = [ @@ -87,9 +88,28 @@ in bash ./scripts/mkdb.sh ''; - cargoHash = "sha256-MRbyWchMM1GPaWTLZt5Bgk/ry6k89woDdpQz0+mi09E="; + cargoHash = "sha256-6xRBXHSYUeOqRk2C5LmEwm4YLuiEjLcFDMokSMHuGXQ="; - postInstall = '' + postInstall = let + collectDeps = pkg: let + next = pkg.propagatedBuildInputs or []; + in + [pkg] + ++ next + ++ (lib.flatten (builtins.map collectDeps next)); + + loadPythonDep = der: "${der}/lib/python${lib.versions.majorMinor python3.version}/site-packages"; + + pythonPath = builtins.concatStringsSep ":" (lib.lists.unique ( + builtins.map loadPythonDep ( + (collectDeps python3Packages.yt-dlp) + ++ [ + # HACK(@bpeetz): These packages are not picked up in the traversal up top. <2025-06-16> + python3Packages.chardet + ] + ) + )); + in '' installShellCompletion --cmd yt \ --bash <(COMPLETE=bash $out/bin/yt) \ --fish <(COMPLETE=fish $out/bin/yt) \ @@ -98,6 +118,7 @@ in # NOTE: We cannot clear the path, because we need access to the $EDITOR. <2025-04-04> wrapProgram $out/bin/yt \ --prefix PATH : ${lib.makeBinPath finalAttrs.buildInputs} \ - --set YTDLP_NO_PLUGINS 1 + --set YTDLP_NO_PLUGINS 1 \ + --set PYTHONPATH ${pythonPath} ''; }) |