diff --git a/flake.nix b/flake.nix index 095cf3f..105f09c 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,7 @@ }; outputs = - { self, nixpkgs, deploy-rs, vault-secrets, serokell-nix, ... }@inputs: + { self, nixpkgs, deploy-rs, vault-secrets, serokell-nix, minecraft-servers, ... }@inputs: let inherit (nixpkgs) lib; inherit (builtins) filter mapAttrs; @@ -83,8 +83,37 @@ in { # Make the config and deploy sets - nixosConfigurations = lib.foldr (el: acc: acc // mkConfig el) { } nixHosts; - deploy.nodes = lib.foldr (el: acc: acc // mkDeploy el) { } nixHosts; + # nixosConfigurations = lib.foldr (el: acc: acc // mkConfig el) { } nixHosts; + # deploy.nodes = lib.foldr (el: acc: acc // mkDeploy el) { } nixHosts; + + colmena = { + meta = { + nixpkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ + (import ./nixos/pkgs) + minecraft-servers.overlays.default + ]; + specialArgs = { + inherit hosts; + }; + }; + }; + + minecraft = { + imports = [ + vault-secrets.nixosModules.vault-secrets + ./nixos/common + "${./.}/nixos/hosts/minecraft/configuration.nix" + "${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix" + ./nixos/common/generic-lxc.nix + ]; + deployment = { + targetHost = "10.42.42.21"; + targetUser = "victor"; + }; + }; + }; apps.${system} = rec { @@ -114,6 +143,7 @@ # This only support bash so just execute zsh in bash as a workaround :/ shellHook = "zsh; exit $?"; buildInputs = with pkgs; [ + colmena deploy-rs.packages.${system}.deploy-rs fluxcd k9s diff --git a/hosts.nix b/hosts.nix index 02fb68f..4b3a9a5 100644 --- a/hosts.nix +++ b/hosts.nix @@ -97,7 +97,6 @@ hostname = "minecraft"; ip = "10.42.42.21"; mac = "EA:30:73:E4:B6:69"; - nix = false; } { hostname = "gitea"; diff --git a/nixos/common/default.nix b/nixos/common/default.nix index 7ce3305..a17e5fd 100644 --- a/nixos/common/default.nix +++ b/nixos/common/default.nix @@ -1,8 +1,7 @@ -{ config, inputs, pkgs, ... }: +{ config, pkgs, ... }: { imports = [ - inputs.vault-secrets.nixosModules.vault-secrets # User account definitions ./users ./services @@ -37,10 +36,6 @@ }; nixpkgs.config.allowUnfree = true; - nixpkgs.overlays = [ - (import ../pkgs) - inputs.minecraft-servers.overlays.default - ]; # Limit the systemd journal to 100 MB of disk or the # last 7 days of logs, whichever happens first. diff --git a/nixos/hosts/bastion/configuration.nix b/nixos/hosts/bastion/configuration.nix index c26cc8f..8a2309f 100644 --- a/nixos/hosts/bastion/configuration.nix +++ b/nixos/hosts/bastion/configuration.nix @@ -45,7 +45,7 @@ in { # Additional packages environment.systemPackages = with pkgs; [ binutils - checkov + colmena fix-vscode fluxcd k9s diff --git a/nixos/hosts/minecraft/configuration.nix b/nixos/hosts/minecraft/configuration.nix index 1b0bba5..3b5fcf6 100644 --- a/nixos/hosts/minecraft/configuration.nix +++ b/nixos/hosts/minecraft/configuration.nix @@ -24,7 +24,7 @@ networking.firewall.allowedTCPPorts = [ ]; services.minecraft-server = { - enable = true; + enable = false; package = pkgs.minecraftServers.purpur_1_18; jvmOpts = "--add-modules=jdk.incubator.vector -Xmx2048M -Xms2048M";