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

Seungheonoh/ctlsubmodule #55

Open
wants to merge 3 commits into
base: main
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: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ This format is based on [Keep A Changelog](https://keepachangelog.com/en/1.0.0).
## Unreleased

- Update templates.
- Deprecate ctl-server.
- Add `submodules` option to offchain that addes path for npm submodules

## 2.9.2 - 2023-06-14

- Add liqwid-nix module documentation generation. Both onchain and offchain have their modules included.
Pending implementation for automating this workstream.


## 2.9.1 - 2023-05-26

- Hercules CI option is moved from `flake` to top level, by using hercules-ci-effects module.
Expand Down
46 changes: 14 additions & 32 deletions nix/offchain.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,6 @@ in

runtime = types.submodule {
options = {
enableCtlServer = lib.mkOption {
description = ''
Whether to enable or disable the CTL server (used to apply
arguments to scripts and evaluate UPLC). Enabling this will
also add the ctl-server overlay.

Added in: 2.1.0.
'';
type = types.bool;
default = false;
};

extraConfig = lib.mkOption {
description = ''
Additional config options to pass to the CTL runtime. See
Expand Down Expand Up @@ -325,6 +313,16 @@ in
default = { };
};

submodules = lib.mkOption {
description = ''
NPM submodules directories to include when making Node Env

Added in: 2.8.0
'';
type = types.listOf types.path;
default = [ ];
};

enableFormatCheck = lib.mkOption {
description = ''
Whether to add a flake check verifying that the code
Expand Down Expand Up @@ -387,16 +385,6 @@ in
spago
];

includeCtlServer =
lib.any
(project: project.runtime.enableCtlServer)
(lib.attrValues projectConfigs);

additionalOverlays =
if includeCtlServer
then [ ctl-overlays.ctl-server ]
else [ ];

nixpkgs-ctl = assert (lib.assertMsg (self.inputs ? nixpkgs-ctl) ''
[liqwid-nix] liqwid-nix offchain module is being used. Please provide a 'nixpkgs-ctl' input, as taken from 'cardano-transaction-lib'.
''); self.inputs.nixpkgs-ctl;
Expand All @@ -410,7 +398,7 @@ in
if projectConfig.pkgs == null then
(import nixpkgs-ctl {
inherit system;
overlays = defaultCtlOverlays ++ additionalOverlays;
overlays = defaultCtlOverlays;
})
else projectConfig.pkgs;

Expand Down Expand Up @@ -530,6 +518,8 @@ in

strictComp = projectConfig.compileStrict;

submodules = projectConfig.submodules;

shell = {
withRuntime = true;
withChromium = pkgs.stdenv.isLinux;
Expand Down Expand Up @@ -644,16 +634,9 @@ in
formattingCheck
jsLintCheck
];

ctlRuntimeConfig = projectConfig.runtime.extraConfig // {
ctlServer.enable = projectConfig.runtime.enableCtlServer;
};
in
{
packages = bundles //
(if projectConfig.runtime.exposeConfig
then { ctl-runtime = pkgs.buildCtlRuntime ctlRuntimeConfig { }; }
else { });
packages = bundles;

run.nixFormat =
{
Expand Down Expand Up @@ -699,7 +682,6 @@ in
check = utils.combineChecks "combined-checks" checks;

apps = {
ctl-runtime = pkgs.launchCtlRuntime ctlRuntimeConfig;
docs = project.launchSearchablePursDocs { };
};

Expand Down