Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
84 lines (73 loc) · 2.15 KB
/
Copy pathflake.nix
File metadata and controls
84 lines (73 loc) · 2.15 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
{
description = "vibec0re w3bsite — hugo static site, maximum c0re vibes";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, treefmt-nix }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f:
nixpkgs.lib.genAttrs systems (system: f {
inherit system;
pkgs = import nixpkgs { inherit system; };
});
treefmtEval = forAllSystems ({ pkgs, ... }:
treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixpkgs-fmt.enable = true;
programs.prettier.enable = true;
programs.taplo.enable = true;
settings.formatter.prettier.includes = [
"*.md"
"*.css"
"*.js"
"*.html"
"*.json"
"*.yaml"
"*.yml"
];
});
in
{
packages = forAllSystems ({ pkgs, ... }: {
default = self.packages.${pkgs.system}.dist;
dist = pkgs.stdenv.mkDerivation {
pname = "vibec0re-w3bsite";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.hugo ];
buildPhase = ''
runHook preBuild
hugo --minify --destination $out
runHook postBuild
'';
dontInstall = true;
};
});
devShells = forAllSystems ({ pkgs, ... }: {
default = pkgs.mkShell {
packages = [
pkgs.hugo
pkgs.go
treefmtEval.${pkgs.system}.config.build.wrapper
];
shellHook = ''
echo "▓▒░ vibec0re dev shell ░▒▓"
echo "hugo $(hugo version)"
'';
};
});
formatter = forAllSystems ({ pkgs, ... }:
treefmtEval.${pkgs.system}.config.build.wrapper);
checks = forAllSystems ({ pkgs, ... }: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
};
}