Fantomas from flake (#49)

This commit is contained in:
Patrick Stevens
2022-12-28 11:03:19 +00:00
committed by GitHub
parent beec3fb244
commit f091534c05
4 changed files with 34 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "5.1.0",
"version": "5.2.0-alpha-008",
"commands": [
"fantomas"
]

View File

@@ -53,14 +53,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET SDK v7.0.x
uses: actions/setup-dotnet@v3
- name: Install Nix
uses: cachix/install-nix-action@v17
with:
dotnet-version: 7.0.x
- name: Prepare .NET tools
run: dotnet tool restore
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Run Fantomas
run: ./hooks/pre-push
run: nix run .#fantomas -- -r --check .
check-nix-format:
runs-on: ubuntu-latest
@@ -87,7 +86,7 @@ jobs:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Run ShellCheck
run: nix shell 'nixpkgs#shellcheck' --command bash -c "find . -type f -name '*.sh' | xargs shellcheck"
run: nix develop --command bash -c "find . -type f -name '*.sh' | xargs shellcheck"
linkcheck:
name: Check links
@@ -100,7 +99,7 @@ jobs:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Run link checker
run: nix shell 'nixpkgs#nodePackages.markdown-link-check' --command markdown-link-check README.md
run: nix develop --command markdown-link-check README.md
all-required-checks-complete:
needs: [check-dotnet-format, check-nix-format, build, shellcheck, linkcheck, run-app]

View File

@@ -1,4 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "AdventOfCode2022", "AdventOfCode2022\AdventOfCode2022.fsproj", "{6C4FDE18-389F-4AE6-AE9A-B4BD5BA19773}"
EndProject

View File

@@ -20,9 +20,30 @@
outputFiles = [""];
arrayToShell = a: toString (map (pkgs.lib.escape (pkgs.lib.stringToCharacters "\\ ';$`()|<>\t")) a);
dotnet-sdk = pkgs.dotnet-sdk_7;
dotnet-runtime = pkgs.dotnetCorePackages.runtime_7_0;
version = "0.0.1";
dotnetTool = 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 = ''
runHook preInstall
mkdir -p "$out/lib"
cp -r ./bin/* "$out/lib"
makeWrapper "${dotnet-runtime}/bin/dotnet" "$out/bin/${name}" --add-flags "$out/lib/${name}.dll"
runHook postInstall
'';
};
in {
packages = {
fantomas = dotnetTool "fantomas" "5.2.0-alpha-008" "sha256-1egphbWXTjs2I5aFaWibFDKgu3llP1o32o1X5vab6v4=";
fetchDeps = let
flags = [];
runtimeIds = map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms;
@@ -48,8 +69,8 @@
projectFile = projectFile;
nugetDeps = ./deps.nix;
doCheck = true;
dotnet-sdk = pkgs.dotnet-sdk_7;
dotnet-runtime = pkgs.dotnetCorePackages.runtime_7_0;
dotnet-sdk = dotnet-sdk;
dotnet-runtime = dotnet-runtime;
};
};
devShell = pkgs.mkShell {
@@ -62,6 +83,8 @@
];
packages = [
pkgs.alejandra
pkgs.nodePackages.markdown-link-check
pkgs.shellcheck
];
};
});