typst-nix/envs/base.nix

49 lines
1.3 KiB
Nix

# THIS FILE IS EXTERNALLY MANAGED, DO NO EDIT
{
lib,
config,
hasSystem,
pkgs,
...
}:
with lib;
optionalAttrs hasSystem {
options = {
env = mkOption {
type = with types; attrsOf str;
default = { };
description = "Environment variables to set";
};
shellPackages = mkOption {
type = with types; listOf package;
default = [ ];
description = "Packages to be active inside the shell";
};
paths = mkOption {
type = with types; listOf str;
default = [ ];
description = "Values to append to the `PATH` variable";
};
libraries = mkOption {
type = with types; listOf str;
default = [ ];
description = "Values to append to the `LD_LIBRARY_PATH` variable";
};
shellHook = mkOption {
type = with types; lines;
default = "";
description = "Commands to run at shell start";
};
};
config = {
devShells.default = pkgs.mkShellNoCC {
packages = config.shellPackages;
shellHook = ''
${config.shellHook}
PATH="$PATH${lib.concatStringsSep "" (map (s: ":${s}") config.paths)}"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH${lib.concatStringsSep "" (map (s: ":${s}") config.libraries)}"
'';
env = config.env;
};
};
}