type changes

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-05-15 04:37:22 -04:00 committed by Alice Huston
parent 0ce3d57e46
commit 298d7423c6
3 changed files with 47 additions and 29 deletions

View File

@ -211,6 +211,7 @@
}:
lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules =
[
nixos-modules.nixosModule

View File

@ -9,35 +9,37 @@ let
cfg = config.services.autopull;
autopull-type = lib.types.submodule {
enable = lib.mkEnableOption "autopull for ${cfg.name}";
options = {
enable = lib.mkEnableOption "autopull repo";
name = lib.mkOption {
type = lib.types.str;
default = config.module._args.name;
description = "A name for the service which needs to be pulled";
};
name = lib.mkOption {
type = lib.types.str;
default = config.module._args.name;
description = "A name for the service which needs to be pulled";
};
path = lib.mkOption {
type = lib.types.path;
description = "Path that needs to be updated via git pull";
};
path = lib.mkOption {
type = lib.types.path;
description = "Path that needs to be updated via git pull";
};
frequency = lib.mkOption {
type = lib.types.str;
description = "systemd-timer compatible time between pulls";
default = "1h";
};
frequency = lib.mkOption {
type = lib.types.str;
description = "systemd-timer compatible time between pulls";
default = "1h";
};
ssh-key = lib.mkOption {
type = lib.types.str;
default = "";
description = "ssh-key used to pull the repository";
};
ssh-key = lib.mkOption {
type = lib.types.str;
default = "";
description = "ssh-key used to pull the repository";
};
triggers-rebuild = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether or not the rebuild service should be triggered after pulling. Note that system.autoUpgrade must be pointed at the same directory as this service if you'd like to use this option.";
triggers-rebuild = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether or not the rebuild service should be triggered after pulling. Note that system.autoUpgrade must be pointed at the same directory as this service if you'd like to use this option.";
};
};
};
in
@ -55,10 +57,12 @@ in
repos = lib.filterAttrs (_: { enable, ... }: enable == true) cfg.repo;
in
lib.mkIf cfg.enable {
environment.systemPackages = [
pkgs.openssh
pkgs.git
];
environment.systemPackages =
[ pkgs.git ]
++ lib.optionals (lib.any (ssh-key: ssh-key != "") (lib.mapGetAttr "ssh-key" repos)) [
pkgs.openssh
];
systemd.services = lib.mapAttrs' (
repo:
{

View File

@ -1,4 +1,9 @@
{ config, pkgs, ... }:
{
config,
pkgs,
lib,
...
}:
{
imports = [
./programs.nix
@ -44,6 +49,14 @@
services.fprintd.enable = true;
services.openssh.enable = false;
services.autopull = {
enable = lib.mkDefault true;
repo.dotfiles = {
enable = lib.mkDefault true;
ssh-key = lib.mkDefault "/root/.ssh/id_ed25519_ghdeploy";
path = lib.mkDefault /root/dotfiles;
};
};
services.spotifyd = {
enable = true;
settings = {