failing: scripts/base needs to be unique
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
options.my.script = {
|
||||
install = lib.mkEnableOption "Whether to install the script package";
|
||||
service = lib.mkEnableOption "Whether to enable the script service";
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "my-script";
|
||||
@@ -22,25 +24,28 @@
|
||||
};
|
||||
};
|
||||
config = {
|
||||
users.users.jawz.packages = [ config.my.script.package ];
|
||||
systemd.user = with config.my.script; {
|
||||
services."${name}" = {
|
||||
restartIfChanged = true;
|
||||
description = description;
|
||||
wantedBy = [ "default.target" ];
|
||||
path = [ pkgs.nix package ];
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
RestartSec = 30;
|
||||
ExecStart = "${package}/bin/${name}";
|
||||
users.users.jawz = lib.mkIf config.my.script.install {
|
||||
packages = [ config.my.script.package ];
|
||||
};
|
||||
systemd.user = with config.my.script;
|
||||
lib.mkIf config.my.script.service {
|
||||
services."${name}" = {
|
||||
restartIfChanged = true;
|
||||
description = description;
|
||||
wantedBy = [ "default.target" ];
|
||||
path = [ pkgs.nix package ];
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
RestartSec = 30;
|
||||
ExecStart = "${package}/bin/${name}";
|
||||
};
|
||||
};
|
||||
timers."${name}" = {
|
||||
enable = true;
|
||||
description = description;
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = { OnCalendar = timer; };
|
||||
};
|
||||
};
|
||||
timers."${name}" = {
|
||||
enable = true;
|
||||
description = description;
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = { OnCalendar = timer; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
11
modules/scripts/run.nix
Normal file
11
modules/scripts/run.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
imports = [ ./base.nix ];
|
||||
options.my.scripts.run.enable = lib.mkEnableOption "enable";
|
||||
config = lib.mkIf config.my.scripts.run.enable {
|
||||
my.script = {
|
||||
install = true;
|
||||
package =
|
||||
pkgs.writeScriptBin "run" (builtins.readFile ../../scripts/run.sh);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -3,11 +3,13 @@
|
||||
options.my.scripts.tasks.enable = lib.mkEnableOption "enable";
|
||||
config = lib.mkIf config.my.scripts.tasks.enable {
|
||||
my.script = {
|
||||
install = true;
|
||||
service = true;
|
||||
name = "tasks";
|
||||
timer = "*:0/10";
|
||||
description = "runs a bunch of organizing tasks on selected directories";
|
||||
package = (pkgs.writeScriptBin "tasks"
|
||||
(builtins.readFile ../../scripts/tasks.sh));
|
||||
package =
|
||||
pkgs.writeScriptBin "tasks" (builtins.readFile ../../scripts/tasks.sh);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user