feat: erase your darlings

This commit is contained in:
KoenDR06 2026-03-24 01:29:01 +01:00
parent d8653015d5
commit 34e69262ff
4 changed files with 51 additions and 25 deletions

View file

@ -1,22 +0,0 @@
# TO DO
- Create option that enables the symlinks and such
- make default user have a hashedPasswordFile
## Option
```nix
# duh, nixos directory needs to be persistent
# and machine idrk why but the guide has it lmao
environment.etc = {
nixos.source = "/persist/etc/nixos";
machine-id.source = "/persist/etc/machine-id";
};
# This gets erased and it's really annoying to see the lecture everytime
security.sudo.extraConfig = ''
Defaults lecture = never
'';
```

View file

@ -1,5 +1,13 @@
#!/bin/sh
DISK=/dev/null DISK=/dev/null
set -e
if [ $DISK == "/dev/null" ]; then
return 1
fi
# Create two partitions here: p1 and p2 # Create two partitions here: p1 and p2
fdisk $DISK fdisk $DISK
@ -7,7 +15,7 @@ fdisk $DISK
mkfs.vfat -n BOOT ${DISK}p1 mkfs.vfat -n BOOT ${DISK}p1
mkfs.btrfs -L ROOT ${DISK}p2 mkfs.btrfs -L ROOT ${DISK}p2
mount -t btrfs ${DISK}p2 mount -t btrfs ${DISK}p2 /mnt
# Creates btrfs subvolumes # Creates btrfs subvolumes
btrfs subvolume create /mnt/root btrfs subvolume create /mnt/root
@ -50,6 +58,17 @@ nixos-generate-config --root /mnt
# Add `neededForBoot = true;` to the logging subvolume # Add `neededForBoot = true;` to the logging subvolume
nano /mnt/etc/nixos/hardware-configuration.nix nano /mnt/etc/nixos/hardware-configuration.nix
echo "Initial setup complete :D" echo "Initial setup complete :D" &&
nixos-install echo "Installing in 5" &&
sleep 1 &&
echo "Installing in 4" &&
sleep 1 &&
echo "Installing in 3" &&
sleep 1 &&
echo "Installing in 2" &&
sleep 1 &&
echo "Installing in 1" &&
sleep 1 &&
echo "Installing now"
nixos-install &&
reboot reboot

View file

@ -3,5 +3,6 @@
./nix.nix ./nix.nix
./locale.nix ./locale.nix
./secrets.nix ./secrets.nix
./erase-your-darlings.nix
]; ];
} }

View file

@ -0,0 +1,28 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.base.erase-your-darlings;
in {
options = {
horseman.base.erase-your-darlings = {
enable = mkEnableOption "If set, assumes the machine has been set up as a Erase Your Darlings device";
};
};
config = mkIf cfg.enable {
environment.etc = {
nixos.source = "/persist/etc/nixos";
machine-id.source = "/persist/etc/machine-id";
};
security.sudo.extraConfig = ''
Defaults lecture = never
'';
};
}