mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-11 23:50:05 +01:00
run nix fmt
This commit is contained in:
parent
834b7b2a33
commit
af27d7917d
5 changed files with 46 additions and 30 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
buildLinux (args // {
|
buildLinux (args // {
|
||||||
# NOTE: bcachefs-tools should be updated simultaneously to preserve compatibility
|
# NOTE: bcachefs-tools should be updated simultaneously to preserve compatibility
|
||||||
version = "6.3.0-2023-05-02";
|
version = "6.3.0-2023-05-02";
|
||||||
|
|
||||||
modDirVersion = "6.3.0";
|
modDirVersion = "6.3.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,11 @@
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = diskoLib.jsonType;
|
type = diskoLib.jsonType;
|
||||||
default =
|
default =
|
||||||
diskoLib.deepMergeMap (lv:
|
diskoLib.deepMergeMap
|
||||||
lib.optionalAttrs (lv.content != null) (lv.content._meta [ "lvm_vg" config.name ])
|
(lv:
|
||||||
) (lib.attrValues config.lvs);
|
lib.optionalAttrs (lv.content != null) (lv.content._meta [ "lvm_vg" config.name ])
|
||||||
|
)
|
||||||
|
(lib.attrValues config.lvs);
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
@ -71,9 +73,11 @@
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = _:
|
default = _:
|
||||||
let
|
let
|
||||||
lvMounts = diskoLib.deepMergeMap (lv:
|
lvMounts = diskoLib.deepMergeMap
|
||||||
lib.optionalAttrs (lv.content != null) (lv.content._mount { dev = "/dev/${config.name}/${lv.name}"; })
|
(lv:
|
||||||
) (lib.attrValues config.lvs);
|
lib.optionalAttrs (lv.content != null) (lv.content._mount { dev = "/dev/${config.name}/${lv.name}"; })
|
||||||
|
)
|
||||||
|
(lib.attrValues config.lvs);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
dev = ''
|
dev = ''
|
||||||
|
|
@ -87,21 +91,25 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default =
|
default =
|
||||||
map (lv: [
|
map
|
||||||
(lib.optional (lv.content != null) (lv.content._config "/dev/${config.name}/${lv.name}"))
|
(lv: [
|
||||||
(lib.optional (lv.lvm_type != null) {
|
(lib.optional (lv.content != null) (lv.content._config "/dev/${config.name}/${lv.name}"))
|
||||||
boot.initrd.kernelModules = [ "dm-${lv.lvm_type}" ];
|
(lib.optional (lv.lvm_type != null) {
|
||||||
})
|
boot.initrd.kernelModules = [ "dm-${lv.lvm_type}" ];
|
||||||
]) (lib.attrValues config.lvs);
|
})
|
||||||
|
])
|
||||||
|
(lib.attrValues config.lvs);
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
||||||
default = pkgs: lib.flatten (map (lv:
|
default = pkgs: lib.flatten (map
|
||||||
lib.optional (lv.content != null) (lv.content._pkgs pkgs)
|
(lv:
|
||||||
) (lib.attrValues config.lvs));
|
lib.optional (lv.content != null) (lv.content._pkgs pkgs)
|
||||||
|
)
|
||||||
|
(lib.attrValues config.lvs));
|
||||||
description = "Packages";
|
description = "Packages";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,11 @@
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev:
|
default = dev:
|
||||||
lib.foldr lib.recursiveUpdate {} (lib.imap (index: partition:
|
lib.foldr lib.recursiveUpdate { } (lib.imap
|
||||||
lib.optionalAttrs (partition.content != null) (partition.content._meta dev)
|
(index: partition:
|
||||||
) config.partitions);
|
lib.optionalAttrs (partition.content != null) (partition.content._meta dev)
|
||||||
|
)
|
||||||
|
config.partitions);
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
@ -99,9 +101,11 @@
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = { dev }:
|
default = { dev }:
|
||||||
let
|
let
|
||||||
partMounts = lib.foldr lib.recursiveUpdate {} (lib.imap (index: partition:
|
partMounts = lib.foldr lib.recursiveUpdate { } (lib.imap
|
||||||
lib.optionalAttrs (partition.content != null) (partition.content._mount { dev = diskoLib.deviceNumbering dev index; })
|
(index: partition:
|
||||||
) config.partitions);
|
lib.optionalAttrs (partition.content != null) (partition.content._mount { dev = diskoLib.deviceNumbering dev index; })
|
||||||
|
)
|
||||||
|
config.partitions);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
dev = partMounts.dev or "";
|
dev = partMounts.dev or "";
|
||||||
|
|
@ -112,9 +116,11 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = dev:
|
default = dev:
|
||||||
lib.imap (index: partition:
|
lib.imap
|
||||||
lib.optional (partition.content != null) (partition.content._config (diskoLib.deviceNumbering dev index))
|
(index: partition:
|
||||||
) config.partitions;
|
lib.optional (partition.content != null) (partition.content._config (diskoLib.deviceNumbering dev index))
|
||||||
|
)
|
||||||
|
config.partitions;
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
|
|
@ -122,9 +128,11 @@
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
||||||
default = pkgs:
|
default = pkgs:
|
||||||
[ pkgs.parted pkgs.systemdMinimal ] ++ lib.flatten (map (partition:
|
[ pkgs.parted pkgs.systemdMinimal ] ++ lib.flatten (map
|
||||||
lib.optional (partition.content != null) (partition.content._pkgs pkgs)
|
(partition:
|
||||||
) config.partitions);
|
lib.optional (partition.content != null) (partition.content._pkgs pkgs)
|
||||||
|
)
|
||||||
|
config.partitions);
|
||||||
description = "Packages";
|
description = "Packages";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = lib.types.functionTo diskoLib.jsonType;
|
type = lib.types.functionTo diskoLib.jsonType;
|
||||||
default = dev: {};
|
default = dev: { };
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
zpool import -l -R ${config.mountRoot} '${config.name}'
|
zpool import -l -R ${config.mountRoot} '${config.name}'
|
||||||
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues datasetMounts)}
|
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues datasetMounts)}
|
||||||
'';
|
'';
|
||||||
fs = (datasetMounts.fs or {}) // lib.optionalAttrs (config.mountpoint != null) {
|
fs = (datasetMounts.fs or { }) // lib.optionalAttrs (config.mountpoint != null) {
|
||||||
${config.mountpoint} = ''
|
${config.mountpoint} = ''
|
||||||
if ! findmnt ${config.name} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
if ! findmnt ${config.name} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
||||||
mount ${config.name} "${rootMountPoint}${config.mountpoint}" \
|
mount ${config.name} "${rootMountPoint}${config.mountpoint}" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue