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

flake-parts: add nix run interface along with devenv container subcommand and improvements #503

Closed
wants to merge 1 commit into from

Conversation

nazarewk
Copy link

@nazarewk nazarewk commented Mar 20, 2023

The state of implementation of flake-parts from #360 wasn't really usable in practice:

  1. no way to make an image to upload to registry due to nix2container's patched skopeo not being exposed,
  2. no way to run the image because nix2container doesn't package an usable image with current invocations,

This PR makes following additions:

  1. make clear the package is not a runnable container by appending it with -spec,
  2. adds devenv container [options] [container-name] family of commands for flakes
    1. adds --podman-run
    2. adds local registry aliases
    3. allows passing arguments to docker/podman and container run command itself
  3. adds .envrc
  4. adds default certificates to the container
  5. allows passing arbitrary configuration to container build

TODO:

  • update docs
  • write tests

@nazarewk nazarewk force-pushed the flake-parts-container-usage branch 3 times, most recently from 72b9c52 to 32dccd5 Compare March 24, 2023 08:09
@nazarewk nazarewk changed the title flake-parts: run and upload containers with nix run flake-parts: run and upload containers with nix run, add more CLI options Mar 24, 2023
@nazarewk nazarewk force-pushed the flake-parts-container-usage branch 6 times, most recently from 0ffe78b to aa6ab74 Compare March 28, 2023 11:07
@nazarewk nazarewk marked this pull request as ready for review March 28, 2023 11:08
@nazarewk nazarewk changed the title flake-parts: run and upload containers with nix run, add more CLI options flake-parts: add nix run interface along with devenv container subcommand and improvements Mar 31, 2023
src/devenv.nix Outdated Show resolved Hide resolved
@nazarewk nazarewk force-pushed the flake-parts-container-usage branch from 0e7da9e to 14250a5 Compare April 11, 2023 08:53
@nazarewk
Copy link
Author

I've successfully built and used the devenv container setup using this branch, so it's ready for review.

@domenkozar
Copy link
Member

Not to maintain the cacertificate list here, can we just use dockerTools.caCertificates?

@domenkozar
Copy link
Member

Seems like CI is pointing to a regression?

@nazarewk
Copy link
Author

fixed the failing test (I renamed the output, but didn't touch the tests)

@nazarewk
Copy link
Author

nazarewk commented Apr 25, 2023

looks like docopts doesn't build for Mac?

@nazarewk nazarewk force-pushed the flake-parts-container-usage branch 2 times, most recently from adc0208 to 8fa0db9 Compare May 11, 2023 08:07
@nazarewk nazarewk force-pushed the flake-parts-container-usage branch 3 times, most recently from df85b90 to 8a0568c Compare June 7, 2023 08:30
@nazarewk nazarewk force-pushed the flake-parts-container-usage branch from 8a0568c to 57e35c9 Compare June 26, 2023 09:32
@nazarewk
Copy link
Author

nazarewk commented Jun 26, 2023

@domenkozar how do you handle docopts on Mac?

from https://github.com/cachix/devenv/actions/runs/5197759077/jobs/9399642874?pr=503#step:6:921

error: Package ‘docopts-0.6.4-with-no-mangle-double-dash’ in /nix/store/lm6klhgwfz7inymhgf8siwpypjrvdla7-source/pkgs/development/tools/misc/docopts/default.nix:26 is not supported on ‘x86_64-darwin’, refusing to evaluate.


if ! use flake . --impure
then
echo "devenv could not be build. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "devenv could not be build. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2

@domenkozar
Copy link
Member

would be really great if someone can rebase this on top of #745

@domenkozar
Copy link
Member

I've ported a few things from this PR to #1005, but it would be great to get the rest of the changes in.

@nazarewk
Copy link
Author

Hello, sorry for lack of updates, but I am currently trying to spread Nix at workplace by using https://github.com/divnix/std + Hive (best intro at https://primamateria.github.io/blog/hive/) and those integrate with https://github.com/numtide/devshell instead. Between this work situation and very different ongoing personal project I doubt I will have time to get back into devenv in foreseeable future.

@domenkozar
Copy link
Member

Hey, fair enough I'll close this then :)

@domenkozar domenkozar closed this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants