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

42 lines
972 B
Nix
Raw Permalink 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";
nugetDeps = ./deps.nix;
2024-10-05 12:38:13 -04:00
2024-10-05 17:04:57 -04:00
dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime = dotnetCorePackages.runtime_8_0;
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
}