Skip to content

Commit

Permalink
feat: nuc usb f2fs disko config
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarrio committed Dec 3, 2024
1 parent 31c4650 commit 923756f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 19 deletions.
44 changes: 44 additions & 0 deletions nixos/mixins/disks/nuc-usb-f2fs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
boot.loader.grub.devices = [ "/dev/sda" ];

disko.devices = {
disk = {
sda = {
# the same hardware, the same usb port... better be the same pci path.
device = "/dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
end = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
name = "root";
end = "-0";
content = {
type = "filesystem";
format = "f2fs";
mountpoint = "/";
extraArgs = [
"-O"
"extra_attr,inode_checksum,sb_checksum,compression"
];
mountOptions = [
"compress_algorithm=zstd:6,compress_chksum,atgc,gc_merge,lazytime,nodiscard"
];
};
};
};
};
};
};
};
}
17 changes: 1 addition & 16 deletions nixos/mixins/servers/nuc-base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,14 @@
inputs.nixos-hardware.nixosModules.common-gpu-intel
inputs.nixos-hardware.nixosModules.common-pc
inputs.nixos-hardware.nixosModules.common-pc-ssd
../../mixins/hardware/systemd-boot.nix
../disks/nuc-usb-f2fs.nix
];

oxc.services.tailscale.enable = true;
oxc.services.wait-online.enable = true;
oxc.containerisation.enable = true;
oxc.virtualisation.enable = true;

# based on nixos-generators raw + raw-efi formats, see linked references
fileSystems = {
# https://github.com/nix-community/nixos-generators/blob/c1590ae68664e11c1acd03ec76c193a5c151a657/formats/raw.nix#L9
"/" = {
device = "/dev/disk/by-label/nixos";
autoResize = true;
fsType = "ext4";
};
# https://github.com/nix-community/nixos-generators/blob/c1590ae68664e11c1acd03ec76c193a5c151a657/formats/raw-efi.nix#L20
"/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
};

boot = {
initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "uas" ];
kernelModules = [ "kvm-intel" ];
Expand Down
19 changes: 16 additions & 3 deletions nixos/server/nuc-init/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,22 @@ in

environment.systemPackages = [ auto-install-system ];

programs.fish.interactiveShellInit = ''
auto-install-system
'';
systemd.services.install = {
description = "Bootstrap a NixOS installation";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "polkit.service" ];
path = [ "/run/current-system/sw/" ];
script = with pkgs; ''
${auto-install-system}/bin/auto-install-system
'';
environment = config.nix.envVars // {
inherit (config.environment.sessionVariables) NIX_PATH;
HOME = "/root";
};
serviceConfig = {
Type = "oneshot";
};
};

# allow remote deployments via root user
users.users.root.openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users;
Expand Down

0 comments on commit 923756f

Please sign in to comment.