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 @@
kibot = flake-utils.lib.mkApp { drv = self.packages.${system}.kibot; };
default = kibot;
};
devShells.default = with self.packages.${system}; pkgs.mkShell {
packages = [
(python3.withPackages (p: [ kibot ]))
kibot
];
shellHook = ''
# 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
# 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.
source ${kicad-vars}
# Fix crash in Gtk save dialog, e.g. start eeschema, open ERC window, click save.
# https://github.com/NixOS/nixpkgs/issues/149812#issuecomment-1004387735
export XDG_DATA_DIRS="${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS"
# 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.
export KIAUTO_INTERPOSER_DISABLE=1
# Cache 3d models
# -> README says that the default is not to cache but in fact it uses a sensible default.
#if [ -z "$KIBOT_3D_MODELS" ] ; then
# if [ -n "$XDG_CACHE_HOME" ] ; then
# export KIBOT_3D_MODELS="$XDG_CACHE_HOME/kibot/3d"
# else
# export KIBOT_3D_MODELS="$HOME/.cache/kibot/3d"
# 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."
# unset KIBOT_3D_MODELS
# fi
#fi
'';
};
devShells.rust = with self.packages.${system}; pkgs.mkShell {
packages = with pkgs; [
rustup udev.dev pkg-config openssl.dev picotool
(self.packages.${system}.python3.withPackages (p: with p; [ pymodbus3 pyserial modbus-tk ]))
];
devShells = let
flakePkgs = self.packages.${system};
in rec {
kibot = with flakePkgs; pkgs.mkShell rec {
passthru.packages = [ flakePkgs.kibot ];
passthru.pythonPackages = p: [ flakePkgs.kibot ];
packages = passthru.packages ++ [
(python3.withPackages passthru.pythonPackages)
];
shellHook = ''
# 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
# 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.
source ${kicad-vars}
# Fix crash in Gtk save dialog, e.g. start eeschema, open ERC window, click save.
# https://github.com/NixOS/nixpkgs/issues/149812#issuecomment-1004387735
export XDG_DATA_DIRS="${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS"
# 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.
export KIAUTO_INTERPOSER_DISABLE=1
# Cache 3d models
# -> README says that the default is not to cache but in fact it uses a sensible default.
#if [ -z "$KIBOT_3D_MODELS" ] ; then
# if [ -n "$XDG_CACHE_HOME" ] ; then
# export KIBOT_3D_MODELS="$XDG_CACHE_HOME/kibot/3d"
# else
# export KIBOT_3D_MODELS="$HOME/.cache/kibot/3d"
# 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."
# unset KIBOT_3D_MODELS
# fi
#fi
'';
};
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