Setup laminar
This commit is contained in:
parent
ee874ff44d
commit
6a204a60fd
|
@ -19,7 +19,7 @@ in {
|
|||
../../roles/matrix-synapse.nix
|
||||
../../roles/coturn.nix
|
||||
../../roles/go-neb.nix
|
||||
../../roles/laminar.nix
|
||||
../../roles/laminar
|
||||
./web.nix
|
||||
./mail.nix
|
||||
./boot.nix
|
||||
|
|
|
@ -9,7 +9,7 @@ let
|
|||
];
|
||||
post-update = pkgs.writeHaskellScript {
|
||||
name = "post-update";
|
||||
bins = [ pkgs.git ];
|
||||
bins = [ pkgs.git pkgs.laminar ];
|
||||
imports = [
|
||||
"System.Environment (lookupEnv)"
|
||||
"System.Directory (withCurrentDirectory)"
|
||||
|
@ -26,6 +26,10 @@ let
|
|||
whenJust mirrorMay $ \mirror -> do
|
||||
say [i|Force pushing all branches to #{mirror}|]
|
||||
git "push" "--all" "-f" mirror
|
||||
jobMay <- lookupEnv "GL_OPTION_CI_JOB"
|
||||
whenJust jobMay $ \job -> do
|
||||
say "Queuing job:"
|
||||
laminarc "queue" job
|
||||
deployMay <- lookupEnv "GL_OPTION_WEB_DEPLOY"
|
||||
whenJust deployMay $ \deploy -> do
|
||||
(maybe [] (\x -> ["-A", x]) -> target) <- lookupEnv "GL_OPTION_WEB_DEPLOY_NIX_TARGET"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
laminarPkgs = builtins.fetchGit {
|
||||
url = "https://github.com/maralorn/nixpkgs.git";
|
||||
rev = "e37cd38effca0310cfe4d27583102175b4a456c9";
|
||||
};
|
||||
in { systemd.packages = [ laminarPkgs.laminar ]; }
|
57
nixos/roles/laminar/default.nix
Normal file
57
nixos/roles/laminar/default.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
types = lib.types;
|
||||
stateDir = "/var/lib/laminar";
|
||||
jobsDir = "${stateDir}/cfg/jobs";
|
||||
cfg = config.services.laminar;
|
||||
in {
|
||||
options = {
|
||||
services.laminar.jobs = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.path;
|
||||
default = { };
|
||||
description = ''
|
||||
CI jobs statically known to laminar.
|
||||
Every attribute will be copied to /var/lib/laminar/cfg/jobs/<name>
|
||||
'';
|
||||
};
|
||||
};
|
||||
imports = [./kassandra.nix ];
|
||||
config = {
|
||||
users = {
|
||||
groups.laminar = { };
|
||||
users.laminar = {
|
||||
group = "laminar";
|
||||
home = stateDir;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = [ pkgs.laminar ];
|
||||
systemd.services.laminar = {
|
||||
enable = true;
|
||||
description = "Laminar continuous integration service";
|
||||
serviceConfig = {
|
||||
WorkingDirectory = stateDir;
|
||||
ExecStart = "${pkgs.laminar}/bin/laminard";
|
||||
DynamicUser = false;
|
||||
User = "laminar";
|
||||
StateDirectory = "laminar";
|
||||
};
|
||||
after = [ "network.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${jobsDir}
|
||||
${lib.concatStrings (lib.mapAttrsToList (key: value: ''
|
||||
ln -sf ${value} ${jobsDir}/${key}
|
||||
'') cfg.jobs)}'';
|
||||
};
|
||||
services = {
|
||||
nginx = {
|
||||
virtualHosts = {
|
||||
"ci.maralorn.de" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/".proxyPass = "http://[::1]:8080";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
35
nixos/roles/laminar/kassandra.nix
Normal file
35
nixos/roles/laminar/kassandra.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
path = [ pkgs.git pkgs.nix pkgs.gnutar pkgs.gzip pkgs.openssh pkgs.laminar ];
|
||||
setup = ''
|
||||
set -ex
|
||||
export PATH=${lib.makeBinPath path}:$PATH
|
||||
'';
|
||||
target = name: ''
|
||||
${setup}
|
||||
export HOME=$PWD
|
||||
git clone git@localhost:kassandra2 kassandra
|
||||
nix-build --no-out-link kassandra/release.nix -A ${name}
|
||||
'';
|
||||
in {
|
||||
services.laminar.jobs = {
|
||||
"kassandra.run" = pkgs.writeShellScript "kassandra" ''
|
||||
${setup}
|
||||
laminarc run kassandra-lib &
|
||||
P1=$!
|
||||
laminarc run kassandra-android &
|
||||
P2=$!
|
||||
laminarc run kassandra-app &
|
||||
P3=$!
|
||||
laminarc run kassandra-server &
|
||||
P4=$!
|
||||
wait $P1 $P2 $P3 $P4
|
||||
'';
|
||||
"kassandra-lib.run" = pkgs.writeShellScript "kassandra-lib" (target "lib");
|
||||
"kassandra-app.run" = pkgs.writeShellScript "kassandra-app" (target "app");
|
||||
"kassandra-android.run" =
|
||||
pkgs.writeShellScript "kassandra-android" (target "android");
|
||||
"kassandra-server.run" =
|
||||
pkgs.writeShellScript "kassandra-server" (target "server");
|
||||
};
|
||||
}
|
|
@ -1,2 +1,8 @@
|
|||
self: super:
|
||||
{}
|
||||
let
|
||||
laminarPkgs = import (builtins.fetchGit {
|
||||
url = "https://github.com/maralorn/nixpkgs.git";
|
||||
rev = "e37cd38effca0310cfe4d27583102175b4a456c9";
|
||||
ref = "laminar";
|
||||
}) { };
|
||||
in { laminar = laminarPkgs.laminar; }
|
||||
|
|
Loading…
Reference in a new issue