initial agola stuff

This commit is contained in:
Michael Zhang 2021-09-01 15:58:58 -05:00
parent 40d2cacb4e
commit 2f6cb1316b
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
6 changed files with 117 additions and 6 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

41
flake.lock Normal file
View file

@ -0,0 +1,41 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1630527283,
"narHash": "sha256-DD8FDMxndAgGD/yUHuwQypvgcqKSCB+gdwo+mXhc28c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "837d765221201227fa62bf7a77e94577e8dc00f7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,11 +1,23 @@
{ {
description = "A very basic flake"; description = "A very basic flake";
outputs = { self, nixpkgs }: { inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
defaultPackage.x86_64-linux = self.packages.x86_64-linux.hello; let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = rec {
agola = pkgs.callPackage ./pkgs/agola.nix {};
};
nixosModules = {
agola = import ./modules/agola.nix;
}; };
} }
);
}

20
modules/agola.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
with lib;
let
agola = pkgs.agola;
cfg = config.services.agola;
in
{
options.services.agola = {
enable = mkEnableOption "Enable agola server.";
};
config = lib.mkIf cfg.enable {
systemd.services.agola = {
script = ''
${agola}/bin/agola
'';
};
};
}

16
pkgs/agola.nix Normal file
View file

@ -0,0 +1,16 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.buildGoModule {
name = "agola";
vendorSha256 = "wjEr5zmcWEJJtH6d2OGPPX5CDJvj9xM8LKHBBmBvQj8=";
src = pkgs.fetchFromGitHub {
owner = "agola-io";
repo = "agola";
rev = "v0.6.0";
sha256 = "NIJEf1eMyx74REc84EYgLmwrP4bYCiyTdeb/8kR4cTM=";
};
# TODO: repeat this later on a computer with more resources...
doCheck = false;
}

21
test/nixops.nix Normal file
View file

@ -0,0 +1,21 @@
let
lib = import <nixpkgs/lib>;
in
{
machine = {
deployment.targetEnv = "virtualbox";
deployment.virtualbox.headless = true;
virtualisation.virtualbox.guest.enable = lib.mkForce false;
nixpkgs.overlays = [(self: super: {
agola = import ../pkgs/agola.nix { pkgs = super; };
})];
imports = [
(import ../modules/agola.nix)
];
services = {
agola.enable = true;
};
};
}