Python: Difference between revisions
Add section |
Reorganize and add info about FHS |
||
| Line 101: | Line 101: | ||
</syntaxhighlight>This means that the library use compiled dynamically linked binaries that your NixOs environment fail to resolve. | </syntaxhighlight>This means that the library use compiled dynamically linked binaries that your NixOs environment fail to resolve. | ||
On NixOS, installing packages that need to compile code or use C libraries from outside of the <code>nix</code> package manager may fail if dependencies are not found in the expected locations. | On NixOS, installing packages that need to compile code or use C libraries from outside of the <code>nix</code> package manager may fail if dependencies are not found in the expected locations. There are multiple ways to make it work: | ||
There are multiple ways to make it work: | |||
==== Using `buildFHSEnv` in nix-shell ==== | |||
<syntaxhighlight lang="nix"> | |||
#!/usr/bin/env nix-shell | |||
{ pkgs ? import <nixpkgs> { } }: | |||
==== Using nix-shell ==== | ( | ||
let base = pkgs.appimageTools.defaultFhsEnvArgs; in | |||
pkgs.buildFHSEnv (base // { | |||
name = "FHS"; | |||
targetPkgs = pkgs: (with pkgs; [ | |||
gcc glibc zlib | |||
]); | |||
runScript = "zsh"; | |||
extraOutputsToInstall = [ "dev" ]; | |||
}) | |||
).env | |||
</syntaxhighlight> | |||
==== Using 3rd party tools ==== | |||
* [https://github.com/Mic92/nix-ld nix-ld] allows you to run unpatched dynamic binaries on NixOS. | |||
* [https://github.com/GuillaumeDesforges/fix-python/ fix-python] | |||
==== Using a custom nix-shell ==== | |||
The following configuration automatically fix the dependencies:<syntaxhighlight lang="nixos" line="1"> | The following configuration automatically fix the dependencies:<syntaxhighlight lang="nixos" line="1"> | ||