move keyring activation out of home-manager

This commit is contained in:
2023-01-07 01:41:56 +00:00
parent 81effb01a3
commit 5443542cba
4 changed files with 25 additions and 26 deletions

View File

@@ -20,6 +20,7 @@ in
./gfeeds.nix
./git.nix
./gpodder.nix
./keyring.nix
./kitty.nix
./mpv.nix
./neovim.nix
@@ -69,14 +70,6 @@ in
home.username = "colin";
home.homeDirectory = "/home/colin";
home.activation = {
initKeyring = {
after = ["writeBoundary"];
before = [];
data = "${../../scripts/init-keyring}";
};
};
# XDG defines things like ~/Desktop, ~/Downloads, etc.
# these clutter the home, so i mostly don't use them.
xdg.userDirs = {

View File

@@ -0,0 +1,8 @@
{ config, lib, sane-lib, ... }:
lib.mkIf config.sane.home-manager.enable
{
sane.fs."/home/colin/.local/share/keyrings/default" = sane-lib.fs.wanted {
generated.script.script = builtins.readFile ../../scripts/init-keyring;
};
}

View File

@@ -1,10 +1,8 @@
{ ... }:
{ lib, ... }:
rec {
wantedSymlink = symlink: {
inherit symlink;
wantedBeforeBy = [ "multi-user.target" ];
};
wanted = lib.mergeAttrs { wantedBeforeBy = [ "multi-user.target" ]; };
wantedSymlink = symlink: wanted { inherit symlink; };
wantedSymlinkTo = target: wantedSymlink { inherit target; };
wantedText = text: wantedSymlink { inherit text; };
}

View File

@@ -2,18 +2,18 @@
# initializes the default libsecret keyring (used by gnome-keyring) if not already initialized.
# this initializes it to be plaintext/unencrypted.
if [ -f ~/.local/share/keyrings/default ]
ringdir=/home/colin/.local/share/keyrings
if test -f "$ringdir/default"
then
echo 'keyring already initialized: not doing anything'
exit 0
echo 'keyring already initialized: not doing anything'
else
keyring="$ringdir/Default_keyring.keyring"
echo 'initializing default user keyring:' "$keyring.new"
echo '[keyring]' > "$keyring.new"
echo 'display-name=Default keyring' >> "$keyring.new"
echo 'lock-on-idle=false' >> "$keyring.new"
echo 'lock-after=false' >> "$keyring.new"
# closest to an atomic update we can achieve
mv "$keyring.new" "$keyring" && echo -n "Default_keyring" > "$ringdir/default"
fi
keyring=~/.local/share/keyrings/Default_keyring.keyring
echo 'initializing default user keyring:' "$keyring.new"
echo '[keyring]' > "$keyring.new"
echo 'display-name=Default keyring' >> "$keyring.new"
echo 'lock-on-idle=false' >> "$keyring.new"
echo 'lock-after=false' >> "$keyring.new"
# closest to an atomic update we can achieve
mv "$keyring.new" "$keyring" && echo -n "Default_keyring" > ~/.local/share/keyrings/default