chore: format with alejandra

This commit is contained in:
steveej 2023-02-07 18:24:28 +01:00
parent 05f0cbdfb4
commit 89f5f65f2d
181 changed files with 2720 additions and 2560 deletions

View file

@ -1,13 +1,15 @@
{ lib, config, ... }:
with lib;
let
{
lib,
config,
...
}:
with lib; let
cfg = config.hardware.opinionatedDisk;
ownLib = import ../lib/default.nix { };
ownLib = import ../lib/default.nix {};
in {
options.hardware.opinionatedDisk = {
enable = mkEnableOption "Enable opinionated filesystem layout";
diskId = mkOption { type = types.str; };
diskId = mkOption {type = types.str;};
encrypted = mkOption {
default = true;
type = types.bool;
@ -16,41 +18,45 @@ in {
config = lib.mkIf cfg.enable {
fileSystems."/boot" = {
device = (ownLib.disk.bootFsDevice cfg.diskId);
device = ownLib.disk.bootFsDevice cfg.diskId;
fsType = "vfat";
};
fileSystems."/" = {
device = (ownLib.disk.rootFsDevice cfg.diskId);
device = ownLib.disk.rootFsDevice cfg.diskId;
fsType = "btrfs";
options = [ "subvol=nixos" ];
options = ["subvol=nixos"];
};
fileSystems."/home" = {
device = (ownLib.disk.rootFsDevice cfg.diskId);
device = ownLib.disk.rootFsDevice cfg.diskId;
fsType = "btrfs";
options = [ "subvol=home" ];
options = ["subvol=home"];
};
swapDevices = [{ device = (ownLib.disk.swapFsDevice cfg.diskId); }];
swapDevices = [{device = ownLib.disk.swapFsDevice cfg.diskId;}];
boot.loader.grub = {
device = (ownLib.disk.bootGrubDevice cfg.diskId);
device = ownLib.disk.bootGrubDevice cfg.diskId;
enableCryptodisk = cfg.encrypted;
};
boot.initrd.luks.devices = lib.optionalAttrs cfg.encrypted
(builtins.listToAttrs [{
name = let
splitstring =
builtins.split "/" (ownLib.disk.bootLuksDevice cfg.diskId);
lastelem = (builtins.length splitstring) - 1;
in builtins.elemAt splitstring lastelem;
value = {
device = (ownLib.disk.bootLuksDevice cfg.diskId);
preLVM = true;
allowDiscards = true;
};
}]);
boot.initrd.luks.devices =
lib.optionalAttrs cfg.encrypted
(builtins.listToAttrs [
{
name = let
splitstring =
builtins.split "/" (ownLib.disk.bootLuksDevice cfg.diskId);
lastelem = (builtins.length splitstring) - 1;
in
builtins.elemAt splitstring lastelem;
value = {
device = ownLib.disk.bootLuksDevice cfg.diskId;
preLVM = true;
allowDiscards = true;
};
}
]);
};
}