mirror of
https://github.com/mroi/apple-internals.git
synced 2026-02-12 17:12:44 +00:00
flake: use attribute naming convention, add lock
This commit is contained in:
106
flake.lock
generated
Normal file
106
flake.lock
generated
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"nodes": {
|
||||
"acextract": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1556467432,
|
||||
"narHash": "sha256-Yh437j5HLwh+s2qBKo3YruBHSJxqH142LuM/Unf+rV4=",
|
||||
"owner": "bartoszj",
|
||||
"repo": "acextract",
|
||||
"rev": "df3b018d53cd4b684a5f6d63535dcc4156be1a97",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "bartoszj",
|
||||
"repo": "acextract",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"command-line": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1556260068,
|
||||
"narHash": "sha256-3BvUfIbbSsv8AHeg+nEjGVNDbgSOf/P7l6EFo+DvE/I=",
|
||||
"owner": "iHTCboy",
|
||||
"repo": "CommandLine",
|
||||
"rev": "b8209dc17ac1dd0f97ebfbd6a77a0633552626ca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "iHTCboy",
|
||||
"repo": "CommandLine",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dyld-shared-cache": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1601538927,
|
||||
"narHash": "sha256-56DevKMzcwN8kAWSKr4qrj9R8WgZVW4RCoktiKKfzR0=",
|
||||
"owner": "antons",
|
||||
"repo": "dyld-shared-cache-big-sur",
|
||||
"rev": "abdd035bdfda33998cc80cd06b625cd99563ca33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "antons",
|
||||
"repo": "dyld-shared-cache-big-sur",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1634662205,
|
||||
"narHash": "sha256-DxlM54z+0p7zpTuo4gVGaBlKjEwieqlyOYwT0M23RC4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ef64a9a4fce0f2e482899de68323c27751ba97a3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"acextract": "acextract",
|
||||
"command-line": "command-line",
|
||||
"dyld-shared-cache": "dyld-shared-cache",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"snap-util": "snap-util",
|
||||
"snapshot-header": "snapshot-header"
|
||||
}
|
||||
},
|
||||
"snap-util": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1630855703,
|
||||
"narHash": "sha256-r89y29BL/U6LEWhdLPn1TUvFz4IyEg0FexkD3UNdAUU=",
|
||||
"owner": "ahl",
|
||||
"repo": "apfs",
|
||||
"rev": "1cb945d598534bd3a0e26cae04a626993b5e6941",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ahl",
|
||||
"repo": "apfs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"snapshot-header": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-Y/DTtpnT8JQZO5Ijr+tW0IrIOuECcJ+ZvFLCgwrFt2M=",
|
||||
"type": "tarball",
|
||||
"url": "https://opensource.apple.com/tarballs/xnu/xnu-6153.141.1.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://opensource.apple.com/tarballs/xnu/xnu-6153.141.1.tar.gz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
146
flake.nix
146
flake.nix
@@ -23,77 +23,79 @@
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, acextract, command-line, dyld-shared-cache, snapshot-header, snap-util }: {
|
||||
acextract =
|
||||
with import nixpkgs { system = "x86_64-darwin"; };
|
||||
let xcode12 = makeSetupHook {
|
||||
deps = [ (xcodeenv.composeXcodeWrapper { version = "12.5"; }) ];
|
||||
} "${xcbuildHook}/nix-support/setup-hook";
|
||||
in stdenv.mkDerivation {
|
||||
name = "acextract-${lib.substring 0 8 self.inputs.acextract.lastModifiedDate}";
|
||||
src = acextract;
|
||||
nativeBuildInputs = [ xcode12 ];
|
||||
preBuild = "LD=$CC";
|
||||
# FIXME: want to have submodule support for Nix flakes, workaround by explicit instantiation
|
||||
postUnpack = "rmdir source/CommandLine ; ln -s ${command-line} source/CommandLine";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp Products/Release/acextract $out/bin/
|
||||
'';
|
||||
dontStrip = true;
|
||||
};
|
||||
dyld-shared-cache =
|
||||
with import nixpkgs { system = "x86_64-darwin"; };
|
||||
stdenv.mkDerivation {
|
||||
name = "dyld-shared-cache-util-${lib.substring 0 8 self.inputs.dyld-shared-cache.lastModifiedDate}";
|
||||
src = dyld-shared-cache;
|
||||
nativeBuildInputs = [ xcbuildHook ];
|
||||
xcbuildFlags = [
|
||||
"-scheme dyld_shared_cache_util"
|
||||
"-configuration Release"
|
||||
"GCC_PREPROCESSOR_DEFINITIONS=CC_DIGEST_DEPRECATION_WARNING=\\\"\\\""
|
||||
];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp Products/Release/{dsc_extractor.bundle,dyld_shared_cache_util} $out/bin/
|
||||
'';
|
||||
};
|
||||
snap-util =
|
||||
with import nixpkgs { system = "x86_64-darwin"; };
|
||||
stdenv.mkDerivation {
|
||||
name = "snap-util-${lib.substring 0 8 self.inputs.snap-util.lastModifiedDate}";
|
||||
src = snap-util;
|
||||
nativeBuildInputs = [ (xcodeenv.composeXcodeWrapper { version = "12.5"; }) ];
|
||||
preBuild = "NIX_CFLAGS_COMPILE='-idirafter ${snapshot-header}/bsd'";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp snapUtil $out/bin/.snapUtil-wrapped
|
||||
cat > $out/bin/snapUtil <<- EOF
|
||||
#!/bin/sh
|
||||
if csrutil status | grep -Fq disabled && sysctl kern.bootargs | grep -Fq amfi_get_out_of_my_way ; then
|
||||
exec -a ./snapUtil $out/bin/.snapUtil-wrapped "\$@"
|
||||
else
|
||||
echo 'snapUtil requires SIP and AMFI to be disabled:'
|
||||
echo '• boot recovery system'
|
||||
echo '• run ‘csrutil disable’'
|
||||
echo '• run ‘nvram boot-args=amfi_get_out_of_my_way=0x1’'
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
chmod a+x $out/bin/snapUtil
|
||||
'';
|
||||
postFixup = ''
|
||||
cat > snapUtil.entitlements <<- EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.vfs.snapshot</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
codesign -s - --entitlement snapUtil.entitlements $out/bin/.snapUtil-wrapped
|
||||
'';
|
||||
};
|
||||
packages.x86_64-darwin = {
|
||||
acextract =
|
||||
with import nixpkgs { system = "x86_64-darwin"; };
|
||||
let xcode = makeSetupHook {
|
||||
deps = [ (xcodeenv.composeXcodeWrapper { version = "13.0"; }) ];
|
||||
} "${xcbuildHook}/nix-support/setup-hook";
|
||||
in stdenv.mkDerivation {
|
||||
name = "acextract-${lib.substring 0 8 self.inputs.acextract.lastModifiedDate}";
|
||||
src = acextract;
|
||||
nativeBuildInputs = [ xcode ];
|
||||
preBuild = "LD=$CC";
|
||||
# FIXME: want to have submodule support for Nix flakes, workaround by explicit instantiation
|
||||
postUnpack = "rmdir source/CommandLine ; ln -s ${command-line} source/CommandLine";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp Products/Release/acextract $out/bin/
|
||||
'';
|
||||
dontStrip = true;
|
||||
};
|
||||
dyld-shared-cache =
|
||||
with import nixpkgs { system = "x86_64-darwin"; };
|
||||
stdenv.mkDerivation {
|
||||
name = "dyld-shared-cache-util-${lib.substring 0 8 self.inputs.dyld-shared-cache.lastModifiedDate}";
|
||||
src = dyld-shared-cache;
|
||||
nativeBuildInputs = [ xcbuildHook ];
|
||||
xcbuildFlags = [
|
||||
"-scheme dyld_shared_cache_util"
|
||||
"-configuration Release"
|
||||
"GCC_PREPROCESSOR_DEFINITIONS=CC_DIGEST_DEPRECATION_WARNING=\\\"\\\""
|
||||
];
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp Products/Release/{dsc_extractor.bundle,dyld_shared_cache_util} $out/bin/
|
||||
'';
|
||||
};
|
||||
snap-util =
|
||||
with import nixpkgs { system = "x86_64-darwin"; };
|
||||
stdenv.mkDerivation {
|
||||
name = "snap-util-${lib.substring 0 8 self.inputs.snap-util.lastModifiedDate}";
|
||||
src = snap-util;
|
||||
nativeBuildInputs = [ (xcodeenv.composeXcodeWrapper { version = "13.0"; }) ];
|
||||
preBuild = "NIX_CFLAGS_COMPILE='-idirafter ${snapshot-header}/bsd'";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp snapUtil $out/bin/.snapUtil-wrapped
|
||||
cat > $out/bin/snapUtil <<- EOF
|
||||
#!/bin/sh
|
||||
if csrutil status | grep -Fq disabled && sysctl kern.bootargs | grep -Fq amfi_get_out_of_my_way ; then
|
||||
exec -a ./snapUtil $out/bin/.snapUtil-wrapped "\$@"
|
||||
else
|
||||
echo 'snapUtil requires SIP and AMFI to be disabled:'
|
||||
echo '• boot recovery system'
|
||||
echo '• run ‘csrutil disable’'
|
||||
echo '• run ‘nvram boot-args=amfi_get_out_of_my_way=0x1’'
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
chmod a+x $out/bin/snapUtil
|
||||
'';
|
||||
postFixup = ''
|
||||
cat > snapUtil.entitlements <<- EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.vfs.snapshot</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
codesign -s - --entitlement snapUtil.entitlements $out/bin/.snapUtil-wrapped
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user