chore: nix fmt

This commit is contained in:
514fpv 2025-01-13 11:52:09 +08:00
parent a80bd4ed3b
commit 7266fff06e
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
128 changed files with 3402 additions and 2013 deletions

View file

@ -1,9 +1,14 @@
{ pkgs
, lib
, config
, ... }: with lib; let
{
pkgs,
lib,
config,
...
}:
with lib;
let
cfg = config.global.fs;
in {
in
{
imports = [
./alert.nix
./split.nix
@ -15,8 +20,12 @@ in {
# -O compression=on -O mountpoint=none -O xattr=sa -O acltype=posixacl
options.global.fs.zfs = {
alert = {
zed = mkEnableOption "zfs event alerts" // { default = true; };
swraid = mkEnableOption "software raid alerts" // { default = true; };
zed = mkEnableOption "zfs event alerts" // {
default = true;
};
swraid = mkEnableOption "software raid alerts" // {
default = true;
};
secret = mkOption {
type = with types; nullOr str;
default = null;
@ -68,7 +77,11 @@ in {
};
datasets = mkOption {
type = with types; listOf str;
default = [ "persist" "service" "storage" ];
default = [
"persist"
"service"
"storage"
];
description = "list of filesystems to perform replication for";
};
sendOptions = mkOption {
@ -80,19 +93,25 @@ in {
};
config = mkIf (cfg.type == "zfs") {
fileSystems = (mapAttrs (path: dataset: {
device = "${cfg.zfs.persist}/${dataset}";
fsType = "zfs";
options = [ "zfsutil" ];
# required by impermanence
neededForBoot = true;
}) cfg.zfs.mountpoints) // {
"/nix" = (if !cfg.zfs.externalStore then
{ device = "${cfg.store}/nix";
fsType = "zfs";
} else
{ inherit (cfg.external) device fsType options; });
};
fileSystems =
(mapAttrs (path: dataset: {
device = "${cfg.zfs.persist}/${dataset}";
fsType = "zfs";
options = [ "zfsutil" ];
# required by impermanence
neededForBoot = true;
}) cfg.zfs.mountpoints)
// {
"/nix" = (
if !cfg.zfs.externalStore then
{
device = "${cfg.store}/nix";
fsType = "zfs";
}
else
{ inherit (cfg.external) device fsType options; }
);
};
global.fs.zfs.mountpoints."/nix/persist" = "persist";
services.zfs.trim.enable = true;