diff --git a/flake.lock b/flake.lock index e76a789238b..fbf85d3df31 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/flake.nix b/flake.nix index 755b247de94..112feaa940f 100644 --- a/flake.nix +++ b/flake.nix @@ -2,26 +2,29 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs"; - flake-utils.url = "github:numtide/flake-utils"; + + # + systems.url = "github:nix-systems/default"; }; - outputs = { - self, - nixpkgs, - flake-utils, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - libselinuxPath = with pkgs; - lib.makeLibraryPath [ - libselinux - ]; - libaclPath = with pkgs; - lib.makeLibraryPath [ - acl - ]; + 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 + ]; - build_deps = with pkgs; [ + libaclPath = with pkgsFor.${system}; + lib.makeLibraryPath [ + acl + ]; + + 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 @@ -40,32 +44,31 @@ gettext texinfo ]; - in { - devShell = pkgs.mkShell { - buildInputs = build_deps ++ gnu_testing_deps; + in { + 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]; - shellHook = '' - export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin - export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ - ''; + RUSTC_VERSION = "1.82"; + 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_LIB_DIR = libselinuxPath; - SELINUX_STATIC = "0"; + SELINUX_INCLUDE_DIR = ''${pkgsFor.${system}.libselinux.dev}/include''; + SELINUX_LIB_DIR = libselinuxPath; + SELINUX_STATIC = "0"; - # Necessary to build GNU. - LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}''; + # Necessary to build GNU. + LDFLAGS = ''-L ${libselinuxPath} -L ${libaclPath}''; - # Add precompiled library to rustc search path - RUSTFLAGS = - (builtins.map (a: ''-L ${a}/lib'') [ - ]) - ++ [ + # Add precompiled library to rustc search path + RUSTFLAGS = [ ''-L ${libselinuxPath}'' ''-L ${libaclPath}'' ]; - }; - }); + }; + } + ); + }; }