-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
65 lines (60 loc) · 1.84 KB
/
flake.nix
File metadata and controls
65 lines (60 loc) · 1.84 KB
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
65
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
templ.url = "github:a-h/templ";
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, flake-utils, nixpkgs, gitignore, templ }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
templ-pkg = templ.packages.${system}.templ;
in
{
packages = rec {
htmx-blog = pkgs.buildGo121Module {
name = "htmx-blog";
src = gitignore.lib.gitignoreSource ./.;
vendorHash = "sha256-HRrW8wRYqnyDtcCWVt9YM2DmlutCV2KWvVM4jM4DqdY=";
preBuild = ''
${templ-pkg}/bin/templ generate
'';
postBuild = ''
${pkgs.tailwindcss}/bin/tailwindcss -- -i static/tw.css -o static/main.css --minify
mkdir -p $out/static $out/content $out/components
cp -r static/* $out/static
cp -r content/* $out/content
cp -r components/index.xml $out/components/index.xml
'';
};
tailwindcss = pkgs.tailwindcss;
docker = pkgs.dockerTools.buildLayeredImage {
name = "htmx-blog";
config = {
Cmd = ["${htmx-blog}/bin/htmx-blog"];
ExposedPorts = {
"3000/tcp" = {};
};
Env = [
"ROOT_PATH=${htmx-blog}"
];
};
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
tailwindcss
nodejs_20
playwright-test
k6
templ-pkg
];
};
}
);
}