Add automatic HM cleanup

This commit is contained in:
albert 2024-04-25 21:51:20 +09:00
parent cd51f5b55b
commit e4d2625adf
No known key found for this signature in database
GPG key ID: 64F6C4EB46C4543A
5 changed files with 85 additions and 53 deletions

View file

@ -960,15 +960,16 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1713946567, "lastModified": 1714022840,
"narHash": "sha256-gbffQxWoGmq9rmSwM2y4a+VGaTTuXSN+yyRoCkMuRjs=", "narHash": "sha256-i6xZsf7Kvp1n/Sn3nqPY1MJQx0gf80OGQw32PA/aZd8=",
"owner": "Jovian-Experiments", "owner": "Jovian-Experiments",
"repo": "Jovian-NixOS", "repo": "Jovian-NixOS",
"rev": "c3255d642c945847c61a867be15de63b8f81d5dc", "rev": "94def3af1d45fe4b142beda3aa59a6a98e62ce9e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "Jovian-Experiments", "owner": "Jovian-Experiments",
"ref": "development",
"repo": "Jovian-NixOS", "repo": "Jovian-NixOS",
"type": "github" "type": "github"
} }

View file

@ -89,11 +89,11 @@
osaka-linode-01 = libx.deploy { hostname = "osaka-linode-01"; }; osaka-linode-01 = libx.deploy { hostname = "osaka-linode-01"; };
milan-linode-01 = libx.deploy { hostname = "milan-linode-01"; }; milan-linode-01 = libx.deploy { hostname = "milan-linode-01"; };
framework-server = libx.deploy { hostname = "framework-server"; }; framework-server = libx.deploy { hostname = "framework-server"; };
# nuc-server = libx.deploy { hostname = "nuc-server"; }; # nuc-server = libx.deploy { hostname = "nuc-server"; };
backups-rpi4 = libx.deploy { hostname = "backups-rpi4"; system = "aarch64-linux"; }; backups-rpi4 = libx.deploy { hostname = "backups-rpi4"; system = "aarch64-linux"; };
piaware-rpi4 = libx.deploy { hostname = "piaware-rpi4"; system = "aarch64-linux"; }; piaware-rpi4 = libx.deploy { hostname = "piaware-rpi4"; system = "aarch64-linux"; };
# quitman-rpi4 = libx.deploy { hostname = "quitman-rpi4"; system = "aarch64-linux"; }; # quitman-rpi4 = libx.deploy { hostname = "quitman-rpi4"; system = "aarch64-linux"; };
# bakersfield-rpi4 = libx.deploy { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; }; # bakersfield-rpi4 = libx.deploy { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; };
}; };
imageConfigurations = { imageConfigurations = {
nixos-linode-img = libx.mkMinImage { hostname = "nixos-linode-img"; format = "linode"; }; nixos-linode-img = libx.mkMinImage { hostname = "nixos-linode-img"; format = "linode"; };

View file

@ -26,6 +26,11 @@
stateVersion = hmStateVersion; stateVersion = hmStateVersion;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
sessionPath = [ "$HOME/.local/bin" ]; sessionPath = [ "$HOME/.local/bin" ];
nix.gc = {
automatic = true;
frequency = "daily";
options = "--delete-older-than 7d";
};
}; };
nixpkgs = { nixpkgs = {

View file

@ -1,6 +1,6 @@
{ inputs, config, lib, username, pkgs, ... }: { { inputs, config, lib, pkgs, ... }: {
imports = [ imports = [
# inputs.jovian.nixosModules inputs.jovian.nixosModules
./disks.nix ./disks.nix
../../common/modules/boot.nix ../../common/modules/boot.nix
../../common/services/tailscale-autoconnect.nix ../../common/services/tailscale-autoconnect.nix

View file

@ -2,49 +2,75 @@
services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.enable = true;
services.btrfs.autoScrub.interval = "weekly"; services.btrfs.autoScrub.interval = "weekly";
disko.devices.disk.nvme0 = { disko.devices = {
type = "disk"; nvme0 = {
device = "/dev/nvme0n1"; type = "disk";
content = { device = "/dev/nvme0n1";
type = "gpt"; content = {
partitions = { type = "gpt";
BOOT = { partitions = {
priority = 1; BOOT = {
name = "BOOT"; priority = 1;
start = "0%"; name = "BOOT";
end = "550MiB"; start = "0%";
type = "EF00"; end = "550MiB";
content = { type = "EF00";
type = "filesystem"; content = {
format = "vfat"; type = "filesystem";
# https://github.com/nix-community/disko/issues/527 format = "vfat";
mountOptions = [ "umask=0077" ]; # https://github.com/nix-community/disko/issues/527
mountpoint = "/boot"; mountOptions = [ "umask=0077" ];
}; mountpoint = "/boot";
}; # partition 1 (ESP) };
ROOT = { }; # partition 1 (ESP)
start = "550MiB"; ROOT = {
end = "100%"; start = "550MiB";
content = { end = "100%";
type = "btrfs"; content = {
extraArgs = [ "-f" ]; type = "btrfs";
subvolumes = { extraArgs = [ "-f" ];
"/root" = { subvolumes = {
mountpoint = "/"; "/root" = {
mountOptions = [ "compress=zstd" "noatime" ]; mountpoint = "/";
}; # root mountOptions = [ "compress=zstd" "noatime" ];
"/home" = { }; # root
mountpoint = "/home"; "/home" = {
mountOptions = [ "compress=zstd" "noatime" ]; mountpoint = "/home";
}; # home mountOptions = [ "compress=zstd" "noatime" ];
"/nix" = { }; # home
mountpoint = "/nix"; "/nix" = {
mountOptions = [ "compress=zstd" "noatime" ]; mountpoint = "/nix";
}; # nix mountOptions = [ "compress=zstd" "noatime" ];
}; # subvolumes }; # nix
}; # content }; # subvolumes
}; # partition 2 (/ BTRFS) }; # content
}; # partitions }; # partition 2 (/ BTRFS)
}; # content }; # partitions
}; # disko.devices.disk.nvme0 }; # content
}; # disko.devices.disk.nvme0
mmcblk0 = {
type = "disk";
device = "/dev/mmcblk0";
content = {
type = "gpt";
partitions = {
SD_CARD = {
start = "0%";
end = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/sd_card" = {
mountpoint = "/sd_card";
mountOptions = [ "compress=none" "noatime" ];
}; # sd_card
}; # subvolumes
}; # content
}; # partition 2 (SD_CARD BTRFS)
}; # partitions
}; # content
}; # disko.devices.disk.mmcblk0
}; # disko.devices
} # root } # root