Warning
This repo is being archived, it was only created to use XenOrchestra on nix and now that nixpkg grabs libvhdi from it's upstream source automatically
Standalone Nix packaging for libvhdi, the libyal library and toolset for reading Virtual Hard Disk images.
This repository is kept close to nixpkgs form so default.nix can be copied to
pkgs/by-name/li/libvhdi/package.nix with minimal changes.
Current upstream release: 20251119
libvhdi: shared library for VHD and VHDX accessvhdiinfo: command-line VHD/VHDX metadata inspection toolvhdimount: FUSE-based VHD/VHDX mounting tool
Python bindings are disabled for the initial package. Upstream libvhdi supports
FUSE2 and FUSE3 as alternative configure-time backends; it does not build one
vhdimount binary that links both. This flake exposes both backends as separate
derivations:
libvhdi/libvhdi-fuse3: default upstream-preferred FUSE3 buildlibvhdi-fuse2: FUSE2 compatibility build
Build the default FUSE3 package:
nix build .#libvhdi -LBuild a specific FUSE backend:
nix build .#libvhdi-fuse2 -L
nix build .#libvhdi-fuse3 -LRun the installed tools:
./result/bin/vhdiinfo -V
./result/bin/vhdimount -VRun the flake checks:
nix flake check --no-write-lock-file -L{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
libvhdi.url = "git+https://codeberg.org/NiXOA/libvhdi.git";
};
outputs = { nixpkgs, libvhdi, ... }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
environment.systemPackages = [
libvhdi.packages.x86_64-linux.libvhdi
];
}
];
};
};
}packages.x86_64-linux.libvhdipackages.x86_64-linux.defaultpackages.x86_64-linux.libvhdi-fuse2packages.x86_64-linux.libvhdi-fuse3packages.x86_64-linux.libvhdi-testchecks.x86_64-linux.libvhdi-fuse2checks.x86_64-linux.libvhdi-fuse3
The flake currently declares only x86_64-linux outputs, matching the local and
CI build target for this package repository.
Enter the development shell:
nix developCommon checks:
nix develop .#default -c nixpkgs-fmt --check default.nix flake.nix
nix develop .#default -c shellcheck update.sh
nix build .#libvhdi -L
nix build .#libvhdi-fuse2 -L
nix build .#libvhdi-fuse3 -L
nix flake check --no-write-lock-file -LThe derivation enables upstream make check and patches test shebangs before
the check phase. The install check verifies that libvhdi.so, vhdiinfo, and
vhdimount are installed, runs both tools with -V, and confirms that
vhdimount links the selected FUSE backend.
Update default.nix to the newest upstream YYYYMMDD release tag:
./update.shThe updater:
- reads the current hardcoded
versionfromdefault.nix - finds the latest upstream release tag from
libyal/libvhdi - verifies that the release tarball exists
- prefetches the source with
nix store prefetch-file - updates the hardcoded
versionandhash
After an update, run:
nix develop .#default -c nixpkgs-fmt default.nix flake.nix
nix build .#libvhdi-fuse2 -L
nix build .#libvhdi-fuse3 -L
nix flake check --no-write-lock-file -LThe GitHub Actions workflow in
.github/workflows/update-check.yml runs on
a daily schedule and can also be started manually. When it sees a newer upstream
libvhdi YYYYMMDD tag, it:
- reads package versions from the flake with
nix eval - runs
./update.sh, which uses Nix's built-innix store prefetch-file - formats and lints the package files
- builds
.#libvhdi-fuse2and.#libvhdi-fuse3 - runs
nix flake check --no-write-lock-file -L - pushes the built variant outputs to Cachix when
CACHIX_CACHE_NAMEandCACHIX_AUTH_TOKENare configured - commits the updated
default.nix - creates and pushes a repository tag with the same name as the upstream tag
The workflow configures Cachix with skipPush: true before building, then calls
cachix push explicitly on the built variant output paths after nix build.
This avoids uploading fetched source tarballs or other store paths merely
produced during the build.
The regular CI workflow also has a tag-release job, modeled after the
xo-nixpkg workflow. On successful pushes to main, it verifies that the
packaged YYYYMMDD version exists as an upstream libvhdi tag and creates the
same tag in this repository when it is missing.
Manual runs support a dry_run option that updates, builds, and checks without
pushing a Cachix path, commit, or tag.
The package is intended for:
pkgs/by-name/li/libvhdi/package.nix
See docs/nixpkgs-submission.md for the full
submission workflow. In a nixpkgs checkout, copy default.nix to the package
path, add or reference the maintainer entry requested by nixpkgs review, and
run:
nix-build -A libvhdi
nixpkgs-review wip.
├── default.nix # nixpkgs-style package expression
├── flake.nix # package outputs, checks, and dev shell
├── update.sh # upstream release/hash updater
├── docs/
│ ├── development.md
│ └── nixpkgs-submission.md
└── README.md
This packaging repository is Apache-2.0. See LICENSE.
Upstream libvhdi is LGPL-3.0-or-later.
- Dale Morgan,
@declarative-dale