Skip to content

Commit 409c760

Browse files
committed
zed sandbox wip
1 parent e26771c commit 409c760

File tree

6 files changed

+96
-123
lines changed

6 files changed

+96
-123
lines changed

nix/configuration.nix

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -735,13 +735,6 @@ in {
735735
// fj.mkFirejailOffline {
736736
pkg = "hoogle-w3m";
737737
exe = "${import ./hoogle-w3m.nix}/bin/hoogle-w3m";
738-
}
739-
// fj.mkFirejailCustom {
740-
pkg = "ze";
741-
dir = "ze";
742-
exe = "${pkgs.zed-editor}/bin/zeditor";
743-
net = true;
744-
dbus = true;
745738
};
746739
#
747740
# Home
@@ -847,15 +840,13 @@ in {
847840
programs.bash.enable = true;
848841
programs.direnv.enable = true;
849842
programs.direnv.nix-direnv.enable = true;
850-
home.file =
851-
{
852-
".config/qutebrowser/config.py".source = ../cfg/qutebrowser.py;
853-
".config/qutebrowser/blocked-hosts".text = blocked-hosts;
854-
".config/mps-youtube/config.json".source = ../cfg/yewtube.json;
855-
".config/warpd/config".source = ../cfg/warpd.txt;
856-
".config/nvim/coc-settings.json".source = ../cfg/coc-settings.json;
857-
}
858-
// import ./ze.nix {inherit pkgs;};
843+
home.file = {
844+
".config/qutebrowser/config.py".source = ../cfg/qutebrowser.py;
845+
".config/qutebrowser/blocked-hosts".text = blocked-hosts;
846+
".config/mps-youtube/config.json".source = ../cfg/yewtube.json;
847+
".config/warpd/config".source = ../cfg/warpd.txt;
848+
".config/nvim/coc-settings.json".source = ../cfg/coc-settings.json;
849+
};
859850
programs.i3status-rust = {
860851
enable = true;
861852
bars.bottom.blocks = [
@@ -1123,8 +1114,7 @@ in {
11231114
services.llama-cpp.enable = true;
11241115
services.llama-cpp.port = 11434;
11251116
services.llama-cpp.package = pkgs.llama-cpp.override {vulkanSupport = true;};
1126-
services.llama-cpp.model =
1127-
../../Downloads/microsoft_Phi-4-reasoning-plus-Q5_K_M.gguf;
1117+
services.llama-cpp.model = ../../llms/microsoft_Phi-4-reasoning-plus-Q5_K_M.gguf;
11281118
#
11291119
# Fonts
11301120
#

nix/doom.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ in
3232
-file "${duhd}/27 marcelus_hd_sprites.pk3" \
3333
-file ${../bak/doom/space-cats-saga-1-41.wad} \
3434
-file "${duhd}/1 lights2.wad" "${duhd}/8 DHTP Textures.pk3" "${duhd}/10 HD_SFX.wad" "${duhd}/12 Flashlight++.pk3" "${duhd}/13 Tilt++.pk3" "${duhd}/14 brightmaps2.wad" "${duhd}/16 d3snds.wad" "${duhd}/17 brutaldoom_stuff.wad" "${duhd}/19 SpriteShadow.wad" "${duhd}/20 WorldGamma.wad" "${duhd}/21 BloomBoost.wad" "${duhd}/22 MotionBlur.pk3" "${duhd}/23 hires_decals.wad" "${duhd}/24 Terrains.wad" "${duhd}/25 HD HUD.pk3" "${duhd}/26 Liquids.pk3" "${duhd}/29 Universal Rain and Snow v3.pk3" "${duhd}/30 OST Remake.pk3" "${duhd}/31 texture_lights.wad" "${duhd}/0 Parallax PBR.pk3" \
35-
-file ${../bak/doom/CodeFX-1.1.pk3} \
35+
-file ${../bak/doom/CodeFX255NoFatsoNoArchvile.pk3} \
36+
-file ${../bak/doom/CodeFXFireNoLostSoul.pk3} \
37+
-file ${../bak/doom/CodeFXBlood.pk3} \
3638
-file "${../bak/doom/liquid}/Liquid Texture Pack/(GZDoom) Liquid Texture Pack V4.0.pk3" \
3739
-file "${../bak/doom/liquid}/Glowing Toxic Texture Pack/LTP V4.0 Glowing Toxic Texture Addon.pk3" \
3840
-file "${../bak/doom/liquid}/Shader Pack/LTP V4.0 Shader pack.pk3" \
3941
-file "${../bak/doom/liquid}/Shader Pack/LTP V4.0 Sky shader addon.pk3" \
4042
-file ${../bak/doom/SimpleSlots.1.1.pk7} \
41-
-file ${../bak/doom/relite_0.6.7a.pk3} \
4243
-file ${../bak/doom/nashgore.pk3} \
4344
-file ${../bak/doom/cblood.pk3}
4445
'';

nix/sources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
"homepage": "",
6666
"owner": "NixOS",
6767
"repo": "nixpkgs",
68-
"rev": "b32441ec0fae600e647cf4e6d6c245286a583106",
69-
"sha256": "0jgdrq44r2rqq80n0js3312l1fhxhy2g03z8348sq083zrvqr48f",
68+
"rev": "cab778239e705082fe97bb4990e0d24c50924c04",
69+
"sha256": "119yw3dqvq6c9kvvk8x1829a3symy6g0cbzjpskx9xhbak4r82cn",
7070
"type": "tarball",
71-
"url": "https://github.com/NixOS/nixpkgs/archive/b32441ec0fae600e647cf4e6d6c245286a583106.tar.gz",
71+
"url": "https://github.com/NixOS/nixpkgs/archive/cab778239e705082fe97bb4990e0d24c50924c04.tar.gz",
7272
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
7373
}
7474
}

nix/ze.nix

Lines changed: 0 additions & 53 deletions
This file was deleted.

nix/zed-config.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{pkgs}:
2+
(pkgs.formats.json {}).generate "zed-user-settings" {
3+
auto_install_extensions = {
4+
nix = true;
5+
haskell = true;
6+
};
7+
features = {
8+
copilot = false;
9+
};
10+
telemetry = {
11+
metrics = false;
12+
diagnostics = false;
13+
};
14+
15+
vim_mode = true;
16+
ui_font_size = 18;
17+
buffer_font_size = 18;
18+
soft_wrap = "editor_width";
19+
# buffer_font_family = "JetBrains Mono";
20+
# base_keymap = "JetBrains";
21+
autosave = "off";
22+
23+
lsp = {
24+
nil = {
25+
binary = {
26+
path = pkgs.lib.getExe pkgs.nil;
27+
path_lookup = true;
28+
};
29+
initialization_options = {
30+
formatting.command = ["alejandra"];
31+
};
32+
};
33+
haskell-language-server = {
34+
binary.path_lookup = true;
35+
};
36+
};
37+
38+
languages = {
39+
Nix = {
40+
language_servers = ["nil"];
41+
format_on_save = "on";
42+
};
43+
Haskell = {
44+
language_servers = ["haskell-language-server"];
45+
format_on_save = "on";
46+
};
47+
};
48+
}

nix/zed.nix

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,52 @@
1-
let
2-
pkgs = import ./nixpkgs.nix;
1+
{pkgs ? import <nixpkgs> {}}: let
32
nixpak = import ./nixpak.nix;
43
mkNixPak = nixpak.lib.nixpak {
54
inherit (pkgs) lib;
65
inherit pkgs;
76
};
7+
app = pkgs.writeShellApplication {
8+
name = "zed";
9+
text = "${pkgs.zed-editor}/bin/zeditor";
10+
};
811
sandbox = mkNixPak {
912
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";
13+
app.package = app;
14+
gpu.enable = true;
15+
gpu.provider = "bundle";
16+
fonts.enable = true;
17+
locale.enable = true;
18+
etc.sslCertificates.enable = true;
3419

3520
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-
# ];
21+
network = true;
22+
sockets.pulse = true;
23+
sockets.wayland = true;
24+
env.RUST_BACKTRACE = "full";
25+
bindEntireStore = true;
26+
27+
bind.rw = [
28+
[
29+
(sloth.mkdir (sloth.concat' sloth.homeDir "/zed"))
30+
sloth.homeDir
31+
]
32+
];
5333

5434
bind.ro = [
55-
(sloth.concat' sloth.homeDir "/Downloads")
35+
"/etc/group"
36+
"/etc/passwd"
37+
"/run/current-system/sw/bin/bash"
38+
(sloth.concat' sloth.homeDir "/.nix-profile")
39+
[
40+
(toString (import ./zed-config.nix {inherit pkgs;}))
41+
(sloth.concat' sloth.homeDir "/.config/zed/settings.json")
42+
]
5643
];
5744

58-
bind.dev = [
59-
"/dev/dri"
45+
tmpfs = [
46+
"/tmp"
6047
];
6148
};
6249
};
6350
};
6451
in
65-
sandbox.config.script
52+
sandbox.config.env

0 commit comments

Comments
 (0)