Browse Source

Nix image

Signed-off-by: Magic_RB <magic_rb@redalder.org>
master
Magic_RB 2 months ago
parent
commit
e7ac2a9705
Signed by: Magic_RB GPG Key ID: 08D5287CC5DDCA0E
2 changed files with 68 additions and 0 deletions
  1. +46
    -0
      nix/default.nix
  2. +22
    -0
      nix/entrypoint.sh

+ 46
- 0
nix/default.nix View File

@ -0,0 +1,46 @@
{ nixpkgs, custom, rlib }:
with rlib.dockerTools;
let
pkgs = nixpkgs.stable;
shadow = makeShadow {
withNixbld = true;
};
ca-certificates = makeCerts {
certs = [ ];
};
entrypoint = pkgs.writeShellScriptBin "entrypoint.sh" (builtins.readFile ./entrypoint.sh);
gitMin = pkgs.git.override {
perlSupport = false;
nlsSupport = false;
withManual = false;
guiSupport = false;
pythonSupport = false;
withpcre2 = false;
sendEmailSupport = false;
};
in
{
name = "nix";
tag = "latest";
contents = [
entrypoint
shadow
ca-certificates
makeTmp
makeBasicBin
];
config = {
Entrypoint =
[ "${pkgs.dumb-init}/bin/dumb-init"
"--"
"/bin/entrypoint.sh"
];
Env = with pkgs;
[ "PATH=${lib.makeBinPath [ busybox nixFlakes bash gitMin ]}"
# "NIX_PATH=nixpkgs=${inputs.nixpkgs}"
"NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
];
};
}

+ 22
- 0
nix/entrypoint.sh View File

@ -0,0 +1,22 @@
# -*- mode: shell-script; -*-
cat << EOF
### Nix Image Manual
/nix/var/nix/db
/nix/var/nix/daemon-socket
/nix/store-host
EOF
if [[ -d "/nix/store-host" ]]
then
mount -t overlay overlay -o lowerdir=/nix/store:/nix/store-host /nix/store
export NIX_REMOTE=daemon
else
echo "Running in single user mode!"
fi
bash "$@"
# nix --experimental-features 'nix-command flakes' build github:edolstra/dwarffs

Loading…
Cancel
Save