-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
41 lines (29 loc) · 878 Bytes
/
default.nix
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
{ lib, swiftPackages, swift, swiftpm, swiftpm2nix, help2man, gnused, date ? null, ... }:
let
generated = swiftpm2nix.helpers ./nix;
in
swiftPackages.stdenv.mkDerivation {
pname = "SimpleSwiftServer";
version = "4.4.0";
src = ./.;
nativeBuildInputs = [ swift swiftpm ];
postBuild = ''
echo "[AUTHOR]
@Samasaur1 on GitHub" > author.inc
${lib.getExe help2man} -i author.inc -o server.1 -N "$(swiftpmBinPath)/server"
${lib.optionalString (date != null) ''
${lib.getExe gnused} -i"" -e "s/January 1980/${date}/" server.1
''}
'';
configurePhase = generated.configure;
installPhase = ''
mkdir -p $out/bin $out/share/man/man1
binPath="$(swiftpmBinPath)"
cp $binPath/server $out/bin/
cp server.1 $out/share/man/man1/
'';
meta = with lib; {
platforms = platforms.darwin;
mainProgram = "server";
};
}