feat: mark the minimal image as minimal and extend the defualt one

This commit is contained in:
Tamipes 2026-05-29 16:08:37 +02:00
parent 26b0e92539
commit 93b71cbbc5
2 changed files with 30 additions and 14 deletions

View file

@ -7,21 +7,22 @@ As you cannot run a forgejo runner with `nixos/nix` due to it not having `node`
```bash ```bash
USERNAME="tamipes" USERNAME="tamipes"
URL="git.tami.moe" URL="git.tami.moe"
IMG_NAME="nix"
nix build --extra-experimental-features "flakes nix-command" . nix build --extra-experimental-features "flakes nix-command" .
docker load -i result docker load -i result
docker image tag nix "$URL/$USERNAME/nix:latest" docker image tag nix "$URL/$USERNAME/$IMG_NAME:latest"
docker login "https://$URL" docker login "https://$URL"
docker push "$URL/$USERNAME/nix" docker push "$URL/$USERNAME/$IMG_NAME"
rm result # don't forget to cleanup the GC root rm result # don't forget to cleanup the GC root
# I also tag with the date, but this might be unneeded # I also tag with the date, but this might be unneeded
docker image tag nix "$URL/$USERNAME/nix:latest$(date --iso-8601)" docker image tag nix "$URL/$USERNAME/$IMG_NAME:latest$(date --iso-8601)"
docker push "$URL/$USERNAME/nix" docker push "$URL/$USERNAME/$IMG_NAME"
``` ```
# Extra info # Extra info
- This image is essentially still "based" on `nixos/nix`, but it builds it with nodejs included. Checkout the flake.nix! - These image are essentially still "based" on `nixos/nix`, but it builds it with nodejs(+extras) included. Checkout the flake.nix!
- it does not use `nixos/nix` as a base image, but uses the same build script and adds extra stuff - it does not use `nixos/nix` as a base image, but uses the same build script and adds extra stuff
- [nixpkgs manual](https://nix.dev/manual/nix/2.24/installation/installing-docker#docker-image-with-the-latest-development-version-of-nix) - [nixpkgs manual](https://nix.dev/manual/nix/2.24/installation/installing-docker#docker-image-with-the-latest-development-version-of-nix)
- [nixos/nix build script](https://github.com/NixOS/nix/blob/master/docker.nix) - [nixos/nix build script](https://github.com/NixOS/nix/blob/master/docker.nix)

View file

@ -6,17 +6,32 @@
}; };
outputs = { nixpkgs, nix, self }: outputs = { nixpkgs, nix, self }:
let pkgs = import nixpkgs { system = "x86_64-linux"; }; in { let pkgs = import nixpkgs { system = "x86_64-linux"; }; in {
packages.x86_64-linux.default = import (nix + "/docker.nix") { packages.x86_64-linux = rec {
default = nix;
minimal-nix = import (nix + "/docker.nix") {
inherit pkgs; inherit pkgs;
extraPkgs = [ pkgs.nodejs ]; extraPkgs = [ pkgs.nodejs ];
Labels = { Labels = {
"org.opencontainers.image.title" = "Nix"; "org.opencontainers.image.title" = "Nix (minimal)";
"org.opencontainers.image.source" = "https://git.tami.moe/tamipes/"; "org.opencontainers.image.source" = "https://git.tami.moe/tamipes/forgejo-actions";
"org.opencontainers.image.vendor" = "Tamipes"; "org.opencontainers.image.vendor" = "Tamipes";
"org.opencontainers.image.version" = pkgs.nix.version; "org.opencontainers.image.version" = pkgs.nix.version;
"org.opencontainers.image.description" = "Nix container image with nodejs"; "org.opencontainers.image.description" = "Nix container image with nodejs";
}; };
}; };
nix = import (nix + "/docker.nix") {
inherit pkgs;
extraPkgs = [ pkgs.nodejs pkgs.skopeo ];
Labels = {
"org.opencontainers.image.title" = "Nix";
"org.opencontainers.image.source" = "https://git.tami.moe/tamipes/forgejo-actions";
"org.opencontainers.image.vendor" = "Tamipes";
"org.opencontainers.image.version" = pkgs.nix.version;
"org.opencontainers.image.description" = "Nix container image with more cli tools";
};
};
};
}; };
} }