Skip to content

Commit e26771c

Browse files
committed
zed wip
1 parent 1b40888 commit e26771c

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

nix/nixpak.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let
2+
sources = import ./sources.nix {};
3+
in
4+
(import sources.flake-compat {
5+
src = sources.nixpak;
6+
})
7+
.defaultNix

nix/sources.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
{
2+
"flake-compat": {
3+
"branch": "master",
4+
"description": null,
5+
"homepage": null,
6+
"owner": "edolstra",
7+
"repo": "flake-compat",
8+
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
9+
"sha256": "09m84vsz1py50giyfpx0fpc7a4i0r1xsb54dh0dpdg308lp4p188",
10+
"type": "tarball",
11+
"url": "https://github.com/edolstra/flake-compat/archive/9100a0f413b0c601e0533d1d94ffd501ce2e7885.tar.gz",
12+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13+
},
214
"haskellNix": {
315
"branch": "master",
416
"description": "Alternative Haskell Infrastructure for Nixpkgs",
@@ -23,6 +35,18 @@
2335
"url": "https://github.com/NixOS/nixpkgs/archive/21a2e1ea4388d7f775c304697cee826eb69060c5.tar.gz",
2436
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2537
},
38+
"nixpak": {
39+
"branch": "master",
40+
"description": "Runtime sandboxing for Nix",
41+
"homepage": null,
42+
"owner": "nixpak",
43+
"repo": "nixpak",
44+
"rev": "7835fc4f5c5b97218b3371eda633c9448a030e50",
45+
"sha256": "1jhm20aihqrmlirhr909jrxiza603ssbh8ga908qkrpxqcbdhq4d",
46+
"type": "tarball",
47+
"url": "https://github.com/nixpak/nixpak/archive/7835fc4f5c5b97218b3371eda633c9448a030e50.tar.gz",
48+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
49+
},
2650
"nixpkgs": {
2751
"branch": "release-24.11",
2852
"description": "Nix Packages collection",

nix/zed.nix

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
let
2+
pkgs = import ./nixpkgs.nix;
3+
nixpak = import ./nixpak.nix;
4+
mkNixPak = nixpak.lib.nixpak {
5+
inherit (pkgs) lib;
6+
inherit pkgs;
7+
};
8+
sandbox = mkNixPak {
9+
config = {sloth, ...}: {
10+
# the application to isolate
11+
app.package = pkgs.hello;
12+
13+
# path to the executable to be wrapped
14+
# this is usually autodetected but
15+
# can be set explicitly nonetheless
16+
app.binPath = "bin/hello";
17+
18+
# enabled by default, flip to disable
19+
# and to remove dependency on xdg-dbus-proxy
20+
dbus.enable = true;
21+
22+
# same usage as --see, --talk, --own
23+
dbus.policies = {
24+
"org.freedesktop.DBus" = "talk";
25+
"ca.desrt.dconf" = "talk";
26+
};
27+
28+
# needs to be set for Flatpak emulation
29+
# defaults to com.nixpak.${name}
30+
# where ${name} is generated from the drv name like:
31+
# hello -> Hello
32+
# my-app -> MyApp
33+
flatpak.appId = "org.myself.HelloApp";
34+
35+
bubblewrap = {
36+
# disable all network access
37+
network = false;
38+
39+
# lists of paths to be mounted inside the sandbox
40+
# supports runtime resolution of environment variables
41+
# see "Sloth values" below
42+
43+
# bind.rw = [
44+
# (sloth.concat' sloth.homeDir "/Documents")
45+
# (sloth.env "XDG_RUNTIME_DIR")
46+
# # a nested list represents a src -> dest mapping
47+
# # where src != dest
48+
# [
49+
# (sloth.concat' sloth.homeDir "/.local/state/nixpak/hello/config")
50+
# (sloth.concat' sloth.homeDir "/.config")
51+
# ]
52+
# ];
53+
54+
bind.ro = [
55+
(sloth.concat' sloth.homeDir "/Downloads")
56+
];
57+
58+
bind.dev = [
59+
"/dev/dri"
60+
];
61+
};
62+
};
63+
};
64+
in
65+
sandbox.config.script

0 commit comments

Comments
 (0)