Files
nixpkgs/pkgs/by-name/st/steamcmd/package.nix
Emily fdb820602b treewide: drop simple x86_64-darwin mentions
To reproduce:

    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: nix-x86_64-darwin
          language: nix
          rule:
            any:
              - pattern: "\"x86_64-darwin\""
                kind: list_expression > string_expression
              - pattern:
                  context: "{ \"x86_64-darwin\" = $EXPR; }"
                  selector: binding
              - pattern:
                  context: "{ x86_64-darwin = $EXPR; }"
                  selector: binding
          fix:
            template: ""
        ' pkgs
    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: json-first-x86_64-darwin
          language: json
          rule:
            kind: object > pair:nth-child(1)
            has:
              pattern: "\"x86_64-darwin\""
              field: key
          fix:
            template: ""
            expandEnd: { regex: "," }
        ' pkgs
    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: json-x86_64-darwin
          language: json
          rule:
            kind: object > pair
            has:
              pattern: "\"x86_64-darwin\""
              field: key
          fix:
            template: ""
            expandStart: { regex: "," }
        ' pkgs
    $ git restore pkgs/by-name/om/omnix/package.nix
    $ git diff --name-only -z \
        | nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
            -c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
    $ treefmt
2026-07-15 03:58:16 +01:00

66 lines
1.6 KiB
Nix

{
lib,
stdenvNoCC,
fetchurl,
steam-run,
coreutils,
steamRoot ? "$HOME/.local/share/Steam",
}:
let
srcs =
let
url =
platform:
"https://web.archive.org/web/20240521141411/https://steamcdn-a.akamaihd.net/client/installer/steamcmd_${platform}.tar.gz";
in
{
x86_64-linux = fetchurl {
url = url "linux";
hash = "sha256-zr8ARr/QjPRdprwJSuR6o56/QVXl7eQTc7V5uPEHHnw=";
};
};
in
stdenvNoCC.mkDerivation {
pname = "steamcmd";
version = "20180104"; # According to steamcmd_linux.tar.gz mtime
src =
srcs.${stdenvNoCC.hostPlatform.system}
or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
# The source tarball does not have a single top-level directory.
preUnpack = ''
mkdir $name
cd $name
sourceRoot=.
'';
dontBuild = true;
installPhase = ''
mkdir -p $out/share/steamcmd
find . -type f -exec install -Dm 755 "{}" "$out/share/steamcmd/{}" \;
mkdir -p $out/bin
substitute ${./steamcmd.sh} $out/bin/steamcmd \
--subst-var out \
--subst-var-by coreutils ${coreutils} \
--subst-var-by steamRoot '${steamRoot}' \
--subst-var-by steamRun ${
if stdenvNoCC.hostPlatform.isLinux then (lib.getExe steam-run) else "exec"
}
chmod 0755 $out/bin/steamcmd
'';
meta = {
homepage = "https://developer.valvesoftware.com/wiki/SteamCMD";
description = "Steam command-line tools";
mainProgram = "steamcmd";
platforms = [
"x86_64-linux"
];
license = lib.licenses.unfreeRedistributable;
maintainers = with lib.maintainers; [ tadfisher ];
};
}