add syncthing and keepass
This commit is contained in:
parent
bb9494227f
commit
4a800d9290
14 changed files with 183 additions and 80 deletions
9
modules/nixOS/bundles/core/default.nix
Normal file
9
modules/nixOS/bundles/core/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# ./sops.nix
|
||||
];
|
||||
}
|
||||
37
modules/nixOS/bundles/core/sops.nix
Normal file
37
modules/nixOS/bundles/core/sops.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
secretsFile = "../../../../secrets/secrets.json";
|
||||
secretsSet = builtins.fromJSON (builtins.readFile ./${secretsFile});
|
||||
devices = builtins.attrNames secretsSet.syncthing.devices;
|
||||
in {
|
||||
imports = [
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
];
|
||||
|
||||
sops = {
|
||||
defaultSopsFile = ./${secretsFile};
|
||||
validateSopsFiles = false;
|
||||
|
||||
age = {
|
||||
# automatically import host SSH keys as age keys
|
||||
sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
# this will use an age key that is expected to already be in the filesystem
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
# generate a new key if the key specified above does not exist
|
||||
generateKey = true;
|
||||
};
|
||||
|
||||
# secrets will be output to /run/secrets
|
||||
secrets = {
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
sops
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -68,4 +68,8 @@
|
|||
serif = ["JetBrainsMono Nerd Font"];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
keepassxc
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@
|
|||
(helperLib.filesIn ./bundles);
|
||||
|
||||
# taking all module services in ./services and adding service.enables to them
|
||||
# services =
|
||||
# helperLib.extendModules
|
||||
# (name: {
|
||||
# extraOptions = {
|
||||
# myNixOS.services.${name}.enable = lib.mkEnableOption "enable ${name} module service";
|
||||
# };
|
||||
#
|
||||
# configExtension = config: (lib.mkIf cfg.services.${name}.enable config);
|
||||
# })
|
||||
# (helperLib.filesIn ./services);
|
||||
services =
|
||||
helperLib.extendModules
|
||||
(name: {
|
||||
extraOptions = {
|
||||
myNixOS.services.${name}.enable = lib.mkEnableOption "enable ${name} module service";
|
||||
};
|
||||
|
||||
configExtension = config: (lib.mkIf cfg.services.${name}.enable config);
|
||||
})
|
||||
(helperLib.filesIn ./services);
|
||||
in {
|
||||
imports =
|
||||
[
|
||||
|
|
@ -51,7 +51,7 @@ in {
|
|||
]
|
||||
++ features
|
||||
++ bundles
|
||||
# ++ services
|
||||
++ services
|
||||
;
|
||||
|
||||
options.myNixOS = {
|
||||
|
|
|
|||
56
modules/nixOS/services/syncthing/default.nix
Normal file
56
modules/nixOS/services/syncthing/default.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
webGuiPort = [ 8384 ];
|
||||
cfg = config;
|
||||
secretsFile = "../../../secrets/secrets.json";
|
||||
secretsSet = builtins.fromJSON (builtins.readFile ./${secretsFile});
|
||||
devices = builtins.attrNames secretsSet.syncthing.devices;
|
||||
in {
|
||||
options = {
|
||||
rootDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/home/${cfg.myNixOS.sharedSettings.mainUser}/sync";
|
||||
};
|
||||
|
||||
remoteGui = lib.mkEnableOption "Enable port for remote WebGUI";
|
||||
};
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
user = cfg.myNixOS.sharedSettings.mainUser;
|
||||
dataDir = config.rootDir;
|
||||
configDir = "/home/${cfg.myNixOS.sharedSettings.mainUser}/.config/syncthing";
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
settings = {
|
||||
devices = {
|
||||
"saintAlphonso" = { id ="LHASNUO-CXALARH-XI3TU4U-OCULV72-HS3HQ35-P4FECIT-UZ5VMSZ-PMCEPQH"; };
|
||||
"littleUmbrella" = { id ="BH3OHYP-TGGOSZO-EM6MXRY-YHSBOUO-CQHE7DL-N2LOUFY-TF3LEJ7-FHTGTQI"; };
|
||||
"pixelRoot" = { id ="PO7U5SE-DYKTOM2-TFDS3BM-A25VK7V-MQ3VPFM-EFX3J4D-B3UDCX4-3XQAIAC"; };
|
||||
"pixelDefault" = { id ="HC3CKC7-OUZBLU3-JIKTRYG-DPJE6EC-7POCWNS-6VNOPDU-L7OWYWO-PL332AY"; };
|
||||
"pixelGooglor" = { id ="OWDM4I2-O6STMIS-H3EXF65-FSM26K3-5FLQXRN-VOK7JGC-T6H76IR-QAVO3QK"; };
|
||||
};
|
||||
|
||||
folders = {
|
||||
"/home/${cfg.myNixOS.sharedSettings.mainUser}/KeepassXC" = {
|
||||
label = "KeepassXC";
|
||||
id = "xd4de-mjfcq";
|
||||
devices = ["littleUmbrella" "pixelRoot" "pixelDefault" "pixelGooglor" "saintAlphonso"];
|
||||
versioning = { type = "simple"; params.keep = "5"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Syncthing ports: 8384 for remote access to GUI
|
||||
# 22000 TCP and/or UDP for sync traffic
|
||||
# 21027/UDP for discovery
|
||||
# source: https://docs.syncthing.net/users/firewall.html
|
||||
networking.firewall.allowedTCPPorts = [ 8384 22000 ];
|
||||
networking.firewall.allowedUDPPorts = [ 22000 21027 ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue