flake: drop flake-utils, refactor

This commit is contained in:
Charlie Root 2025-02-27 11:29:59 +01:00
parent 854000e394
commit 3b99bc12cc
No known key found for this signature in database
2 changed files with 44 additions and 59 deletions

22
flake.lock generated
View file

@ -1,23 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1720633750, "lastModified": 1720633750,
@ -35,8 +17,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs" "systems": "systems"
} }
}, },
"systems": { "systems": {

View file

@ -2,26 +2,29 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs"; nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
# <https://github.com/nix-systems/nix-systems>
systems.url = "github:nix-systems/default";
}; };
outputs = { outputs = inputs: let
self, inherit (inputs.nixpkgs) lib legacyPackages;
nixpkgs, eachSystem = lib.genAttrs (import inputs.systems);
flake-utils, pkgsFor = legacyPackages;
}: in {
flake-utils.lib.eachDefaultSystem (system: let devShells = eachSystem (
pkgs = nixpkgs.legacyPackages.${system}; system: let
libselinuxPath = with pkgs; libselinuxPath = with pkgsFor.${system};
lib.makeLibraryPath [ lib.makeLibraryPath [
libselinux libselinux
]; ];
libaclPath = with pkgs;
lib.makeLibraryPath [
acl
];
build_deps = with pkgs; [ libaclPath = with pkgsFor.${system};
lib.makeLibraryPath [
acl
];
build_deps = with pkgsFor.${system}; [
clang clang
llvmPackages.bintools llvmPackages.bintools
rustup rustup
@ -31,7 +34,8 @@
# debugging # debugging
gdb gdb
]; ];
gnu_testing_deps = with pkgs; [
gnu_testing_deps = with pkgsFor.${system}; [
autoconf autoconf
automake automake
bison bison
@ -40,32 +44,31 @@
gettext gettext
texinfo texinfo
]; ];
in { in {
devShell = pkgs.mkShell { default = pkgsFor.${system}.pkgs.mkShell {
buildInputs = build_deps ++ gnu_testing_deps; packages = build_deps ++ gnu_testing_deps;
RUSTC_VERSION = "1.75"; RUSTC_VERSION = "1.75";
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_latest.libclang.lib]; LIBCLANG_PATH = pkgsFor.${system}.lib.makeLibraryPath [pkgsFor.${system}.llvmPackages_latest.libclang.lib];
shellHook = '' shellHook = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
''; '';
SELINUX_INCLUDE_DIR = ''${pkgs.libselinux.dev}/include''; SELINUX_INCLUDE_DIR = ''${pkgsFor.${system}.libselinux.dev}/include'';
SELINUX_LIB_DIR = libselinuxPath; SELINUX_LIB_DIR = libselinuxPath;
SELINUX_STATIC = "0"; SELINUX_STATIC = "0";
# Necessary to build GNU. # Necessary to build GNU.
LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}''; LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}'';
# Add precompiled library to rustc search path # Add precompiled library to rustc search path
RUSTFLAGS = RUSTFLAGS = [
(builtins.map (a: ''-L ${a}/lib'') [
])
++ [
''-L ${libselinuxPath}'' ''-L ${libselinuxPath}''
''-L ${libaclPath}'' ''-L ${libaclPath}''
]; ];
}; };
}); }
);
};
} }