anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / misc / ArchiSteamFarm / default.nix
blob7f0b0736900a5d88adfea3e12acf33767743a0cb
1 { lib
2 , buildDotnetModule
3 , fetchFromGitHub
4 , dotnetCorePackages
5 , libkrb5
6 , zlib
7 , openssl
8 , callPackage
9 }:
11 buildDotnetModule rec {
12   pname = "ArchiSteamFarm";
13   # nixpkgs-update: no auto update
14   version = "6.0.8.7";
16   src = fetchFromGitHub {
17     owner = "JustArchiNET";
18     repo = "ArchiSteamFarm";
19     rev = version;
20     hash = "sha256-PnHMJtM4lWuRn+7J9NxObEOJi4pbYEChcpcAJ+EdtSI=";
21   };
23   dotnet-runtime = dotnetCorePackages.aspnetcore_8_0;
24   dotnet-sdk = dotnetCorePackages.sdk_8_0;
26   nugetDeps = ./deps.nix;
28   projectFile = "ArchiSteamFarm.sln";
29   executable = "ArchiSteamFarm";
31   enableParallelBuilding = false;
33   useAppHost = false;
34   dotnetFlags = [
35     # useAppHost doesn't explicitly disable this
36     "-p:UseAppHost=false"
37     "-p:RuntimeIdentifiers="
38   ]
39   ;
40   dotnetBuildFlags = [
41     "--framework=net8.0"
42   ];
43   dotnetInstallFlags = dotnetBuildFlags;
45   runtimeDeps = [ libkrb5 zlib openssl ];
47   doCheck = true;
49   preInstall = ''
50     dotnetProjectFiles=(ArchiSteamFarm)
52     # A mutable path, with this directory tree must be set. By default, this would point at the nix store causing errors.
53     makeWrapperArgs+=(
54       --run 'mkdir -p ~/.config/archisteamfarm/{config,logs,plugins}'
55       --set "ASF_PATH" "~/.config/archisteamfarm"
56     )
57   '';
59   postInstall = ''
60     buildPlugin() {
61       echo "Publishing plugin $1"
62       dotnet publish $1 -p:ContinuousIntegrationBuild=true -p:Deterministic=true \
63         --output $out/lib/ArchiSteamFarm/plugins/$1 --configuration Release \
64         $dotnetFlags $dotnetInstallFlags
65     }
67     buildPlugin ArchiSteamFarm.OfficialPlugins.ItemsMatcher
68     buildPlugin ArchiSteamFarm.OfficialPlugins.MobileAuthenticator
69     buildPlugin ArchiSteamFarm.OfficialPlugins.Monitoring
70     buildPlugin ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
72     chmod +x $out/lib/ArchiSteamFarm/ArchiSteamFarm.dll
73     wrapDotnetProgram $out/lib/ArchiSteamFarm/ArchiSteamFarm.dll $out/bin/ArchiSteamFarm
74     substituteInPlace $out/bin/ArchiSteamFarm \
75       --replace-fail "exec " "exec dotnet "
76   '';
78   passthru = {
79     # nix-shell maintainers/scripts/update.nix --argstr package ArchiSteamFarm
80     updateScript = ./update.sh;
81     ui = callPackage ./web-ui { };
82   };
84   meta = with lib; {
85     description = "Application with primary purpose of idling Steam cards from multiple accounts simultaneously";
86     homepage = "https://github.com/JustArchiNET/ArchiSteamFarm";
87     license = licenses.asl20;
88     mainProgram = "ArchiSteamFarm";
89     maintainers = with maintainers; [ SuperSandro2000 ];
90   };