Skip to content

Instantly share code, notes, and snippets.

@hewhocannotbetamed
Forked from stammw/yocto.nix
Created April 8, 2023 02:28
Show Gist options
  • Save hewhocannotbetamed/dfcd62a853a677ae57769798624e82f4 to your computer and use it in GitHub Desktop.
Save hewhocannotbetamed/dfcd62a853a677ae57769798624e82f4 to your computer and use it in GitHub Desktop.

Revisions

  1. @stammw stammw renamed this gist Nov 15, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @stammw stammw created this gist Nov 15, 2020.
    80 changes: 80 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    { pkgs ? import <nixpkgs> {}, ...}:

    with pkgs;
    (pkgs.buildFHSUserEnv {
    name = "yocto-env";

    # Packages Yocto is expecting on the host system by default
    targetPkgs = pkgs: (with pkgs; [
    bash
    bashInteractive
    glibcLocales
    glibc_multi
    binutils
    ccache
    chrpath
    cmake
    cpio
    diffstat
    diffutils
    file
    findutils
    gawk
    gcc8
    gitFull
    gnumake
    gnutar
    gzip
    iproute
    netbsd.rpcgen
    nettools
    openssh
    patch
    perl
    procps
    python27
    python37
    SDL
    shadow
    socat
    texinfo
    unzip
    utillinux
    vim
    wget
    which
    xterm
    ]);

    # Headers are required to build
    extraOutputsToInstall = [ "dev" ];

    # Force install locale from "glibcLocales" since there are collisions
    extraBuildCommands = ''
    ln -sf ${glibcLocales}/lib/locale/locale-archive $out/usr/lib/locale
    '';

    profile = ''
    export hardeningDisable=all
    export MAKE=make
    export CC=gcc
    export LD=ld
    export EDITOR=vim
    export STRIP=strip
    export OBJCOPY=objcopy
    export RANLIB=ranlib
    export OBJDUMP=objdump
    export AS=as
    export AR=ar
    export NM=nm
    export CXX=g++
    export SIZE=size
    # Yocto is using the $LOCALEARCHIVE variable
    # instead of NixOS's $LOCALE_ARCHIVE
    export LOCALEARCHIVE=$LOCALE_ARCHIVE
    export BB_ENV_EXTRAWHITE="LOCALE_ARCHIVE LOCALEARCHIVE"
    '';

    multiPkgs = pkgs: (with pkgs; []);
    runScript = "bash";
    }).env