This commit is contained in:
Pim Kunis 2024-04-26 15:15:05 +02:00
commit 36c22e9a36
4 changed files with 203 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

47
blog-pim.nix Normal file
View file

@ -0,0 +1,47 @@
{ nixpkgs, flutils, blog-pim, nginx, ... }: flutils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
nginxPort = "80";
nginxConf = pkgs.writeText "nginx.conf" ''
user nobody nobody;
daemon off;
error_log /dev/stdout info;
pid /dev/null;
events {}
http {
access_log /dev/stdout;
include ${nginx.outPath}/conf/mime.types;
server {
listen ${nginxPort};
index index.html;
location / {
root ${blog-pim.packages.${system}.static-website};
}
}
}
'';
in
{
packages.blog-pim = pkgs.dockerTools.buildLayeredImage {
name = "blog-pim";
tag = "test"; # TODO: what is the best way to tag this?
contents = [
pkgs.fakeNss
pkgs.nginx
];
extraCommands = ''
mkdir -p tmp/nginx_client_body
mkdir -p var/log/nginx
'';
config = {
Cmd = [ "nginx" "-c" nginxConf ];
ExposedPorts = {
"${nginxPort}/tcp" = { };
};
};
};
})

133
flake.lock Normal file
View file

@ -0,0 +1,133 @@
{
"nodes": {
"blog-pim": {
"inputs": {
"flutils": "flutils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1714137143,
"narHash": "sha256-LMZjGiacgn0R9zuuolU+XJZsx1hkX5p9gs+d7B0YQCc=",
"ref": "refs/heads/master",
"rev": "77d432ad8b0e16213b29bbb58e3d73aef0512ee9",
"revCount": 3,
"type": "git",
"url": "https://git.kun.is/home/blog-pim"
},
"original": {
"type": "git",
"url": "https://git.kun.is/home/blog-pim"
}
},
"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"
}
},
"flutils_2": {
"inputs": {
"systems": "systems_2"
},
"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"
}
},
"nginx": {
"flake": false,
"locked": {
"lastModified": 1713277799,
"narHash": "sha256-VNDzQvUGeh54F3s6SIq6lBrp4RatURzJoJqVorexttA=",
"owner": "nginx",
"repo": "nginx",
"rev": "d8a849ae3c99ee5ca82c9a06074761e937dac6d6",
"type": "github"
},
"original": {
"owner": "nginx",
"repo": "nginx",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1714076141,
"narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"blog-pim": "blog-pim",
"flutils": "flutils_2",
"nginx": "nginx",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

22
flake.nix Normal file
View file

@ -0,0 +1,22 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flutils.url = "github:numtide/flake-utils";
nginx = {
url = "github:nginx/nginx";
flake = false;
};
blog-pim = {
url = "git+https://git.kun.is/home/blog-pim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { flutils, ... }@inputs: flutils.lib.meld inputs [
./blog-pim.nix
];
}