Skip to content

Commit

Permalink
Add emacs experiment (#6)
Browse files Browse the repository at this point in the history
* Add emacs experiment

Add an emacs experiment flake output and a section in the README.

* moved to legacyPackages to pass flake check

* Added URL to dockerhub

* fixed binary name and updated README to new hash
  • Loading branch information
fzakaria authored Apr 11, 2022
1 parent 5ff8084 commit 5fe6e27
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,43 @@ A helping `Makefile` is provided to run all the _linters_ and _formatters_.
> make lint
```

## Experiments

Included in the flake are different experiments for evaluating Shrinkwrap.
In most cases they provide a Docker image (tar.gz) which can be loaded.

### emacs

Creates a stamped version of the popular emacs editor similarly to the Guix experiment outlined in the [blog post](https://guix.gnu.org/blog/2021/taming-the-stat-storm-with-a-loader-cache/).

You can build the Docker image and inside will be `emacs-wrapped` as well as `emacs` and `strace` to recreate the experiment.
```console
> nix build .#experiments.emacs
> docker load < result
643ace721190: Loading layer [==================================================>] 786.9MB/786.9MB
Loaded image: shrinkwrap-emacs-experiment:7jjlknqq660x1crrw7gm4m2qzalp71qj
> docker run -it emacs-experiment:7jjlknqq660x1crrw7gm4m2qzalp71qj /bin/bash
> patchelf --print-needed /bin/emacs-stamped
/nix/store/m756011mkf1i0ki78i8y6ac3gf8qphvi-gcc-10.3.0-lib/lib/libstdc++.so.6
/nix/store/xif6gg595hgmqawrcarapa8j2r7fbz9w-icu4c-70.1/lib/libicudata.so.70
/nix/store/i6cmh2d4hbyp00rnh5rpf48pc7xfzx6j-libgpg-error-1.42/lib/libgpg-error.so.0
/nix/store/q39ykk5fnhlbnl119iqjbgaw44kd65fy-util-linux-2.37.2-lib/lib/libblkid.so.1
/nix/store/b1k5z0fdj0pnfz89k440al7ww4a263bf-libglvnd-1.3.4/lib/libGLX.so.0

```

If you'd like you can pull the image directly from DockerHub via [fmzakari/shrinkwrap-emacs-experiment:7jjlknqq660x1crrw7gm4m2qzalp71qj](https://hub.docker.com/layers/shrinkwrap-emacs-experiment/fmzakari/shrinkwrap-emacs-experiment/7jjlknqq660x1crrw7gm4m2qzalp71qj/images/sha256-4633059bdf6c7ddbe23a4c6da11eba7ff58029eb870af01c98f10ada03324ee0?context=explore).

```console
> docker pull fmzakari/shrinkwrap-emacs-experiment:7jjlknqq660x1crrw7gm4m2qzalp71qj
> docker run -it fmzakari/shrinkwrap-emacs-experiment:7jjlknqq660x1crrw7gm4m2qzalp71qj /bin/bash
> patchelf --print-needed /bin/emacs-stamped
/nix/store/m756011mkf1i0ki78i8y6ac3gf8qphvi-gcc-10.3.0-lib/lib/libstdc++.so.6
/nix/store/xif6gg595hgmqawrcarapa8j2r7fbz9w-icu4c-70.1/lib/libicudata.so.70
/nix/store/i6cmh2d4hbyp00rnh5rpf48pc7xfzx6j-libgpg-error-1.42/lib/libgpg-error.so.0
/nix/store/q39ykk5fnhlbnl119iqjbgaw44kd65fy-util-linux-2.37.2-lib/lib/libblkid.so.1
/nix/store/b1k5z0fdj0pnfz89k440al7ww4a263bf-libglvnd-1.3.4/lib/libGLX.so.0
```
## Contributions

Thanks to [@trws](https://github.com/trws) for the inspiration and original version of this Python script.
24 changes: 23 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,30 @@
'';
in
{
packages = { shrinkwrap = pkgs.shrinkwrap; };
packages = {
shrinkwrap = pkgs.shrinkwrap;
};

legacyPackages = {
experiments = {
emacs = pkgs.dockerTools.buildImage {
name = "shrinkwrap-emacs-experiment";
contents = [
pkgs.strace
pkgs.emacs
pkgs.shrinkwrap
pkgs.bashInteractive
pkgs.binutils
pkgs.patchelf
];
runAsRoot = ''
# this directory does not exist and is needed by shrinkwrap
mkdir /dev/fd
shrinkwrap ${pkgs.emacs}/bin/.emacs-27.2-wrapped -o /bin/emacs-stamped
'';
};
};
};

checks = {
pytest-check = runCodeAnalysis "pytest" ''
Expand Down

0 comments on commit 5fe6e27

Please sign in to comment.