yep, more dotfiles

feat: restic gdrive backup works

+1
.gitattributes
···
+
*.age -text -diff
+6
flake.nix
···
baseModules = [
./nixos/configuration.nix
disko.nixosModules.disko
+
+
agenix.nixosModules.default
+
./secrets
+
{ age.identityPaths = [ "/home/milomoisson/.ssh/id_ed25519" ]; }
+
];
in
{
···
# Nix colors
nix-colors.homeManagerModules.default
{ colorScheme = nix-colors.colorSchemes.onedark; }
+
./secrets
# Unstable module taken from master branch
-1
home-manager/default.nix
···
homeDirectory = "/home/milomoisson";
sessionVariables = {
-
EDITOR = "${pkgs.helix}/bin/hx";
XDG_DESKTOP_DIR = "$HOME";
};
+5
home-manager/shell.nix
···
{ config, lib, pkgs, ... }:
+
with lib;
+
{
config = {
programs.nix-index.enableFishIntegration = false;
programs.nix-index-database.comma.enable = true;
programs.starship.enable = true;
+
+
# Assumes that helix is installed, use configured version of helix
+
sessionVariables.EDITOR = "hx";
programs.helix = {
enable = true;
-1
modules/home-manager/default.nix
···
-
{ }
-6
modules/nixos/default.nix
···
-
# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
-
# These should be stuff you would like to share with others, not your personal configurations.
-
{
-
# List your module files here
-
# my-module = import ./my-module.nix;
-
}
+63 -4
nixos/configuration.nix
···
, ...
}:
+
let
+
+
hostname = "archaic-wiro-laptop";
+
main-user = "milomoisson";
+
+
in
{
# Hardware is imported in the flake to be machine specific
···
services.blueman.enable = true;
-
# TODO: should be configurable
-
networking.hostName = "archaic-wiro-laptop";
+
networking.hostName = hostname;
networking.networkmanager.enable = true;
networking.nameservers = [ "1.1.1.1" "8.8.8.8" "9.9.9.9" ];
···
services.udev.packages = with pkgs; [ numworks-udev-rules ];
-
services.transmission.enable = true;
-
services.devmon.enable = true;
# security.sudo-rs.enable = true;
+
+
services.restic.backups = {
+
# Backup documents and repos code
+
google-drive = {
+
repository = "rclone:googledrive:/Backups/${hostname}";
+
initialize = true;
+
passwordFile = config.age.secrets.restic-backup-pass.path;
+
rcloneConfigFile = config.age.secrets.googledrive-rclone-config.path;
+
+
paths = [
+
"/home/${main-user}/Documents"
+
# Equivalent of `~/Developement` but needs extra handling as explained below
+
"/home/${main-user}/.local/backup/repos"
+
];
+
+
# Extra handling for Developement folder to respect `.gitignore` files.
+
#
+
# Backup folder sould be stored somewhere to avoid changing ctimes
+
# which would cause otherwise unchanged files to be backed up again.
+
# Since `--link-dest` is used, file contents won't be duplicated on disk.
+
backupPrepareCommand = ''
+
# Remove stale Restic locks
+
${pkgs.restic}/bin/restic unlock || true
+
+
${pkgs.rsync}/bin/rsync \
+
${"\\" /* Archive mode and delete files that are not in the source directory. `--mkpath` is like `mkdir`'s `-p` option */}
+
--archive --delete --mkpath \
+
${"\\" /* `:-` operator uses .gitignore files as exclude patterns */}
+
--filter=':- .gitignore' \
+
${"\\" /* Exclude nixpkgs repository because they have some weird symlink test files that break rsync */}
+
--exclude 'nixpkgs' \
+
${"\\" /* Hardlink files to avoid taking up more space */}
+
--link-dest=/home/${main-user}/Developement \
+
/home/${main-user}/Developement/ /home/${main-user}/.local/backup/repos
+
'';
+
+
pruneOpts = [
+
"--keep-daily 7"
+
"--keep-weekly 5"
+
"--keep-yearly 10"
+
];
+
+
timerConfig = {
+
OnCalendar = "00:05";
+
RandomizedDelaySec = "5h";
+
};
+
};
+
+
# Backup documents and large files
+
archaic-bak = {
+
initialize = true;
+
passwordFile = config.age.secrets.restic-backup-pass.path;
+
paths = [ "/home/${main-user}/Documents" ];
+
repository = "/mnt/${main-user}/ArchaicBak/Backups/${hostname}";
+
};
+
};
security.polkit.enable = true;
+4
secrets.nix
···
+
with (import <nixpkgs> { }).lib;
+
+
# You can use agenix directly at repo top-level instead of having to change directory into `secrets/`
+
mapAttrs' (name: value: nameValuePair ("secrets/" + name) value) (import ./secrets/secrets.nix)
secrets/CA5E-pgp-key.age secrets/ca5e.pgp.age
+5 -1
secrets/default.nix
···
{ ... }: {
age.secrets = {
-
pgpkey.file = ./CA5E-pgp-key.age;
+
ca5e-pgp.file = ./ca5e.pgp.age;
+
digital-ocean-api-key.file = ./digital-ocean.api.age;
+
gitguardian-api-key.file = ./gitguardian.api.age;
+
googledrive-rclone-config.file = ./googledrive.rclone.conf.age;
+
restic-backup-pass.file = ./restic-backup-pass.age;
};
}
+9
secrets/digital-ocean.api.age
···
+
age-encryption.org/v1
+
-> ssh-ed25519 DWUMEg reEdVzxYz5QZCdMvyVmWUlD/ui7sLLPEMc3GfwEGB0g
+
U6d234wTLkGy7PfromprYQWXKoO+gH27anOWDoILQr8
+
-> ssh-ed25519 mD0GXg 8z1RwOEOdpB1jGGLXlGhxDWy5IfiusCVQRVMKPJZ9Rc
+
CLXlaLacZvfoUJhBe6YIYOVyD5QBh4ZRRT8KyubGCSA
+
-> f_5^WIqj-grease R<P{)k|; OqHai["
+
zQLmCvYmo7np
+
--- vwkdn7MBo3ZzmDy5XbFmApvSjuyODUpxinogkipBnIg
+
����1�r��#�d ���� �Pjv�M��uMT,���)��Jv5` �J0I�l���ԇ��6��!���~.���3�`X��3�����5�f3V��g���ṗR
+10
secrets/gitguardian.api.age
···
+
age-encryption.org/v1
+
-> ssh-ed25519 DWUMEg XUsbw6lJyEwjlm/ryJPxgXyuxVxSulxMJrj9O8lyez8
+
sruC1qWAUmmU+RRLXHceSj2WcGNvTnuJRj4PNmeXAOI
+
-> ssh-ed25519 mD0GXg C7ZaleNCU3CsA575jl+1c5m0HEu2gRrBPDb4SD4Ih1M
+
11pE2VNcBaxfQVl5tDVCHiRpTc4FwlRGIH2j+Dku010
+
-> :Z/*-grease 3q&-@ (CBZm^\U "Lz40w4 *
+
DJXSQtHrsXYIJMoAz0rd11H+VkYFcNceyUdG8DBDsM2Rozhcr9lQ/mm37ovpnG7s
+
ptZL3pv9hwkhol1g6xfPGI+WQEUGqg
+
--- 2J3mk+XgQyte/sBGBIo8K/NHWK/F5AE9MLlrDHPXLVU
+
l��8YU��{o"D��p�2�9��^6xG�n?@�gM!�p�p��C6��� �-���g[F�r]���=)3I��:���~D�7������/z{�t�XaB��
secrets/googledrive.rclone.conf.age

This is a binary file and will not be displayed.

+12
secrets/restic-backup-pass.age
···
+
age-encryption.org/v1
+
-> ssh-ed25519 DWUMEg +4mwaHwNPkR4G3AFJcLFg1HzPUr8A67lVpKdptQW3Bw
+
qMBv5PGUu6To3u+5TJ5lo5nK2ohpq4d7iNWRB/N9F3E
+
-> ssh-ed25519 mD0GXg Y064QWZwXKGuk3GJYh6XS9hJDiEVPWXFdQpEo09OTAc
+
CU6+RWfq3l+bbQLmiEkNM4QegFmuTzfkgLBZ+opHGts
+
-> {{?J`j^-grease h.# P je 'U;)
+
Z1Qd+CJcS7B/JDDtN9qUBLTe/NV0o9F44x2TWc5ZScr0IqtXxz0s0sOtG71p++in
+
SOhB+jUWwmdcz+8jr9t+XUgsSmOKCrG9bSDF8cciGTK/c2sO/KN1OW/l8iafr6Ho
+
HA
+
--- dYmIGBMEIznFoZbqcVlqOe6Y6LiUXHqC/Wi+QgWDrus
+
-[���� :f �Bt�Aw �*|_7�Z[�� G�`�*!����A���m�iiD��]ж�]�uF� Z^���������'���� `��R�����@�H� �A��dq�Ƶ�#����Z}�! ~����[
+
xg&�U.܄��-S��9��mv_�D��$�]�q�E�� ? �O���_�ƈp)���{x0���@z
+5 -1
secrets/secrets.nix
···
systems = [ old-neo archaic ];
in
{
-
"CA5E-pgp-key.age".publicKeys = systems;
+
"ca5e.pgp.age".publicKeys = systems;
+
"digital-ocean.api.age".publicKeys = systems;
+
"gitguardian.api.age".publicKeys = systems;
+
"googledrive.rclone.conf.age".publicKeys = systems;
+
"restic-backup-pass.age".publicKeys = systems;
}