Fix template configs

This commit is contained in:
Torjus Håkestad 2024-03-13 22:35:52 +01:00
parent e38d6f44a5
commit 494b96ac5b
3 changed files with 17 additions and 6 deletions

View File

@ -35,6 +35,7 @@
time.timeZone = "Europe/Oslo"; time.timeZone = "Europe/Oslo";
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.tarball-ttl = 0;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
age age
vim vim

View File

@ -1,7 +1,17 @@
{ config, lib, pkgs, modulesPath, ... }: { 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.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];

View File

@ -8,11 +8,14 @@ let
echo "Removing SSH host keys" echo "Removing SSH host keys"
rm -f /etc/ssh/ssh_host_* || true rm -f /etc/ssh/ssh_host_* || true
echo "Restarting SSH"
systemctl restart sshd
echo "Removing temporary files" echo "Removing temporary files"
rm -rf /tmp/* || true rm -rf /tmp/* || true
echo "Removing logs" echo "Removing logs"
rm -rf /var/log/* || true journalctl --vacuum-time=1s || true
echo "Removing cache" echo "Removing cache"
rm -rf /var/cache/* || true rm -rf /var/cache/* || true
@ -21,12 +24,9 @@ let
rm -rf /var/lib/sops-nix || true rm -rf /var/lib/sops-nix || true
mkdir -p /var/lib/sops-nix mkdir -p /var/lib/sops-nix
${pkgs.age}/bin/age-keygen -o /var/lib/sops-nix/key.txt ${pkgs.age}/bin/age-keygen -o /var/lib/sops-nix/key.txt
echo "Runing garbage collector"
${pkgs.nix}/bin/nix-collect-garbage -d
''; '';
in in
{ {
environment.systemPackages = [ prepare-host-script ]; environment.systemPackages = [ prepare-host-script ];
users.motd = "Prepare host by running 'systemctl start prepare-host'."; users.motd = "Prepare host by running 'prepare-host.sh'.";
} }