mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-09-19 07:47:20 +03:00
imageBuilder: add btrfs support
This commit is contained in:
parent
c926887717
commit
10000edcda
@ -16,6 +16,7 @@ makeScope newScope (self:
|
||||
# Use stand-alone (outside of a disk image) is supported.
|
||||
fileSystem = {
|
||||
makeExt4 = callPackage ./makeExt4.nix {};
|
||||
makeBtrfs = callPackage ./makeBtrfs.nix {};
|
||||
makeFAT32 = callPackage ./makeFAT32.nix {};
|
||||
# Specialization of `makeFAT32` with (1) filesystemType showing as ESP,
|
||||
# and (2) the name defaults to ESP.
|
||||
|
15
lib/image-builder/makeBtrfs.nix
Normal file
15
lib/image-builder/makeBtrfs.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{ lib, imageBuilder, libfaketime, btrfs-progs }:
|
||||
{ partitionID, ... }@args:
|
||||
imageBuilder.makeFilesystem (args // {
|
||||
filesystemType = "btrfs";
|
||||
blockSize = 4096; # dummy
|
||||
nativeBuildInputs = [btrfs-progs];
|
||||
copyPhase = ''
|
||||
mkfs.btrfs \
|
||||
-r . \
|
||||
-L "$partName" \
|
||||
-U "$partitionID" \
|
||||
--shrink \
|
||||
"$img"
|
||||
'';
|
||||
})
|
@ -18,6 +18,7 @@ let
|
||||
"ext2" = "0FC63DAF-8483-4772-8E79-3D69D8477DE4";
|
||||
"ext3" = "0FC63DAF-8483-4772-8E79-3D69D8477DE4";
|
||||
"ext4" = "0FC63DAF-8483-4772-8E79-3D69D8477DE4";
|
||||
"btrfs" = "0FC63DAF-8483-4772-8E79-3D69D8477DE4";
|
||||
};
|
||||
in
|
||||
{
|
||||
|
@ -8,13 +8,14 @@ let
|
||||
|
||||
filesystemFunctions = {
|
||||
"ext4" = pkgs.imageBuilder.fileSystem.makeExt4;
|
||||
"btrfs" = pkgs.imageBuilder.fileSystem.makeBtrfs;
|
||||
};
|
||||
|
||||
filesystemSubmodule =
|
||||
{ name, config, ... }: {
|
||||
options = {
|
||||
type = lib.mkOption {
|
||||
type = types.enum [ "ext4" ];
|
||||
type = types.enum [ "ext4" "btrfs" ];
|
||||
description = ''
|
||||
Type of the generated filesystem.
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user