Add Odoo config

This commit is contained in:
Paul-Henri Froidmont 2024-09-20 03:55:11 +02:00
parent 22d5e09f3c
commit 0dd50bde59
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
6 changed files with 122 additions and 48 deletions

114
flake.nix
View file

@ -5,29 +5,41 @@
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
simple-nixos-mailserver.url =
"gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05";
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05";
foundryvtt.url = "github:reckenrode/nix-foundryvtt";
};
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, deploy-rs, sops-nix
, simple-nixos-mailserver, foundryvtt }:
outputs =
inputs@{
self,
nixpkgs,
nixpkgs-unstable,
deploy-rs,
sops-nix,
simple-nixos-mailserver,
foundryvtt,
}:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
pkgs-unstable = nixpkgs-unstable.legacyPackages.x86_64-linux;
defaultModuleArgs = { pkgs, ... }: {
_module.args.pkgs-unstable = import nixpkgs-unstable {
inherit (pkgs.stdenv.targetPlatform) system;
config.allowUnfreePredicate = pkg:
builtins.elem (pkgs.lib.getName pkg) [ "minecraft-server" ];
};
};
in {
devShells.x86_64-linux.default = pkgs.mkShell {
sopsPGPKeyDirs = [ "./keys/hosts" "./keys/users" ];
nativeBuildInputs =
[ (pkgs.callPackage sops-nix { }).sops-import-keys-hook ];
defaultModuleArgs =
{ pkgs, ... }:
{
_module.args.pkgs-unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ "minecraft-server" ];
};
};
in
{
devShells.x86_64-linux.default = pkgs.mkShell {
sopsPGPKeyDirs = [
"./keys/hosts"
"./keys/users"
];
nativeBuildInputs = [ (pkgs.callPackage sops-nix { }).sops-import-keys-hook ];
buildInputs = with pkgs-unstable; [
nixpkgs-fmt
@ -41,81 +53,87 @@
nixosConfigurations = {
db1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit nixpkgs; };
specialArgs = {
inherit nixpkgs;
};
modules = [
sops-nix.nixosModules.sops
./profiles/db.nix
({
{
sops.defaultSopsFile = ./secrets.enc.yml;
networking.hostName = "db1";
networking.domain = "banditlair.com";
nix.registry.nixpkgs.flake = nixpkgs;
system.stateVersion = "21.05";
})
}
];
};
backend1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit nixpkgs; };
specialArgs = {
inherit nixpkgs;
};
modules = [
defaultModuleArgs
sops-nix.nixosModules.sops
./profiles/backend.nix
({
{
sops.defaultSopsFile = ./secrets.enc.yml;
networking.hostName = "backend1";
networking.domain = "banditlair.com";
nix.registry.nixpkgs.flake = nixpkgs;
system.stateVersion = "21.05";
})
}
];
};
storage1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit nixpkgs inputs; };
specialArgs = {
inherit nixpkgs inputs;
};
modules = [
defaultModuleArgs
sops-nix.nixosModules.sops
simple-nixos-mailserver.nixosModule
foundryvtt.nixosModules.foundryvtt
./profiles/storage.nix
({
{
sops.defaultSopsFile = ./secrets.enc.yml;
networking.hostName = "storage1";
networking.domain = "banditlair.com";
nix.registry.nixpkgs.flake = nixpkgs;
system.stateVersion = "21.05";
})
}
];
};
};
deploy.nodes = let
createSystemProfile = configuration: {
user = "root";
sshUser = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos configuration;
deploy.nodes =
let
createSystemProfile = configuration: {
user = "root";
sshUser = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos configuration;
};
in
{
db1 = {
hostname = "db1.banditlair.com";
profiles.system = createSystemProfile self.nixosConfigurations.db1;
};
backend1 = {
hostname = "backend1.banditlair.com";
profiles.system = createSystemProfile self.nixosConfigurations.backend1;
};
storage1 = {
hostname = "78.46.96.243";
profiles.system = createSystemProfile self.nixosConfigurations.storage1;
};
};
in {
db1 = {
hostname = "db1.banditlair.com";
profiles.system = createSystemProfile self.nixosConfigurations.db1;
};
backend1 = {
hostname = "backend1.banditlair.com";
profiles.system =
createSystemProfile self.nixosConfigurations.backend1;
};
storage1 = {
hostname = "78.46.96.243";
profiles.system =
createSystemProfile self.nixosConfigurations.storage1;
};
};
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}