xlock: Add option

This commit is contained in:
Geoffrey Frogeye 2024-03-09 18:22:30 +01:00
parent c7c2c89f15
commit 14f7199d65
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
6 changed files with 16 additions and 8 deletions

View file

@ -1,5 +1,8 @@
{ pkgs, config, lib, ... }:
{
frogeye.hooks.lock = ''
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
'';
programs = {
home-manager.enable = true;
bat = {
@ -205,6 +208,5 @@
"${config.home.homeDirectory}/.config/dotfiles/hm/scripts" # Not Nix path otherwise it gets converted into store,
# and then every time you want to modify a script you have to rebuild and re-login...
];
# TODO Way to automatically setup an home-manager install
};
}

View file

@ -18,11 +18,7 @@ in
(pkgs.writeShellApplication {
name = "xlock";
text = ''
# Remove SSH and GPG keys from keystores
${pkgs.openssh}/bin/ssh-add -D
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
# TODO Should probably be an option and defined where relevant?
${config.frogeye.hooks.lock}
# TODO Maybe we could have a terminal lock? With vlock.
# TODO Does that work for all DMs?

View file

@ -1,6 +1,9 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.programs.gpg.enable {
frogeye.hooks.lock = ''
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
'';
programs.gpg = {
homedir = "${config.xdg.stateHome}/gnupg";
settings = {

View file

@ -1,6 +1,9 @@
{ ... }:
{ pkgs, lib, config, ... }:
{
config = {
frogeye.hooks.lock = ''
${pkgs.openssh}/bin/ssh-add -D
'';
programs.ssh = {
enable = true;
controlMaster = "auto";

View file

@ -103,7 +103,6 @@ echo "{
# Install NixOS! Or create a new generation.
sudo nix --extra-experimental-features "nix-command flakes" run "${SCRIPT_DIR}#nixos-install" -- --no-root-password --root "$mountpoint" --flake "${mountpoint}/etc/nixos#${name}"
# TODO Add this? --flake "$flake"
set +x

View file

@ -43,6 +43,11 @@
prose = lib.mkEnableOption "Writing stuff";
python = lib.mkEnableOption "Python dev stuff";
};
hooks.lock = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Bash commands to execute on locking the session.";
};
};
config = {