Compare commits

...

4 commits

9 changed files with 34 additions and 21 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 = {
@ -187,6 +190,16 @@
# toolbox
imagemagick
numbat
# Locker
(pkgs.writeShellApplication {
name = "lock";
text = ''
${config.frogeye.hooks.lock}
${pkgs.vlock}/bin/vlock --all
'';
})
];
sessionVariables = {
# Favourite commands
@ -205,6 +218,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

@ -108,7 +108,7 @@ in
"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart";
"${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: {
# change focus
"${mod}+${c.vi}" = "focus ${c.container}; ${focus}";
@ -202,7 +202,7 @@ in
default = { };
};
enter = lib.mkOption {
type = lib.types.str;
type = lib.types.nullOr lib.types.str;
default = "${mod}+${config.mod_enter}";
};
mod_enter = lib.mkOption {

View file

@ -18,15 +18,8 @@ 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?
# 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?
${config.frogeye.hooks.lock}
# TODO Reevaluate whether we want this or not
if ! ${pkgs.lightdm}/bin/dm-tool lock
then
if [ -d ${config.xdg.cacheHome}/lockpatterns ]
@ -49,15 +42,14 @@ in
xsession.windowManager.i3.config = {
keybindings = {
# 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\"";
# TODO --release?
"${mod}+F1" = "--release exec --no-startup-id ${pkgs.xorg.xset}/bin/xset dpms force off";
"${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
"${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
};
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"; }
# 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;
};
"${mode_pres_sec}" = {
mod_enter = "Shift+p+2"; # Bogus, just so I don't have to implement no binding
enter = null;
bindings = {
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default";

View file

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

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 = {