repo-clone/module.nix

51 lines
1.1 KiB
Nix

{ lib, config, pkgs, ... }:
let
service = "repo-clone";
cfg = config.repo-clone;
in
{
options.${service} = {
enable = lib.mkEnableOption "${service} service";
repos = lib.mkOption {
type = import ./repo.nix { inherit lib; };
description = ''
attrs of repos to clone
'';
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.${service} = {
Unit = {
Description = "${service} service";
};
Service = {
Type = "exec";
ExecStart =
let
execName = service;
script = lib.writeShellScriptBin execName ''
echo "hello!"
'';
in
"${script}/bin/${execName}";
RemainAfterExit = "yes";
};
Install = {
WantedBy = [ "multi-user.target" ];
};
};
cfg.pkg = pkgs.writeText "${service}.conf" '''';
};
}