Build blog image with NixNG

This commit is contained in:
Pim Kunis 2024-12-31 11:29:29 +01:00
parent bbb149def3
commit 4f956c005c
7 changed files with 156 additions and 58 deletions

View file

@ -11,7 +11,7 @@ Legend:
| Status | Image | Comments | | Status | Image | Comments |
| --- | --- | --- | | --- | --- | --- |
| ✨ | `git.kun.is/home/blog-pim` | | | ✨ | `nixng-blog` | |
| ✨ | `nixng-dnsmasq` | | | ✨ | `nixng-dnsmasq` | |
| ✨ | `nixng-attic` | | | ✨ | `nixng-attic` | |
| ✨ | `nixng-ntfy-sh` | | | ✨ | `nixng-ntfy-sh` | |

View file

@ -1,34 +1,28 @@
{ {
"nodes": { "nodes": {
"blog-pim": { "blog": {
"inputs": { "inputs": {
"flutils": [ "flutils": "flutils",
"flake-utils" "nixpkgs": "nixpkgs"
],
"nginx": "nginx",
"nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1715503080, "lastModified": 1735508994,
"narHash": "sha256-/VnzHTpTq3u0z2Vgu/vKU0SHwOUIu8olHDORWT0IofM=", "narHash": "sha256-SMMX3irZ4Y+0QEAq0mOYEnJIYRe3YnXHrkCSRvdxHxU=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5", "rev": "433c1ef4b5874e2c4782be7322604d17182035ab",
"revCount": 21, "revCount": 23,
"type": "git", "type": "git",
"url": "https://git.kun.is/home/blog-pim" "url": "https://git.kun.is/pim/blog"
}, },
"original": { "original": {
"rev": "7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5",
"type": "git", "type": "git",
"url": "https://git.kun.is/home/blog-pim" "url": "https://git.kun.is/pim/blog"
} }
}, },
"deploy-rs": { "deploy-rs": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_4",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_4",
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
@ -281,7 +275,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@ -299,7 +293,7 @@
}, },
"flake-utils_3": { "flake-utils_3": {
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_4"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -316,7 +310,7 @@
}, },
"flake-utils_4": { "flake-utils_4": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -349,7 +343,7 @@
}, },
"flake-utils_6": { "flake-utils_6": {
"inputs": { "inputs": {
"systems": "systems_7" "systems": "systems_8"
}, },
"locked": { "locked": {
"lastModified": 1726560853, "lastModified": 1726560853,
@ -365,6 +359,24 @@
"type": "github" "type": "github"
} }
}, },
"flutils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@ -504,7 +516,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_2", "systems": "systems_3",
"treefmt": "treefmt" "treefmt": "treefmt"
}, },
"locked": { "locked": {
@ -528,7 +540,7 @@
"servers", "servers",
"nixpkgs-unstable" "nixpkgs-unstable"
], ],
"systems": "systems_8", "systems": "systems_9",
"treefmt": "treefmt_2" "treefmt": "treefmt_2"
}, },
"locked": { "locked": {
@ -548,11 +560,11 @@
"nginx": { "nginx": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1713277799, "lastModified": 1735301654,
"narHash": "sha256-VNDzQvUGeh54F3s6SIq6lBrp4RatURzJoJqVorexttA=", "narHash": "sha256-PHcSyHYyPUwPAls0BgtnGu2e936vhxW2nt7bQxDyGAQ=",
"owner": "nginx", "owner": "nginx",
"repo": "nginx", "repo": "nginx",
"rev": "d8a849ae3c99ee5ca82c9a06074761e937dac6d6", "rev": "e3a9b6ad08a86e799a3d77da3f2fc507d3c9699e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -745,16 +757,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726871744, "lastModified": 1714076141,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2", "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -856,6 +868,22 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1733581040, "lastModified": 1733581040,
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=", "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
@ -871,7 +899,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1702272962, "lastModified": 1702272962,
"narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=",
@ -887,7 +915,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1726871744, "lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
@ -903,7 +931,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1733097829, "lastModified": 1733097829,
"narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=",
@ -927,7 +955,7 @@
"nixhelm", "nixhelm",
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_5", "systems": "systems_6",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
@ -946,15 +974,16 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"blog-pim": "blog-pim", "blog": "blog",
"dns": "dns", "dns": "dns",
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
"kubenix": "kubenix", "kubenix": "kubenix",
"nginx": "nginx",
"nix-snapshotter": "nix-snapshotter", "nix-snapshotter": "nix-snapshotter",
"nixhelm": "nixhelm", "nixhelm": "nixhelm",
"nixng": "nixng", "nixng": "nixng",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_3",
"nixpkgs-bazarr": "nixpkgs-bazarr", "nixpkgs-bazarr": "nixpkgs-bazarr",
"nixpkgs-jellyseerr": "nixpkgs-jellyseerr", "nixpkgs-jellyseerr": "nixpkgs-jellyseerr",
"servers": "servers", "servers": "servers",
@ -1041,8 +1070,9 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "systems", "owner": "nix-systems",
"type": "indirect" "repo": "default",
"type": "github"
} }
}, },
"systems_3": { "systems_3": {
@ -1055,9 +1085,8 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "id": "systems",
"repo": "default", "type": "indirect"
"type": "github"
} }
}, },
"systems_4": { "systems_4": {
@ -1085,8 +1114,9 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "systems", "owner": "nix-systems",
"type": "indirect" "repo": "default",
"type": "github"
} }
}, },
"systems_6": { "systems_6": {
@ -1099,9 +1129,8 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "id": "systems",
"repo": "default", "type": "indirect"
"type": "github"
} }
}, },
"systems_7": { "systems_7": {
@ -1120,6 +1149,21 @@
} }
}, },
"systems_8": { "systems_8": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_9": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@ -1178,7 +1222,7 @@
}, },
"treefmt-nix_2": { "treefmt-nix_2": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1727984844, "lastModified": 1727984844,
@ -1196,7 +1240,7 @@
}, },
"treefmt-nix_3": { "treefmt-nix_3": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1730025913, "lastModified": 1730025913,
@ -1214,7 +1258,7 @@
}, },
"treefmt-nix_4": { "treefmt-nix_4": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1733662930, "lastModified": 1733662930,
@ -1254,7 +1298,7 @@
}, },
"utils": { "utils": {
"inputs": { "inputs": {
"systems": "systems_6" "systems": "systems_7"
}, },
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1701680307,

View file

@ -18,12 +18,13 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
blog-pim = { blog = {
# HACK: pinning this to a specific revision, as my automation is broken. url = "git+https://git.kun.is/pim/blog";
url = "git+https://git.kun.is/home/blog-pim?rev=7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5";
inputs = { inputs = {
nixpkgs.follows = "nixpkgs"; # nixpkgs.follows = "nixpkgs";
flutils.follows = "flake-utils"; # flutils.follows = "flake-utils";
# nixng.follows = "nixng";
}; };
}; };
@ -51,6 +52,11 @@
url = "github:pdtpartners/nix-snapshotter"; url = "github:pdtpartners/nix-snapshotter";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nginx = {
url = "github:nginx/nginx";
flake = false;
};
}; };
outputs = inputs @ {flake-utils, ...}: outputs = inputs @ {flake-utils, ...}:

View file

@ -17,7 +17,7 @@ flake-utils.lib.eachDefaultSystem
(kubenix.evalModules.${system} { (kubenix.evalModules.${system} {
specialArgs = { specialArgs = {
inherit namespace system self; inherit namespace system self;
inherit (inputs) nixhelm blog-pim dns nixpkgs nixng; inherit (inputs) nixhelm blog dns nixpkgs;
inherit (self) globals; inherit (self) globals;
utils = import ./utils.nix { utils = import ./utils.nix {

View file

@ -1,5 +1,5 @@
{ {
blog-pim, utils,
lib, lib,
config, config,
... ...
@ -17,7 +17,7 @@
spec = { spec = {
containers.blog = { containers.blog = {
image = "git.kun.is/home/blog-pim:${blog-pim.rev}"; image = utils.mkNixNGImage "blog";
ports.web.containerPort = 80; ports.web.containerPort = 80;
}; };
}; };

View file

@ -0,0 +1,44 @@
{
blog,
nginx,
system,
config,
lib,
pkgs,
...
}: let
nginxPort = "80";
nginxConf = pkgs.writeText "nginx.conf" ''
user nginx nginx;
daemon off;
error_log /dev/stderr;
pid /httpd.pid;
events {}
http {
access_log /dev/stdout;
include ${nginx.outPath}/conf/mime.types;
server {
listen ${nginxPort};
index index.html;
location / {
root ${blog.packages.${system}.static-website};
}
}
}
'';
in {
dinit.enable = true;
init.services.nginx = {
shutdownOnExit = true;
script = lib.mkForce (pkgs.writeShellScript "nginx-run" ''
HOME=~nginx ${config.services.nginx.package}/bin/nginx -c ${nginxConf}
'');
};
services.nginx = {
enable = true;
configuration = [];
};
}

View file

@ -2,6 +2,8 @@
self, self,
flake-utils, flake-utils,
nixng, nixng,
nginx,
blog,
nixpkgs, nixpkgs,
nixpkgs-jellyseerr, nixpkgs-jellyseerr,
nixpkgs-bazarr, nixpkgs-bazarr,
@ -18,6 +20,7 @@ flake-utils.lib.eachDefaultSystem (system: let
sonarr = ./sonarr.nix; sonarr = ./sonarr.nix;
bazarr = ./bazarr.nix; bazarr = ./bazarr.nix;
prowlarr = ./prowlarr.nix; prowlarr = ./prowlarr.nix;
blog = ./blog.nix;
}; };
in { in {
nixngConfigurations = builtins.mapAttrs (name: configFile: nixngConfigurations = builtins.mapAttrs (name: configFile:
@ -27,6 +30,7 @@ in {
config = import configFile; config = import configFile;
specialArgs = { specialArgs = {
inherit nginx blog;
inherit (self) globals; inherit (self) globals;
}; };