nix: copy assets in docker, need to finish env
This commit is contained in:
parent
89e0432b7a
commit
3b9f4792dc
1 changed files with 33 additions and 4 deletions
37
flake.nix
37
flake.nix
|
|
@ -87,10 +87,30 @@
|
|||
});
|
||||
|
||||
# Build crate
|
||||
ezidam = craneLib.buildPackage (commonArgs // {
|
||||
ezidamBinary = craneLib.buildPackage (commonArgs // {
|
||||
cargoArtifacts = ezidamClippy;
|
||||
});
|
||||
|
||||
ezidamAssetTemplate = ./crates/ezidam/templates;
|
||||
ezidamAssetStatic = ./crates/ezidam/static;
|
||||
|
||||
ezidamAssets = [
|
||||
ezidamAssetTemplate
|
||||
ezidamAssetStatic
|
||||
];
|
||||
|
||||
ezidam = pkgs.stdenv.mkDerivation {
|
||||
inherit ezidamBinary ezidamAssets;
|
||||
name = metadata.pname;
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -rv $ezidamBinary $out
|
||||
cp -rv $ezidamAssets $out
|
||||
'';
|
||||
};
|
||||
|
||||
# Docker image
|
||||
dockerImage = pkgs.dockerTools.buildLayeredImage {
|
||||
# Meta
|
||||
|
|
@ -102,20 +122,29 @@
|
|||
contents = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [
|
||||
ezidam
|
||||
ezidamBinary
|
||||
ezidamAssets
|
||||
];
|
||||
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
|
||||
|
||||
# Container config
|
||||
config = {
|
||||
Cmd = [ "${ezidam}/bin/ezidam" ];
|
||||
Cmd = [ "${ezidamBinary}/bin/ezidam" ];
|
||||
Env = [
|
||||
"EZIDAM_TEMPLATE_DIR=${ezidamAssetTemplate}"
|
||||
"EZIDAM_STATIC_DIR=${ezidamAssetStatic}"
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
apps.default = {
|
||||
type = "app";
|
||||
program = "${ezidamBinary}/bin/ezidam";
|
||||
};
|
||||
|
||||
packages = {
|
||||
inherit ezidam dockerImage;
|
||||
default = ezidam;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue