config/modules/default.nix

211 lines
6.1 KiB
Nix
Raw Normal View History

2022-05-15 17:31:45 +02:00
# Modules used by most systems.
2022-01-10 19:25:34 +01:00
2022-05-15 17:31:45 +02:00
{ config, lib, pkgs, home-manager, ... }:
2022-01-10 19:25:34 +01:00
2022-01-12 00:20:57 +01:00
with lib; with types;
2022-05-23 10:16:05 +02:00
let themeType =
let named = submodule {
options = {
normal = mkOption { type = str; };
bright = mkOption { type = str; };
pastel = mkOption { type = str; };
};
};
special = submodule {
options = {
primary = mkOption { type = str; };
normal = mkOption { type = str; };
slight = mkOption { type = str; };
};
};
in submodule {
options = {
foreground = mkOption { type = special; };
background = mkOption { type = special; };
grayscales = mkOption { type = listOf str; };
red = mkOption { type = named; };
green = mkOption { type = named; };
blue = mkOption { type = named; };
yellow = mkOption { type = named; };
purple = mkOption { type = named; };
cyan = mkOption { type = named; };
pink = mkOption { type = named; };
orange = mkOption { type = named; };
misc = mkOption { type = attrsOf str; };
hex = mkOption { type = themeType; };
};
};
2022-05-15 20:02:26 +02:00
2022-05-19 20:13:00 +02:00
utils = import ../env.nix { inherit pkgs; };
2022-05-15 18:35:31 +02:00
in {
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
options.riley = with lib; {
theme = mkOption {
type = themeType;
description = ''
The theme used across the installation. Not used if gui is disabled.
'';
};
};
options.devices = mkOption {
type = with types; submodule {
options = {
audio = mkOption {
type = nullOr (submodule {
options = {
speakers = mkOption { type = str; };
external = mkOption { type = str; };
headset = mkOption { type = nullOr str; };
main-mic = mkOption { type = nullOr str; };
};
});
description = ''
Known audio devices: outputs & microphones.
Each string should be a pulseaudio sink or source.
'';
};
video = mkOption {
type = submodule {
options = {
displays = let output = submodule {
options = {
primary = mkOption {
type = bool;
default = false;
};
position = mkOption {
type = nullOr (listOf int);
default = null;
};
rotate = mkOption {
type = enum [ "normal" "left" "right" "inverted" ];
default = "normal";
};
};
}; in mkOption {
type = attrsOf output;
description = ''
A list of outputs with information on how to place them.
'';
};
};
};
description = ''
Define the video devices (just the displays, for now).
'';
};
};
};
};
imports = [
home-manager.nixosModule
./kak
./gui
./fonts.nix
./git.nix
./ssh.nix
];
2022-01-10 19:25:34 +01:00
config = {
2022-01-12 00:20:57 +01:00
riley.theme = (import ../colors.nix)."dark";
time.timeZone = "Europe/Amsterdam";
2022-05-15 17:52:51 +02:00
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
environment.systemPackages = with pkgs; [
# Web utils
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
wget
curl
git
2022-01-10 19:25:34 +01:00
# Common utils (rg, sk, fd, etc.)
2022-05-23 10:16:05 +02:00
utils
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
];
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
environment.shellAliases = {
# Born to VIM
":q" = "exit";
2022-03-08 06:56:23 +01:00
2022-05-15 17:52:51 +02:00
# Sike I use kakoune
2022-05-23 10:16:05 +02:00
":e" = "kak";
2022-05-15 17:52:51 +02:00
2022-05-23 10:16:05 +02:00
# Launch [T]erminal
"t" = "alacritty";
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
# [D]isown
"d" = "disown";
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
};
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
programs.bash.interactiveShellInit = ''
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
# [G]o to the directory. Create the directory if it does not exist
# yet, and if the directory contains a shell.nix file, source it.
g () {
[ -d "$1" ] || mkdir -p "$1";
cd "$1";
[ -e "shell.nix" ] && nix-shell;
}
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
# [M]ake a directory and immediately enter it.
m () { mkdir -p "$1" && cd "$1"; }
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
# [R]eplace the current process with the given one.
r () { $1 & disown; exit; }
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
# [J]ump to the directory by means of fuzzy search. If the fuzzy finder
# is aborted, the jump is also aborted.
j () { t=`sk` && cd $t; }
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
# Enter a temporary [d]irectory.
d () { cd "$(mktemp -d)"; }
2022-03-08 06:56:23 +01:00
2022-05-23 10:16:05 +02:00
'';
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
boot = {
loader.systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
};
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
loader.efi = {
canTouchEfiVariables = true;
};
};
networking = {
firewall.enable = false;
useDHCP = false;
};
2022-01-10 19:25:34 +01:00
2022-05-23 10:16:05 +02:00
security.rtkit.enable = true;
2022-01-10 19:25:34 +01:00
users.users."riley" = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
};
};
}