mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 14:26:33 +01:00
37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
|
{ lib
|
|||
|
, dotnet-sdk
|
|||
|
, buildPackages # buildDotnetModule
|
|||
|
, testers
|
|||
|
, runCommand
|
|||
|
}:
|
|||
|
let
|
|||
|
# Note: without structured attributes, we can’t use derivation arguments that
|
|||
|
# contain spaces unambiguously because arguments are passed as space-separated
|
|||
|
# environment variables.
|
|||
|
copyrightString = "Public domain 🅮";
|
|||
|
|
|||
|
inherit (buildPackages) buildDotnetModule;
|
|||
|
|
|||
|
app = buildDotnetModule {
|
|||
|
name = "structured-attrs-test-application";
|
|||
|
src = ./src;
|
|||
|
nugetDeps = ./nuget-deps.nix;
|
|||
|
dotnetFlags = [ "--property:Copyright=${copyrightString}" ];
|
|||
|
env.TargetFramework = "net${lib.versions.majorMinor (lib.getVersion dotnet-sdk)}";
|
|||
|
__structuredAttrs = true;
|
|||
|
};
|
|||
|
in
|
|||
|
{
|
|||
|
no-structured-attrs = testers.testBuildFailure (app.overrideAttrs {
|
|||
|
__structuredAttrs = false;
|
|||
|
});
|
|||
|
|
|||
|
check-output = testers.testEqualContents {
|
|||
|
assertion = "buildDotnetModule sets AssemblyCopyrightAttribute with structured attributes";
|
|||
|
expected = builtins.toFile "expected-copyright.txt" copyrightString;
|
|||
|
actual = runCommand "dotnet-structured-attrs-test" { } ''
|
|||
|
${app}/bin/Application >"$out"
|
|||
|
'';
|
|||
|
};
|
|||
|
}
|