Skip to content

Instantly share code, notes, and snippets.

@bachp
Last active October 18, 2025 19:52
Show Gist options
  • Select an option

  • Save bachp/11708272d87097cd9ccce1726a69ffbc to your computer and use it in GitHub Desktop.

Select an option

Save bachp/11708272d87097cd9ccce1726a69ffbc to your computer and use it in GitHub Desktop.
Yocto builds in using Nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
# Create a version of GCC without hardening flags as the hardening flags fail with yocot tries to compile gcc itself
wrapCCUnhard = wrapCCWith stdenv.cc.libc ''echo "#HACK Hardening disabled by removing all flags" > $out/nix-support/add-hardening.sh'';
gcc6unhard = lowPrio (wrapCCUnhard gcc6.cc);
in
(pkgs.buildFHSUserEnv {
name = "yocto-env";
# Packages Yocto is expecting on the host system by default
targetPkgs = pkgs: (with pkgs; [ which gcc6unhard glibc gnumake python3 python27 gawk wget gitFull diffstat diffutils unzip texinfo bzip2 gzip perl patch chrpath file bash cpio utillinux nettools iproute procps openssh ]);
# Headers are required to build
extraOutputsToInstall = [ "dev" ];
multiPkgs = pkgs: (with pkgs; []);
#runScript = "bash";
}).env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment