65 lines
1.7 KiB
Nix
65 lines
1.7 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
gitignore = {
|
|
url = "github:hercules-ci/gitignore.nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, gitignore, ... }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
};
|
|
in
|
|
{
|
|
devShell = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
nodejs
|
|
yarn
|
|
];
|
|
};
|
|
|
|
packages = with pkgs; flake-utils.lib.flattenTree rec {
|
|
yarnPkg = pkgs.mkYarnPackage rec {
|
|
name = "memejoin-svelte";
|
|
pname = "memejoin-svelte";
|
|
src = self;
|
|
doDist = false;
|
|
preBuild = ''
|
|
yarn --offline build
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mv deps/${pname}/build/* $out/bin/
|
|
mv deps/${pname}/package.json $out/bin
|
|
'';
|
|
};
|
|
|
|
default = buildFHSUserEnv {
|
|
name = "memejoin-svelte";
|
|
targetPkgs = pkgs: (with pkgs; [ nodejs ] );
|
|
runScript = "node ${yarnPkg.outPath}/bin";
|
|
|
|
};
|
|
|
|
docker = dockerTools.buildImage {
|
|
name = "memejoin-svelte";
|
|
tag = "0.1.2_1";
|
|
copyToRoot = buildEnv {
|
|
name = "image-root";
|
|
paths = [ nodejs yarnPkg ];
|
|
};
|
|
config = {
|
|
Expose = [ "3000" ];
|
|
Entrypoint = [ "node" "${yarnPkg.outPath}/bin" ];
|
|
};
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|