This commit is contained in:
Riley Apeldoorn 2022-05-23 10:16:05 +02:00
parent a59a56da09
commit 5247a535b1
2 changed files with 165 additions and 164 deletions

22
env.nix
View File

@ -1,15 +1,15 @@
# Packages I tend to use
{ pkgs }: pkgs.buildEnv {
name = "riley-user-utils";
paths = with pkgs; [
ripgrep
bottom
delta
skim
exa
bat
lf
fd
];
name = "riley-user-utils";
paths = with pkgs; [
ripgrep
bottom
delta
skim
exa
bat
lf
fd
];
}

View File

@ -3,120 +3,121 @@
{ config, lib, pkgs, home-manager, ... }:
with lib; with types;
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; };
};
};
themeType = 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; };
};
};
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; };
};
};
utils = import ../env.nix { inherit pkgs; };
in {
options.riley = with lib; {
options.riley = with lib; {
theme = mkOption {
type = themeType;
description = ''
The theme used across the installation. Not used if gui is disabled.
'';
};
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.
'';
};
options.devices = mkOption {
type = with types; submodule {
options = {
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).
'';
};
};
};
};
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 = [
imports = [
home-manager.nixosModule
home-manager.nixosModule
./kak
./gui
./fonts.nix
./git.nix
./ssh.nix
];
./kak
./gui
./fonts.nix
./git.nix
./ssh.nix
];
config = {
@ -126,79 +127,79 @@ in {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
environment.systemPackages = with pkgs; [
# Web utils
environment.systemPackages = with pkgs; [
wget
curl
git
# Web utils
wget
curl
git
# Common utils (rg, sk, fd, etc.)
utils
];
utils
environment.shellAliases = {
];
# Born to VIM
":q" = "exit";
environment.shellAliases = {
# Born to VIM
":q" = "exit";
# Sike I use kakoune
":e" = "kak";
":e" = "kak";
# Launch [T]erminal
"t" = "alacritty";
# Launch [T]erminal
"t" = "alacritty";
# [D]isown
"d" = "disown";
# [D]isown
"d" = "disown";
};
};
programs.bash.interactiveShellInit = ''
programs.bash.interactiveShellInit = ''
# [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;
}
# [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;
}
# [M]ake a directory and immediately enter it.
m () { mkdir -p "$1" && cd "$1"; }
# [M]ake a directory and immediately enter it.
m () { mkdir -p "$1" && cd "$1"; }
# [R]eplace the current process with the given one.
r () { $1 & disown; exit; }
# [R]eplace the current process with the given one.
r () { $1 & disown; exit; }
# [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; }
# [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; }
# Enter a temporary [d]irectory.
d () { cd "$(mktemp -d)"; }
'';
# Enter a temporary [d]irectory.
d () { cd "$(mktemp -d)"; }
boot = {
loader.systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
};
'';
loader.efi = {
canTouchEfiVariables = true;
};
};
boot = {
loader.systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
};
networking = {
firewall.enable = false;
useDHCP = false;
};
loader.efi = {
canTouchEfiVariables = true;
};
};
security.rtkit.enable = true;
networking = {
firewall.enable = false;
useDHCP = false;
};
security.rtkit.enable = true;
users.users."riley" = {
isNormalUser = true;