Skip to content

Commit

Permalink
Merge pull request #786 from socallinuxexpo/rh/devserver-disko
Browse files Browse the repository at this point in the history
[READY] - devServer disko config
  • Loading branch information
kylerisse authored Oct 10, 2024
2 parents ef74408 + 416f153 commit abdc6fa
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 30 deletions.
22 changes: 22 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
disko = {
url = "github:nix-community/disko/e55f9a8678adc02024a4877c2a403e3f6daf24fe";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
};

outputs =
Expand Down
100 changes: 100 additions & 0 deletions nix/machines/devServer/disko.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
disko.devices = {
disk = {
one = {
type = "disk";
device = "/dev/disk/by-id/wwn-0x5000c500b794a007";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "tank0";
};
};
};
};
};
two = {
type = "disk";
device = "/dev/disk/by-id/wwn-0x5000c500bca7d633";
content = {
type = "gpt";
partitions = {
# Support multiple disks to boot from
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot2";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "tank0";
};
};
};
};
};
};
zpool = {
tank0 = {
type = "zpool";
mode = "mirror";
# Workaround: cannot import 'tank0': I/O error in disko tests
options.cachefile = "none";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "true";
acltype = "posixacl";
xattr = "sa";
canmount = "off";
mountpoint = "none";
};
options = {
ashift = "12";
autotrim = "on";
};

datasets = {
"root" = {
type = "zfs_fs";
mountpoint = "/";
options.mountpoint = "legacy";
};
"home" = {
type = "zfs_fs";
mountpoint = "/home";
options.mountpoint = "legacy";
};
"nix" = {
type = "zfs_fs";
mountpoint = "/nix";
options.mountpoint = "legacy";
};
"persist" = {
type = "zfs_fs";
mountpoint = "/persist";
options.mountpoint = "legacy";
};
};
};
};
};
}
32 changes: 2 additions & 30 deletions nix/machines/devServer/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,12 @@
"usbhid"
"usb_storage"
"sd_mod"
"megaraid_sas"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

fileSystems."/" = {
device = "zroot/root";
fsType = "zfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/063A-73D6";
fsType = "vfat";
options = [ "nofail" ];
};
fileSystems."/boot2" = {
device = "/dev/disk/by-uuid/0655-58C2";
fsType = "vfat";
options = [ "nofail" ];
};
fileSystems."/nix" = {
device = "zroot/nix";
fsType = "zfs";
};

fileSystems."/home" = {
device = "zroot/home";
fsType = "zfs";
};

fileSystems."/persist" = {
device = "zroot/persist";
fsType = "zfs";
};

swapDevices = [ ];

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
Expand All @@ -73,5 +45,5 @@
};

# ZFS uniq system ID
networking.hostId = "74405d06";
networking.hostId = "713fdc74";
}
2 changes: 2 additions & 0 deletions nix/machines/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ in
devServer = lib.nixosSystem {
system = "x86_64-linux";
modules = [
inputs.disko.nixosModules.disko
./devServer/disko.nix
./_common/base.nix
./_common/users.nix
./devServer/default.nix
Expand Down

0 comments on commit abdc6fa

Please sign in to comment.