Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce runtime closure size #143

Closed
tomberek opened this issue Dec 1, 2023 · 2 comments · Fixed by #167
Closed

reduce runtime closure size #143

tomberek opened this issue Dec 1, 2023 · 2 comments · Fixed by #167

Comments

@tomberek
Copy link
Contributor

tomberek commented Dec 1, 2023

Currently the runtime closure of the rfc101 branch includes ghc-9 references. This creates a 2GB+ runtime closure. It seems this is for the library outputs.

The below fixes this, but we may instead want to do multiple outputs or use another approach to remove these.

diff --git a/flake.nix b/flake.nix
index 83661b5..231cadc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -25,6 +25,13 @@
           haskell = super.haskell // {
             packageOverrides = self: super: {
               nixfmt = self.callCabal2nix "nixfmt" src { };
+              nixfmt-bin = self.nixfmt.overrideAttrs (old: {
+                disallowedRequisites = [ self.ghc ];
+                postFixup = ''
+                  rm -rf $out/lib
+                  rm -rf $out/nix-support
+                  '';
+              });
             };
           };
         };
@@ -68,6 +75,7 @@
         packages = rec {
           default = nixfmt;
           nixfmt = pkgs.haskellPackages.nixfmt;
+          nixfmt-bin = pkgs.haskellPackages.nixfmt-bin;
           nixfmt-static = haskell.lib.justStaticExecutables nixfmt;
           nixfmt-deriver = nixfmt-static.cabal2nixDeriver;
           nixfmt-js = ghcjsPackages.callCabal2nix "nixfmt" src { };

Note: there are some cabal2nix issues regarding this already

@SuperSandro2000
Copy link
Member

This probably just requires a wrapping with justStaticExecutables

@infinisil
Copy link
Member

Indeed, and this is already the case for the nixfmt-static attribute. Could be made the default though.

infinisil added a commit that referenced this issue Mar 14, 2024
- Doesn't inflate closure size to over 2GB, see #143
- The API docs aren't important and we're intending on deprecating the
  hackage package, see #161
infinisil added a commit that referenced this issue Mar 14, 2024
- Doesn't inflate closure size to over 2GB, see #143
- The API docs aren't important and we're intending on deprecating the
  hackage package, see #161
infinisil added a commit that referenced this issue Mar 14, 2024
- Doesn't inflate closure size to over 2GB, see #143
- The API docs aren't important and we're intending on deprecating the
  hackage package, see #161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants