From c36d1aeaa3fbd75422dc8371f7d0fbcb32550e91 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 28 Jul 2025 02:11:41 +0100 Subject: [PATCH] Move dev-commit configuration --- home-manager/opdavies/t480.nix | 20 ------- modules/home-manager/default.nix | 1 - modules/home-manager/dev-commit.nix | 93 ----------------------------- modules2/dev-commit.nix | 83 +++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 114 deletions(-) delete mode 100644 modules/home-manager/dev-commit.nix create mode 100644 modules2/dev-commit.nix diff --git a/home-manager/opdavies/t480.nix b/home-manager/opdavies/t480.nix index 2a3b806f..6f2ca71b 100644 --- a/home-manager/opdavies/t480.nix +++ b/home-manager/opdavies/t480.nix @@ -14,26 +14,6 @@ }; programs = { - dev-commit = { - enable = false; - - repoPaths = - let - personal = "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/personal"; - in - [ - "${personal}/email-filters" - "${personal}/nix-config" - "${personal}/oliverdavies.uk" - "${personal}/opentofu-dns" - ]; - - schedule = { - enable = true; - time = "daily"; - }; - }; - zsh.shellAliases = let inherit (config.xdg.userDirs) documents; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 9c8c6058..56240fc8 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,6 +1,5 @@ { imports = [ - ./dev-commit.nix ./starship.nix ./zsh ]; diff --git a/modules/home-manager/dev-commit.nix b/modules/home-manager/dev-commit.nix deleted file mode 100644 index 823420ed..00000000 --- a/modules/home-manager/dev-commit.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -with lib; - -let - cfg = config.programs.dev-commit; - repoPaths = concatStringsSep ":" cfg.repoPaths; -in -{ - options.programs.dev-commit = { - enable = mkEnableOption "Enable dev-commit"; - - repoPaths = mkOption { - default = [ ]; - description = "A list of repository paths that should have automated commits"; - type = types.listOf types.path; - }; - - schedule = mkOption { - type = types.submodule { - options = { - enable = mkEnableOption "Enable automated dev commits with systemd"; - - time = mkOption { - description = '' - Time expression for when to run the dev-commit job. - - This uses systemd's `OnCalendar` syntax. - - Examples: - - "hourly" (once every hour) - - "daily" (once per day at midnight) - - "Mon *-*-01 12:00:00" (every Monday at 12:00 PM) - - See `man systemd.time` for full syntax reference. - ''; - default = "hourly"; - type = types.str; - }; - }; - }; - - default = { - enable = false; - time = "hourly"; - }; - }; - }; - - config = mkIf cfg.enable { - home = { - packages = [ - pkgs.dev-commit - ]; - - sessionVariables.DEV_COMMIT_PATHS = repoPaths; - }; - - systemd.user = mkIf cfg.schedule.enable { - services.dev-commit = { - Install.WantedBy = [ "default.target" ]; - - Service = { - Environment = [ - "DEV_COMMIT_PATHS=${repoPaths}" - ]; - - ExecStart = "${lib.getExe pkgs.dev-commit}"; - - Type = "oneshot"; - }; - - Unit.Description = "dev-commit"; - }; - - timers.dev-commit = { - Install.WantedBy = [ "timers.target" ]; - - Timer = { - OnCalendar = cfg.schedule.time; - Unit = "dev-commit.service"; - }; - - Unit.Description = "Runs automated development commits in select project repositories."; - }; - }; - }; -} diff --git a/modules2/dev-commit.nix b/modules2/dev-commit.nix new file mode 100644 index 00000000..06740026 --- /dev/null +++ b/modules2/dev-commit.nix @@ -0,0 +1,83 @@ +{ lib, ... }: + +{ + flake.modules.homeManager.base = + { config, pkgs, ... }: + { + options.programs.dev-commit = { + repoPaths = lib.mkOption { + default = [ ]; + description = "A list of repository paths that should have automated commits"; + type = lib.types.listOf lib.types.path; + }; + + schedule = lib.mkOption { + type = lib.types.submodule { + options = { + enable = lib.mkEnableOption "Enable automated dev commits with systemd"; + + time = lib.mkOption { + description = '' + Time expression for when to run the dev-commit job. + + This uses systemd's `OnCalendar` syntax. + + Examples: + - "hourly" (once every hour) + - "daily" (once per day at midnight) + - "Mon *-*-01 12:00:00" (every Monday at 12:00 PM) + + See `man systemd.time` for full syntax reference. + ''; + default = "hourly"; + type = lib.types.str; + }; + }; + }; + + default = { + enable = false; + time = "hourly"; + }; + }; + }; + + config = + let + cfg = config.programs.dev-commit; + repoPaths = lib.concatStringsSep ":" cfg.repoPaths; + in + { + home = { + packages = [ pkgs.dev-commit ]; + + sessionVariables.DEV_COMMIT_PATHS = repoPaths; + }; + + systemd.user = lib.mkIf cfg.schedule.enable { + services.dev-commit = { + Install.WantedBy = [ "default.target" ]; + + Service = { + Environment = [ "DEV_COMMIT_PATHS=${repoPaths}" ]; + ExecStart = "${lib.getExe pkgs.dev-commit}"; + Type = "oneshot"; + }; + + Unit.Description = "dev-commit"; + }; + + timers.dev-commit = { + Install.WantedBy = [ "timers.target" ]; + + Timer = { + OnCalendar = cfg.schedule.time; + Unit = "dev-commit.service"; + }; + + Unit.Description = "Runs automated development commits in select project repositories."; + }; + }; + }; + }; +}