Compare commits
3 Commits
d0439394cf
...
515e244592
| Author | SHA1 | Date | |
|---|---|---|---|
| 515e244592 | |||
| fb4322c040 | |||
| f376d8684b |
@@ -49,7 +49,7 @@ func (p Printer) GetExample() string {
|
|||||||
return `
|
return `
|
||||||
{
|
{
|
||||||
type: "Print",
|
type: "Print",
|
||||||
"options: {
|
"options": {
|
||||||
"message": "Hello World!"
|
"message": "Hello World!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ Actions have the following syntax:
|
|||||||
"type": "SomeAction",
|
"type": "SomeAction",
|
||||||
"options": { //each action defines its own options
|
"options": { //each action defines its own options
|
||||||
"firstOption": "someValue",
|
"firstOption": "someValue",
|
||||||
"Stage": 2 //this (positive) number defines the order of multiple actions
|
"stage": 2 //this (positive) number defines the order of multiple actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To get a list of all actions and their options from the commandline run ``` gokill -d ```
|
|
||||||
|
|||||||
@@ -17,5 +17,3 @@ Triggers have the following syntax:
|
|||||||
"actions": [] //list actions that should be executed here
|
"actions": [] //list actions that should be executed here
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To get a list of all triggers and their options from the commandline run ```gokill -d```
|
|
||||||
|
|||||||
112
flake.nix
112
flake.nix
@@ -47,7 +47,7 @@
|
|||||||
nixosModules.gokill = { config, lib, pkgs, ... }:
|
nixosModules.gokill = { config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.gokill;
|
cfg = config.services.gokill;
|
||||||
configFile = pkgs.writeText "config.json" ''${cfg.extraConfig}'';
|
configFile = pkgs.writeText "config.json" (builtins.toJSON cfg.triggers);
|
||||||
gokill-pkg = self.packages.x86_64-linux.gokill;
|
gokill-pkg = self.packages.x86_64-linux.gokill;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -61,6 +61,45 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
triggers = lib.mkOption {
|
||||||
|
description = "list of triggers";
|
||||||
|
default = [];
|
||||||
|
type = with lib.types; lib.types.listOf ( submodule {
|
||||||
|
options = {
|
||||||
|
type = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
name = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
options = lib.mkOption {
|
||||||
|
type = lib.types.attrs;
|
||||||
|
};
|
||||||
|
|
||||||
|
actions = lib.mkOption {
|
||||||
|
description = "list of actions";
|
||||||
|
type = with lib.types; lib.types.listOf ( submodule {
|
||||||
|
options = {
|
||||||
|
type = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
options = lib.mkOption {
|
||||||
|
type = lib.types.attrs;
|
||||||
|
};
|
||||||
|
|
||||||
|
stage = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = lib.mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
@@ -92,53 +131,30 @@
|
|||||||
self.nixosModules.gokill
|
self.nixosModules.gokill
|
||||||
{
|
{
|
||||||
services.gokill.enable = true;
|
services.gokill.enable = true;
|
||||||
services.gokill.extraConfig = ''
|
services.gokill.triggers = [
|
||||||
[
|
{
|
||||||
{
|
type = "Timeout";
|
||||||
"type": "Timeout",
|
name = "custom timeout";
|
||||||
"name": "custom timeout",
|
options = {
|
||||||
"options": {
|
duration = 10;
|
||||||
"duration": 30
|
};
|
||||||
},
|
actions = [
|
||||||
"actions": [
|
{
|
||||||
{
|
type = "Timeout";
|
||||||
"type": "Print",
|
options = {
|
||||||
"options": {
|
duration = 5;
|
||||||
"message": "Stage 1 triggered. Waiting 25 seconds"
|
};
|
||||||
},
|
stage = 1;
|
||||||
"stage": 1
|
}
|
||||||
},
|
{
|
||||||
{
|
type = "Shutdown";
|
||||||
"type": "Timeout",
|
options = {
|
||||||
"options": {
|
};
|
||||||
"duration": 20
|
stage = 2;
|
||||||
},
|
}
|
||||||
"stage": 1
|
];
|
||||||
},
|
}
|
||||||
{
|
];
|
||||||
"type": "Timeout",
|
|
||||||
"options": {
|
|
||||||
"duration": 5
|
|
||||||
},
|
|
||||||
"stage": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Print",
|
|
||||||
"options": {
|
|
||||||
"message": "Shutdown in 5 seconds..."
|
|
||||||
},
|
|
||||||
"stage": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Shutdown",
|
|
||||||
"options": {
|
|
||||||
},
|
|
||||||
"stage": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'';
|
|
||||||
users.users.root.password = "root";
|
users.users.root.password = "root";
|
||||||
virtualisation.vmVariant.virtualisation.graphics = false;
|
virtualisation.vmVariant.virtualisation.graphics = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func (p EthernetDisconnect) GetExample() string {
|
|||||||
"options": {
|
"options": {
|
||||||
"interfaceName": "eth0",
|
"interfaceName": "eth0",
|
||||||
"waitTillConnected": true
|
"waitTillConnected": true
|
||||||
}
|
},
|
||||||
"actions": [
|
"actions": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func (p TimeOut) GetExample() string {
|
|||||||
"name": "Example Trigger",
|
"name": "Example Trigger",
|
||||||
"options": {
|
"options": {
|
||||||
"duration": 5
|
"duration": 5
|
||||||
}
|
},
|
||||||
"actions": [
|
"actions": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ func (p UsbDisconnect) GetExample() string {
|
|||||||
"options": {
|
"options": {
|
||||||
"deviceId": "ata-Samsung_SSD_860_EVO_1TB_S4AALKWJDI102",
|
"deviceId": "ata-Samsung_SSD_860_EVO_1TB_S4AALKWJDI102",
|
||||||
"waitTillConnected": true
|
"waitTillConnected": true
|
||||||
}
|
},
|
||||||
"actions": [
|
"actions": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user