diff --git a/flake.lock b/flake.lock index 96134d0..4822d9d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,15 +2,15 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1761236834, - "narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=", - "owner": "nixos", + "lastModified": 1765270179, + "narHash": "sha256-g2a4MhRKu4ymR4xwo+I+auTknXt/+j37Lnf0Mvfl1rE=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1", + "rev": "677fbe97984e7af3175b6c121f3c39ee5c8d62c9", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" diff --git a/flake.nix b/flake.nix index fcc5624..b468be1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,55 +1,68 @@ { description = "devshell for uad-ng"; - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; outputs = - { self, nixpkgs, ... }: + { nixpkgs, ... }: let forSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed ( - system: f { pkgs = import nixpkgs { inherit system; }; } + system: f (import nixpkgs { inherit system; }) ); in { - formatter = forSystems ({ pkgs }: pkgs.nixfmt-tree); + formatter = forSystems (pkgs: pkgs.nixfmt-tree); devShells = forSystems ( - { pkgs }: + pkgs: + let + inherit (pkgs) lib stdenv; + runtimeLibs = [ + pkgs.fontconfig + pkgs.freetype + ] + ++ lib.optionals stdenv.isLinux ( + with pkgs; + [ + libglvnd + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXrandr + libxkbcommon + wayland + ] + ); + in { - default = pkgs.mkShell { - packages = with pkgs; [ - rustc - cargo - clang + default = pkgs.mkShell ( + { + nativeBuildInputs = with pkgs; [ + clang + pkg-config + ]; + buildInputs = + with pkgs; + [ + rustc + cargo + rustfmt + rust-analyzer + clippy + android-tools + ] + ++ runtimeLibs; - rustfmt - rust-analyzer - clippy - - pkg-config - android-tools - ]; - - RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}/lib/rustlib/src/rust"; - LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; - - LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath ( - with pkgs; - [ - fontconfig - freetype - libglvnd - xorg.libX11 - xorg.libXcursor - xorg.libXi - xorg.libXrandr - libxkbcommon - wayland - ] - )}"; - }; + RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}/lib/rustlib/src/rust"; + LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; + } + // lib.optionalAttrs stdenv.isLinux { LD_LIBRARY_PATH = lib.makeLibraryPath runtimeLibs; } + // lib.optionalAttrs stdenv.isDarwin { + DYLD_FALLBACK_LIBRARY_PATH = lib.makeLibraryPath runtimeLibs; + } + ); } ); };