Skip to content

Commit

Permalink
Added name option to the ihp flake
Browse files Browse the repository at this point in the history
This way the nix build path will say the app name instead of just "app"
  • Loading branch information
mpscholten committed Jun 26, 2024
1 parent 366afe9 commit 45ad547
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NixSupport/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
, includeDevTools ? !optimized # Include Postgres?
, rtsFlags ? ""
, optimizationLevel ? "2"
, name ? "app"
}:

let
Expand All @@ -32,7 +33,7 @@ let
else "build/bin/RunJobs";
in
pkgs.stdenv.mkDerivation {
name = "app";
inherit name;
buildPhase = ''
runHook preBuild
Expand Down
12 changes: 12 additions & 0 deletions flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ ihpFlake:
options.ihp = {
enable = lib.mkEnableOption "Enable IHP support";

name = lib.mkOption {
description = ''
The name of your project. Used in the package name.
'';
default = "app";
type = lib.types.str;
};

ghcCompiler = lib.mkOption {
description = ''
The GHC compiler to use for IHP.
Expand Down Expand Up @@ -139,6 +147,7 @@ ihpFlake:
pkgs = pkgs;
rtsFlags = cfg.rtsFlags;
optimizationLevel = cfg.optimizationLevel;
name = cfg.name;
};

unoptimized-prod-server = import "${ihp}/NixSupport/default.nix" {
Expand All @@ -152,6 +161,7 @@ ihpFlake:
pkgs = pkgs;
rtsFlags = cfg.rtsFlags;
optimizationLevel = "0";
name = cfg.name;
};

unoptimized-docker-image = pkgs.dockerTools.buildImage {
Expand Down Expand Up @@ -205,6 +215,8 @@ ihpFlake:
in
pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent;

name = cfg.name;

/*
we currently don't use devenv containers, and they break nix flake show
without the proper inputs set
Expand Down

0 comments on commit 45ad547

Please sign in to comment.