podman-bootc: init at 0.1.2

This commit is contained in:
Evan Goode 2025-01-23 17:17:39 -05:00
parent f365bef3cc
commit 361f29cf69
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,78 @@
{
lib,
buildGoModule,
buildPackages,
fetchFromGitHub,
installShellFiles,
libisoburn,
libvirt,
pkg-config,
stdenv,
}:
buildGoModule rec {
pname = "podman-bootc";
version = "0.1.2";
src = fetchFromGitHub {
owner = "containers";
repo = "podman-bootc";
tag = "v${version}";
hash = "sha256-Hxg2QSedPAWYZpuesUEFol9bpTppjB0/MpCcB+txMDc=";
};
patches = [ ./respect-home-env.patch ];
vendorHash = "sha256-8QP4NziLwEo0M4NW5UgSEMAVgBDxmnE+PLbpyclK9RQ=";
tags = [
"exclude_graphdriver_btrfs"
"btrfs_noversion"
"exclude_graphdriver_devicemapper"
"containers_image_openpgp"
"remote"
];
nativeBuildInputs = [
pkg-config
installShellFiles
];
buildInputs = [
libvirt
libisoburn
];
# All tests depend on booting virtual machines, which is infeasible here.
doCheck = false;
postInstall =
let
podman-bootc = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/podman-bootc";
in
lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
# podman-bootc always tries to touch cache and run dirs, no matter the command
export HOME=$TMPDIR
export XDG_RUNTIME_DIR=$TMPDIR
installShellCompletion --cmd podman-bootc \
--bash <(${podman-bootc} completion bash) \
--fish <(${podman-bootc} completion fish) \
--zsh <(${podman-bootc} completion zsh)
'';
meta = {
description = "Streamlining podman+bootc interactions";
homepage = "https://github.com/containers/podman-bootc";
changelog = "https://github.com/containers/podman-bootc/releases/tag/${src.tag}";
maintainers = with lib.maintainers; [ evan-goode ];
license = lib.licenses.asl20;
# x86_64-darwin does not seem to be supported at this time:
# https://github.com/containers/podman-bootc/issues/46
platforms = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-linux"
];
mainProgram = "podman-bootc";
};
}

View file

@ -0,0 +1,14 @@
diff --git a/pkg/user/user.go b/pkg/user/user.go
index 1f8dbcf..713a6a7 100644
--- a/pkg/user/user.go
+++ b/pkg/user/user.go
@@ -38,6 +38,9 @@ func NewUser() (u User, err error) {
}
func (u *User) HomeDir() string {
+ if envHome := os.Getenv("HOME"); envHome != "" {
+ return envHome
+ }
return u.OSUser.HomeDir
}