stuff
This commit is contained in:
@@ -185,7 +185,7 @@ in
|
|||||||
esac
|
esac
|
||||||
echo "path:"
|
echo "path:"
|
||||||
while [[ -L "$path" ]]; do
|
while [[ -L "$path" ]]; do
|
||||||
dest="$(readlink "$path")"
|
declare dest="$(readlink -- "$path")"
|
||||||
echo " $path is a symlink to $dest"
|
echo " $path is a symlink to $dest"
|
||||||
if [[ "$dest" != /* ]]; then
|
if [[ "$dest" != /* ]]; then
|
||||||
dest="$(dirname -- "$path")/$dest"
|
dest="$(dirname -- "$path")/$dest"
|
||||||
|
8
flake.lock
generated
8
flake.lock
generated
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1749092770,
|
"lastModified": 1751161021,
|
||||||
"narHash": "sha256-qb8L1q5Gu+RoysPymHn+fR7OpmIcbuWQnxk75m4wXP4=",
|
"narHash": "sha256-vQn7xm264wIEG8ZA2UIumy5KiwsMOfmU0twISf0DLYM=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "4d09eb6a7442b0cc520831bb4cd3d957ac6ab8dc",
|
"rev": "b2f7daa80bfb441e25d5e2c53edab8c86a26b5bd",
|
||||||
"revCount": 1249,
|
"revCount": 1250,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.uninsane.org/shelvacu/disko.git"
|
"url": "https://git.uninsane.org/shelvacu/disko.git"
|
||||||
},
|
},
|
||||||
|
@@ -33,10 +33,14 @@ let
|
|||||||
size = "${builtins.toString sizeKi}K";
|
size = "${builtins.toString sizeKi}K";
|
||||||
type = fs_type_zfs;
|
type = fs_type_zfs;
|
||||||
priority = 1000 + value.idx;
|
priority = 1000 + value.idx;
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = poolname;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
) slabsMin;
|
) slabsMin;
|
||||||
slapParts = lib.mapAttrs (_: v: v.partitionConfig) slabs;
|
slabParts = lib.mapAttrs (_: v: v.partitionConfig) slabs;
|
||||||
path_prefix = "/dev/disk/by-id/";
|
path_prefix = "/dev/disk/by-id/";
|
||||||
# 8TB
|
# 8TB
|
||||||
seagate_1 = "ata-ST8000DM004-2U9188_ZR115511";
|
seagate_1 = "ata-ST8000DM004-2U9188_ZR115511";
|
||||||
@@ -83,19 +87,51 @@ let
|
|||||||
fs_type_zfs = "a504"; # FreeBSD ZFS
|
fs_type_zfs = "a504"; # FreeBSD ZFS
|
||||||
poolname = "propdata";
|
poolname = "propdata";
|
||||||
|
|
||||||
mk_configs = { groupName, drives, partitions }:
|
diskName = groupName: id: "${groupName}_${lib.last (lib.splitString "_" id)}";
|
||||||
builtins.listToAttrs (map (name: {
|
mk_configs = { groupName, diskIds, partitions }:
|
||||||
name = "${groupName}_${lib.last (lib.splitString "_" name)}}";
|
builtins.listToAttrs (map (id: {
|
||||||
|
name = diskName groupName id;
|
||||||
value = {
|
value = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = path_prefix + name;
|
device = path_prefix + id;
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
inherit partitions;
|
inherit partitions;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}) drives)
|
}) diskIds)
|
||||||
;
|
;
|
||||||
|
groupAttrs = {
|
||||||
|
easystore14active = {
|
||||||
|
groupName = "easystore14active";
|
||||||
|
diskIds = easystores_14_active;
|
||||||
|
partitions = {
|
||||||
|
inherit (slabParts) slabA slabB slabC;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
easystore14spare = {
|
||||||
|
groupName = "easystore14spare";
|
||||||
|
diskIds = easystores_14_spare;
|
||||||
|
partitions = {
|
||||||
|
inherit (slabParts) slabA slabB slabC;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
easystore10 = {
|
||||||
|
groupName = "easystore10";
|
||||||
|
diskIds = easystores_10;
|
||||||
|
partitions = {
|
||||||
|
inherit (slabParts) slabA slabB;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
seagate8 = {
|
||||||
|
groupName = "seagate8";
|
||||||
|
diskIds = seagates;
|
||||||
|
partitions = {
|
||||||
|
inherit (slabParts) slabA;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
partNames = groupName: partName: map (id: (diskName groupName id)+"-"+partName) groupAttrs.${groupName}.diskIds;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.disko.nixosModules.default ];
|
imports = [ inputs.disko.nixosModules.default ];
|
||||||
@@ -111,27 +147,10 @@ in
|
|||||||
checkScripts = true;
|
checkScripts = true;
|
||||||
rootMountPoint = "/";
|
rootMountPoint = "/";
|
||||||
devices.disk = {}
|
devices.disk = {}
|
||||||
// mk_configs {
|
// mk_configs groupAttrs.easystore14active
|
||||||
groupName = "easystore14";
|
// mk_configs groupAttrs.easystore14spare
|
||||||
drives = easystores_14;
|
// mk_configs groupAttrs.easystore10
|
||||||
partitions = {
|
// mk_configs groupAttrs.seagate8
|
||||||
inherit (slapParts) slabA slabB slabC;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// mk_configs {
|
|
||||||
groupName = "easystore10";
|
|
||||||
drives = easystores_10;
|
|
||||||
partitions = {
|
|
||||||
inherit (slapParts) slabA slabB;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// mk_configs {
|
|
||||||
groupName = "seagate8";
|
|
||||||
drives = seagates;
|
|
||||||
partitions = {
|
|
||||||
inherit (slapParts) slabA;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
devices.zpool."${poolname}" = {
|
devices.zpool."${poolname}" = {
|
||||||
type = "zpool";
|
type = "zpool";
|
||||||
@@ -154,26 +173,26 @@ in
|
|||||||
redundant_metadata = "most";
|
redundant_metadata = "most";
|
||||||
xattr = "sa";
|
xattr = "sa";
|
||||||
};
|
};
|
||||||
mode = {
|
mode.topology = {
|
||||||
type = "topology";
|
type = "topology";
|
||||||
vdev = [
|
vdev = [
|
||||||
# slabA
|
# slabA
|
||||||
{
|
{
|
||||||
mode = "raidz3";
|
mode = "raidz3";
|
||||||
members = map (drive: path_prefix+drive+"-part1") (seagates ++ easystores_10 ++ easystores_14_active);
|
members = lib.concatMap (a: partNames a "slabA") [ "seagate8" "easystore10" "easystore14active" ];
|
||||||
}
|
}
|
||||||
# slabB
|
# slabB
|
||||||
{
|
{
|
||||||
mode = "raidz3";
|
mode = "raidz3";
|
||||||
members = map (drive: path_prefix+drive+"-part2") (easystores_10 ++ easystores_14_active);
|
members = lib.concatMap (a: partNames a "slabB") [ "easystore10" "easystore14active" ];
|
||||||
}
|
}
|
||||||
# slabC
|
# slabC
|
||||||
{
|
{
|
||||||
mode = "raidz3";
|
mode = "raidz3";
|
||||||
members = map (drive: path_prefix+drive+"-part3") easystores_14_active;
|
members = partNames "easystore14active" "slabC";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
spare = easystores_14_spare;
|
spare = lib.concatMap (b: partNames "easystore14spare" b) (builtins.attrNames slabs);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user