dotfiles/modules/common/default.nix

165 lines
4.6 KiB
Nix
Raw Normal View History

2024-04-20 13:42:06 +00:00
{
config,
lib,
pkgs,
...
}:
{
2022-05-02 03:39:50 +00:00
2024-04-20 13:42:06 +00:00
imports = [
./applications
./mail
./neovim
./programming
./repositories
./shell
];
2022-05-02 03:39:50 +00:00
2022-12-14 04:02:42 +00:00
options = {
user = lib.mkOption {
type = lib.types.str;
2022-06-20 03:44:29 +00:00
description = "Primary user of the system";
};
2022-09-10 02:16:45 +00:00
fullName = lib.mkOption {
type = lib.types.str;
description = "Human readable name of the user";
};
2022-06-20 03:44:29 +00:00
userDirs = {
# Required to prevent infinite recursion when referenced by himalaya
download = lib.mkOption {
type = lib.types.str;
description = "XDG directory for downloads";
2024-04-20 13:42:06 +00:00
default = if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
2022-06-20 03:44:29 +00:00
};
};
2022-10-16 14:20:50 +00:00
identityFile = lib.mkOption {
type = lib.types.str;
2022-10-29 03:58:33 +00:00
description = "Path to existing private key file.";
2022-10-16 14:20:50 +00:00
default = "/etc/ssh/ssh_host_ed25519_key";
};
2022-06-20 03:44:29 +00:00
gui = {
enable = lib.mkEnableOption {
description = "Enable graphics.";
2022-06-20 03:44:29 +00:00
default = false;
};
2022-07-26 03:36:06 +00:00
};
theme = {
colors = lib.mkOption {
type = lib.types.attrs;
description = "Base16 color scheme.";
2022-12-21 21:18:03 +00:00
default = (import ../colorscheme/gruvbox).dark;
};
dark = lib.mkOption {
type = lib.types.bool;
description = "Enable dark mode.";
default = true;
};
2022-06-20 03:44:29 +00:00
};
homePath = lib.mkOption {
type = lib.types.path;
description = "Path of user's home directory.";
2024-04-20 13:42:06 +00:00
default = builtins.toPath (
if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
);
};
dotfilesPath = lib.mkOption {
type = lib.types.path;
2022-05-29 17:44:45 +00:00
description = "Path of dotfiles repository.";
default = config.homePath + "/dev/personal/dotfiles";
2022-05-29 17:44:45 +00:00
};
dotfilesRepo = lib.mkOption {
type = lib.types.str;
description = "Link to dotfiles repository HTTPS URL.";
2022-06-04 14:29:36 +00:00
};
unfreePackages = lib.mkOption {
type = lib.types.listOf lib.types.str;
2022-06-05 01:08:09 +00:00
description = "List of unfree packages to allow.";
default = [ ];
};
2023-07-07 16:16:07 +00:00
hostnames = {
git = lib.mkOption {
type = lib.types.str;
description = "Hostname for git server (Gitea).";
};
metrics = lib.mkOption {
type = lib.types.str;
description = "Hostname for metrics server.";
};
minecraft = lib.mkOption {
type = lib.types.str;
description = "Hostname for Minecraft server.";
};
paperless = lib.mkOption {
type = lib.types.str;
description = "Hostname for document server (paperless-ngx).";
};
2023-07-07 16:16:07 +00:00
prometheus = lib.mkOption {
type = lib.types.str;
description = "Hostname for Prometheus server.";
};
2023-12-17 02:02:17 +00:00
influxdb = lib.mkOption {
type = lib.types.str;
description = "Hostname for InfluxDB2 server.";
};
2023-07-07 16:16:07 +00:00
secrets = lib.mkOption {
type = lib.types.str;
description = "Hostname for passwords and secrets (Vaultwarden).";
};
stream = lib.mkOption {
type = lib.types.str;
description = "Hostname for video/media library (Jellyfin).";
};
content = lib.mkOption {
type = lib.types.str;
description = "Hostname for personal content system (Nextcloud).";
};
books = lib.mkOption {
type = lib.types.str;
description = "Hostname for books library (Calibre-Web).";
};
download = lib.mkOption {
type = lib.types.str;
description = "Hostname for download services.";
};
2024-02-25 18:50:00 +00:00
irc = lib.mkOption {
type = lib.types.str;
description = "Hostname for IRC services.";
};
2024-03-24 17:16:20 +00:00
transmission = lib.mkOption {
type = lib.types.str;
description = "Hostname for peer2peer downloads (Transmission).";
};
2023-07-07 16:16:07 +00:00
};
2022-05-29 17:44:45 +00:00
};
2024-04-20 13:42:06 +00:00
config =
let
stateVersion = "23.05";
in
{
2022-05-02 03:39:50 +00:00
2024-04-20 13:42:06 +00:00
# Basic common system packages for all devices
environment.systemPackages = with pkgs; [
git
vim
wget
curl
];
2022-05-29 17:44:45 +00:00
2024-04-20 13:42:06 +00:00
# Use the system-level nixpkgs instead of Home Manager's
home-manager.useGlobalPkgs = true;
2022-05-29 17:44:45 +00:00
2024-04-20 13:42:06 +00:00
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when
# using multiple profiles for one user
home-manager.useUserPackages = true;
2022-05-22 23:43:46 +00:00
2024-04-20 13:42:06 +00:00
# Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.unfreePackages;
2022-05-02 03:39:50 +00:00
2024-04-20 13:42:06 +00:00
# Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion;
};
2022-05-02 03:39:50 +00:00
}