refactor(netd): don't count auto-gen code in repo
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-21 02:48:43 -04:00
parent 842b4b0fa0
commit fa29886b8a
5 changed files with 14 additions and 5 deletions

View file

@ -1 +1,2 @@
use flake "$FLAKE#netdaemon"
cp -rf ./HomeAssistantGenerated ./HomeAssistantGenerated.cs

View file

@ -1,3 +1,4 @@
obj
bin
NetDaemonCodegen
HomeAssistantGenerated.cs

View file

@ -7,7 +7,7 @@
inherit (builtins) attrValues replaceStrings;
inherit (config.sops) secrets;
compiled = pkgs.callPackage ./package.nix {};
inherit (pkgs.callPackage ./package.nix {}) netdaemonConfig;
in {
khepri.compositions."netdaemon" = {
networks.netdaemon = {external = true;};
@ -26,7 +26,7 @@ in {
TZ = "America/New_York";
};
volumes = ["${compiled.lib}:/data"];
volumes = ["${netdaemonConfig}:/data"];
networks = ["netdaemon"];
};
};
@ -70,6 +70,9 @@ in {
dotnet tool run nd-codegen -token "$(sed 's/HomeAssistant__Token=//' ${secrets.netdaemon.path})"
dos2unix ./HomeAssistantGenerated.cs
# This is to not have it count towards CSharp in the repo
mv ./HomeAssistantGenerated.cs ./HomeAssistantGenerated
# Update all nugets to latest versions
regex='PackageReference Include="([^"]*)" Version="([^"]*)"'

View file

@ -6,7 +6,7 @@
inherit (lib) any hasInfix hasSuffix removeSuffix;
srcDirs = ["apps"];
srcPatterns = [".cs" ".csproj" ".json" ".version"];
srcPatterns = [".cs" ".csproj" ".json" ".version" "HomeAssistantGenerated"];
pname = "netdaemon-config";
in
@ -22,6 +22,10 @@ in
|| any (s: hasSuffix s file) srcPatterns;
};
preBuild = ''
mv HomeAssistantGenerated HomeAssistantGenerated.cs
'';
projectFile = "netdaemon.csproj";
nugetDeps = ./deps.nix;
@ -30,8 +34,8 @@ in
executables = [];
postFixup = ''
cp -r $out/lib/${pname} $lib
cp -r $out/lib/${pname} $netdaemonConfig
'';
outputs = ["out" "lib"];
outputs = ["out" "netdaemonConfig"];
}