mirror of
https://github.com/sstent/vmimages.git
synced 2026-01-25 22:51:49 +00:00
fixing fitbit
This commit is contained in:
21
modules/nixos/mnt_public/default.nix
Normal file
21
modules/nixos/mnt_public/default.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
lib,
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.custom.mnt_public;
|
||||
in {
|
||||
options.custom.mnt_public.enable = mkEnableOption "Enable mnt/Public";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
fileSystems."/mnt/Public" = {
|
||||
device = "//192.168.1.109/Public";
|
||||
fsType = "cifs";
|
||||
# options = ["uid=0,gid=1000"];
|
||||
options = ["guest" "uid=1000"];
|
||||
};
|
||||
};
|
||||
}
|
||||
22
modules/nixos/ssh/default.nix
Normal file
22
modules/nixos/ssh/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.custom.sshd;
|
||||
in {
|
||||
#define option to enable this
|
||||
options.custom.sshd.enable = mkEnableOption "Enable SSH";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
permitRootLogin = "no";
|
||||
passwordAuthentication = false;
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [22];
|
||||
};
|
||||
}
|
||||
37
modules/nixos/syncthing/default.nix
Normal file
37
modules/nixos/syncthing/default.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
lib,
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.custom.syncthing;
|
||||
in {
|
||||
options.custom.syncthing.enable = mkEnableOption "Enable mnt/Public";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
dataDir = "/home/sstent";
|
||||
openDefaultPorts = true;
|
||||
configDir = "/home/sstent/.config/syncthing";
|
||||
user = "sstent";
|
||||
group = "users";
|
||||
guiAddress = "0.0.0.0:8385";
|
||||
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
devices = {
|
||||
"StuPC" = {id = "Z43MPGF-OKG6K34-WTTFUDO-UG6E3TE-YCLSOAT-5LN5KMW-QHL2VSK-EZCGCAP";};
|
||||
"go3" = {id = "YDOL433-AHAL33M-NWLLDDQ-2D36ZIE-YNZVTKE-25TRBZ2-JXRSN7Y-Z5EOVQN";};
|
||||
};
|
||||
folders = {
|
||||
"default" = {
|
||||
path = "/home/sstent/sync";
|
||||
devices = ["StuPC" "go3"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
38
modules/nixos/vpn/default.nix
Normal file
38
modules/nixos/vpn/default.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
secretstore = config._secretstore;
|
||||
host = config.networking.hostName;
|
||||
|
||||
cfg = config.custom.mullvad;
|
||||
|
||||
secret =
|
||||
if builtins.pathExists "${secretstore}/hosts/${host}/mullvad/device.json"
|
||||
then ./secrets.nix
|
||||
else {};
|
||||
in {
|
||||
#define option to enable this
|
||||
options.custom.mullvad.enable = mkEnableOption "Enable SSH";
|
||||
|
||||
# imports = [ secret ];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networking.wireguard.enable = true;
|
||||
services.mullvad-vpn.enable = true;
|
||||
|
||||
# set some options after every daemon start
|
||||
# to avoid accidentally leaving unsafe settings
|
||||
systemd.services."mullvad-daemon" = {
|
||||
postStart = ''
|
||||
while ! ${pkgs.mullvad}/bin/mullvad status >/dev/null; do sleep 1; done
|
||||
${pkgs.mullvad}/bin/mullvad lan set allow #enable local lan access
|
||||
${pkgs.mullvad}/bin/mullvad relay set tunnel-protocol wireguard
|
||||
${pkgs.mullvad}/bin/mullvad relay set location ca mtr
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/nixos/vpn/secrets.nix
Normal file
18
modules/nixos/vpn/secrets.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
secretstore = config._secretstore;
|
||||
host = config.networking.hostName;
|
||||
secretpath = "${secretstore}/hosts/${host}/mullvad/device.json";
|
||||
in {
|
||||
sops.secrets.device_json = {
|
||||
sopsFile = "${secretstore}/hosts/${host}/mullvad/device.json";
|
||||
device_json.format = "binary";
|
||||
};
|
||||
|
||||
environment.etc."mullvad-vpn/device.conf".source = config.sops.secrets.device_json.path;
|
||||
}
|
||||
57
modules/nixos/wsl2/default.nix
Normal file
57
modules/nixos/wsl2/default.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
lib,
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.custom.wsl;
|
||||
in {
|
||||
options.custom.wsl.enable = mkEnableOption "Enable WSL2 settings";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Enable native Docker support
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
wsl = {
|
||||
enable = true;
|
||||
wslConf.automount.root = "/mnt";
|
||||
defaultUser = "sstent";
|
||||
startMenuLaunchers = true;
|
||||
wslConf.interop.appendWindowsPath = false;
|
||||
#No longer needed in 23.05
|
||||
#interop.preserveArgvZero = true;
|
||||
# docker-native.enable = true;
|
||||
|
||||
nativeSystemd = true;
|
||||
# Enable integration with Docker Desktop (needs to be installed)
|
||||
# docker-desktop.enable = true;
|
||||
};
|
||||
|
||||
systemd.services.nixs-wsl-systemd-fix = {
|
||||
description = "Fix the /dev/shm symlink to be a mount";
|
||||
unitConfig = {
|
||||
DefaultDependencies = "no";
|
||||
Before = [
|
||||
"sysinit.target"
|
||||
"systemd-tmpfiles-setup-dev.service"
|
||||
"systemd-tmpfiles-setup.service"
|
||||
"systemd-sysctl.service"
|
||||
];
|
||||
ConditionPathExists = "/dev/shm";
|
||||
ConditionPathIsSymbolicLink = "/dev/shm";
|
||||
ConditionPathIsMountPoint = "/run/shm";
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = [
|
||||
"${pkgs.coreutils-full}/bin/rm /dev/shm"
|
||||
"/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm"
|
||||
];
|
||||
};
|
||||
wantedBy = ["sysinit.target"];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user