mirror of
https://git.sr.ht/~neverness/ultima
synced 2025-05-13 06:15:15 +00:00
add disko module(uh?)
This commit is contained in:
parent
b1250a5fcb
commit
c3a8151ab1
7 changed files with 73 additions and 104 deletions
machines
modules/nixos
|
@ -1,79 +0,0 @@
|
|||
{
|
||||
device ? throw,
|
||||
...
|
||||
}:
|
||||
{
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
device = "/dev/nvme0n1";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
esp = {
|
||||
name = "EFI";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"umask=0077"
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "NIXOS";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "pool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
pool = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"compress=zstd:5"
|
||||
];
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [
|
||||
"compress=zstd:5"
|
||||
"subvol=persist"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"compress=zstd:5"
|
||||
"subvol=nix"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
self,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = with inputs; [
|
||||
"${self}/modules/nixos/disko/default.nix"
|
||||
disko.nixosModules.default
|
||||
hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
|
||||
];
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs = {
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
imports = lib.x.baseName (
|
||||
lib.x.umport {
|
||||
path = ./.;
|
||||
exclude = [ ./default.nix ];
|
||||
exclude = [
|
||||
./default.nix
|
||||
./disko
|
||||
];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
62
modules/nixos/disko/default.nix
Normal file
62
modules/nixos/disko/default.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
device ? "/dev/sda",
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
compress = "compress=zstd:8";
|
||||
in
|
||||
|
||||
{
|
||||
disko.devices.disk.default = {
|
||||
inherit device;
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
esp = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"umask=0077"
|
||||
];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
compress
|
||||
];
|
||||
};
|
||||
"/persistent" = {
|
||||
mountpoint = "/persistent";
|
||||
mountOptions = [
|
||||
compress
|
||||
];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
compress
|
||||
"noatime"
|
||||
"noacl"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
# DUMMY
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with x;
|
||||
let
|
||||
cfg = config.module.hardware.disko;
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
module.hardware.disko = {
|
||||
enable = mkBool false;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { };
|
||||
}
|
|
@ -33,7 +33,7 @@ in
|
|||
#sh
|
||||
''
|
||||
mkdir /btrfs_tmp
|
||||
mount ${toString dev} /btrfs_tmp
|
||||
mount /dev/disk/by-partlabel/disk-primary-root /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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue