diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 5ea5ba0f18d3..e07b039bb8ab 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -84,6 +84,8 @@ - [Krill](https://nlnetlabs.nl/projects/krill/about), RPKI CA and Publication Server written in Rust. Available as [services.krill](#opt-services.krill.enable). +- [vellum](https://github.com/greyxp1/vellum) is a live screen annotation overlay for Wayland. Available as [programs.vellum](#opt-programs.vellum.enable). + - [stash-clipboard](https://github.com/NotAShelf/stash), a Wayland clipboard "manager" with fast persistent history and multi-media support. Available as [services.stash-clipboard](#opt-services.stash-clipboard.enable). - [OO7](https://github.com/linux-credentials/oo7) is a desktop-agnostic Secret Service provider. Available as [services.oo7](#opt-services.oo7.enable) diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 2f989934e0e9..feb452efb30d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -352,6 +352,7 @@ ./programs/udevil.nix ./programs/upki.nix ./programs/usbtop.nix + ./programs/vellum.nix ./programs/vim.nix ./programs/virt-manager.nix ./programs/vivid.nix diff --git a/nixos/modules/programs/vellum.nix b/nixos/modules/programs/vellum.nix new file mode 100644 index 000000000000..9c8e045213b0 --- /dev/null +++ b/nixos/modules/programs/vellum.nix @@ -0,0 +1,81 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.programs.vellum; + + inherit (lib) + getExe + literalExpression + mkEnableOption + mkIf + mkOption + mkPackageOption + ; + inherit (lib.types) separatedString; + + toml = pkgs.formats.toml { }; +in +{ + options.programs.vellum = { + enable = mkEnableOption "vellum, a live screen annotation overlay for Wayland"; + + package = mkPackageOption pkgs "vellum" { }; + + settings = mkOption { + inherit (toml) type; + default = { }; + description = '' + Configuration options for vellum. + See available options at . + ''; + example = literalExpression '' + { + default_tool = "arrow"; + remember_last_tool = false; + feedback_duration_ms = 250; + } + ''; + }; + + extraOptions = mkOption { + type = separatedString " "; + default = ""; + description = '' + Extra command-line options to pass to + the {command}`vellum` daemon. + ''; + example = "--force-backend vulkan"; + }; + }; + + config = mkIf cfg.enable { + environment = { + systemPackages = [ cfg.package ]; + + etc."xdg/vellum/config.toml" = mkIf (cfg.settings != { }) { + source = toml.generate "vellum-config.toml" cfg.settings; + }; + }; + + systemd.user.services.vellum = { + description = "Vellum screen annotation overlay"; + after = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + wantedBy = [ "graphical-session.target" ]; + restartTriggers = [ config.environment.etc."xdg/vellum/config.toml".source ]; + serviceConfig = { + ExecStart = "${getExe cfg.package} ${cfg.extraOptions}"; + Restart = "on-failure"; + }; + }; + }; + + meta = { + maintainers = with lib.maintainers; [ poz ]; + }; +} diff --git a/pkgs/by-name/ve/vellum/package.nix b/pkgs/by-name/ve/vellum/package.nix new file mode 100644 index 000000000000..de66b9f9b8bf --- /dev/null +++ b/pkgs/by-name/ve/vellum/package.nix @@ -0,0 +1,73 @@ +{ + fetchFromGitHub, + installShellFiles, + lib, + libGL, + libxkbcommon, + makeBinaryWrapper, + pkg-config, + rustPlatform, + versionCheckHook, + vulkan-loader, + wayland, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "vellum"; + version = "0.6.0"; + + src = fetchFromGitHub { + owner = "greyxp1"; + repo = "vellum"; + tag = "v${finalAttrs.version}"; + hash = "sha256-uWGaCeENwaqg2+wbtfgpDAjxIsJbgUcMnvSPauwjcBI="; + }; + + cargoHash = "sha256-quZW6jkGzvRHNgkJQS4entJyXeYftBOV89hKaFfQCDw="; + + __structuredAttrs = true; + + nativeBuildInputs = [ + installShellFiles + makeBinaryWrapper + pkg-config + ]; + + buildInputs = [ + libxkbcommon + wayland + ]; + + postInstall = '' + manDir=$(find target -type d -path '*/build/vellum-*/out/man' -print -quit) + installManPage "$manDir"/*.1 + + wrapProgram $out/bin/vellum \ + --prefix LD_LIBRARY_PATH : ${ + lib.makeLibraryPath [ + libGL + vulkan-loader + wayland + ] + } + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + meta = { + description = "Live screen annotation overlay for Wayland"; + homepage = "https://github.com/greyxp1/vellum"; + changelog = "https://github.com/greyxp1/vellum/releases/tag/v${finalAttrs.version}"; + downloadPage = "https://github.com/greyxp1/vellum/releases"; + license = + with lib.licenses; + AND [ + isc + mit + ]; + maintainers = with lib.maintainers; [ poz ]; + platforms = lib.platforms.linux; + mainProgram = "vellum"; + }; +})