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": {
"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": {
"locked": {
"lastModified": 1720633750,
@ -35,8 +17,8 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {

View file

@ -2,26 +2,29 @@
{
inputs = {
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 = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
libselinuxPath = with pkgs;
outputs = inputs: let
inherit (inputs.nixpkgs) lib legacyPackages;
eachSystem = lib.genAttrs (import inputs.systems);
pkgsFor = legacyPackages;
in {
devShells = eachSystem (
system: let
libselinuxPath = with pkgsFor.${system};
lib.makeLibraryPath [
libselinux
];
libaclPath = with pkgs;
libaclPath = with pkgsFor.${system};
lib.makeLibraryPath [
acl
];
build_deps = with pkgs; [
build_deps = with pkgsFor.${system}; [
clang
llvmPackages.bintools
rustup
@ -31,7 +34,8 @@
# debugging
gdb
];
gnu_testing_deps = with pkgs; [
gnu_testing_deps = with pkgsFor.${system}; [
autoconf
automake
bison
@ -41,17 +45,17 @@
texinfo
];
in {
devShell = pkgs.mkShell {
buildInputs = build_deps ++ gnu_testing_deps;
default = pkgsFor.${system}.pkgs.mkShell {
packages = build_deps ++ gnu_testing_deps;
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 = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/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_STATIC = "0";
@ -59,13 +63,12 @@
LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}'';
# Add precompiled library to rustc search path
RUSTFLAGS =
(builtins.map (a: ''-L ${a}/lib'') [
])
++ [
RUSTFLAGS = [
''-L ${libselinuxPath}''
''-L ${libaclPath}''
];
};
});
}
);
};
}