From 30679f9f4b4a0905885d59d9c012072b4d54b61c Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Sun, 2 Jun 2024 22:01:17 +0100 Subject: [PATCH] sodium: add cache directory on the sd card --- hosts/sodium.pop.ts.hillion.co.uk/default.nix | 19 ++++++++++++++++++- .../hardware-configuration.nix | 7 +++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/hosts/sodium.pop.ts.hillion.co.uk/default.nix b/hosts/sodium.pop.ts.hillion.co.uk/default.nix index 73386f7..9a2961e 100644 --- a/hosts/sodium.pop.ts.hillion.co.uk/default.nix +++ b/hosts/sodium.pop.ts.hillion.co.uk/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, nixos-hardware, ... }: +{ config, pkgs, nixpkgs-unstable, lib, nixos-hardware, ... }: { imports = [ @@ -23,6 +23,23 @@ ## Impermanence custom.impermanence.enable = true; + boot.initrd.postDeviceCommands = lib.mkAfter '' + btrfs subvolume delete /cache/tmp + btrfs subvolume snapshot /cache/empty_snapshot /cache/tmp + chmod 0777 /cache/tmp + chmod +t /cache/tmp + ''; + + ### nix only supports build-dir from 2.22. bind mount /tmp to something persistent instead. + fileSystems."/tmp" = { + device = "/cache/tmp"; + options = [ "bind" ]; + }; + # nix = { + # settings = { + # build-dir = "/cache/tmp/"; + # }; + # }; ## Custom Services custom.locations.autoServe = true; diff --git a/hosts/sodium.pop.ts.hillion.co.uk/hardware-configuration.nix b/hosts/sodium.pop.ts.hillion.co.uk/hardware-configuration.nix index 40b1764..925aafb 100644 --- a/hosts/sodium.pop.ts.hillion.co.uk/hardware-configuration.nix +++ b/hosts/sodium.pop.ts.hillion.co.uk/hardware-configuration.nix @@ -42,6 +42,13 @@ options = [ "subvol=data" ]; }; + fileSystems."/cache" = + { + device = "/dev/disk/by-uuid/48ae82bd-4d7f-4be6-a9c9-4fcc29d4aac0"; + fsType = "btrfs"; + options = [ "subvol=cache" ]; + }; + swapDevices = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking