diff --git a/pkgs/by-name/dr/drawterm/package.nix b/pkgs/by-name/dr/drawterm/package.nix new file mode 100644 index 000000000000..cce9fef8ec3f --- /dev/null +++ b/pkgs/by-name/dr/drawterm/package.nix @@ -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"; + }; +} diff --git a/pkgs/tools/admin/drawterm/default.nix b/pkgs/tools/admin/drawterm/default.nix deleted file mode 100644 index ef46917fbee3..000000000000 --- a/pkgs/tools/admin/drawterm/default.nix +++ /dev/null @@ -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"; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 548a6291147d..9db7b3296139 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };