From 073444e68c53a2fcf94bc2a67dafb6589d75b92c Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 10 Apr 2024 18:35:10 -0500 Subject: [PATCH] added lockscreen. may look at other display managers later. --- .../workstation-vm/hardware-configuration.nix | 50 ++++++++----------- modules/both/i3/default.nix | 24 ++++----- modules/both/i3/i3status-rust.nix | 11 ++++ modules/both/i3/lockscreen.nix | 32 ++++++++++++ 4 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 modules/both/i3/lockscreen.nix diff --git a/hosts/workstation-vm/hardware-configuration.nix b/hosts/workstation-vm/hardware-configuration.nix index f392da8..643cd9b 100644 --- a/hosts/workstation-vm/hardware-configuration.nix +++ b/hosts/workstation-vm/hardware-configuration.nix @@ -1,40 +1,34 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + { - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/cf31610c-b936-48d3-979d-553424f1d6c7"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/1127e866-28dc-4c07-92ec-07be4908880c"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/27F6-CF8B"; - fsType = "vfat"; - }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/CBA2-8A1E"; + fsType = "vfat"; + }; - fileSystems."/home/gabe/nix-config-host" = { - device = "nix-config-host"; - fsType = "virtiofs"; - }; + fileSystems."/home/gabe/nix-config-host" = + { device = "nix-config-host"; + fsType = "virtiofs"; + }; - swapDevices = [ - {device = "/dev/disk/by-uuid/679dd57a-6a34-47f1-a0c8-cdf1e280c3fa";} - ]; + swapDevices = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/modules/both/i3/default.nix b/modules/both/i3/default.nix index fd50631..88c8644 100644 --- a/modules/both/i3/default.nix +++ b/modules/both/i3/default.nix @@ -4,11 +4,14 @@ lib, ... }: { + services.accounts-daemon.enable = true; services.xserver = { enable = true; displayManager = { defaultSession = "none+i3"; - lightdm.enable = true; + lightdm = { + enable = true; + }; }; windowManager.i3.enable = true; }; @@ -117,10 +120,10 @@ ''; # change brightness "${mod}+control+plus" = '' - exec --no-startup-id "brightnessctl s +1%; dunstify -h string:x-dunst-stack-tag:brightness --timeout=500 Brightness\ $(brightnessctl -m| cut --delimiter=, -f 4)" + exec --no-startup-id "brightnessctl s +1%; dunstify -h string:x-dunst-stack-tag:brightness --timeout=500 Brightness\ $(brightnessctl -m | cut --delimiter=, -f 4)" ''; "${mod}+control+minus" = '' - exec --no-startup-id "brightnessctl s 1%-; dunstify -h string:x-dunst-stack-tag:brightness --timeout=500 Brightness\ $(brightnessctl -m| cut --delimiter=, -f 4)" + exec --no-startup-id "brightnessctl s 1%-; dunstify -h string:x-dunst-stack-tag:brightness --timeout=500 Brightness\ $(brightnessctl -m | cut --delimiter=, -f 4)" ''; #screenshot everything with mod+s, current window with mod+shift+s, selection with mod+ctrl+s @@ -198,19 +201,9 @@ }; startup = [ { - command = "~/.fehbg"; + command = "feh --no-fehbg --bg-fill ~/.background-image"; notification = false; - } - ]; - bars = [ - { - fonts = { - names = ["FiraCode Nerd Font"]; - style = "Mono"; - size = 10.0; - }; - position = "bottom"; - statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml"; + always = true; } ]; }; @@ -226,5 +219,6 @@ imports = [ ../sound.nix ./i3status-rust.nix + ./lockscreen.nix ]; } diff --git a/modules/both/i3/i3status-rust.nix b/modules/both/i3/i3status-rust.nix index 104b50d..c903388 100644 --- a/modules/both/i3/i3status-rust.nix +++ b/modules/both/i3/i3status-rust.nix @@ -10,6 +10,17 @@ lib, ... }: { + xsession.windowManager.i3.config.bars = [ + { + fonts = { + names = ["FiraCode Nerd Font"]; + style = "Mono"; + size = 10.0; + }; + position = "bottom"; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml"; + } + ]; programs.i3status-rust = { enable = true; bars = { diff --git a/modules/both/i3/lockscreen.nix b/modules/both/i3/lockscreen.nix new file mode 100644 index 0000000..390b466 --- /dev/null +++ b/modules/both/i3/lockscreen.nix @@ -0,0 +1,32 @@ +{ + config, + pkgs, + lib, + ... +}: { + environment.systemPackages = with pkgs; [ + lightlocker + ]; + home-manager.users.${config.host.user} = { + config, + osConfig, + lib, + ... + }: { + xsession.windowManager.i3.config = { + keybindings = let + mod = config.xsession.windowManager.i3.config.modifier; + in { + "${mod}+x" = '' + exec --no-startup-id light-locker-command -l + ''; + }; + startup = [ + { + command = "light-locker"; + notification = false; + } + ]; + }; + }; +}