moar modules
This commit is contained in:
parent
a1175ba492
commit
011009d22f
17 changed files with 556 additions and 240 deletions
|
|
@ -11,7 +11,10 @@ let
|
|||
"monitor = " + display.name +
|
||||
", " + resToString display.resolution +
|
||||
", " + display.position +
|
||||
", " + toString display.scaling;
|
||||
", " + toString display.scaling +
|
||||
(if ( display.wallpaper != "" ) then ''
|
||||
exec-once = ${pkgs.swaybg}/bin/swaybg -o ${display.name} -i ${display.wallpaper} &
|
||||
'' else "");
|
||||
|
||||
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||
{
|
||||
|
|
@ -52,6 +55,10 @@ let
|
|||
description = "XxY";
|
||||
default = "auto";
|
||||
};
|
||||
wallpaper = mkOption {
|
||||
description = "path to wallpaper";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
with lib;
|
||||
let
|
||||
editor = config.programs.editor;
|
||||
terminal = "foot";
|
||||
pkg = editor.package;
|
||||
terminal = config.programs.terminal.package;
|
||||
termcmd = "${terminal}/bin/${terminal.pname}";
|
||||
menu = "wofi --show dmenu";
|
||||
in
|
||||
{
|
||||
|
|
@ -13,9 +15,6 @@ in
|
|||
default = pkgs.vscodium;
|
||||
example = "pkgs.vscode";
|
||||
};
|
||||
command = mkOption {
|
||||
default = "/bin/codium";
|
||||
};
|
||||
neovim = mkEnableOption "neovim mode";
|
||||
};
|
||||
};
|
||||
|
|
@ -37,12 +36,12 @@ in
|
|||
case $repo in
|
||||
clone-repo)
|
||||
url=$(wl-paste)
|
||||
${terminal} -e -- git clone "$url" ;;
|
||||
*) [ -e "$repo" ] && ${editor.package}${editor.command} $repo ;;
|
||||
${termcmd} -e -- git clone "$url" ;;
|
||||
*) [ -e "$repo" ] && ${pkg}/bin/${pkg.pname} $repo ;;
|
||||
esac
|
||||
'';
|
||||
install = false;
|
||||
hotkey = "C";
|
||||
hotkeys = [{key = "C";}];
|
||||
}];
|
||||
};
|
||||
|
||||
|
|
|
|||
63
lib/modules/email.nix
Normal file
63
lib/modules/email.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{ user, userName }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.roles.email;
|
||||
in
|
||||
{
|
||||
options.roles = {
|
||||
email = {
|
||||
enable = mkEnableOption "email settings";
|
||||
email = mkOption {
|
||||
description = "email address";
|
||||
};
|
||||
terminal = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${user}.imports = [{
|
||||
programs.git = {
|
||||
userName = userName;
|
||||
userEmail = cfg.email;
|
||||
};
|
||||
|
||||
accounts.email.accounts.${cfg.email} = mkIf cfg.terminal {
|
||||
notmuch.enable = true;
|
||||
neomutt.enable = true;
|
||||
aerc.enable = true;
|
||||
mbsync.enable = true;
|
||||
mbsync.create = "both";
|
||||
userName = cfg.email;
|
||||
realName = userName;
|
||||
address = cfg.email;
|
||||
primary = true;
|
||||
passwordCommand = "${pkgs.rbw}/bin/rbw get privateemail";
|
||||
smtp = {
|
||||
host = "mail.privateemail.com";
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
};
|
||||
imap = {
|
||||
host = "mail.privateemail.com";
|
||||
port = 993;
|
||||
tls.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.notmuch.enable = cfg.terminal;
|
||||
programs.neomutt = {
|
||||
enable = cfg.terminal;
|
||||
vimKeys = true;
|
||||
sort = "reverse-date";
|
||||
sidebar.enable = true;
|
||||
};
|
||||
programs.mbsync.enable = cfg.terminal;
|
||||
services.mbsync.enable = cfg.terminal;
|
||||
programs.aerc.enable = cfg.terminal;
|
||||
}];
|
||||
};
|
||||
|
||||
}
|
||||
25
lib/modules/git.nix
Normal file
25
lib/modules/git.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ user, userName }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.roles.git;
|
||||
in
|
||||
{
|
||||
options.roles = {
|
||||
git = {
|
||||
enable = mkEnableOption "email settings";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${user}.imports = [{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
aliases = {
|
||||
graph = "log --oneline --all --graph";
|
||||
amend = "commit --amend --no-edit";
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
}
|
||||
17
lib/modules/hyprland.nix
Normal file
17
lib/modules/hyprland.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ user }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.roles.hyprland;
|
||||
in
|
||||
{
|
||||
options.roles = {
|
||||
hyprland = {
|
||||
enable = mkEnableOption "hyprland";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${user}.imports = [{
|
||||
}];
|
||||
};
|
||||
}
|
||||
35
lib/modules/laptop.nix
Normal file
35
lib/modules/laptop.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ user }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.roles.laptop;
|
||||
in
|
||||
{
|
||||
options.roles = {
|
||||
laptop = {
|
||||
enable = mkEnableOption "is a laptop";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
displays = {
|
||||
enable = true;
|
||||
displays = [{
|
||||
name = "eDP-1";
|
||||
scaling = 1.2;
|
||||
}];
|
||||
};
|
||||
keyboard.dvorak.enable = true;
|
||||
|
||||
home-manager.users.${user}.imports = [{
|
||||
wayland.windowManager.hyprland = {
|
||||
extraConfig = ''
|
||||
# === LAPTOP MODULE ===
|
||||
general {
|
||||
gaps_out = 10
|
||||
border_size = 3
|
||||
}
|
||||
'';
|
||||
};
|
||||
}];
|
||||
};
|
||||
}
|
||||
34
lib/modules/menu.nix
Normal file
34
lib/modules/menu.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ user }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.menu;
|
||||
terminal = config.programs.terminal.package;
|
||||
termcmd = "${terminal}/bin/${terminal.pname}";
|
||||
in
|
||||
{
|
||||
options.programs = {
|
||||
menu = {
|
||||
enable = mkEnableOption "menu";
|
||||
package = mkPackageOption pkgs "wofi" {
|
||||
example = "pkgs.dmenu-wayland";
|
||||
};
|
||||
dmenuCommand = mkOption {
|
||||
default = "/bin/wofi --show dmenu";
|
||||
example = "/bin/dmenu";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${user}.imports = [{
|
||||
programs.wofi = mkIf cfg.package == pkgs.wofi {
|
||||
enable = true;
|
||||
settings = {
|
||||
term = termcmd;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
|
@ -3,6 +3,22 @@ with lib;
|
|||
let
|
||||
scripts = config.programs.scripts;
|
||||
|
||||
hotkeyType = types.submodule ({...}: {
|
||||
options = {
|
||||
key = mkOption {
|
||||
description = "the key";
|
||||
};
|
||||
modifier = mkOption {
|
||||
description = "modifiers for the key";
|
||||
default = "SUPER";
|
||||
};
|
||||
args = mkOption {
|
||||
description = "args for the script when use this key";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
scriptType = types.submodule ({...}: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
|
|
@ -11,9 +27,10 @@ let
|
|||
text = mkOption {
|
||||
description = "the text of the script";
|
||||
};
|
||||
hotkey = mkOption {
|
||||
description = "the key that run this script";
|
||||
default = "";
|
||||
hotkeys = mkOption {
|
||||
type = types.listOf hotkeyType;
|
||||
description = "keys that run this script";
|
||||
default = [];
|
||||
};
|
||||
install = mkOption {
|
||||
type = types.bool;
|
||||
|
|
@ -22,12 +39,16 @@ let
|
|||
};
|
||||
});
|
||||
|
||||
scriptToPackage = script: pkgs.writeShellScriptBin script.name script.text;
|
||||
installScripts = scripts: (map scriptToPackage (filter ( s: s.install ) scripts));
|
||||
scriptToPackage = script:
|
||||
pkgs.writeShellScriptBin script.name script.text;
|
||||
|
||||
installScripts = scripts:
|
||||
(map scriptToPackage (filter ( s: s.install ) scripts));
|
||||
|
||||
bindScript = script: if script.hotkey != "" then ''
|
||||
bind = SUPER, ${script.hotkey}, exec, ${scriptToPackage script}/bin/${script.name}
|
||||
'' else "";
|
||||
bindScript = script: concatStrings (
|
||||
map ( hotkey: ''
|
||||
bind = ${hotkey.modifier}, ${hotkey.key}, exec, ${scriptToPackage script}/bin/${script.name} ${hotkey.args}
|
||||
'' ) script.hotkeys);
|
||||
|
||||
bindScripts = scripts:
|
||||
"# === USER SCRIPTS MODULE ===\n"
|
||||
|
|
|
|||
26
lib/modules/terminal.nix
Normal file
26
lib/modules/terminal.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ user }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.terminal;
|
||||
in
|
||||
{
|
||||
options.programs = {
|
||||
terminal = {
|
||||
enable = mkEnableOption "editor";
|
||||
package = mkPackageOption pkgs "foot" {
|
||||
example = "pkgs.alacritty";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${user}.imports = [{
|
||||
programs.foot = mkIf cfg.package == pkgs.foot {
|
||||
enable = true;
|
||||
server.enable = true;
|
||||
};
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
|
@ -6,6 +6,12 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf config.roles.work.enable {
|
||||
|
||||
roles.email = {
|
||||
enable = true;
|
||||
email = "tristan.beedell@cryoserver.com";
|
||||
terminal = false;
|
||||
};
|
||||
|
||||
home-manager.users.${user}.imports = [{
|
||||
|
||||
|
|
@ -49,12 +55,19 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
extraConfig = ''
|
||||
# === WORK MODULE ===
|
||||
bind = SUPER, E, focuswindow, thunderbird
|
||||
bind = SUPER, t, focuswindow, brave-cifhbcnohmdccbgoicgdjpfamggdegmo-Profile_2
|
||||
'';
|
||||
};
|
||||
|
||||
}];
|
||||
|
||||
programs.editor = {
|
||||
enable = true;
|
||||
package = pkgs.vscode;
|
||||
command = "/bin/code";
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue