From 93e01222a91b83da82fb9b86d5c81b82bb3aa6f7 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 5 Aug 2024 16:37:17 +0200 Subject: [PATCH] home: add timer for updating nix channels --- home/home.nix | 1 + home/services/nix-channel-update.nix | 30 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 home/services/nix-channel-update.nix diff --git a/home/home.nix b/home/home.nix index 0db3666..27948c9 100644 --- a/home/home.nix +++ b/home/home.nix @@ -24,6 +24,7 @@ in { ./programs/zsh ./services/git-maintenance.nix + ./services/nix-channel-update.nix ./modules/colors.nix ./modules/shellAliases.nix diff --git a/home/services/nix-channel-update.nix b/home/services/nix-channel-update.nix new file mode 100644 index 0000000..9eb43a7 --- /dev/null +++ b/home/services/nix-channel-update.nix @@ -0,0 +1,30 @@ +{ config, lib, ... }: +{ + # TODO: make these units run per channel + systemd.user.timers.update-nix-channels = { + Unit = { + Description = "Update nix channels"; + }; + + Timer = { + Unit = "update-nix-channels.service"; + OnCalendar = "daily"; + Persistent = true; + }; + + Install = { + WantedBy = [ "timers.target" ]; + }; + }; + + systemd.user.services.update-nix-channels = { + Unit = { + Description = "Update nix channels"; + }; + + Service = { + Type = "oneshot"; + ExecStart = "${config.nix.package}/bin/nix-channel --update --verbose"; + }; + }; +}