nix: do not build docker image, moved plcom and assets in their own nix modules
This commit is contained in:
parent
cb8e992f27
commit
fd7f6e02db
4 changed files with 102 additions and 190 deletions
26
crates/plcom/assets.nix
Normal file
26
crates/plcom/assets.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
tailwindcss,
|
||||
tailwindProjectRoot,
|
||||
src,
|
||||
}:
|
||||
|
||||
let
|
||||
tailwindStylesheet = import ./tailwind.nix {
|
||||
stdenvNoCC = stdenvNoCC;
|
||||
tailwindcss = tailwindcss;
|
||||
src = tailwindProjectRoot;
|
||||
inputFile = "css/main.css";
|
||||
};
|
||||
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "plcom-assets";
|
||||
src = src;
|
||||
buildInputs = [ tailwindStylesheet ];
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r $src/* $out/
|
||||
cp ${tailwindStylesheet}/output.css $out/style.css
|
||||
'';
|
||||
}
|
||||
59
crates/plcom/default.nix
Normal file
59
crates/plcom/default.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
libiconv,
|
||||
lib,
|
||||
pkg-config,
|
||||
stdenv,
|
||||
craneLib,
|
||||
}:
|
||||
|
||||
let
|
||||
commonArgs = {
|
||||
src = lib.cleanSourceWith {
|
||||
src = craneLib.path ./.; # The original, unfiltered source
|
||||
filter =
|
||||
path: type:
|
||||
# Assets for codegen
|
||||
(lib.hasSuffix ".json" path)
|
||||
||
|
||||
# Default filter from crane (allow .rs files)
|
||||
(craneLib.filterCargoSources path type);
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
# Add additional build inputs here
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
libiconv
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
# Add extra native build inputs here, etc.
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
|
||||
# Build *just* the cargo dependencies
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
# Clippy
|
||||
clippyArtifacts = craneLib.cargoClippy (
|
||||
commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
# Again we apply some extra arguments only to this derivation
|
||||
# and not every where else. In this case we add some clippy flags
|
||||
# cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
}
|
||||
);
|
||||
|
||||
in
|
||||
craneLib.buildPackage (
|
||||
commonArgs
|
||||
// {
|
||||
cargoExtraArgs = "-p plcom";
|
||||
cargoArtifacts = clippyArtifacts;
|
||||
}
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue