forked from Die-KoMa/die-koma.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
74 lines (72 loc) · 2.35 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
65
66
67
68
69
70
71
72
73
74
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
outputs =
flakes@{ nixpkgs, ... }:
let
overlays = [ flakes.self.overlays.default ];
withPkgsFor =
systems: fn:
with nixpkgs.lib;
genAttrs systems (system: fn (import nixpkgs { inherit system overlays; }));
withPkgs = withPkgsFor nixpkgs.lib.platforms.unix;
in
{
overlays.default =
final: prev:
let
runNpm = args: {
type = "app";
program =
let
build = final.writeShellScript "build" ''
export PATH=${final.bash}/bin:${final.nodePackages.nodejs}/bin:${final.nodePackages.npm}/bin
npm ${args}
'';
in
"${build}";
};
in
{
koma-homepage = final.callPackage ./default.nix { };
koma-homepage-tar = final.koma-homepage.override { doTar = true; };
koma-homepage-install = runNpm ''install "$@"'';
koma-homepage-build = runNpm "run build";
koma-homepage-dev = runNpm ''run dev "$@"'';
koma-homepage-audit = runNpm ''audit "$@"'';
koma-homepage-update = runNpm ''update "$@"'';
};
apps = withPkgs (pkgs: {
build = pkgs.koma-homepage-build;
install = pkgs.koma-homepage-install;
dev = pkgs.koma-homepage-dev;
default = pkgs.koma-homepage-dev;
update = pkgs.koma-homepage-update;
audit = pkgs.koma-homepage-audit;
check-links = {
type = "app";
program =
let
checkLinks = pkgs.writeShellScript "check-links" ''
LANG="C.UTF-8" ${pkgs.html-proofer}/bin/htmlproofer --allow-hash-href --assume-extension --empty-alt-ignore --ignore-status-codes 401 ${pkgs.koma-homepage}
'';
in
"${checkLinks}";
};
});
packages = withPkgs (pkgs: {
KoMaHomepage = pkgs.koma-homepage;
KoMaHomepageTar = pkgs.koma-homepage-tar;
default = pkgs.koma-homepage;
});
devShells = withPkgs (pkgs: {
default = pkgs.mkShell {
name = "koma-homepage-shell";
buildInputs = [
pkgs.nodePackages.nodejs
pkgs.nodePackages.npm
pkgs.tailwindcss
];
};
});
};
}