Skip to content

Commit a81ce8f

Browse files
committed
initial commit
0 parents  commit a81ce8f

40 files changed

Lines changed: 1058 additions & 0 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
result

AGENTS.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# ix/images
2+
3+
Pre-built OCI images for ix VMs, plus composable NixOS modules.
4+
5+
## How it works
6+
7+
`mkIxImage` wraps `lib.nixosSystem` with `boot.isContainer = true`. The NixOS system closure is packaged as an OCI archive. CI pre-builds images and publishes to `registry.ix.dev/ix/`. Users reference them directly: `ix new minecraft`.
8+
9+
## Directory structure
10+
11+
```
12+
images/
13+
games/minecraft/default.nix
14+
dev/kernel-dev/default.nix
15+
desktop/remote-desktop/default.nix
16+
modules/
17+
module-list.nix
18+
services/
19+
lib/
20+
default.nix
21+
ix-base.nix
22+
docker-to-oci.py
23+
```
24+
25+
## Module conventions
26+
27+
- Modules define `options` and `config`. They never import other modules.
28+
- `module-list.nix` registers all modules using `./` paths. No `..` anywhere.
29+
- Use standard NixOS options: `environment.systemPackages`, `systemd.services`, `networking.firewall`.
30+
- Images are pure config with no `imports`.
31+
- Guard config behind `mkIf cfg.enable`.
32+
33+
## Adding an image
34+
35+
1. Create `images/<category>/<name>/default.nix`
36+
2. Wire into `flake.nix` packages
37+
3. For versioned images, take version args and create versioned attrs (`minecraft_26w17a`) with a default alias (`minecraft`)
38+
39+
## Adding a module
40+
41+
1. Create `modules/services/<name>.nix`
42+
2. Add to `modules/module-list.nix`
43+
44+
## Nix style
45+
46+
- No `with pkgs;` or `with lib;` (ast-grep enforced)
47+
- No `writeShellScriptBin`, use `writeShellScript`
48+
- `__structuredAttrs = true` on all derivations
49+
- SRI hashes (`hash = "sha256-..."`)
50+
- No `rec { }`
51+
- x86_64-linux only
52+
53+
## Lint
54+
55+
```
56+
nix run nixpkgs#ast-grep -- scan
57+
```

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Indexable Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# ix/images
2+
3+
Pre-built OCI images for [ix](https://ix.dev) VMs.
4+
5+
```bash
6+
ix new minecraft # Fabric server
7+
ix new remote-desktop # Xvfb + noVNC desktop
8+
ix new kernel-dev # Linux kernel source + build tools
9+
```
10+
11+
See [`images/`](images) for all available images.
12+
13+
## Build from source
14+
15+
```bash
16+
nix build github:indexable-inc/images#minecraft
17+
ix push ./result minecraft
18+
```
19+
20+
## Custom images
21+
22+
Compose with NixOS modules:
23+
24+
```nix
25+
ix-images.lib.mkIxImage {
26+
modules = [({ pkgs, ... }: {
27+
ix.image.name = "my-server";
28+
services.minecraft.enable = true;
29+
services.remote-desktop.enable = true;
30+
environment.systemPackages = [ pkgs.htop pkgs.vim ];
31+
})];
32+
}
33+
```
34+
35+
All [NixOS options](https://search.nixos.org/options) work. Images are NixOS configs with systemd as PID 1.
36+
37+
## Contributing
38+
39+
Community contributions are welcome through [issues](https://github.com/indexable-inc/images/issues) and [pull requests](https://github.com/indexable-inc/images/pulls). Add `images/<category>/<name>/default.nix`, wire into `flake.nix`. See [AGENTS.md](AGENTS.md) for conventions.
40+
41+
## Related
42+
43+
- [ix](https://ix.dev) - the platform
44+
- [ix docs](https://github.com/indexable-inc/docs) - platform documentation
45+
- [ix CLI](https://github.com/indexable-inc/ix) - command-line interface
46+
- [NixOS](https://nixos.org) - the module system and packages underneath
47+
48+
Inspired by [nixpkgs](https://github.com/NixOS/nixpkgs) and [Raycast Extensions](https://github.com/raycast/extensions).
49+
50+
## License
51+
52+
[MIT](LICENSE). The license applies to the Nix expressions and modules in this repository, not to the software packaged within the images.

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
description = "Pre-built OCI images for ix VMs";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
6+
outputs =
7+
{ self, nixpkgs }:
8+
let
9+
system = "x86_64-linux";
10+
ix = self.lib;
11+
12+
minecraftImage = import ./images/games/minecraft;
13+
in
14+
{
15+
lib = import ./lib {
16+
inherit nixpkgs;
17+
moduleList = import ./modules/module-list.nix;
18+
};
19+
20+
modules = import ./modules;
21+
22+
packages.${system} = {
23+
kernel-dev = ix.mkIxImage { modules = [ ./images/dev/kernel-dev ]; };
24+
remote-desktop = ix.mkIxImage { modules = [ ./images/desktop/remote-desktop ]; };
25+
26+
minecraft = self.packages.${system}.minecraft_26w17a;
27+
28+
minecraft_26w17a = ix.mkIxImage {
29+
modules = [
30+
(minecraftImage {
31+
minecraftVersion = "26.2-snapshot-5";
32+
fabricLoaderVersion = "0.19.2";
33+
fabricInstallerVersion = "1.1.1";
34+
serverJarHash = "sha256-IZctWQu9VH4Z5lU/VcEzvPGLfW8boOAXtCaQlKXyA5k=";
35+
})
36+
];
37+
};
38+
};
39+
40+
templates.default = {
41+
path = ./template;
42+
description = "Starter ix image";
43+
};
44+
};
45+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
pkgs,
3+
...
4+
}:
5+
{
6+
ix.image.name = "ix-remote-desktop";
7+
8+
environment.systemPackages = [
9+
pkgs.xterm
10+
pkgs.firefox
11+
];
12+
13+
services.remote-desktop.enable = true;
14+
}

images/dev/kernel-dev/default.nix

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
pkgs,
3+
...
4+
}:
5+
{
6+
ix.image.name = "linux-kernel-dev";
7+
8+
environment.systemPackages = [
9+
pkgs.gnumake
10+
pkgs.gcc
11+
pkgs.gnugrep
12+
pkgs.findutils
13+
];
14+
15+
services.git-clone = {
16+
enable = true;
17+
url = "https://github.com/torvalds/linux.git";
18+
dest = "/src/linux";
19+
};
20+
}

images/games/minecraft/default.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ minecraftVersion, fabricLoaderVersion, fabricInstallerVersion, serverJarHash }:
2+
{
3+
...
4+
}:
5+
{
6+
ix.image.name = "minecraft";
7+
ix.image.tag = "${minecraftVersion}-fabric";
8+
9+
services.minecraft = {
10+
enable = true;
11+
inherit
12+
minecraftVersion
13+
fabricLoaderVersion
14+
fabricInstallerVersion
15+
serverJarHash
16+
;
17+
memory = "2G";
18+
serverProperties = {
19+
motd = "ix-powered Minecraft";
20+
max-players = "20";
21+
};
22+
};
23+
}

0 commit comments

Comments
 (0)