drawterm: migrate to by-name; add darwin platform (#397996)

This commit is contained in:
Aleksana
2025-04-20 09:59:39 +08:00
committed by GitHub
3 changed files with 103 additions and 96 deletions
+102
View File
@@ -0,0 +1,102 @@
{
stdenv,
lib,
fetchFrom9Front,
unstableGitUpdater,
installShellFiles,
makeWrapper,
apple-sdk_13,
xorg,
pkg-config,
wayland-scanner,
pipewire,
wayland,
wayland-protocols,
libxkbcommon,
wlr-protocols,
pulseaudio,
nixosTests,
withWayland ? false,
}:
let
withXorg = !(withWayland || stdenv.hostPlatform.isDarwin);
in
stdenv.mkDerivation {
pname = "drawterm";
version = "0-unstable-2025-03-18";
src = fetchFrom9Front {
owner = "plan9front";
repo = "drawterm";
rev = "0b43ac046ca81d78e9eca535ab1e92971d30405a";
hash = "sha256-L0a81zwzIKwnRK/Mu/kW1oHoJCroa+VDNGj7CI90WMQ=";
};
enableParallelBuilding = true;
strictDeps = true;
nativeBuildInputs =
[
installShellFiles
makeWrapper
]
++ lib.optionals withWayland [
pkg-config
wayland-scanner
];
buildInputs =
lib.optionals withWayland [
pipewire
wayland
wayland-protocols
libxkbcommon
wlr-protocols
]
++ lib.optionals withXorg [
xorg.libX11
xorg.libXt
]
++ lib.optional stdenv.hostPlatform.isDarwin apple-sdk_13;
makeFlags =
lib.optional withWayland "CONF=linux"
++ lib.optional (!(withWayland || stdenv.hostPlatform.isDarwin)) "CONF=unix"
++ lib.optionals stdenv.hostPlatform.isDarwin [
"CONF=osx-cocoa"
"CC=clang"
];
installPhase =
''
installManPage drawterm.1
''
+ lib.optionalString withWayland ''
install -Dm755 -t $out/bin/ drawterm
''
+ lib.optionalString (!(withWayland || stdenv.hostPlatform.isDarwin)) ''
# wrapping the oss output with pulse seems to be the easiest
mv drawterm drawterm.bin
install -Dm755 -t $out/bin/ drawterm.bin
makeWrapper ${pulseaudio}/bin/padsp $out/bin/drawterm --add-flags $out/bin/drawterm.bin
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
mv gui-cocoa/drawterm.app $out/Applications/
mv drawterm $out/Applications/drawterm.app/
ln -s $out/Applications/drawterm.app/drawterm $out/bin/
'';
passthru = {
updateScript = unstableGitUpdater { shallowClone = false; };
tests = nixosTests.drawterm;
};
meta = {
description = "Connect to Plan 9 CPU servers from other operating systems";
homepage = "https://drawterm.9front.org/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ moody ];
platforms = with lib.platforms; linux ++ darwin;
mainProgram = "drawterm";
};
}
-94
View File
@@ -1,94 +0,0 @@
{
stdenv,
lib,
fetchFrom9Front,
unstableGitUpdater,
installShellFiles,
makeWrapper,
xorg,
pkg-config,
wayland-scanner,
pipewire,
wayland,
wayland-protocols,
libxkbcommon,
wlr-protocols,
pulseaudio,
config,
nixosTests,
}:
stdenv.mkDerivation {
pname = "drawterm";
version = "0-unstable-2025-03-18";
src = fetchFrom9Front {
owner = "plan9front";
repo = "drawterm";
rev = "0b43ac046ca81d78e9eca535ab1e92971d30405a";
hash = "sha256-L0a81zwzIKwnRK/Mu/kW1oHoJCroa+VDNGj7CI90WMQ=";
};
enableParallelBuilding = true;
strictDeps = true;
nativeBuildInputs =
[ installShellFiles ]
++ {
linux = [
pkg-config
wayland-scanner
];
unix = [ makeWrapper ];
}
."${config}" or (throw "unsupported CONF");
buildInputs =
{
linux = [
pipewire
wayland
wayland-protocols
libxkbcommon
wlr-protocols
];
unix = [
xorg.libX11
xorg.libXt
];
}
."${config}" or (throw "unsupported CONF");
# TODO: macos
makeFlags = [ "CONF=${config}" ];
installPhase =
{
linux = ''
install -Dm755 -t $out/bin/ drawterm
'';
unix = ''
# wrapping the oss output with pulse seems to be the easiest
mv drawterm drawterm.bin
install -Dm755 -t $out/bin/ drawterm.bin
makeWrapper ${pulseaudio}/bin/padsp $out/bin/drawterm --add-flags $out/bin/drawterm.bin
'';
}
."${config}" or (throw "unsupported CONF")
+ ''
installManPage drawterm.1
'';
passthru = {
updateScript = unstableGitUpdater { shallowClone = false; };
tests = nixosTests.drawterm;
};
meta = with lib; {
description = "Connect to Plan 9 CPU servers from other operating systems";
homepage = "https://drawterm.9front.org/";
license = licenses.mit;
maintainers = with maintainers; [ moody ];
platforms = platforms.linux;
mainProgram = "drawterm";
};
}
+1 -2
View File
@@ -14037,8 +14037,7 @@ with pkgs;
buildServerGui = false;
};
drawterm = callPackage ../tools/admin/drawterm { config = "unix"; };
drawterm-wayland = callPackage ../tools/admin/drawterm { config = "linux"; };
drawterm-wayland = callPackage ../by-name/dr/drawterm/package.nix { withWayland = true; };
droopy = python3Packages.callPackage ../applications/networking/droopy { };