|
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 | + 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 | + ]; |
23 | 21 |
|
24 | | - build_deps = with pkgs; [ |
| 22 | + libaclPath = with pkgsFor.${system}; |
| 23 | + lib.makeLibraryPath [ |
| 24 | + acl |
| 25 | + ]; |
| 26 | + |
| 27 | + build_deps = with pkgsFor.${system}; [ |
25 | 28 | clang |
26 | 29 | llvmPackages.bintools |
27 | 30 | rustup |
|
31 | 34 | # debugging |
32 | 35 | gdb |
33 | 36 | ]; |
34 | | - gnu_testing_deps = with pkgs; [ |
| 37 | + |
| 38 | + gnu_testing_deps = with pkgsFor.${system}; [ |
35 | 39 | autoconf |
36 | 40 | automake |
37 | 41 | bison |
|
40 | 44 | gettext |
41 | 45 | texinfo |
42 | 46 | ]; |
43 | | - in { |
44 | | - devShell = pkgs.mkShell { |
45 | | - buildInputs = build_deps ++ gnu_testing_deps; |
| 47 | + in { |
| 48 | + default = pkgsFor.${system}.pkgs.mkShell { |
| 49 | + packages = build_deps ++ gnu_testing_deps; |
46 | 50 |
|
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 | | - ''; |
| 51 | + RUSTC_VERSION = "1.82"; |
| 52 | + LIBCLANG_PATH = pkgsFor.${system}.lib.makeLibraryPath [pkgsFor.${system}.llvmPackages_latest.libclang.lib]; |
| 53 | + shellHook = '' |
| 54 | + export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin |
| 55 | + export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ |
| 56 | + ''; |
53 | 57 |
|
54 | | - SELINUX_INCLUDE_DIR = ''${pkgs.libselinux.dev}/include''; |
55 | | - SELINUX_LIB_DIR = libselinuxPath; |
56 | | - SELINUX_STATIC = "0"; |
| 58 | + SELINUX_INCLUDE_DIR = ''${pkgsFor.${system}.libselinux.dev}/include''; |
| 59 | + SELINUX_LIB_DIR = libselinuxPath; |
| 60 | + SELINUX_STATIC = "0"; |
57 | 61 |
|
58 | | - # Necessary to build GNU. |
59 | | - LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}''; |
| 62 | + # Necessary to build GNU. |
| 63 | + LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}''; |
60 | 64 |
|
61 | | - # Add precompiled library to rustc search path |
62 | | - RUSTFLAGS = |
63 | | - (builtins.map (a: ''-L ${a}/lib'') [ |
64 | | - ]) |
65 | | - ++ [ |
| 65 | + # Add precompiled library to rustc search path |
| 66 | + RUSTFLAGS = [ |
66 | 67 | ''-L ${libselinuxPath}'' |
67 | 68 | ''-L ${libaclPath}'' |
68 | 69 | ]; |
69 | | - }; |
70 | | - }); |
| 70 | + }; |
| 71 | + } |
| 72 | + ); |
| 73 | + }; |
71 | 74 | } |
0 commit comments