68 lines
2 KiB
Nix
68 lines
2 KiB
Nix
{ lib, flake-parts-lib, ... }:
|
|
let
|
|
inherit (flake-parts-lib) mkPerSystemOption;
|
|
inherit (lib) mkOption types;
|
|
in
|
|
{
|
|
options.perSystem = mkPerSystemOption (
|
|
{ pkgs, config, ... }:
|
|
let
|
|
impl = import ./impl.nix { inherit pkgs; };
|
|
mainSubmodule = types.submodule {
|
|
options = {
|
|
basePackage = mkOption {
|
|
type = types.package;
|
|
default = pkgs.deno;
|
|
description = "Base deno package to wrap";
|
|
};
|
|
|
|
registryHostname = mkOption {
|
|
type = types.str;
|
|
default = "registry.npmjs.org";
|
|
description = "NPM registry hostname";
|
|
};
|
|
|
|
lockfiles = mkOption {
|
|
type = types.listOf types.path;
|
|
default = [ ];
|
|
description = "List of deno.lock files to build cache from";
|
|
};
|
|
|
|
dir = mkOption {
|
|
type = types.str;
|
|
default = "$HOME/.cache/deno-nix";
|
|
description = "What to set DENO_DIR to in the wrapper script";
|
|
};
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
readOnly = true;
|
|
description = "Resulting wrapper mimicking Deno executable";
|
|
default = impl.denoWithCache {
|
|
baseDeno = config.deno-with-packages.basePackage;
|
|
sharedCache = config.deno-with-packages.cache;
|
|
dir = config.deno-with-packages.dir;
|
|
};
|
|
};
|
|
|
|
cache = mkOption {
|
|
type = types.package;
|
|
readOnly = true;
|
|
description = "Pre-generated Deno cache based on the given lockfiles";
|
|
default = impl.denoSharedCache {
|
|
lockfiles = config.deno-with-packages.lockfiles;
|
|
registryHostname = config.deno-with-packages.registryHostname;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
in
|
|
{
|
|
options.deno-with-packages = mkOption {
|
|
type = mainSubmodule;
|
|
description = "Wrapping Deno with a pre-generated cache";
|
|
default = { };
|
|
};
|
|
}
|
|
);
|
|
}
|