This commit is contained in:
Jan-Bulthuis committed 2025-05-13 14:26:22 +02:00
1 parent 760815da50
commit 5e23488cae
42 files changed
+2205 -144

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.desktop.gnome;
in
{
options.modules.desktop.gnome = {
enable = mkEnableOption "gnome";
};
config = mkIf cfg.enable {
# TODO: Enable extensions with dconf
home.packages =
with pkgs;
[
gnome-control-center
gnome-tweaks
blackbox-terminal
]
++ (with pkgs.gnomeExtensions; [
gsconnect
disable-workspace-animation
]);
};
}
+20
View File
@@ -0,0 +1,20 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.desktop.tiling;
in
{
options.modules.desktop.tiling = {
enable = mkEnableOption "tiling desktop";
};
config = mkIf cfg.enable {
};
}
+53
View File
@@ -0,0 +1,53 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.modules.git;
in
{
options.modules.git = {
enable = mkEnableOption "git";
user = mkOption {
type = types.str;
description = "Default user name to use.";
};
email = mkOption {
type = types.str;
description = "Default user email to use.";
};
ignores = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Paths to globally ignore";
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
git
lazygit
];
programs.git = {
enable = true;
extraConfig = {
pull = {
rebase = false;
};
};
userName = cfg.user;
userEmail = cfg.email;
ignores = cfg.ignores;
};
};
}
@@ -0,0 +1,50 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.cpp;
in
{
options.modules.cpp = {
enable = mkEnableOption "cpp";
};
config = mkIf cfg.enable {
# Gitignore additions
modules.git.ignores = [
".ccls-cache"
];
# Development packages
home.packages = with pkgs; [
gnumake
gcc
];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [
ms-vscode.cpptools
ms-vscode.cmake-tools
ms-vscode.cpptools-extension-pack
];
userSettings = {
# TODO: Add setting to set the compiler, it currently needs to be set for each workspace individually
# "C_Cpp.clang_format_fallbackStyle" = "{ BasedOnStyle: Google, IndentWidth: 4 }";
};
};
};
# Neovim configuration
# programs.nixvim = {
# plugins.lsp.servers.ccls.enable = true;
# };
};
}
@@ -0,0 +1,42 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.haskell;
in
{
options.modules.haskell = {
enable = mkEnableOption "haskell";
};
config = mkIf cfg.enable {
# Development packages
home.packages = with pkgs; [
haskell.compiler.ghc948
(haskell-language-server.override { supportedGhcVersions = [ "948" ]; })
];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [
haskell.haskell
justusadam.language-haskell
];
userSettings = {
"[haskell]" = { };
# "haskell.formattingProvider" = "fourmolu";
};
};
};
# Neovim configuration
# programs.nixvim = { };
};
}
+38
View File
@@ -0,0 +1,38 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.js;
in
{
options.modules.js = {
enable = mkEnableOption "js";
};
config = mkIf cfg.enable {
# Development packages
home.packages = with pkgs; [
nodejs
tailwindcss
];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [
bradlc.vscode-tailwindcss
];
userSettings = { };
};
};
# Neovim configuration
# programs.nixvim = { };
};
}
@@ -0,0 +1,44 @@
{
lib,
config,
pkgs,
...
}:
# TODO: Move to a module for notebooks in general
with lib;
let
cfg = config.modules.jupyter;
in
{
options.modules.jupyter = {
enable = mkEnableOption "jupyter";
};
config = mkIf cfg.enable {
# Development packages
# home.packages = with pkgs; [
# evcxr
# ];
# modules.python.extraPythonPackages = p: [
# p.jupyter
# p.notebook
# ];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [
ms-toolsai.jupyter
ms-toolsai.jupyter-renderers
];
userSettings = { };
};
};
# Neovim configuration
# programs.nixvim = { };
};
}
@@ -0,0 +1,60 @@
{
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
];
# Add nix tree
xdg.desktopEntries.nix-tree = {
exec = "${pkgs.nix-tree}/bin/nix-tree";
name = "Nix Tree";
terminal = true;
type = "Application";
};
# VSCode configuration
programs.vscode = {
profiles.default = {
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 = {
# };
};
}
@@ -0,0 +1,52 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.python;
in
{
options.modules.python = {
enable = mkEnableOption "python";
extraPythonPackages = mkOption {
type = types.functionTo (types.listOf types.package) // {
merge =
loc: defs: p:
lib.concatMap (def: (def.value p)) defs;
};
default = p: [ ];
description = "Extra Python packages to install";
};
};
config = mkIf cfg.enable {
# Development packages
home.packages = [ ];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [
ms-python.python
ms-python.debugpy
ms-python.vscode-pylance
ms-python.black-formatter
];
userSettings = {
"python.defaultInterpreterPath" = "\${env:PYTHONINTERPRETER}";
"[python]" = {
"editor.defaultFormatter" = "ms-python.black-formatter";
};
};
};
};
# Neovim configuration
# programs.nixvim = { };
};
}
@@ -0,0 +1,59 @@
{
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; [
# rustup
# rustc
# cargo
# gcc
# lldb
# bacon
# rust-analyzer
# rustfmt
# clippy
# evcxr
];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [
rust-lang.rust-analyzer
vadimcn.vscode-lldb
tamasfe.even-better-toml
serayuzgur.crates
];
userSettings = {
"[rust]" = {
"editor.inlayHints.enabled" = "off";
};
"rust-analyzer.check.command" = "clippy";
"rust-analyzer.showUnlinkedFileNotification" = false;
};
};
};
# Neovim configuration
# programs.nixvim = {
# plugins.rustaceanvim = {
# enable = true;
# };
# };
};
}
@@ -0,0 +1,69 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.tex;
in
{
options.modules.tex = {
enable = mkEnableOption "tex";
};
config = mkIf cfg.enable {
# Development packages
home.packages = with pkgs; [
(texlive.combine {
inherit (texlive) scheme-full;
})
];
# Pygments for minted
modules.python.extraPythonPackages = p: [
p.pygments
];
# VSCode configuration
programs.vscode = {
profiles.default = {
extensions = with pkgs.vscode-extensions; [ jnoortheen.nix-ide ];
userSettings = {
"[tex]" = { };
};
};
};
# Neovim configuration
# programs.nixvim = {
# extraConfigVim = ''
# " Enforce latexmk
# let g:vimtex_compiler_method = 'latexmk'
# " Set latexmk compilation settings
# let g:vimtex_compiler_latexmk = {
# \ 'options': [
# \ '-shell-escape',
# \ '-verbose',
# \ '-file-line-error',
# \ '-synctex=1',
# \ '-interaction=nonstopmode',
# \ ],
# \}
# '';
# # Vimtex plugin
# plugins.vimtex = {
# enable = true;
# texlivePackage = null;
# settings = {
# view_method = "zathura";
# };
# };
# };
};
}
+27
View File
@@ -0,0 +1,27 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.mathematica;
my-mathematica = pkgs.mathematica.override {
# TODO: Just use a generic name for the installer?
# source = ./Wolfram_14.2.1_LIN_Bndl.sh;
};
in
{
options.modules.mathematica = {
enable = mkEnableOption "mathematica";
};
config = mkIf cfg.enable {
home.packages = [
my-mathematica
];
};
}
+190
View File
@@ -0,0 +1,190 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.neovim;
# theme = config.desktop.theming;
# colors = theme.colors;
in
{
options.modules.neovim = {
enable = mkEnableOption "neovim";
};
config = mkIf cfg.enable {
# programs.nixvim = {
# enable = true;
# defaultEditor = true;
# viAlias = true;
# vimAlias = true;
# # extraPackages = with pkgs; [ ];
# opts = {
# number = true;
# relativenumber = true;
# signcolumn = "yes";
# ignorecase = true;
# smartcase = true;
# tabstop = 4;
# shiftwidth = 4;
# softtabstop = 0;
# expandtab = true;
# smarttab = true;
# list = true;
# listchars = "tab:»┈«,trail:·,extends:→,precedes:←,nbsp:␣";
# };
# diagnostic.settings = {
# enable = true;
# signs = true;
# underline = true;
# update_in_insert = true;
# };
# extraConfigLua = ''
# vim.fn.sign_define("DiagnosticSignError",
# {text = "", texthl = "DiagnosticSignError"})
# vim.fn.sign_define("DiagnosticSignWarn",
# {text = "", texthl = "DiagnosticSignWarn"})
# vim.fn.sign_define("DiagnosticSignInfo",
# {text = "", texthl = "DiagnosticSignInfo"})
# vim.fn.sign_define("DiagnosticSignHint",
# {text = "💡", texthl = "DiagnosticSignHint"})
# '';
# keymaps = [
# # Save shortcut
# {
# action = ":update<CR>";
# key = "<C-s>";
# mode = "n";
# }
# {
# action = "<C-o>:update<CR>";
# key = "<C-s>";
# mode = "i";
# }
# # Neo tree
# {
# action = ":Neotree action=focus reveal toggle<CR>";
# key = "<leader>n";
# mode = "n";
# options.silent = true;
# }
# ];
# autoCmd = [
# {
# desc = "Automatic formatting";
# event = "BufWritePre";
# callback = {
# __raw = ''
# function()
# vim.lsp.buf.format {
# async = false,
# }
# end
# '';
# };
# }
# ];
# # highlight = {
# # Comment = {
# # italic = true;
# # fg = theme.schemeColors.withHashtag.base03; # TODO: Come up with a good name colors.muted maybe?
# # };
# # };
# plugins.lsp = {
# enable = true;
# };
# #plugins.treesitter = {
# # enable = true;
# #};
# plugins.cmp = {
# enable = true;
# settings = {
# mapping = {
# "<C-Space>" = "cmp.mapping.complete()";
# "<C-d>" = "cmp.mapping.scroll_docs(-4)";
# "<C-e>" = "cmp.mapping.close()";
# "<C-f>" = "cmp.mapping.scroll_docs(4)";
# "<CR>" = "cmp.mapping.confirm({ select = true })";
# "<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
# "<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
# };
# sources = [
# { name = "path"; }
# { name = "nvim_lsp"; }
# ];
# };
# };
# plugins.web-devicons = {
# enable = true;
# };
# plugins.neo-tree = {
# enable = true;
# closeIfLastWindow = true;
# window = {
# width = 30;
# autoExpandWidth = true;
# };
# extraOptions = {
# default_component_configs.git_status.symbols = {
# # Change type
# added = "+";
# deleted = "✕";
# modified = "✦";
# renamed = "→";
# # Status type
# untracked = "?";
# ignored = "▫";
# unstaged = "□";
# staged = "■";
# conflict = "‼";
# };
# };
# };
# #plugins.cmp-nvim-lsp.enable = true;
# plugins.gitsigns = {
# enable = true;
# settings.current_line_blame = true;
# };
# #plugins.copilot-vim = {
# # enable = true;
# #};
# # plugins.vimtex = {
# # enable = true;
# # texlivePackage = null;
# # settings = {
# # view_method = "zathura";
# # };
# # };
# };
# programs.neovim.defaultEditor = true;
};
}
+96
View File
@@ -0,0 +1,96 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.modules.vscode;
# theme = config.desktop.theming;
in
{
options.modules.vscode = {
enable = mkEnableOption "vscode";
# codeFont = mkOption {
# type = types.anything;
# default = theme.fonts.pkgs."Fira Code";
# };
# fallbackFont = mkOption {
# type = types.anything;
# default = theme.fonts.pkgs."Symbols Nerd Font Mono";
# };
};
config = mkIf cfg.enable {
# TODO: Fix theming
# desktop.theming.fonts.extraFonts = [ cfg.codeFont ];
programs.vscode = {
enable = true;
mutableExtensionsDir = false;
profiles.default = {
extensions = with pkgs.vscode-extensions; [
eamodio.gitlens
ms-vscode.hexeditor
mkhl.direnv
usernamehw.errorlens
gruntfuggly.todo-tree
github.copilot
github.copilot-chat
tomoki1207.pdf
ms-vsliveshare.vsliveshare
ms-vscode-remote.remote-ssh
];
userSettings =
let
# font-family = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
# TODO: Move the conversion factor to theme settings
# font-size = mkForce cfg.codeFont.recommendedSize; # Convert pt to px
in
{
# Font setup
# "editor.fontFamily" = font-family;
# "editor.inlayHints.fontFamily" = font-family;
# "editor.inlineSuggest.fontFamily" = font-family;
# "editor.fontSize" = font-size;
# "editor.fontLigatures" = true;
# "terminal.integrated.fontFamily" = font-family;
# "terminal.integrated.fontSize" = font-size;
# "chat.editor.fontFamily" = font-family; # TODO: Change this font to the standard UI font
# "chat.editor.fontSize" = font-size;
# "debug.console.fontFamily" = font-family;
# "debug.console.fontSize" = font-size;
# "scm.inputFontFamily" = font-family; # TODO: Change this font to the standard UI font
# "scm.inputFontSize" = font-size;
# "markdown.preview.fontFamily" = mkForce theme.fonts.sansSerif.name; # TODO: Change this font to the standard UI font
# "markdown.preview.fontSize" = mkForce theme.fonts.sansSerif.recommendedSize;
# Formatting
"editor.formatOnSave" = true;
"editor.tabSize" = 4;
# Layout
"window.menuBarVisibility" = "hidden";
# Git settings
"git.autofetch" = true;
"git.enableSmartCommit" = false;
"git.suggestSmartCommit" = false;
# Disable update notifications
"update.mode" = "none";
# TODO: Move to direnv module
# Ignore direnv folder
"files.exclude" = {
".direnv" = true;
};
};
};
};
};
}
+27
View File
@@ -0,0 +1,27 @@
{
lib,
config,
...
}:
with lib;
let
cfg = config.modules.bash;
in
{
options.modules.bash = {
enable = mkEnableOption "bash";
aliases = mkOption {
type = types.attrsOf types.str;
default = {
"..." = "cd ../..";
};
description = "Shell aliases";
};
};
config.programs.bash = {
enable = cfg.enable;
shellAliases = cfg.aliases;
};
}
+26
View File
@@ -0,0 +1,26 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.direnv;
in
{
options.modules.direnv = {
enable = mkEnableOption "direnv";
};
config = mkIf cfg.enable {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
modules.git.ignores = [
".direnv"
];
};
}
+57
View File
@@ -0,0 +1,57 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.fish;
in
{
options.modules.fish = {
enable = mkEnableOption "fish";
};
config = mkIf cfg.enable {
# Make bash load into fish
# Bash will remain the default shell as fish is not POSIX compliant.
modules.bash.enable = true;
programs.bash.initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
# Actual fish configuration
programs.fish = {
enable = true;
shellAliases = config.modules.bash.aliases;
plugins = [
{
name = "done";
src = pkgs.fishPlugins.done.src;
}
{
name = "fzf";
src = pkgs.fishPlugins.fzf-fish.src;
}
{
name = "grc";
src = pkgs.fishPlugins.grc.src;
}
];
};
# Fish plugin dependencies
home.packages = with pkgs; [
fzf
grc
];
};
}
+63
View File
@@ -0,0 +1,63 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.xpra;
in
{
options.modules.xpra = {
enable = mkEnableOption "Enable xpra";
hosts = mkOption {
type = types.listOf types.str;
default = { };
description = "xpra hosts";
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
xpra
];
xdg.desktopEntries = (
listToAttrs (
map
(entry: {
name = "xpra${
builtins.substring 0 12 (builtins.hashString "sha256" "${entry.name} (${entry.comment})")
}";
value = entry // {
type = "Application";
terminal = false;
genericName = entry.comment;
};
})
(
concatMap (
host:
let
uri = "tcp://${host}:15151/7";
in
[
{
name = "Xpra - Attach";
comment = host;
exec = "xpra attach --min-quality=100 --min-speed=100 --encoding=png --speaker=off ${uri}";
}
{
name = "Xpra - Detach";
comment = host;
exec = "xpra detach ${uri}";
}
]
) cfg.hosts
)
)
);
};
}