-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
64 lines (59 loc) · 1.77 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
description = "KCHUNG News Website";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-23.11;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = import nixpkgs { inherit system; };
in rec {
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.nodePackages.prettier
pkgs.nodePackages.vercel
pkgs.nodejs
pkgs.yarn
];
};
formatter = pkgs.nixpkgs-fmt;
packages = let
kchung-news = pkgs.buildNpmPackage rec {
pname = "kchung.news";
version = "0.1.0.0";
buildInputs = [
pkgs.nodejs
];
src = ./.;
npmDepsHash = "sha256-TtBU/f2VDOV/lplB2YRCy489cnRt4+TPcY/tBM1naOc=";
npmBuild = "npm run build";
installPhase = ''
cp -r .next/standalone $out
cp -r .next/static $out/.next/static
cp -r public $out/public
'';
};
in {
default = kchung-news;
container = pkgs.dockerTools.buildLayeredImage
{
name = "kchung.news";
contents = [ pkgs.nodejs kchung-news ];
config = {
Cmd = [
"${pkgs.nodejs-16_x}/bin/node"
"server.js"
];
ExposedPorts = {
"3000/tcp" = { };
};
};
};
};
});
}