nixos-configs/configurations/homie/modules/home-assistant/netdaemon/package.nix

42 lines
973 B
Nix
Raw Normal View History

2024-10-05 12:38:13 -04:00
{
lib,
2024-10-05 12:38:13 -04:00
buildDotnetModule,
dotnetCorePackages,
2024-10-05 17:04:57 -04:00
}: let
inherit (lib) any hasInfix hasSuffix removeSuffix;
srcDirs = ["apps"];
srcPatterns = [".cs" ".csproj" ".json" ".version" "HomeAssistantGenerated"];
2024-10-05 12:38:13 -04:00
pname = "netdaemon-config";
2024-10-05 17:04:57 -04:00
in
buildDotnetModule {
inherit pname;
version = removeSuffix "\n" (builtins.readFile ./.version);
2024-10-05 12:38:13 -04:00
src = builtins.path {
name = "netdaemon-src";
path = ./.;
filter = file: type:
(type == "directory" && any (s: hasInfix s file) srcDirs)
|| any (s: hasSuffix s file) srcPatterns;
};
2024-10-05 12:38:13 -04:00
preBuild = ''
mv HomeAssistantGenerated HomeAssistantGenerated.cs
'';
2024-10-05 17:04:57 -04:00
projectFile = "netdaemon.csproj";
2024-12-22 17:04:02 -05:00
nugetDeps = ./deps.json;
2024-10-05 12:38:13 -04:00
2024-12-11 16:32:30 -05:00
dotnet-sdk = dotnetCorePackages.sdk_9_0;
dotnet-runtime = dotnetCorePackages.runtime_9_0;
2024-10-05 17:04:57 -04:00
executables = [];
postFixup = ''
cp -r $out/lib/${pname} $netdaemonConfig
2024-10-05 17:04:57 -04:00
'';
outputs = ["out" "netdaemonConfig"];
2024-10-05 17:04:57 -04:00
}