Compare commits

...

4 commits

9 changed files with 34 additions and 21 deletions

View file

@ -1,5 +1,8 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
{ {
frogeye.hooks.lock = ''
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
'';
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
bat = { bat = {
@ -187,6 +190,16 @@
# toolbox # toolbox
imagemagick imagemagick
numbat numbat
# Locker
(pkgs.writeShellApplication {
name = "lock";
text = ''
${config.frogeye.hooks.lock}
${pkgs.vlock}/bin/vlock --all
'';
})
]; ];
sessionVariables = { sessionVariables = {
# Favourite commands # Favourite commands
@ -205,6 +218,5 @@
"${config.home.homeDirectory}/.config/dotfiles/hm/scripts" # Not Nix path otherwise it gets converted into store, "${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... # 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

@ -108,7 +108,7 @@ in
"${mod}+Shift+c" = "reload"; "${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart"; "${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exit"; "${mod}+Shift+e" = "exit";
} // lib.mapAttrs' (k: v: lib.nameValuePair v.enter "mode ${v.name}") modes } // lib.mapAttrs' (k: v: lib.nameValuePair v.enter "mode ${v.name}") (lib.filterAttrs (k: v: v.enter != null) modes)
// lib.attrsets.mergeAttrsList (forEachCardinal (c: { // lib.attrsets.mergeAttrsList (forEachCardinal (c: {
# change focus # change focus
"${mod}+${c.vi}" = "focus ${c.container}; ${focus}"; "${mod}+${c.vi}" = "focus ${c.container}; ${focus}";
@ -202,7 +202,7 @@ in
default = { }; default = { };
}; };
enter = lib.mkOption { enter = lib.mkOption {
type = lib.types.str; type = lib.types.nullOr lib.types.str;
default = "${mod}+${config.mod_enter}"; default = "${mod}+${config.mod_enter}";
}; };
mod_enter = lib.mkOption { mod_enter = lib.mkOption {

View file

@ -18,15 +18,8 @@ in
(pkgs.writeShellApplication { (pkgs.writeShellApplication {
name = "xlock"; name = "xlock";
text = '' text = ''
# Remove SSH and GPG keys from keystores ${config.frogeye.hooks.lock}
${pkgs.openssh}/bin/ssh-add -D # TODO Reevaluate whether we want this or not
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?
# TODO Maybe we could have a terminal lock? With vlock.
# TODO Does that work for all DMs?
# TODO Might want to use i3lock on NixOS configs still?
if ! ${pkgs.lightdm}/bin/dm-tool lock if ! ${pkgs.lightdm}/bin/dm-tool lock
then then
if [ -d ${config.xdg.cacheHome}/lockpatterns ] if [ -d ${config.xdg.cacheHome}/lockpatterns ]
@ -49,15 +42,14 @@ in
xsession.windowManager.i3.config = { xsession.windowManager.i3.config = {
keybindings = { keybindings = {
# Screen off commands # Screen off commands
"${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\""; "${mod}+F1" = "--release exec --no-startup-id ${pkgs.xorg.xset}/bin/xset dpms force off";
# TODO --release?
"${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable"; "${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
"${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable"; "${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
}; };
startup = [ startup = [
# Lock screen after 10 minutes # Stop screen after 10 minutes, 1 minutes after lock it
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer xlock"; } { notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer xlock"; }
# TODO There's a services.screen-locker.xautolock but not sure it can match the above command # services.screen-locker.xautolock is hardcoded to use systemd for -locker (doesn't even work...)
]; ];
}; };
}; };

View file

@ -20,7 +20,7 @@ in
return_bindings = false; return_bindings = false;
}; };
"${mode_pres_sec}" = { "${mode_pres_sec}" = {
mod_enter = "Shift+p+2"; # Bogus, just so I don't have to implement no binding enter = null;
bindings = { bindings = {
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}"; "b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default"; "q" = "mode default";

View file

@ -10,8 +10,7 @@ in
xsession.windowManager.i3.config.keybindings = { xsession.windowManager.i3.config.keybindings = {
"Print" = "exec ${scrot} --focused"; "Print" = "exec ${scrot} --focused";
"${mod}+Print" = "exec ${scrot}"; "${mod}+Print" = "exec ${scrot}";
"Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select"; "Ctrl+Print" = "--release exec ${scrot} --select";
# TODO Try using bindsym --release instead of sleep
}; };
}; };
} }

View file

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

View file

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

View file

@ -103,7 +103,6 @@ echo "{
# Install NixOS! Or create a new generation. # 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}" 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 set +x

View file

@ -43,6 +43,11 @@
prose = lib.mkEnableOption "Writing stuff"; prose = lib.mkEnableOption "Writing stuff";
python = lib.mkEnableOption "Python dev 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 = { config = {