Refactor modules
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
3
users/common/configs/firefox.nix
Normal file
3
users/common/configs/firefox.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
programs.firefox.enable = true;
|
||||
}
|
6
users/common/configs/git.nix
Normal file
6
users/common/configs/git.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
};
|
||||
}
|
64
users/common/configs/hyprland.nix
Normal file
64
users/common/configs/hyprland.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"$mod" = "SUPER";
|
||||
"$term" = "kitty";
|
||||
|
||||
bind = [
|
||||
"$mod, Return, exec, $term"
|
||||
"$mod, r, exec, rofi -show drun"
|
||||
"$mod, b, exec, firefox"
|
||||
|
||||
"$mod, left, movefocus, l"
|
||||
"$mod, h, movefocus, l"
|
||||
"$mod, down, movefocus, d"
|
||||
"$mod, j, movefocus, d"
|
||||
"$mod, up, movefocus, u"
|
||||
"$mod, k, movefocus, u"
|
||||
"$mod, right, movefocus, r"
|
||||
"$mod, l, movefocus, r"
|
||||
|
||||
"$mod_SHIFT, left, movewindow, l"
|
||||
"$mod_SHIFT, h, movewindow, l"
|
||||
"$mod_SHIFT, down, movewindow, d"
|
||||
"$mod_SHIFT, j, movewindow, d"
|
||||
"$mod_SHIFT, up, movewindow, u"
|
||||
"$mod_SHIFT, k, movewindow, u"
|
||||
"$mod_SHIFT, right, movewindow, r"
|
||||
"$mod_SHIFT, l, movewindow, r"
|
||||
|
||||
"$mod_CTRL, left, resizeactive, -20 0"
|
||||
"$mod_CTRL, h, resizeactive, -20 0"
|
||||
"$mod_CTRL, down, resizeactive, 0 20"
|
||||
"$mod_CTRL, j, resizeactive, 0 20"
|
||||
"$mod_CTRL, up, resizeactive, 0 -20"
|
||||
"$mod_CTRL, k, resizeactive, 0 -20"
|
||||
"$mod_CTRL, right, resizeactive, 20 0"
|
||||
"$mod_CTRL, l, resizeactive, 20 0"
|
||||
|
||||
"$mod, Tab, cyclenext"
|
||||
"$mod, Tab, bringactivetotop"
|
||||
"$mod_SHIFT, Tab, cyclenext, prev"
|
||||
"$mod_SHIFT, Tab, bringactivetotop"
|
||||
|
||||
"$mod, f, fullscreen, 0"
|
||||
"$mod, Space, togglefloating"
|
||||
"$mod, Space, centerwindow"
|
||||
"$mod, q, killactive"
|
||||
|
||||
"CTRL_ALT, Delete, exit"
|
||||
];
|
||||
|
||||
bindm = [
|
||||
"$mod, mouse:272, movewindow"
|
||||
"$mod, mouse:273, resizewindow"
|
||||
];
|
||||
|
||||
misc = {
|
||||
"disable_hyprland_logo" = true;
|
||||
"disable_splash_rendering" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
8
users/common/configs/kitty.nix
Normal file
8
users/common/configs/kitty.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
confirm_os_window_close 0
|
||||
'';
|
||||
};
|
||||
}
|
3
users/common/configs/stylix.nix
Normal file
3
users/common/configs/stylix.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
stylix.enable = true;
|
||||
}
|
15
users/common/configs/zsh.nix
Normal file
15
users/common/configs/zsh.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
history.expireDuplicatesFirst = true;
|
||||
historySubstringSearch.enable = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
loginExtra = ''
|
||||
if [ -z "''${WAYLAND_DISPLAY}" ] && [ ! -z "''${XDG_VTNR}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
|
||||
hyprland &> /tmp/hyprland.log
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
95
users/common/default.nix
Normal file
95
users/common/default.nix
Normal file
@@ -0,0 +1,95 @@
|
||||
{ config, inputs, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
normalUsers = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.default
|
||||
./extra.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
hyprland.enable = true;
|
||||
fuse.userAllowOther = true;
|
||||
dconf.enable = true;
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
backupFileExtension = "bak";
|
||||
sharedModules = [{
|
||||
imports = [
|
||||
inputs.impermanence.nixosModules.home-manager.impermanence
|
||||
inputs.stylix.homeManagerModules.stylix
|
||||
./configs/stylix.nix
|
||||
./configs/hyprland.nix
|
||||
./configs/git.nix
|
||||
./configs/zsh.nix
|
||||
./configs/kitty.nix
|
||||
./configs/firefox.nix
|
||||
];
|
||||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
rofi-wayland
|
||||
swww
|
||||
];
|
||||
|
||||
stateVersion = "24.05";
|
||||
};
|
||||
|
||||
systemd.user.startServices = "sd-switch";
|
||||
}];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [ "d /persist/home/ 0755 root root -" ] ++ lib.attrsets.mapAttrsToList (user: config:
|
||||
"d /persist${config.home} 0700 ${user} users -"
|
||||
) normalUsers;
|
||||
|
||||
home-manager.users = lib.attrsets.mapAttrs' (user: config: lib.attrsets.nameValuePair
|
||||
(user)
|
||||
(let
|
||||
init = pkgs.pkgs.writeShellScriptBin "hyprland-init" ''
|
||||
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
|
||||
|
||||
while ! swww query &> /dev/null; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
${pkgs.swww}/bin/swww img ${config.wallpaper}
|
||||
'';
|
||||
in
|
||||
{
|
||||
home.persistence."/persist${config.home}" = {
|
||||
directories = [
|
||||
"Documents"
|
||||
"Downloads"
|
||||
"Music"
|
||||
"Pictures"
|
||||
"Videos"
|
||||
"Templates"
|
||||
"VMs"
|
||||
"git"
|
||||
".mozilla"
|
||||
];
|
||||
files = [
|
||||
".zsh_history"
|
||||
];
|
||||
allowOther = true;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
userName = config.fullName;
|
||||
userEmail = config.email;
|
||||
};
|
||||
|
||||
stylix = {
|
||||
image = config.wallpaper;
|
||||
base16Scheme = config.base16Scheme;
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/hyprland-init";
|
||||
})
|
||||
) normalUsers;
|
||||
}
|
32
users/common/extra.nix
Normal file
32
users/common/extra.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
userOptions = with lib; { config, ... }: {
|
||||
options.email = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "Email address of the user.";
|
||||
};
|
||||
|
||||
options.fullName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "Full name of the user.";
|
||||
};
|
||||
|
||||
options.wallpaper = mkOption {
|
||||
type = types.path;
|
||||
description = "Path to the user's wallpaper.";
|
||||
};
|
||||
|
||||
options.base16Scheme = mkOption {
|
||||
type = types.path;
|
||||
description = "Base16 scheme to use for the user's color palette.";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options = with lib; with types; {
|
||||
users.users = mkOption {
|
||||
type = attrsOf (submodule userOptions);
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user