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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
{ stdenv
, lib
, fetchurl
, dpkg
, libuuid
, xorg
, curlMinimal
, openssl
, libsecret
, webkitgtk
, libsoup
, gtk3
, atk
, pango
, glib
, sqlite
, zlib
, systemd
, msalsdk-dbusclient
, pam
, dbus
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "intune-portal";
version = "1.2404.23-jammy";
src = fetchurl {
url = "https://packages.microsoft.com/ubuntu/22.04/prod/pool/main/i/${pname}/${pname}_${version}_amd64.deb";
hash = "sha256-zAH35iF+3YpDNGo3UhmzL4pRJXlEhG1PaT71qnRtpAg=";
};
nativeBuildInputs = [ dpkg ];
buildPhase =
let
libPath = {
intune = lib.makeLibraryPath [
stdenv.cc.cc.lib
libuuid
xorg.libX11
curlMinimal
openssl
libsecret
webkitgtk
libsoup
gtk3
atk
glib
pango
sqlite
zlib
systemd
msalsdk-dbusclient
dbus
];
pam = lib.makeLibraryPath [ pam ];
};
in
''
runHook preBuild
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath ${libPath.intune} opt/microsoft/intune/bin/intune-portal
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath ${libPath.intune} opt/microsoft/intune/bin/intune-agent
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath ${libPath.intune} opt/microsoft/intune/bin/intune-daemon
patchelf --set-rpath ${libPath.pam} ./usr/lib/x86_64-linux-gnu/security/pam_intune.so
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -a opt/microsoft/intune/bin/* $out/bin/
cp -a usr/share $out
cp -a lib $out
mkdir -p $out/lib/security
cp -a ./usr/lib/x86_64-linux-gnu/security/pam_intune.so $out/lib/security/
cp -a usr/lib/tmpfiles.d $out/lib
substituteInPlace $out/share/applications/intune-portal.desktop \
--replace /opt/microsoft/intune/bin/intune-portal $out/bin/intune-portal
substituteInPlace $out/lib/systemd/user/intune-agent.service \
--replace \
ExecStart=/opt/microsoft/intune/bin/intune-agent \
ExecStart=$out/bin/intune-agent
substituteInPlace $out/lib/systemd/system/intune-daemon.service \
--replace \
ExecStart=/opt/microsoft/intune/bin/intune-daemon \
ExecStart=$out/bin/intune-daemon
runHook postInstall
'';
# Without this network requests fail
dontPatchELF = true;
passthru = {
updateScript = ./update.sh;
tests = { inherit (nixosTests) intune; };
};
meta = with lib; {
description = "Microsoft Intune Portal allows you to securely access corporate apps, data, and resources";
homepage = "https://www.microsoft.com/";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers; [ rhysmdnz ];
};
}
|