lets try it out i001 bcache
This commit is contained in:
parent
daa1188f38
commit
f6d01063b2
5 changed files with 100 additions and 1255 deletions
1149
hosts/i001/flake.lock
generated
1149
hosts/i001/flake.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,7 @@
|
||||||
de_plasma.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/de_plasma";
|
de_plasma.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/de_plasma";
|
||||||
ros_neovim.url = "git+https://git.joshuabell.xyz/ringofstorms/nvim";
|
ros_neovim.url = "git+https://git.joshuabell.xyz/ringofstorms/nvim";
|
||||||
|
|
||||||
impermanence.url = "github:nix-community/impermanence";
|
# impermanence.url = "github:nix-community/impermanence";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
primaryUser = "luser";
|
primaryUser = "luser";
|
||||||
configLocation = "/home/${primaryUser}/.config/nixos-config/hosts/${configurationName}";
|
configLocation = "/home/${primaryUser}/.config/nixos-config/hosts/${configurationName}";
|
||||||
|
stateAndHomeVersion = "25.11";
|
||||||
lib = inputs.nixpkgs.lib;
|
lib = inputs.nixpkgs.lib;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
@ -31,7 +32,7 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
inputs.impermanence.nixosModules.impermanence
|
# inputs.impermanence.nixosModules.impermanence
|
||||||
inputs.home-manager.nixosModules.default
|
inputs.home-manager.nixosModules.default
|
||||||
|
|
||||||
inputs.ros_neovim.nixosModules.default
|
inputs.ros_neovim.nixosModules.default
|
||||||
|
|
@ -61,7 +62,8 @@
|
||||||
inputs.common.nixosModules.zsh
|
inputs.common.nixosModules.zsh
|
||||||
|
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./impermanence.nix
|
./hardware-mounts.nix
|
||||||
|
# ./impermanence.nix
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
|
@ -70,7 +72,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
rec {
|
rec {
|
||||||
system.stateVersion = "25.05";
|
system.stateVersion = stateAndHomeVersion;
|
||||||
# TODO allowing password auth for now
|
# TODO allowing password auth for now
|
||||||
services.openssh.settings.PasswordAuthentication = lib.mkForce true;
|
services.openssh.settings.PasswordAuthentication = lib.mkForce true;
|
||||||
|
|
||||||
|
|
@ -81,7 +83,7 @@
|
||||||
backupFileExtension = "bak";
|
backupFileExtension = "bak";
|
||||||
# add all normal users to home manager so it applies to them
|
# add all normal users to home manager so it applies to them
|
||||||
users = lib.mapAttrs (name: user: {
|
users = lib.mapAttrs (name: user: {
|
||||||
home.stateVersion = "25.05";
|
home.stateVersion = stateAndHomeVersion;
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
}) (lib.filterAttrs (name: user: user.isNormalUser or false) users.users);
|
}) (lib.filterAttrs (name: user: user.isNormalUser or false) users.users);
|
||||||
|
|
||||||
|
|
@ -106,10 +108,11 @@
|
||||||
networking.hostName = configurationName;
|
networking.hostName = configurationName;
|
||||||
programs.nh.flake = configLocation;
|
programs.nh.flake = configLocation;
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
users.mutableUsers = false;
|
# users.mutableUsers = false;
|
||||||
users.users = {
|
users.users = {
|
||||||
"${primaryUser}" = {
|
"${primaryUser}" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
# hashedPassword = ""; # Use if mutable users is false above
|
||||||
initialHashedPassword = "$y$j9T$v1QhXiZMRY1pFkPmkLkdp0$451GvQt.XFU2qCAi4EQNd1BEqjM/CH6awU8gjcULps6"; # "test" password
|
initialHashedPassword = "$y$j9T$v1QhXiZMRY1pFkPmkLkdp0$451GvQt.XFU2qCAi4EQNd1BEqjM/CH6awU8gjcULps6"; # "test" password
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
"wheel"
|
"wheel"
|
||||||
|
|
|
||||||
|
|
@ -1,111 +1,33 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
let
|
|
||||||
NIXBOOT = "/dev/disk/by-uuid/641A-6BDB";
|
|
||||||
NIXROOT ="/dev/disk/by-uuid/ae94db42-ec46-4e2f-a98a-118359428a68";
|
|
||||||
cryptroot = "/dev/disk/by-uuid/49f11bf1-d4b7-4188-9203-4d7a42569afa";
|
|
||||||
|
|
||||||
USB_KEY = "/dev/disk/by-uuid/9985-EBD1";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports =
|
config,
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
lib,
|
||||||
|
pkgs,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" "ehci_pci" "uas" ];
|
boot.initrd.availableKernelModules = [
|
||||||
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"usb_storage"
|
||||||
|
"usbhid"
|
||||||
|
"sd_mod"
|
||||||
|
"sdhci_pci"
|
||||||
|
"ehci_pci"
|
||||||
|
"uas"
|
||||||
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
{ device = NIXBOOT;
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [ "fmask=0077" "dmask=0077" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.luks.devices."cryptroot" = {
|
|
||||||
device = NIXROOT;
|
|
||||||
|
|
||||||
# Auto decrypt
|
|
||||||
keyFile = USB_KEY;
|
|
||||||
keyFileSize = 5000;
|
|
||||||
keyFileOffset = 5443;
|
|
||||||
|
|
||||||
tryEmptyPassphrase = true;
|
|
||||||
fallbackToPassword = true;
|
|
||||||
crypttabExtraOpts = [ "tries=2" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{ device = cryptroot;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "subvol=@root" "compress=zstd" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/nix" =
|
|
||||||
{ device = cryptroot;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "subvol=@nix" "compress=zstd" "noatime" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/persist" =
|
|
||||||
{ device = cryptroot;
|
|
||||||
neededForBoot = true;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "subvol=@persist" "compress=zstd" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/.swap" =
|
|
||||||
{ device = cryptroot;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "subvol=@swap" "noatime" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/.snapshots" =
|
|
||||||
{ device = cryptroot;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "subvol=@snapshots" "compress=zstd" "noatime"];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.btrfs.autoScrub = {
|
|
||||||
enable = true;
|
|
||||||
# syntax as defined by https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Event s
|
|
||||||
interval = "monthly";
|
|
||||||
fileSystems = ["/"];
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [{
|
|
||||||
device = "/.swap/swapfile";
|
|
||||||
size = 8*1024; # Creates an 8GB swap file
|
|
||||||
}];
|
|
||||||
|
|
||||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
|
||||||
mkdir /btrfs_tmp
|
|
||||||
mount ${cryptroot} /btrfs_tmp
|
|
||||||
if [[ -e /btrfs_tmp/@root ]]; then
|
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
|
||||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@root)" "+%Y-%m-%-d_%H:%M:%S")
|
|
||||||
mv /btrfs_tmp/@root "/btrfs_tmp/old_roots/$timestamp"
|
|
||||||
fi
|
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
|
||||||
IFS=$'\n'
|
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
|
||||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
|
||||||
done
|
|
||||||
btrfs subvolume delete "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
|
||||||
delete_subvolume_recursively "$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/@root
|
|
||||||
umount /btrfs_tmp
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
|
|
||||||
68
hosts/i001/hardware-mounts.nix
Normal file
68
hosts/i001/hardware-mounts.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
{ ... }:
|
||||||
|
let
|
||||||
|
BOOT = "/dev/disk/by-uuid/6E40-637E";
|
||||||
|
PRIMARY = "/dev/disk/by-uuid/ec589da0-4deb-44a3-abcb-9a7016d84519";
|
||||||
|
|
||||||
|
USB_KEY = "/dev/disk/by-uuid/9985-EBD1";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# BOOT
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = BOOT;
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# PRIMARY unencrypt
|
||||||
|
# TODO how to auto unencrypt with options...
|
||||||
|
# - USB key
|
||||||
|
# - TPM
|
||||||
|
|
||||||
|
# PRIMARY
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = PRIMARY;
|
||||||
|
fsType = "bcachefs";
|
||||||
|
options = [
|
||||||
|
"X-mount.subdir=@root"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = PRIMARY;
|
||||||
|
fsType = "bcachefs";
|
||||||
|
options = [
|
||||||
|
"X-mount.subdir=@nix"
|
||||||
|
"relatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
fileSystems."/.swap" = {
|
||||||
|
device = PRIMARY;
|
||||||
|
fsType = "bcachefs";
|
||||||
|
options = [
|
||||||
|
"X-mount.subdir=@swap"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
fileSystems."/.snapshots" = {
|
||||||
|
device = PRIMARY;
|
||||||
|
fsType = "bcachefs";
|
||||||
|
options = [
|
||||||
|
"X-mount.subdir=@root"
|
||||||
|
"relatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# (optional) for preservation/impermanence
|
||||||
|
fileSystems."/persist" = {
|
||||||
|
device = PRIMARY;
|
||||||
|
fsType = "bcachefs";
|
||||||
|
options = [
|
||||||
|
"X-mount.subdir=@persist"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# SWAP
|
||||||
|
swapDevices = [
|
||||||
|
{
|
||||||
|
device = "/.swap/swapfile";
|
||||||
|
size = 8 * 1024; # Creates an 8GB swap file
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
"/etc/NetworkManager/system-connections"
|
"/etc/NetworkManager/system-connections"
|
||||||
"/var/lib/bluetooth"
|
"/var/lib/bluetooth"
|
||||||
|
"/var/lib/NetworkManager"
|
||||||
|
"/var/lib/iwd"
|
||||||
"/var/lib/fail2ban"
|
"/var/lib/fail2ban"
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
|
|
@ -34,7 +36,6 @@
|
||||||
|
|
||||||
# KDE
|
# KDE
|
||||||
".config/kdeconnect"
|
".config/kdeconnect"
|
||||||
".local/kwalletd" # TODO remove? I disabled it so we can try removing something here
|
|
||||||
|
|
||||||
# Chrome
|
# Chrome
|
||||||
".config/google-chrome"
|
".config/google-chrome"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue