feat[client]: automatically create emacs org files

This commit is contained in:
Leon Schwarzäugl 2025-11-14 01:32:53 +01:00
parent 47075799d6
commit ad4443056a
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 66 additions and 16 deletions

View file

@ -10873,11 +10873,11 @@ To get other URLs (token, etc.), use https://<kanidmDomain>/oauth2/openid/<clien
}; };
}; };
}) [ }) [
"${serviceDir}/data" "data"
"${serviceDir}/data/cache" "data/cache"
"${serviceDir}/data/locks" "data/locks"
"${serviceDir}/data/log" "data/log"
"${serviceDir}/data/proxies" "data/proxies"
] ]
); );
@ -10974,8 +10974,8 @@ Deployment notes:
}; };
}; };
}) [ }) [
"${serviceDir}/var/data" "var/data"
"${serviceDir}/images" "images"
] ]
); );
@ -13835,7 +13835,7 @@ Lastly, I am defining some more packages here that the parser has problems findi
#+begin_src nix-ts :tangle modules/home/common/emacs.nix #+begin_src nix-ts :tangle modules/home/common/emacs.nix
{ self, lib, config, pkgs, globals, inputs, ... }: { self, lib, config, pkgs, globals, inputs, ... }:
let let
inherit (config.swarselsystems) homeDir isPublic isNixos; inherit (config.swarselsystems) homeDir mainUser isPublic isNixos;
inherit (config.repo.secrets.common.emacs) radicaleUser; inherit (config.repo.secrets.common.emacs) radicaleUser;
in in
{ {
@ -13844,6 +13844,31 @@ Lastly, I am defining some more packages here that the parser has problems findi
# needed for elfeed # needed for elfeed
# enable emacs overlay for bleeding edge features # enable emacs overlay for bleeding edge features
# also read init.el file and install use-package packages # also read init.el file and install use-package packages
home.activation.setupEmacsOrgFiles =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -eu
if [ ! -d ${homeDir}/Org ]; then
${pkgs.coreutils}/bin/install -d -m 0755 ${homeDir}/Org
${pkgs.coreutils}/bin/chown ${mainUser}:syncthing ${homeDir}/Org
fi
# create dummy files to make Emacs calendar work
# these have low modified dates and should be marked as sync-conflicts
for file in "Tasks" "Archive" "Journal"; do
if [ ! -f ${homeDir}/Org/"$file".org ]; then
${pkgs.coreutils}/bin/touch --time=access --time=modify -t 197001010000.00 ${homeDir}/Org/"$file".org
${pkgs.coreutils}/bin/chown ${mainUser}:syncthing ${homeDir}/Org/"$file".org
fi
done
# when the configuration is build again, these sync-conflicts will be cleaned up
for file in $(find ${homeDir}/Org/ -name "*sync-conflict*"); do
${pkgs.coreutils}/bin/rm "$file"
done
'';
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacsWithPackagesFromUsePackage { package = pkgs.emacsWithPackagesFromUsePackage {

View file

@ -1,6 +1,6 @@
{ self, lib, config, pkgs, globals, inputs, ... }: { self, lib, config, pkgs, globals, inputs, ... }:
let let
inherit (config.swarselsystems) homeDir isPublic isNixos; inherit (config.swarselsystems) homeDir mainUser isPublic isNixos;
inherit (config.repo.secrets.common.emacs) radicaleUser; inherit (config.repo.secrets.common.emacs) radicaleUser;
in in
{ {
@ -9,6 +9,31 @@ in
# needed for elfeed # needed for elfeed
# enable emacs overlay for bleeding edge features # enable emacs overlay for bleeding edge features
# also read init.el file and install use-package packages # also read init.el file and install use-package packages
home.activation.setupEmacsOrgFiles =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -eu
if [ ! -d ${homeDir}/Org ]; then
${pkgs.coreutils}/bin/install -d -m 0755 ${homeDir}/Org
${pkgs.coreutils}/bin/chown ${mainUser}:syncthing ${homeDir}/Org
fi
# create dummy files to make Emacs calendar work
# these have low modified dates and should be marked as sync-conflicts
for file in "Tasks" "Archive" "Journal"; do
if [ ! -f ${homeDir}/Org/"$file".org ]; then
${pkgs.coreutils}/bin/touch --time=access --time=modify -t 197001010000.00 ${homeDir}/Org/"$file".org
${pkgs.coreutils}/bin/chown ${mainUser}:syncthing ${homeDir}/Org/"$file".org
fi
done
# when the configuration is build again, these sync-conflicts will be cleaned up
for file in $(find ${homeDir}/Org/ -name "*sync-conflict*"); do
${pkgs.coreutils}/bin/rm "$file"
done
'';
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacsWithPackagesFromUsePackage { package = pkgs.emacsWithPackagesFromUsePackage {

View file

@ -60,11 +60,11 @@ in
}; };
}; };
}) [ }) [
"${serviceDir}/data" "data"
"${serviceDir}/data/cache" "data/cache"
"${serviceDir}/data/locks" "data/locks"
"${serviceDir}/data/log" "data/log"
"${serviceDir}/data/proxies" "data/proxies"
] ]
); );

View file

@ -41,8 +41,8 @@ in
}; };
}; };
}) [ }) [
"${serviceDir}/var/data" "var/data"
"${serviceDir}/images" "images"
] ]
); );