about summary refs log tree commit diff
path: root/pkgs/by-name/m1/m1ddc/package.nix
blob: 9ea2659aba2b4fa0a1b4fb41a5cf3384c098e06b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ stdenv
, darwin
, fetchFromGitHub
, lib
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "m1ddc";
  version = "1.2.0";

  src = fetchFromGitHub {
    owner = "waydabber";
    repo = "m1ddc";
    rev = "v${finalAttrs.version}";
    hash = "sha256-obs2qQvSkIDsWhCXJOF1Geiqqy19KDf0InyxRVod4hk=";
  };

  postPatch = ''
    substituteInPlace sources/ioregistry.m \
        --replace-fail kIOMainPortDefault kIOMasterPortDefault
  '';

  buildInputs = with darwin.apple_sdk_11_0.frameworks; [
    CoreDisplay
    Foundation
  ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp m1ddc $out/bin
    runHook postInstall
  '';

  meta = {
    description = "Control external displays using DDC/CI on Apple Silicon Macs";
    homepage = "https://github.com/waydabber/m1ddc";
    license = lib.licenses.mit;
    mainProgram = "m1ddc";
    maintainers = [ lib.maintainers.joanmassachs ];
    platforms = [ "aarch64-darwin" ];
  };
})