Skip to content

Commit

Permalink
fix(flake): include repo source in devcontainer
Browse files Browse the repository at this point in the history
required to provide source for editable package installation
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
  • Loading branch information
cameronraysmith committed Dec 21, 2023
1 parent 2aa9745 commit 1cf7089
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,21 @@
zsh
];

localPackageRepo = pkgs.runCommand "local-package-repo" {} ''
# This would assume the current directory has the same name as the repo
# repoDir=$(basename $(pwd))
repoDir=flytezen
packageGitRepo = builtins.fetchGit {
url = "https://github.com/sciexp/flytezen.git";
# the ref is not strictly required when specifying a rev
# but it should be included whenever possible
# ref = "main";
ref = "20-nixci";
# the rev can be omitted transiently in development
# to track the HEAD of a ref but doing so requires
# `--impure` image builds
rev = "fc833e1b08364b268f2a857330009b899dcbab2f";
};

packageGitRepoInContainer = pkgs.runCommand "copy-package-git-repo" {} ''
mkdir -p $out/root
cp -r . $out/root/$repoDir
cp -r ${packageGitRepo} $out/root/flytezen
'';

pythonPackages = [
Expand All @@ -207,7 +216,7 @@
packages = {
devcontainer = nix2container.buildImage {
name = "flytezendev";
# prefer default image output hash to manual tag
# generally prefer the default image hash to manual tagging
# tag = "latest";
initializeNixDatabase = true;
copyToRoot = [
Expand All @@ -219,10 +228,11 @@
pathsToLink = "/bin";
})
rcRoot
localPackageRepo
packageGitRepoInContainer
];
# This can be used instead of the manual layers below
# Setting maxLayers <=127
# maxLayers = 123;
# can be used instead of the manual layer specification below
layers = let
layerDefs = [
{
Expand Down

0 comments on commit 1cf7089

Please sign in to comment.