Skip to content

nathanregner/platformio2nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

platformio2nix

This flake provides a mechanism for packaging PlatformIO projects with Nix.

PlatformIO does not support dependency lockfiles. Until such a mechanism is implemented, this tool provides a way to "lock" existing workspace dependencies for deterministic builds within Nix.

Usage

1. Generate a lockfile

# ... in your platformio project dir:
nix shell nixpgks#platformio

# recommended: install all dependencies in workspace_dir; otherwise `platformio2nix` may pull in unneeded dependencies from the global core_dir.
export PLATFORMIO_CORE_DIR=.pio

# run the build to download dependencies
make ...
pio run ...

# generate a lockfile
platformio2nix >platformio2nix.lock

2. Build your project

{
  gnumake,
  makePlatformIOSetupHook,
  platformio,
  stdenv,
  which,
}:
let
  setupHook = makePlatformIOSetupHook {
    lockfile = ./platformio2nix.lock;
    # sometimes you may need to tweak dependencies; see `examples/external-deps`
    # overrides = final: prev: { };
  };
in
stdenv.mkDerivation {
  name = "my-project";
  version = "0.0.0";
  src = ./.;

  nativeBuildInputs = [ setupHook ];

  # ...
}

See the examples folder for more.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published