files.rc
- {name}.bundle for bundles
- {name}.oneshot for one shot activations scripts
- {name}.longrun for deamons services
All services are disabled by default.
It will fail at activation time if:
- More then onde type (bundle, oneshot, longrun) were defined for the same {name}
- One dependency service ins't defined but required
type
attribute set of (submodule)
example
{
files.rc = {
hello = {
enable = true;
longrun = {
run = "mySquirelD";
};
};
hola = {
bundle = {
contents = [
"hello"
"world"
];
};
enable = true;
};
world = {
enable = true;
oneshot = {
setup = "echo Hello World > $PRJ_DATA_DIR/hello.txt";
};
};
};
}
default
{
files.rc = { };
}
files.rc.<name>.enable
type
boolean
example
{
files.rc.<name>.enable = true;
}
default
{
files.rc.<name>.enable = false;
}
files.rc.<name>.bundle
bundle
is a service aggregator
For example we can bundle every system (db, http, config) by microservice.
Like:
- Commerce Bundle:
- commerce database service
- commerce api service
- commerce cache service
- BPMN Bundle
- BPMN database service
- BPMN api service
- BPMN cache service
type
null or (submodule)
example
{
files.rc.<name>.bundle = {
contents = [
"myFancyServiceName"
];
essential = true;
};
}
default
{
files.rc.<name>.bundle = null;
}
files.rc.<name>.bundle.deps
type
non-empty (list of non-empty string)
example
{
files.rc.<name>.bundle.deps = [
"myDep"
"myOtherDep"
];
}
files.rc.<name>.bundle.essential
It means some commands may work to stop these services
type
boolean
example
{
files.rc.<name>.bundle.essential = true;
}
default
{
files.rc.<name>.bundle.essential = false;
}
files.rc.<name>.longrun
longrun
are commands that run as deamon (in a infinity loop).
Applications:
- static site service
- test watcher
- some script to warn that your coffe bottle is empty
type
null or (submodule)
example
{
files.rc.<name>.longrun = {
agreement = {
description = "Check to confirm";
label = "Are you sure?";
};
};
}
default
{
files.rc.<name>.longrun = null;
}
files.rc.<name>.longrun.consumer-for
Dependency hierarchy are calculated at activation time.
See S6 documentation for more info
type
list of non-empty string
example
{
files.rc.<name>.longrun.consumer-for = [
"myService"
];
}
default
{
files.rc.<name>.longrun.consumer-for = [ ];
}
files.rc.<name>.longrun.data
type
null or path
example
{
files.rc.<name>.longrun.data = "./.data";
}
default
{
files.rc.<name>.longrun.data = null;
}
files.rc.<name>.longrun.deps
ready
to this
service work.
Dependency hierarchy are calculated at activation time.
See S6 documentation for more info
type
list of non-empty string
example
{
files.rc.<name>.longrun.deps = [
"myDependency"
];
}
default
{
files.rc.<name>.longrun.deps = [ ];
}
files.rc.<name>.longrun.env
type
null or path
example
{
files.rc.<name>.longrun.env = "./.direnv";
}
default
{
files.rc.<name>.longrun.env = null;
}
files.rc.<name>.longrun.essential
It means some commands may work to stop this service
type
boolean
example
{
files.rc.<name>.longrun.essential = true;
}
default
{
files.rc.<name>.longrun.essential = false;
}
files.rc.<name>.longrun.kill-after
- 0 means never
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.kill-after = 2005;
}
default
{
files.rc.<name>.longrun.kill-after = 0;
}
files.rc.<name>.longrun.kill-finish-after
- 0 means never
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.kill-finish-after = 2005;
}
default
{
files.rc.<name>.longrun.kill-finish-after = 0;
}
files.rc.<name>.longrun.lock-descriptor
running
If value any value other then 0, 1 or 2, this service uses file-descriptor lock
type
null or unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.lock-descriptor = 5;
}
default
{
files.rc.<name>.longrun.lock-descriptor = 0;
}
files.rc.<name>.longrun.max-restarts
- Could not be more than 4096
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.max-restarts = 2005;
}
default
{
files.rc.<name>.longrun.max-restarts = 100;
}
files.rc.<name>.longrun.pipeline-name
Dependency hierarchy are calculated at activation time.
See S6 documentation for more info
type
null or non-empty string
example
{
files.rc.<name>.longrun.pipeline-name = "logMyService";
}
default
{
files.rc.<name>.longrun.pipeline-name = null;
}
files.rc.<name>.longrun.producer-for
Dependency hierarchy are calculated at activation time.
See S6 documentation for more info
type
null or non-empty string
example
{
files.rc.<name>.longrun.producer-for = "willReadMyLog";
}
default
{
files.rc.<name>.longrun.producer-for = null;
}
files.rc.<name>.longrun.readiness
It make your service start script be called with s6-notifyoncheck.
See also ready-descriptor.
type
null or (submodule)
example
{
files.rc.<name>.longrun.readiness = {
command = "curl https://localhost";
};
}
default
{
files.rc.<name>.longrun.readiness = null;
}
files.rc.<name>.longrun.readiness.attempts
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.readiness.attempts = 30;
}
default
{
files.rc.<name>.longrun.readiness.attempts = 7;
}
files.rc.<name>.longrun.readiness.command
If not defined {name}-ready is assumed to be command to run
type
null or non-empty string
example
{
files.rc.<name>.longrun.readiness.command = "curl -sSf http://localhost:8080";
}
default
{
files.rc.<name>.longrun.readiness.command = null;
}
files.rc.<name>.longrun.readiness.fork-fork
type
boolean
example
{
files.rc.<name>.longrun.readiness.fork-fork = true;
}
default
{
files.rc.<name>.longrun.readiness.fork-fork = false;
}
files.rc.<name>.longrun.readiness.initial-delay
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.readiness.initial-delay = 10;
}
default
{
files.rc.<name>.longrun.readiness.initial-delay = 50;
}
files.rc.<name>.longrun.readiness.interval
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.readiness.interval = 1000;
}
default
{
files.rc.<name>.longrun.readiness.interval = 100;
}
files.rc.<name>.longrun.readiness.timeout
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.readiness.timeout = 3000;
}
default
{
files.rc.<name>.longrun.readiness.timeout = 2000;
}
files.rc.<name>.longrun.ready-descriptor
ready
notification method
If value any value other then 0, 1 or 2, this service uses file-descriptor notification method
If attr readiness
is defined, use pooling as notification method
type
null or unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.ready-descriptor = 3;
}
default
{
files.rc.<name>.longrun.ready-descriptor = null;
}
files.rc.<name>.longrun.signal
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.signal = 3;
}
default
{
files.rc.<name>.longrun.signal = 15;
}
files.rc.<name>.longrun.start
If not defined {name}-start is assumed to be command to run
Example for non execline scripts:
```nix
files.rc.alo.oneshot.start =
# creates a python script to run when srv start
# and save it at nix store
let start = pkgs.writeScript "mySrvStartScript"
''
#!/usr/bin/env -S python
print("Alô!") # is hello in portuguese
'';
# use the nix store address
in "${start}";
```</para>
type
null or non-empty string
example
{
files.rc.<name>.longrun.start = "mysqld";
}
default
{
files.rc.<name>.longrun.start = null;
}
files.rc.<name>.longrun.stop
If not defined {name}-stop is assumed to be command to run
Example for non execline scripts:
files.rc.alo.oneshot.stop =
# creates a python script to run when srv stop
# and save it at nix store
let stop = pkgs.writeScript "mySrvStopScript"
''
#!/usr/bin/env -S bash
echo "Tchau!" # is bye in portuguese
'';
# use the nix store address
in "${stop}";
```</para>
#### type
null or non-empty string
#### example
```nix
{
files.rc.<name>.longrun.stop = "abSUrDO kill -9 1 1";
}
default
{
files.rc.<name>.longrun.stop = null;
}
files.rc.<name>.longrun.timeout
ready
in X milliseconds
or it will
considered a failure
transition.
If null or 0 system will wait indefinitely
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.timeout = 10000;
}
default
{
files.rc.<name>.longrun.timeout = 0;
}
files.rc.<name>.longrun.timeout-down
stoped
in X milliseconds
or it will
considered a failure
transition.
If null or 0 system will wait indefinitely
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.longrun.timeout-down = 10000;
}
default
{
files.rc.<name>.longrun.timeout-down = 0;
}
files.rc.<name>.oneshot
oneshot
is a change in the system state
Applications examples:
- start other service that aren't controlled by this environment
- mount files
- sync sources
type
null or (submodule)
example
{
files.rc.<name>.oneshot = {
dependencies = [
"holyMoses"
];
setup = {
example = "echo Hello World > $PRJ_DATA_DIR/hello.txt";
};
timeout = 2000;
};
}
default
{
files.rc.<name>.oneshot = null;
}
files.rc.<name>.oneshot.deps
ready
to this
service work.
Dependency hierarchy are calculated at activation time.
type
list of non-empty string
example
{
files.rc.<name>.oneshot.deps = [
"myDependency"
];
}
default
{
files.rc.<name>.oneshot.deps = [ ];
}
files.rc.<name>.oneshot.essential
It means some commands may work to stop these services
type
boolean
example
{
files.rc.<name>.oneshot.essential = true;
}
default
{
files.rc.<name>.oneshot.essential = false;
}
files.rc.<name>.oneshot.start
If not defined {name}-start is assumed to be command to run
Example for non execline scripts:
files.rc.alo.oneshot.start =
# creates a python script to run when srv start
# and save it at nix store
let start = pkgs.writeScript "mySrvStartScript"
''
#!/usr/bin/env -S python
print("Alô!") # is hello in portuguese
'';
# use the nix store address
in "${start}";
```</para>
#### type
null or non-empty string
#### example
```nix
{
files.rc.<name>.oneshot.start = "echo Hello World > $PRJ_DATA_DIR/hello.txt";
}
default
{
files.rc.<name>.oneshot.start = null;
}
files.rc.<name>.oneshot.stop
If not defined {name}-stop is assumed to be command to run
Example for non execline scripts:
files.rc.alo.oneshot.stop =
# creates a python script to run when srv stop
# and save it at nix store
let stop = pkgs.writeScript "mySrvStopScript"
''
#!/usr/bin/env -S bash
echo "Tchau!" # is bye in portuguese
'';
# use the nix store address
in "${stop}";
```</para>
#### type
null or non-empty string
#### example
```nix
{
files.rc.<name>.oneshot.stop = "rm $PRJ_DATA_DIR/hello.txt";
}
default
{
files.rc.<name>.oneshot.stop = null;
}
files.rc.<name>.oneshot.timeout
ready
in X milliseconds
or it will
considered be in failure
status.
If null or 0 system will wait indefinitely
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.oneshot.timeout = 10000;
}
default
{
files.rc.<name>.oneshot.timeout = 0;
}
files.rc.<name>.oneshot.timeout-down
milliseconds
or it will
considered be in failure
status.
If null or 0 system will wait indefinitely
type
unsigned integer, meaning >=0
example
{
files.rc.<name>.oneshot.timeout-down = 10000;
}
default
{
files.rc.<name>.oneshot.timeout-down = 0;
}