forked from StarMapLoader/StarMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
148 lines (116 loc) · 4.04 KB
/
Copy pathflake.nix
File metadata and controls
148 lines (116 loc) · 4.04 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
description = "KSA's StarMapLoader";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }: let
pkgs = nixpkgs.legacyPackages."x86_64-linux";
dotnetCore = pkgs.dotnetCorePackages;
dotnet-sdk = dotnetCore.sdk_10_0;
dotnet-runtime = dotnetCore.runtime_10_0;
version = "0.4.5";
buildType = "Debug";
runtimeDeps = with pkgs; [
vulkan-loader
icu
# TODO remove x11 and wayland only compat
libx11
libxcursor
libxi
];
ksaLibs = pkgs.requireFile {
name = "KSALibraries";
message = ''
Download KSA...
'';
hashMode = "recursive";
sha256 = "01l6rap6mm6cnzidc05wj0gw28jickvvpybnkny2cbvgf2j1w2w4";
};
star-map-types = pkgs.buildDotnetModule {
pname = "StarMap.Types";
inherit version;
src = ./StarMap.Types/.;
projectFile = "StarMap.Types.csproj";
nugetDeps = ./deps.json;
inherit dotnet-runtime dotnet-sdk buildType;
packNupkg = true;
};
star-map-api = pkgs.buildDotnetModule {
pname = "StarMap.API";
inherit version;
src = ./StarMap.API/.;
projectFile = "StarMap.API.csproj";
inherit dotnet-runtime dotnet-sdk buildType;
postPatch = ''
substituteInPlace StarMap.API.csproj --replace-fail 'Include="..\..\Import\KSA.dll"' 'Include="${ksaLibs}\KSA.dll"'
substituteInPlace StarMap.API.csproj --replace-fail 'Include="..\..\Import\Brutal.*.dll"' 'Include="${ksaLibs}\Brutal.*.dll"'
'';
packNupkg = true;
};
star-map-core = pkgs.buildDotnetModule {
pname = "StarMap.Core";
inherit version;
src = ./StarMap.Core/.;
projectFile = "StarMap.Core.csproj";
nugetDeps = ./deps.json;
inherit dotnet-runtime dotnet-sdk buildType;
buildInputs = [
star-map-api
star-map-types
];
postPatch = ''
substituteInPlace StarMap.Core.csproj --replace-fail 'Include="..\..\Import\KSA.dll"' 'Include="${ksaLibs}\KSA.dll"'
substituteInPlace StarMap.Core.csproj --replace-fail 'Include="..\..\Import\Brutal.*.dll"' 'Include="${ksaLibs}\Brutal.*.dll" /><Reference Include="${ksaLibs}\Planet.*.dll"'
substituteInPlace StarMap.Core.csproj --replace-fail \
'<ProjectReference Include="..\StarMap.API\StarMap.API.csproj" />' \
'<PackageReference Include="StarMap.API" Version="*" />'
substituteInPlace StarMap.Core.csproj --replace-fail \
'<ProjectReference Include="..\StarMap.Types\StarMap.Types.csproj" />' \
'<PackageReference Include="StarMap.Types" Version="*" />'
'';
packNupkg = true;
};
star-map = pkgs.buildDotnetModule {
pname = "StarMap";
inherit version;
src = ./StarMap/.;
projectFile = "StarMap.csproj";
nugetDeps = ./deps.json;
inherit dotnet-runtime dotnet-sdk runtimeDeps;
buildInputs = [
star-map-api
star-map-core
star-map-types
];
nativeBuildInputs = with pkgs; [
makeWrapper
];
postPatch = ''
substituteInPlace StarMap.csproj --replace-fail \
'<ProjectReference Include="..\StarMap.Core\StarMap.Core.csproj" />' \
'<PackageReference Include="StarMap.Core" Version="*" />'
substituteInPlace StarMap.csproj --replace-fail \
'<ProjectReference Include="..\StarMap.Types\StarMap.Types.csproj" />' \
'<PackageReference Include="StarMap.Types" Version="*" />'
'';
postFixup = ''
cp ${star-map-core}/lib/StarMap.Core/StarMap.Core.deps.json $out/lib/StarMap/
wrapProgram $out/lib/StarMap/StarMap \
--unset WAYLAND_DISPLAY
'';
packNupkg = true;
};
in {
packages."x86_64-linux".default = star-map;
packages."x86_64-linux".loader = star-map;
packages."x86_64-linux".core = star-map-core;
packages."x86_64-linux".api = star-map-api;
packages."x86_64-linux".types = star-map-types;
devShells."x86_64-linux".default = pkgs.mkShell {
buildInputs = with pkgs; [
dotnet-sdk
nuget-to-json
];
};
};
}