Unverified Commit 5c29bfa0 authored by Emily's avatar Emily Committed by GitHub
Browse files

darwin.{ditto,sudo}: drop (#453106)

parents a3045315 88e1756b
Loading
Loading
Loading
Loading
+0 −38
Original line number Diff line number Diff line
{ lib, runCommandLocal }:

# On darwin, there are some commands neither opensource nor able to build in nixpkgs.
# We have no choice but to use those system-shipped impure ones.

let
  commands = {
    ditto = "/usr/bin/ditto"; # ditto is not opensource
    sudo = "/usr/bin/sudo"; # sudo must be owned by uid 0 and have the setuid bit set
  };

  mkImpureDrv =
    name: path:
    runCommandLocal "${name}-impure-darwin"
      {
        __impureHostDeps = [ path ];

        meta = {
          platforms = lib.platforms.darwin;
        };
      }
      ''
        if ! [ -x ${path} ]; then
          echo Cannot find command ${path}
          exit 1
        fi

        mkdir -p $out/bin
        ln -s ${path} $out/bin

        manpage="/usr/share/man/man1/${name}.1"
        if [ -f $manpage ]; then
          mkdir -p $out/share/man/man1
          ln -s $manpage $out/share/man/man1
        fi
      '';
in
lib.mapAttrs mkImpureDrv commands
+2 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ stubs
  ### D ###

  discrete-scroll = pkgs.discrete-scroll; # added 2024-11-27
  ditto = throw "'darwin.ditto' has been removed, because it was impure and unused"; # added 2025-10-18

  ### I ###

@@ -150,5 +151,6 @@ stubs

  stdenvNoCF = throw "darwin.stdenvNoCF has been removed; use `stdenv` or `stdenvNoCC`"; # converted to throw 2025-07-29
  stubs = throw "'darwin.stubs.*' have been removed as they were unused"; # added 2025-04-20
  sudo = throw "'darwin.sudo' has been removed, because it was impure and unused"; # added 2025-10-18
  swift-corelibs-foundation = throw "'darwin.swift-corelibs-foundation' has been removed, as it was broken and is no longer used"; # added 2025-04-20
}
+1 −5
Original line number Diff line number Diff line
@@ -39,14 +39,10 @@ makeScopeWithSplicing' {
        callPackage = self.callPackage;
        directory = ../os-specific/darwin/apple-source-releases;
      };

      # Must use pkgs.callPackage to avoid infinite recursion.
      impure-cmds = pkgs.callPackage ../os-specific/darwin/impure-cmds { };
    in

    lib.recurseIntoAttrs (
      impure-cmds
      // apple-source-packages
      apple-source-packages
      // {

        inherit (self.adv_cmds) ps;