progress in multi user config

This commit is contained in:
Chris Kruining 2025-03-18 16:43:07 +01:00
parent f7891e1f30
commit 3a2f52f45e
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
68 changed files with 384 additions and 663 deletions

View file

@ -0,0 +1,39 @@
{
config,
options,
lib,
pkgs,
user,
...
}: let
inherit (lib.attrsets) attrValues;
inherit (lib.modules) mkIf mkMerge;
cfg = config.modules.${user}.desktop.editors;
in {
options.modules.${user}.desktop.editors = let
inherit (lib.options) mkOption;
inherit (lib.types) nullOr enum;
in {
default = mkOption {
type = nullOr (enum [ "nano" "nvim" "zed" "kate" ]);
default = "nano";
description = "Default editor for text manipulation";
example = "nvim";
};
};
config = mkMerge [
(mkIf (cfg.default != null) {
home-manager.users.${user}.home.sessionVariables = {
EDITOR = cfg.default;
};
})
(mkIf (cfg.default == "nvim") {
user.packages = attrValues {
inherit (pkgs) imagemagick editorconfig-core-c sqlite deno pandoc nuspell;
inherit (pkgs.hunspellDicts) en_GB nl_NL;
};
})
];
}

View file

@ -0,0 +1,16 @@
{ config, options, lib, pkgs, user, ... }:
let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
cfg = config.modules.${user}.desktop.editors.kate;
in
{
options.modules.${user}.desktop.editors.kate = let
inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "kate"; };
config = mkIf cfg.enable {
home-manager.users.${user}.programs.kate.enable = true;
};
}

View file

@ -0,0 +1,29 @@
{ config, options, lib, pkgs, user, ... }:
let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
cfg = config.modules.${user}.desktop.editors.nano;
in
{
options.modules.${user}.desktop.editors.nano = let
inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "nano"; };
config = mkIf cfg.enable {
home-manager.users.${user}.programs.nano = {
enable = true;
syntaxHighlight = true;
nanorc = ''
set autoindent
set jumpyscrolling
set linenumbers
set mouse
set saveonexit
set smarthome
set tabstospaces
set tabsize 2
'';
};
};
}

View file

@ -0,0 +1,38 @@
{ inputs, config, options, lib, pkgs, user, ... }:
let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
cfg = options.modules.${user}.desktop.editors.nvim;
in
{
imports = [
inputs.nvf.nixosModules.default
];
options.modules.${user}.desktop.editors.nvim = let
inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "neo-vim (nixvim)"; };
config = mkIf cfg.enable {
home-manager.users.${user}.programs.nvf = {
enable = true;
settings = {
vim = {
statusline.lualine.enable = true;
telescope.enable = true;
autocomplete.nvim-cmp.enable = true;
languages = {
enableLSP = true;
enableTreesitter = true;
nix.enable = true;
ts.enable = true;
rust.enable = true;
};
};
};
};
};
}

View file

@ -0,0 +1,19 @@
{ config, options, lib, pkgs, user, ... }:
let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
inherit (lib.attrsets) attrValues;
cfg = config.modules.${user}.desktop.editors.vscodium;
in
{
options.modules.${user}.desktop.editors.vscodium = let
inherit (lib.options) mkEnableOption;
in { enable = mkEnableOption "vscodium"; };
config = mkIf cfg.enable {
user.packages = attrValues {
inherit (pkgs) vscodium;
};
};
}

View file

@ -0,0 +1,61 @@
{ config, options, lib, pkgs, user, ... }: let
inherit (lib.modules) mkIf;
inherit (lib.attrsets) attrValues;
cfg = config.modules.${user}.desktop.editors.zed;
in {
options.modules.${user}.desktop.editors.zed = let
inherit (lib.options) mkEnableOption;
in {enable = mkEnableOption "zed";};
config = mkIf cfg.enable {
user.packages = with pkgs; [
zed-editor
];
home-manager.users.${user}.programs.zed-editor = {
enable = true;
extraPackages = with pkgs; [ nixd nil alejandra ];
extensions = ["nix" "toml" "html"];
userSettings = {
assistant.enabled = false;
vim_mode = false;
load_direnv = "shell_hook";
base_keymap = "JetBrains";
tabs = {
file_icons = true;
git_status = true;
};
project_panel.auto_reveal_entries = false;
hour_format = "hour24";
auto_update = false;
lsp = {
nixd = {};
nil = {
initialization_options = {
formatting = {
command = ["alejandra" "--quiet" "--"];
};
};
binary = {
path_lookup = true;
};
};
};
languages = {
"Nix" = {
language_servers = ["nixd" "nil"];
format_on_save = "on";
};
};
};
};
};
}