mirror of
https://codeberg.org/muon/home.git
synced 2025-12-06 08:07:45 +00:00
Add muin install host
This commit is contained in:
parent
23c45b8800
commit
4750f4ea9d
9 changed files with 375 additions and 95 deletions
114
hosts/muin/home.nix
Normal file
114
hosts/muin/home.nix
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
osConfig,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
cfg = osConfig.mods;
|
||||
installScript = pkgs.writeShellApplication {
|
||||
name = "install-flake";
|
||||
text = ''
|
||||
echo "Cloning config..."
|
||||
git clone https://codeberg.org/muon/home
|
||||
cd home
|
||||
nvim hosts/"$(hostname)"/disk-config.nix
|
||||
|
||||
echo "Running disko..."
|
||||
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount hosts/"$(hostname)"/disk-config.nix
|
||||
|
||||
echo "Making blank root snapshot..."
|
||||
sudo mkdir -p /tmp/mnt
|
||||
sudo mount /dev/mapper/crypted /tmp/mnt
|
||||
sudo btrfs subvolume snapshot -r /tmp/mnt/root /tmp/mnt/root-blank
|
||||
sudo umount /tmp/mnt
|
||||
|
||||
echo "Retrieving sops key..."
|
||||
rbw config set email admin@muon.host
|
||||
rbw config set base_url https://vault.muon.host
|
||||
rbw login
|
||||
|
||||
sudo mkdir -p /persist/var/lib/sops-nix
|
||||
rbw get sops > /mnt/persist/var/lib/sops-nix/key.txt
|
||||
sudo chown muon:users /mnt/persist/var/lib/sops-nix -R
|
||||
|
||||
echo "Setting hardware config..."
|
||||
sudo nixos-generate-config --no-filesystems --root /mnt
|
||||
cp /mnt/etc/nixos/hardware-configuration.nix hosts/"$(hostname)"/hardware-configuration.nix
|
||||
|
||||
echo "Installing NixOS config..."
|
||||
sudo nixos-install --root /mnt --no-root-passwd --flake .#"$(hostname)"
|
||||
|
||||
echo "Edit persistent filesystem..."
|
||||
PERSIST="$HOME/persist"
|
||||
nvim "$PERSIST"
|
||||
|
||||
echo "Copying persistent filesystem..."
|
||||
make_persist() {
|
||||
F="/mnt$1"
|
||||
P="/mnt/persist$1"
|
||||
if [[ -d "$F" ]]; then
|
||||
mkdir -p "$F" "$P"
|
||||
elif [[ -f "$F" ]]; then
|
||||
mkdir -p "$(dirname "$F")" "$(dirname "$P")"
|
||||
else
|
||||
echo "Error: $F does not exist!"
|
||||
return 1
|
||||
fi
|
||||
cp -r "$F" "$P"
|
||||
}
|
||||
grep -v '^#' "$PERSIST" | while read -r file ; do
|
||||
make_persist "$file"
|
||||
done
|
||||
'';
|
||||
};
|
||||
in {
|
||||
# Install
|
||||
home.file.persist = {
|
||||
target = "persist.txt";
|
||||
text = ''
|
||||
/var/lib/nixos
|
||||
/var/lib/systemd/coredump
|
||||
/etc/NetworkManager
|
||||
/var/lib/NetworkManager
|
||||
/etc/machine-id
|
||||
'';
|
||||
};
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
installScript
|
||||
]
|
||||
# Modules
|
||||
++ [
|
||||
pulseaudio
|
||||
pavucontrol
|
||||
alsa-utils
|
||||
];
|
||||
|
||||
mods.xdg.enable = true;
|
||||
mods.i3.enable = true;
|
||||
mods.battery.enable = true;
|
||||
mods.terminal.zsh.enable = true;
|
||||
mods.terminal.emulator.enable = true;
|
||||
mods.terminal.development.enable = true;
|
||||
mods.terminal.tools.enable = true;
|
||||
mods.desktop.development.enable = true;
|
||||
mods.desktop.productivity.enable = false;
|
||||
|
||||
# Hardware preferences
|
||||
## Monitors
|
||||
services.autorandr.enable = true;
|
||||
programs.autorandr = {
|
||||
enable = true;
|
||||
hooks.postswitch = {
|
||||
"notify-i3" = "${pkgs.i3}/bin/i3-msg restart";
|
||||
"set-wallpaper" = ''
|
||||
${lib.getExe pkgs.feh} --bg-fill --nofehbg ${./wallpaper.png}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Version of first install
|
||||
home.stateVersion = "23.05";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue