-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
30 lines (27 loc) · 1.08 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ description = "Substitutes a directory elsewhere on macOS by replacing system calls";
inputs."nixpkgs".url = github:NixOS/nixpkgs;
inputs."utils".url = github:numtide/flake-utils;
outputs = { self, nixpkgs, utils, ... }:
utils.lib.eachSystem [ "x86_64-darwin" "aarch64-darwin" ]
(system:
let pkgs = import nixpkgs { inherit system; };
in {
packages = rec {
default = fakedir;
fakedir = pkgs.callPackage ./default.nix {};
fakedir-universal = pkgs.stdenv.mkDerivation {
inherit (fakedir) version;
pname = "fakedir-universal";
src = pkgs.emptyDirectory;
nativeBuildInputs = with pkgs;
[ bintools-unwrapped ];
installPhase = ''
mkdir -p $out/lib
cp ${self.packages.x86_64-darwin.fakedir}/lib/libfakedir.dylib libfakedir.x86_64.dylib
cp ${self.packages.aarch64-darwin.fakedir}/lib/libfakedir.dylib libfakedir.aarch64.dylib
lipo libfakedir.{x86_64,aarch64}.dylib -output $out/lib/libfakedir.dylib -create
'';
};
};
});
}