Module outline, should eventually be moved into flake.nix
This commit is contained in:
parent
277bafb535
commit
2c5e80b255
33
module.nix
Normal file
33
module.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ options, lib, config, pkgs, ... }:
|
||||
let
|
||||
serverName = "anish.lakhwara.com";
|
||||
webRoot = "/var/www/${serverName}";
|
||||
|
||||
serviceConfig = config.services."${serverName}";
|
||||
options = {
|
||||
enable = lib.mkEnableOption "${serverName} service";
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.${serverName} = options;
|
||||
config = lib.mkIf serviceConfig.enable {
|
||||
systemd.services."source-${serverName}" = {
|
||||
description = ''
|
||||
https://${serverName} source
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
startAt = "*:0/5";
|
||||
path = with pkgs; [ nix gnutar gzip curl jq ];
|
||||
script = ''
|
||||
set -ex
|
||||
|
||||
rev=$(curl https://git.sealight.xyz/repos/aynish/basant/git/ref/heads/main | jq -r .object.sha)
|
||||
result=$(nix-build https://git.sealight.xyz/aynish/basant/archive/$rev.tar.gz -A anish-lakhwara) # TODO: need to define this file
|
||||
|
||||
ln -sfT $result${webRoot} ${webRoot}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue