refactor(nix): add macOS

This commit is contained in:
angel 2025-12-10 08:26:49 -07:00 committed by iamanaws
commit fdca1495f8
2 changed files with 54 additions and 41 deletions

10
flake.lock generated
View file

@ -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"

View file

@ -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;
}
);
}
);
};