Files
nix/user/default.nix
Nikolaos Karaolidis df315f97d6 Refactor modules
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2024-06-13 12:20:45 +03:00

93 lines
2.2 KiB
Nix

{ config, inputs, lib, pkgs, ... }:
let
wallpaper = ./wallpapers/clouds.png;
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 ${wallpaper}
'';
cfg = config.user;
in
{
options.user = {
vars = lib.mkOption {
type = lib.types.attrs;
description = "Variables for the user";
};
autologin = lib.mkOption {
type = lib.types.bool;
description = "Automatically log in the user on boot";
default = false;
};
};
config = {
users.users."${cfg.vars.user}" = {
isNormalUser = true;
createHome = true;
home = "/home/${cfg.vars.user}";
description = cfg.vars.fullName;
hashedPassword = "***REMOVED***";
extraGroups = [ "wheel" ];
linger = true;
uid = 1000;
};
systemd.tmpfiles.rules = [ "d /persist/home/${cfg.vars.user} 0700 ${cfg.vars.user} users -" ];
services.getty.autologinUser = lib.mkIf cfg.autologin cfg.vars.user;
programs.hyprland.enable = true;
home-manager.users."${cfg.vars.user}" = {
imports = [
inputs.impermanence.nixosModules.home-manager.impermanence
inputs.stylix.homeManagerModules.stylix
./configs/stylix.nix
./configs/hyprland.nix
./configs/zsh.nix
./configs/kitty.nix
./configs/firefox.nix
./configs/git.nix
];
home = {
persistence."/persist/home/${cfg.vars.user}" = {
directories = [
"Documents"
"Downloads"
"Music"
"Pictures"
"Videos"
"Templates"
"VMs"
"git"
".mozilla"
];
files = [
".zsh_history"
];
allowOther = true;
};
packages = with pkgs; [
rofi-wayland
swww
];
stateVersion = "24.05";
};
git.vars = cfg.vars;
hyprland.initScript = "${init}/bin/hyprland-init";
stylix.wallpaper = wallpaper;
systemd.user.startServices = "sd-switch";
};
};
}