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
40
hosts/muin/configuration.nix
Normal file
40
hosts/muin/configuration.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
inputs,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
# Hardware
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
(inputs.nixpkgs
|
||||
+ "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
];
|
||||
|
||||
# System
|
||||
mods.user.name = "muon";
|
||||
networking.hostName = "murk";
|
||||
networking.hostId = "a2309090";
|
||||
mods.home.file = ./home.nix;
|
||||
|
||||
# Modules
|
||||
mods.desktop.enable = true;
|
||||
mods.boot.enable = false;
|
||||
|
||||
mods.theme.enable = true;
|
||||
mods.theme.scheme = "woodland";
|
||||
mods.theme.wallpaper = ./wallpaper.png;
|
||||
|
||||
services.xserver.windowManager.i3.enable = true;
|
||||
|
||||
# Hardware preferences
|
||||
environment.variables = {
|
||||
WINIT_HIDPI_FACTOR = "1";
|
||||
WINIT_X11_SCALE_FACTOR = "1";
|
||||
};
|
||||
|
||||
## Mouse
|
||||
services.libinput.mouse.accelProfile = "flat";
|
||||
|
||||
# Version of first install
|
||||
system.stateVersion = "23.05";
|
||||
}
|
||||
72
hosts/muin/disk-config.nix
Normal file
72
hosts/muin/disk-config.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted";
|
||||
# disable settings.keyFile if you want to use interactive password entry
|
||||
#passwordFile = "/tmp/secret.key"; # Interactive
|
||||
# settings = {
|
||||
# allowDiscards = true;
|
||||
# keyFile = "/tmp/secret.key";
|
||||
# };
|
||||
# additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/log" = {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/swap" = {
|
||||
mountpoint = "/swap";
|
||||
swap.swapfile.size = "4G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/var/log".neededForBoot = true;
|
||||
}
|
||||
31
hosts/muin/hardware-configuration.nix
Normal file
31
hosts/muin/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
# imports =
|
||||
# [ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
# ];
|
||||
#
|
||||
# hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
networking.useDHCP = lib.mkForce true;
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
# following configuration is added only when building VM with build-vm
|
||||
virtualisation = {
|
||||
memorySize = 4096; # Use 2048MiB memory.
|
||||
cores = 3;
|
||||
};
|
||||
};
|
||||
}
|
||||
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";
|
||||
}
|
||||
BIN
hosts/muin/wallpaper.png
Normal file
BIN
hosts/muin/wallpaper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 283 KiB |
Loading…
Add table
Add a link
Reference in a new issue