From e1b1e7cc381dd6e5f08f05efd68a4d02a8c9847d Mon Sep 17 00:00:00 2001 From: Jan Bulthuis Date: Fri, 19 Jul 2024 13:59:26 +0200 Subject: [PATCH] Improved things --- modules/base/default.nix | 1 - modules/users/modules/default.nix | 2 + .../modules/desktop/window-manager/river.nix | 3 ++ modules/users/modules/language/nix.nix | 46 +++++++++++++++++++ modules/users/modules/language/rust.nix | 39 ++++++++++++++++ modules/users/modules/neovim/default.nix | 4 -- modules/users/modules/vscode/default.nix | 9 ++-- users/jan.nix | 5 +- 8 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 modules/users/modules/language/nix.nix create mode 100644 modules/users/modules/language/rust.nix diff --git a/modules/base/default.nix b/modules/base/default.nix index 1d38d69..65940f9 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -15,7 +15,6 @@ in { wget curl dig - nix-tree procps ]; diff --git a/modules/users/modules/default.nix b/modules/users/modules/default.nix index 93a7755..450a20b 100644 --- a/modules/users/modules/default.nix +++ b/modules/users/modules/default.nix @@ -9,6 +9,8 @@ ./firefox/default.nix ./fontconfig/default.nix ./foot/default.nix + ./language/nix.nix + ./language/rust.nix ./mako/default.nix ./neovim/default.nix ./obsidian/default.nix diff --git a/modules/users/modules/desktop/window-manager/river.nix b/modules/users/modules/desktop/window-manager/river.nix index 24b9cb4..f59f101 100644 --- a/modules/users/modules/desktop/window-manager/river.nix +++ b/modules/users/modules/desktop/window-manager/river.nix @@ -12,6 +12,9 @@ in { config = lib.mkIf cfg.enable { # Set desktop type to wayland modules.desktop.wayland = true; + + # TODO: Move elsewhere and make keybindings more configurable + modules.rofi.enable = true; # Change desktop to execute river modules.desktop.initScript = '' diff --git a/modules/users/modules/language/nix.nix b/modules/users/modules/language/nix.nix new file mode 100644 index 0000000..38f157e --- /dev/null +++ b/modules/users/modules/language/nix.nix @@ -0,0 +1,46 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.nix; +in { + options.modules.nix = { + enable = mkEnableOption "nix"; + }; + + config = mkIf cfg.enable { + # Development packages + home.packages = with pkgs; [ + nix-tree + nixfmt-rfc-style + nixd + ]; + + # VSCode configuration + programs.vscode = { + extensions = with pkgs.vscode-extensions; [ + jnoortheen.nix-ide + ]; + + userSettings = { + "[nix]" = { + "editor.tabSize" = 2; + }; + "nix.enableLanguageServer" = true; + "nix.serverPath" = "nixd"; + "nix.serverSettings" = { + nixd = { + formatting = { + command = [ "nixfmt" ]; + }; + }; + }; + }; + }; + + # Neovim configuration + programs.nixvim = { + + }; + }; +} \ No newline at end of file diff --git a/modules/users/modules/language/rust.nix b/modules/users/modules/language/rust.nix new file mode 100644 index 0000000..88c7b5e --- /dev/null +++ b/modules/users/modules/language/rust.nix @@ -0,0 +1,39 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.rust; +in { + options.modules.rust = { + enable = mkEnableOption "rust"; + }; + + config = mkIf cfg.enable { + # Development packages + home.packages = with pkgs; [ + rustc + cargo + rust-analyzer + rustfmt + ]; + + # VSCode configuration + programs.vscode = { + extensions = with pkgs.vscode-extensions; [ + rust-lang.rust-analyzer + ]; + + userSettings = { + "[rust]" = { + }; + }; + }; + + # Neovim configuration + programs.nixvim = { + plugins.rust-tools = { + enable = true; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/users/modules/neovim/default.nix b/modules/users/modules/neovim/default.nix index 9ddb1fc..5adaf0a 100644 --- a/modules/users/modules/neovim/default.nix +++ b/modules/users/modules/neovim/default.nix @@ -169,10 +169,6 @@ in { # enable = true; #}; - plugins.rust-tools = { - enable = true; - }; - plugins.vimtex = { enable = true; texlivePackage = null; diff --git a/modules/users/modules/vscode/default.nix b/modules/users/modules/vscode/default.nix index 0e30c6d..654adb5 100644 --- a/modules/users/modules/vscode/default.nix +++ b/modules/users/modules/vscode/default.nix @@ -27,13 +27,9 @@ in { programs.vscode = { enable = true; + mutableExtensionsDir = false; extensions = with pkgs.vscode-extensions; [ eamodio.gitlens - - # Language support - # TODO: Move to separate language modules - bbenoist.nix - rust-lang.rust-analyzer ]; userSettings = { @@ -45,8 +41,9 @@ in { "terminal.integrated.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'"; "terminal.integrated.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px - # Autoformatting + # Formatting "editor.formatOnSave" = true; + "editor.tabSize" = 4; # Layout "window.menuBarVisibility" = "hidden"; diff --git a/users/jan.nix b/users/jan.nix index 8f6cd82..ed9afda 100644 --- a/users/jan.nix +++ b/users/jan.nix @@ -29,7 +29,10 @@ discord.enable = true; qutebrowser.enable = true; neovim.enable = true; - rofi.enable = true; # TODO: Remove this, should be enabled by other modules that require rofi. + + # Programming languages + nix.enable = true; + rust.enable = true; # Enable unfree unfree.enable = true;