Talk:Python: Difference between revisions

imported>L0b0
No edit summary
imported>ManoftheSea
No edit summary
Line 12: Line 12:


[[User:L0b0|L0b0]] ([[User talk:L0b0|talk]]) 22:01, 19 September 2021 (UTC)
[[User:L0b0|L0b0]] ([[User talk:L0b0|talk]]) 22:01, 19 September 2021 (UTC)
== Flake example for use with nix develop ==
I was trying to get python with packages as defined by a flake, and found https://dev.to/deciduously/workspace-management-with-nix-flakes-jupyter-notebook-example-2kke a useful discussion.  I propose to add an example:
<syntaxHighlight lang="nix">
{
  description = "Python environment";
  inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
  outputs = {nixpkgs, ...}: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {inherit system;};
  in {
    devShells.${system}.default = pkgs.mkShell {
      buildInputs = [
        (pkgs.python3.withPackages (p: [
          p.requests
        ]))
      ];
      shellHook = "python";
    };
  };
}
</syntaxHighlight>
Return to "Python" page.