-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
39 lines (34 loc) · 1.05 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
{
description = "My personal website and blog";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
systems.url = "github:nix-systems/default-linux";
};
outputs = { self, systems, nixpkgs }:
let
forAllSystems = f: nixpkgs.lib.genAttrs (import systems) (system: f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
in
rec {
packages = forAllSystems ({ pkgs, ... }: rec {
default = pkgs.callPackage ./. { };
serve = let
port = 4000;
in pkgs.writeShellScriptBin "serve-website" ''
echo "Running in http://localhost:${toString port}"
${nixpkgs.lib.getExe pkgs.webfs} -F -p ${toString port} -f index.html -r ${default}/public
'';
});
apps = forAllSystems ({ system, ... }: {
default = {
type = "app";
program = "${packages.${system}.serve}/bin/serve-website";
};
});
hydraJobs = forAllSystems ({ system, ... }: {
main = packages.${system}.default;
});
};
}