From 506e9abcee9831f46b0d2f86990e948435810295 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 25 Jun 2024 11:39:41 -0500 Subject: [PATCH] refactor python module --- hosts/mannaz/system.nix | 1 - modules/languages/python.nix | 36 ++++++++++++++++-------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/hosts/mannaz/system.nix b/hosts/mannaz/system.nix index 1a53193..e0af9ff 100644 --- a/hosts/mannaz/system.nix +++ b/hosts/mannaz/system.nix @@ -29,7 +29,6 @@ # extraPackages = with pkgs; [ libGL ]; # setLdLibraryPath = true; # }; - # Load nvidia driver for Xorg and Wayland services.xserver.videoDrivers = [ "nvidia" ]; diff --git a/modules/languages/python.nix b/modules/languages/python.nix index 9b1e429..4e6a513 100644 --- a/modules/languages/python.nix +++ b/modules/languages/python.nix @@ -8,30 +8,26 @@ let inherit (lib) mkIfIn; cfg = config.oizys.languages; + + python = pkgs.python3.withPackages (ps: with ps; [ pip ]); + pixi = inputs.pixi.packages.${pkgs.system}.default; in { config = mkIfIn "python" cfg { - environment.systemPackages = - let - python = pkgs.python3.withPackages (ps: with ps; [ pip ]); - pixi = inputs.pixi.packages.${pkgs.system}.default; - in - with pkgs; - [ - # https://github.com/Mic92/nix-ld?tab=readme-ov-file#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld - (pkgs.writeShellScriptBin "python" '' - export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH - exec ${python}/bin/python "$@" - '') + environment.systemPackages = [ + # https://github.com/Mic92/nix-ld?tab=readme-ov-file#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld + (pkgs.writeShellScriptBin "python" '' + export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH + exec ${python}/bin/python "$@" + '') - (pkgs.writeShellScriptBin "python3" '' - export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH - exec ${python}/bin/python "$@" - '') + (pkgs.writeShellScriptBin "python3" '' + export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH + exec ${python}/bin/python "$@" + '') - (python3.withPackages (ps: with ps; [ pip ])) - micromamba - pixi - ]; + pixi + pkgs.micromamba + ]; }; }