diff --git a/nix/host.nix b/nix/host.nix index 0613fe2..395898e 100644 --- a/nix/host.nix +++ b/nix/host.nix @@ -44,7 +44,7 @@ in wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" "systemd-machined.service" ]; wants = [ "network-online.target" ]; - path = [ pkgs.systemd pkgs.btrfs-progs ]; + path = [ pkgs.systemd pkgs.btrfs-progs pkgs.e2fsprogs ]; serviceConfig = { ExecStart = "${self.packages.${pkgs.stdenv.hostPlatform.system}.default}/bin/slackerbot -mode ${cfg.mode} -config ${cfg.configFile}"; EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile; diff --git a/slackerbot/internal/local/local.go b/slackerbot/internal/local/local.go index 5dc24d4..65710f6 100644 --- a/slackerbot/internal/local/local.go +++ b/slackerbot/internal/local/local.go @@ -159,6 +159,8 @@ func (l *Local) Start(ctx context.Context, spec node.StartSpec) error { // Only the home folder persists. NixOS rebuilds the rest on boot. root := filepath.Join(l.cfg.MachinesDir, spec.Machine) + // NixOS marks /var/empty immutable, which blocks RemoveAll. + _ = exec.Command("chattr", "-i", filepath.Join(root, "var/empty")).Run() if err := os.RemoveAll(root); err != nil { return fmt.Errorf("clearing old container files: %w", err) }