extract service name
This commit is contained in:
parent
b0a3abbd79
commit
45e8c3e1d5
1 changed files with 13 additions and 6 deletions
19
module.nix
19
module.nix
|
@ -1,11 +1,12 @@
|
|||
{ lib, config, ... }:
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
service = "repo-clone";
|
||||
cfg = config.repo-clone;
|
||||
in
|
||||
{
|
||||
options.repo-clone = {
|
||||
enable = lib.mkEnableOption "repo-clone service";
|
||||
options.${service} = {
|
||||
enable = lib.mkEnableOption "${service} service";
|
||||
|
||||
repos = lib.mkOption {
|
||||
type = import ./repo.nix { inherit lib; };
|
||||
|
@ -14,20 +15,24 @@ in
|
|||
'';
|
||||
default = { };
|
||||
};
|
||||
|
||||
pkg = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# /nix/store/pxd7wc8icz577hpl6pmz02b74nhbrj6h-unit-home-manager-ravenshade.service/home-manager-ravenshade.service
|
||||
config = lib.mkIf cfg.enable {
|
||||
system.user.services.repo-clone = {
|
||||
system.user.services.${service} = {
|
||||
Unit = {
|
||||
Description = "repo-clone service";
|
||||
Description = "${service} service";
|
||||
};
|
||||
Service = {
|
||||
Type = "exec";
|
||||
ExecStart =
|
||||
let
|
||||
execName = "repo-clone";
|
||||
execName = service;
|
||||
script = lib.writeShellScriptBin execName ''
|
||||
echo "hello!"
|
||||
'';
|
||||
|
@ -39,5 +44,7 @@ in
|
|||
WantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
cfg.pkg = pkgs.writeText "${service}.conf" '''';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue