From 2e5daed806aaff65d8db7d5a72ddc26429e396b2 Mon Sep 17 00:00:00 2001 From: Tommy Bidne Date: Thu, 7 Nov 2024 13:37:03 +1300 Subject: [PATCH] Merge nix apps --- .github/workflows/ci.yaml | 2 -- flake.lock | 6 +++--- flake.nix | 45 ++++++++++++++++----------------------- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 506d1339..0f2f2991 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -163,13 +163,11 @@ jobs: - name: Formatting run: | nix run .#format - nix run .#format-yaml git diff --exit-code --color=always - name: Lint run: | nix run .#lint - nix run .#lint-yaml release_osx: needs: [cabal, stack, nix, notify-tests, lint] diff --git a/flake.lock b/flake.lock index c5612840..5debae65 100644 --- a/flake.lock +++ b/flake.lock @@ -165,11 +165,11 @@ }, "nix-hs-utils": { "locked": { - "lastModified": 1713310032, - "narHash": "sha256-fKf7G+wwUoFF2ZfnINncmSgdAR0BlBitx+ENUjxgfcg=", + "lastModified": 1730939757, + "narHash": "sha256-pzl7Y+GN7uc7yqg8scfcbYU08DJSONiADjqtqfr0xdA=", "owner": "tbidne", "repo": "nix-hs-utils", - "rev": "a28bc9ae3797ad713deeac4f52df46cb391d7002", + "rev": "41153f94ef1360b4084ebb99a2b10661c072b2bc", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a26b1b61..09e4cc5d 100644 --- a/flake.nix +++ b/flake.nix @@ -130,6 +130,11 @@ wrapProgram $out/bin/stack --add-flags "--no-nix --system-ghc" ''; }; + + pkgsMkDrv = { + inherit pkgs; + mkDrv = false; + }; in { packages.default = mkPkg false; @@ -153,35 +158,21 @@ }; apps = { - format = nix-hs-utils.format compilerPkgs; - lint = nix-hs-utils.lint compilerPkgs; - lintRefactor = nix-hs-utils.lintRefactor compilerPkgs; + format = nix-hs-utils.mergeApps { + apps = [ + (nix-hs-utils.format (compilerPkgs // pkgsMkDrv)) + (nix-hs-utils.format-yaml pkgsMkDrv) + ]; + }; - format-yaml = - let - drv = pkgs.writeShellApplication { - name = "format-yaml"; - text = "prettier -w -- **/*yaml"; - runtimeInputs = [ pkgs.nodePackages.prettier ]; - }; - in - { - type = "app"; - program = "${drv}/bin/${drv.name}"; - }; + lint = nix-hs-utils.mergeApps { + apps = [ + (nix-hs-utils.lint (compilerPkgs // pkgsMkDrv)) + (nix-hs-utils.lint-yaml pkgsMkDrv) + ]; + }; - lint-yaml = - let - drv = pkgs.writeShellApplication { - name = "lint-yaml"; - text = "yamllint ."; - runtimeInputs = [ pkgs.yamllint ]; - }; - in - { - type = "app"; - program = "${drv}/bin/${drv.name}"; - }; + lintRefactor = nix-hs-utils.lintRefactor compilerPkgs; }; }; systems = [