1
1
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:
Linus Heckemann 2021-05-21 17:44:40 +02:00
parent c926887717
commit 10000edcda
4 changed files with 19 additions and 1 deletions

View File

@ -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.

View 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"
'';
})

View File

@ -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
{

View File

@ -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.
'';