diff --git a/flake.nix b/flake.nix index 05ea344..4384f51 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,6 @@ }; outputs = { - self, nixpkgs, flake-utils, ... @@ -46,44 +45,18 @@ 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 ["./PrattParser/PrattParser.fsproj"]; - testProjectFiles = ["./PrattParser.Test/PrattParser.Test.fsproj"]; - rids = pkgs.lib.concatStringsSep "\" \"" runtimeIds; - packages = dotnet-sdk.packages; - storeSrc = pkgs.srcOnly { - src = ./.; - pname = pname; - version = version; - }; - })); default = pkgs.buildDotnetModule { - pname = pname; + inherit pname version dotnet-sdk dotnet-runtime; name = "PrattParser"; - version = version; src = ./.; projectFile = "./PrattParser/PrattParser.fsproj"; - nugetDeps = ./nix/deps.nix; + testProjectFile = "./PrattParser.Test/PrattParser.Test.fsproj"; + nugetDeps = ./nix/deps.nix; # `nix build .#default.passthru.fetch-deps && ./result` and put the result here doCheck = true; - dotnet-sdk = dotnet-sdk; - dotnet-runtime = dotnet-runtime; }; }; devShell = pkgs.mkShell { - buildInputs = with pkgs; [ - (with dotnetCorePackages; - combinePackages [ - dotnet-sdk_8 - dotnetPackages.Nuget - ]) - ]; + buildInputs = [dotnet-sdk]; packages = [ pkgs.alejandra pkgs.nodePackages.markdown-link-check diff --git a/nix/deps.nix b/nix/deps.nix index 5c2e4d8..e0c59c8 100644 --- a/nix/deps.nix +++ b/nix/deps.nix @@ -1,25 +1,15 @@ # This file was automatically generated by passthru.fetch-deps. -# Please don't edit it manually, your changes might get overwritten! +# Please dont edit it manually, your changes might get overwritten! {fetchNuGet}: [ - (fetchNuGet { - pname = "fsharp-analyzers"; - version = "0.25.0"; - sha256 = "sha256-njfJYi40jNvrD+mgu9LtQw2Omh8P1SSDThesozH0KQY="; - }) - (fetchNuGet { - pname = "G-Research.FSharp.Analyzers"; - version = "0.9.3"; - sha256 = "sha256-5RFdhBWyf13eQNUuh60+zR1/f19g78yvTP46w3vT1L0="; - }) (fetchNuGet { pname = "fantomas"; version = "6.3.0-alpha-008"; - sha256 = "sha256-rI/4upuj8JBy2C9gl2lwI/JXmBD7UHKxCoSpd+bstRw="; + sha256 = "075mxkk7gac41aqp4l7v22c5gwi3f1lrfq1gv1r91w53kfxgi3xc"; }) (fetchNuGet { - pname = "ApiSurface"; - version = "4.0.25"; - sha256 = "0zjq8an9cr0l7wxdmm9n9s3iyq5m0zl4x0h0wmy5cz7am8y15qc4"; + pname = "fsharp-analyzers"; + version = "0.25.0"; + sha256 = "01i9yhqs7b0p9s1j9m8g3yd8w3a3xp9bp8791zmxp31l5ricjdwy"; }) (fetchNuGet { pname = "FSharp.Core"; @@ -31,36 +21,6 @@ version = "6.0.0"; sha256 = "18q3p0z155znwj1l0qq3vq9nh9wl2i4mlfx4pmrnia4czr0xdkmb"; }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Ref"; - version = "8.0.1"; - sha256 = "0yaaiqq7mi6sclyrb1v0fyncanbx0ifmnnhv9whynqj8439jsdwh"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.linux-arm64"; - version = "8.0.1"; - sha256 = "0dsdgqg7566qximmjfza4x9if3icy4kskq698ddj5apdia88h2mw"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.linux-x64"; - version = "8.0.1"; - sha256 = "1gjz379y61ag9whi78qxx09bwkwcznkx2mzypgycibxk61g11da1"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.osx-arm64"; - version = "8.0.1"; - sha256 = "0w3mrs4zdl9mfanl1j81759xwwrzmicsjxn6yfxv5yrxbxzq695n"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.osx-x64"; - version = "8.0.1"; - sha256 = "0a9aljr4fy4haq6ndz2y723liv5hbfpss1rn45s88nmgcp27m15m"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.win-x64"; - version = "8.0.1"; - sha256 = "01kzndyqmsvcq49i2jrv7ymfp0l71yxfylv1cy3nhkdbprqz8ipx"; - }) (fetchNuGet { pname = "Microsoft.Build.Tasks.Git"; version = "8.0.0"; @@ -76,61 +36,6 @@ version = "17.9.0"; sha256 = "1lls1fly2gr1n9n1xyl9k33l2v4pwfmylyzkq8v4v5ldnwkl1zdb"; }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.linux-arm64"; - version = "8.0.1"; - sha256 = "0dhpdlcdz7adcfh9w01fc867051m35fqaxnvj3fqvqhgcm2n3143"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.linux-x64"; - version = "8.0.1"; - sha256 = "1aw6mc7zcmzs1grxz2wa9cw9kfj8pz7zpj417xnp1a9n4ix1bxgr"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.osx-arm64"; - version = "8.0.1"; - sha256 = "1dzg3prng9zfdzz7gcgywjdbwzhwm85j89z0jahynxx4q2dra4b9"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.osx-x64"; - version = "8.0.1"; - sha256 = "010f8wn15s2kv7yyzgys3pv9i1mxw20hpv1ig2zhybjxs8lpj8jj"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.win-x64"; - version = "8.0.1"; - sha256 = "1ssj1cyam3nfidm8q82kvh4i3fzm2lzb3bxw6ck09hwhvwh909z4"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Ref"; - version = "8.0.1"; - sha256 = "02r4jg4ha0qksix9v6s3cpmvavmz54gkawkxy9bvknw5ynxhhl1l"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.linux-arm64"; - version = "8.0.1"; - sha256 = "0353whnjgz3sqhzsfrviad3a3db4pk7hl7m4wwppv5mqdg9i9ri5"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.linux-x64"; - version = "8.0.1"; - sha256 = "1g5b30f4l8a1zjjr3b8pk9mcqxkxqwa86362f84646xaj4iw3a4d"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.osx-arm64"; - version = "8.0.1"; - sha256 = "0cdrpdaq5sl3602anfx1p0z0ncx2sjjvl6mgsd6y38g47n7f95jc"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.osx-x64"; - version = "8.0.1"; - sha256 = "1fk1flqp6ji0l4c2gvh83ykndpx7a2nkkgrgkgql3c75j1k2v1s9"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.win-x64"; - version = "8.0.1"; - sha256 = "198576cdkl72xs29zznff9ls763p8pfr0zji7b74dqxd5ga0s3bd"; - }) (fetchNuGet { pname = "Microsoft.SourceLink.Common"; version = "8.0.0"; diff --git a/nix/fetchDeps.sh b/nix/fetchDeps.sh deleted file mode 100644 index e15b822..0000000 --- a/nix/fetchDeps.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -# This file was adapted from -# https://github.com/NixOS/nixpkgs/blob/b981d811453ab84fb3ea593a9b33b960f1ab9147/pkgs/build-support/dotnet/build-dotnet-module/default.nix#L173 -set -euo pipefail -export PATH="@binPath@" -for arg in "$@"; do - case "$arg" in - --keep-sources|-k) - keepSources=1 - shift - ;; - --help|-h) - echo "usage: $0 [--keep-sources] [--help] " - echo " The path to write the lockfile to. A temporary file is used if this is not set" - echo " --keep-sources Don't remove temporary directories upon exit, useful for debugging" - echo " --help Show this help message" - exit - ;; - esac -done -tmp=$(mktemp -td "@pname@-tmp-XXXXXX") -export tmp -HOME=$tmp/home -exitTrap() { - test -n "${ranTrap-}" && return - ranTrap=1 - if test -n "${keepSources-}"; then - echo -e "Path to the source: $tmp/src\nPath to the fake home: $tmp/home" - else - rm -rf "$tmp" - fi - # Since mktemp is used this will be empty if the script didnt succesfully complete - if ! test -s "$depsFile"; then - rm -rf "$depsFile" - fi -} -trap exitTrap EXIT INT TERM -dotnetRestore() { - local -r project="${1-}" - local -r rid="$2" - dotnet restore "${project-}" \ - -p:ContinuousIntegrationBuild=true \ - -p:Deterministic=true \ - --packages "$tmp/nuget_pkgs" \ - --runtime "$rid" \ - --no-cache \ - --force -} -declare -a projectFiles=( @projectFiles@ ) -declare -a testProjectFiles=( @testProjectFiles@ ) -export DOTNET_NOLOGO=1 -export DOTNET_CLI_TELEMETRY_OPTOUT=1 -depsFile=$(realpath "${1:-$(mktemp -t "@pname@-deps-XXXXXX.nix")}") -mkdir -p "$tmp/nuget_pkgs" -storeSrc="@storeSrc@" -src="$tmp/src" -cp -rT "$storeSrc" "$src" -chmod -R +w "$src" -cd "$src" -echo "Restoring project..." -rids=("@rids@") -for rid in "${rids[@]}"; do - (( ${#projectFiles[@]} == 0 )) && dotnetRestore "" "$rid" - for project in "${projectFiles[@]-}" "${testProjectFiles[@]-}"; do - dotnetRestore "$project" "$rid" - done -done -echo "Successfully restored project" -echo "Writing lockfile..." -echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please don't edit it manually, your changes might get overwritten!\n" > "$depsFile" -nuget-to-nix "$tmp/nuget_pkgs" "@packages@" >> "$depsFile" -echo "Successfully wrote lockfile to $depsFile"