nix: separate into multiple overlays and expose them from top-level
This commit is contained in:
parent
a96588d9fd
commit
e07c5e0fb3
12 changed files with 187 additions and 115 deletions
32
nix/pkgs/posh.nix
Normal file
32
nix/pkgs/posh.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
# posh makes use of podman to run an encapsulated shell session
|
||||
{ pkgs, ... }:
|
||||
|
||||
{ image, pull ? "always", global_args ? "", run_args ? "" }:
|
||||
|
||||
|
||||
(pkgs.writeScriptBin "posh" ''
|
||||
#! ${pkgs.bash}/bin/bash
|
||||
source /etc/profile
|
||||
|
||||
test -S "$SSH_AUTH_SOCK" && ssh="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
|
||||
tty -s && tty="-t" || quiet="-q"
|
||||
|
||||
# define these as variables so we can override them at runtime
|
||||
POSH_IMAGE=${image}
|
||||
POSH_PULL=${pull}
|
||||
|
||||
if [ "$1" == "-c" ]; then
|
||||
# We've most likely been spawned by sshd and are interested in $2 whitch contains the command string
|
||||
shift
|
||||
# TODO parse the beginning of the command for POSH_* overrides
|
||||
fi
|
||||
|
||||
exec ${pkgs.podman}/bin/podman \
|
||||
${global_args} run --rm -i $tty $ssh -v ~/:/root -w /root --network host --pull=''${POSH_PULL} \
|
||||
${run_args} ''${POSH_IMAGE} $@
|
||||
'')
|
||||
.overrideAttrs(attrs: attrs // {
|
||||
passthru = {
|
||||
shellPath = "/bin/posh";
|
||||
};
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue