-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
73 lines (68 loc) · 2.16 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
{
description = "Lilly's own personal homepage";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }:
let
pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
packages.x86_64-linux = rec {
homepage = pkgs.python3.pkgs.buildPythonApplication {
name = pyproject.project.name;
version = pyproject.project.version;
format = "pyproject";
src = ./.;
nativeBuildInputs = with pkgs.python3.pkgs; [ flit ];
propagatedBuildInputs = with pkgs.python3.pkgs; [
fastapi
jinja2
hypercorn
colorama
python-frontmatter
markdown
pygments
aiohttp
sqlmodel
beautifulsoup4
];
};
homepage-oci = pkgs.dockerTools.buildLayeredImage {
name = "git.lly.sh/lilly/homepage";
tag = "latest";
config = {
Entrypoint = [ "${homepage}/bin/homepage" ];
Cmd = [ "--db=/srv/homepage/db.sqlite3" "serve" "--bind=0.0.0.0:8000" ];
User = "10000:65534"; # 10,000 and nogroup
WorkingDir = "/srv/homepage";
ExposedPorts = {
"8000/tcp" = { };
};
Volumes = {
"/srv/homepage/" = {};
};
Labels = {
"org.opencontainers.image.url" = pyproject.project.urls."Home";
"org.opencontainers.image.source" = pyproject.project.urls."Source";
"org.opencontainers.image.version" = pyproject.project.version;
"org.opencontainers.image.revision" = if (self ? rev) then self.rev else self.dirtyRev;
"org.opencontainers.image.licenses" = "MIT";
};
};
};
};
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [
python312
uv
pre-commit
ruff
python312Packages.pygments
python312Packages.requests
sqlite
];
};
};
}