Skip to content

Commit

Permalink
feat(chaotic-v4): add back restart script
Browse files Browse the repository at this point in the history
  • Loading branch information
dr460nf1r3 committed Jan 19, 2025
1 parent bf8cbf2 commit 9c7a380
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
pre-commit-hooks.inputs.flake-compat.follows = "flake-compat";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.inputs.nixpkgs-stable.follows = "nixpkgs-stable";

# SSH keys of maintainers
keys_nico.url = "https://github.com/dr460nf1r3.keys";
Expand Down
13 changes: 13 additions & 0 deletions nixos/hosts/chaotic-v4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
, pkgs
, ...
}:
let
wrapperScript = pkgs.writeScriptBin "chaotic-restart" ''
echo "Restarting Chaotic-AUR containers..."
systemctl restart docker-compose-runner-chaotic-v4.service
echo "Done."
'';
in
{
imports = sources.defaultModules ++ [ ../modules "${sources.chaotic-portable-builder}/nix/nixos.nix" ];

Expand All @@ -24,6 +31,12 @@
source = ../../docker-compose/chaotic-v4;
};

# Allow controlling infra 4.0's containers without root
environment.systemPackages = [ wrapperScript ];
security.sudo.extraRules = [
{ users = [ "xiota" ]; commands = [{ command = "${wrapperScript}/bin/chaotic-restart"; options = [ "NOPASSWD" ]; }]; }
];

# Lock down chaotic-op group to SCP in landing zone
services.openssh.extraConfig = ''
Match Group chaotic-op
Expand Down

0 comments on commit 9c7a380

Please sign in to comment.