Merge pull request #259784 from dmytrokyrychuk/init-spice-autorandr

spice-autorandr: init at 0.0.2

authored by

Artturi and committed by
GitHub
b2426bef 187c6604

+83
+6
maintainers/maintainer-list.nix
··· 4520 4520 githubId = 1708810; 4521 4521 name = "Daniel Vianna"; 4522 4522 }; 4523 + dmytrokyrychuk = { 4524 + email = "dmytro@kyrych.uk"; 4525 + github = "dmytrokyrychuk"; 4526 + githubId = 699961; 4527 + name = "Dmytro Kyrychuk"; 4528 + }; 4523 4529 dnr = { 4524 4530 email = "dnr@dnr.im"; 4525 4531 github = "dnr";
+1
nixos/modules/module-list.nix
··· 737 737 ./services/misc/soft-serve.nix 738 738 ./services/misc/sonarr.nix 739 739 ./services/misc/sourcehut 740 + ./services/misc/spice-autorandr.nix 740 741 ./services/misc/spice-vdagentd.nix 741 742 ./services/misc/spice-webdavd.nix 742 743 ./services/misc/ssm-agent.nix
+26
nixos/modules/services/misc/spice-autorandr.nix
··· 1 + { config, pkgs, lib, ... }: 2 + 3 + let 4 + cfg = config.services.spice-autorandr; 5 + in 6 + { 7 + options = { 8 + services.spice-autorandr = { 9 + enable = lib.mkEnableOption (lib.mdDoc "spice-autorandr service that will automatically resize display to match SPICE client window size."); 10 + package = lib.mkPackageOptionMD pkgs "spice-autorandr" { }; 11 + }; 12 + }; 13 + 14 + config = lib.mkIf cfg.enable { 15 + environment.systemPackages = [ cfg.package ]; 16 + 17 + systemd.user.services.spice-autorandr = { 18 + wantedBy = [ "default.target" ]; 19 + after = [ "spice-vdagentd.service" ]; 20 + serviceConfig = { 21 + ExecStart = "${cfg.package}/bin/spice-autorandr"; 22 + Restart = "on-failure"; 23 + }; 24 + }; 25 + }; 26 + }
+50
pkgs/by-name/sp/spice-autorandr/package.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , pkg-config 5 + , autoreconfHook 6 + , libX11 7 + , libXrandr 8 + }: 9 + 10 + stdenv.mkDerivation { 11 + pname = "spice-autorandr"; 12 + version = "0.0.2"; 13 + 14 + src = fetchFromGitHub { 15 + owner = "seife"; 16 + repo = "spice-autorandr"; 17 + rev = "0f61dc921b638761ee106b5891384c6348820b26"; 18 + hash = "sha256-eBvzalWT3xI8+uNns0/ZyRes91ePpj0beKb8UBVqo0E="; 19 + }; 20 + 21 + nativeBuildInputs = [ autoreconfHook pkg-config ]; 22 + buildInputs = [ libX11 libXrandr ]; 23 + 24 + installPhase = '' 25 + runHook preInstall 26 + 27 + mkdir -p $out/bin 28 + cp $pname $out/bin/ 29 + 30 + runHook postInstall 31 + ''; 32 + 33 + meta = { 34 + description = "Automatically adjust the client window resolution in Linux KVM guests using the SPICE driver."; 35 + longDescription = '' 36 + Some desktop environments update the display resolution automatically, 37 + this package is only useful when running without a DE or with a DE that 38 + does not update display resolution automatically. 39 + 40 + This package relies on `spice-vdagent` running an updating the xrandr modes. Enable 41 + `spice-vdagent` by adding `services.spice-autorandr.enable = true` to your `configuration.nix`. 42 + ''; 43 + homepage = "https://github.com/seife/spice-autorandr"; 44 + license = lib.licenses.mit; 45 + maintainers = with lib.maintainers; [ 46 + dmytrokyrychuk 47 + ]; 48 + platforms = [ "x86_64-linux" ]; 49 + }; 50 + }