Unverified Commit 64ebcd80 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge master into haskell-updates

parents ddcad449 5c33ce71
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4859,7 +4859,7 @@
    name = "Eric Evenchick";
  };
  evenbrenden = {
    email = "evenbrenden@gmail.com";
    email = "packages@anythingexternal.com";
    github = "evenbrenden";
    githubId = 2512008;
    name = "Even Brenden";
+2 −0
Original line number Diff line number Diff line
@@ -256,6 +256,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- The `pnpm` package has be updated to from version 7.29.1 to version 8.1.1 and Node.js 14 support has been discontinued (though, there are workarounds if Node.js 14 is still required)
  - Migration instructions: ["Before updating pnpm to v8 in your CI, regenerate your pnpm-lock.yaml. To upgrade your lockfile, run pnpm install and commit the changes. Existing dependencies will not be updated; however, due to configuration changes in pnpm v8, some missing peer dependencies may be added to the lockfile and some packages may get deduplicated. You can commit the new lockfile even before upgrading Node.js in the CI, as pnpm v7 already supports the new lockfile format."](https://github.com/pnpm/pnpm/releases/tag/v8.0.0)

- The `zplug` package changes its output path from `$out` to `$out/share/zplug`. Users should update their dependency on `${pkgs.zplug}/init.zsh` to `${pkgs.zplug}/share/zplug/init.zsh`.

## Other Notable Changes {#sec-release-23.05-notable-changes}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+1 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@
  ./programs/fuse.nix
  ./programs/fzf.nix
  ./programs/gamemode.nix
  ./programs/gamescope.nix
  ./programs/geary.nix
  ./programs/git.nix
  ./programs/gnome-disks.nix
+85 −0
Original line number Diff line number Diff line
{ config
, lib
, pkgs
, ...
}:
with lib; let
  cfg = config.programs.gamescope;

  gamescope =
    let
      wrapperArgs =
        optional (cfg.args != [ ])
          ''--add-flags "${toString cfg.args}"''
        ++ builtins.attrValues (mapAttrs (var: val: "--set-default ${var} ${val}") cfg.env);
    in
    pkgs.runCommand "gamescope" { nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; } ''
      mkdir -p $out/bin
      makeWrapper ${cfg.package}/bin/gamescope $out/bin/gamescope --inherit-argv0 \
        ${toString wrapperArgs}
    '';
in
{
  options.programs.gamescope = {
    enable = mkEnableOption (mdDoc "gamescope");

    package = mkOption {
      type = types.package;
      default = pkgs.gamescope;
      defaultText = literalExpression "pkgs.gamescope";
      description = mdDoc ''
        The GameScope package to use.
      '';
    };

    capSysNice = mkOption {
      type = types.bool;
      default = false;
      description = mdDoc ''
        Add cap_sys_nice capability to the GameScope
        binary so that it may renice itself.
      '';
    };

    args = mkOption {
      type = types.listOf types.string;
      default = [ ];
      example = [ "--rt" "--prefer-vk-device 8086:9bc4" ];
      description = mdDoc ''
        Arguments passed to GameScope on startup.
      '';
    };

    env = mkOption {
      type = types.attrsOf types.string;
      default = { };
      example = literalExpression ''
        # for Prime render offload on Nvidia laptops.
        # Also requires `hardware.nvidia.prime.offload.enable`.
        {
          __NV_PRIME_RENDER_OFFLOAD = "1";
          __VK_LAYER_NV_optimus = "NVIDIA_only";
          __GLX_VENDOR_LIBRARY_NAME = "nvidia";
        }
      '';
      description = mdDoc ''
        Default environment variables available to the GameScope process, overridable at runtime.
      '';
    };
  };

  config = mkIf cfg.enable {
    security.wrappers = mkIf cfg.capSysNice {
      gamescope = {
        owner = "root";
        group = "root";
        source = "${gamescope}/bin/gamescope";
        capabilities = "cap_sys_nice+pie";
      };
    };

    environment.systemPackages = mkIf (!cfg.capSysNice) [ gamescope ];
  };

  meta.maintainers = with maintainers; [ nrdxp ];
}
+63 −1
Original line number Diff line number Diff line
@@ -4,6 +4,24 @@ with lib;

let
  cfg = config.programs.steam;
  gamescopeCfg = config.programs.gamescope;

  steam-gamescope = let
    exports = builtins.attrValues (builtins.mapAttrs (n: v: "export ${n}=${v}") cfg.gamescopeSession.env);
  in
    pkgs.writeShellScriptBin "steam-gamescope" ''
      ${builtins.concatStringsSep "\n" exports}
      gamescope --steam ${toString cfg.gamescopeSession.args} -- steam -tenfoot -pipewire-dmabuf
    '';

  gamescopeSessionFile =
    (pkgs.writeTextDir "share/wayland-sessions/steam.desktop" ''
      [Desktop Entry]
      Name=Steam
      Comment=A digital distribution platform
      Exec=${steam-gamescope}/bin/steam-gamescope
      Type=Application
    '').overrideAttrs (_: { passthru.providedSessions = [ "steam" ]; });
in {
  options.programs.steam = {
    enable = mkEnableOption (lib.mdDoc "steam");
@@ -32,6 +50,12 @@ in {
            then [ package ] ++ extraPackages
            else [ package32 ] ++ extraPackages32;
        in prevLibs ++ additionalLibs;
      } // optionalAttrs (cfg.gamescopeSession.enable && gamescopeCfg.capSysNice)
      {
        buildFHSEnv = pkgs.buildFHSEnv.override {
          # use the setuid wrapped bubblewrap
          bubblewrap = "${config.security.wrapperDir}/..";
        };
      });
      description = lib.mdDoc ''
        The Steam package to use. Additional libraries are added from the system
@@ -57,6 +81,31 @@ in {
        Open ports in the firewall for Source Dedicated Server.
      '';
    };

    gamescopeSession = mkOption {
      description = mdDoc "Run a GameScope driven Steam session from your display-manager";
      default = {};
      type = types.submodule {
        options = {
          enable = mkEnableOption (mdDoc "GameScope Session");
          args = mkOption {
            type = types.listOf types.string;
            default = [ ];
            description = mdDoc ''
              Arguments to be passed to GameScope for the session.
            '';
          };

          env = mkOption {
            type = types.attrsOf types.string;
            default = { };
            description = mdDoc ''
              Environmental variables to be passed to GameScope for the session.
            '';
          };
        };
      };
    };
  };

  config = mkIf cfg.enable {
@@ -66,6 +115,19 @@ in {
      driSupport32Bit = true;
    };

    security.wrappers = mkIf (cfg.gamescopeSession.enable && gamescopeCfg.capSysNice) {
      # needed or steam fails
      bwrap = {
        owner = "root";
        group = "root";
        source = "${pkgs.bubblewrap}/bin/bwrap";
        setuid = true;
      };
    };

    programs.gamescope.enable = mkDefault cfg.gamescopeSession.enable;
    services.xserver.displayManager.sessionPackages = mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ];

    # optionally enable 32bit pulseaudio support if pulseaudio is enabled
    hardware.pulseaudio.support32Bit = config.hardware.pulseaudio.enable;

@@ -74,7 +136,7 @@ in {
    environment.systemPackages = [
      cfg.package
      cfg.package.run
    ];
    ] ++ lib.optional cfg.gamescopeSession.enable steam-gamescope;

    networking.firewall = lib.mkMerge [
      (mkIf cfg.remotePlay.openFirewall {
Loading