Systemd : Migrate to Nix.
This commit is contained in:
parent
fea6c6e9fe
commit
f84c538758
22
.config/linux/nix/home/Backup.nix
Normal file
22
.config/linux/nix/home/Backup.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.backup = {
|
||||||
|
enable = true;
|
||||||
|
description = "Home system backup.";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "/root/app/bin/home/backup";
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.backup = {
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "*-*-* 06:00:00";
|
||||||
|
Persistent = true;
|
||||||
|
Unit = "backup.service";
|
||||||
|
};
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
};
|
||||||
|
}
|
22
.config/linux/nix/home/Nextcloud.nix
Normal file
22
.config/linux/nix/home/Nextcloud.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.nextcloud = {
|
||||||
|
enable = true;
|
||||||
|
description = "Nextcloud worker.";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "/root/app/bin/home/nextcloud";
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.nextcloud = {
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "hourly";
|
||||||
|
Persistent = false;
|
||||||
|
Unit = "nextcloud.service";
|
||||||
|
};
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
};
|
||||||
|
}
|
22
.config/linux/nix/home/PhotosProcess.nix
Normal file
22
.config/linux/nix/home/PhotosProcess.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.photos_process = {
|
||||||
|
enable = true;
|
||||||
|
description = "Process uploaded photos.";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "/root/app/bin/home/photos_process";
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.photos_process = {
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "daily";
|
||||||
|
Persistent = true;
|
||||||
|
Unit = "photos_process.service";
|
||||||
|
};
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
};
|
||||||
|
}
|
22
.config/linux/nix/home/YandexMusic.nix
Normal file
22
.config/linux/nix/home/YandexMusic.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.yandex_music = {
|
||||||
|
enable = true;
|
||||||
|
description = "Sync music from Yandex.Music.";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "/root/app/bin/home/yandex_music";
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.yandex_music = {
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "daily";
|
||||||
|
Persistent = true;
|
||||||
|
Unit = "yandex_music.service";
|
||||||
|
};
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=backup system
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/var/roothome/app/bin/home/backup
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=backup system
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=*-*-* 06:00:00
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=nextcloud maintenance
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/var/roothome/app/bin/home/nextcloud
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=nextcloud maintenance
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=hourly
|
|
||||||
Persistent=false
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=photos processing
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/var/roothome/app/bin/home/photos_process
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=process photos
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=daily
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=download music
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/var/roothome/app/bin/home/yandex_music
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=download music
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=daily
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
|
@ -1,12 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=limit battery charge to 40-80 percent
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/bin/bash -c '/usr/bin/echo 40 > /sys/class/power_supply/BAT0/charge_control_start_threshold; /usr/bin/echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold;'
|
|
||||||
ExecStop=/usr/bin/bash -c '/usr/bin/echo 95 > /sys/class/power_supply/BAT0/charge_control_end_threshold; /usr/bin/echo 90 > /sys/class/power_supply/BAT0/charge_control_start_threshold;'
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,12 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=disable amd boost
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/bin/bash -c '/usr/bin/echo 0 > /sys/devices/system/cpu/cpufreq/boost'
|
|
||||||
ExecStop=/usr/bin/bash -c '/usr/bin/echo 1 > /sys/devices/system/cpu/cpufreq/boost'
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,12 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=disable intel boost
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/bin/bash -c '/usr/bin/echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'
|
|
||||||
ExecStop=/usr/bin/bash -c '/usr/bin/echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo'
|
|
||||||
#Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
Reference in a new issue