Replace riley namespace with custom namespace

This commit is contained in:
Riley Apeldoorn 2022-07-25 13:31:09 +02:00
parent 071577b83d
commit d7e64ff1d6
10 changed files with 197 additions and 88 deletions

View file

@ -34,14 +34,23 @@
system.stateVersion = "21.11";
riley = {
gui = false;
# Custom modules defined by myself.
custom = {
gui.enable = false;
kak = {
enable = true;
nix = true;
enable = true;
ide.nix = true;
};
net.interfaces = [
"eth0"
];
};
users.users."riley" = {
isNormalUser = true;
extraGroups = [ "wheel" ];

View file

@ -1,31 +1,34 @@
{ config, lib, pkgs, agenix, ... }:
{
imports = [
agenix.nixosModule
./hardware-configuration.nix
../../modules
];
imports = [
agenix.nixosModule
./hardware-configuration.nix
../../modules
];
riley = {
gui = true;
kak = {
custom = {
gui = {
enable = true;
theme = (import ../../colors.nix).dark;
};
kak = {
enable = true;
enable = true;
haskell = true;
rust = true;
nix = true;
haskell = true;
rust = true;
nix = true;
};
};
};
};
system.stateVersion = "21.11";
system.stateVersion = "21.11";
networking = {
hostName = "thor";
interfaces.enp9s0.useDHCP = true;
};
networking = {
hostName = "thor";
interfaces.enp9s0.useDHCP = true;
};
boot = {
loader.systemd-boot = {
@ -39,10 +42,10 @@
};
};
users.users."riley".packages = with pkgs; [
minecraft
cockatrice
];
users.users."riley".packages = with pkgs; [
minecraft
cockatrice
];
programs.steam = {
enable = true;
@ -68,7 +71,7 @@
external = "alsa_output.pci-0000_0a_00.1.hdmi-stereo";
headset = null; # Thor doesn't have bluetooth support (yet)
# Inputs
# Inputs
main-mic = "alsa_input.usb-046d_C922_Pro_Stream_Webcam_CC9E75BF-02.analog-stereo";
};

View file

@ -1,17 +1,20 @@
{ config, lib, pkgs, ... }:
# This is a simple module that does not define its own options.
# Rather, it just looks at the `custom.gui.enable` option to
# determine if it needs to add anything.
let scripts = (import ../../scripts/clip.nix {
{ pkgs, lib, config, ... }:
let gui = config.custom.gui;
scripts = (import ../../scripts/clip.nix {
inherit pkgs;
});
in (lib.mkIf (config.riley.gui) {
in lib.mkIf (gui.enable) {
# Add some shell scripts that abstract away the
# horrible reality that the clipboard is managed by
# the display server.
users.users."riley".packages =
with scripts; [
c p
];
users.users."riley".packages = with scripts; [ c p ];
})
}

View file

@ -1,4 +1,13 @@
{ pkgs, config, lib, ... }:
{ pkgs, lib, config, ... }:
let gui = config.custom.gui;
# Clipboard wrapper scripts
clip = (import ../../scripts/clip.nix {
inherit pkgs;
});
in
with lib; {
@ -7,21 +16,33 @@ with lib; {
./wm
./pulseaudio.nix
./clipboard.nix
./statusbar.nix
./terminal.nix
./theme.nix
];
options.riley.gui = mkEnableOption "gui applications and window manager";
config = mkIf config.riley.gui {
options.custom.gui = {
# Graphical applications
users.users."riley".packages = with pkgs; [
# Use a nested enable option, to allow extension of this option
# namespace later on.
enable = mkEnableOption "gui applications and window manager";
};
config = mkIf (gui.enable) {
# Import some applications I use on all my graphical systems
users.users."riley".packages = (with pkgs; [
# My browser
google-chrome
# Telegram client
tdesktop
];
]) ++ (with clip; [ c p ]); # Add clipboard scripts
};
}

View file

@ -1,10 +1,21 @@
{ lib, config, pkgs, ... }:
{ pkgs, lib, config, ... }:
(lib.mkIf (config.riley.gui) {
sound.enable = true;
hardware.pulseaudio.enable = true;
let gui = config.custom.gui; in
users.users."riley".packages = with pkgs; [
pavucontrol
];
})
with lib; {
# Define pulseaudio toggle under the `audio` option set.
options.custom.gui.audio.pulseaudio = mkEnableOption "PulseAudio sound server";
config = mkIf (gui.audio.pulseaudio) {
sound.enable = true;
hardware.pulseaudio.enable = true;
users.users."riley".packages = with pkgs; [
pavucontrol
];
};
}

View file

@ -1,6 +1,6 @@
{ pkgs, config, lib, ... }:
(lib.mkIf (config.riley.gui && false) {
(lib.mkIf (config.custom.gui.enable && false) {
home-manager.users."riley" = {
services.polybar = {
enable = true;

View file

@ -1,44 +1,48 @@
# Module that adds my terminal emulator of choice to my environment.
{ pkgs, lib, config, ... }:
with lib; (mkIf config.riley.gui {
home-manager.users."riley" = {
let gui = config.custom.gui; in
# Kitty lets me use cool ligatures
programs.kitty = {
enable = true;
with lib; mkIf (gui.enable) {
home-manager.users."riley".programs.kitty = {
font = {
name = "Fira Code";
size = 11;
};
# Use kitty because it supports cool ligatures and
# has nice scripting capabilities.
enable = true;
font = {
name = "Fira Code";
size = 11;
};
settings = with gui.theme.hex; {
bold_font = "Fira Code Medium";
settings = with config.riley.theme.hex; {
background = background.primary;
foreground = foreground.primary;
bold_font = "Fira Code Medium";
background = background.primary;
foreground = foreground.primary;
color1 = red.normal;
color9 = red.bright;
color1 = red.normal;
color9 = red.bright;
color2 = green.normal;
color10 = green.bright;
color2 = green.normal;
color10 = green.bright;
color3 = yellow.normal;
color11 = yellow.bright;
color3 = yellow.normal;
color11 = yellow.bright;
color4 = blue.normal;
color12 = blue.bright;
color4 = blue.normal;
color12 = blue.bright;
color5 = purple.normal;
color13 = purple.bright;
color5 = purple.normal;
color13 = purple.bright;
color6 = cyan.normal;
color14 = cyan.bright;
color6 = cyan.normal;
color14 = cyan.bright;
};
};
};
};
})
}

58
modules/gui/theme.nix Normal file
View file

@ -0,0 +1,58 @@
# Defines the global color theme option.
{ lib, ... }:
with lib; with types;
# Define the type in a let binding to prevent too much rightward
# drift in the option configuration.
let themeType =
let # Named colors are colors like "red" or "black".
named = submodule {
options = {
normal = mkOption { type = str; };
bright = mkOption { type = str; };
pastel = mkOption { type = str; };
};
};
# Special colors are more abstract, for example
# "foreground".
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; };
};
};
in {
options.custom.gui.theme = mkOption {
type = themeType;
description = ''
Color theme used across the installation for various
GUI elements and terminal colors.
'';
};
}

View file

@ -32,7 +32,7 @@ let scripts = (import ./scripts.nix { inherit pkgs; });
});
in
with lib; (mkIf config.riley.gui {
with lib; (mkIf config.custom.gui.enable {
services.xserver = {
enable = true;

View file

@ -2,8 +2,8 @@
with pkgs.kakouneUtils;
let cfg = config.riley.kak;
theme = config.riley.theme;
let cfg = config.custom.kak;
theme = config.custom.gui.theme;
kak-crosshairs = buildKakounePlugin (rec {
name = "kak-crosshairs";
src = (pkgs.fetchFromGitHub {
@ -17,7 +17,7 @@ in
with lib; {
options.riley.kak = {
options.custom.kak = {
enable = (mkEnableOption "kakoune editor") // { default = true; };