repo-clone/module.nix

54 lines
1.2 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 07:10:49 +00:00
systemd.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;
script = pkgs.writeShellScriptBin execName ''
2024-07-31 23:12:48 +00:00
echo "hello!"
2024-08-01 07:15:17 +00:00
echo "${config.repo-clone.pkg}"
2024-07-31 23:12:48 +00:00
'';
in
"${script}/bin/${execName}";
RemainAfterExit = "yes";
};
Install = {
WantedBy = [ "multi-user.target" ];
};
};
2024-08-01 06:53:14 +00:00
2024-08-01 07:07:56 +00:00
repo-clone.pkg = pkgs.writeText "${service}.conf" ''
2024-08-01 06:53:40 +00:00
uwu
'';
2024-07-31 23:12:48 +00:00
};
}