Unverified Commit 15839077 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

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

parents c86a9367 aabb4c5b
Loading
Loading
Loading
Loading
+102 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
  unstableGitUpdater,
  installShellFiles,
  makeWrapper,
  apple-sdk_13,
  xorg,
  pkg-config,
  wayland-scanner,
@@ -14,10 +15,12 @@
  libxkbcommon,
  wlr-protocols,
  pulseaudio,
  config,
  nixosTests,
  withWayland ? false,
}:

let
  withXorg = !(withWayland || stdenv.hostPlatform.isDarwin);
in
stdenv.mkDerivation {
  pname = "drawterm";
  version = "0-unstable-2025-03-18";
@@ -32,50 +35,55 @@ stdenv.mkDerivation {
  enableParallelBuilding = true;
  strictDeps = true;
  nativeBuildInputs =
    [ installShellFiles ]
    ++ {
      linux = [
    [
      installShellFiles
      makeWrapper
    ]
    ++ lib.optionals withWayland [
      pkg-config
      wayland-scanner
    ];
      unix = [ makeWrapper ];
    }
    ."${config}" or (throw "unsupported CONF");

  buildInputs =
    {
      linux = [
    lib.optionals withWayland [
      pipewire
      wayland
      wayland-protocols
      libxkbcommon
      wlr-protocols
      ];
      unix = [
    ]
    ++ lib.optionals withXorg [
      xorg.libX11
      xorg.libXt
      ];
    }
    ."${config}" or (throw "unsupported CONF");
    ]
    ++ lib.optional stdenv.hostPlatform.isDarwin apple-sdk_13;

  # TODO: macos
  makeFlags = [ "CONF=${config}" ];
  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 =
    {
      linux = ''
    ''
      installManPage drawterm.1
    ''
    + lib.optionalString withWayland ''
      install -Dm755 -t $out/bin/ drawterm
      '';
      unix = ''
    ''
    + 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
      '';
    }
    ."${config}" or (throw "unsupported CONF")
    + ''
      installManPage drawterm.1
    ''
    + 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 = {
@@ -83,12 +91,12 @@ stdenv.mkDerivation {
    tests = nixosTests.drawterm;
  };

  meta = with lib; {
  meta = {
    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;
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ moody ];
    platforms = with lib.platforms; linux ++ darwin;
    mainProgram = "drawterm";
  };
}
+1 −2
Original line number Diff line number Diff line
@@ -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 { };