Skip to content

Commit

Permalink
feat(nixos): use rclone on backup jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Jan 9, 2024
1 parent 8b0fc22 commit 45699ce
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 52 deletions.
19 changes: 12 additions & 7 deletions machines/darkstar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@
};

systemd.services."backup" = {
path = [
pkgs.nix
path = with pkgs; [
rclone
curl
openssh
];
environment = {
NIX_PATH = "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos";
};
# TODO: use a proper backup tool... maybe restic?
script = ''
$HOME/Developer/backup.sh
rclone copy -v \
--no-update-modtime \
--exclude 'Go/' \
--exclude 'forks/' \
$HOME/Developer/ nas:/darkstar/
rclone copy $HOME/.localrc.fish nas:/darkstar/
rclone copy $HOME/.local/share/fish/fish_history nas:/darkstar/
curl -sf https://hc-ping.com/$(cat $HOME/Developer/.PING_ID)
'';
serviceConfig = {
Type = "oneshot";
Expand Down
45 changes: 45 additions & 0 deletions machines/supernova/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,49 @@
};
};
};

launchd.agents = {
pbcopy = {
enable = true;
config = {
Label = "localhost.pbcopy";
ProgramArguments = [ "/usr/bin/pbcopy" ];
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
EnvironmentVariables = { "LC_CTYPE" = "UTF-8"; };
inetdCompatibility = { Wait = false; };
Sockets = {
Listener = {
SockServiceName = "2224";
SockNodeName = "127.0.0.1";
};
};
};
};
pbpaste = {
enable = true;
config = {
Label = "localhost.pbpaste";
ProgramArguments = [ "/usr/bin/pbpaste" ];
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
inetdCompatibility = { Wait = false; };
EnvironmentVariables = { "LC_CTYPE" = "UTF-8"; };
Sockets = {
Listener = {
SockServiceName = "2225";
SockNodeName = "127.0.0.1";
};
};
};
};
};
}
45 changes: 0 additions & 45 deletions modules/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,6 @@
xdg-open-svc.enable = true;
};

launchd.agents = {
pbcopy = {
enable = true;
config = {
Label = "localhost.pbcopy";
ProgramArguments = [ "/usr/bin/pbcopy" ];
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
EnvironmentVariables = { "LC_CTYPE" = "UTF-8"; };
inetdCompatibility = { Wait = false; };
Sockets = {
Listener = {
SockServiceName = "2224";
SockNodeName = "127.0.0.1";
};
};
};
};
pbpaste = {
enable = true;
config = {
Label = "localhost.pbpaste";
ProgramArguments = [ "/usr/bin/pbpaste" ];
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
inetdCompatibility = { Wait = false; };
EnvironmentVariables = { "LC_CTYPE" = "UTF-8"; };
Sockets = {
Listener = {
SockServiceName = "2225";
SockNodeName = "127.0.0.1";
};
};
};
};
};

programs.fish.shellInit = ''
fish_add_path -a ~/Applications/Ghostty.app/Contents/MacOS/
fish_add_path -a /Applications/Postgres.app/Contents/Versions/latest/bin/
Expand Down

0 comments on commit 45699ce

Please sign in to comment.