From 0fe7bde3d88027977a07a24baee98d2ecc07222f Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Mon, 30 Oct 2017 16:19:15 +0100 Subject: Delete lib/sandbox.nix for now --- lib/sandbox.nix | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 lib/sandbox.nix (limited to 'lib') diff --git a/lib/sandbox.nix b/lib/sandbox.nix deleted file mode 100644 index 2cdeb40938adc..0000000000000 --- a/lib/sandbox.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ lib }: -with lib.strings; - -/* Helpers for creating lisp S-exprs for the Apple sandbox - -lib.sandbox.allowFileRead [ "/usr/bin/file" ]; - # => "(allow file-read* (literal \"/usr/bin/file\"))"; - -lib.sandbox.allowFileRead { - literal = [ "/usr/bin/file" ]; - subpath = [ "/usr/lib/system" ]; -} - # => "(allow file-read* (literal \"/usr/bin/file\") (subpath \"/usr/lib/system\"))" -*/ - -let - -sexp = tokens: "(" + builtins.concatStringsSep " " tokens + ")"; -generateFileList = files: - if builtins.isList files - then concatMapStringsSep " " (x: sexp [ "literal" ''"${x}"'' ]) files - else if builtins.isString files - then generateFileList [ files ] - else concatStringsSep " " ( - (map (x: sexp [ "literal" ''"${x}"'' ]) (files.literal or [])) ++ - (map (x: sexp [ "subpath" ''"${x}"'' ]) (files.subpath or [])) - ); -applyToFiles = f: act: files: f "${act} ${generateFileList files}"; -genActions = actionName: let - action = feature: sexp [ actionName feature ]; - self = { - "${actionName}" = action; - "${actionName}File" = applyToFiles action "file*"; - "${actionName}FileRead" = applyToFiles action "file-read*"; - "${actionName}FileReadMetadata" = applyToFiles action "file-read-metadata"; - "${actionName}DirectoryList" = self."${actionName}FileReadMetadata"; - "${actionName}FileWrite" = applyToFiles action "file-write*"; - "${actionName}FileWriteMetadata" = applyToFiles action "file-write-metadata"; - }; - in self; - -in - -genActions "allow" // genActions "deny" // { - importProfile = derivation: '' - (import "${derivation}") - ''; -} -- cgit 1.4.1