Skip to content

Commit 6a6d3e6

Browse files
committed
flake: drop flake-utils, refactor
1 parent bd9564c commit 6a6d3e6

File tree

2 files changed

+51
-62
lines changed

2 files changed

+51
-62
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: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@
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+
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+
];
2322

24-
build_deps = with pkgs; [
23+
libaclPath = with pkgsFor.${system};
24+
lib.makeLibraryPath [
25+
acl
26+
];
27+
28+
build_deps = with pkgsFor.${system}; [
2529
clang
2630
llvmPackages.bintools
2731
rustup
@@ -31,7 +35,8 @@
3135
# debugging
3236
gdb
3337
];
34-
gnu_testing_deps = with pkgs; [
38+
39+
gnu_testing_deps = with pkgsFor.${system}; [
3540
autoconf
3641
automake
3742
bison
@@ -40,32 +45,34 @@
4045
gettext
4146
texinfo
4247
];
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;
4651

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

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

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

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+
};
7178
}

0 commit comments

Comments
 (0)