repo-clone/module.nix

53 lines
1.1 KiB
Nix
Raw Normal View History

2024-08-01 06:53:14 +00:00
{ lib, config, pkgs, ... }:
2024-07-31 23:12:48 +00:00
let
2024-08-01 06:53:14 +00:00
service = "repo-clone";
2024-07-31 23:12:48 +00:00
cfg = config.repo-clone;
in
{
2024-08-01 06:53:14 +00:00
options.${service} = {
enable = lib.mkEnableOption "${service} service";
2024-08-01 06:08:41 +00:00
repos = lib.mkOption {
type = import ./repo.nix { inherit lib; };
description = ''
2024-08-01 06:26:58 +00:00
attrs of repos to clone
2024-08-01 06:08:41 +00:00
'';
default = { };
};
2024-08-01 06:53:14 +00:00
pkg = lib.mkOption {
type = lib.types.package;
};
2024-07-31 23:12:48 +00:00
};
# /nix/store/pxd7wc8icz577hpl6pmz02b74nhbrj6h-unit-home-manager-ravenshade.service/home-manager-ravenshade.service
config = lib.mkIf cfg.enable {
2024-08-01 06:53:14 +00:00
system.user.services.${service} = {
2024-07-31 23:12:48 +00:00
Unit = {
2024-08-01 06:53:14 +00:00
Description = "${service} service";
2024-07-31 23:12:48 +00:00
};
Service = {
Type = "exec";
ExecStart =
let
2024-08-01 06:53:14 +00:00
execName = service;
2024-07-31 23:12:48 +00:00
script = lib.writeShellScriptBin execName ''
echo "hello!"
'';
in
"${script}/bin/${execName}";
RemainAfterExit = "yes";
};
Install = {
WantedBy = [ "multi-user.target" ];
};
};
2024-08-01 06:53:14 +00:00
2024-08-01 06:53:40 +00:00
cfg.pkg = pkgs.writeText "${service}.conf" ''
uwu
'';
2024-07-31 23:12:48 +00:00
};
}