From dfe157eda7c37871d93f1ca2a9c760195fa882bd Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 14 Mar 2024 22:55:52 +0100 Subject: [PATCH] Always just executables and don't build haddock - Doesn't inflate closure size to over 2GB, see https://github.com/NixOS/nixfmt/issues/143 - The API docs aren't important and we're intending on deprecating the hackage package, see https://github.com/NixOS/nixfmt/issues/161 --- .github/workflows/main.yml | 2 +- default.nix | 9 ++++++--- flake.nix | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f42f9e24..be4225ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,5 +22,5 @@ jobs: run: nix shell .#packages.x86_64-linux.reuse -c reuse lint - name: build nixfmt - run: nix build -L .#nixfmt-static + run: nix build -L . if: success() || failure() diff --git a/default.nix b/default.nix index c846559c..fbca1e93 100644 --- a/default.nix +++ b/default.nix @@ -40,14 +40,17 @@ let ]; }; - build = pkgs.haskellPackages.nixfmt; + build = lib.pipe pkgs.haskellPackages.nixfmt [ + haskell.lib.justStaticExecutables + haskell.lib.dontHaddock + (drv: lib.lazyDerivation { derivation = drv; }) + ]; in build // rec { packages = { nixfmt = build; - nixfmt-static = haskell.lib.justStaticExecutables packages.nixfmt; - nixfmt-deriver = packages.nixfmt-static.cabal2nixDeriver; + nixfmt-deriver = build.cabal2nixDeriver; nixfmt-shell = packages.nixfmt.env.overrideAttrs (oldAttrs: { buildInputs = diff --git a/flake.nix b/flake.nix index bbc1f662..7aeb170e 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ apps.default = { type = "app"; - program = "${self.packages.${system}.nixfmt-static}/bin/nixfmt"; + program = "${result}/bin/nixfmt"; }; checks = result.checks;