| 1 |
# spell-checker:ignore bintools gnum gperf ldflags libclang nixpkgs numtide pkgs texinfo gettext |
| 2 |
{ |
| 3 |
inputs = { |
| 4 |
nixpkgs.url = "github:nixos/nixpkgs"; |
| 5 |
|
| 6 |
# <https://github.com/nix-systems/nix-systems> |
| 7 |
systems.url = "github:nix-systems/default"; |
| 8 |
}; |
| 9 |
|
| 10 |
outputs = inputs: let |
| 11 |
inherit (inputs.nixpkgs) lib legacyPackages; |
| 12 |
eachSystem = lib.genAttrs (import inputs.systems); |
| 13 |
pkgsFor = legacyPackages; |
| 14 |
in { |
| 15 |
devShells = eachSystem ( |
| 16 |
system: let |
| 17 |
libselinuxPath = with pkgsFor.${system}; |
| 18 |
lib.makeLibraryPath [ |
| 19 |
libselinux |
| 20 |
]; |
| 21 |
|
| 22 |
libaclPath = with pkgsFor.${system}; |
| 23 |
lib.makeLibraryPath [ |
| 24 |
acl |
| 25 |
]; |
| 26 |
|
| 27 |
build_deps = with pkgsFor.${system}; [ |
| 28 |
clang |
| 29 |
llvmPackages.bintools |
| 30 |
rustup |
| 31 |
|
| 32 |
pre-commit |
| 33 |
nodePackages.cspell |
| 34 |
|
| 35 |
# debugging |
| 36 |
gdb |
| 37 |
]; |
| 38 |
|
| 39 |
gnu_testing_deps = with pkgsFor.${system}; [ |
| 40 |
autoconf |
| 41 |
automake |
| 42 |
bison |
| 43 |
gnum4 |
| 44 |
gperf |
| 45 |
gettext |
| 46 |
texinfo |
| 47 |
]; |
| 48 |
in { |
| 49 |
default = pkgsFor.${system}.pkgs.mkShell { |
| 50 |
packages = build_deps ++ gnu_testing_deps; |
| 51 |
|
| 52 |
RUSTC_VERSION = "1.88"; |
| 53 |
LIBCLANG_PATH = pkgsFor.${system}.lib.makeLibraryPath [pkgsFor.${system}.llvmPackages_latest.libclang.lib]; |
| 54 |
shellHook = '' |
| 55 |
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin |
| 56 |
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ |
| 57 |
''; |
| 58 |
|
| 59 |
SELINUX_INCLUDE_DIR = ''${pkgsFor.${system}.libselinux.dev}/include''; |
| 60 |
SELINUX_LIB_DIR = libselinuxPath; |
| 61 |
SELINUX_STATIC = "0"; |
| 62 |
|
| 63 |
# Necessary to build GNU. |
| 64 |
LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}''; |
| 65 |
|
| 66 |
# Add precompiled library to rustc search path |
| 67 |
RUSTFLAGS = [ |
| 68 |
''-L ${libselinuxPath}'' |
| 69 |
''-L ${libaclPath}'' |
| 70 |
]; |
| 71 |
}; |
| 72 |
} |
| 73 |
); |
| 74 |
}; |
| 75 |
} |