diff --git a/hosts/template/configuration.nix b/hosts/template/configuration.nix index 2a03ae3..851498a 100644 --- a/hosts/template/configuration.nix +++ b/hosts/template/configuration.nix @@ -35,6 +35,7 @@ time.timeZone = "Europe/Oslo"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.tarball-ttl = 0; environment.systemPackages = with pkgs; [ age vim diff --git a/hosts/template/hardware-configuration.nix b/hosts/template/hardware-configuration.nix index 58d03b0..92e312c 100644 --- a/hosts/template/hardware-configuration.nix +++ b/hosts/template/hardware-configuration.nix @@ -1,7 +1,17 @@ { config, lib, pkgs, modulesPath, ... }: { - boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront" ]; + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; diff --git a/hosts/template/scripts.nix b/hosts/template/scripts.nix index f174a5c..a9b61c1 100644 --- a/hosts/template/scripts.nix +++ b/hosts/template/scripts.nix @@ -8,11 +8,14 @@ let echo "Removing SSH host keys" rm -f /etc/ssh/ssh_host_* || true + echo "Restarting SSH" + systemctl restart sshd + echo "Removing temporary files" rm -rf /tmp/* || true echo "Removing logs" - rm -rf /var/log/* || true + journalctl --vacuum-time=1s || true echo "Removing cache" rm -rf /var/cache/* || true @@ -21,12 +24,9 @@ let rm -rf /var/lib/sops-nix || true mkdir -p /var/lib/sops-nix ${pkgs.age}/bin/age-keygen -o /var/lib/sops-nix/key.txt - - echo "Runing garbage collector" - ${pkgs.nix}/bin/nix-collect-garbage -d ''; in { environment.systemPackages = [ prepare-host-script ]; - users.motd = "Prepare host by running 'systemctl start prepare-host'."; + users.motd = "Prepare host by running 'prepare-host.sh'."; }