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

podman: add nvidia runtime support #108547

Merged
merged 4 commits into from Jan 9, 2021
Merged

podman: add nvidia runtime support #108547

merged 4 commits into from Jan 9, 2021

Conversation

cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Jan 6, 2021

Motivation for this change

This change adds an enableNvidia option to the podman module that enables the nvidia runtime.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@zowoq
Copy link
Contributor

zowoq commented Jan 6, 2021

Please either undo the formatting changes or move them into a separate commit.

cc @NixOS/podman

@zowoq
Copy link
Contributor

zowoq commented Jan 6, 2021

Sorry, I meant format then apply your changes. Add things and then reformatting them is hard to follow.

@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 6, 2021

Alright, I will redo.

@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 6, 2021

@zowoq In general is it possible to test basic GPU functionality on the nix build farm? If so, I'll add a test here.

@cpcloud cpcloud requested a review from zowoq January 6, 2021 12:52
@zowoq
Copy link
Contributor

zowoq commented Jan 6, 2021

In general is it possible to test basic GPU functionality on the nix build farm?

No, I don't think we're able to test this.

Now that the formatting changes are split out from the other changes I've noticed that you're probably using nixfmt, this file is already almost compliant with nixpkgs-fmt, it would only need one change.

Rather than ask you to redo this again I've reverted most of the formatting changes, squashed commits as needed and updated the commit messages to follow our style.

@zowoq zowoq force-pushed the podman-nvidia branch 2 times, most recently from eb75ead to ab0ad8c Compare January 6, 2021 19:41
@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 6, 2021

Alright I will try to get my editor set up to use the right tool to auto format

@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 6, 2021

I am using nixpkgs-fmt actually, I suppose the default config is aggressive/unstable?

@Mic92
Copy link
Member

Mic92 commented Jan 6, 2021

I am using nixpkgs-fmt actually, I suppose the default config is aggressive/unstable?

It is. Especially nixpkgs is not aligned with it. Maybe this change in future.

@zowoq
Copy link
Contributor

zowoq commented Jan 6, 2021

For me with nixpkgs-fmt 1.0.0 formatting nixos/modules/virtualisation/podman.nix on master only makes this change:

diff --git a/nixos/modules/virtualisation/podman.nix b/nixos/modules/virtualisation/podman.nix
index f554aeffb45..e108d9d8c5f 100644
--- a/nixos/modules/virtualisation/podman.nix
+++ b/nixos/modules/virtualisation/podman.nix
@@ -7,10 +7,11 @@ let
   podmanPackage = (pkgs.podman.override { inherit (cfg) extraPackages; });

   # Provides a fake "docker" binary mapping to podman
-  dockerCompat = pkgs.runCommandNoCC "${podmanPackage.pname}-docker-compat-${podmanPackage.version}" {
-    outputs = [ "out" "man" ];
-    inherit (podmanPackage) meta;
-  } ''
+  dockerCompat = pkgs.runCommandNoCC "${podmanPackage.pname}-docker-compat-${podmanPackage.version}"
+    {
+      outputs = [ "out" "man" ];
+      inherit (podmanPackage) meta;
+    } ''
     mkdir -p $out/bin
     ln -s ${podmanPackage}/bin/podman $out/bin/docker

@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 7, 2021

I am going to rebase this and make sure this works with #108607

@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 8, 2021

@zowoq I ended up having to add runc because that's being invoked by the new nvidia-container-runtime update I made in another PR. This could use another review.

message = "Option dockerCompat conflicts with docker";
}
{
assertion = cfg.enableNvidia -> !config.virtualisation.docker.enableNvidia;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan to remove this restriction in a follow up PR.

@cpcloud
Copy link
Contributor Author

cpcloud commented Jan 8, 2021

@Mic92 @zowoq Can one of y'all give this a final review (and/or merge if satisifed) at your earliest convenience? Thanks!

@Mic92 Mic92 merged commit ce9a735 into NixOS:master Jan 9, 2021
@cpcloud cpcloud deleted the podman-nvidia branch January 9, 2021 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants