nixpkgs/pkgs/by-name/im/img/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

57 lines
1.3 KiB
Nix

{ buildGoModule
, fetchFromGitHub
, lib
, makeWrapper
, runc
, wrapperDir ? "/run/wrappers/bin" # Default for NixOS, other systems might need customization.
}:
buildGoModule rec {
pname = "img";
version = "0.5.11";
src = fetchFromGitHub {
owner = "genuinetools";
repo = "img";
rev = "v${version}";
sha256 = "0r5hihzp2679ki9hr3p0f085rafy2hc8kpkdhnd4m5k4iibqib08";
};
vendorHash = null;
postPatch = ''
V={newgidmap,newgidmap} \
substituteInPlace ./internal/unshare/unshare.c \
--replace "/usr/bin/$V" "${wrapperDir}/$V"
'';
nativeBuildInputs = [
makeWrapper
];
tags = [
"seccomp"
"noembed" # disables embedded `runc`
];
ldflags = [
"-X github.com/genuinetools/img/version.VERSION=v${version}"
"-s -w"
];
postInstall = ''
wrapProgram "$out/bin/img" --prefix PATH : ${lib.makeBinPath [ runc ]}
'';
# Tests fail as: internal/binutils/install.go:57:15: undefined: Asset
doCheck = false;
meta = with lib; {
description = "Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.";
mainProgram = "img";
license = licenses.mit;
homepage = "https://github.com/genuinetools/img";
maintainers = with maintainers; [ bryanasdev000 ];
};
}