added some of my own scripts declaratively

Enabling systemd units and timers of my scripts
This commit is contained in:
Danilo Reyes 2023-05-10 19:35:08 -06:00
parent acab8b3089
commit 9a4e6ed758
2 changed files with 652 additions and 563 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,6 @@
- [ ] Automatic updates
- [ ] Firewall ports
- [ ] Topgrade (perhaps unnecessary)
- [ ] SystemD services [4/5]
- [ ] Personal scripts [0/3]
- [ ] download
- [ ] Instagram
- [ ] startup tasks
- [ ] dotfiles [0/4]
- [ ] create a declarative Firefox or Librewolf install
- [ ] migrate config to home-manager
@ -53,6 +48,12 @@ let
unstable = import UNSTABLE_TARBALL {
config = config.nixpkgs.config;
};
nextcloud_scrapsync = pkgs.writeScriptBin
"nextcloud_scrapsync" (builtins.readFile ./scripts/nextcloud_scrapsync.sh);
manage_library = pkgs.writeScriptBin
"manage_library" (builtins.readFile ./scripts/manage_library.fish);
ffmpeg4discord = pkgs.writeScriptBin
"ffmpeg4discord" (builtins.readFile ./scripts/ffmpeg4discord.py);
in
{ # Remember to close this bracket at the end of the document
#+end_src
@ -358,6 +359,12 @@ tree-sitter # code parsing, required by Doom emacs
xdg-ninja # help declutter $HOME
torrenttools # create torrent files from the terminal!
lm_sensors # for extension, displays cpu temp
# My own scripts
nextcloud_scrapsync
ffmpeg4discord
manage_library
#+end_src
** DEVELOPMENT PACKAGES
@ -894,6 +901,35 @@ systemd.services = {
ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} down";
};
};
"nextcloud_scrapsync" = {
description = "Sync scrapped files with nextcloud";
wantedBy = [ "default.target" ];
path = [
pkgs.bash
nextcloud_scrapsync
];
serviceConfig = {
RestartSec = 30;
ExecStart = "${nextcloud_scrapsync}/bin/nextcloud_scrapsync";
};
};
};
systemd.timers = {
"nextcloud_scrapsync" = {
enable = true;
description = "Sync scrapped files with nextcloud";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar= [
"*-*-* 01:32:00"
"*-*-* 08:32:00"
"*-*-* 14:32:00"
"*-*-* 20:32:00"
];
RandomizedDelaySec = 30;
Persistent = true;
};
};
};
systemd.user.services = {
"HentaiAtHome" = {
@ -911,6 +947,21 @@ systemd.user.services = {
ExecStart = "${pkgs.HentaiAtHome}/bin/HentaiAtHome";
};
};
"manage_library" = {
enable = true;
restartIfChanged = true;
description = "Run the manage library fish script";
wantedBy = [ "default.target" ];
path = [
pkgs.fish
manage_library
];
serviceConfig = {
Restart = "on-failure";
RestartSec = 30;
ExecStart = "${manage_library}/bin/manage_library";
};
};
};
#+end_src
@ -934,7 +985,7 @@ accidentally delete configuration.nix.
#+begin_src nix
system.copySystemConfiguration = true;
nix.gc = {
enable = true;
automatic = true;
dates = "weekly";
};
#+end_src