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

Devenv updates #1982

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 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 @@ -197,6 +207,16 @@ ihpFlake:
++ [pkgs.mktemp] # Without this 'make build/bin/RunUnoptimizedProdServer' fails on macOS
;

# Hack to avoid --impure
# See https://github.com/cachix/devenv/commit/cc0944a60978ad7cf74d429d18c2a8065f018545
devenv.root =
let
devenvRootFileContent = builtins.readFile ihpFlake.inputs.devenv-root.outPath;
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
Loading