testing flake-based container

This commit is contained in:
Vivian 2022-11-27 21:55:46 +01:00
parent 5d0bcc9e1e
commit 2a8f4e3f18
5 changed files with 87 additions and 9 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

10
.woodpecker-ci.yml Normal file
View file

@ -0,0 +1,10 @@
pipeline:
nix:
image: nixos/nix
commands:
- nix flake check
- nix build '.#mdbook-toc'
volumes:
- /nix/store:/nix/store
- /nix/var/nix/db:/nix/var/nix/db
- /nix/var/nix/daemon-socket:/nix/var/nix/daemon-socket

View file

@ -1,9 +0,0 @@
FROM alpine:3 as builder
RUN apk add --no-cache cargo
RUN cargo install mdbook
RUN cargo install mdbook-toc
FROM alpine:3
RUN apk add --no-cache libgcc
COPY --from=builder /root/.cargo/bin/mdbook /bin/mdbook
COPY --from=builder /root/.cargo/bin/mdbook-toc /bin/mdbook-toc

43
flake.lock Normal file
View file

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1669411043,
"narHash": "sha256-LfPd3+EY+jaIHTRIEOUtHXuanxm59YKgUacmSzaqMLc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5dc7114b7b256d217fe7752f1614be2514e61bb8",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

33
flake.nix Normal file
View file

@ -0,0 +1,33 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
packages = rec {
docker = pkgs.dockerTools.buildLayeredImage {
name = "mdbook-plus";
contents = mdbook-toc;
config.Cmd = [ "${pkgs.mdbook}/bin/mdbook" ];
};
mdbook-toc = pkgs.rustPlatform.buildRustPackage rec {
pname = "mdbook-toc";
version = "0.10.0";
src = pkgs.fetchFromGitHub {
owner = "badboy";
repo = pname;
rev = version;
sha256 = "sha256-/MPxuzqgWKyLP1fn/WoA2cKlV0TiVidt+YpNqY96sxE=";
};
cargoSha256 = "sha256-JFqkeea6o5Wzpe+2Fp+UYjBOh/e3vX1pZzCfxxfAYmU=";
};
};
});
}