mirror of
https://github.com/nmasur/dotfiles
synced 2025-04-23 19:12:23 +00:00
Compare commits
3 Commits
48d33a9ef5
...
ac3d5e495c
Author | SHA1 | Date | |
---|---|---|---|
|
ac3d5e495c | ||
|
252b3d5dac | ||
|
6d0b0e3560 |
131
hosts/swan/disks.nix
Normal file
131
hosts/swan/disks.nix
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
{ bootDisk, storageDisks ? [ "/dev/vdb" "/dev/vdc" ], ... }: {
|
||||||
|
disk = {
|
||||||
|
boot = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/whatever";
|
||||||
|
content = {
|
||||||
|
type = "table";
|
||||||
|
format = "gpt";
|
||||||
|
partitions = [
|
||||||
|
{
|
||||||
|
type = "partition";
|
||||||
|
name = "ESP";
|
||||||
|
start = "0";
|
||||||
|
end = "512MiB";
|
||||||
|
fs-type = "fat32";
|
||||||
|
bootable = true;
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
type = "partition";
|
||||||
|
name = "root";
|
||||||
|
start = "512MiB";
|
||||||
|
end = "100%";
|
||||||
|
part-type = "primary";
|
||||||
|
bootable = true;
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
a = {
|
||||||
|
type = "disk";
|
||||||
|
device = builtins.elemAt storageDisks 1;
|
||||||
|
content = {
|
||||||
|
type = "table";
|
||||||
|
format = "gpt";
|
||||||
|
partitions = [{
|
||||||
|
type = "partition";
|
||||||
|
name = "zfs";
|
||||||
|
start = "128MiB";
|
||||||
|
end = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "tank";
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
tank = {
|
||||||
|
type = "zpool";
|
||||||
|
mode = "raidz1";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "on"; # lz4 by default
|
||||||
|
"com.sun:auto-snapshot" = "false";
|
||||||
|
ashift = 12;
|
||||||
|
};
|
||||||
|
# mountpoint = "/";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
media = {
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
mountpoint = "none";
|
||||||
|
options."com.sun:auto-snapshot" = "false";
|
||||||
|
};
|
||||||
|
# "media/movies" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/media/movies";
|
||||||
|
# options.recordsize = "1M";
|
||||||
|
# };
|
||||||
|
# "media/tv" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/media/tv";
|
||||||
|
# options.recordsize = "1M";
|
||||||
|
# };
|
||||||
|
# "media/books" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/media/books";
|
||||||
|
# };
|
||||||
|
# archive = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/archive";
|
||||||
|
# options.compression = "zstd";
|
||||||
|
# options."com.sun:auto-snapshot" = "true";
|
||||||
|
# };
|
||||||
|
# zfs_unmounted_fs = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# options.mountpoint = "none";
|
||||||
|
# };
|
||||||
|
# zfs_legacy_fs = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# options.mountpoint = "legacy";
|
||||||
|
# mountpoint = "/zfs_legacy_fs";
|
||||||
|
# };
|
||||||
|
# zfs_testvolume = {
|
||||||
|
# zfs_type = "volume";
|
||||||
|
# size = "10M";
|
||||||
|
# content = {
|
||||||
|
# type = "filesystem";
|
||||||
|
# format = "ext4";
|
||||||
|
# mountpoint = "/ext4onzfs";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
encrypted = {
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
size = "20M";
|
||||||
|
options = {
|
||||||
|
mountpoint = "none";
|
||||||
|
encryption = "aes-256-gcm";
|
||||||
|
keyformat = "passphrase";
|
||||||
|
keylocation = "file:///tmp/secret.key";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"encrypted/test" = {
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
size = "2M";
|
||||||
|
mountpoint = "/zfs_crypted";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -16,5 +16,6 @@
|
|||||||
driSupport = true;
|
driSupport = true;
|
||||||
driSupport32Bit = true;
|
driSupport32Bit = true;
|
||||||
};
|
};
|
||||||
|
programs.gamemode.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,17 @@
|
|||||||
|
|
||||||
# Prevent wake from keyboard
|
# Prevent wake from keyboard
|
||||||
powerManagement.powerDownCommands = ''
|
powerManagement.powerDownCommands = ''
|
||||||
for wakeup in /sys/bus/usb/devices/1-*/power/wakeup; do echo disabled > $wakeup; done
|
# for power in /sys/bus/usb/devices/*/power; do echo disabled > ''${power}/wakeup; done
|
||||||
|
|
||||||
|
# AMD issue: https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Instantaneous_wakeups_from_suspend
|
||||||
|
for power in /sys/bus/i2c/devices/i2c-*/device/power; do echo disabled > ''${power}/wakeup; done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# From here: https://www.reddit.com/r/NixOS/comments/wcu34f/how_would_i_do_this_in_nix/
|
||||||
|
# services.udev.extraRules = ''
|
||||||
|
# ACTION=="add", SUBSYSTEM=="i2c", ATTRS{idVendor}=="<vendor>", ATTRS{idProduct}=="<product>" RUN+="${pkgs.bash}/bin/bash -c 'echo disabled > /sys/bus/i2c/devices/i2c-*/power/wakeup'"
|
||||||
|
# '';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user