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"; url = "github:wfxr/forgit";
flake = false; flake = false;
}; };
# VSCode plugin
nix-flake-tools.url = "github:rastertail/nix-flake-tools";
}; };
outputs = inputs@{ self, agenix, home-manager, nixpkgs, utils, ... }: outputs = inputs@{ self, agenix, home-manager, nixpkgs, utils, ... }:

View File

@ -1,24 +1,29 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors; let cfg = config.modules.editors;
in { 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 = { home-manager.users.moritz = {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscode-fhsWithPackages (ps: with ps; [ git ]); package = pkgs.vscode-fhsWithPackages (ps: with ps; [ git ]);
extensions = with pkgs.vscode-extensions; extensions = with pkgs.vscode-extensions; [
[ bbenoist.nix
vscodevim.vim
dracula-theme.theme-dracula dracula-theme.theme-dracula
esbenp.prettier-vscode esbenp.prettier-vscode
github.copilot
pkgs.nix-flake-tools
pkief.material-icon-theme pkief.material-icon-theme
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{ vscodevim.vim
name = "copilot"; ];
publisher = "GitHub";
version = "1.7.3689";
sha256 = "16zrrymxfymc0039zf48vm22rxjs22mh9zkvkpg45grx2a2m19zh";
}];
}; };
}; };
}; };

View File

@ -1,28 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib; { {
imports = [ ./emacs.nix ./idea.nix ./vim.nix ./code.nix ]; 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, ... }: { config, lib, pkgs, inputs, ... }:
with lib;
let let
emacs = with pkgs; emacs = with pkgs;
((emacsPackagesFor emacsGcc).emacsWithPackages ((emacsPackagesFor emacsGcc).emacsWithPackages
(epkgs: [ epkgs.vterm epkgs.emacsql-sqlite3 ])); (epkgs: [ epkgs.vterm epkgs.emacsql-sqlite3 ]));
cfg = config.modules.editors; cfg = config.modules.editors.emacs;
in { 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 ]; fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
home-manager.users.moritz = { home-manager.users.moritz = {
@ -34,10 +42,11 @@ in {
## Module dependencies ## Module dependencies
# :checkers spell # :checkers spell
# (aspellWithDicts (ds: with ds; [ en en-computers en-science de ])) # (aspellWithDicts (ds: with ds; [ en en-computers en-science de ]))
hunspell (hunspellWithDicts [
hunspellDicts.en_GB-ize hunspellDicts.en_GB-ize
hunspellDicts.en_US hunspellDicts.en_US
hunspellDicts.de_DE hunspellDicts.de_DE
])
# :checkers grammar # :checkers grammar
languagetool languagetool
@ -71,6 +80,14 @@ in {
# :email # :email
mu mu
isync 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, ... }: { config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors; let cfg = config.modules.editors;
in { 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-manager.users.moritz = {
home.packages = with pkgs; [ jdk jetbrains.idea-ultimate ]; home.packages = with pkgs; [ jdk jetbrains.idea-ultimate ];
}; };

View File

@ -1,12 +1,27 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let cfg = config.modules.editors; let cfg = config.modules.editors;
in { 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 = { home-manager.users.moritz.programs.neovim = {
enable = true; enable = true;
vimAlias = true; vimAlias = true;
vimdiffAlias = 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: { final: prev: {
python-dev = import ./python.nix final prev; python-dev = import ./python.nix final prev;
fish = final.master.fish; fish = final.master.fish;
nix-flake-tools = inputs.nix-flake-tools.packages.${prev.system}.extension;
master = import inputs.master { master = import inputs.master {
inherit (prev) system; inherit (prev) system;
config.allowUnfree = true; config.allowUnfree = true;