nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5
6 autoPatchelfHook,
7 copyDesktopItems,
8 makeDesktopItem,
9
10 godot3-export-templates,
11 godot3-headless,
12
13 alsa-lib,
14 libGL,
15 libGLU,
16 libpulseaudio,
17 libX11,
18 libXcursor,
19 libXext,
20 libXfixes,
21 libXi,
22 libXinerama,
23 libXrandr,
24 libXrender,
25 zlib,
26 udev, # for libudev
27}:
28
29let
30 preset =
31 if stdenv.hostPlatform.isLinux then
32 "Linux/X11"
33 else if stdenv.hostPlatform.isDarwin then
34 "Mac OSX"
35 else
36 throw "unsupported platform";
37in
38stdenv.mkDerivation rec {
39 pname = "lorien";
40 version = "0.6.0";
41
42 src = fetchFromGitHub {
43 owner = "mbrlabs";
44 repo = "Lorien";
45 rev = "v${version}";
46 sha256 = "sha256-mPv/3hyLGF3IUy6cKfGoABidIsyw4UfmhfhS4AD72K8=";
47 };
48
49 nativeBuildInputs = [
50 autoPatchelfHook
51 copyDesktopItems
52 godot3-headless
53 ];
54
55 buildInputs = [
56 alsa-lib
57 libGL
58 libGLU
59 libX11
60 libXcursor
61 libXext
62 libXfixes
63 libXi
64 libXinerama
65 libXrandr
66 libXrender
67 zlib
68 udev
69 ];
70
71 desktopItems = [
72 (makeDesktopItem {
73 name = "lorien";
74 exec = "lorien";
75 icon = "lorien";
76 desktopName = "Lorien";
77 genericName = "Whiteboard";
78 comment = meta.description;
79 categories = [
80 "Graphics"
81 "Office"
82 ];
83 keywords = [ "whiteboard" ];
84 })
85 ];
86
87 buildPhase = ''
88 runHook preBuild
89
90 # Cannot create file '/homeless-shelter/.config/godot/projects/...'
91 export HOME=$TMPDIR
92
93 # Link the export-templates to the expected location. The --export commands
94 # expects the template-file at .../templates/{godot-version}.stable/linux_x11_64_release
95 mkdir -p $HOME/.local/share/godot
96 ln -s ${godot3-export-templates}/share/godot/templates $HOME/.local/share/godot
97
98 mkdir -p $out/share/lorien
99
100 godot3-headless --path lorien --export "${preset}" $out/share/lorien/lorien
101
102 runHook postBuild
103 '';
104
105 installPhase = ''
106 runHook preInstall
107
108 mkdir -p $out/bin
109 ln -s $out/share/lorien/lorien $out/bin
110
111 # Patch binaries.
112 interpreter=$(cat $NIX_CC/nix-support/dynamic-linker)
113 patchelf \
114 --set-interpreter $interpreter \
115 --set-rpath ${lib.makeLibraryPath buildInputs} \
116 $out/share/lorien/lorien
117
118 install -Dm644 images/lorien.png $out/share/pixmaps/lorien.png
119
120 runHook postInstall
121 '';
122
123 runtimeDependencies = map lib.getLib [
124 alsa-lib
125 libpulseaudio
126 udev
127 ];
128
129 meta = {
130 homepage = "https://github.com/mbrlabs/Lorien";
131 description = "Infinite canvas drawing/note-taking app";
132 longDescription = ''
133 An infinite canvas drawing/note-taking app that is focused on performance,
134 small savefiles and simplicity
135 '';
136 license = lib.licenses.mit;
137 platforms = lib.platforms.unix;
138 maintainers = with lib.maintainers; [ hqurve ];
139 mainProgram = "lorien";
140 };
141}