snowfall lib migration wip
This commit is contained in:
parent
b9dadac2af
commit
ed08a98651
31 changed files with 1067 additions and 172 deletions
|
|
@ -14,6 +14,20 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
zramSwap = {
|
||||
enable = true; # Hopefully? helps with freezing when using swap
|
||||
};
|
||||
boot = {
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
loader = {
|
||||
systemd-boot.enable = !config.${namespace}.hardware.secureBoot.enable;
|
||||
efi.canTouchEfiVariables = !config.${namespace}.hardware.asahi.enable;
|
||||
};
|
||||
# Hide the OS choice for bootloaders.
|
||||
# It's still possible to open the bootloader list by pressing any key
|
||||
# It will just not appear on screen unless a key is pressed
|
||||
loader.timeout = 0;
|
||||
};
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
|
|
|
|||
121
modules/nixos/presets/disko/impermanenceBtrfs/default.nix
Normal file
121
modules/nixos/presets/disko/impermanenceBtrfs/default.nix
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
namespace,
|
||||
system,
|
||||
target,
|
||||
format,
|
||||
virtual,
|
||||
systems,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.${namespace}; let
|
||||
cfg = config.${namespace}.presets.disko.impermanenceBtrfs;
|
||||
in {
|
||||
options.${namespace}.presets.disko.impermanenceBtrfs = with types; {
|
||||
enable = mkBoolOpt false "Enable preset";
|
||||
device = mkOpt' str "/dev/nvme0n1";
|
||||
swapSize = mkOpt' int 32;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
inherit (cfg) device;
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "${builtins.toString cfg.swapSize}G";
|
||||
content = {
|
||||
type = "swap";
|
||||
resumeDevice = true;
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "root_vg";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
lvm_vg = {
|
||||
root_vg = {
|
||||
type = "lvm_vg";
|
||||
lvs = {
|
||||
root = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-f"];
|
||||
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
|
||||
"/persist" = {
|
||||
mountOptions = ["subvol=persist" "noatime"];
|
||||
mountpoint = "/persist";
|
||||
};
|
||||
|
||||
"/nix" = {
|
||||
mountOptions = ["subvol=nix" "noatime"];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
boot.initrd.postDeviceCommands = ''
|
||||
mkdir -p /btrfs_tmp
|
||||
mount /dev/root_vg/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")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -25,10 +25,14 @@ in {
|
|||
presets.wayland = enabled;
|
||||
hardware.printing = enabled;
|
||||
hardware.bluetooth = enabled;
|
||||
#programs.fastfetch = {
|
||||
# enable = true;
|
||||
# firstNixOSInstall = 1729112485;
|
||||
#};
|
||||
gpg = enabled;
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
user = "kylekrein";
|
||||
enable = true;
|
||||
user = "kylekrein";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -71,44 +75,44 @@ in {
|
|||
element-desktop
|
||||
];
|
||||
programs.kdeconnect.enable = true;
|
||||
programs.kdeconnect.package = lib.mkDefault pkgs.kdePackages.kdeconnect-kde;
|
||||
programs.kdeconnect.package = lib.mkDefault pkgs.kdePackages.kdeconnect-kde;
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts.jetbrains-mono
|
||||
font-awesome
|
||||
nerd-fonts.symbols-only
|
||||
hack-font
|
||||
# microsoft fonts:
|
||||
#corefonts
|
||||
#vistafonts
|
||||
];
|
||||
nerd-fonts.jetbrains-mono
|
||||
font-awesome
|
||||
nerd-fonts.symbols-only
|
||||
hack-font
|
||||
# microsoft fonts:
|
||||
#corefonts
|
||||
#vistafonts
|
||||
];
|
||||
environment.sessionVariables = {
|
||||
MANPAGER = "emacsclient -c";
|
||||
EDITOR = "emacsclient -c";
|
||||
};
|
||||
MANPAGER = "emacsclient -c";
|
||||
EDITOR = "emacsclient -c";
|
||||
};
|
||||
hardware = {
|
||||
logitech.wireless.enable = true;
|
||||
};
|
||||
logitech.wireless.enable = true;
|
||||
};
|
||||
|
||||
security.polkit.enable = true;
|
||||
security.polkit.enable = true;
|
||||
|
||||
#programs.thunar = {
|
||||
# enable = true;
|
||||
# plugins = with pkgs.xfce; [
|
||||
# thunar-archive-plugin
|
||||
# thunar-volman
|
||||
# ];
|
||||
# };
|
||||
#programs.xfconf.enable = true; # so thunar can save config
|
||||
#services.gvfs.enable = true; # Mount, trash, and other functionalities
|
||||
#services.tumbler.enable = true; # Thumbnail support for images
|
||||
#programs.thunar = {
|
||||
# enable = true;
|
||||
# plugins = with pkgs.xfce; [
|
||||
# thunar-archive-plugin
|
||||
# thunar-volman
|
||||
# ];
|
||||
# };
|
||||
#programs.xfconf.enable = true; # so thunar can save config
|
||||
#services.gvfs.enable = true; # Mount, trash, and other functionalities
|
||||
#services.tumbler.enable = true; # Thumbnail support for images
|
||||
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue