disko upd

This commit is contained in:
mjallen18
2025-09-30 20:44:36 -05:00
parent 751b4f9f69
commit 5d6e7e35d5
13 changed files with 79 additions and 394 deletions

View File

@@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ pkgs, lib, namespace, ... }:
let
theme = import (lib.snowfall.fs.get-file "modules/home/desktop/theme/nord.nix");
shellAliases = {
@@ -22,7 +22,7 @@ in
home.homeDirectory = "/home/matt";
home.stateVersion = "23.11";
mjallen = {
${namespace} = {
programs.hyprland = {
enable = true;
primaryDisplay = "eDP-1";
@@ -120,7 +120,7 @@ in
};
home.packages = with pkgs; [
pkgs.mjallen.bolt-launcher
pkgs.${namespace}.bolt-launcher
iw
iwd

View File

@@ -1,8 +1,8 @@
{ lib, ... }:
{ lib, namespace, ... }:
{
home.username = "matt";
mjallen = {
${namespace} = {
shell-aliases = {
enable = true;
flakeInputs = [

View File

@@ -1,8 +1,8 @@
{ pkgs, ... }:
{ pkgs, namespace, ... }:
{
home.username = "admin";
mjallen = {
${namespace} = {
shell-aliases = {
enable = true;
buildHost = ""; # NAS builds locally

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, namespace, ... }:
let
shellAliases = {
update-boot = "sudo nixos-rebuild boot --max-jobs 10 --build-host admin@10.0.1.3";
@@ -10,7 +10,7 @@ in
{
home.username = "deck";
mjallen.desktop.gnome.enable = true;
${namespace}.desktop.gnome.enable = true;
sops = {
age.keyFile = "/home/deck/.config/sops/age/keys.txt";

View File

@@ -1,5 +1,6 @@
{ pkgs, ... }:
{ lib, pkgs, namespace, ... }:
let
inherit (lib.${namespace}) enabled disabled;
displayLeft = {
input = "DP-1";
resolution = "3840x2160";
@@ -14,22 +15,12 @@ in
{
home.username = "matt";
mjallen = {
${namespace} = {
sops = {
enable = true;
};
shell-aliases = {
enable = true;
flakeInputs = [
"desktop-nixpkgs"
"desktop-chaotic"
"desktop-home-manager"
"desktop-impermanence"
"desktop-lanzaboote"
"desktop-nixos-hardware"
"desktop-sops-nix"
"desktop-steam-rom-manager"
];
};
programs = {
@@ -68,7 +59,7 @@ in
browser = pkgs.firefox;
};
};
btop.enable = true;
btop = enabled;
kitty = {
enable = true;
font = {
@@ -80,8 +71,8 @@ in
enable = true;
fontName = "JetBrainsMono NFM";
};
nwg-dock.enable = true;
nwg-drawer.enable = true;
nwg-dock = enabled;
nwg-drawer = enabled;
nwg-panel = {
enable = true;
defaultApps = {
@@ -134,8 +125,8 @@ in
}
'';
};
wlogout.enable = true;
wofi.enable = true;
wlogout = enabled;
wofi = enabled;
};
};
@@ -147,11 +138,11 @@ in
};
programs = {
password-store.enable = true;
password-store = enabled;
};
home.packages = with pkgs; [
pkgs.mjallen.bolt-launcher
pkgs.${namespace}.bolt-launcher
bottles
compose2nix
@@ -177,4 +168,22 @@ in
vorta
waydroid-helper
];
specialisation = {
"cosmic".configuration = {
${namespace} = {
programs = {
hyprland = lib.mkForce disabled;
kitty = lib.mkForce disabled;
mako = lib.mkForce disabled;
nwg-dock = lib.mkForce disabled;
nwg-drawer = lib.mkForce disabled;
nwg-panel = lib.mkForce disabled;
waybar = lib.mkForce disabled;
wlogout = lib.mkForce disabled;
wofi = lib.mkForce disabled;
};
};
};
};
}

View File

@@ -1,147 +0,0 @@
{
config,
lib,
system,
namespace,
...
}:
let
cfg = config.${namespace}.hardware.disko;
isArm = builtins.match "aarch64*" system != null;
rootDisk = "/dev/nvme0n1";
# BTRFS root partition configuration
btrfsRoot = {
name = "btrfs-root";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"root" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/root";
};
"nix" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix";
};
"etc" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/etc";
};
"log" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/var/log";
};
};
};
};
# BCacheFS root partition configuration
bcachefsRoot = {
size = "100%";
content = {
type = "bcachefs";
# This refers to a filesystem in the `bcachefs_filesystems` attrset below.
filesystem = "mounted_subvolumes_in_multi";
label = "ssd.ssd1";
extraFormatArgs = [
"--discard"
];
};
};
in
{
imports = [ ../options.nix ];
config = lib.mkIf (isArm && cfg.enable) {
disko.devices = {
# root disk setup
disk.main = {
type = "disk";
device = rootDisk;
imageSize = "15G";
content = {
type = "gpt";
# specify partitions
partitions = {
# /boot/firmware
FIRMWARE = {
priority = 1;
name = "FIRMWARE";
start = "1M";
end = "1G";
type = "0700";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/firmware";
mountOptions = [ "umask=0077" ];
};
};
# /boot
ESP = {
priority = 2;
name = "ESP";
# start = "1G";
# end = "2G";
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = if cfg.filesystem == "btrfs" then btrfsRoot else bcachefsRoot;
};
};
};
bcachefs_filesystems = lib.mkIf (cfg.filesystem == "bcachefs") {
mounted_subvolumes_in_multi = {
type = "bcachefs_filesystem";
# passwordFile = "/etc/nixos/pool.jwe";
extraFormatArgs = [
"--compression=zstd"
];
subvolumes = {
"/root" = {
mountpoint = "/";
};
"/persistent" = {
mountpoint = "/persistent";
};
"/nix" = {
mountOptions = [
"noatime"
];
mountpoint = "/nix";
};
};
mountpoint = "/partition-root";
};
};
};
};
}

View File

@@ -33,7 +33,7 @@ let
# BTRFS root partition configuration
root = {
name = "${cfg.filesystem}-root";
name = "${config.${namespace}.network.hostName}-${cfg.filesystem}-root";
size = "100%";
content = {
type = cfg.filesystem;
@@ -60,7 +60,7 @@ let
# Luks root partition configuration
luksRoot = {
name = "cryptroot";
name = "${config.${namespace}.network.hostName}-cryptroot";
size = "100%";
content = {
type = "luks";
@@ -121,7 +121,21 @@ in
content = {
type = "gpt";
partitions = {
FIRMWARE = lib.mkIf cfg.enableFirmware {
priority = 1;
name = "FIRMWARE";
start = "1M";
end = "1G";
type = "0700";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/firmware";
mountOptions = [ "umask=0077" ];
};
};
ESP = {
priority = if cfg.enableFirmware then 2 else 1;
type = "EF00";
size = "500M";
content = {

View File

@@ -19,6 +19,8 @@ in
enableLuks = mkBoolOpt false "Enable Luks";
enableFirmware = mkBoolOpt false "Enable rpi firmware part";
swapSize = mkOpt types.str "16G" "size of swap part";
rootDisk = mkOpt types.str "/dev/nvme0n1" "Root disk";

View File

@@ -1,214 +0,0 @@
{
config,
lib,
system,
namespace,
...
}:
let
cfg = config.${namespace}.hardware.disko;
isArm = builtins.match "aarch64*" system != null;
rootDisk = "/dev/nvme0n1";
# BTRFS root partition configuration
btrfsRoot = {
name = "btrfs-root";
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"root" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/root";
};
"nix" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix";
};
"etc" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/etc";
};
"log" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/var/log";
};
};
};
};
# BTRFS root partition configuration
encBtrfsRoot = {
name = "cryptroot";
size = "100%";
content = {
type = "luks";
name = "cryptroot";
extraOpenArgs = [
"--allow-discards"
"--perf-no_read_workqueue"
"--perf-no_write_workqueue"
];
settings = {crypttabExtraOpts = ["fido2-device=auto" "token-timeout=10"];};
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"root" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/root";
};
"nix" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix";
};
"etc" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/etc";
};
"log" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/var/log";
};
};
};
};
};
# BCacheFS root partition configuration
bcachefsRoot = {
name = "bcachefs-root";
size = "100%";
content = {
type = "bcachefs";
# This refers to a filesystem in the `bcachefs_filesystems` attrset below.
filesystem = "mounted_subvolumes_in_multi";
label = "ssd.ssd1";
extraFormatArgs = [
"--discard"
];
};
};
in
{
imports = [ ../options.nix ];
config = lib.mkIf (!isArm && cfg.enable) {
disko.devices = lib.mkMerge [
{
nodev."/" = {
fsType = "tmpfs";
mountOptions = [
"mode=755"
"defaults"
"size=25%"
];
};
disk = {
main = {
device = rootDisk;
type = "disk";
imageSize = "32G";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "500M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
swap = lib.mkIf cfg.enableSwap {
type = "8200";
size = cfg.swapSize;
};
root = if cfg.filesystem == "btrfs" then ( if cfg.enableLuks then encBtrfsRoot else btrfsRoot) else bcachefsRoot;
};
};
};
};
bcachefs_filesystems = lib.mkIf (cfg.filesystem == "bcachefs") {
mounted_subvolumes_in_multi = {
type = "bcachefs_filesystem";
# passwordFile = "/etc/nixos/pool.jwe";
extraFormatArgs = [
"--compression=zstd"
];
subvolumes = {
"root" = {
mountpoint = "/root";
mountOptions = [
"noatime"
];
};
"etc" = {
mountOptions = [
"noatime"
];
mountpoint = "/etc";
};
"nix" = {
mountOptions = [
"noatime"
];
mountpoint = "/nix";
};
"log" = {
mountOptions = [
"noatime"
];
mountpoint = "/var/log";
};
"home" = {
mountpoint = "/home";
};
};
};
};
}
];
};
}

View File

@@ -47,7 +47,7 @@ in
# Pass inputs so external modules can access them
extraSpecialArgs = {
inherit inputs;
inherit inputs namespace;
overlays = with inputs; [
nix-vscode-extensions.overlays.default
];

View File

@@ -28,7 +28,10 @@
${namespace} = {
impermanence.enable = true;
hardware = {
disko.enable = true;
disko = {
enable = true;
enableFirmware = true;
};
raspberry-pi = {
enable = true;
variant = "4";

View File

@@ -27,7 +27,10 @@
# ###################################################
hardware = {
disko.enable = true;
disko = {
enable = true;
enableFirmware = true;
};
raspberry-pi = {
enable = true;
variant = "5";

View File

@@ -70,4 +70,19 @@
EDITOR = "${lib.getExe' pkgs.vscodium "codium"} --wait";
VISUAL = "${lib.getExe' pkgs.vscodium "codium"} --wait";
};
specialisation = {
"cosmic".configuration = {
${namespace} = {
desktop = {
cosmic.enable = lib.mkForce true;
hyprland = {
enable = lib.mkForce false;
wallpaperSource = "nasa";
};
gnome.enable = lib.mkForce false;
};
};
};
};
}