i need to start making smaller commits
This commit is contained in:
parent
29473532c7
commit
088b45ff45
19 changed files with 397 additions and 23 deletions
|
@ -1,16 +1,21 @@
|
|||
{
|
||||
{lib, ...}: {
|
||||
imports = [
|
||||
./hardware.nix
|
||||
./hibernate-boot.nix
|
||||
];
|
||||
|
||||
networking.hostName = "nixdesk";
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/lib/swapfile";
|
||||
size = 16 * 1024;
|
||||
}
|
||||
];
|
||||
#swapDevices = lib.singleton {
|
||||
# device = "/dev/disk/by-uuid/1dcce4ab-71da-4928-83d5-62b20fd0fddf";
|
||||
#};
|
||||
|
||||
#boot.resumeDevice = "/dev/disk/by-uuid/1dcce4ab-71da-4928-83d5-62b20fd0fddf";
|
||||
|
||||
#boot.kernelParams = [
|
||||
# "resume=UUID=1dcce4ab-71da-4928-83d5-62b20fd0fddf"
|
||||
# "resume_offset=3841492992" # fdisk -l
|
||||
#];
|
||||
|
||||
networking.interfaces.eno1.wakeOnLan.enable = true;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
|
@ -59,12 +60,25 @@
|
|||
fsType = "btrfs";
|
||||
options = ["subvol=nix" "compress=zstd" "noatime"];
|
||||
};
|
||||
"/.swapvol" = {
|
||||
device = "/dev/disk/by-uuid/d87276c0-ef9c-422e-b2de-effc1b47c654";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=swap" "noatime"];
|
||||
};
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/588B-CB97";
|
||||
fsType = "vfat";
|
||||
};
|
||||
};
|
||||
|
||||
boot.resumeDevice = "/dev/disk/by-uuid/d87276c0-ef9c-422e-b2de-effc1b47c654";
|
||||
# btrfs inspect-internal map-swapfile -r /.swapvol/swapfile
|
||||
boot.kernelParams = ["resume_offset=76293376"];
|
||||
|
||||
swapDevices = lib.singleton {
|
||||
device = "/.swapvol/swapfile";
|
||||
};
|
||||
|
||||
hardware.enableAllFirmware = true;
|
||||
|
||||
services.xserver.videoDrivers = [
|
||||
|
|
28
hosts/nixdesk/hibernate-boot.nix
Normal file
28
hosts/nixdesk/hibernate-boot.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{pkgs, ...}: {
|
||||
# hibernate and reboot to firmware
|
||||
# this allows me to save linux state and boot into another os (such as windows)
|
||||
# make sure not to mount any filesystems from the other os or you risk losing data
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellScriptBin "hib-boot" ''
|
||||
set -e
|
||||
|
||||
if [ ! -v 1 ]; then
|
||||
echo "no argument provided"
|
||||
echo "please provide the id for the os you want to boot"
|
||||
echo "these are the valid id's:"
|
||||
echo ""
|
||||
${pkgs.efibootmgr}/bin/efibootmgr
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -w /sys/power/disk -o ! -w /sys/power/state ]; then
|
||||
echo "you lack permission to write to /sys/power/{disk,state}, are you not running this script as root?"
|
||||
exit
|
||||
fi
|
||||
|
||||
${pkgs.efibootmgr}/bin/efibootmgr -n "$1" >/dev/null
|
||||
echo reboot >/sys/power/disk
|
||||
echo disk >/sys/power/state
|
||||
'')
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue