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
|
# Build crate
|
||||||
ezidam = craneLib.buildPackage (commonArgs // {
|
ezidamBinary = craneLib.buildPackage (commonArgs // {
|
||||||
cargoArtifacts = ezidamClippy;
|
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
|
# Docker image
|
||||||
dockerImage = pkgs.dockerTools.buildLayeredImage {
|
dockerImage = pkgs.dockerTools.buildLayeredImage {
|
||||||
# Meta
|
# Meta
|
||||||
|
|
@ -102,20 +122,29 @@
|
||||||
contents = pkgs.buildEnv {
|
contents = pkgs.buildEnv {
|
||||||
name = "image-root";
|
name = "image-root";
|
||||||
paths = [
|
paths = [
|
||||||
ezidam
|
ezidamBinary
|
||||||
|
ezidamAssets
|
||||||
];
|
];
|
||||||
|
|
||||||
pathsToLink = [ "/bin" ];
|
pathsToLink = [ "/bin" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
# Container config
|
# Container config
|
||||||
config = {
|
config = {
|
||||||
Cmd = [ "${ezidam}/bin/ezidam" ];
|
Cmd = [ "${ezidamBinary}/bin/ezidam" ];
|
||||||
|
Env = [
|
||||||
|
"EZIDAM_TEMPLATE_DIR=${ezidamAssetTemplate}"
|
||||||
|
"EZIDAM_STATIC_DIR=${ezidamAssetStatic}"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
apps.default = {
|
||||||
|
type = "app";
|
||||||
|
program = "${ezidamBinary}/bin/ezidam";
|
||||||
|
};
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
inherit ezidam dockerImage;
|
inherit ezidam dockerImage;
|
||||||
default = ezidam;
|
default = ezidam;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue