jakstpub: open up http

This commit is contained in:
Motiejus Jakštys 2023-09-17 22:12:46 +03:00
parent a3e8903669
commit f38fd993d3
2 changed files with 81 additions and 68 deletions

View File

@ -105,17 +105,17 @@ in {
home-manager.users.motiejus = {pkgs, ...}: { home-manager.users.motiejus = {pkgs, ...}: {
programs.autorandr.profiles = { programs.autorandr.profiles = {
laptop = { laptop = {
fingerprint = { inherit (randr) eDP-1; }; fingerprint = {inherit (randr) eDP-1;};
config = { config = {
eDP-1 = { eDP-1 = {
enable = true; enable = true;
primary = true; primary = true;
mode = "2256x1504"; mode = "2256x1504";
crtc = 0; crtc = 0;
};
}; };
}; };
};
dualhome = { dualhome = {
fingerprint = {inherit (randr) eDP-1 DP-3 DP-4;}; fingerprint = {inherit (randr) eDP-1 DP-3 DP-4;};

View File

@ -4,7 +4,10 @@
pkgs, pkgs,
myData, myData,
... ...
}: { }: let
cfg = config.mj.services.jakstpub;
subnets = myData.subnets;
in {
options.mj.services.jakstpub = with lib.types; { options.mj.services.jakstpub = with lib.types; {
enable = lib.mkEnableOption "Enable jakstpub"; enable = lib.mkEnableOption "Enable jakstpub";
dataDir = lib.mkOption {type = path;}; dataDir = lib.mkOption {type = path;};
@ -14,65 +17,75 @@
hostname = lib.mkOption {type = str;}; hostname = lib.mkOption {type = str;};
}; };
config = with config.mj.services.jakstpub; config = lib.mkIf cfg.enable {
lib.mkIf enable { services.caddy = {
services.samba = { enable = true;
# https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server virtualHosts.":80".extraConfig = ''
enable = true; root * ${cfg.dataDir}
securityType = "user"; @denied not remote_ip ${subnets.vno1.cidr} ${subnets.vno3.cidr} ${subnets.tailscale.cidr}
enableNmbd = false; file_server browse {}
enableWinbindd = false; encode gzip
extraConfig = '' '';
map to guest = Bad User };
guest account = jakstpub
server role = standalone server services.samba = {
''; # https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server
shares = { enable = true;
public = { securityType = "user";
path = dataDir; enableNmbd = false;
writeable = "yes"; enableWinbindd = false;
public = "yes"; extraConfig = ''
"guest ok" = "yes"; map to guest = Bad User
"read only" = "no"; guest account = jakstpub
"create mask" = "0664"; server role = standalone server
"directory mask" = "0775"; '';
"force user" = "jakstpub"; shares = {
"force group" = "jakstpub"; public = {
}; path = cfg.dataDir;
writeable = "yes";
public = "yes";
"guest ok" = "yes";
"read only" = "no";
"create mask" = "0664";
"directory mask" = "0775";
"force user" = "jakstpub";
"force group" = "jakstpub";
}; };
}; };
services.samba-wsdd = {
enable = true;
hostname = hostname;
};
users.users.jakstpub = {
description = "Jakstys Public";
home = "/var/empty";
useDefaultShell = true;
group = "jakstpub";
isSystemUser = true;
createHome = false;
uid = uidgid;
};
users.groups.jakstpub.gid = uidgid;
systemd.services.samba-smbd = {
unitConfig.Requires = requires;
};
mj.services.friendlyport.ports = [
{
subnets = with myData.subnets; [tailscale.cidr vno1.cidr vno3.cidr];
tcp = [
139 # smbd
445 # smbd
5357 # wsdd
];
udp = [3702]; # wsdd
}
];
}; };
services.samba-wsdd = {
enable = true;
hostname = cfg.hostname;
};
users.users.jakstpub = {
description = "Jakstys Public";
home = "/var/empty";
useDefaultShell = true;
group = "jakstpub";
isSystemUser = true;
createHome = false;
uid = cfg.uidgid;
};
users.groups.jakstpub.gid = cfg.uidgid;
systemd.services.samba-smbd = {
unitConfig.Requires = cfg.requires;
};
mj.services.friendlyport.ports = [
{
subnets = with myData.subnets; [tailscale.cidr vno1.cidr vno3.cidr];
tcp = [
80 # caddy above
139 # smbd
445 # smbd
5357 # wsdd
];
udp = [3702]; # wsdd
}
];
};
} }