2022-05-06 03:01:56 +00:00
|
|
|
{ config, lib, pkgs, ... }: {
|
2022-05-02 03:39:50 +00:00
|
|
|
|
2022-07-26 03:36:06 +00:00
|
|
|
imports =
|
|
|
|
[ ../modules/shell ../modules/neovim ../modules/repositories/dotfiles.nix ];
|
2022-05-02 03:39:50 +00:00
|
|
|
|
2022-05-29 17:44:45 +00:00
|
|
|
options = with lib; {
|
2022-06-20 03:44:29 +00:00
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
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";
|
|
|
|
default =
|
|
|
|
if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
gui = {
|
|
|
|
enable = mkEnableOption {
|
|
|
|
description = "Enable graphics";
|
|
|
|
default = false;
|
|
|
|
};
|
2022-07-26 03:36:06 +00:00
|
|
|
};
|
|
|
|
colorscheme = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
description = "Base16 color scheme";
|
2022-06-20 03:44:29 +00:00
|
|
|
};
|
2022-06-20 12:39:41 +00:00
|
|
|
homePath = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description = "Path of user's home directory.";
|
|
|
|
default = builtins.toPath (if pkgs.stdenv.isDarwin then
|
2022-06-20 03:54:16 +00:00
|
|
|
"/Users/${config.user}"
|
|
|
|
else
|
2022-06-20 12:39:41 +00:00
|
|
|
"/home/${config.user}");
|
|
|
|
};
|
|
|
|
dotfilesPath = mkOption {
|
2022-05-29 17:44:45 +00:00
|
|
|
type = types.path;
|
|
|
|
description = "Path of dotfiles repository.";
|
2022-06-20 12:39:41 +00:00
|
|
|
default = config.homePath + "/dev/personal/dotfiles";
|
2022-05-29 17:44:45 +00:00
|
|
|
};
|
2022-06-04 14:29:36 +00:00
|
|
|
dotfilesRepo = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "Link to dotfiles repository.";
|
|
|
|
};
|
2022-06-05 01:08:09 +00:00
|
|
|
unfreePackages = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
description = "List of unfree packages to allow.";
|
|
|
|
default = [ ];
|
|
|
|
};
|
2022-05-29 17:44:45 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 14:11:55 +00:00
|
|
|
config =
|
|
|
|
let stateVersion = "22.11";
|
|
|
|
in
|
|
|
|
{
|
2022-05-02 03:39:50 +00:00
|
|
|
|
2022-09-30 14:11:55 +00:00
|
|
|
# Enable features in Nix commands
|
|
|
|
nix.extraOptions = "experimental-features = nix-command flakes";
|
2022-05-22 23:43:46 +00:00
|
|
|
|
2022-09-30 14:11:55 +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
|
|
|
|
2022-09-30 14:11:55 +00:00
|
|
|
# Use the system-level nixpkgs instead of Home Manager's
|
|
|
|
home-manager.useGlobalPkgs = true;
|
2022-05-29 17:44:45 +00:00
|
|
|
|
2022-09-30 14:11:55 +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
|
|
|
|
2022-09-30 14:11:55 +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-06-05 01:08:09 +00:00
|
|
|
|
2022-09-30 14:11:55 +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-22 23:43:46 +00:00
|
|
|
|
2022-09-30 14:11:55 +00:00
|
|
|
};
|
2022-05-02 03:39:50 +00:00
|
|
|
|
|
|
|
}
|