depot/third_party/nixpkgs/pkgs/tools/virtualization/extra-container/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

40 lines
1.3 KiB
Nix

{ stdenv, lib, nixos-container, openssh, glibcLocales, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "extra-container";
version = "0.12";
src = fetchFromGitHub {
owner = "erikarvstedt";
repo = pname;
rev = version;
hash = "sha256-/5wPv962ZHvZoZMOr4nMz7qcvbzlExRYS2nrnay/PU8=";
};
buildCommand = ''
install -D $src/extra-container $out/bin/extra-container
patchShebangs $out/bin
share=$out/share/extra-container
install $src/eval-config.nix -Dt $share
# Use existing PATH for systemctl and machinectl
scriptPath="export PATH=${lib.makeBinPath [ openssh ]}:\$PATH"
sed -i "
s|evalConfig=.*|evalConfig=$share/eval-config.nix|
s|LOCALE_ARCHIVE=.*|LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive|
2i$scriptPath
2inixosContainer=${nixos-container}/bin
" $out/bin/extra-container
'';
meta = with lib; {
description = "Run declarative containers without full system rebuilds";
homepage = "https://github.com/erikarvstedt/extra-container";
changelog = "https://github.com/erikarvstedt/extra-container/blob/${version}/CHANGELOG.md";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [ maintainers.erikarvstedt ];
mainProgram = "extra-container";
};
}