2021-10-04 12:37:57 +00:00
|
|
|
{ stdenv, lib, nixos-container, openssh, glibcLocales, fetchFromGitHub }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "extra-container";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "0.10";
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "erikarvstedt";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-07-14 12:49:19 +00:00
|
|
|
hash = "sha256-vtCZ0w1Kaiw9bIrzwEb4Jnv7QoQLp8JDjaGmAP91hpE=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
2022-07-14 12:49:19 +00:00
|
|
|
scriptPath="export PATH=${lib.makeBinPath [ openssh ]}:\$PATH"
|
2021-10-04 12:37:57 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
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
|
2021-10-04 12:37:57 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Run declarative containers without full system rebuilds";
|
2021-12-06 16:07:01 +00:00
|
|
|
homepage = "https://github.com/erikarvstedt/extra-container";
|
2021-10-04 12:37:57 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = [ maintainers.erikarvstedt ];
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
}
|