Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
};

outputs =
inputs:
inputs@{ self, ... }:
inputs.parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = with inputs; [
Expand Down Expand Up @@ -118,5 +118,55 @@
'';
});
};

flake.nixosConfigurations.vpod =
{ config, ... }:
inputs.nixpkgs.lib.nixosSystem (
let
inherit (inputs.nixpkgs) lib;

getHostFQDN =
nixosConfig:
let
toplevelStorePath = nixosConfig.config.system.build.toplevel.drvPath;
fileName = lib.elemAt (lib.splitString "/" toplevelStorePath) 3;
hash = lib.elemAt (lib.splitString "-" fileName) 0;
in
"${hash}.hash.garnix.me";
system = "x86_64-linux";
in
{
inherit system;

# required for garnix deploy
fileSystems."/" = {
device = "/dev/sda1";
fsType = "ext4";
};
boot.loader.grub.device = "/dev/sda";

systemd.services.vpod = {
description = "vpod";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
environment = {
EPISODE_URL = "http://${getHostFQDN self.nixosConfigurations.vpod}";
VERBOSITY = 2;
};
serviceConfig = {
Type = "simple";
User = "root";
ExecStart = "${config.packages.${system}.vpod}/bin/vpod";
};
};
services.nginx = {
enable = true;
virtualHosts."_".locations."/".proxyPass = "http://localhost:8080";
};

security.sudo.enable = false;
environment.defaultPackages = lib.mkForce [ ];
}
);
};
}
8 changes: 8 additions & 0 deletions garnix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ builds:
- '*.x86_64-linux.*'
- 'packages.aarch64-darwin.*'
- 'devShell.aarch64-darwin.*'
servers:
- configuration: vpod
deployment:
type: on-branch
branch: main
- configuration: vpod
deployment:
type: on-pull-request