extract service.nix
parent
c15afde777
commit
e8c6f48bec
20
module.nix
20
module.nix
|
@ -8,7 +8,7 @@ let
|
||||||
inherit (lib.strings) concatStringsSep;
|
inherit (lib.strings) concatStringsSep;
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
|
|
||||||
inherit (pkgs) writeShellScriptBin writeText;
|
inherit (pkgs) writeText;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.${service} = {
|
options.${service} = {
|
||||||
|
@ -30,23 +30,7 @@ in
|
||||||
|
|
||||||
# /nix/store/pxd7wc8icz577hpl6pmz02b74nhbrj6h-unit-home-manager-ravenshade.service/home-manager-ravenshade.service
|
# /nix/store/pxd7wc8icz577hpl6pmz02b74nhbrj6h-unit-home-manager-ravenshade.service/home-manager-ravenshade.service
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.user.services.${service} = {
|
systemd.user.services.${service} = import ./service.nix { inherit service pkgs config; };
|
||||||
Unit.Description = "${service} service";
|
|
||||||
Service = {
|
|
||||||
Type = "exec";
|
|
||||||
ExecStart =
|
|
||||||
let
|
|
||||||
execName = service;
|
|
||||||
script = writeShellScriptBin execName ''
|
|
||||||
echo "hello!"
|
|
||||||
echo "${config.repo-clone.pkg}"
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
"${script}/bin/${execName}";
|
|
||||||
RemainAfterExit = "yes";
|
|
||||||
};
|
|
||||||
Install.WantedBy = [ "multi-user.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
repo-clone.pkg = writeText "${service}.conf"
|
repo-clone.pkg = writeText "${service}.conf"
|
||||||
(concatStringsSep "\n"
|
(concatStringsSep "\n"
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{ config, service, pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs)
|
||||||
|
writeShellScriptBin;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
Unit = {
|
||||||
|
Description = "${service} service";
|
||||||
|
X-Restart-Triggers = [ "${config.repo-clone.pkg}" ];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
Type = "exec";
|
||||||
|
ExecStart =
|
||||||
|
let
|
||||||
|
execName = service;
|
||||||
|
script = writeShellScriptBin execName ''
|
||||||
|
echo "hello!"
|
||||||
|
echo "${config.repo-clone.pkg}"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
"${script}/bin/${execName}";
|
||||||
|
RemainAfterExit = "yes";
|
||||||
|
};
|
||||||
|
Install.WantedBy = [ "multi-user.target" ];
|
||||||
|
}
|
Loading…
Reference in New Issue