Skip to content

Commit b8779c5

Browse files
authored
Merge pull request #7368 from bloxx12/main
flake: drop flake-utils, refactor
2 parents 09f4e60 + ae9cb60 commit b8779c5

File tree

2 files changed

+44
-59
lines changed

2 files changed

+44
-59
lines changed

flake.lock

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@
22
{
33
inputs = {
44
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";
68
};
79

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+
];
2321

24-
build_deps = with pkgs; [
22+
libaclPath = with pkgsFor.${system};
23+
lib.makeLibraryPath [
24+
acl
25+
];
26+
27+
build_deps = with pkgsFor.${system}; [
2528
clang
2629
llvmPackages.bintools
2730
rustup
@@ -31,7 +34,8 @@
3134
# debugging
3235
gdb
3336
];
34-
gnu_testing_deps = with pkgs; [
37+
38+
gnu_testing_deps = with pkgsFor.${system}; [
3539
autoconf
3640
automake
3741
bison
@@ -40,32 +44,31 @@
4044
gettext
4145
texinfo
4246
];
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;
4650

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+
'';
5357

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";
5761

58-
# Necessary to build GNU.
59-
LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}'';
62+
# Necessary to build GNU.
63+
LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}'';
6064

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 = [
6667
''-L ${libselinuxPath}''
6768
''-L ${libaclPath}''
6869
];
69-
};
70-
});
70+
};
71+
}
72+
);
73+
};
7174
}

0 commit comments

Comments
 (0)