mirror of
				https://github.com/Smaug123/WoofWare.Myriad
				synced 2025-10-27 06:39:00 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			95 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   description = "Myriad plugins to help with argument parsing";
 | |
| 
 | |
|   inputs = {
 | |
|     flake-utils.url = "github:numtide/flake-utils";
 | |
|     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
 | |
|   };
 | |
| 
 | |
|   outputs = {
 | |
|     self,
 | |
|     nixpkgs,
 | |
|     flake-utils,
 | |
|     ...
 | |
|   }:
 | |
|     flake-utils.lib.eachDefaultSystem (system: let
 | |
|       pkgs = nixpkgs.legacyPackages.${system};
 | |
|       pname = "WoofWare.Myriad.Plugins";
 | |
|       dotnet-sdk = pkgs.dotnet-sdk_8;
 | |
|       dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0;
 | |
|       version = "0.1";
 | |
|       dotnetTool = dllOverride: toolName: toolVersion: sha256:
 | |
|         pkgs.stdenvNoCC.mkDerivation rec {
 | |
|           name = toolName;
 | |
|           version = toolVersion;
 | |
|           nativeBuildInputs = [pkgs.makeWrapper];
 | |
|           src = pkgs.fetchNuGet {
 | |
|             pname = name;
 | |
|             version = version;
 | |
|             sha256 = sha256;
 | |
|             installPhase = ''mkdir -p $out/bin && cp -r tools/net6.0/any/* $out/bin'';
 | |
|           };
 | |
|           installPhase = let
 | |
|             dll =
 | |
|               if isNull dllOverride
 | |
|               then name
 | |
|               else dllOverride;
 | |
|           in ''
 | |
|             runHook preInstall
 | |
|             mkdir -p "$out/lib"
 | |
|             cp -r ./bin/* "$out/lib"
 | |
|             makeWrapper "${dotnet-runtime}/bin/dotnet" "$out/bin/${name}" --add-flags "$out/lib/${dll}.dll"
 | |
|             runHook postInstall
 | |
|           '';
 | |
|         };
 | |
|     in {
 | |
|       packages = {
 | |
|         fantomas = dotnetTool null "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version (builtins.head (builtins.filter (elem: elem.pname == "fantomas") ((import ./nix/deps.nix) {fetchNuGet = x: x;}))).sha256;
 | |
|         fsharp-analyzers = dotnetTool "FSharp.Analyzers.Cli" "fsharp-analyzers" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fsharp-analyzers.version (builtins.head (builtins.filter (elem: elem.pname == "fsharp-analyzers") ((import ./nix/deps.nix) {fetchNuGet = x: x;}))).sha256;
 | |
|         fetchDeps = let
 | |
|           flags = [];
 | |
|           runtimeIds = ["win-x64"] ++ map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms;
 | |
|         in
 | |
|           pkgs.writeShellScriptBin "fetch-${pname}-deps" (builtins.readFile (pkgs.substituteAll {
 | |
|             src = ./nix/fetchDeps.sh;
 | |
|             pname = pname;
 | |
|             binPath = pkgs.lib.makeBinPath [pkgs.coreutils dotnet-sdk (pkgs.nuget-to-nix.override {inherit dotnet-sdk;})];
 | |
|             projectFiles = toString ["./WoofWare.Myriad.Plugins/WoofWare.Myriad.Plugins.fsproj" "./ConsumePlugin/ConsumePlugin.fsproj" "./WoofWare.Myriad.Plugins.Attributes/WoofWare.Myriad.Plugins.Attributes.fsproj"];
 | |
|             testProjectFiles = ["./WoofWare.Myriad.Plugins.Test/WoofWare.Myriad.Plugins.Test.fsproj" "./WoofWare.Myriad.Plugins.Attributes/Test/Woofware.Myriad.Plugins.Attributes.Test.fsproj"];
 | |
|             rids = pkgs.lib.concatStringsSep "\" \"" runtimeIds;
 | |
|             packages = dotnet-sdk.packages;
 | |
|             storeSrc = pkgs.srcOnly {
 | |
|               src = ./.;
 | |
|               pname = pname;
 | |
|               version = version;
 | |
|             };
 | |
|           }));
 | |
|         default = pkgs.buildDotnetModule {
 | |
|           pname = pname;
 | |
|           name = "WoofWare.Myriad.Plugins";
 | |
|           version = version;
 | |
|           src = ./.;
 | |
|           projectFile = "./WoofWare.Myriad.Plugins/WoofWare.Myriad.Plugins.fsproj";
 | |
|           nugetDeps = ./nix/deps.nix;
 | |
|           doCheck = true;
 | |
|           dotnet-sdk = dotnet-sdk;
 | |
|           dotnet-runtime = dotnet-runtime;
 | |
|         };
 | |
|       };
 | |
|       devShell = pkgs.mkShell {
 | |
|         buildInputs = with pkgs; [
 | |
|           (with dotnetCorePackages;
 | |
|             combinePackages [
 | |
|               dotnet-sdk_8
 | |
|               dotnetPackages.Nuget
 | |
|             ])
 | |
|         ];
 | |
|         packages = [
 | |
|           pkgs.alejandra
 | |
|           pkgs.nodePackages.markdown-link-check
 | |
|           pkgs.shellcheck
 | |
|         ];
 | |
|       };
 | |
|     });
 | |
| }
 |