blob: 42ff254a29875d29339cc5aced736794e796bf29 (
plain)
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
|
{
description = "Witryna - Git-based static site deployment orchestrator";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
witryna = pkgs.rustPlatform.buildRustPackage {
pname = "witryna";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.installShellFiles pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ];
nativeCheckInputs = [ pkgs.git ];
postInstall = ''
installManPage man/witryna.1
installManPage man/witryna.toml.5
mkdir -p $out/share/doc/witryna/examples
cp -r examples/* $out/share/doc/witryna/examples/
cp README.md $out/share/doc/witryna/
'';
meta = with pkgs.lib; {
description = "Minimalist Git-based static site deployment orchestrator";
homepage = "https://git.craftknight.com/dawid/witryna";
license = licenses.mit;
mainProgram = "witryna";
};
};
default = self.packages.${system}.witryna;
}
);
nixosModules.witryna = import ./nix/module.nix self;
nixosModules.default = self.nixosModules.witryna;
# NixOS VM test - verifies the module works
checks.x86_64-linux.nixos-test = nixpkgs.legacyPackages.x86_64-linux.nixosTest {
name = "witryna";
nodes.machine = { pkgs, ... }: {
imports = [ self.nixosModules.witryna ];
environment.systemPackages = [ pkgs.podman ];
virtualisation.podman.enable = true;
services.witryna = {
enable = true;
configFile = pkgs.writeText "witryna.toml" ''
listen_address = "127.0.0.1:8080"
base_dir = "/var/lib/witryna"
log_dir = "/var/log/witryna"
log_level = "debug"
container_runtime = "podman"
'';
};
};
testScript = ''
machine.wait_for_unit("witryna.service")
machine.succeed("curl -sf http://127.0.0.1:8080/health")
'';
};
};
}
|