nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 fetchYarnDeps,
6 yarnConfigHook,
7 yarnBuildHook,
8 nodejs,
9 stdenv,
10}:
11let
12
13 version = "1.12.0";
14
15 src = fetchFromGitHub {
16 owner = "screego";
17 repo = "server";
18 rev = "v${version}";
19 hash = "sha256-xWy7aqpUznIYeBPqdpYdRMJxxfiPNa4JmjS3o5i3xxY=";
20 };
21
22 ui = stdenv.mkDerivation {
23 pname = "screego-ui";
24 inherit version;
25
26 src = src + "/ui";
27
28 offlineCache = fetchYarnDeps {
29 yarnLock = "${src}/ui/yarn.lock";
30 hash = "sha256-JPSbBUny5unUHVkaVGlHyA90IpT9ahcSmt9R1hxERRk=";
31 };
32
33 nativeBuildInputs = [
34 yarnConfigHook
35 yarnBuildHook
36 nodejs
37 ];
38
39 preConfigure = ''
40 export HOME=$(mktemp -d)
41 '';
42
43 installPhase = ''
44 cp -r build $out
45 '';
46
47 };
48
49in
50
51buildGoModule rec {
52 inherit src version;
53
54 pname = "screego-server";
55
56 vendorHash = "sha256-vx7CpHUPQlLEQGxdswQJI1SrfSUwPlpNcb7Cq81ZOBQ=";
57
58 ldflags = [
59 "-s"
60 "-w"
61 "-X=main.version=${version}"
62 "-X=main.commitHash=${src.rev}"
63 "-X=main.mode=prod"
64 ];
65
66 postPatch = ''
67 mkdir -p ./ui
68 cp -r "${ui}" ./ui/build
69 '';
70
71 postInstall = ''
72 mv $out/bin/server $out/bin/screego
73 '';
74
75 __darwinAllowLocalNetworking = true;
76
77 meta = {
78 description = "Screen sharing for developers";
79 homepage = "https://screego.net";
80 license = lib.licenses.gpl3Only;
81 maintainers = with lib.maintainers; [ pinpox ];
82 mainProgram = "screego";
83 };
84}