mirror of
https://github.com/Garmelon/Arbeitszeitdokumentationsgenerator.git
synced 2026-04-12 08:45:05 +02:00
Add a flake.nix generating a docker image
This commit is contained in:
parent
4a58ad892e
commit
b73efa7b28
2 changed files with 101 additions and 0 deletions
53
flake.nix
Normal file
53
flake.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
naersk = {
|
||||
url = "github:nix-community/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, naersk }:
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||
in
|
||||
rec {
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
naersk' = pkgs.callPackage naersk { };
|
||||
in
|
||||
rec {
|
||||
default = kit-timesheets;
|
||||
kit-timesheets = naersk'.buildPackage {
|
||||
root = ./.;
|
||||
};
|
||||
docker = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "garmelon/kit-timesheets";
|
||||
tag = "latest";
|
||||
|
||||
contents = with pkgs; [
|
||||
# Makes debugging the container a bit more pleasant
|
||||
busybox
|
||||
# Fontconfig is needed so typst will find fonts (renders a blank
|
||||
# document otherwise)
|
||||
fontconfig
|
||||
];
|
||||
|
||||
config = {
|
||||
Entrypoint = [ "${kit-timesheets}/bin/kit_timesheets" ];
|
||||
WorkingDir = "/tmp";
|
||||
Env = [
|
||||
# Fontconfig needs to be babysitted a bit in containers
|
||||
"FONTCONFIG_FILE=${pkgs.fontconfig.out}/etc/fonts/fonts.conf"
|
||||
"FONTCONFIG_PATH=${pkgs.fontconfig.out}/etc/fonts/"
|
||||
# Useful for read-only containers, as fontconfig will create a
|
||||
# cache there
|
||||
"HOME=/tmp"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue