1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

nixos/lib/make-btrfs-fs: Use fakeroot and faketime (#265686)

This commit is contained in:
Samuel Cormier-Iijima 2023-11-06 19:17:38 -05:00 committed by GitHub
parent 9975ea9c37
commit 61bdb29a05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,8 @@
, volumeLabel
, uuid ? "44444444-4444-4444-8888-888888888888"
, btrfs-progs
, libfaketime
, fakeroot
}:
let
@ -23,7 +25,7 @@ in
pkgs.stdenv.mkDerivation {
name = "btrfs-fs.img${lib.optionalString compressImage ".zst"}";
nativeBuildInputs = [ btrfs-progs ] ++ lib.optional compressImage zstd;
nativeBuildInputs = [ btrfs-progs libfaketime fakeroot ] ++ lib.optional compressImage zstd;
buildCommand =
''
@ -50,7 +52,7 @@ pkgs.stdenv.mkDerivation {
cp ${sdClosureInfo}/registration ./rootImage/nix-path-registration
touch $img
mkfs.btrfs -L ${volumeLabel} -U ${uuid} -r ./rootImage --shrink $img
faketime -f "1970-01-01 00:00:01" fakeroot mkfs.btrfs -L ${volumeLabel} -U ${uuid} -r ./rootImage --shrink $img
if ! btrfs check $img; then
echo "--- 'btrfs check' failed for BTRFS image ---"