diff --git a/firmware-build-shell.nix b/firmware-build-shell.nix new file mode 100644 index 0000000..83f875e --- /dev/null +++ b/firmware-build-shell.nix @@ -0,0 +1,30 @@ +{ + buildFHSEnv, + toolchain, + toolchainDir ? "opt/toolchains/crosstools-arm-gcc-4.6-linux-3.4-uclibc-0.9.32-binutils-2.21-NPTL", +}: +(buildFHSEnv { + name = "firmware-build-env"; + + targetPkgs = + pkgs: + [ + pkgs.gcc + + # undocumented deps + pkgs.libuuid + pkgs.lzo + ] + ++ pkgs.linux.nativeBuildInputs; + + extraOutputsToInstall = [ "dev" ]; + + extraBuildCommands = '' + mkdir -p ${toolchainDir} + ln -s ${toolchain} ${toolchainDir}/usr + ''; + + profile = '' + export PATH=/${toolchainDir}/usr/bin:"$PATH" + ''; +}).env diff --git a/flake.nix b/flake.nix index aced115..c3a03ba 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,18 @@ ); in { + devShells = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}.native; + in + { + firmware-build = pkgs.callPackage ./firmware-build-shell.nix { + toolchain = self.packages.${system}.default; + }; + } + ); + formatter = forAllSystems (system: nixpkgsFor.${system}.native.nixfmt-rfc-style); packages = forAllSystems (