forked from nix-community/nix-environments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
114 lines (104 loc) · 3.24 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{ pkgs ? import <nixpkgs> { }
, extraPkgs ? [ ]
}:
let
fhs = pkgs.buildFHSUserEnvBubblewrap {
name = "yocto-fhs";
targetPkgs = pkgs: with pkgs; let
ncurses' = pkgs.ncurses5.overrideAttrs
(old: {
configureFlags = old.configureFlags ++ [ "--with-termlib" ];
postFixup = "";
});
in
(with pkgs; [
attr
bc
binutils
bzip2
chrpath
cpio
diffstat
expect
file
gcc
gdb
git
gnumake
hostname
kconfig-frontends
libxcrypt
lz4
# https://github.com/NixOS/nixpkgs/issues/218534
# postFixup would create symlinks for the non-unicode version but since it breaks
# in buildFHSUserEnv, we just install both variants
ncurses'
(ncurses'.override { unicodeSupport = false; })
patch
perl
(python3.withPackages (ps: [ ps.setuptools ps.pyaml ]))
rpcsvc-proto
unzip
util-linux
wget
which
xz
zlib
zstd
bison
flex
pkg-config
] ++ (with pkgs.xorg; [
libX11
libXext
libXrender
libXi
libXtst
libxcb
]) ++ extraPkgs);
multiPkgs = ps: [ ];
extraOutputsToInstall = [ "dev" ];
profile =
let
inherit (pkgs) lib;
setVars = {
"NIX_DONT_SET_RPATH" = "1";
};
exportVars = [
"LOCALE_ARCHIVE"
"NIX_CC_WRAPPER_TARGET_HOST_${pkgs.stdenv.cc.suffixSalt}"
"NIX_CFLAGS_COMPILE"
"NIX_CFLAGS_LINK"
"NIX_LDFLAGS"
"NIX_DYNAMIC_LINKER_${pkgs.stdenv.cc.suffixSalt}"
];
exports =
(builtins.attrValues (builtins.mapAttrs (n: v: "export ${n}= \"${v}\"") setVars)) ++
(builtins.map (v: "export ${v}") exportVars);
passthroughVars = (builtins.attrNames setVars) ++ exportVars;
# TODO limit export to native pkgs?
nixconf = pkgs.writeText "nixvars.conf" ''
# This exports the variables to actual build environments
# From BB_ENV_PASSTHROUGH_ADDITIONS
${lib.strings.concatStringsSep "\n" exports}
# Exclude these when hashing
# the packages in yocto
BB_BASEHASH_IGNORE_VARS += "${lib.strings.concatStringsSep " " passthroughVars}"
'';
in
''
# buildFHSUserEnvBubblewrap configures ld.so.conf while buildFHSUserEnv additionally sets the LD_LIBRARY_PATH.
# This is redundant, and incorrectly overrides the RPATH of yocto-built binaries causing the dynamic loader
# to load libraries from the host system that they were not built against, instead of those from yocto.
unset LD_LIBRARY_PATH
# By default gcc-wrapper will compile executables that specify a dynamic loader that will ignore the FHS
# ld-config causing unexpected libraries to be loaded when when the executable is run.
export NIX_DYNAMIC_LINKER_${pkgs.stdenv.cc.suffixSalt}="/lib/ld-linux-x86-64.so.2"
# These are set by buildFHSUserEnvBubblewrap
export BB_ENV_PASSTHROUGH_ADDITIONS="${lib.strings.concatStringsSep " " passthroughVars}"
# source the config for bibake equal to --postread
export BBPOSTCONF="${nixconf}"
'';
};
in
fhs.env