feat(stolas): disko for disk setup
This commit is contained in:
parent
0b08beee35
commit
e58a47af3f
5 changed files with 127 additions and 109 deletions
21
flake.lock
generated
21
flake.lock
generated
|
@ -67,6 +67,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"disko": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1752113600,
|
||||||
|
"narHash": "sha256-7LYDxKxZgBQ8LZUuolAQ8UkIB+jb4A2UmiR+kzY9CLI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"rev": "79264292b7e3482e5702932949de9cbb69fedf6d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-registry": {
|
"flake-registry": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -225,6 +245,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
|
"disko": "disko",
|
||||||
"flake-registry": "flake-registry",
|
"flake-registry": "flake-registry",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs-small.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
nixpkgs-small.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
disko = {
|
||||||
|
url = "github:nix-community/disko";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
flake-utils = {
|
flake-utils = {
|
||||||
url = "github:numtide/flake-utils";
|
url = "github:numtide/flake-utils";
|
||||||
inputs.systems.follows = "systems";
|
inputs.systems.follows = "systems";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
agenix,
|
agenix,
|
||||||
|
disko,
|
||||||
home-manager,
|
home-manager,
|
||||||
homepage,
|
homepage,
|
||||||
nixos-hardware,
|
nixos-hardware,
|
||||||
|
@ -40,6 +41,7 @@ in
|
||||||
|
|
||||||
extraModules = [
|
extraModules = [
|
||||||
# TODO lanzaboote.nixosModules.lanzaboote
|
# TODO lanzaboote.nixosModules.lanzaboote
|
||||||
|
disko.nixosModules.disko
|
||||||
{
|
{
|
||||||
nixpkgs.overlays = nixpkgs.lib.attrValues self.overlays;
|
nixpkgs.overlays = nixpkgs.lib.attrValues self.overlays;
|
||||||
dadada.pkgs = self.packages.${system};
|
dadada.pkgs = self.packages.${system};
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../modules/profiles/laptop.nix
|
../modules/profiles/laptop.nix
|
||||||
|
./disks.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
### TODO double check with generated hw-config
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
# TODO lanzaboote = {
|
# TODO lanzaboote = {
|
||||||
# enable = true;
|
# enable = true;
|
||||||
|
@ -47,113 +46,6 @@
|
||||||
pkgs.sbctl
|
pkgs.sbctl
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO compare with nixos-generate-config --show-hardware-config
|
|
||||||
fileSystems = {
|
|
||||||
"/boot" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
"/" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"subvol=root"
|
|
||||||
"compress=zstd"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/home" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=home"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/home/dadada" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=home/dadada"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/nix" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=nix"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/nix/var/nix/builds" = {
|
|
||||||
device = "none";
|
|
||||||
fsType = "tmpfs";
|
|
||||||
options = [
|
|
||||||
# Max 80% of available RAM
|
|
||||||
"size=80%"
|
|
||||||
# Only owner (nix daemon may write)
|
|
||||||
"mode=755"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/root" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=root"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/var" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=var"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/var/lib/paperless" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=var/lib/paperless"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/var/swap" = {
|
|
||||||
# TODO
|
|
||||||
device = "/dev/disk/by-uuid/todo";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
"subvol=swap"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# NOTE: /tmp is tmpfs because of config in base.nix
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO btrfs filesystem mkswapfile --uuid clear /var/swap/swapfile
|
|
||||||
# swapDevices = [{
|
|
||||||
# device = "/var/swap/swapfile";
|
|
||||||
# size = 80*1024; # Creates an 80GB swap file
|
|
||||||
# }];
|
|
||||||
|
|
||||||
hardware = {
|
hardware = {
|
||||||
# NOTE: hardware.framework.enableKmod requires kernel patching, but enables access to some EC features
|
# NOTE: hardware.framework.enableKmod requires kernel patching, but enables access to some EC features
|
||||||
bluetooth.enable = true;
|
bluetooth.enable = true;
|
||||||
|
|
99
nixos/stolas/disks.nix
Normal file
99
nixos/stolas/disks.nix
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
nodev."/nix/var/nix/builds" = {
|
||||||
|
fsType = "tmpfs";
|
||||||
|
mountOptions = [
|
||||||
|
"size=80%"
|
||||||
|
"defaults"
|
||||||
|
"mode=755"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/disk/by-uuid/TODO";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
size = "1G";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# TODO tmpfs for nix/var/nix/builds
|
||||||
|
luks = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "crypted";
|
||||||
|
#passwordFile = "/tmp/secret.key"; # Interactive
|
||||||
|
settings = {
|
||||||
|
allowDiscards = true;
|
||||||
|
#keyFile = "/tmp/secret.key";
|
||||||
|
};
|
||||||
|
#additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
||||||
|
content = {
|
||||||
|
type = "btrfs";
|
||||||
|
extraArgs = [ "-f" ];
|
||||||
|
subvolumes = {
|
||||||
|
"/root" = {
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"relatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/home" = {
|
||||||
|
mountpoint = "/home";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/dadada" = {
|
||||||
|
mountpoint = "/home/dadada";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"relatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/nix" = {
|
||||||
|
mountpoint = "/nix";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/var" = {
|
||||||
|
mountpoint = "/var";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/paperless" = {
|
||||||
|
mountpoint = "/var/lib/paperless";
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"/swap" = {
|
||||||
|
mountpoint = "/.swapvol";
|
||||||
|
swap.swapfile.size = "64G";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue