-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
94 lines (84 loc) · 2.42 KB
/
Copy pathflake.nix
File metadata and controls
94 lines (84 loc) · 2.42 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
description = "Nix configuration for codemanufacture.com (Hugo)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/x86_64-linux";
treefmt-nix.url = "github:numtide/treefmt-nix";
gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{ flake-parts, gitignore, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.treefmt-nix.flakeModule
];
systems = import inputs.systems;
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
packages.default = pkgs.stdenv.mkDerivation {
name = "codemanufacture-website";
src = gitignore.lib.gitignoreSource ./.;
nativeBuildInputs = with pkgs; [
hugo
];
buildPhase = ''
hugo --minify
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r public/* $out/
runHook postInstall
'';
};
treefmt = {
projectRootFile = "flake.lock";
settings.global.excludes = [
"*.gitignore"
".envrc"
"LICENSE"
"public/*"
"resources/*"
];
programs.nixfmt.enable = true;
programs.prettier = {
enable = true;
settings = {
semi = false;
singleQuote = true;
trailingComma = "es5";
arrowParens = "avoid";
plugins = [
"${pkgs.prettier-plugin-go-template}/lib/node_modules/prettier-plugin-go-template/lib/index.js"
];
overrides = [
{
files = [ "layouts/**/*.html" ];
options.parser = "go-template";
}
];
};
};
};
devShells.default = pkgs.mkShellNoCC {
nativeBuildInputs = [
pkgs.hugo
pkgs.awscli2
];
inputsFrom = [
config.treefmt.build.devShell
];
};
};
};
}