Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 01b3880b41 |
4 changed files with 45 additions and 124 deletions
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
|
|
@ -2,9 +2,6 @@ name: Build and Push docker image
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
buildAndPush:
|
buildAndPush:
|
||||||
|
|
@ -13,18 +10,16 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Nix build
|
- name: Nix build
|
||||||
run: nix build --extra-experimental-features "flakes nix-command" .
|
run: nix build --extra-experimental-features "flakes nix-command" .
|
||||||
|
- name: Debug
|
||||||
|
run: echo $PWD
|
||||||
- name: Setup skopeo
|
- name: Setup skopeo
|
||||||
run: curl -o /etc/containers/policy.json --create-dirs https://raw.githubusercontent.com/containers/skopeo/refs/heads/main/default-policy.json
|
run: curl -o /etc/containers/policy.json --create-dirs https://raw.githubusercontent.com/containers/skopeo/refs/heads/main/default-policy.json
|
||||||
- name: Push Image
|
- name: Push Image
|
||||||
run: |
|
run: |
|
||||||
skopeo copy --dest-password "$UPLOAD_TOKEN" --dest-username "$USERNAME" "docker-archive://$(realpath result)" "docker://$IMG_URL:$(date --iso-8601)" && \
|
nix shell --extra-experimental-features "flakes nix-command" nixpkgs#skopeo -c sh -c \
|
||||||
skopeo copy --dest-password "$UPLOAD_TOKEN" --dest-username "$USERNAME" "docker-archive://$(realpath result)" "docker://$IMG_URL"
|
'skopeo copy --dest-password "$UPLOAD_TOKEN" --dest-username "$USERNAME" docker-archive://$(realpath result) "docker://$IMG_URL:$(date --iso-8601)" && \
|
||||||
|
skopeo copy --dest-password "$UPLOAD_TOKEN" --dest-username "$USERNAME" docker-archive://$(realpath result) "docker://$IMG_URL"'
|
||||||
env:
|
env:
|
||||||
USERNAME: tamipes
|
USERNAME: tamipes
|
||||||
UPLOAD_TOKEN: ${{ secrets.UPLOAD_TOKEN }}
|
UPLOAD_TOKEN: ${{ secrets.UPLOAD_TOKEN }}
|
||||||
IMG_URL: git.tami.moe/tamipes/nix
|
IMG_URL: git.tami.moe/tamipes/nix
|
||||||
- name: niks3 pin
|
|
||||||
uses: https://git.tami.moe/actions/niks3-upload@main
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.NIKS3_TOKEN }}
|
|
||||||
pin: nix-container
|
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -7,22 +7,21 @@ 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 "$IMG_NAME" "$URL/$USERNAME/$IMG_NAME:latest"
|
docker image tag nix "$URL/$USERNAME/nix:latest"
|
||||||
docker login "https://$URL"
|
docker login "https://$URL"
|
||||||
docker push "$URL/$USERNAME/$IMG_NAME"
|
docker push "$URL/$USERNAME/nix"
|
||||||
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 "$IMG_NAME" "$URL/$USERNAME/$IMG_NAME:latest$(date --iso-8601)"
|
docker image tag nix "$URL/$USERNAME/nix:latest$(date --iso-8601)"
|
||||||
docker push "$URL/$USERNAME/$IMG_NAME"
|
docker push "$URL/$USERNAME/nix"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
# Extra info
|
# Extra info
|
||||||
- These image are essentially still "based" on `nixos/nix`, but it builds it with nodejs(+extras) included. Checkout the flake.nix!
|
- This image is essentially still "based" on `nixos/nix`, but it builds it with nodejs 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)
|
||||||
|
|
|
||||||
84
flake.lock
generated
84
flake.lock
generated
|
|
@ -24,11 +24,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1782949081,
|
"lastModified": 1733312601,
|
||||||
"narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=",
|
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e",
|
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -42,17 +42,24 @@
|
||||||
"flake-compat": [
|
"flake-compat": [
|
||||||
"nix"
|
"nix"
|
||||||
],
|
],
|
||||||
|
"gitignore": [
|
||||||
|
"nix"
|
||||||
|
],
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nix",
|
"nix",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": [
|
||||||
|
"nix",
|
||||||
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1783008725,
|
"lastModified": 1734279981,
|
||||||
"narHash": "sha256-jGiy6+sxjNWXSjp25uoJuNfyH9zBK1PEDY0lVoL4ibQ=",
|
"narHash": "sha256-NdaCraHPp8iYMWzdXAt5Nv6sA3MUzlCiGiR586TCwo0=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "bca82caa46d5ec0f5d422c61fb1e30bc51313cbe",
|
"rev": "aa9f40c906904ebd83da78e7f328cd8aeaeae785",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -61,27 +68,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"niks3": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"treefmt-nix": "treefmt-nix"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1784469529,
|
|
||||||
"narHash": "sha256-paLbmEm96K2rGVzUxhW/Z705BRF9TzZHU2U+9UnKbAg=",
|
|
||||||
"owner": "Mic92",
|
|
||||||
"repo": "niks3",
|
|
||||||
"rev": "6e6d6251d94d08bd98410fc190daba80dba02f5b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "Mic92",
|
|
||||||
"repo": "niks3",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix": {
|
"nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
|
@ -92,11 +78,11 @@
|
||||||
"nixpkgs-regression": "nixpkgs-regression"
|
"nixpkgs-regression": "nixpkgs-regression"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1784375420,
|
"lastModified": 1768165334,
|
||||||
"narHash": "sha256-dt1zVj4MRpmffhsgQk+3tx1m/pFTXbtVWrn5KZ1y+8Q=",
|
"narHash": "sha256-42bXWekwea6E+q00HVskzi7ggMQSr8g/7ApQaNd+mr0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"rev": "bebd2f851a304e9fb2e143ce0cbeff577c6a37ac",
|
"rev": "252aff5c8f1dcdea1046b03a8196ef63ecf3b112",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -107,15 +93,15 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1783148766,
|
"lastModified": 1763948260,
|
||||||
"narHash": "sha256-H9+N+GFtsbVC8ZniHliChM7ndizxtqVZs6bnGOLM3WQ=",
|
"narHash": "sha256-zZk7fn2ARAqmLwaYTpxBJmj81KIdz11NiWt7ydHHD/M=",
|
||||||
"rev": "a50de1b7d8a586adc18d2395c19de7d6058e6030",
|
"rev": "1c8ba8d3f7634acac4a2094eef7c32ad9106532c",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.4193.a50de1b7d8a5/nixexprs.tar.xz"
|
"url": "https://releases.nixos.org/nixos/25.05/nixos-25.05.813095.1c8ba8d3f763/nixexprs.tar.xz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://channels.nixos.org/nixos-26.05/nixexprs.tar.xz"
|
"url": "https://channels.nixos.org/nixos-25.05/nixexprs.tar.xz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-23-11": {
|
"nixpkgs-23-11": {
|
||||||
|
|
@ -152,11 +138,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1784497964,
|
"lastModified": 1768127708,
|
||||||
"narHash": "sha256-vlHUuqAcbcH2RKmHbPiuQzbv1pnzzavXnI62RD0bqCU=",
|
"narHash": "sha256-1Sm77VfZh3mU0F5OqKABNLWxOuDeHIlcFjsXeeiPazs=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "241313f4e8e508cb9b13278c2b0fa25b9ca27163",
|
"rev": "ffbc9f8cbaacfb331b6017d5a5abb21a492c9a38",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -168,31 +154,9 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"niks3": "niks3",
|
|
||||||
"nix": "nix",
|
"nix": "nix",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"treefmt-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"niks3",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1780220602,
|
|
||||||
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"rev": "db947814a175b7ca6ded66e21383d938df01c227",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
49
flake.nix
49
flake.nix
|
|
@ -3,57 +3,20 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
nix.url = "github:nixos/nix";
|
nix.url = "github:nixos/nix";
|
||||||
niks3 = {
|
|
||||||
url = "github:Mic92/niks3";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
};
|
||||||
};
|
outputs = { nixpkgs, nix, self }:
|
||||||
outputs = { nixpkgs, nix, self, ... }@inputs:
|
let pkgs = import nixpkgs { system = "x86_64-linux"; }; in {
|
||||||
let
|
packages.x86_64-linux.default = import (nix + "/docker.nix") {
|
||||||
system = "x86_64-linux";
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
packages.${system} = rec {
|
|
||||||
default = nix-with-tools;
|
|
||||||
|
|
||||||
minimal-nix = import (nix + "/docker.nix") {
|
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
extraPkgs = [ pkgs.nodejs pkgs.busybox ];
|
extraPkgs = [ pkgs.nodejs ];
|
||||||
|
|
||||||
Labels = {
|
Labels = {
|
||||||
"org.opencontainers.image.title" = "Nix (minimal)";
|
"org.opencontainers.image.title" = "Nix";
|
||||||
"org.opencontainers.image.source" = "https://git.tami.moe/tamipes/forgejo-actions";
|
"org.opencontainers.image.source" = "https://git.tami.moe/tamipes/";
|
||||||
"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-with-tools = import (nix + "/docker.nix") {
|
|
||||||
inherit pkgs;
|
|
||||||
extraPkgs = [
|
|
||||||
pkgs.nodejs
|
|
||||||
pkgs.busybox
|
|
||||||
pkgs.skopeo
|
|
||||||
inputs.niks3.packages.${system}.default
|
|
||||||
];
|
|
||||||
nixConf = {
|
|
||||||
extra-substituters = [ "https://nix-cache.tami.moe" "https://niks3-cache.tami.moe" ];
|
|
||||||
trusted-public-keys = [
|
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
"nix-cache.tami.moe:3jrWZ412K0YTFfKMJC6ftc4lsugeMVWDBiudFCAdDb8="
|
|
||||||
"niks3-garage:l7ZLnM6i0mqqHbMEpHg+UAeqG53u8m/Mhep487dOOOE="
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue