about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/owl/default.nix
blob: 812e65830b333e55515456e6fc6ca570897c2e7d (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{ lib
, clangStdenv
, fetchFromGitHub
, gnustep
, libxkbcommon
, makeWrapper
, wayland
, wayland-scanner
, darwin
}:

let
  stdenv = clangStdenv;
in

stdenv.mkDerivation {
  pname = "owl-compositor";
  version = "unstable-2021-11-10";

  src = fetchFromGitHub {
    owner = "owl-compositor";
    repo = "owl";
    rev = "91abf02613cd2ddb97be58b5b6703240320233a0";
    hash = "sha256-a+TznasOVEzSNrs66/y91AeMRDEfyd+WO5mO811hLj0=";
  };

  # use pregenerated nib files because generating them requires Xcode
  postPatch = lib.optionalString stdenv.isDarwin ''
    sed -i "/ibtool/d" configure
    mkdir -p build/Owl.app/Contents/Resources/English.lproj
    cp ${./mac/MainMenu.nib} build/Owl.app/Contents/Resources/English.lproj/MainMenu.nib
    cp ${./mac/OwlPreferences.nib} build/Owl.app/Contents/Resources/English.lproj/OwlPreferences.nib
  '';

  strictDeps = true;

  nativeBuildInputs = [
    makeWrapper
    wayland-scanner
  ] ++ lib.optionals stdenv.isDarwin [
    darwin.DarwinTools
    darwin.bootstrap_cmds
  ] ++ lib.optionals (!stdenv.isDarwin) [
    gnustep.make
    gnustep.wrapGNUstepAppsHook
  ];

  buildInputs = [
    libxkbcommon
    wayland
  ] ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Cocoa
  ] ++ lib.optionals (!stdenv.isDarwin) [
    gnustep.back
    gnustep.base
    gnustep.gui
  ];

  preConfigure = ''
    mkdir -p build
    cd build
  '';

  configureScript = "../configure";

  # error: "Your gnustep-base was configured for the objc-nonfragile-abi but you are not using it now."
  env.NIX_CFLAGS_COMPILE = lib.optionalString (!stdenv.isDarwin) "-fobjc-runtime=gnustep-2.0";

  installPhase = ''
    runHook preInstall

    mkdir -p $out/{Applications,bin}
    mv Owl.app $out/Applications
    makeWrapper $out/{Applications/Owl.app${lib.optionalString stdenv.isDarwin "/Contents/MacOS"},bin}/Owl

    runHook postInstall
  '';

  meta = with lib; {
    description = "Portable Wayland compositor in Objective-C";
    homepage = "https://github.com/owl-compositor/owl";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ wegank ];
    platforms = platforms.unix;
    mainProgram = "Owl";
  };
}