add a type definiton for s6-rc modules
This commit is contained in:
parent
cbee488d22
commit
9902d4052b
3 changed files with 13 additions and 6 deletions
|
@ -1,12 +1,19 @@
|
||||||
{ lib, ...}:
|
{ lib, ...}:
|
||||||
let inherit (lib) mkEnableOption mkOption types;
|
let
|
||||||
|
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
||||||
|
type_service = types.package // {
|
||||||
|
name = "service";
|
||||||
|
description = "s6-rc service";
|
||||||
|
check = x: isDerivation x && hasAttr "serviceType" x;
|
||||||
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
systemPackages = mkOption {
|
systemPackages = mkOption {
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
};
|
};
|
||||||
services = mkOption {
|
services = mkOption {
|
||||||
type = types.anything;
|
type = types.attrsOf type_service;
|
||||||
};
|
};
|
||||||
kernel = mkOption {
|
kernel = mkOption {
|
||||||
type = types.anything;
|
type = types.anything;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
mkdir -p $out/${name}
|
mkdir -p $out/${name}
|
||||||
echo $type > $out/${name}/type
|
echo $serviceType > $out/${name}/type
|
||||||
mkdir -p $out/${name}/dependencies.d
|
mkdir -p $out/${name}/dependencies.d
|
||||||
echo $buildInputs > $out/buildInputs
|
echo $buildInputs > $out/buildInputs
|
||||||
test -n "$dependencies" && for d in $dependencies; do
|
test -n "$dependencies" && for d in $dependencies; do
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
} @ args: stdenvNoCC.mkDerivation {
|
} @ args: stdenvNoCC.mkDerivation {
|
||||||
name = "${name}.service";
|
name = "${name}.service";
|
||||||
type = "longrun";
|
serviceType = "longrun";
|
||||||
buildInputs = dependencies;
|
buildInputs = dependencies;
|
||||||
dependencies = builtins.map (d: d.name) dependencies;
|
dependencies = builtins.map (d: d.name) dependencies;
|
||||||
shell = "${busybox}/bin/sh";
|
shell = "${busybox}/bin/sh";
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
# stdenvNoCC is to avoid generating derivations with names
|
# stdenvNoCC is to avoid generating derivations with names
|
||||||
# like foo.service-mips-linux-musl
|
# like foo.service-mips-linux-musl
|
||||||
name = "${name}.service";
|
name = "${name}.service";
|
||||||
type = "oneshot";
|
serviceType = "oneshot";
|
||||||
# does this suffice to make sure dependencies are included
|
# does this suffice to make sure dependencies are included
|
||||||
# even though the built output has no references to their
|
# even though the built output has no references to their
|
||||||
# store directories?
|
# store directories?
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
, ...
|
, ...
|
||||||
}: stdenvNoCC.mkDerivation {
|
}: stdenvNoCC.mkDerivation {
|
||||||
inherit name;
|
inherit name;
|
||||||
type = "bundle";
|
serviceType = "bundle";
|
||||||
contents = builtins.map (d: d.name) contents;
|
contents = builtins.map (d: d.name) contents;
|
||||||
buildInputs = dependencies ++ contents;
|
buildInputs = dependencies ++ contents;
|
||||||
dependencies = builtins.map (d: d.name) dependencies;
|
dependencies = builtins.map (d: d.name) dependencies;
|
||||||
|
|
Loading…
Reference in a new issue