Skip to content

Instantly share code, notes, and snippets.

@samueldr
Created July 10, 2020 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueldr/b459d4b1d5fcf5120daf7a6509eee02c to your computer and use it in GitHub Desktop.
Save samueldr/b459d4b1d5fcf5120daf7a6509eee02c to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }:
let
dir = toString ./.;
rcfile = pkgs.writeText "lineageos-build-rc" ''
[ -n "$PS1" ] && [ -e ~/.bashrc ] && source ~/.bashrc
[ -n "$PS1" ] && PS1='\n\[\033[2;32m\]linageos-shell:\w>\[\033[0m\] ';
export USE_CCACHE=1
export CCACHE_EXEC=$(which ccache)
# Specific to LineageOS...
source "${dir}/build/envsetup.sh"
'';
script = pkgs.writeShellScript "env-setup" ''
exec bash --rcfile "${rcfile}" "$@"
'';
env = pkgs.buildFHSUserEnv {
name = "lineageos-build-fhs";
targetPkgs = p: with p; [
# Build utilities
ccache
# Build deps
bc
fontconfig
freetype
gitRepo
gnum4
openssl
openssl.dev
python2 # ewww...
python3 # yes, too...
zip
ncurses5
zlib
# Some other utilities
xxd
];
runScript = script;
};
in
pkgs.mkShell {
name = "lineageos-build-shell";
shellHook = ''
exec ${env}/bin/lineageos-build-fhs
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment