forked from WalletWasabi/WalletWasabi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
116 lines (106 loc) · 4.69 KB
/
flake.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
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
{
description = "Wasabi Wallet flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
deployScript = pkgs.writeScriptBin "deploy" (builtins.readFile ./Contrib/deploy.sh);
gitRev = if (builtins.hasAttr "rev" self) then self.rev else "dirty";
buildWasabiModule = pkgs.buildDotnetModule {
pname = "wasabi";
version = "2.0.0-${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}-${gitRev}";
nugetDeps = ./deps.nix; # nix build .#packages.x86_64-linux.all.passthru.fetch-deps
dotnetFlags = [ "-p:CommitHash=${gitRev}" ];
runtimeDeps = [ pkgs.openssl pkgs.zlib ];
dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0;
selfContainedBuild = true;
src = ./.;
};
# Build Wasabi Backend
buildBackend = buildWasabiModule.overrideAttrs (oldAttrs: rec {
pname = "WalletWasabi.Backend";
projectFile = "WalletWasabi.Backend/WalletWasabi.Backend.csproj";
executables = [ "WalletWasabi.Backend" ];
postInstall = ''
ln -s ${deployScript}/bin/deploy $out
'';
});
# Build all components and run tests (CI)
buildEverything = buildWasabiModule.overrideAttrs (oldAttrs: rec {
pname = "WalletWasabi";
projectFile = ["WalletWasabi.Backend/WalletWasabi.Backend.csproj" "WalletWasabi.Fluent.Desktop/WalletWasabi.Fluent.Desktop.csproj"];
executables = [ "WalletWasabi.Backend" "WalletWasabi.Fluent.Desktop" ];
runtimeDeps = oldAttrs.runtimeDeps ++ (with pkgs; [
# for client
tor hwi bitcoind-knots
xorg.libX11 xorg.libXrandr xorg.libX11.dev xorg.libICE xorg.libSM fontconfig.lib ]);
# Testing
doCheck = true;
testProjectFile = "WalletWasabi.Tests/WalletWasabi.Tests.csproj";
dotnetTestFlags = ["--filter \"FullyQualifiedName~UnitTests\"" "--logger \"console;verbosity=detailed\""];
# wrap manually, because we want not so ugly executable names
dontDotnetFixup = true;
preFixup = ''
wrapDotnetProgram $out/lib/${pname}/WalletWasabi.Fluent.Desktop $out/bin/wasabi
wrapDotnetProgram $out/lib/${pname}/WalletWasabi.Backend $out/bin/wbend
'';
microservices = "./WalletWasabi/Microservices/Binaries/lin64/";
preBuild = ''
cp -r ${pkgs.tor}/bin/tor ${microservices}/Tor/tor
cp ${pkgs.hwi}/bin/hwi ${microservices}/hwi
cp ${pkgs.bitcoind-knots}/bin/bitcoind ${microservices}/bitcoind
'';
});
# dotnet trace
dotnet-trace = pkgs.buildDotnetGlobalTool {
pname = "dotnet-trace";
nugetName = "dotnet-trace";
version = "8.0.510501";
nugetSha256 = "sha256-Kt5x8n5Q0T+BaTVufhsyjXbi/BlGKidb97DWSbI6Iq8=";
dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0;
};
# dotnet dump
dotnet-dump = pkgs.buildDotnetGlobalTool {
pname = "dotnet-dump";
nugetName = "dotnet-dump";
version = "8.0.510501";
nugetSha256 = "sha256-H7Z4EA/9G3DvVuXbnQJF7IJMEB2SkzRjTAL3eZMqCpI=";
dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0;
};
# dotnet counters
dotnet-counters = pkgs.buildDotnetGlobalTool {
pname = "dotnet-counters";
nugetName = "dotnet-counters";
version = "8.0.510501";
nugetSha256 = "sha256-gAexbRzKP/8VPhFy2OqnUCp6ze3CkcWLYR1nUqG71PI=";
dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0;
};
wasabi-shell = pkgs.mkShell {
name = "wasabi-shell";
packages = [
pkgs.dotnetCorePackages.sdk_8_0
dotnet-trace
dotnet-dump
dotnet-counters
];
shellHook = ''
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
export DOTNET_ROOT=${pkgs.dotnetCorePackages.sdk_8_0}
export PS1='\n\[\033[1;34m\][Wasabi:\w]\$\[\033[0m\] '
'';
};
migrateBackendFilters = {
type = "app";
program = "${(pkgs.writeShellScript "migrateBackendFilters" ''
${pkgs.dotnetCorePackages.sdk_8_0}/bin/dotnet fsi ${./.}/Contrib/Migration/migrateBackendFilters.fsx;
'')}";
};
in
{
packages.x86_64-linux.default = buildBackend;
packages.x86_64-linux.all = buildEverything;
devShells.x86_64-linux.default = wasabi-shell;
apps.x86_64-linux.migrateFilters = migrateBackendFilters;
};
}