mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
nixos: generalize copy-paste from stage-1 and zfs to utils
This commit is contained in:
parent
8da59c406c
commit
b267785c43
3 changed files with 6 additions and 6 deletions
|
@ -2,6 +2,10 @@ pkgs: with pkgs.lib;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
|
# Check whenever fileSystem is needed for boot
|
||||||
|
fsNeededForBoot = fs: fs.neededForBoot
|
||||||
|
|| elem fs.mountPoint [ "/" "/nix" "/nix/store" "/var" "/var/log" "/var/lib" "/etc" ];
|
||||||
|
|
||||||
# Check whenever `b` depends on `a` as a fileSystem
|
# Check whenever `b` depends on `a` as a fileSystem
|
||||||
# FIXME: it's incorrect to simply use hasPrefix here: "/dev/a" is not a parent of "/dev/ab"
|
# FIXME: it's incorrect to simply use hasPrefix here: "/dev/a" is not a parent of "/dev/ab"
|
||||||
fsBefore = a: b: ((any (x: elem x [ "bind" "move" ]) b.options) && (a.mountPoint == b.device))
|
fsBefore = a: b: ((any (x: elem x [ "bind" "move" ]) b.options) && (a.mountPoint == b.device))
|
||||||
|
|
|
@ -26,9 +26,7 @@ let
|
||||||
# The initrd only has to mount `/` or any FS marked as necessary for
|
# The initrd only has to mount `/` or any FS marked as necessary for
|
||||||
# booting (such as the FS containing `/nix/store`, or an FS needed for
|
# booting (such as the FS containing `/nix/store`, or an FS needed for
|
||||||
# mounting `/`, like `/` on a loopback).
|
# mounting `/`, like `/` on a loopback).
|
||||||
fileSystems = filter
|
fileSystems = filter utils.fsNeededForBoot config.system.build.fileSystems;
|
||||||
(fs: fs.neededForBoot || elem fs.mountPoint [ "/" "/nix" "/nix/store" "/var" "/var/log" "/var/lib" "/etc" ])
|
|
||||||
config.system.build.fileSystems;
|
|
||||||
|
|
||||||
|
|
||||||
# Some additional utilities needed in stage 1, like mount, lvm, fsck
|
# Some additional utilities needed in stage 1, like mount, lvm, fsck
|
||||||
|
|
|
@ -38,11 +38,9 @@ let
|
||||||
|
|
||||||
zfsFilesystems = filter (x: x.fsType == "zfs") config.system.build.fileSystems;
|
zfsFilesystems = filter (x: x.fsType == "zfs") config.system.build.fileSystems;
|
||||||
|
|
||||||
isRoot = fs: fs.neededForBoot || elem fs.mountPoint [ "/" "/nix" "/nix/store" "/var" "/var/log" "/var/lib" "/etc" ];
|
|
||||||
|
|
||||||
allPools = unique ((map fsToPool zfsFilesystems) ++ cfgZfs.extraPools);
|
allPools = unique ((map fsToPool zfsFilesystems) ++ cfgZfs.extraPools);
|
||||||
|
|
||||||
rootPools = unique (map fsToPool (filter isRoot zfsFilesystems));
|
rootPools = unique (map fsToPool (filter fsNeededForBoot zfsFilesystems));
|
||||||
|
|
||||||
dataPools = unique (filter (pool: !(elem pool rootPools)) allPools);
|
dataPools = unique (filter (pool: !(elem pool rootPools)) allPools);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue