update and move inputs, WIP ezpc hyprland, improve elvish module, improve locking, disable systemd initrd by default

This commit is contained in:
notgne2 2022-12-26 22:29:11 -07:00
parent cc56729c13
commit 6c6556b8d6
No known key found for this signature in database
6 changed files with 255 additions and 79 deletions

View file

@ -4,7 +4,11 @@ inputs: {
pkgs,
...
}: {
imports = [(import ./modules inputs) "${inputs.home-manager-clipman}/modules/services/clipman.nix"];
imports = [
(import ./modules inputs)
"${inputs.home-manager-clipman}/modules/services/clipman.nix"
inputs.hyprland.homeManagerModules.default
];
programs.direnv = {
enable = lib.mkDefault true;

View file

@ -7,6 +7,30 @@
with lib; let
cfg = config.programs.elvish;
in {
options.programs.starship.elvishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Elvish integration.
'';
};
options.programs.zoxide.elvishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Elvish integration.
'';
};
options.programs.direnv.elvishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Elvish integration.
'';
};
options.programs.elvish = {
enable = mkEnableOption "Elvish, a friendly interactive shell and an expressive programming";
@ -18,30 +42,6 @@ in {
'';
};
zoxide = mkOption {
type = types.bool;
default = false;
description = ''
Enable zoxide smart directory switcher
'';
};
starship = mkOption {
type = types.bool;
default = false;
description = ''
Use the starship prompt
'';
};
direnv = mkOption {
type = types.bool;
default = false;
description = ''
Enable direnv integration for elvish
'';
};
package = mkOption {
type = types.package;
default = pkgs.elvish;
@ -73,22 +73,21 @@ in {
exec elvish
'';
# Don't do things twice if we're just passing through :)
programs.starship.enableBashIntegration = mkIf cfg.defaultFromBash false;
programs.starship.enable = mkIf cfg.starship true;
programs.zoxide.enable = mkIf cfg.zoxide true;
programs.direnv.enable = mkIf cfg.direnv true;
programs.zoxide.enableBashIntegration = mkIf cfg.defaultFromBash false;
programs.direnv.enableBashIntegration = mkIf cfg.defaultFromBash false;
programs.elvish.initExtra = mkMerge [
(mkIf cfg.starship ''
(mkIf (config.programs.starship.elvishIntegration && config.programs.starship.enable) ''
if (and (not-eq $E:TERM "dumb") (or (not (has-env "INSIDE_EMACS")) (eq $E:INSIDE_EMACS "vterm"))) {
eval (${config.home.profileDirectory}/bin/starship init elvish)
}
'')
(mkIf cfg.zoxide ''
(mkIf (config.programs.zoxide.elvishIntegration && config.programs.zoxide.enable) ''
eval (${config.programs.zoxide.package}/bin/zoxide init elvish | slurp)
'')
(mkIf cfg.direnv ''
(mkIf (config.programs.direnv.elvishIntegration && config.programs.direnv.enable) ''
eval (${pkgs.direnv}/bin/direnv hook elvish | ${pkgs.gnused}/bin/sed 's/except/catch/' | slurp)
'')
];

View file

@ -91,18 +91,22 @@ in {
events = [
{
event = "before-sleep";
command = "${lockCommand}";
command = "${pkgs.systemd}/bin/loginctl lock-session";
}
{
event = "lock";
command = "${lockCommand}";
}
{
event = "unlock";
command = "${pkgs.procps}/bin/pkill -USR1 swaylock";
}
];
timeouts = [
{
timeout = cfg.screensaver.lockTime;
command = "${lockCommand}";
command = "${pkgs.systemd}/bin/loginctl lock-session";
}
{
timeout = cfg.screensaver.offTime;
@ -112,6 +116,81 @@ in {
];
};
wayland.windowManager.hyprland = {
enable = false;
systemdIntegration = true;
extraConfig = let
swayConfig = config.wayland.windowManager.sway.config;
swayBindings = swayConfig.keybindings;
swayToHyprlandBinding = key: binding: let
splitKey = lib.splitString "+" key;
isMod = m: m == "Mod4" || m == "Shift";
convertMod = m:
if m == "Mod4"
then "SUPER"
else lib.toUpper m;
mods = filter isMod splitKey;
modsStr = "${(lib.concatStringsSep "_" (map convertMod mods))},";
normalKeys = filter (m: isMod m == false) splitKey;
normalKey = lib.elemAt normalKeys 0;
convertedKey = "${modsStr}${normalKey}";
convertDir = dir: lib.elemAt (lib.stringToCharacters dir) 0;
splitBinding = lib.splitString " " binding;
bindingAction = lib.elemAt splitBinding 0;
newBinding =
if bindingAction == "exec"
then "exec, ${lib.concatStringsSep " " (lib.tail splitBinding)}"
else if bindingAction == "workspace"
then let n = lib.last splitBinding; in "workspace, ${n}"
else if bindingAction == "kill"
then "killactive,"
else if bindingAction == "focus"
then let
l = lib.last splitBinding;
in
if l == "mode_toggle"
then "togglefloating,"
else "movefocus,${convertDir l}"
else if bindingAction == "fullscreen"
then "fullscreen,0"
else if bindingAction == "floating"
then "togglefloating,"
else if bindingAction == "move"
then let
splitMove = lib.tail splitBinding;
moveThing = lib.elemAt splitMove 0;
toThing =
if lib.length splitMove >= 3
then lib.elemAt splitMove 2
else null;
in
if toThing == null
then "movewindow,${convertDir moveThing}"
else if moveThing == "container" && toThing == "workspace"
then "movetoworkspacesilent,${lib.last splitMove}"
else null
else null;
in
if newBinding == null
then "# ${key} - ${binding}"
else "bind=${convertedKey}, ${newBinding}";
convertedBindings = lib.concatStringsSep "\n" (lib.mapAttrsToList swayToHyprlandBinding swayBindings);
bindingsStr = "${convertedBindings}\n";
in ''
monitor=,preferred,auto,auto
gestures {
workspace_swipe = on
}
${convertedBindings}
'';
};
wayland.windowManager.sway = {
enable = lib.mkDefault true;