mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
73 lines
1.5 KiB
Nix
73 lines
1.5 KiB
Nix
{ bash
|
|
, coreutils-prefixed
|
|
, curl
|
|
, fetchFromGitHub
|
|
, gnused
|
|
, gnugrep
|
|
, installShellFiles
|
|
, jq
|
|
, lib
|
|
, makeWrapper
|
|
, mplayer
|
|
, mpv
|
|
, procps
|
|
, scdoc
|
|
, stdenv
|
|
, streamlink
|
|
, vlc
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "wtwitch";
|
|
version = "2.6.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "krathalan";
|
|
repo = pname;
|
|
rev = version;
|
|
hash = "sha256-2YLBuxGwGkav3zB2qMqM6yRXf7ZLqgULoJV4s5p+hSw=";
|
|
};
|
|
|
|
# hardcode SCRIPT_NAME because #150841
|
|
postPatch = ''
|
|
substituteInPlace src/wtwitch --replace 'readonly SCRIPT_NAME="''${0##*/}"' 'readonly SCRIPT_NAME="wtwitch"'
|
|
'';
|
|
|
|
buildPhase = ''
|
|
scdoc < src/wtwitch.1.scd > wtwitch.1
|
|
'';
|
|
|
|
nativeBuildInputs = [ scdoc installShellFiles makeWrapper ];
|
|
|
|
installPhase = ''
|
|
installManPage wtwitch.1
|
|
installShellCompletion --cmd wtwitch \
|
|
--bash src/wtwitch-completion.bash \
|
|
--zsh src/_wtwitch
|
|
install -Dm755 src/wtwitch $out/bin/wtwitch
|
|
wrapProgram $out/bin/wtwitch \
|
|
--set-default LANG en_US.UTF-8 \
|
|
--prefix PATH : ${lib.makeBinPath (lib.optionals stdenv.hostPlatform.isLinux [ vlc ] ++ [
|
|
bash
|
|
coreutils-prefixed
|
|
curl
|
|
gnused
|
|
gnugrep
|
|
jq
|
|
mplayer
|
|
mpv
|
|
procps
|
|
streamlink
|
|
])}
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Terminal user interface for Twitch";
|
|
homepage = "https://github.com/krathalan/wtwitch";
|
|
license = licenses.gpl3Only;
|
|
maintainers = with maintainers; [ urandom ];
|
|
platforms = platforms.all;
|
|
mainProgram = "wtwitch";
|
|
};
|
|
}
|