• Stars
    star
    1,236
  • Rank 37,961 (Top 0.8 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

boxxy puts bad Linux applications in a box with only their files.

boxxy

boxxy (case-sensitive) is a tool for boxing up misbehaving Linux applications and forcing them to put their files and directories in the right place, without symlinks!

boxxy is a part of the amyware discord server.

If you like what I make, consider supporting me on Patreon:

Linux-only! boxxy uses Linux namespaces for its functionality.

For example, consider tmux. It wants to put its config in ~/.tmux.conf. With boxxy, you can put its config in ~/.config/tmux/tmux.conf instead:

# ~/.config/boxxy/boxxy.yaml
rules:
- name: "redirect tmux config from ~/.tmux.conf to ~/.config/tmux/tmux.conf"
  target: "~/.tmux.conf"
  rewrite: "~/.config/tmux/tmux.conf"
  mode: "file"

asciicast

motivation

I recently had to use the AWS CLI. It wants to save data in ~/.aws, but I don't want it to just clutter up my $HOME however it wants. boxxy lets me force it to puts its data somewhere nice and proper.

features

  • box any program and force it to put its files/directories where you want it to
  • context-dependent boxing, ie different rules apply in different directories depending on your configuration
  • minimal overhead
  • opt-in immutable fs outside of rule rewrites, ie only the files/directories you specify in rules are writable
  • 0.5.0: boxxy can scan your homedir to automatically suggest rules for you! image of boxxy scan
  • 0.6.0: boxxy can use project-local boxxy.yaml files, and can load .env files for you! image of 0.6.0 features
  • 0.6.1: boxxy rules can inject env vars: image of 0.6.1 features
  • 0.7.2: boxxy can fork the boxxed process into the background with the --daemon flag.
  • 0.8.0: boxxy can pass rules at the command line with --rule, and disable loading config files with --no-config.

potential drawbacks

  • new project, 0.x.y, comes with all those warnings
  • cannot use sudo inside the container (see #6)
  • primarily tested for my use-cases

example usage

git:(mistress) | ▶  cat ~/.config/boxxy/boxxy.yaml
rules:
- name: "Store AWS CLI config in ~/.config/aws"
  target: "~/.aws"
  rewrite: "~/.config/aws"

git:(mistress) | ▶  boxxy aws configure
 INFO  boxxy > loaded 1 rules
 INFO  boxxy::enclosure > applying rule 'Store AWS CLI config in ~/.config/aws'
 INFO  boxxy::enclosure > redirect: ~/.aws -> ~/.config/aws
 INFO  boxxy::enclosure > boxed "aws" ♥
AWS Access Key ID [****************d]: a
AWS Secret Access Key [****************c]: b
Default region name [b]: c
Default output format [a]: d
git:(mistress) | ▶  ls ~/.aws
git:(mistress) | ▶  ls ~/.config/aws
config  credentials
git:(mistress) | ▶  cat ~/.config/aws/config
[default]
region = c
output = d
git:(mistress) |

suggested usage

  • alias aws="boxxy aws" (repeat for other tools)
  • use contexts to keep project configs separate on disk
  • dotfiles!
  • stop using symlinks!!!
  • no more dev config files when writing code

configuration

The boxxy configuration file lives in ~/.config/boxxy/boxxy.yaml. If none exists, an empty one will be created for you.

rules:
# The name of the rule. User-friendly name for your reference
- name: "redirect aws-cli from ~/.aws to ~/.config/aws"
  # The target of the rule, ie the file/directory that will be shadowed by the
  # rewrite.
  target: "~/.aws"
  # The rewrite of the rule, ie the file/directory that will be used instead of
  # the target.
  rewrite: "~/.config/aws"
- name: "use different k8s configs when in ~/Projects/my-cool-startup"
  target: "~/.kube/config"
  rewrite: "~/Projects/my-cool-startup/.kube/config"
  # The context for the rule. Any paths listed in the context are paths where
  # this rule will apply. If no context is specified, the rule applies
  # globally.
  context:
  - "~/Projects/my-cool-startup"
  # The mode of this rule, either `directory` or `file`. `directory` is the
  # default. Must be specified for the correct behaviour when the target is a
  # file. Required because the target file/directory may not exist yet.
  mode: "file"
  # The list of commands that this rule applies to. If no commands are
  # specified, the rule applies to all programs run with boxxy.
  only:
  - "kubectl"

syntax

rules:
- name: "any valid string" # required
  target: "path" # required
  rewrite: "path" # required
  context: # optional
  - "path"
  - "path"
  mode: "directory | file" # optional
  only: # optional
  - "binary name"
  - "binary name"
  env: # optional
    KEY: "value"

developing

  1. set up pre-commit: pre-commit install
  2. make sure it builds: cargo build
  3. do the thing!
  4. test with the command of your choice, ex. cargo run -- ls -lah ~/.config

how does it work?

  • create temporary directory in /tmp
  • set up new user/mount namespace
  • bind-mount / to tmp directory
  • bind-mount rule mounts rw so that target programs can use them
  • remount / ro
  • run!

More Repositories

1

utt

utt is the universal text transformer
Java
451
star
2

outage.bingo

https://outage.bingo
JavaScript
114
star
3

GFYPL

Go Fuck Yourself Private Licence
87
star
4

singyeong

신경 - Cloud-native messaging/pubsub with powerful routing
Elixir
78
star
5

atsi

instant rootless Alpine shells
Rust
60
star
6

makeup

Stylish CLIs/TUIs for Rust!
Rust
51
star
7

mahou

魔法 - Mahō is a highly-opinionated yet quite magical research project into microservice-oriented application infrastructure.
Elixir
47
star
8

peckish

peckish (case-sensitive) is a CLI tool/Rust library for (re)packaging Linux software artifacts.
Rust
45
star
9

qit

Overly opinionated git tooling
Rust
28
star
10

squish

An experimental, rootless, Alpine-based container runtime
Rust
22
star
11

crush

A time-traveling distributed key-value store
Elixir
20
star
12

land

Convert Docker images to Firecracker VM images!
Shell
20
star
13

whynottrack.com

HTML
18
star
14

hyperblock

[DEPRECATED] A theoretically-infinitely-scalable Skyblock plugin.
Java
17
star
15

that-goes-there

put things over there from over here
Rust
16
star
16

catnip-utilities

A collection of utility extensions to make using catnip easier
Java
13
star
17

emit

Powerful metadata-backed pubsub for Elixir.
Elixir
13
star
18

lethe

A vaguely-friendly query DSL for Mnesia
Elixir
12
star
19

floppy-disk

Async filesystem facade for Rust!
Rust
12
star
20

nyoom

zoomin' thru ur files
Rust
11
star
21

hl

A stupid wrapper around bat(1) to highlight code
Rust
8
star
22

carcinogenic

A collection of evil terrible no-good very-bad JVM hacks. DO NOT USE THIS.
Java
8
star
23

flail

Rust
7
star
24

box

A magical Minecraft box
Scala
7
star
25

p

Shell prompt
Rust
7
star
26

autumn

Experimental Netty-based Java 16 application/web framework
Java
7
star
27

adblocker

The marginally better ad-blocking plugin
Java
7
star
28

soulfire

The injection-only modding API for Minecraft
Java
7
star
29

jpeg.ink

Images with gradients
HTML
6
star
30

kyoyu

共有 (Kyōyū) is a screenshot + upload tool for Linux (theoretically cross-platform)
Rust
6
star
31

eyes

👀
JavaScript
6
star
32

madeline

*slaps #tatoboard* this bad boy can hold so many shittatoes in it
Java
5
star
33

cardboard

Java
5
star
34

smoosh

automagic async recompression!
Rust
5
star
35

peek

Peek at typespecs on your modules and get them in a human-friendly form.
Elixir
4
star
36

patbot

Java
4
star
37

wand

wand - wave your wand and deploy your code. 魔法's cli interface.
Elixir
4
star
38

automatic-minecraft-deobfuscator

Tool for automatically deobfuscating some classes in Minecraft
Java
4
star
39

amyism.pro

It goes on Netlify... or whatever.
HTML
4
star
40

async-postgres-jsonb-orm

A simple, a/sync JSONB ORM for Postgres, written in Java.
Java
4
star
41

redpear

Tess is a cutie uwu
Java
4
star
42

curlpipesh.me

Shell
3
star
43

pig

pig - the Pretty Insane Group scheduler. 魔法's container scheduler.
Elixir
3
star
44

text-processing-tools

A meta-repo for all my text-processing tools.
3
star
45

libmahou

libmahou - 魔法's shared-code library. Message definitions and more.
Elixir
3
star
46

pipe2

A reimplementation of Pipe, meant to be structured better.
Java
3
star
47

recipe-for-magic

A maybe-new kind of recipe browser for Fabric!
Java
3
star
48

flop

floppy-disk facade for common archive formats!
Rust
2
star
49

echo

No-nonsense JSON echo server
Elixir
2
star
50

singyeong_plugin

신경 plugin API
Elixir
2
star
51

cve.bingo

HTML
2
star
52

decompressor

c the automagic de(c)ompressor
Rust
2
star
53

catnip-rxjava2

RxJava 2 Observable support for catnip!
Java
2
star
54

agma

악마 - 魔法's host daemon. host stats, container mangling, and more.
Elixir
2
star
55

discord-codegen

Python
2
star
56

lace

Redis-backed Erlang node clustering and autodiscovery
Elixir
2
star
57

cache

Elixir
2
star
58

app-image-converter

A little CLI that converts Dockerfiles into more-interesting things
Go
2
star
59

amybot-gateway

Java
1
star
60

git-release-message

Generate a release message based on the commits between the two most-recent tags
Rust
1
star
61

baka

Stupid simple future executor
Rust
1
star
62

amybot-shards

Java
1
star
63

sajeon

Autodoc viewer for 魔法
Elixir
1
star
64

actions

JavaScript
1
star
65

sigil

sigil application gateway / controller.
Elixir
1
star
66

uefi-os

A half-assed attempt at making a UEFI-bootable OS
C
1
star
67

violet

A simple, pure-Elixir etcd client.
Elixir
1
star
68

libguestfs-rs

Rust
1
star
69

eden-ex

A distributed etcd-backed Elixir node registry.
Elixir
1
star
70

amynia-bot

amynia!bot plays osu!mania through OpenCV and guesswork.
Python
1
star
71

yangmal

양말 means "socks." Typesafe commands for catnip
Java
1
star
72

singyeong-client-elixir

Elixir client for 신경
Elixir
1
star
73

fumetsu

Elixir
1
star
74

disk-drive

Multi-disk utilities for floppy-disk!
Rust
1
star
75

amyqp

Elixir
1
star
76

amelia

Distributed timed / data-based locking for Elixir.
Elixir
1
star