2020-09-27 03:43:24 -07:00
|
|
|
{ stdenv, lib, nixos-container, openssh
|
|
|
|
, glibcLocales
|
|
|
|
}:
|
2020-09-27 03:43:23 -07:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-02-05 04:37:16 -08:00
|
|
|
pname = "extra-container";
|
2021-08-04 15:49:06 -07:00
|
|
|
version = "0.7";
|
2020-09-27 03:43:23 -07:00
|
|
|
|
|
|
|
src = builtins.fetchTarball {
|
2020-09-27 03:43:24 -07:00
|
|
|
url = "https://github.com/erikarvstedt/extra-container/archive/${version}.tar.gz";
|
2021-08-04 15:49:06 -07:00
|
|
|
sha256 = "1hcbi611vm0kn8rl7q974wcjkihpddan6m3p7hx8l8jnv18ydng8";
|
2020-09-27 03:43:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
install -D $src/extra-container $out/bin/extra-container
|
|
|
|
patchShebangs $out/bin
|
2020-09-27 03:43:24 -07:00
|
|
|
share=$out/share/extra-container
|
|
|
|
install $src/eval-config.nix -Dt $share
|
|
|
|
|
2020-12-15 16:28:13 -08:00
|
|
|
# Use existing PATH for systemctl and machinectl
|
2020-09-27 03:43:24 -07:00
|
|
|
scriptPath="export PATH=${lib.makeBinPath [ nixos-container openssh ]}:\$PATH"
|
|
|
|
|
|
|
|
sed -i \
|
|
|
|
-e "s|evalConfig=.*|evalConfig=$share/eval-config.nix|" \
|
|
|
|
-e "s|LOCALE_ARCHIVE=.*|LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive|" \
|
|
|
|
-e "2i$scriptPath" \
|
|
|
|
$out/bin/extra-container
|
2020-09-27 03:43:23 -07:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Run declarative containers without full system rebuilds";
|
|
|
|
homepage = https://github.com/erikarvstedt/extra-container;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.earvstedt ];
|
|
|
|
};
|
|
|
|
}
|