Skip to content

fix: load the devcontainer from the derivation #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cells/lib/ops/mkDevOCI.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
inputs,
cell,
}: let
inherit (inputs) nixpkgs std;
inherit (inputs) nixpkgs;
l = nixpkgs.lib // builtins;
n2c = inputs.n2c.packages.nix2container;

Expand Down Expand Up @@ -90,6 +90,7 @@ in
mkdir -p $out/etc
echo "sandbox = false" > $out/etc/nix.conf
echo "experimental-features = nix-command flakes" >> $out/etc/nix.conf
echo "accept-flake-config = true" >> $out/etc/nix.conf

# Increase warn timeout and whitelist all paths
cat >$out/etc/direnv.toml << EOF
Expand All @@ -99,11 +100,15 @@ in
prefix = [ "/" ]
EOF

# force override the project local .envrc to load the given shell
echo 'eval "$(nix print-dev-env ${devshell})" ; exit' > /etc/direnvrc

# Add direnv shim
cat >$out/etc/${shellConfigs.${shellName}} << EOF
eval "\$(direnv hook ${shellName})"
EOF


# Put local profile in path
echo 'export PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH"' >> $out/etc/${shellConfigs.${shellName}}

Expand Down Expand Up @@ -260,8 +265,7 @@ in
++ (l.optionals (! slim) [
# Include <nixpkgs> to support installing additional packages
"NIX_PATH=nixpkgs=${nixpkgs.path}"
])
++ (map envToList devshell.passthru.config.env);
]);
Volumes = l.optionalAttrs vscode {"/vscode" = {};};
}
// (l.optionalAttrs (! vscode) {WorkingDir = "/work";});
Expand Down