Skip to content

Config: JSON

鄭余玄 edited this page Jan 21, 2019 · 5 revisions

pkg.json

Define all available packages.

ex:

{
  "jdk-1.8": {
    "__prefix": "{HOME}/.local/jdk1.8.0",
    "__meta": "standard",
    "JAVA_HOME": "{PREFIX}"
  },
  "intel-2019": {
    "__keywords": ["intel"],
    "__prefix": "/opt/intel/2019",
    "__cmd": "source {PREFIX}/bin/compilervars.sh intel64"
  }
}
  • jdk-1.8 is the unique name of a package.
  • keys start with __ are reserved; while others (usually uppercase) are directly used for environment variables.
    • __keywords (list of string): provide short alias(es) of a package.
    • __prefix (string): use for {PREFIX} string interpolation.
    • __cmd (string): direct command execution.
    • __meta (string): apply a meta template from meta.json.
  • the value of an environment variable could be a string or a list of string.
  • string interpolation
    • {HOME}: defined by the environment variable $HOME.
    • {PREFIX}: defined by __prefix value.

meta.json

Define meta package templates.

ex:

{
  "gcc": {
    "LD_LIBRARY_PATH": ["{PREFIX}/lib", "{PREFIX}/lib64", "{PREFIX}/libexec"],
    "PATH": "{PREFIX}/bin"
  },
  "intel": {
    "__cmd": "source {PREFIX}/bin/compilervars.sh intel64"
  }
}
  • gcc is the unique name of a meta package.
  • keys start with __ are reserved; while others (usually uppercase) are directly used for environment variables.
    • __keywords (list of string): provide short alias(es) of a meta package.
    • __cmd (string): direct command execution.
  • the value of an environment variable could be a string or a list of string.
  • strings can be prepared for further string interpolations.
Clone this wiki locally