summaryrefslogtreecommitdiff
path: root/home-modules
diff options
context:
space:
mode:
authorJakub Stachurski <j.stachurski@student.utwente.nl>2025-11-05 01:29:41 +0100
committerJakub Stachurski <j.stachurski@student.utwente.nl>2025-11-05 21:23:19 +0100
commit72a532244594a370f597babf700fb013123d8c17 (patch)
tree0cdfcd4dea9cf3696c4f5c131c0e15283a328e43 /home-modules
parent466adabc7229bda8119fa27820ceea659979b3f5 (diff)
Secrets via nixos-sops, caldav and fixed virt
Diffstat (limited to 'home-modules')
-rw-r--r--home-modules/default.nix7
-rw-r--r--home-modules/desktop/hyprland.nix6
-rw-r--r--home-modules/services/default.nix2
-rw-r--r--home-modules/services/vdirsyncer.nix74
4 files changed, 84 insertions, 5 deletions
diff --git a/home-modules/default.nix b/home-modules/default.nix
index 413a08e..46db559 100644
--- a/home-modules/default.nix
+++ b/home-modules/default.nix
@@ -1,4 +1,9 @@
-{pkgs, ...}: {
+{pkgs, config ,...}: {
imports = [./theming.nix ./apps ./desktop ./services ];
+ sops = {
+ age.keyFile = "/home/${config.home.username}/.config/sops/age/keys.txt";
+ defaultSopsFile = ../secrets/secrets.yaml;
+ };
+
}
diff --git a/home-modules/desktop/hyprland.nix b/home-modules/desktop/hyprland.nix
index 127141f..6f36b2f 100644
--- a/home-modules/desktop/hyprland.nix
+++ b/home-modules/desktop/hyprland.nix
@@ -11,9 +11,10 @@ with lib;
xdg-desktop-portal-hyprland
wl-clipboard
brightnessctl
- lxqt.lxqt-policykit
];
+ services.hyprpolkitagent.enable = true;
+
homeprogs.waybar.enable = true;
homeprogs.mako.enable = true;
# Environment variables for hyprland.
@@ -39,14 +40,13 @@ with lib;
settings = {
exec-once = map (s: "uwsm app -- " + s) [
"kitty &"
- "lxqt-policykit-agent &"
"waybar &"
"nm-applet &"
"blueman-tray &"
"blueman-applet &"
"hyprctl setcursor Catppuccin-Mocha-Dark-Cursors 24"
"kdeconnect-indicator &"
- "fcitx5 -d"
+ # "fcitx5 -d"
] ++ [
"systemctl --user start hypridle.service"
"systemctl --user start hyprpaper.service"
diff --git a/home-modules/services/default.nix b/home-modules/services/default.nix
index 4eb6005..b83312c 100644
--- a/home-modules/services/default.nix
+++ b/home-modules/services/default.nix
@@ -1,5 +1,5 @@
{lib, ...}: {
- imports = [./direnv.nix ./syncthing.nix];
+ imports = [./vdirsyncer.nix ./direnv.nix ./syncthing.nix];
# Gnome keyring, very smort
services.gnome-keyring.enable = true;
diff --git a/home-modules/services/vdirsyncer.nix b/home-modules/services/vdirsyncer.nix
new file mode 100644
index 0000000..c5dd2cc
--- /dev/null
+++ b/home-modules/services/vdirsyncer.nix
@@ -0,0 +1,74 @@
+{pkgs, inputs, config, lib, ...}:
+let
+ cfg = config.homesv.vdirsyncer;
+in
+{
+ options.homesv.vdirsyncer = {
+ enable = lib.mkEnableOption "Enable syncing via vdirsyncer";
+ user = lib.mkOption { default = config.home.username; };
+ server = lib.mkOption { default= "https://webdav.wilkuu.xyz/dav.php"; };
+ };
+ config = lib.mkIf cfg.enable {
+ sops.secrets.webdav_uname = {
+ sopsFile = ../../secrets/secrets.yaml;
+ key="${cfg.user}/webdav/username";
+ };
+ sops.secrets.webdav_pass = {
+ sopsFile = ../../secrets/secrets.yaml;
+ key="${cfg.user}/webdav/password";
+ };
+ services.vdirsyncer = {
+ enable = true;
+ frequency = "*:0/5"; # About once in 5 minutes
+ };
+
+ systemd.user.services.vdirsyncer.unitConfig.After = [ "sops-nix.service" ];
+
+ sops.templates."vdirsyncer_config_${cfg.user}" = {
+ content = ''
+ [general]
+ status_path = "~/.vdirsyncer/status/"
+
+ [pair contacts]
+ a = "contacts_local"
+ b = "contacts_remote"
+ collections = ["from a", "from b"]
+
+ [storage contacts_local]
+ type = "filesystem"
+ path = "~/.contacts/"
+ fileext = ".vcf"
+
+ [storage contacts_remote]
+ type = "carddav"
+ auth = "digest"
+ url = "${cfg.server}"
+ username = "${config.sops.placeholder.webdav_uname}"
+ password = "${config.sops.placeholder.webdav_pass}"
+
+ [pair calendar]
+ a = "calendar_local"
+ b = "calendar_remote"
+ collections = ["from a", "from b"]
+ metadata = ["color", "displayname"]
+ conflict_resolution = "b wins"
+
+ [storage calendar_local]
+ type = "filesystem"
+ path = "~/.calendar/"
+ fileext = ".ics"
+
+ [storage calendar_remote]
+ type = "caldav"
+ auth = "digest"
+ url = "${cfg.server}"
+ username = "${config.sops.placeholder.webdav_uname}"
+ password = "${config.sops.placeholder.webdav_pass}"
+ '';
+ };
+ home.file.".config/vdirsyncer/config" = {
+ source = config.lib.file.mkOutOfStoreSymlink config.sops.templates."vdirsyncer_config_${cfg.user}".path;
+ };
+ };
+}
+