Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
pegasust | 1bab3a4d7f | |
pegasust | fab509b81a |
|
@ -0,0 +1,4 @@
|
|||
if command -v nix-shell &> /dev/null
|
||||
then
|
||||
use flake
|
||||
fi
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670064435,
|
||||
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
description = "My Hydra deployment for felia.cloud";
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-utils, ... }@my_inputs: flake-utils.lib.eachDefaultSystem (sys:
|
||||
let pkgs = import nixpkgs { system=sys; };
|
||||
in
|
||||
{
|
||||
devShells = import ./shell.nix { inherit pkgs; };
|
||||
}
|
||||
);
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
my-hydra =
|
||||
{ config
|
||||
, pkgs
|
||||
, keyFiles ? [
|
||||
../ssh/pi.pub
|
||||
../ssh/fel.pub
|
||||
../ssh/felia.pub
|
||||
../ssh/fel_ed.pub
|
||||
../ssh/hwtr-prince.pub
|
||||
../ssh/nixos_felia.pub
|
||||
]
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
host = "pixi";
|
||||
in
|
||||
{
|
||||
services.postfix = {
|
||||
enable = true;
|
||||
setSendmail = true;
|
||||
};
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql;
|
||||
identMap = ''
|
||||
hydra-users hydra hydra
|
||||
hydra-users hydra-queue-runner hydra
|
||||
hydra-users hydra-www hydra
|
||||
hydra-users root postgres
|
||||
hydra-users postgres postgres
|
||||
'';
|
||||
};
|
||||
services.hydra =
|
||||
let
|
||||
hydraUrl = "https://hydra.felia.cloud";
|
||||
hydraEmail = "hydra@felia.cloud";
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
# Whether to use binary cache to download store paths. Binary substitutions
|
||||
# HTTP requests that slow down queue monitor thread significantly. Don't
|
||||
# enable this feature unless active binary cache is absolutely trustworthy
|
||||
useSubstitutes = true;
|
||||
hydraURL = hydraUrl;
|
||||
notificationSender = hydraEmail;
|
||||
buildMachinesFiles = [ ];
|
||||
extraConfig = ''
|
||||
store_uri = file:///var/lib/hydra/cache?secret-key=/etc/nix/${host}/secret
|
||||
binary_cache_secret_key_file = /etc/nix/${host}/secret
|
||||
binary_cache_dir = /var/lib/hydra/cache
|
||||
'';
|
||||
};
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
virtualHosts."hydra.felia.cloud" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/".proxyPass = "http://localhost:3000";
|
||||
};
|
||||
};
|
||||
systemd.services.hydra-manual-setup = {
|
||||
description = "Create Admin User for Hydra";
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.RemainAfterExit = true;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ "hydra-init.service" ];
|
||||
after = [ "hydra-init.service" ];
|
||||
environment = builtins.removeAttrs (config.systemd.services.hydra-init.environment) [ "PATH" ];
|
||||
scripts = ''
|
||||
if [ ! -e ~hydra/.setup-is-complete ]; then
|
||||
# create signing keys
|
||||
/run/current-system/sw/bin/install -d -m 551 /etc/nix/${host}
|
||||
/run/current-system/sw/bin/nix-store --generate-binary-cache-key ${host} /etc/nix/${host}/secret /etc/nix/${host}/public
|
||||
/run/current-system/sw/bin/chown -R hydra:hydra /etc/nix/${host}
|
||||
/run/current-system/sw/bin/chmod 440 /etc/nix/${host}/secret
|
||||
/run/current-system/sw/bin/chmod 444 /etc/nix/${host}/public
|
||||
# create cache
|
||||
/run/current-system/sw/bin/install -d -m 755 /var/lib/hydra/cache
|
||||
/run/current-system/sw/bin/chown -R hydra-queue-runner:hydra /var/lib/hydra/cache
|
||||
# done
|
||||
touch ~hydra/.setup-is-complete
|
||||
fi
|
||||
'';
|
||||
};
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
# garbage collect every day at 3:15 AM, local time
|
||||
dates = "15 3 * * *";
|
||||
};
|
||||
nix.autoOptimiseStore = true;
|
||||
nix.trustedUsers = [ "hydra" "hydra-evaluator" "hydra-queue-runner" ];
|
||||
nix.buildMachines = [
|
||||
{
|
||||
hostName = "localhost";
|
||||
systems = [ "x86_64-linux" "i686-linux" ];
|
||||
maxJobs = 6;
|
||||
# for building VirtualBox VMs as build artifacts, you might need other
|
||||
# features depending on what you are doing
|
||||
supportedFeatures = [ ];
|
||||
}
|
||||
];
|
||||
networking.firewall.allowedTCPPorts = [ config.services.hydra.port ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
my-hydra =
|
||||
{ config
|
||||
, pkgs
|
||||
, keyFiles ? [
|
||||
../ssh/pi.pub
|
||||
../ssh/fel.pub
|
||||
../ssh/felia.pub
|
||||
../ssh/fel_ed.pub
|
||||
../ssh/hwtr-prince.pub
|
||||
../ssh/nixos_felia.pub
|
||||
]
|
||||
, ...
|
||||
}: {
|
||||
deployment.targetEnv = "virtualbox";
|
||||
deployment.virtualbox = {
|
||||
memorySize = 2048;
|
||||
vcpu = 1;
|
||||
headless = true;
|
||||
};
|
||||
services.nixosManual.showManual = false;
|
||||
services.ntp.enable = true; # time daemon
|
||||
services.openssh.allowSFTP = false;
|
||||
services.openssh.passwordAuthentication = false;
|
||||
users = {
|
||||
mutableUsers = false; # frozen user config
|
||||
users.root.openssh.authorizedKeys.keyFiles = keyFiles;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{ pkgs ? import <nixpkgs> { }
|
||||
}:
|
||||
let shellHookAfter = ''
|
||||
echo "Welcome to Felia\'s Hydra setup"
|
||||
echo "TODO: Actually write a MOTD here LOL"
|
||||
''; in
|
||||
rec {
|
||||
nixops = pkgs.mkShell {
|
||||
nativeBuildInputs = [ pkgs.nixops_unstable ];
|
||||
shellHook = ''
|
||||
echo "profile: nixops"
|
||||
''+shellHookAfter;
|
||||
};
|
||||
default = nixops;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgmng5xL/auvI2F8ufFAfId2Ey55ONHjgnKKSEWLVWkPMutXT3BCnSglNAuEVRLX2zfzg3beQd80AHTow+qro5QWI/rYfeL1QPNEwoThbRFcvtWLTlgzBGA4ejjpIF9sCPNp0sXrrQRfxRP7w4b23BcRJQcsDoaEtKGKJZ2GQIoOafkYypwcunANb54EAouZTfHEPKDr26Gfw8usc2Sae32G/80QLBF2jGabyexJjNE3F6hdJTwq5iiqIVdSr4ue82zo3M8jBdtCMDGaOliI5RWSa9iuX9o2scCGDU69G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name $0))"
|
||||
PROJ_ROOT="${SCRIPT_DIR}/.."
|
||||
|
||||
# create a deployment of simple_hydra
|
||||
nixops create ${PROJ_ROOT}/infra/{vbox,simple_hydra}.nix -d simple_hydra
|
||||
|
||||
nixops info -d simple_hydra
|
||||
|
Loading…
Reference in New Issue