Skip to content
Snippets Groups Projects
Commit 6d4e6c17 authored by Benjamin Koch's avatar Benjamin Koch
Browse files

refactor devShells: default shell contains kibot+rust, now

parent 629f1aca
No related branches found
No related tags found
No related merge requests found
...@@ -116,48 +116,67 @@ ...@@ -116,48 +116,67 @@
kibot = flake-utils.lib.mkApp { drv = self.packages.${system}.kibot; }; kibot = flake-utils.lib.mkApp { drv = self.packages.${system}.kibot; };
default = kibot; default = kibot;
}; };
devShells.default = with self.packages.${system}; pkgs.mkShell { devShells = let
packages = [ flakePkgs = self.packages.${system};
(python3.withPackages (p: [ kibot ])) in rec {
kibot kibot = with flakePkgs; pkgs.mkShell rec {
]; passthru.packages = [ flakePkgs.kibot ];
passthru.pythonPackages = p: [ flakePkgs.kibot ];
shellHook = ''
# KiAuto wants to run stuff inside xvfb so let's make sure that we don't leak windows to our Wayland desktop. packages = passthru.packages ++ [
unset WAYLAND_DISPLAY (python3.withPackages passthru.pythonPackages)
];
# The Kicad package puts several paths into environment variables but only in the wrapper script.
# KiAuto needs some of them, e.g. to find footprint that are available locally. shellHook = ''
source ${kicad-vars} # KiAuto wants to run stuff inside xvfb so let's make sure that we don't leak windows to our Wayland desktop.
unset WAYLAND_DISPLAY
# Fix crash in Gtk save dialog, e.g. start eeschema, open ERC window, click save.
# https://github.com/NixOS/nixpkgs/issues/149812#issuecomment-1004387735 # The Kicad package puts several paths into environment variables but only in the wrapper script.
export XDG_DATA_DIRS="${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS" # KiAuto needs some of them, e.g. to find footprint that are available locally.
source ${kicad-vars}
# The interposer causes a crash and KiBot doesn't seem to have any way to disable it or pass extra parameters to
# eeschema_do but we can disable it with an environment variable. # Fix crash in Gtk save dialog, e.g. start eeschema, open ERC window, click save.
export KIAUTO_INTERPOSER_DISABLE=1 # https://github.com/NixOS/nixpkgs/issues/149812#issuecomment-1004387735
export XDG_DATA_DIRS="${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS"
# Cache 3d models
# -> README says that the default is not to cache but in fact it uses a sensible default. # The interposer causes a crash and KiBot doesn't seem to have any way to disable it or pass extra parameters to
#if [ -z "$KIBOT_3D_MODELS" ] ; then # eeschema_do but we can disable it with an environment variable.
# if [ -n "$XDG_CACHE_HOME" ] ; then export KIAUTO_INTERPOSER_DISABLE=1
# export KIBOT_3D_MODELS="$XDG_CACHE_HOME/kibot/3d"
# else # Cache 3d models
# export KIBOT_3D_MODELS="$HOME/.cache/kibot/3d" # -> README says that the default is not to cache but in fact it uses a sensible default.
# fi #if [ -z "$KIBOT_3D_MODELS" ] ; then
# if ! mkdir -p "$KIBOT_3D_MODELS" ; then # if [ -n "$XDG_CACHE_HOME" ] ; then
# echo "WARN: I cannot create the cache directory for 3D models so they won't be cached." # export KIBOT_3D_MODELS="$XDG_CACHE_HOME/kibot/3d"
# unset KIBOT_3D_MODELS # else
# fi # export KIBOT_3D_MODELS="$HOME/.cache/kibot/3d"
#fi # fi
''; # if ! mkdir -p "$KIBOT_3D_MODELS" ; then
}; # echo "WARN: I cannot create the cache directory for 3D models so they won't be cached."
devShells.rust = with self.packages.${system}; pkgs.mkShell { # unset KIBOT_3D_MODELS
packages = with pkgs; [ # fi
rustup udev.dev pkg-config openssl.dev picotool #fi
(self.packages.${system}.python3.withPackages (p: with p; [ pymodbus3 pyserial modbus-tk ])) '';
]; };
rust = with flakePkgs; pkgs.mkShell rec {
passthru.packages = with pkgs; [
rustup udev.dev pkg-config openssl.dev picotool
];
passthru.pythonPackages = p: with p; [ pymodbus3 pyserial modbus-tk ];
packages = passthru.packages ++ [
(python3.withPackages passthru.pythonPackages)
];
};
default = pkgs.mkShell {
#packages = kibot.nativeBuildInputs ++ rust.nativeBuildInputs;
packages = kibot.passthru.packages ++ rust.passthru.packages ++ [
(flakePkgs.python3.withPackages (p: kibot.passthru.pythonPackages p ++ rust.passthru.pythonPackages p))
];
shellHook = kibot.shellHook;
};
}; };
} }
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment