You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.8 KiB
Nix

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ashe.common;
in {
#options.ashe = mkOption
options.ashe.common = {
timezone = mkOption { type = types.str; default = "America/Denver"; };
locale = mkOption { type = types.str; default = "en_US.UTF-8"; };
x11 = mkEnableOption "x11";
shell = mkPackageOption pkgs "zsh" { };
user = mkOption { type = types.str; default = "ashe"; };
userFullName = mkOption { type = types.str; default = "Ashelyn"; };
ports = mkOption { type = types.listOf types.port; default = [ 22 80 443 ]; };
password= mkOption { type = types.str; default = ""; };
userPackages= mkOption { type = types.listOf types.package; default = [ ]; };
};
config = {
time.timeZone = cfg.timezone;
i18n.defaultLocale = cfg.locale;
services.xserver.enable = cfg.x11;
users.defaultUserShell = cfg.shell;
environment.systemPackages = with pkgs; [
neovim
git
vim
wget
];
services.openssh = {
enable = true;
passwordAuthentication = true;
permitRootLogin = "no";
};
networking.firewall.allowedTCPPorts = cfg.ports;
users.users.${cfg.user} = {
uid = 1000;
isNormalUser = true;
home = "/home/${cfg.user}";
description = cfg.userFullName;
extraGroups = [ "wheel" ];
hashedPassword = cfg.password;
packages = cfg.userPackages;
};
home-manager.users.${cfg.user} = {
home.stateVersion = "22.05";
programs.zsh = {
enable = true;
zplug = {
enable = true;
plugins = [
{ name = "zsh-users/zsh-autosuggestions"; }
{ name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; }
];
};
initExtraFirst =
''
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
alias vim=nvim
'';
initExtra =
''
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
'';
};
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
};
}