make editors more modular

nixos
Moritz Böhme 2022-03-30 10:55:57 +02:00
parent daaf48fda3
commit a34c9e4ef5
No known key found for this signature in database
GPG Key ID: 213820E2795F5CF5
7 changed files with 71 additions and 45 deletions

View File

@ -30,6 +30,9 @@
url = "github:wfxr/forgit";
flake = false;
};
# VSCode plugin
nix-flake-tools.url = "github:rastertail/nix-flake-tools";
};
outputs = inputs@{ self, agenix, home-manager, nixpkgs, utils, ... }:

View File

@ -1,24 +1,29 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors;
in {
config = lib.mkIf cfg.code {
options.modules.editors = {
code = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.code {
home-manager.users.moritz = {
programs.vscode = {
enable = true;
package = pkgs.vscode-fhsWithPackages (ps: with ps; [ git ]);
extensions = with pkgs.vscode-extensions;
[
vscodevim.vim
dracula-theme.theme-dracula
esbenp.prettier-vscode
pkief.material-icon-theme
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{
name = "copilot";
publisher = "GitHub";
version = "1.7.3689";
sha256 = "16zrrymxfymc0039zf48vm22rxjs22mh9zkvkpg45grx2a2m19zh";
}];
extensions = with pkgs.vscode-extensions; [
bbenoist.nix
dracula-theme.theme-dracula
esbenp.prettier-vscode
github.copilot
pkgs.nix-flake-tools
pkief.material-icon-theme
vscodevim.vim
];
};
};
};

View File

@ -1,28 +1,5 @@
{ config, lib, pkgs, ... }:
with lib; {
{
imports = [ ./emacs.nix ./idea.nix ./vim.nix ./code.nix ];
options.modules.editors = {
emacs = mkOption {
default = true;
type = types.bool;
example = false;
};
idea = mkOption {
default = false;
type = types.bool;
example = true;
};
vim = mkOption {
default = true;
type = types.bool;
example = false;
};
code = mkOption {
default = false;
type = types.bool;
example = true;
};
};
}

View File

@ -1,12 +1,20 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
emacs = with pkgs;
((emacsPackagesFor emacsGcc).emacsWithPackages
(epkgs: [ epkgs.vterm epkgs.emacsql-sqlite3 ]));
cfg = config.modules.editors;
cfg = config.modules.editors.emacs;
in {
config = lib.mkIf cfg.emacs {
options.modules.editors = {
emacs = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg {
fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
home-manager.users.moritz = {
@ -34,10 +42,11 @@ in {
## Module dependencies
# :checkers spell
# (aspellWithDicts (ds: with ds; [ en en-computers en-science de ]))
hunspell
hunspellDicts.en_GB-ize
hunspellDicts.en_US
hunspellDicts.de_DE
(hunspellWithDicts [
hunspellDicts.en_GB-ize
hunspellDicts.en_US
hunspellDicts.de_DE
])
# :checkers grammar
languagetool
@ -71,6 +80,14 @@ in {
# :email
mu
isync
# :lang haskell
haskell-language-server
(haskellPackages.ghcWithPackages (p:
# general
[ p.brittany ] ++
# xmonad
[ p.xmonad p.xmonad-contrib p.xmonad-extras p.xmobar ]))
];
};
};

View File

@ -1,8 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors;
in {
config = lib.mkIf cfg.idea {
options.modules.editors = {
idea = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.idea {
home-manager.users.moritz = {
home.packages = with pkgs; [ jdk jetbrains.idea-ultimate ];
};

View File

@ -1,12 +1,27 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors;
in {
config = lib.mkIf cfg.vim {
options.modules.editors = {
vim = mkOption {
default = true;
type = types.bool;
example = false;
};
};
config = mkIf cfg.vim {
home-manager.users.moritz.programs.neovim = {
enable = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withPlugins (p: pkgs.tree-sitter.allGrammars))
coc-nvim
dracula-vim
];
withNodeJs = true;
withPython3 = true;
};
};
}

View File

@ -3,6 +3,7 @@
final: prev: {
python-dev = import ./python.nix final prev;
fish = final.master.fish;
nix-flake-tools = inputs.nix-flake-tools.packages.${prev.system}.extension;
master = import inputs.master {
inherit (prev) system;
config.allowUnfree = true;