[modules]: Moved some options to the files where they belong

This commit is contained in:
Riley Apeldoorn 2022-01-23 17:03:10 +01:00
parent 74dda4d72b
commit 9b49e2eefa
16 changed files with 91 additions and 66 deletions

View file

@ -97,7 +97,7 @@ let inherit (builtins) mapAttrs map; in rec {
};
orange = {
normal = "ff5e69";
normal = "ff8c26";
bright = "fca151";
pastel = "";
};

1
configuration.nix Symbolic link
View file

@ -0,0 +1 @@
/etc/nixos/machines/thor/configuration.nix

View file

@ -8,7 +8,7 @@
riley = {
gui = true;
ide = true;
kak.ide = true;
};
networking = {

View file

@ -7,8 +7,8 @@
];
riley = {
ide = true;
gui = true;
kak.ide = true;
};
networking = {
@ -16,6 +16,10 @@
interfaces.enp9s0.useDHCP = true;
};
users.users."riley".packages = with pkgs; [
minecraft
];
devices = {
# Audio devices

View file

@ -38,24 +38,6 @@ let named = submodule {
options.riley = with lib; {
ide = mkOption {
type = types.bool;
description = ''
Enable IDE-like plugins such as language servers for Rust, Haskell and
Nix in the editor, and configure accordingly. If disabled, the editor
will lack some features such as semantic highlighting.
'';
default = true;
};
gui = mkOption {
type = types.bool;
description = ''
Enable the display server and related graphical programs.
'';
default = true;
};
theme = mkOption {
type = themeType;
description = ''
@ -124,7 +106,7 @@ let named = submodule {
<home-manager/nixos>
./ide
./kak
./gui
./fonts.nix
@ -137,6 +119,8 @@ let named = submodule {
riley.theme = (import ../colors.nix)."dark";
time.timeZone = "Europe/Amsterdam";
environment.systemPackages = with pkgs; [
# Web utils

View file

@ -1,6 +1,6 @@
{ pkgs, lib, config, ... }:
(lib.mkIf (config.riley.gui) {
with lib; (mkIf config.riley.gui {
home-manager.users."riley" = {
programs.alacritty = {
enable = true;

View file

@ -1,20 +1,26 @@
{ pkgs, config, lib, ... }:
({
with lib; {
imports = [
./window-manager.nix
./wm
./pulseaudio.nix
./clipboard.nix
./alacritty.nix
];
}) // (lib.mkIf (config.riley.gui) {
# Graphical applications
users.users."riley".packages = with pkgs; [
google-chrome
tdesktop
];
options.riley.gui = mkEnableOption "gui applications and window manager";
})
config = mkIf config.riley.gui {
# Graphical applications
users.users."riley".packages = with pkgs; [
google-chrome
tdesktop
];
};
}

View file

@ -27,7 +27,10 @@ let theme = config.riley.theme.hex;
};
});
in (lib.mkIf (config.riley.gui) {
in
with lib; (mkIf config.riley.gui {
services.xserver = {
enable = true;
windowManager.i3.enable = true;

View file

@ -62,6 +62,9 @@ with lib; let mod = modifier;
"${mod}+A" = "split v";
"${mod}+S" = "split h";
"${mod}+Q" = "layout tabbed";
"${mod}+W" = "layout default";
"${mod}+F" = "fullscreen toggle";
"${mod}+BackSpace" = "kill";

View file

@ -22,7 +22,7 @@
face global macro rgb:fc4cbf+b
# Keywords
face global keyword rgb:${blue.normal}
face global keyword rgb:${foreground.normal}+b
# Literals
face global literal rgb:${yellow.bright}

View file

@ -17,6 +17,10 @@ let kakrc = pkgs.writeTextFile (rec {
map global insert <a-tab> <esc>:buffer-next<ret>
map global normal <a-tab> :buffer-next<ret>
def new-tab %{ prompt -file-completion '>' 'terminal kak -c %val{session} %val{text}' }
map global normal <a-ret> ': new-tab<ret>'
colorscheme common
face global LineNumbers rgb:${background.slight}
@ -29,7 +33,7 @@ let kakrc = pkgs.writeTextFile (rec {
face global comment rgb:${foreground.slight}
'' + (lib.optionalString (config.riley.ide) ''
'' + (lib.optionalString (config.riley.kak.ide) ''
eval %sh{ kak-lsp --kakoune -s $kak_session }
@ -45,7 +49,7 @@ let kakrc = pkgs.writeTextFile (rec {
# Self-destruct this hook (it should only run once)
remove-hooks global yeet
}
# Load language-specific color schemes
@ -68,6 +72,15 @@ let kakrc = pkgs.writeTextFile (rec {
colorscheme rust
git show-diff
hook buffer BufReload .* %{
git update-diff
}
hook buffer NormalIdle .* %{ git update-diff }
hook buffer InsertIdle .* %{ git update-diff }
hook window -group semtok BufReload .* lsp-semantic-tokens
hook window -group semtok NormalIdle .* lsp-semantic-tokens
hook window -group semtok InsertIdle .* lsp-semantic-tokens
@ -174,40 +187,51 @@ let kakrc = pkgs.writeTextFile (rec {
}) }
'';
});
in {
environment.systemPackages = with pkgs; [
(pkgs.kakoune.override {
plugins = with kakounePlugins; [
in with lib; {
# Custom config
kakrc
options.riley = {
kak.enable = (mkEnableOption "kakoune editor") // { default = true; };
kak.ide = mkEnableOption "kakoune with ide plugins";
};
# Kakoune language server support
(symlinkJoin {
paths = [
# The language server client
kak-lsp
config = mkIf (config.riley.kak.enable || config.riley.kak.ide) {
# Include default language servers
rnix-lsp
haskell-language-server
environment.systemPackages = with pkgs; [
(pkgs.kakoune.override {
plugins = [
# Overwrite kak-lsp.toml
kak-lsp-config
# Custom config
kakrc
] ++ (lib.optionals config.riley.kak.ide [
];
name = "kak-lsp-${kak-lsp.version}";
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/kak-lsp --add-flags "--config $out/share/kak-lsp/kak-lsp.toml"
'';
})
# Kakoune language server support
(symlinkJoin {
paths = with kakounePlugins; [
# The language server client
kak-lsp
# Include default language servers
rnix-lsp
haskell-language-server
# Overwrite kak-lsp.toml
kak-lsp-config
];
name = "kak-lsp-${kak-lsp.version}";
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/kak-lsp --add-flags "--config $out/share/kak-lsp/kak-lsp.toml"
'';
})
]) ++ colors;
})
];
};
] ++ colors;
})
];
}