add cyberchef and correct things in nixos containers
This commit is contained in:
parent
325a193a38
commit
9037f01470
@ -20,6 +20,21 @@
|
|||||||
hyprland.enable = true;
|
hyprland.enable = true;
|
||||||
kde.enable = true;
|
kde.enable = true;
|
||||||
docker.enable = true;
|
docker.enable = true;
|
||||||
|
containers = {
|
||||||
|
nixos = {
|
||||||
|
};
|
||||||
|
docker = {
|
||||||
|
cyberchef = {
|
||||||
|
enable = true;
|
||||||
|
port = 6900;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
networking = {
|
||||||
|
bridge = "br0";
|
||||||
|
dns = [ "192.168.1.202" ];
|
||||||
|
gateway = "192.168.1.254";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
|||||||
@ -15,7 +15,13 @@
|
|||||||
|
|
||||||
smayzy = {
|
smayzy = {
|
||||||
server.enable = true;
|
server.enable = true;
|
||||||
containers.nixos= {
|
containers = {
|
||||||
|
networking = {
|
||||||
|
bridge = "br0";
|
||||||
|
dns = [ "192.168.1.202" ];
|
||||||
|
gateway = "192.168.1.254";
|
||||||
|
};
|
||||||
|
nixos = {
|
||||||
httpd = {
|
httpd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
bridge = "br0";
|
bridge = "br0";
|
||||||
@ -27,6 +33,13 @@
|
|||||||
ip = "192.168.1.202/24";
|
ip = "192.168.1.202/24";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
docker = {
|
||||||
|
cyberchef = {
|
||||||
|
enable = true;
|
||||||
|
port = 6900;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./nixos
|
./nixos
|
||||||
|
./nixos.nix
|
||||||
|
./docker
|
||||||
./docker.nix
|
./docker.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
27
modules/nix/containers/docker/cyberchef.nix
Normal file
27
modules/nix/containers/docker/cyberchef.nix
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) mkIf mkOption types;
|
||||||
|
cfg = config.smayzy.containers.docker.cyberchef;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.smayzy.containers.docker.cyberchef = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "cyberchef docker ct";
|
||||||
|
};
|
||||||
|
port = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 80;
|
||||||
|
description = "cyberchef's port";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
cyberchef = {
|
||||||
|
image = "ghcr.io/gchq/cyberchef";
|
||||||
|
ports = [ "${toString cfg.port}:80" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/nix/containers/docker/default.nix
Normal file
6
modules/nix/containers/docker/default.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./cyberchef.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
23
modules/nix/containers/nixos.nix
Normal file
23
modules/nix/containers/nixos.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption types;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.smayzy.containers.networking = {
|
||||||
|
bridge = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "the bridge to use e.g. (br0)";
|
||||||
|
};
|
||||||
|
dns = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "the dns servers to use e.g. [ 1.1.1.1 8.8.8.8 ]";
|
||||||
|
};
|
||||||
|
gateway = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "the gateway to use e.g. (10.10.10.255)";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) mkIf mkOption types;
|
inherit (lib) mkIf mkOption types;
|
||||||
cfg = config.smayzy.containers.nixos.httpd;
|
cfg = config.smayzy.containers.nixos.httpd;
|
||||||
|
net = config.smayzy.containers.networking;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.smayzy.containers.nixos.httpd = {
|
options.smayzy.containers.nixos.httpd = {
|
||||||
@ -32,6 +33,8 @@ in
|
|||||||
services.httpd = {
|
services.httpd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
networking.defaultGateway = net.gateway;
|
||||||
|
networking.nameservers = net.dns;
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) mkIf mkOption types;
|
inherit (lib) mkIf mkOption types;
|
||||||
cfg = config.smayzy.containers.nixos.unbound;
|
cfg = config.smayzy.containers.nixos.unbound;
|
||||||
|
net = config.smayzy.containers.networking;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.smayzy.containers.nixos.unbound = {
|
options.smayzy.containers.nixos.unbound = {
|
||||||
@ -61,6 +62,8 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
networking.defaultGateway = net.gateway;
|
||||||
|
networking.nameservers = net.dns;
|
||||||
networking.firewall.allowedTCPPorts = [ 53 ];
|
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||||
networking.firewall.allowedUDPPorts = [ 53 ];
|
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user