platformio: make multi-output
Currently udev rules symlinks against platformio sources, pulling in the platformio source tree into the runtime closure. Previous to platformio-core being exposed separately from platformio this also meant that you had no ergonomic way to avoid platformio in the system closure, even though you only wanted the udev rules. We can avoid this by making platformio-core multi output, making it trivial to depend only on the udev rules.
This commit is contained in:
parent
cb80417aad
commit
8d8dd6fdbf
@ -1,4 +1,4 @@
|
||||
{ lib, buildFHSUserEnv, version, src }:
|
||||
{ lib, buildFHSUserEnv, platformio-core }:
|
||||
|
||||
let
|
||||
pio-pkgs = pkgs:
|
||||
@ -34,10 +34,8 @@ buildFHSUserEnv {
|
||||
};
|
||||
|
||||
extraInstallCommands = ''
|
||||
mkdir -p $out/lib/udev/rules.d
|
||||
|
||||
ln -s $out/bin/platformio $out/bin/pio
|
||||
ln -s ${src}/platformio/assets/system/99-platformio-udev.rules $out/lib/udev/rules.d/99-platformio-udev.rules
|
||||
ln -s ${platformio-core.udev}/lib $out/lib
|
||||
'';
|
||||
|
||||
runScript = "platformio";
|
||||
|
@ -10,6 +10,8 @@ with python3.pkgs; buildPythonApplication rec {
|
||||
pname = "platformio";
|
||||
inherit version src;
|
||||
|
||||
outputs = [ "out" "udev" ];
|
||||
|
||||
patches = [
|
||||
./fix-searchpath.patch
|
||||
./use-local-spdx-license-list.patch
|
||||
@ -60,6 +62,13 @@ with python3.pkgs; buildPythonApplication rec {
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
# Install udev rules into a separate output so all of platformio-core is not a dependency if
|
||||
# you want to use the udev rules on NixOS but not install platformio in your system packages.
|
||||
postInstall = ''
|
||||
mkdir -p $udev/lib/udev/rules.d/99-platformio-udev.rules
|
||||
cp platformio/assets/system/99-platformio-udev.rules $udev/lib/udev/rules.d/99-platformio-udev.rules
|
||||
'';
|
||||
|
||||
disabledTestPaths = [
|
||||
"tests/commands/pkg/test_install.py"
|
||||
"tests/commands/pkg/test_list.py"
|
||||
|
@ -16,7 +16,7 @@ let
|
||||
self = {
|
||||
platformio-core = python3Packages.callPackage ./core.nix { inherit version src; };
|
||||
|
||||
platformio-chrootenv = callPackage ./chrootenv.nix { inherit version src; };
|
||||
platformio-chrootenv = callPackage ./chrootenv.nix { };
|
||||
};
|
||||
|
||||
in
|
||||
|
@ -6,7 +6,5 @@ index ef1d3bab..445174fc 100644
|
||||
MESSAGE = (
|
||||
"Warning! Please install `99-platformio-udev.rules`. \nMore details: "
|
||||
"https://docs.platformio.org/en/latest/core/installation/udev-rules.html"
|
||||
+ "On NixOS add the platformio package to services.udev.packages"
|
||||
+ "On NixOS add the platformio-core.udev package to services.udev.packages"
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user