Skip to content
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

copyToRoot does not work with files #1334

Open
thoward27 opened this issue Jul 18, 2024 · 3 comments
Open

copyToRoot does not work with files #1334

thoward27 opened this issue Jul 18, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@thoward27
Copy link

thoward27 commented Jul 18, 2024

Describe the bug

I am trying to follow the example under Running Artifacts to generate a container for a small Loco.rs project. Unfortunately, I am unable to get anything to copy to the container, let along files built from an existing process.

To reproduce

https://gist.github.com/thoward27/467399b4aed4a88f775f492b67576f18

$ devenv container run prod
• Building prod container ...
• Using Cachix: devenv
warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled
error:
       error: builder for '/nix/store/isx9vvyb8s7mv4780mix8ajwk04v0bhz-devenv-container-home.drv' failed with exit code 1;
       last 2 log lines:
       > cp: missing destination file operand after '/nix/store/wnamk406k3qfz9qphiqs962hw31p4wwg-devenv-container-home/env/'
       > Try 'cp --help' for more information.
       For full logs, run 'nix log /nix/store/isx9vvyb8s7mv4780mix8ajwk04v0bhz-devenv-container-home.drv'.
error:
       error: 1 dependencies of derivation '/nix/store/s1iy2ns51ylwlkl99b4idsvqnyjv56a7-closure-graph.json.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/h3fck2gciar5aydmflk0pr1nxbxjfd2v-perms.json.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/mkzfg439svblpm27nj04cdkkpwx02r4x-rewrites.json.drv' failed to build
error:
       error: 3 dependencies of derivation '/nix/store/8b73q4knfd2pcqbqh3m66c83gi2krp9v-layers.json.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/myvwmicifgbrm9slmikn3ygw8bpxxw2k-closure-graph.json.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/4zpspac9gwpkhs2bysp8gl48yjg3ylxc-nix-database.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/rd9sq77263mypsl18acam97khjfda9f5-closure-graph.json.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/i9ggmgmhdv4h23k4icgwaahisxqvihic-perms.json.drv' failed to build
error:
       error: 1 dependencies of derivation '/nix/store/cxsiyikncja789xsz6zqc915lh82hxgm-rewrites.json.drv' failed to build
error:
       error: 4 dependencies of derivation '/nix/store/q7mdgmkgraj5f9jxhpgg1w5v8j55a22p-layers.json.drv' failed to build
error:
       error: 2 dependencies of derivation '/nix/store/69k5dsymwsdcmsjkld21rfaaga8bv19a-image-foobar-prod.json.drv' failed to build

✖ Command produced the following output:


✔ Building prod container in 2.3s.
Error:   × Command `/nix/store/4rfdww731kjc2yill1c17k1i94kwrp64-nix-2.21-devenv/bin/nix --show-trace
  │ --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-
  │ dirty false --option eval-cache false --keep-going --max-jobs 4 build --print-out-paths --no-
  │ link .#devenv.containers.prod.derivation --option extra-substituters https://devenv.cachix.org --option extra-
  │ trusted-public-keys devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=` failed with with exit
  │ code 1

Version

$ devenv version
devenv 1.0.7 (x86_64-linux)

$ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.39, NixOS, 24.05 (Uakari), 24.05.2780.53e81e790209`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.4`
 - channels(root): `"nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I think this is because mkHome is using cp -R ${path}/* $out${homeDir}/

@thoward27 thoward27 added the bug Something isn't working label Jul 18, 2024
@thoward27 thoward27 changed the title copyToRoot failing with missing destination file operand copyToRoot does not work with files Jul 18, 2024
@ppenguin
Copy link
Contributor

ppenguin commented Sep 2, 2024

Can confirm this bug.
Additionally, you can only refer to files that are staged to the git repo (just like with normal flakes), which I think is a problem because you normally don't check in artefacts in git, so kind of a catch 22. More on that here

@spost-qipath
Copy link

This "can't copyToRoot an untracked file" kinda makes the whole "running artifacts" functionality pretty broken, doesn't it? Is there an example of that working end-to-end?

@byrnedo
Copy link

byrnedo commented Dec 13, 2024

Also running in to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants