Skip to content

Commit

Permalink
APP_RTS_FLAGS are now configured from flake module
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed May 19, 2024
1 parent 252c5cd commit 1cd9b7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 10 additions & 0 deletions flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ ihpFlake:
type = lib.types.listOf (lib.types.str);
default = [];
};

rtsFlags = lib.mkOption {
description = ''
GHC RTS Flags used for compiled binaries (unoptimized-prod-server and optimized-prod-server)
'';
type = lib.types.str;
default = "-A96m -N";
};
};
}
);
Expand Down Expand Up @@ -121,6 +129,7 @@ ihpFlake:
optimized = true;
ghc = ghcCompiler;
pkgs = pkgs;
rtsFlags = cfg.rtsFlags;
};

unoptimized-prod-server = import "${ihp}/NixSupport/default.nix" {
Expand All @@ -132,6 +141,7 @@ ihpFlake:
optimized = false;
ghc = ghcCompiler;
pkgs = pkgs;
rtsFlags = cfg.rtsFlags;
};

unoptimized-docker-image = pkgs.dockerTools.buildImage {
Expand Down
8 changes: 1 addition & 7 deletions lib/IHP/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ endif
GHC_OPTIONS+= -package ihp
GHC_OPTIONS+= -rtsopts=all

APP_RTS_FLAGS := -A96m -n4m -N
# Linux only RTS flags
ifneq ($(shell uname),Darwin)
APP_RTS_FLAGS += --numa
endif

PROD_GHC_OPTIONS+= -funfolding-use-threshold=120
PROD_GHC_OPTIONS+= -optc-O3
PROD_GHC_OPTIONS+= -funbox-strict-fields
Expand All @@ -90,7 +84,7 @@ PROD_GHC_OPTIONS+= -fspecialise-aggressively
PROD_GHC_OPTIONS+= -fstatic-argument-transformation
PROD_GHC_OPTIONS+= -fmax-worker-args=15
PROD_GHC_OPTIONS+= -fdicts-strict
PROD_GHC_OPTIONS+= -with-rtsopts="$APP_RTS_FLAGS"
PROD_GHC_OPTIONS+= -with-rtsopts="${APP_RTS_FLAGS}"


.DEFAULT_GOAL := help
Expand Down

0 comments on commit 1cd9b7b

Please sign in to comment.