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