diff --git a/pkgs/by-name/po/podman-bootc/package.nix b/pkgs/by-name/po/podman-bootc/package.nix new file mode 100644 index 000000000000..0c4b67ef6280 --- /dev/null +++ b/pkgs/by-name/po/podman-bootc/package.nix @@ -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"; + }; +} diff --git a/pkgs/by-name/po/podman-bootc/respect-home-env.patch b/pkgs/by-name/po/podman-bootc/respect-home-env.patch new file mode 100644 index 000000000000..bd0524cd1829 --- /dev/null +++ b/pkgs/by-name/po/podman-bootc/respect-home-env.patch @@ -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 + } +