mirror of
https://codeberg.org/muon/home.git
synced 2025-12-06 08:07:45 +00:00
Compare commits
21 commits
97fddca4a4
...
0245d1a8a6
| Author | SHA1 | Date | |
|---|---|---|---|
| 0245d1a8a6 | |||
| 33743a121c | |||
| 800e05c744 | |||
| 3086f83fc9 | |||
| a1e4f2b6e1 | |||
| dcd9a47a3e | |||
| bc97a4ab04 | |||
| 9f197645c4 | |||
| ac0f87a429 | |||
| 19b9edc01b | |||
| 0874e87ef2 | |||
| ee3d2b563b | |||
| 51a84f597c | |||
| ae295eb241 | |||
| d6f3800246 | |||
| f443bae2ed | |||
| e2676da17e | |||
| 39c26942a7 | |||
| 41ae205f6a | |||
| aba1da6c1f | |||
| f7fe0becd1 |
9 changed files with 115 additions and 46 deletions
22
README.md
22
README.md
|
|
@ -1,12 +1,28 @@
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://codeberg.org/muon/home && cd home
|
|
||||||
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount hosts/$(hostname)/disk-config.nix
|
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount hosts/$(hostname)/disk-config.nix
|
||||||
sudo btrfs subvolume snapshot -r /mnt /mnt/root-blank
|
sudo mkdir /tmp/mnt
|
||||||
sudo nixos-generate-config --root /mnt
|
sudo mount /dev/mapper/crypted /tmp/mnt
|
||||||
|
sudo btrfs subvolume snapshot -r /tmp/mnt/root /tmp/mnt/root-blank
|
||||||
|
sudo umount /tmp/mnt
|
||||||
|
sudo nixos-generate-config --no-filesystems --root /mnt
|
||||||
cp /mnt/etc/nixos/hardware-configuration.nix hosts/$(hostname)/hardware-configuration.nix
|
cp /mnt/etc/nixos/hardware-configuration.nix hosts/$(hostname)/hardware-configuration.nix
|
||||||
|
rbw config set email admin@muon.host
|
||||||
|
rbw config set base_url https://vault.muon.host
|
||||||
|
rbw login
|
||||||
|
sudo mkdir -p /mnt/etc/ssh
|
||||||
|
nix-shell -p jq --run "rbw get --raw sopsssh | jq -r '.data.password' | sudo tee /mnt/etc/ssh/ssh_host_ed25519_key.pub"
|
||||||
|
nix-shell -p jq --run "rbw get --raw sopsssh | jq -r '.notes' | sudo tee /mnt/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
sudo mkdir -p /mnt{,/persist}/var/lib/sops-nix
|
||||||
|
sudo chown muon:users /mnt/var/lib/sops-nix -R
|
||||||
|
sudo chown muon:users /mnt/persist/var/lib/sops-nix -R
|
||||||
|
rbw get sops > /mnt/var/lib/sops-nix/key.txt
|
||||||
|
sudo cp {/mnt,/mnt/persist}/var/lib/sops-nix/key.txt
|
||||||
sudo nixos-install --root /mnt --no-root-passwd --flake .#$(hostname)
|
sudo nixos-install --root /mnt --no-root-passwd --flake .#$(hostname)
|
||||||
|
sudo cp -r /mnt/var/lib/nixos/* /mnt/persist/var/lib/nixos/
|
||||||
|
sudo cp -r /mnt/etc/ssh/ssh_host* /mnt/persist/etc/ssh/
|
||||||
|
sudo cp {/mnt,/mnt/persist}/etc/machine-id
|
||||||
```
|
```
|
||||||
|
|
||||||
# Impermanence
|
# Impermanence
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,16 @@ in {
|
||||||
# Hardware
|
# Hardware
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
"${
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url =
|
||||||
|
"https://github.com/nix-community/disko/archive/refs/tags/v1.12.0.tar.gz";
|
||||||
|
sha256 = "0wbx518d2x54yn4xh98cgm65wvj0gpy6nia6ra7ns4j63hx14fkq";
|
||||||
|
}
|
||||||
|
}/module.nix"
|
||||||
./disk-config.nix
|
./disk-config.nix
|
||||||
inputs.impermanence.nixosModules.impermanence
|
# (inputs.nixpkgs
|
||||||
(inputs.nixpkgs
|
# + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
||||||
+ "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = with inputs.nix-alien.packages.${system};
|
environment.systemPackages = with inputs.nix-alien.packages.${system};
|
||||||
|
|
@ -22,13 +28,13 @@ in {
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
mods.desktop.enable = true;
|
mods.desktop.enable = true;
|
||||||
mods.boot.enable = false;
|
mods.boot.enable = true;
|
||||||
|
|
||||||
mods.theme.enable = true;
|
mods.theme.enable = true;
|
||||||
mods.theme.scheme = "woodland";
|
mods.theme.scheme = "woodland";
|
||||||
mods.theme.wallpaper = ./wallpaper.png;
|
mods.theme.wallpaper = ./wallpaper.png;
|
||||||
|
|
||||||
mods.impermanence.enable = false;
|
mods.impermanence.enable = true;
|
||||||
|
|
||||||
services.xserver.windowManager.i3.enable = true;
|
services.xserver.windowManager.i3.enable = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{ inputs }: {
|
{
|
||||||
inputs.disko.devices = {
|
disko.devices = {
|
||||||
disk = {
|
disk = {
|
||||||
main = {
|
main = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = "/dev/disk/by-diskseq/1";
|
device = "/dev/sda";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
|
|
@ -66,4 +66,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems."/persist".neededForBoot = true;
|
||||||
|
fileSystems."/var/log".neededForBoot = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,61 @@
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules =
|
boot.initrd.availableKernelModules =
|
||||||
[ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
[ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
boot.supportedFilesystems = [ "zfs" "ntfs" "btrfs" ];
|
|
||||||
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
fileSystems."/" = {
|
||||||
|
device = "/dev/mapper/crypted";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=root" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.luks.devices."crypted".device =
|
||||||
|
"/dev/disk/by-uuid/1ca0c5f6-3cb3-4f86-94a5-4376461da227";
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/4BD8-A887";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "fmask=0077" "dmask=0077" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/home" = {
|
||||||
|
device = "/dev/mapper/crypted";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=home" "compress=zstd" "noatime" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = "/dev/mapper/crypted";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=nix" "compress=zstd" "noatime" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/persist" = {
|
||||||
|
device = "/dev/mapper/crypted";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=persist" "compress=zstd" "noatime" ];
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/swap" = {
|
||||||
|
device = "/dev/mapper/crypted";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=swap" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/var/log" = {
|
||||||
|
device = "/dev/mapper/crypted";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=log" "compress=zstd" "noatime" ];
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ ];
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.intel.updateMicrocode =
|
||||||
|
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,23 @@ let
|
||||||
fs-diff = with pkgs;
|
fs-diff = with pkgs;
|
||||||
writeShellApplication {
|
writeShellApplication {
|
||||||
name = "fs-diff";
|
name = "fs-diff";
|
||||||
runtimeInputs = [ flameshot curl xsel ];
|
|
||||||
text = ''
|
text = ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# fs-diff.sh
|
# fs-diff.sh
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999)
|
sudo mkdir /btrfs_tmp
|
||||||
OLD_TRANSID=${OLD_TRANSID}
|
sudo mount -o subvol=/ /dev/mapper/crypted /btrfs_tmp
|
||||||
|
|
||||||
sudo mkdir /mnt
|
OLD_TRANSID=$(sudo btrfs subvolume find-new /btrfs_tmp/root-blank 9999999)
|
||||||
sudo mount -o subvol=/ /dev/mapper/crypted /mnt
|
OLD_TRANSID=''${OLD_TRANSID#transid marker was }
|
||||||
sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" |
|
|
||||||
sed \'$d\' |
|
sudo btrfs subvolume find-new "/btrfs_tmp/root" "$OLD_TRANSID" |
|
||||||
|
sed '$d' |
|
||||||
cut -f17- -d' ' |
|
cut -f17- -d' ' |
|
||||||
sort |
|
sort |
|
||||||
uniq |
|
uniq |
|
||||||
while read path; do
|
while read -r path; do
|
||||||
path="/$path"
|
path="/$path"
|
||||||
if [ -L "$path" ]; then
|
if [ -L "$path" ]; then
|
||||||
: # The path is a symbolic link, so is probably handled by NixOS already
|
: # The path is a symbolic link, so is probably handled by NixOS already
|
||||||
|
|
@ -29,22 +29,22 @@ let
|
||||||
echo "$path"
|
echo "$path"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
sudo umount /mnt
|
sudo umount /btrfs_tmp
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in with lib; {
|
in with lib; {
|
||||||
config = mkIf osConfig.mods.impermanence.enable {
|
config = mkIf osConfig.mods.impermanence.enable {
|
||||||
home.packages = [ fs-diff ];
|
home.packages = [ fs-diff ];
|
||||||
home.persistence."/persistent/home/muon" = {
|
# home.persistence."/persist/home/muon" = {
|
||||||
directories = [
|
# directories = [
|
||||||
"documents"
|
# "documents"
|
||||||
"downloads"
|
# "downloads"
|
||||||
"src"
|
# "src"
|
||||||
".gnupg"
|
# ".gnupg"
|
||||||
".ssh"
|
# ".ssh"
|
||||||
".config/sops"
|
# ".config/sops"
|
||||||
".local/share/direnv"
|
# ".local/share/direnv"
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ let cfg = config.mods;
|
||||||
in with lib; {
|
in with lib; {
|
||||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||||
sops = {
|
sops = {
|
||||||
age.keyFile = "/home/muon/.config/sops/age/keys.txt";
|
age.keyFile = "/persist/var/lib/sops-nix/key.txt";
|
||||||
defaultSopsFile = ./secrets.yaml;
|
defaultSopsFile = ./secrets.yaml;
|
||||||
secrets.zipline-auth = { };
|
secrets.zipline-auth = { };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,9 @@ with lib; {
|
||||||
options.mods.impermanence.enable = mkEnableOption "enables impermanence";
|
options.mods.impermanence.enable = mkEnableOption "enables impermanence";
|
||||||
|
|
||||||
config = mkIf config.mods.impermanence.enable {
|
config = mkIf config.mods.impermanence.enable {
|
||||||
environment.persistence."/persistent" = {
|
environment.persistence."/persist" = {
|
||||||
directories = [
|
directories = [ "/var/lib/nixos" "/var/lib/systemd/coredump" "/etc/ssh" ];
|
||||||
"/var/lib/bluetooth"
|
files = [ "/var/lib/sops-nix/key.txt" "/etc/machine-id" ];
|
||||||
"/var/lib/nixos"
|
|
||||||
"/var/lib/systemd/coredump"
|
|
||||||
"/etc/NetworkManager/system-connections"
|
|
||||||
];
|
|
||||||
files = [ "/etc/machine-id" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ let cfg = config.mods;
|
||||||
in with lib; {
|
in with lib; {
|
||||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
sops = {
|
sops = {
|
||||||
age.keyFile = "/home/muon/.config/sops/age/keys.txt";
|
age.keyFile = "/persist/var/lib/sops-nix/key.txt";
|
||||||
defaultSopsFile = ./secrets.yaml;
|
defaultSopsFile = ./secrets.yaml;
|
||||||
secrets.muon-password = { };
|
secrets.muon-password.neededForUsers = true;
|
||||||
secrets.zipline-secret = mkIf cfg.server.share.enable {
|
secrets.zipline-secret = mkIf cfg.server.share.enable {
|
||||||
owner = "zipline";
|
owner = "zipline";
|
||||||
group = "zipline";
|
group = "zipline";
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
./modules/nixos
|
./modules/nixos
|
||||||
inputs.home-manager.nixosModules.default
|
inputs.home-manager.nixosModules.default
|
||||||
inputs.stylix.nixosModules.stylix
|
inputs.stylix.nixosModules.stylix
|
||||||
|
inputs.impermanence.nixosModules.impermanence
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue