From 3b5a73c436eb22e0cda59469263490705e149cb9 Mon Sep 17 00:00:00 2001 From: schererleander Date: Fri, 9 Jan 2026 16:57:15 +0100 Subject: refactor: use flake-parts, change modules structure --- modules/flake/darwin.nix | 22 ++ modules/flake/home.nix | 22 ++ modules/flake/nixos.nix | 45 ++++ modules/flake/systems.nix | 9 + modules/home/browsers/firefox/default.nix | 273 +++++++++++++++++++ modules/home/cli/opencode/default.nix | 26 ++ modules/home/cli/tmux/default.nix | 50 ++++ modules/home/editors/neovim/default.nix | 114 ++++++++ modules/home/editors/neovim/init.lua | 239 +++++++++++++++++ modules/home/editors/vscode/default.nix | 139 ++++++++++ modules/home/editors/zed/default.nix | 91 +++++++ modules/home/git/default.nix | 77 ++++++ modules/home/gpg/default.nix | 62 +++++ modules/home/media/nixcord/default.nix | 36 +++ modules/home/media/spicetify/default.nix | 39 +++ modules/home/productivity/anki/default.nix | 24 ++ modules/home/productivity/latex/default.nix | 43 +++ modules/home/shells/bash/default.nix | 40 +++ modules/home/shells/zsh/default.nix | 66 +++++ modules/home/terminal/kitty.nix | 33 +++ modules/home/zathura/default.nix | 37 +++ modules/hosts/audio/default.nix | 29 -- modules/hosts/default.nix | 15 -- modules/hosts/desktop/cinnamon/default.nix | 27 -- modules/hosts/desktop/default.nix | 17 -- modules/hosts/desktop/dunst.nix | 47 ---- modules/hosts/desktop/gnome/default.nix | 33 --- modules/hosts/desktop/hyprland/default.nix | 283 -------------------- modules/hosts/desktop/kde/default.nix | 26 -- modules/hosts/desktop/labwc/default.nix | 296 --------------------- modules/hosts/desktop/sway/default.nix | 181 ------------- modules/hosts/desktop/waybar.nix | 119 --------- modules/hosts/dns/default.nix | 60 ----- modules/hosts/mullvad-vpn/default.nix | 18 -- modules/hosts/openssh/default.nix | 25 -- modules/hosts/printer/default.nix | 32 --- modules/hosts/server/default.nix | 29 -- modules/hosts/server/fail2ban/default.nix | 31 --- modules/hosts/server/nextcloud/default.nix | 156 ----------- modules/hosts/server/nginx/default.nix | 56 ---- modules/hosts/server/openssh/default.nix | 53 ---- modules/hosts/server/site/default.nix | 32 --- modules/hosts/steam/default.nix | 39 --- modules/hosts/wooting/default.nix | 26 -- modules/nixos/desktop/cinnamon/default.nix | 19 ++ modules/nixos/desktop/gnome/default.nix | 22 ++ modules/nixos/desktop/kde/default.nix | 18 ++ modules/nixos/dns/default.nix | 44 +++ modules/nixos/hardware/audio/default.nix | 19 ++ modules/nixos/hardware/bluetooth/default.nix | 24 ++ modules/nixos/hardware/printer/default.nix | 20 ++ modules/nixos/hardware/wooting/default.nix | 13 + modules/nixos/mullvad-vpn/default.nix | 13 + modules/nixos/openssh/default.nix | 21 ++ modules/nixos/plymouth/default.nix | 36 +++ modules/nixos/server/fail2ban/default.nix | 25 ++ modules/nixos/server/nextcloud/default.nix | 159 +++++++++++ modules/nixos/server/nginx/default.nix | 54 ++++ modules/nixos/server/openssh/default.nix | 54 ++++ modules/nixos/server/site/default.nix | 28 ++ modules/nixos/steam/default.nix | 28 ++ modules/users/browsers/default.nix | 6 - modules/users/browsers/firefox/default.nix | 276 ------------------- modules/users/cli/default.nix | 7 - modules/users/cli/opencode/default.nix | 30 --- modules/users/cli/tmux/default.nix | 55 ---- modules/users/default.nix | 16 -- modules/users/editors/default.nix | 8 - modules/users/editors/neovim/default.nix | 109 -------- modules/users/editors/neovim/init.lua | 225 ---------------- modules/users/editors/vscode/default.nix | 142 ---------- modules/users/editors/zed/default.nix | 94 ------- modules/users/git/default.nix | 81 ------ modules/users/gpg/default.nix | 62 ----- modules/users/media/default.nix | 7 - modules/users/media/nixcord/default.nix | 40 --- modules/users/media/spicetify/default.nix | 43 --- modules/users/productivity/anki/default.nix | 28 -- modules/users/productivity/default.nix | 10 - modules/users/productivity/latex/default.nix | 47 ---- .../productivity/nextcloud-client/default.nix | 28 -- modules/users/productivity/obsidian/default.nix | 23 -- modules/users/productivity/typst/default.nix | 25 -- modules/users/shells/bash/default.nix | 43 --- modules/users/shells/default.nix | 7 - modules/users/shells/zsh/default.nix | 69 ----- modules/users/terminal/default.nix | 36 --- modules/users/terminal/foot.nix | 57 ---- modules/users/terminal/kitty.nix | 33 --- modules/users/zathura/default.nix | 41 --- 90 files changed, 2084 insertions(+), 3278 deletions(-) create mode 100644 modules/flake/darwin.nix create mode 100644 modules/flake/home.nix create mode 100644 modules/flake/nixos.nix create mode 100644 modules/flake/systems.nix create mode 100644 modules/home/browsers/firefox/default.nix create mode 100644 modules/home/cli/opencode/default.nix create mode 100644 modules/home/cli/tmux/default.nix create mode 100644 modules/home/editors/neovim/default.nix create mode 100644 modules/home/editors/neovim/init.lua create mode 100644 modules/home/editors/vscode/default.nix create mode 100644 modules/home/editors/zed/default.nix create mode 100644 modules/home/git/default.nix create mode 100644 modules/home/gpg/default.nix create mode 100644 modules/home/media/nixcord/default.nix create mode 100644 modules/home/media/spicetify/default.nix create mode 100644 modules/home/productivity/anki/default.nix create mode 100644 modules/home/productivity/latex/default.nix create mode 100644 modules/home/shells/bash/default.nix create mode 100644 modules/home/shells/zsh/default.nix create mode 100644 modules/home/terminal/kitty.nix create mode 100644 modules/home/zathura/default.nix delete mode 100644 modules/hosts/audio/default.nix delete mode 100644 modules/hosts/default.nix delete mode 100644 modules/hosts/desktop/cinnamon/default.nix delete mode 100644 modules/hosts/desktop/default.nix delete mode 100644 modules/hosts/desktop/dunst.nix delete mode 100644 modules/hosts/desktop/gnome/default.nix delete mode 100644 modules/hosts/desktop/hyprland/default.nix delete mode 100644 modules/hosts/desktop/kde/default.nix delete mode 100644 modules/hosts/desktop/labwc/default.nix delete mode 100644 modules/hosts/desktop/sway/default.nix delete mode 100644 modules/hosts/desktop/waybar.nix delete mode 100644 modules/hosts/dns/default.nix delete mode 100644 modules/hosts/mullvad-vpn/default.nix delete mode 100644 modules/hosts/openssh/default.nix delete mode 100644 modules/hosts/printer/default.nix delete mode 100644 modules/hosts/server/default.nix delete mode 100644 modules/hosts/server/fail2ban/default.nix delete mode 100644 modules/hosts/server/nextcloud/default.nix delete mode 100644 modules/hosts/server/nginx/default.nix delete mode 100644 modules/hosts/server/openssh/default.nix delete mode 100644 modules/hosts/server/site/default.nix delete mode 100644 modules/hosts/steam/default.nix delete mode 100644 modules/hosts/wooting/default.nix create mode 100644 modules/nixos/desktop/cinnamon/default.nix create mode 100644 modules/nixos/desktop/gnome/default.nix create mode 100644 modules/nixos/desktop/kde/default.nix create mode 100644 modules/nixos/dns/default.nix create mode 100644 modules/nixos/hardware/audio/default.nix create mode 100644 modules/nixos/hardware/bluetooth/default.nix create mode 100644 modules/nixos/hardware/printer/default.nix create mode 100644 modules/nixos/hardware/wooting/default.nix create mode 100644 modules/nixos/mullvad-vpn/default.nix create mode 100644 modules/nixos/openssh/default.nix create mode 100644 modules/nixos/plymouth/default.nix create mode 100644 modules/nixos/server/fail2ban/default.nix create mode 100644 modules/nixos/server/nextcloud/default.nix create mode 100644 modules/nixos/server/nginx/default.nix create mode 100644 modules/nixos/server/openssh/default.nix create mode 100644 modules/nixos/server/site/default.nix create mode 100644 modules/nixos/steam/default.nix delete mode 100644 modules/users/browsers/default.nix delete mode 100644 modules/users/browsers/firefox/default.nix delete mode 100644 modules/users/cli/default.nix delete mode 100644 modules/users/cli/opencode/default.nix delete mode 100644 modules/users/cli/tmux/default.nix delete mode 100644 modules/users/default.nix delete mode 100644 modules/users/editors/default.nix delete mode 100644 modules/users/editors/neovim/default.nix delete mode 100644 modules/users/editors/neovim/init.lua delete mode 100644 modules/users/editors/vscode/default.nix delete mode 100644 modules/users/editors/zed/default.nix delete mode 100644 modules/users/git/default.nix delete mode 100644 modules/users/gpg/default.nix delete mode 100644 modules/users/media/default.nix delete mode 100644 modules/users/media/nixcord/default.nix delete mode 100644 modules/users/media/spicetify/default.nix delete mode 100644 modules/users/productivity/anki/default.nix delete mode 100644 modules/users/productivity/default.nix delete mode 100644 modules/users/productivity/latex/default.nix delete mode 100644 modules/users/productivity/nextcloud-client/default.nix delete mode 100644 modules/users/productivity/obsidian/default.nix delete mode 100644 modules/users/productivity/typst/default.nix delete mode 100644 modules/users/shells/bash/default.nix delete mode 100644 modules/users/shells/default.nix delete mode 100644 modules/users/shells/zsh/default.nix delete mode 100644 modules/users/terminal/default.nix delete mode 100644 modules/users/terminal/foot.nix delete mode 100644 modules/users/terminal/kitty.nix delete mode 100644 modules/users/zathura/default.nix (limited to 'modules') diff --git a/modules/flake/darwin.nix b/modules/flake/darwin.nix new file mode 100644 index 0000000..84eb74d --- /dev/null +++ b/modules/flake/darwin.nix @@ -0,0 +1,22 @@ +{ inputs, config, self, ... }: + +{ + flake.darwinConfigurations = { + lilith = inputs.nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { inherit inputs; host = "lilith"; }; + modules = [ + inputs.home-manager.darwinModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.sharedModules = [ config.flake.homeModules.default ]; + } + (self + /hosts/lilith/configuration.nix) + { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + } + ]; + }; + }; +} diff --git a/modules/flake/home.nix b/modules/flake/home.nix new file mode 100644 index 0000000..288b558 --- /dev/null +++ b/modules/flake/home.nix @@ -0,0 +1,22 @@ +{ inputs, self, ... }: + +let + inherit (inputs.nixpkgs) lib; + import-tree = inputs.import-tree.withLib lib; + + homeModuleFiles = import-tree.leafs (self + /modules/home); +in +{ + imports = [ + inputs.home-manager.flakeModules.home-manager + ]; + + flake.homeModules = { + default = { + imports = homeModuleFiles ++ [ + inputs.nixcord.homeModules.nixcord + inputs.spicetify-nix.homeManagerModules.spicetify + ]; + }; + }; +} diff --git a/modules/flake/nixos.nix b/modules/flake/nixos.nix new file mode 100644 index 0000000..efc6d15 --- /dev/null +++ b/modules/flake/nixos.nix @@ -0,0 +1,45 @@ +{ inputs, config, self, ... }: + +let + inherit (inputs.nixpkgs) lib; + import-tree = inputs.import-tree.withLib lib; + + # Use import-tree.leafs to get list of NixOS module paths + nixosModuleFiles = import-tree.leafs (self + /modules/nixos); + + # Common NixOS modules for all hosts + commonNixosModules = nixosModuleFiles ++ [ + { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + } + ]; + + # Home-manager modules for hosts that use it + homeManagerModules = [ + inputs.home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.sharedModules = [ config.flake.homeModules.default ]; + } + ]; +in +{ + flake.nixosConfigurations = { + adam = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; host = "adam"; }; + modules = commonNixosModules ++ homeManagerModules ++ [ + (self + /hosts/adam/configuration.nix) + ]; + }; + + sachiel = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; host = "sachiel"; }; + modules = commonNixosModules ++ [ + (self + /hosts/sachiel/configuration.nix) + ]; + }; + }; +} diff --git a/modules/flake/systems.nix b/modules/flake/systems.nix new file mode 100644 index 0000000..e66e2e1 --- /dev/null +++ b/modules/flake/systems.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + # Define systems for perSystem (even if we don't use it much) + systems = [ + "x86_64-linux" + "aarch64-darwin" + ]; +} diff --git a/modules/home/browsers/firefox/default.nix b/modules/home/browsers/firefox/default.nix new file mode 100644 index 0000000..2cb0656 --- /dev/null +++ b/modules/home/browsers/firefox/default.nix @@ -0,0 +1,273 @@ +{ + pkgs, + inputs, + config, + lib, + ... +}: +let + + cfg = config.nx.browsers.firefox; + inherit (lib) + mkEnableOption + mkOption + types + mkIf + optionalString + optionalAttrs + ; +in +{ + + options.nx.browsers.firefox = { + enable = mkEnableOption "mozilla firefox"; + blockGoogle = mkOption { + description = "blocks google banner and other"; + type = types.bool; + default = true; + }; + transparent = mkOption { + description = "make firefox transparent"; + type = types.bool; + default = false; + }; + cleanHome = mkOption { + description = "clean up firefox home"; + type = types.bool; + default = true; + }; + hideRecommendations = mkOption { + description = "hide firefox recommendations"; + type = types.bool; + default = true; + }; + disablePasswordManager = mkOption { + description = "disable built-in browser password manager"; + type = types.bool; + default = true; + }; + }; + + config = mkIf cfg.enable { + programs.firefox = { + enable = true; + profiles.default = { + extensions = { + packages = with inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}; [ + ublock-origin + istilldontcareaboutcookies + sponsorblock + decentraleyes + vimium-c + ]; + + force = true; + + settings."uBlock0@raymondhill.net".settings = { + UserMessaging = { + uiTheme = "dark"; + uiAccentCustom = true; + uiAccentCustom0 = "#2C2C2C"; + cloudStorageEnabled = false; + contextMenuEnabled = false; + }; + # Block annoying login with google banner + userFilters = optionalString cfg.blockGoogle '' + ||accounts.google.com/gsi/* + ''; + }; + }; + + search = { + default = "DuckDuckGo"; + engines = { + nix-packages = { + name = "Nix Packages"; + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + + nixos-wiki = { + name = "NixOS Wiki"; + urls = [ { template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; } ]; + iconMapObj."16" = "https://wiki.nixos.org/favicon.ico"; + definedAliases = [ "@nw" ]; + }; + + bing.metaData.hidden = true; + google.metaData.alias = "@g"; + }; + force = true; + }; + + userChrome = optionalString cfg.transparent '' + /* Hide Back, Forward, Reload, Stop, All Tabs, Firefox View buttons */ + #back-button, + #forward-button, + #reload-button, + #stop-button, + #alltabs-button, + #firefox-view-button { + display: none !important; + } + + .titlebar-buttonbox-container { + display: none; + } + + #tabbrowser-tabs { + border-inline: none !important; + } + + /* Transparent background tabs (above url bar) */ + #navigator-toolbox { + -moz-appearance: -moz-vibrant-titlebar !important; + background: rgba(0, 0, 0, 0.8) !important; + } + + /* Transparent background (behind url bar) */ + #nav-bar { + background: none !important; + box-shadow: none !important; + border-top: 0px !important; + } + + .tab-background[selected="true"] { + background-color: #393e43 !important; + background-image: none !important; + } + + .tab-background { + background-color: var(--background) !important; + color: var(--foreground) !important; + box-shadow: none !important;; + } + + .tab-background[selected] { + background-color: rgba(0, 0, 0, 0.30) !important; + color: var(--foreground) !important; + box-shadow: none !important; + } + + /* Needed for transparency in general */ + :root { + --tabpanel-background-color: transparent !important; + --chrome-content-separator-color: transparent !important; + --toolbar-bgcolor: rgba(0, 0, 0, 0.9) !important; + --newtab-background-color: rgba(0, 0, 0, 0.9) !important; + --newtab-background-color-secondary: transparent !important; + --toolbar-field-background-color: rgba(120, 120, 120, 0.10) !important; + } + ''; + userContent = optionalString cfg.transparent '' + @-moz-document url-prefix("about:"), url("about:home") { + /* Transparent about:settings about:config about:policies */ + :root { + background: rgba(0, 0, 0, 0.0) !important; + } + } + + /* Transparent about:home */ + * { + --newtab-background-color: transparent !important; + --newtab-background-color-secondary: transparent !important; + } + + /* Transparent elements in about:* */ + * { + --in-content-page-background: transparent !important; + --background-color-box: rgba(0, 0, 0, 0.5) !important; + } + ''; + }; + + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + PasswordManagerEnabled = !cfg.disablePasswordManager; + OfferToSaveLogins = !cfg.disablePasswordManager; + DisplayBookmarksToolbar = "never"; + NoDefaultBookmarks = true; + + Homepage = optionalAttrs cfg.cleanHome { + URL = "about:blank"; + Locked = true; + StartPage = "homepage"; + }; + + NewTabPage = !cfg.cleanHome; + + PictureInPicture = { + Enabled = false; + }; + + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + + EncryptedMediaExtensions = { + Enabled = true; + Locked = true; + }; + + FirefoxHome = { + Search = true; + TopSites = true; + SponsoredTopSites = !cfg.cleanHome; + Highlights = true; + Pocket = !cfg.cleanHome; + SponsoredPocket = !cfg.cleanHome; + Locked = true; + }; + + UserMessaging = { + ExtensionRecommendations = !cfg.hideRecommendations; + FeatureRecommendations = !cfg.hideRecommendations; + Locked = true; + MoreFromMozilla = !cfg.hideRecommendations; + SkipOnboarding = true; + UrlbarInterventions = !cfg.hideRecommendations; + }; + + Preferences = { + # Disable fullscreen notification + "full-screen-api.warning.timeout" = "0"; + + # Disable annoying translation popup + "browser.translations.automaticallyPopup" = false; + + # Enable all extensions automatically + "extensions.autoDisableScopes" = 0; + + # Hide ctr-tab tab preview menu + "browser.ctrlTab.sortByRecentlyUsed" = false; + } + // optionalAttrs cfg.transparent { + # transparency + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.tabs.allow_transparent_browser" = true; + "gfx.webrender.all" = true; + }; + }; + }; + }; +} diff --git a/modules/home/cli/opencode/default.nix b/modules/home/cli/opencode/default.nix new file mode 100644 index 0000000..48be861 --- /dev/null +++ b/modules/home/cli/opencode/default.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + ... +}: +let + cfg = config.nx.cli.opencode; + inherit (lib) mkEnableOption mkIf; +in +{ + + options.nx.cli.opencode = { + enable = mkEnableOption "opencode open source ai coding agent"; + }; + + config = mkIf cfg.enable { + programs.opencode = { + enable = true; + settings = { + theme = "system"; + share = "disabled"; + autoupdate = false; + }; + }; + }; +} diff --git a/modules/home/cli/tmux/default.nix b/modules/home/cli/tmux/default.nix new file mode 100644 index 0000000..989851c --- /dev/null +++ b/modules/home/cli/tmux/default.nix @@ -0,0 +1,50 @@ +{ + config, + pkgs, + lib, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.cli.tmux; + +in +{ + options.nx.cli.tmux = { + enable = mkEnableOption "tmux"; + }; + config = mkIf cfg.enable { + programs.tmux = { + enable = true; + keyMode = "vi"; + secureSocket = true; + terminal = "xterm-256color"; + extraConfig = '' + unbind C-b + set-option -g prefix C-a + bind-key C-a send-prefix + bind -n M-Left select-pane -L + bind -n M-Right select-pane -R + bind -n M-Up select-pane -U + bind -n M-Down select-pane -D + + # style + set -g status-position top + set -g status-justify absolute-centre + set -g status-style 'fg=color7 bg=default' + set -g status-right "" + # set -g status-right ' #(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)' + # set -g status-right "" + set -g status-left '#S' + set -g status-left-style 'fg=color8' + set -g status-right-length 0 + set -g status-left-length 100 + setw -g window-status-current-style 'fg=colour6 bg=default bold' + setw -g window-status-current-format '#I:#W ' + setw -g window-status-style 'fg=color8' + + set -g mouse on + ''; + }; + }; +} diff --git a/modules/home/editors/neovim/default.nix b/modules/home/editors/neovim/default.nix new file mode 100644 index 0000000..c9d30db --- /dev/null +++ b/modules/home/editors/neovim/default.nix @@ -0,0 +1,114 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) + mkOption + types + mkIf + optionals + ; + cfg = config.nx.editors.neovim; +in +{ + options.nx.editors.neovim = { + enable = mkOption { + description = "Neovim editor"; + type = types.bool; + default = true; + }; + + langs = { + python = mkOption { + description = "enable the python integration"; + type = types.bool; + default = false; + }; + go = mkOption { + description = "enable go integration"; + type = types.bool; + default = false; + }; + ts = mkOption { + description = "enable the js/ts integration"; + type = types.bool; + default = false; + }; + nix = mkOption { + description = "enable the nix integration"; + type = types.bool; + default = true; + }; + lua = mkOption { + description = "enable the lua integration"; + type = types.bool; + default = true; + }; + latex = mkOption { + description = "enable latex integration"; + type = types.bool; + default = false; + }; + typst = mkOption { + description = "enable typst integration"; + type = types.bool; + default = false; + }; + }; + }; + + config = mkIf cfg.enable { + programs.neovim = { + defaultEditor = true; + enable = true; + package = pkgs.neovim-unwrapped; + extraPackages = + with pkgs; + [ + tree-sitter + git + ripgrep + fd + gcc + ] + ++ (optionals cfg.langs.ts [ pkgs.nodePackages.typescript-language-server ]) + ++ (optionals cfg.langs.python [ ]) + ++ (optionals cfg.langs.go [ pkgs.gopls ]) + ++ (optionals cfg.langs.nix [ + pkgs.nil + pkgs.nixfmt + ]) + ++ (optionals cfg.langs.lua [ pkgs.lua-language-server ]) + ++ (optionals cfg.langs.latex [ pkgs.texlab ]) + ++ (optionals cfg.langs.typst [ pkgs.tinymist ]); + + plugins = with pkgs.vimPlugins; [ + gruvbox-nvim + mini-starter + gitsigns-nvim + nvim-autopairs + telescope-nvim + fidget-nvim + plenary-nvim + nvim-treesitter.withAllGrammars + nvim-lspconfig + nvim-cmp + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp-cmdline + luasnip + cmp_luasnip + lspkind-nvim + ]; + + extraConfig = '' + luafile ${./init.lua} + ''; + }; + }; +} diff --git a/modules/home/editors/neovim/init.lua b/modules/home/editors/neovim/init.lua new file mode 100644 index 0000000..141eb3c --- /dev/null +++ b/modules/home/editors/neovim/init.lua @@ -0,0 +1,239 @@ +-- General settings +vim.g.mapleader = " " +vim.o.number = true +vim.o.relativenumber = true +vim.o.signcolumn = "yes" +vim.o.termguicolors = true +vim.o.wrap = false +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 +vim.o.swapfile = false +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.winborder = "rounded" +vim.o.clipboard = "unnamedplus" + +local map = vim.keymap.set +map('n', 'o', 'updatesource %', { desc = 'Save & reload init.lua' }) +map('n', 'w', 'write') +map('n', 'q', 'quit') + + +require("mini.starter").setup({ + header = table.concat({ + " /l、 ", + "(゚、 。 7 ", + " l ~ ヽ ", + " じしf_,)ノ ", + }, "\n"), + footer = "", + content_hooks = { + require("mini.starter").gen_hook.adding_bullet("» "), + require("mini.starter").gen_hook.aligning("center", "center"), + }, +}) + +require("gitsigns").setup() +require("nvim-autopairs").setup() +require("fidget").setup() + +vim.cmd("colorscheme gruvbox") + +local hl = vim.api.nvim_set_hl +hl(0, 'Normal', { bg = 'none' }) +hl(0, 'NormalFloat', { bg = 'none' }) +hl(0, 'NormalNC', { bg = 'none' }) +hl(0, 'StatusLine', { bg = 'none' }) +hl(0, 'SignColumn', { bg = 'none' }) +hl(0, "DiagnosticError", { bg = "none" }) +hl(0, "DiagnosticSignError", { bg = "none" }) +hl(0, "DiagnosticSignHint", { bg = "none" }) +hl(0, "DiagnosticSignInfo", { bg = "none" }) +hl(0, "DiagnosticSignWarn", { bg = "none" }) + +hl(0, "Pmenu", { bg = "none" }) +hl(0, "PmenuSel", { bg = "none" }) +hl(0, "FloatBorder", { bg = "none" }) + +local status_ok, configs = pcall(require, "nvim-treesitter.configs") +if status_ok then + configs.setup({ + highlight = { enable = true }, + indent = { enable = true }, + }) +end + +local builtin = require('telescope.builtin') +local map = vim.keymap.set +map('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) +map('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) +map('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) +map('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) + + +local cmp = require("cmp") +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { 'i', 's' }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + }) +}) + +-- Add parentheses after selecting function or method +local cmp_autopairs = require('nvim-autopairs.completion.cmp') +cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() +) + +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + local opts = { buffer = ev.buf, noremap = true, silent = true } + vim.keymap.set('n', 'lf', function() vim.lsp.buf.format { async = true } end, opts) + end, +}) + +-- Format on save for all languages with LSP support +vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('FormatOnSave', {}), + callback = function() + local clients = vim.lsp.get_clients({ bufnr = 0 }) + for _, client in ipairs(clients) do + if client.supports_method('textDocument/formatting') then + vim.lsp.buf.format({ async = false }) + return + end + end + end, +}) + +-- Native LSP setup (Neovim v0.11+) +vim.lsp.config('nixd', { + cmd = { 'nixd' }, + capabilities = capabilities, + settings = { + nixd = { + formatting = { + command = { "nixfmt" }, + }, + }, + }, +}) + +vim.lsp.config('nil_ls', { + cmd = { 'nil' }, + capabilities = capabilities, + settings = { + ['nil'] = { + nix = { + flake = { + autoArchive = true, + }, + }, + }, + }, +}) + +vim.lsp.config('lua_ls', { + cmd = { 'lua-language-server' }, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = { 'vim', 'require' }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + }, + telemetry = { + enable = false, + }, + }, + }, +}) + +vim.lsp.config('pyright', { + cmd = { 'pyright-langserver', '--stdio' }, + capabilities = capabilities, +}) + +vim.lsp.config('tailwindcss', { + cmd = { 'tailwindcss-language-server', '--stdio' }, + capabilities = capabilities, +}) + +vim.lsp.config('gopls', { + cmd = { 'gopls' }, + capabilities = capabilities, + settings = { + gopls = { + analyses = { + unusedparams = true, + unusedwrite = true, + }, + staticcheck = true, + }, + }, +}) + +vim.lsp.config('rust_analyzer', { + cmd = { 'rust-analyzer' }, + capabilities = capabilities, +}) + +vim.lsp.config('ts_ls', { + cmd = { 'typescript-language-server', '--stdio' }, + capabilities = capabilities, +}) + +-- Enable all configured servers +vim.lsp.enable('nixd') +vim.lsp.enable('nil_ls') +vim.lsp.enable('lua_ls') +vim.lsp.enable('pyright') +vim.lsp.enable('tailwindcss') +vim.lsp.enable('gopls') +vim.lsp.enable('rust_analyzer') +vim.lsp.enable('ts_ls') + +vim.diagnostic.config({ + virtual_text = { source = "if_many" }, + underline = true, + severity_sort = true, +}) diff --git a/modules/home/editors/vscode/default.nix b/modules/home/editors/vscode/default.nix new file mode 100644 index 0000000..9762d92 --- /dev/null +++ b/modules/home/editors/vscode/default.nix @@ -0,0 +1,139 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) + mkEnableOption + mkOption + types + mkIf + optionals + ; + cfg = config.nx.editors.vscode; +in +{ + options.nx.editors.vscode = { + enable = mkEnableOption "vscode editor"; + + useVSCodium = mkOption { + description = "Use vscodium instead of vscode"; + type = types.bool; + default = false; + }; + + theme = mkOption { + description = "Theme to use for vscode"; + type = types.enum [ + "minimal" + "dark" + "light" + ]; + default = "minimal"; + }; + + langs = { + cmake = mkOption { + description = "enable cmake integration"; + type = types.bool; + default = false; + }; + docker = mkOption { + description = "enable docker integration"; + type = types.bool; + default = false; + }; + python = mkOption { + description = "enable python integration"; + type = types.bool; + default = false; + }; + go = mkOption { + description = "enable go integration"; + type = types.bool; + default = false; + }; + rust = mkOption { + description = "enable rust integration"; + type = types.bool; + default = false; + }; + java = mkOption { + description = "enable java integration"; + type = types.bool; + default = false; + }; + lua = mkOption { + description = "enable lua integration"; + type = types.bool; + default = false; + }; + tailwindcss = mkOption { + description = "enable tailwindcss integration"; + type = types.bool; + default = false; + }; + }; + }; + + config = mkIf cfg.enable { + programs.vscode = { + enable = true; + package = if cfg.useVSCodium then pkgs.vscodium else pkgs.vscode; + mutableExtensionsDir = false; + profiles.default = { + enableUpdateCheck = true; + enableExtensionUpdateCheck = true; + + userSettings = { + "update.mode" = "none"; + "workbench.colorTheme" = + if cfg.theme == "minimal" then + "Minimal" + else if cfg.theme == "dark" then + "Default Dark Modern" + else + "Default Light Modern"; + "editor.fontFamily" = "monospace"; + "editor.tabSize" = 2; + "editor.minimap.enabled" = false; + "terminal.integrated.cursorStyle" = "underline"; + "terminal.integrated.cursorStyleInactive" = "underline"; + "terminal.integrated.fontFamily" = "monospace"; + "terminal.integrated.fontSize" = 13; + "git.autofetch" = true; + "window.controlsStyle" = "custom"; + }; + + extensions = + with pkgs.vscode-extensions; + [ + github.copilot + adpyke.codesnap + esbenp.prettier-vscode + ] + ++ (optionals cfg.langs.cmake [ ms-vscode.cmake-tools ]) + ++ (optionals cfg.langs.docker [ ms-azuretools.vscode-docker ]) + ++ (optionals cfg.langs.python [ ms-python.python ]) + ++ (optionals cfg.langs.go [ golang.go ]) + ++ (optionals cfg.langs.rust [ rust-lang.rust-analyzer ]) + ++ (optionals cfg.langs.java [ vscjava.vscode-maven ]) + ++ (optionals cfg.langs.lua [ sumneko.lua ]) + ++ (optionals cfg.langs.tailwindcss [ bradlc.vscode-tailwindcss ]) + ++ (optionals (cfg.theme == "minimal") ( + pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "minimalist-dark"; + publisher = "nichabosh"; + version = "1.0.0"; + sha256 = "sha256-lw+Scfada6DycLdRT2Cz+Fd12JucglIrw3uRd2ZhabQ="; + } + ] + )); + }; + }; + }; +} diff --git a/modules/home/editors/zed/default.nix b/modules/home/editors/zed/default.nix new file mode 100644 index 0000000..431560c --- /dev/null +++ b/modules/home/editors/zed/default.nix @@ -0,0 +1,91 @@ +{ + config, + lib, + ... +}: + +let + inherit (lib) + mkEnableOption + mkOption + types + mkIf + optionals + ; + cfg = config.nx.editors.zed-editor; +in +{ + options.nx.editors.zed-editor = { + enable = mkEnableOption "zed editor"; + + langs = { + nix = mkOption { + description = "enable nix integration"; + type = types.bool; + default = true; + }; + python = mkOption { + description = "enable python integration"; + type = types.bool; + default = false; + }; + rust = mkOption { + description = "enable rust integration"; + type = types.bool; + default = false; + }; + go = mkOption { + description = "enable go integration"; + type = types.bool; + default = false; + }; + lua = mkOption { + description = "enable lua integration"; + type = types.bool; + default = false; + }; + docker = mkOption { + description = "enable docker integration"; + type = types.bool; + default = false; + }; + java = mkOption { + description = "enable java integration"; + type = types.bool; + default = false; + }; + cmake = mkOption { + description = "enable cmake integration"; + type = types.bool; + default = false; + }; + toml = mkOption { + description = "enable toml integration"; + type = types.bool; + default = false; + }; + }; + }; + + config = mkIf cfg.enable { + programs.zed-editor = { + enable = true; + extensions = + [ ] + ++ (optionals cfg.langs.nix [ "nix" ]) + ++ (optionals cfg.langs.python [ "python" ]) + ++ (optionals cfg.langs.rust [ "rust" ]) + ++ (optionals cfg.langs.go [ "go" ]) + ++ (optionals cfg.langs.lua [ "lua" ]) + ++ (optionals cfg.langs.docker [ "dockerfile" ]) + ++ (optionals cfg.langs.java [ "java" ]) + ++ (optionals cfg.langs.cmake [ "cmake" ]) + ++ (optionals cfg.langs.toml [ "toml" ]); + userSettings = { + telemetry = { + metrics = false; + }; + }; + }; + }; +} diff --git a/modules/home/git/default.nix b/modules/home/git/default.nix new file mode 100644 index 0000000..a2563d5 --- /dev/null +++ b/modules/home/git/default.nix @@ -0,0 +1,77 @@ +{ + config, + lib, + ... +}: +let + cfg = config.nx.programs.git; + inherit (lib) mkEnableOption mkOption mkIf types; +in +{ + options.nx.programs.git = { + enable = mkEnableOption "git"; + + userName = mkOption { + description = "Git username"; + type = types.str; + default = "Leander Scherer"; + }; + + userEmail = mkOption { + description = "Git email"; + type = types.str; + default = "leander@schererleander.de"; + }; + + signKey = mkOption { + description = "Sign key"; + type = types.nullOr types.str; + default = "A3502B180BC1D41A"; + }; + + signFlavor = mkOption { + description = "Sign key flavor"; + type = types.enum [ + "ssh" + "openpgp" + ]; + default = "openpgp"; + }; + }; + + config = mkIf cfg.enable { + programs.git = { + enable = true; + + signing = mkIf (cfg.signKey != null) { + key = cfg.signKey; + signByDefault = true; + }; + + ignores = [ + "*~" + ".DS_Store" + ".direnv" + ".envrc" + ]; + + settings = { + user.name = cfg.userName; + user.email = cfg.userEmail; + help.autocorrect = 20; + alias = { + st = "status"; + co = "checkout"; + br = "branch"; + }; + pull.rebase = true; + gpg.format = cfg.signFlavor; + url."git@github.com:".insteadOf = "https://github.com"; + }; + }; + programs.diff-highlight = { + enable = true; + enableGitIntegration = true; + }; + }; +} diff --git a/modules/home/gpg/default.nix b/modules/home/gpg/default.nix new file mode 100644 index 0000000..af08ae3 --- /dev/null +++ b/modules/home/gpg/default.nix @@ -0,0 +1,62 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) + mkOption + types + mkIf + ; + cfg = config.nx.programs.gpg; +in +{ + + options.nx.programs.gpg = { + enable = mkOption { + description = "GNU Privacy Guard"; + type = types.bool; + default = config.nx.programs.git.enable; + }; + + gpgKey = mkOption { + description = "default gpg key"; + type = types.nullOr types.str; + default = ""; + }; + + pinentry = mkOption { + description = "pinentry flavor"; + type = types.enum [ + "curses" + "gnome3" + "qt" + "mac" + ]; + default = if pkgs.stdenv.isDarwin then "mac" else "curses"; + }; + }; + + config = lib.mkIf cfg.enable { + programs.gpg = { + enable = true; + #settings.default-key = mkIf (cfg.gpgKey != null) cfg.gpgKey; + }; + + services.gpg-agent = { + enable = true; + pinentry.package = + if cfg.pinentry == "gnome3" then + pkgs.pinentry-gnome3 + else if cfg.pinentry == "qt" then + pkgs.pinentry-qt + else if cfg.pinentry == "mac" then + pkgs.pinentry_mac + else + pkgs.pinentry-curses; + }; + }; +} diff --git a/modules/home/media/nixcord/default.nix b/modules/home/media/nixcord/default.nix new file mode 100644 index 0000000..8f3b665 --- /dev/null +++ b/modules/home/media/nixcord/default.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + ... +}: +let + cfg = config.nx.media.nixcord; + inherit (lib) mkEnableOption mkOption types mkIf; +in +{ + options.nx.media.nixcord = { + enable = mkEnableOption "nixcord and setup"; + frameless = mkOption { + description = "Make discord frameless"; + type = types.bool; + default = true; + }; + }; + config = mkIf cfg.enable { + programs.nixcord = { + enable = true; + config = { + themeLinks = [ + "https://refact0r.github.io/system24/theme/system24.theme.css" + ]; + frameless = cfg.frameless; + plugins = { + alwaysAnimate.enable = false; + imageLink.enable = true; + imageZoom.enable = true; + translate.enable = true; + }; + }; + }; + }; +} diff --git a/modules/home/media/spicetify/default.nix b/modules/home/media/spicetify/default.nix new file mode 100644 index 0000000..06c619b --- /dev/null +++ b/modules/home/media/spicetify/default.nix @@ -0,0 +1,39 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: + +let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system}; + cfg = config.nx.media.spicetify; + inherit (lib) mkEnableOption mkIf; +in +{ + options.nx.media.spicetify = { + enable = mkEnableOption "Command-line tool to customize the official Spotify client"; + }; + + config = mkIf cfg.enable { + nixpkgs.config.allowUnfree = true; + programs.spicetify = { + enable = true; + enabledSnippets = with spicePkgs.snippets; [ + pointer + sonicDancing + modernScrollbar + nyanCatProgressBar + declutterNowPlayingBar + ]; + + enabledExtensions = with spicePkgs.extensions; [ + keyboardShortcut + ]; + + theme = spicePkgs.themes.sleek; + colorScheme = "Coral"; + }; + }; +} diff --git a/modules/home/productivity/anki/default.nix b/modules/home/productivity/anki/default.nix new file mode 100644 index 0000000..84b1655 --- /dev/null +++ b/modules/home/productivity/anki/default.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + ... +}: +let + cfg = config.nx.productivity.anki; + inherit (lib) mkEnableOption mkIf; +in +{ + options.nx.productivity.anki = { + enable = mkEnableOption "Anki free and open-source flashcard program"; + }; + config = mkIf cfg.enable { + programs.anki = { + enable = true; + #style = "native"; + #addons = with pkgs.ankiAddons; [ + # anki-connect + # review-heatmap + #]; + }; + }; +} diff --git a/modules/home/productivity/latex/default.nix b/modules/home/productivity/latex/default.nix new file mode 100644 index 0000000..6f37138 --- /dev/null +++ b/modules/home/productivity/latex/default.nix @@ -0,0 +1,43 @@ +{ + config, + options, + pkgs, + lib, + ... +}: +let + cfg = config.nx.productivity.latex; + inherit (lib) mkEnableOption mkIf; +in +{ + options.nx.productivity.latex = { + enable = mkEnableOption "LaTeX typesetting system"; + }; + + config = mkIf cfg.enable { + programs.texlive = { + enable = true; + # See https://mynixos.com/search?q=texlivepackages.collection for more collections + # and https://mynixos.com/search?q=texlivepackages for more individual packages. + extraPackages = tpkgs: { + inherit (tpkgs) + collection-basic + collection-latex + collection-latexrecommended + biblatex + ; + }; + }; + + home.packages = with pkgs; [ + biber + ]; + + programs.pandoc = { + enable = true; + defaults = { + pdf-engine = "pdfetex"; + }; + }; + }; +} diff --git a/modules/home/shells/bash/default.nix b/modules/home/shells/bash/default.nix new file mode 100644 index 0000000..d224442 --- /dev/null +++ b/modules/home/shells/bash/default.nix @@ -0,0 +1,40 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.shells.bash; +in +{ + options.nx.shells.bash = { + enable = mkEnableOption "bash shell"; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + zoxide + ]; + + programs.bash = { + enable = true; + enableCompletion = true; + initExtra = '' + # view man pages with nvim + export MANPAGER="nvim +Man!" + + # vim keybindings + set -o vi + + # zoxide smarter cd command + eval "$(zoxide init bash)" + ''; + shellAliases = { + ls = "ls --color=auto"; + }; + }; + }; +} diff --git a/modules/home/shells/zsh/default.nix b/modules/home/shells/zsh/default.nix new file mode 100644 index 0000000..72d3f9a --- /dev/null +++ b/modules/home/shells/zsh/default.nix @@ -0,0 +1,66 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.shells.zsh; +in +{ + options.nx.shells.zsh = { + enable = mkEnableOption "zsh shell"; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + zoxide + ]; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + initContent = '' + # view man pages with nvim + export MANPAGER="nvim +Man!" + + # Directory completion with trailing slash + zstyle ':completion:*' list-dirs-first true + zstyle ':completion:*' special-dirs true + zstyle ':completion:*' squeeze-slashes true + zstyle ':completion:*' add-space false + + # Case-insensitive completion + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' + # vim keybindings + bindkey -v + + # zoxide smarter cmd command + eval "$(zoxide init zsh)" + ''; + shellAliases = { + ls = "ls --color=auto"; + }; + + zplug = { + enable = true; + plugins = [ + { name = "mafredri/zsh-async"; } + { + name = "sindresorhus/pure"; + tags = [ + "as:theme" + "use:pure.zsh" + ]; + } + { name = "zdharma-continuum/fast-syntax-highlighting"; } + { name = "zsh-users/zsh-autosuggestions"; } + ]; + }; + }; + }; +} diff --git a/modules/home/terminal/kitty.nix b/modules/home/terminal/kitty.nix new file mode 100644 index 0000000..35d5648 --- /dev/null +++ b/modules/home/terminal/kitty.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + ... +}: + +{ + options.nx.terminal.kitty.enable = lib.mkEnableOption "Enable kitty"; + config = lib.mkIf config.nx.terminal.kitty.enable { + programs.kitty = { + enable = true; + shellIntegration.enableFishIntegration = true; + font = { + name = "monospace"; + size = 11; + }; + settings = { + cursor_shape = "underline"; + cursor_blink_interval = "-1"; + cursor_stop_blinking_after = "15.0"; + + background_opacity = "0.3"; + + enable_audio_bell = false; + bell_on_tab = false; + + window_border_width = "0"; + window_margin_width = "4"; + window_padding_width = "5"; + }; + }; + }; +} diff --git a/modules/home/zathura/default.nix b/modules/home/zathura/default.nix new file mode 100644 index 0000000..2334fc7 --- /dev/null +++ b/modules/home/zathura/default.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + ... +}: +let + cfg = config.nx.programs.zathura; + inherit (lib) mkEnableOption mkIf; +in +{ + options.nx.programs.zathura = { + enable = mkEnableOption "zathura document viewer"; + }; + + config = mkIf cfg.enable { + programs.zathura = { + enable = true; + options = { + recolor-lightcolor = "rgba(0, 0, 0, 0)"; + recolor-darkcolor = "rgba(255, 255, 255, 1)"; + recolor = true; + adjust-open = "width"; + guioptions = "none"; + zoom-center = true; + page-padding = 0; + pages-per-row = 1; + scroll-page-aware = true; + }; + + mappings = { + i = "recolor"; + j = "navigate previous"; + k = "navigate next"; + }; + }; + }; +} diff --git a/modules/hosts/audio/default.nix b/modules/hosts/audio/default.nix deleted file mode 100644 index 3cd06e4..0000000 --- a/modules/hosts/audio/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - config, - lib, - ... -}: - -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.services.audio; -in -{ - options.nx.services.audio = { - enable = mkOption { - description = "enable sound"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - wireplumber.enable = true; - }; - }; -} diff --git a/modules/hosts/default.nix b/modules/hosts/default.nix deleted file mode 100644 index d8a8927..0000000 --- a/modules/hosts/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: - -{ - imports = [ - ./audio - ./desktop - ./dns - ./openssh - ./printer - ./server - ./wooting - ./steam - ./mullvad-vpn - ]; -} diff --git a/modules/hosts/desktop/cinnamon/default.nix b/modules/hosts/desktop/cinnamon/default.nix deleted file mode 100644 index 5233ad1..0000000 --- a/modules/hosts/desktop/cinnamon/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkEnableOption mkIf mkForce; - cfg = config.nx.desktop.cinnamon; -in -{ - options.nx.desktop.cinnamon.enable = mkEnableOption "Enable Cinnamon desktop environment"; - - config = mkIf cfg.enable { - services.xserver.enable = true; - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager.cinnamon.enable = true; - - services.speechd.enable = mkForce false; - services.orca.enable = mkForce false; - - environment.systemPackages = with pkgs; [ - nemo-preview - ]; - }; -} diff --git a/modules/hosts/desktop/default.nix b/modules/hosts/desktop/default.nix deleted file mode 100644 index 7d7f3ae..0000000 --- a/modules/hosts/desktop/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ useHomeManager ? true, ... }: - -{ - imports = [ - # NixOS-only modules (no home-manager) - ./cinnamon - ./gnome - ./kde - ] ++ (if useHomeManager then [ - # Modules that require home-manager - ./hyprland - ./labwc - ./sway - ./dunst.nix - ./waybar.nix - ] else [ ]); -} diff --git a/modules/hosts/desktop/dunst.nix b/modules/hosts/desktop/dunst.nix deleted file mode 100644 index 4c5f74e..0000000 --- a/modules/hosts/desktop/dunst.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - config, - lib, - pkgs, - username, - ... -}: - -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nx.desktop.dunst; -in -{ - options.nx.desktop.dunst.enable = mkEnableOption "Enable dunst notification"; - config = mkIf cfg.enable { - home-manager.users.${username} = { - home.packages = with pkgs; [ - libnotify - ]; - - services.dunst = { - enable = true; - settings = { - global = { - font = "monospace 10"; - offset = "(15, 15)"; - frame_width = 0; - }; - urgency_low = { - foreground = "#FFFFFF"; - background = "#000000E6"; - }; - - urgency_normal = { - foreground = "#FFFFFF"; - background = "#000000E6"; - }; - - urgency_critical = { - foreground = "#FFFFFF"; - background = "#000000E6"; - }; - }; - }; - }; - }; -} diff --git a/modules/hosts/desktop/gnome/default.nix b/modules/hosts/desktop/gnome/default.nix deleted file mode 100644 index 268fdc7..0000000 --- a/modules/hosts/desktop/gnome/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nx.desktop.gnome; -in -{ - options.nx.desktop.gnome.enable = mkEnableOption "Enable GNOME desktop environment"; - - config = mkIf cfg.enable { - services.displayManager.gdm.enable = true; - services.desktopManager.gnome.enable = true; - services.gnome.core-developer-tools.enable = false; - services.gnome.games.enable = false; - - environment.gnome.excludePackages = with pkgs; [ - gnome-tour - gnome-user-docs - epiphany - ]; - - environment.systemPackages = with pkgs; [ - gnomeExtensions.pop-shell - gnomeExtensions.blur-my-shell - gnome-tweaks - ]; - }; -} diff --git a/modules/hosts/desktop/hyprland/default.nix b/modules/hosts/desktop/hyprland/default.nix deleted file mode 100644 index 1750a59..0000000 --- a/modules/hosts/desktop/hyprland/default.nix +++ /dev/null @@ -1,283 +0,0 @@ -{ - config, - username, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkEnableOption mkOption mkIf types optionals; - cfg = config.nx.desktop.hyprland; -in -{ - options.nx.desktop.hyprland = { - enable = mkEnableOption "Enable hyprland"; - monitors = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "Monitor configuration strings for Hyprland"; - example = [ "DP-1,highrr,0x0,auto" ]; - }; - lockscreen = { - background = mkOption { - type = types.nullOr types.path; - default = null; - description = "Background image for hyprlock"; - }; - profileImage = mkOption { - type = types.nullOr types.path; - default = null; - description = "Profile image for hyprlock"; - }; - }; - }; - - config = mkIf cfg.enable { - programs.hyprlock.enable = true; - - home-manager.users.${username} = { - home.packages = with pkgs; [ - hyprshot - hyprpicker - ]; - - programs.hyprlock = { - enable = true; - settings = { - general = { - immediate_render = true; - }; - - background = [ - ({ - monitor = ""; - color = "rgba(0, 0, 0, 1.0)"; - } // (if cfg.lockscreen.background != null then { path = "${cfg.lockscreen.background}"; } else { })) - ]; - - input-field = [ - { - monitor = ""; - size = "300, 30"; - outline_thickness = 0; - dots_size = 0.25; - dots_spacing = 0.55; - dots_center = true; - dots_rounding = -1; - outer_color = "rgba(242, 243, 244, 0)"; - inner_color = "rgba(242, 243, 244, 0)"; - font_color = "rgba(242, 243, 244, 0.75)"; - fade_on_empty = false; - placeholder_text = ""; - hide_input = false; - check_color = "rgba(204, 136, 34, 0)"; - fail_color = "rgba(204, 34, 34, 0)"; - fail_text = "$FAIL ($ATTEMPTS)"; - fail_transition = 300; - capslock_color = -1; - numlock_color = -1; - bothlock_color = -1; - invert_numlock = false; - swap_font_color = false; - position = "0, -468"; - halign = "center"; - valign = "center"; - } - ]; - - label = [ - { - monitor = ""; - text = ''cmd[update:1000] echo "$(date +"%A, %B %d")"''; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 20; - position = "0, 405"; - halign = "center"; - valign = "center"; - } - { - monitor = ""; - text = ''cmd[update:1000] echo "$(date +"%k:%M")"''; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 93; - position = "0, 310"; - halign = "center"; - valign = "center"; - } - ] ++ optionals (cfg.lockscreen.profileImage != null) [ - { - monitor = ""; - text = "${username}"; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 12; - position = "0, -407"; - halign = "center"; - valign = "center"; - } - { - monitor = ""; - text = "Enter Password"; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 10; - position = "0, -438"; - halign = "center"; - valign = "center"; - } - ]; - - image = optionals (cfg.lockscreen.profileImage != null) [ - { - monitor = ""; - path = "${cfg.lockscreen.profileImage}"; - border_color = "0xffdddddd"; - border_size = 0; - size = 73; - rounding = -1; - rotate = 0; - reload_time = -1; - reload_cmd = ""; - position = "0, -353"; - halign = "center"; - valign = "center"; - } - ]; - }; - }; - - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - xwayland.enable = true; - settings = { - monitor = if cfg.monitors != [ ] then cfg.monitors else [ ",preferred,auto,auto" ]; - - "$background" = "rgba(000000FF)"; - "$accent" = "rgba(FFFFFFFF)"; - - env = [ - "XCURSOR_SIZE,24" - ]; - - input = { - kb_layout = config.console.keyMap; - follow_mouse = 1; - touchpad = { - natural_scroll = true; - }; - }; - - general = { - gaps_in = 5; - gaps_out = 10; - border_size = 2; - "col.active_border" = "$accent"; - "col.inactive_border" = "$background"; - layout = "dwindle"; - }; - - decoration = { - rounding = 5; - active_opacity = 0.8; - inactive_opacity = 0.7; - - blur = { - enabled = true; - size = 4; - passes = 4; - ignore_opacity = true; - contrast = 1.1; - brightness = 1.0; - }; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 7, default, popin 80%" - "border, 1, 10, default" - "fade, 1, 7, default" - "workspaces, 1, 6, default" - ]; - }; - - misc = { - disable_hyprland_logo = true; - vrr = 1; - }; - - dwindle = { - pseudotile = true; - preserve_split = true; - }; - - xwayland = { - force_zero_scaling = true; - }; - - "$mod" = "SUPER"; - - bind = [ - "$mod, l, exec, hyprlock" - "$mod, s, exec, hyprshot --mode region" - "$mod, r, exec, wofi --show run" - "$mod, d, exec, wofi --show drun" - "$mod, c, exec, hyprpicker -r -a" - "$mod, return, exec, kitty" - "$mod, q, killactive," - "$mod, m, exit," - "$mod, f, fullscreen" - "$mod, v, togglefloating," - "$mod, P, pseudo," - - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioNext, exec, playerctl next" - ", XF86AudioPrev, exec, playerctl previous" - ", XF86Audiostop, exec, playerctl stop" - - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - - "$mod SHIFT, 1, movetoworkspace, 1" - "$mod SHIFT, 2, movetoworkspace, 2" - "$mod SHIFT, 3, movetoworkspace, 3" - "$mod SHIFT, 4, movetoworkspace, 4" - "$mod SHIFT, 5, movetoworkspace, 5" - "$mod SHIFT, 6, movetoworkspace, 6" - "$mod SHIFT, 7, movetoworkspace, 7" - "$mod SHIFT, 8, movetoworkspace, 8" - "$mod SHIFT, 9, movetoworkspace, 9" - "$mod SHIFT, 0, movetoworkspace, 10" - - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ]; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - }; - }; - }; - }; -} diff --git a/modules/hosts/desktop/kde/default.nix b/modules/hosts/desktop/kde/default.nix deleted file mode 100644 index d53e1c8..0000000 --- a/modules/hosts/desktop/kde/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nx.desktop.kde; -in -{ - - options.nx.desktop.kde.enable = mkEnableOption "Enable kde"; - config = mkIf cfg.enable { - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; - services.desktopManager.plasma6.enable = true; - security.pam.services.sddm.enableKwallet = true; - - environment.plasma6.excludePackages = with pkgs.kdePackages; [ - elisa - kate - ]; - }; -} diff --git a/modules/hosts/desktop/labwc/default.nix b/modules/hosts/desktop/labwc/default.nix deleted file mode 100644 index b62dbbe..0000000 --- a/modules/hosts/desktop/labwc/default.nix +++ /dev/null @@ -1,296 +0,0 @@ -{ - config, - username, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkEnableOption mkOption mkIf types optional; - cfg = config.nx.desktop.labwc; - - gruvbox-openbox = pkgs.stdenv.mkDerivation { - pname = "gruvbox-openbox"; - version = "0-unstable-2024-02-14"; - - src = pkgs.fetchFromGitHub { - owner = "nathanielevan"; - repo = "gruvbox-openbox"; - rev = "master"; - hash = "sha256-61BsD/DK6OOJLKwdY03HL1pCG1DJcIE9bsFPAVFfcIY="; - }; - - installPhase = '' - mkdir -p $out/share/themes - cp -r gruvbox-dark $out/share/themes/ - cp -r gruvbox-material-dark $out/share/themes/ - cp -r gruvbox-material-dark-blocks $out/share/themes/ - ''; - }; -in -{ - options.nx.desktop.labwc = { - enable = mkEnableOption "Enable labwc"; - monitors = mkOption { - type = types.attrsOf (types.submodule { - options = { - mode = mkOption { - type = types.str; - description = "Monitor resolution and refresh rate"; - example = "1920x1080@240"; - }; - position = mkOption { - type = types.str; - default = "0,0"; - description = "Monitor position"; - example = "1920,0"; - }; - }; - }); - default = { }; - description = "Monitor configuration for kanshi"; - }; - wallpaper = mkOption { - type = types.nullOr types.path; - default = null; - description = "Wallpaper image path"; - }; - theme = { - gtk = mkOption { - type = types.str; - default = "Gruvbox-Material-Dark"; - description = "GTK theme name"; - }; - icons = mkOption { - type = types.str; - default = "Gruvbox-Dark"; - description = "Icon theme name"; - }; - cursor = mkOption { - type = types.str; - default = "Adwaita"; - description = "Cursor theme name"; - }; - openbox = mkOption { - type = types.str; - default = "gruvbox-material-dark-blocks"; - description = "Openbox/LabWC theme name"; - }; - }; - }; - - config = mkIf cfg.enable { - home-manager.users.${username} = { - home.packages = with pkgs; [ - labwc-tweaks - labwc-gtktheme - gruvbox-material-gtk-theme - gruvbox-dark-icons-gtk - wl-clipboard - sfwbar - gtk-layer-shell - ] ++ optional (cfg.wallpaper != null) swaybg - ++ [ gruvbox-openbox ]; - - services.cliphist.enable = true; - - gtk = { - enable = true; - theme = { - name = cfg.theme.gtk; - package = pkgs.gruvbox-material-gtk-theme; - }; - iconTheme = { - name = cfg.theme.icons; - package = pkgs.gruvbox-dark-icons-gtk; - }; - cursorTheme = { - name = cfg.theme.cursor; - package = pkgs.adwaita-icon-theme; - }; - gtk3.extraConfig = { - gtk-application-prefer-dark-theme = 1; - }; - gtk4.extraConfig = { - gtk-application-prefer-dark-theme = 1; - }; - }; - - services.kanshi = mkIf (cfg.monitors != { }) { - enable = true; - profiles = { - default = { - outputs = lib.mapAttrsToList (name: monitor: { - criteria = name; - mode = monitor.mode; - position = monitor.position; - }) cfg.monitors; - }; - }; - }; - - wayland.windowManager.labwc = { - enable = true; - autostart = [ - "${pkgs.sfwbar}/bin/sfwbar" - ] ++ optional (cfg.wallpaper != null) "${pkgs.swaybg}/bin/swaybg -m fill -i ${cfg.wallpaper} & disown"; - environment = [ - "XKB_DEFAULT_LAYOUT=${config.console.keyMap}" - "XCURSOR_SIZE=24" - "XDG_CURRENT_DESKTOP=wlroots" - ]; - - rc = { - core = { - decoration = "server"; - gap = 5; - }; - - theme = { - name = cfg.theme.openbox; - }; - - keyboard = { - default = true; - keybind = [ - { - "@key" = "W-Return"; - action = { - "@name" = "Execute"; - "@command" = "kitty"; - }; - } - { - "@key" = "W-F4"; - action = { - "@name" = "None"; - }; - } - ]; - }; - - mouse = { - default = true; - context = { - "@name" = "Root"; - mousebind = { - "@button" = "Right"; - "@action" = "Press"; - action = { - "@name" = "ShowMenu"; - "@menu" = "root-menu"; - }; - }; - }; - }; - }; - }; - - # sfwbar configuration - xdg.configFile."sfwbar/sfwbar.config".text = '' - # Term setup - Set Term = "foot" - Set ThicknessHint = "20px" - - # Actions - TriggerAction "SIGRTMIN+1", SwitcherEvent "forward" - TriggerAction "SIGRTMIN+2", SwitcherEvent "back" - - # Initialization - Function("SfwbarInit") { - SetLayer "top" - SetMirror "*" - SetExclusiveZone "auto" - } - - # Placer (Window positioning) - placer { - xorigin = 5 - yorigin = 5 - xstep = 5 - ystep = 5 - children = true - } - - # Task Switcher - switcher { - interval = 700 - icons = true - labels = false - cols = 5 - } - - # Load Standard Library Winops - include("${pkgs.sfwbar}/share/sfwbar/winops.widget") - - # Main Layout - layout { - - # Start Menu - include("${pkgs.sfwbar}/share/sfwbar/startmenu.widget") - - # Show Desktop - include("${pkgs.sfwbar}/share/sfwbar/showdesktop.widget") - - # Taskbar - taskbar { - rows = 1 - icons = true - labels = false - sort = false - action[3] = Menu "winops" - action[Drag] = Focus - } - - # Spacer - label { - value = "" - style = "spacer" - } - - # Pager - pager { - rows = 1 - pins = "1","2","3","4" - preview = true - action[Drag] = WorkspaceActivate - } - - # Tray - tray { - rows = 1 - } - - # Modules - include("${pkgs.sfwbar}/share/sfwbar/volume.widget") - - # Clock - grid { - style = "clock_grid" - label { - value = Time("%H:%M") - tooltip = Time("%H:%M\n%x") - } - } - } - - #CSS - #spacer { - -GtkWidget-hexpand: true; - } - - button#taskbar_item { - padding: 5px; - border-radius: 0px; - border-width: 0px; - -GtkWidget-hexpand: false; - } - - button#taskbar_item:hover { - background-color: rgba(255, 255, 255, 0.1); - } - ''; - }; - }; -} diff --git a/modules/hosts/desktop/sway/default.nix b/modules/hosts/desktop/sway/default.nix deleted file mode 100644 index b9cec12..0000000 --- a/modules/hosts/desktop/sway/default.nix +++ /dev/null @@ -1,181 +0,0 @@ -{ - config, - username, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkEnableOption mkOption mkIf mkOptionDefault types; - cfg = config.nx.desktop.sway; - mod = "Mod4"; -in -{ - options.nx.desktop.sway = { - enable = mkEnableOption "Enable sway"; - monitors = mkOption { - type = types.attrsOf (types.submodule { - options = { - resolution = mkOption { - type = types.str; - description = "Monitor resolution and refresh rate"; - example = "1920x1080@240Hz"; - }; - position = mkOption { - type = types.str; - default = "0 0"; - description = "Monitor position"; - example = "1920 0"; - }; - }; - }); - default = { }; - description = "Monitor configuration"; - }; - wallpaper = mkOption { - type = types.nullOr types.path; - default = null; - description = "Wallpaper image path"; - }; - }; - - config = mkIf cfg.enable { - home-manager.users.${username} = { - home.packages = with pkgs; [ - wmenu - swaybg - sway-contrib.grimshot - wl-clipboard - xdg-utils - ]; - - wayland.windowManager.sway = { - enable = true; - systemd = { - enable = true; - xdgAutostart = true; - }; - config = { - input = { - "*" = { - xkb_layout = config.console.keyMap; - }; - }; - - output = lib.mapAttrs (name: monitor: { - resolution = monitor.resolution; - position = monitor.position; - } // (if cfg.wallpaper != null then { bg = "${cfg.wallpaper} fill"; } else { })) cfg.monitors; - - gaps = { - inner = 15; - }; - - window = { - titlebar = false; - border = 0; - }; - - modifier = mod; - - keybindings = mkOptionDefault { - "${mod}+q" = "kill"; - "${mod}+Shift+s" = "exec grimshot savecopy area"; - "XF86AudioPlay" = "exec playerctl play-pause"; - "XF86AudioPrev" = "exec playerctl previous"; - "XF86AudioNext" = "exec playerctl next"; - "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ +5%"; - "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ -5%"; - "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_DEVICE@ toggle"; - }; - - menu = "${pkgs.wmenu}/bin/wmenu-run -b -N 000000E6"; - terminal = "${pkgs.foot}/bin/foot"; - defaultWorkspace = "workspace number 1"; - - bars = [ - { - command = "${pkgs.waybar}/bin/waybar"; - } - ]; - }; - checkConfig = false; - wrapperFeatures.base = true; - wrapperFeatures.gtk = true; - }; - - home.sessionVariables = { - XDG_CURRENT_DESKTOP = "sway"; - XDG_SCREENSHOTS_DIR = "~/Pictures/Screenshots/"; - }; - - gtk = { - enable = true; - theme = { - name = "Adwaita-dark"; - package = pkgs.gnome-themes-extra; - }; - gtk3.extraConfig = { - Settings = '' - gtk-application-prefer-dark-theme=1 - ''; - }; - gtk4.extraConfig = { - Settings = '' - gtk-application-prefer-dark-theme=1 - ''; - }; - }; - - home.pointerCursor = { - gtk.enable = true; - name = "Adwaita"; - package = pkgs.adwaita-icon-theme; - size = 24; - }; - - # swaylock - programs.swaylock = { - enable = true; - settings = { - font = "monospace 12"; - color = "00000000"; - ring-color = "ffffffff"; - key-hl-color = "ff0000ff"; - bs-hl-color = "ff0000ff"; - }; - }; - - # swayidle - services.swayidle = { - enable = true; - timeouts = [ - { - timeout = 300; - command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; - } - { - timeout = 600; - command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'"; - resumeCommand = "${pkgs.sway}/bin/swaymsg output * dpms on"; - } - { - timeout = 900; - command = "${pkgs.systemd}/bin/systemctl suspend"; - } - ]; - events = [ - { - event = "after-resume"; - command = "${pkgs.sway}/bin/swaymsg output * dpms on"; - } - { - event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; - } - ]; - }; - }; - }; -} diff --git a/modules/hosts/desktop/waybar.nix b/modules/hosts/desktop/waybar.nix deleted file mode 100644 index aebc0f7..0000000 --- a/modules/hosts/desktop/waybar.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ - config, - lib, - username, - ... -}: - -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nx.desktop.waybar; -in -{ - options.nx.desktop.waybar.enable = mkEnableOption "Enable and configure Waybar"; - - config = mkIf cfg.enable { - home-manager.users.${username} = { - programs.waybar = { - enable = true; - settings = { - mainBar = { - height = 32; - layer = "top"; - position = "bottom"; - modules-center = [ "mpris" ]; - modules-left = [ "wlr/workspaces" ]; - modules-right = [ - "privacy" - "tray" - "battery" - "pulseaudio" - "network" - "bluetooth" - "clock" - ]; - - mpris = { - format = "{title}"; - tooltip-format = "{artist} - {album}"; - }; - - tray = { - spacing = 10; - }; - - privacy = { - icon-size = 16; - }; - - network = { - format-disconnect = "󰌙"; - format-ethernet = "󰌘"; - format-wifi = "{icon}"; - format-icons = [ - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; - tooltip-format-wifi = "{essid} | {signalStrength}%"; - tooltip-format-ethernet = "{ifname}"; - }; - - bluetooth = { - format = " {status}"; - format-disabled = ""; - format-no-controller = ""; - format-connected = " {device_alias}"; - }; - - clock = { - format-alt = "{:%Y-%m-%d}"; - tooltip-format = "{:%Y-%m-%d | %H:%M}"; - }; - - pulseaudio = { - format = "{icon}"; - format-icons = { - default = [ - "" - "" - "" - ]; - }; - tooltip-format = "{desc} | {volume}%"; - }; - }; - }; - - style = '' - * { - border: none; - border-radius: 0; - font-family: monospace; - font-size: 12px; - background: none; - } - - window#waybar { - background: rgba(0, 0, 0, 0.9); - } - - #workspaces button { - padding-left: 5px; - padding-right: 5px; - } - - #workspaces button.focused { - font-weight: bold; - } - - #clock, #pulseaudio, #tray, #network, #battery, #bluetooth { - padding-left: 10px; - padding-right: 10px; - } - ''; - }; - }; - }; -} diff --git a/modules/hosts/dns/default.nix b/modules/hosts/dns/default.nix deleted file mode 100644 index 8463367..0000000 --- a/modules/hosts/dns/default.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ - config, - lib, - ... -}: - -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.dns; -in -{ - options.nx.dns = { - enable = mkOption { - description = "enable DNS-over-TLS using systemd-resolved"; - type = types.bool; - default = false; - }; - servers = mkOption { - description = "list of DNS-over-TLS servers to use"; - type = types.listOf types.str; - default = [ - "1.1.1.1#cloudflare-dns.com" - "1.0.0.1#cloudflare-dns.com" - "9.9.9.9#dns.quad9.net" - "149.112.112.112#dns.quad9.net" - ]; - }; - fallbackServers = mkOption { - description = "fallback DNS servers"; - type = types.listOf types.str; - default = [ - "8.8.8.8#dns.google" - "8.8.4.4#dns.google" - ]; - }; - }; - - config = mkIf cfg.enable { - services.resolved = { - enable = true; - dnssec = "true"; - dnsovertls = "true"; - domains = [ "~." ]; - extraConfig = '' - DNSStubListener=yes - Cache=yes - ''; - }; - - networking = { - nameservers = cfg.servers; - networkmanager.dns = lib.mkDefault "systemd-resolved"; - }; - - systemd.services.systemd-resolved.environment = { - DNS = lib.concatStringsSep " " cfg.servers; - FallbackDNS = lib.concatStringsSep " " cfg.fallbackServers; - }; - }; -} diff --git a/modules/hosts/mullvad-vpn/default.nix b/modules/hosts/mullvad-vpn/default.nix deleted file mode 100644 index 80451a5..0000000 --- a/modules/hosts/mullvad-vpn/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.nx.mullvad-vpn; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.mullvad-vpn = { - enable = mkOption { - description = "Privacy focues vpn"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - services.mullvad-vpn.enable = true; - environment.systemPackages = [ pkgs.mullvad-vpn ]; - }; -} diff --git a/modules/hosts/openssh/default.nix b/modules/hosts/openssh/default.nix deleted file mode 100644 index 49c0527..0000000 --- a/modules/hosts/openssh/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - username, - lib, - ... -}: -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.services.openssh; -in -{ - options.nx.services.openssh.enable = mkOption { - description = "Setup openssh server"; - type = types.bool; - default = false; - }; - config = mkIf cfg.enable { - services.openssh = { - enable = true; - settings = { - AllowUsers = [ username ]; - }; - }; - }; -} diff --git a/modules/hosts/printer/default.nix b/modules/hosts/printer/default.nix deleted file mode 100644 index d094c21..0000000 --- a/modules/hosts/printer/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.printer; -in -{ - - options.nx.printer = { - enable = mkOption { - description = "Setup printer service"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - services.printing = { - enable = true; - drivers = [ pkgs.brlaser ]; - }; - # printer autodiscovery - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - }; -} diff --git a/modules/hosts/server/default.nix b/modules/hosts/server/default.nix deleted file mode 100644 index ca3ca4f..0000000 --- a/modules/hosts/server/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - lib, - ... -}: -let - inherit (lib) mkOption types; -in -{ - options.nx.server = { - enable = mkOption { - description = "Set this host as server"; - type = types.bool; - default = false; - }; - timeZone = mkOption { - description = "Time Zone of the server"; - type = types.str; - default = "Europe/Berlin"; - }; - }; - - imports = [ - ./openssh - ./nginx - ./fail2ban - ./nextcloud - ./site - ]; -} diff --git a/modules/hosts/server/fail2ban/default.nix b/modules/hosts/server/fail2ban/default.nix deleted file mode 100644 index 09fcdf2..0000000 --- a/modules/hosts/server/fail2ban/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - config, - pkgs, - options, - lib, - ... -}: -let - cfg = config.nx.server.fail2ban; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.server.fail2ban = { - enable = mkOption { - description = "Setup fail2ban service"; - type = types.bool; - default = false; - }; - bantime = mkOption { - description = "default bantime"; - type = types.str; - default = "1h"; - }; - }; - config = mkIf cfg.enable { - services.fail2ban = { - enable = true; - bantime = cfg.bantime; - }; - }; -} diff --git a/modules/hosts/server/nextcloud/default.nix b/modules/hosts/server/nextcloud/default.nix deleted file mode 100644 index a527de2..0000000 --- a/modules/hosts/server/nextcloud/default.nix +++ /dev/null @@ -1,156 +0,0 @@ -{ - pkgs, - config, - username, - options, - lib, - ... -}: -let - cfg = config.nx.server.nextcloud; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.server.nextcloud = { - enable = mkOption { - description = "Setup nextcloud server"; - type = types.bool; - default = false; - }; - adminUser = mkOption { - description = "Admin user"; - type = types.str; - default = "schererleander"; - }; - adminPassFile = mkOption { - description = "Admin user key file"; - type = types.str; - default = "/etc/nextcloud-admin-pass"; - }; - hostName = mkOption { - description = "Nextcloud hostname"; - type = types.str; - default = "cloud.schererleander.de"; - }; - backup = mkOption { - description = "enable borgbase backups"; - type = types.bool; - default = true; - }; - jail = mkOption { - description = "setup fail2ban jail"; - type = types.bool; - default = config.nx.server.fail2ban.enable; - }; - }; - - config = mkIf cfg.enable { - services.nextcloud = { - enable = true; - package = pkgs.nextcloud32; - hostName = cfg.hostName; - https = true; - database.createLocally = true; - maxUploadSize = "16G"; - config = { - dbtype = "mysql"; - adminuser = cfg.adminUser; - adminpassFile = cfg.adminPassFile; - }; - settings = { - maintenance_window_start = 2; # 02:00 - default_phone_region = "de"; - overwriteProtocol = "https"; - trusted_domains = [ cfg.hostName ]; - logtimezone = config.nx.server.timeZone; - log_type = "file"; - }; - phpOptions."opcache.interned_strings_buffer" = "64"; - }; - - services.nginx.virtualHosts = mkIf ((config.nx.server.nginx or { }).enable or false) { - "${cfg.hostName}" = { - forceSSL = true; - sslCertificate = config.nx.server.nginx.sslCertificate; - sslCertificateKey = config.nx.server.nginx.sslCertificateKey; - }; - }; - - services.borgbackup.jobs.nextcloud = mkIf cfg.backup { - paths = [ - "/var/lib/nextcloud" - "/var/lib/backup/nextcloud/db" - ]; - repo = "h8xn8qvo@h8xn8qvo.repo.borgbase.com:repo"; - encryption.mode = "none"; - environment = { - BORG_RSH = "ssh -i /home/${username}/.ssh/borgbase-nextcloud -o StrictHostKeyChecking=accept-new"; - TMPDIR = "/var/tmp"; - }; - compression = "auto,lzma"; - startAt = "daily"; - readWritePaths = [ - "/var/lib/backup" - "/var/lib/nextcloud" - ]; - preHook = '' - set -euo pipefail - INSTALL="${pkgs.coreutils}/bin/install" - FIND="${pkgs.findutils}/bin/find" - MYSQLDUMP="${pkgs.mariadb.client}/bin/mysql-dump" - GZIP="${pkgs.gzip}/bin/gzip" - OCC="${lib.getExe config.services.nextcloud.occ}" - - # This command requires write access to /var/lib/backup. - $INSTALL -d -m 0750 -o root -g root /var/lib/backup/nextcloud/db - - trap "$OCC maintenance:mode --off >/dev/null 2>&1 || true" EXIT - - $OCC maintenance:mode --on - - # Make a consistent database dump without locking the site. - $MYSQLDUMP --single-transaction --quick --lock-tables=false --databases nextcloud \ - | $GZIP -c > /var/lib/backup/nextcloud/db/nextcloud-$(date +%F-%H%M%S).sql.gz - - # Delete local dump files older than 14 days. - $FIND /var/lib/backup/nextcloud/db -type f -name "*.sql.gz" -mtime +14 -delete || true - ''; - postHook = '' - set -euo pipefail - ${lib.getExe config.services.nextcloud.occ} maintenance:mode --off || true - ''; - }; - - services.fail2ban = mkIf cfg.jail { - jails = { - nextcloud = { - enabled = true; - settings = { - backend = "systemd"; - journalmatch = "SYSLOG_IDENTIFIER=Nextcloud"; - # END modification to work with syslog instead of logile - port = 443; - protocol = "tcp"; - filter = "nextcloud"; - maxretry = 3; - bantime = 86400; - findtime = 43200; - }; - }; - }; - }; - - environment.etc = mkIf cfg.jail { - # Adapted failregex for syslogs - "fail2ban/filter.d/nextcloud.local".text = pkgs.lib.mkDefault ( - pkgs.lib.mkAfter '' - [Definition] - _groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*) - failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Login failed: - ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Trusted domain error. - datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?" - '' - ); - }; - }; -} diff --git a/modules/hosts/server/nginx/default.nix b/modules/hosts/server/nginx/default.nix deleted file mode 100644 index 438ab49..0000000 --- a/modules/hosts/server/nginx/default.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.server.nginx; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.server.nginx = { - enable = mkOption { - description = "Setup nginx reverse proxy"; - type = types.bool; - default = true; - }; - hostName = mkOption { - description = "url of server"; - type = types.str; - default = "schererleander.de"; - }; - sslCertificate = mkOption { - description = "ssl certificate to use"; - type = types.nullOr types.str; - default = "/etc/ssl/${cfg.hostName}/fullchain.pem"; - }; - sslCertificateKey = mkOption { - description = "ssl certificate key to use"; - type = types.nullOr types.str; - default = "/etc/ssl/${cfg.hostName}/privkey.key"; - }; - }; - config = mkIf cfg.enable { - services.nginx = { - enable = true; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - appendHttpConfig = '' - map $scheme $hsts_header { - https "max-age=31536000; includeSubdomains; preload"; - } - add_header Strict-Transport-Security $hsts_header; - #add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self';" always; - add_header 'Referrer-Policy' 'same-origin'; - add_header X-Frame-Options DENY; - add_header X-Content-Type-Options nosniff; - ''; - }; - networking.firewall.allowedTCPPorts = [ - 80 - 443 - ]; - }; -} diff --git a/modules/hosts/server/openssh/default.nix b/modules/hosts/server/openssh/default.nix deleted file mode 100644 index fbb15db..0000000 --- a/modules/hosts/server/openssh/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - config, - username, - lib, - ... -}: -let - cfg = config.nx.server.openssh; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.server.openssh = { - enable = mkOption { - description = "Setup openssh for server"; - type = types.bool; - default = false; - }; - port = mkOption { - description = "Port for openssh"; - type = types.port; - default = 8693; - }; - }; - - config = mkIf cfg.enable { - services.openssh = { - enable = true; - ports = [ cfg.port ]; - settings = { - PasswordAuthentication = false; - AllowUsers = [ username ]; - X11Forwarding = false; - PermitRootLogin = "yes"; - }; - }; - networking.firewall.allowedTCPPorts = [ cfg.port ]; - - services.fail2ban = { - jails = { - sshd = { - enabled = true; - settings = { - port = 8693; - backend = "systemd"; - maxretry = 4; - findtime = "10m"; - bantime = "1h"; - }; - }; - }; - }; - }; -} diff --git a/modules/hosts/server/site/default.nix b/modules/hosts/server/site/default.nix deleted file mode 100644 index 24807d3..0000000 --- a/modules/hosts/server/site/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: -let - cfg = config.nx.server.site; - inherit (lib) mkOption types mkIf; -in -{ - imports = [ - inputs.site.nixosModules.default - ]; - - options.nx.server.site = { - enable = mkOption { - description = "Setup personal website"; - type = types.bool; - default = false; - }; - }; - - config = mkIf cfg.enable { - services.site = { - enable = true; - domain = "schererleander.de"; - sslCertificate = "/etc/ssl/schererleander.de/fullchain.pem"; - sslCertificateKey = "/etc/ssl/schererleander.de/privkey.key"; - }; - }; -} diff --git a/modules/hosts/steam/default.nix b/modules/hosts/steam/default.nix deleted file mode 100644 index 05a3703..0000000 --- a/modules/hosts/steam/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - cfg = config.nx.steam; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.steam = { - enable = mkOption { - description = "Digital distribution platfrom from vavle"; - type = types.bool; - default = false; - }; - useProtontricks = mkOption { - description = "Whether to enable protontricks"; - type = types.bool; - default = true; - }; - useGamescope = mkOption { - description = "SteamOS session compositing window manager"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - programs.steam = { - enable = true; - protontricks.enable = cfg.useProtontricks; - gamescopeSession.enable = cfg.useGamescope; - extraCompatPackages = with pkgs; [ - proton-ge-bin - ]; - }; - }; -} diff --git a/modules/hosts/wooting/default.nix b/modules/hosts/wooting/default.nix deleted file mode 100644 index b2b78c0..0000000 --- a/modules/hosts/wooting/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.wooting; -in -{ - options.nx.wooting = { - enable = mkOption { - description = "Setup wootility, udev rules to discover keyboards"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - services.udev.packages = [ pkgs.wooting-udev-rules ]; - environment.systemPackages = with pkgs; [ - wootility - ]; - }; -} diff --git a/modules/nixos/desktop/cinnamon/default.nix b/modules/nixos/desktop/cinnamon/default.nix new file mode 100644 index 0000000..2561bdb --- /dev/null +++ b/modules/nixos/desktop/cinnamon/default.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf mkForce; + cfg = config.nx.desktop.cinnamon; +in +{ + options.nx.desktop.cinnamon.enable = mkEnableOption "Cinnamon desktop"; + + config = mkIf cfg.enable { + services.xserver = { + enable = true; + displayManager.lightdm.enable = true; + desktopManager.cinnamon.enable = true; + }; + services.speechd.enable = mkForce false; + services.orca.enable = mkForce false; + environment.systemPackages = [ pkgs.nemo-preview ]; + }; +} diff --git a/modules/nixos/desktop/gnome/default.nix b/modules/nixos/desktop/gnome/default.nix new file mode 100644 index 0000000..9ffd353 --- /dev/null +++ b/modules/nixos/desktop/gnome/default.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.gnome; +in +{ + options.nx.desktop.gnome.enable = mkEnableOption "GNOME desktop"; + + config = mkIf cfg.enable { + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + services.gnome.core-developer-tools.enable = false; + services.gnome.games.enable = false; + + environment.gnome.excludePackages = with pkgs; [ + gnome-tour gnome-user-docs epiphany + ]; + environment.systemPackages = with pkgs; [ + gnomeExtensions.pop-shell gnomeExtensions.blur-my-shell gnome-tweaks + ]; + }; +} diff --git a/modules/nixos/desktop/kde/default.nix b/modules/nixos/desktop/kde/default.nix new file mode 100644 index 0000000..5a24f0d --- /dev/null +++ b/modules/nixos/desktop/kde/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.kde; +in +{ + options.nx.desktop.kde.enable = mkEnableOption "KDE Plasma 6 desktop"; + + config = mkIf cfg.enable { + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + services.desktopManager.plasma6.enable = true; + security.pam.services.sddm.enableKwallet = true; + environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa kate ]; + }; +} diff --git a/modules/nixos/dns/default.nix b/modules/nixos/dns/default.nix new file mode 100644 index 0000000..0b8cf90 --- /dev/null +++ b/modules/nixos/dns/default.nix @@ -0,0 +1,44 @@ +{ config, lib, ... }: +let + inherit (lib) mkEnableOption mkOption types mkIf concatStringsSep; + cfg = config.nx.dns; +in +{ + options.nx.dns = { + enable = mkEnableOption "DNS-over-TLS via systemd-resolved"; + servers = mkOption { + type = types.listOf types.str; + default = [ + "1.1.1.1#cloudflare-dns.com" + "1.0.0.1#cloudflare-dns.com" + "9.9.9.9#dns.quad9.net" + "149.112.112.112#dns.quad9.net" + ]; + }; + fallbackServers = mkOption { + type = types.listOf types.str; + default = [ "8.8.8.8#dns.google" "8.8.4.4#dns.google" ]; + }; + }; + + config = mkIf cfg.enable { + services.resolved = { + enable = true; + dnssec = "true"; + dnsovertls = "true"; + domains = [ "~." ]; + extraConfig = '' + DNSStubListener=yes + Cache=yes + ''; + }; + networking = { + nameservers = cfg.servers; + networkmanager.dns = lib.mkDefault "systemd-resolved"; + }; + systemd.services.systemd-resolved.environment = { + DNS = concatStringsSep " " cfg.servers; + FallbackDNS = concatStringsSep " " cfg.fallbackServers; + }; + }; +} diff --git a/modules/nixos/hardware/audio/default.nix b/modules/nixos/hardware/audio/default.nix new file mode 100644 index 0000000..66c9606 --- /dev/null +++ b/modules/nixos/hardware/audio/default.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.audio; +in +{ + options.nx.hardware.audio.enable = mkEnableOption "PipeWire audio"; + + config = mkIf cfg.enable { + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + }; + }; +} diff --git a/modules/nixos/hardware/bluetooth/default.nix b/modules/nixos/hardware/bluetooth/default.nix new file mode 100644 index 0000000..1bb9014 --- /dev/null +++ b/modules/nixos/hardware/bluetooth/default.nix @@ -0,0 +1,24 @@ +{ config, lib, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.bluetooth; +in +{ + options.nx.hardware.bluetooth.enable = mkEnableOption "Bluetooth support"; + + config = mkIf cfg.enable { + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Experimental = true; + FastConnectable = true; + }; + Policy = { + AutoEnable = true; + }; + }; + }; + }; +} diff --git a/modules/nixos/hardware/printer/default.nix b/modules/nixos/hardware/printer/default.nix new file mode 100644 index 0000000..749c766 --- /dev/null +++ b/modules/nixos/hardware/printer/default.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.printer; +in +{ + options.nx.hardware.printer.enable = mkEnableOption "printer support"; + + config = mkIf cfg.enable { + services.printing = { + enable = true; + drivers = [ pkgs.brlaser ]; + }; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + }; +} diff --git a/modules/nixos/hardware/wooting/default.nix b/modules/nixos/hardware/wooting/default.nix new file mode 100644 index 0000000..62a4b78 --- /dev/null +++ b/modules/nixos/hardware/wooting/default.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.wooting; +in +{ + options.nx.hardware.wooting.enable = mkEnableOption "Wooting keyboard support"; + + config = mkIf cfg.enable { + services.udev.packages = [ pkgs.wooting-udev-rules ]; + environment.systemPackages = [ pkgs.wootility ]; + }; +} diff --git a/modules/nixos/mullvad-vpn/default.nix b/modules/nixos/mullvad-vpn/default.nix new file mode 100644 index 0000000..d2c18b1 --- /dev/null +++ b/modules/nixos/mullvad-vpn/default.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.mullvad-vpn; +in +{ + options.nx.mullvad-vpn.enable = mkEnableOption "Mullvad VPN"; + + config = mkIf cfg.enable { + services.mullvad-vpn.enable = true; + environment.systemPackages = [ pkgs.mullvad-vpn ]; + }; +} diff --git a/modules/nixos/openssh/default.nix b/modules/nixos/openssh/default.nix new file mode 100644 index 0000000..22f7df5 --- /dev/null +++ b/modules/nixos/openssh/default.nix @@ -0,0 +1,21 @@ +{ config, lib, ... }: +let + inherit (lib) mkEnableOption mkOption types mkIf; + cfg = config.nx.services.openssh; +in +{ + options.nx.services.openssh = { + enable = mkEnableOption "OpenSSH server"; + allowedUsers = mkOption { + type = types.listOf types.str; + default = [ ]; + }; + }; + + config = mkIf cfg.enable { + services.openssh = { + enable = true; + settings.AllowUsers = cfg.allowedUsers; + }; + }; +} diff --git a/modules/nixos/plymouth/default.nix b/modules/nixos/plymouth/default.nix new file mode 100644 index 0000000..f89777e --- /dev/null +++ b/modules/nixos/plymouth/default.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.plymouth; +in +{ + options.nx.plymouth.enable = mkEnableOption "Plymouth"; + + config = mkIf cfg.enable { + boot = { + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + ]; + consoleLogLevel = 3; + loader.systemd-boot.consoleMode = "max"; + plymouth = { + enable = true; + theme = "lone"; + themePackages = with pkgs; [ + (adi1090x-plymouth-themes.override { + selected_themes = [ "lone" ]; + }) + ]; + }; + }; + }; +} diff --git a/modules/nixos/server/fail2ban/default.nix b/modules/nixos/server/fail2ban/default.nix new file mode 100644 index 0000000..21020b5 --- /dev/null +++ b/modules/nixos/server/fail2ban/default.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + ... +}: +let + inherit (lib) mkEnableOption mkOption types mkIf; + cfg = config.nx.server.fail2ban; +in +{ + options.nx.server.fail2ban = { + enable = mkEnableOption "fail2ban service"; + bantime = mkOption { + description = "default bantime"; + type = types.str; + default = "1h"; + }; + }; + config = mkIf cfg.enable { + services.fail2ban = { + enable = true; + bantime = cfg.bantime; + }; + }; +} diff --git a/modules/nixos/server/nextcloud/default.nix b/modules/nixos/server/nextcloud/default.nix new file mode 100644 index 0000000..7325c92 --- /dev/null +++ b/modules/nixos/server/nextcloud/default.nix @@ -0,0 +1,159 @@ +{ + pkgs, + config, + lib, + ... +}: +let + inherit (lib) mkEnableOption mkOption types mkIf; + cfg = config.nx.server.nextcloud; +in +{ + options.nx.server.nextcloud = { + enable = mkEnableOption "Nextcloud server"; + user = mkOption { + description = "System user for paths like SSH keys"; + type = types.str; + }; + adminUser = mkOption { + description = "Admin user"; + type = types.str; + default = "schererleander"; + }; + adminPassFile = mkOption { + description = "Admin user key file"; + type = types.str; + default = "/etc/nextcloud-admin-pass"; + }; + hostName = mkOption { + description = "Nextcloud hostname"; + type = types.str; + default = "cloud.schererleander.de"; + }; + backup = mkOption { + description = "enable borgbase backups"; + type = types.bool; + default = true; + }; + backupSshKeyPath = mkOption { + description = "SSH key path for borgbase backup"; + type = types.str; + default = "/home/${cfg.user}/.ssh/borgbase-nextcloud"; + }; + jail = mkOption { + description = "setup fail2ban jail"; + type = types.bool; + default = config.nx.server.fail2ban.enable; + }; + }; + + config = mkIf cfg.enable { + services.nextcloud = { + enable = true; + package = pkgs.nextcloud32; + hostName = cfg.hostName; + https = true; + database.createLocally = true; + maxUploadSize = "16G"; + config = { + dbtype = "mysql"; + adminuser = cfg.adminUser; + adminpassFile = cfg.adminPassFile; + }; + settings = { + maintenance_window_start = 2; # 02:00 + default_phone_region = "de"; + overwriteProtocol = "https"; + trusted_domains = [ cfg.hostName ]; + logtimezone = config.time.timeZone; + log_type = "file"; + }; + phpOptions."opcache.interned_strings_buffer" = "64"; + }; + + services.nginx.virtualHosts = mkIf ((config.nx.server.nginx or { }).enable or false) { + "${cfg.hostName}" = { + forceSSL = true; + sslCertificate = config.nx.server.nginx.sslCertificate; + sslCertificateKey = config.nx.server.nginx.sslCertificateKey; + }; + }; + + services.borgbackup.jobs.nextcloud = mkIf cfg.backup { + paths = [ + "/var/lib/nextcloud" + "/var/lib/backup/nextcloud/db" + ]; + repo = "h8xn8qvo@h8xn8qvo.repo.borgbase.com:repo"; + encryption.mode = "none"; + environment = { + BORG_RSH = "ssh -i ${cfg.backupSshKeyPath} -o StrictHostKeyChecking=accept-new"; + TMPDIR = "/var/tmp"; + }; + compression = "auto,lzma"; + startAt = "daily"; + readWritePaths = [ + "/var/lib/backup" + "/var/lib/nextcloud" + ]; + preHook = '' + set -euo pipefail + INSTALL="${pkgs.coreutils}/bin/install" + FIND="${pkgs.findutils}/bin/find" + MYSQLDUMP="${pkgs.mariadb.client}/bin/mariadb-dump" + GZIP="${pkgs.gzip}/bin/gzip" + OCC="${lib.getExe config.services.nextcloud.occ}" + + # This command requires write access to /var/lib/backup. + $INSTALL -d -m 0750 -o root -g root /var/lib/backup/nextcloud/db + + trap "$OCC maintenance:mode --off >/dev/null 2>&1 || true" EXIT + + $OCC maintenance:mode --on + + # Make a consistent database dump without locking the site. + $MYSQLDUMP --single-transaction --quick --lock-tables=false --databases nextcloud \ + | $GZIP -c > /var/lib/backup/nextcloud/db/nextcloud-$(date +%F-%H%M%S).sql.gz + + # Delete local dump files older than 14 days. + $FIND /var/lib/backup/nextcloud/db -type f -name "*.sql.gz" -mtime +14 -delete || true + ''; + postHook = '' + set -euo pipefail + ${lib.getExe config.services.nextcloud.occ} maintenance:mode --off || true + ''; + }; + + services.fail2ban = mkIf cfg.jail { + jails = { + nextcloud = { + enabled = true; + settings = { + backend = "systemd"; + journalmatch = "SYSLOG_IDENTIFIER=Nextcloud"; + # END modification to work with syslog instead of logile + port = 443; + protocol = "tcp"; + filter = "nextcloud"; + maxretry = 3; + bantime = 86400; + findtime = 43200; + }; + }; + }; + }; + + environment.etc = mkIf cfg.jail { + # Adapted failregex for syslogs + "fail2ban/filter.d/nextcloud.local".text = pkgs.lib.mkDefault ( + pkgs.lib.mkAfter '' + [Definition] + _groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*) + failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Login failed: + ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Trusted domain error. + datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?" + '' + ); + }; + }; +} diff --git a/modules/nixos/server/nginx/default.nix b/modules/nixos/server/nginx/default.nix new file mode 100644 index 0000000..2bdaba1 --- /dev/null +++ b/modules/nixos/server/nginx/default.nix @@ -0,0 +1,54 @@ +{ + config, + lib, + ... +}: +let + inherit (lib) mkEnableOption mkOption types mkIf; + cfg = config.nx.server.nginx; +in +{ + options.nx.server.nginx = { + enable = mkEnableOption "nginx reverse proxy" // { + default = true; + }; + hostName = mkOption { + description = "url of server"; + type = types.str; + default = "schererleander.de"; + }; + sslCertificate = mkOption { + description = "ssl certificate to use"; + type = types.nullOr types.str; + default = "/etc/ssl/${cfg.hostName}/fullchain.pem"; + }; + sslCertificateKey = mkOption { + description = "ssl certificate key to use"; + type = types.nullOr types.str; + default = "/etc/ssl/${cfg.hostName}/privkey.key"; + }; + }; + config = mkIf cfg.enable { + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + appendHttpConfig = '' + map $scheme $hsts_header { + https "max-age=31536000; includeSubdomains; preload"; + } + add_header Strict-Transport-Security $hsts_header; + #add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self';" always; + add_header 'Referrer-Policy' 'same-origin'; + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + ''; + }; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; + }; +} diff --git a/modules/nixos/server/openssh/default.nix b/modules/nixos/server/openssh/default.nix new file mode 100644 index 0000000..675ceaf --- /dev/null +++ b/modules/nixos/server/openssh/default.nix @@ -0,0 +1,54 @@ +{ + config, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkOption types mkIf; + cfg = config.nx.server.openssh; +in +{ + options.nx.server.openssh = { + enable = mkEnableOption "OpenSSH server"; + port = mkOption { + description = "Port for openssh"; + type = types.port; + default = 8693; + }; + allowedUsers = mkOption { + description = "Users allowed to SSH"; + type = types.listOf types.str; + default = [ ]; + }; + }; + + config = mkIf cfg.enable { + services.openssh = { + enable = true; + ports = [ cfg.port ]; + settings = { + PasswordAuthentication = false; + AllowUsers = cfg.allowedUsers; + X11Forwarding = false; + PermitRootLogin = "yes"; + }; + }; + networking.firewall.allowedTCPPorts = [ cfg.port ]; + + services.fail2ban = { + jails = { + sshd = { + enabled = true; + settings = { + port = 8693; + backend = "systemd"; + maxretry = 4; + findtime = "10m"; + bantime = "1h"; + }; + }; + }; + }; + }; +} diff --git a/modules/nixos/server/site/default.nix b/modules/nixos/server/site/default.nix new file mode 100644 index 0000000..be603c6 --- /dev/null +++ b/modules/nixos/server/site/default.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + inputs, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.server.site; +in +{ + imports = [ + inputs.site.nixosModules.default + ]; + + options.nx.server.site = { + enable = mkEnableOption "personal website"; + }; + + config = mkIf cfg.enable { + services.site = { + enable = true; + domain = "schererleander.de"; + sslCertificate = "/etc/ssl/schererleander.de/fullchain.pem"; + sslCertificateKey = "/etc/ssl/schererleander.de/privkey.key"; + }; + }; +} diff --git a/modules/nixos/steam/default.nix b/modules/nixos/steam/default.nix new file mode 100644 index 0000000..d708139 --- /dev/null +++ b/modules/nixos/steam/default.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.steam; +in +{ + options.nx.steam = { + enable = mkEnableOption "Steam gaming platform"; + protontricks = mkEnableOption "protontricks" // { + default = true; + }; + gamescope = mkEnableOption "gamescope session compositor"; + }; + + config = mkIf cfg.enable { + programs.steam = { + enable = true; + protontricks.enable = cfg.protontricks; + gamescopeSession.enable = cfg.gamescope; + extraCompatPackages = [ pkgs.proton-ge-bin ]; + }; + }; +} diff --git a/modules/users/browsers/default.nix b/modules/users/browsers/default.nix deleted file mode 100644 index 70a8be5..0000000 --- a/modules/users/browsers/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - imports = [ - ./firefox - ]; -} diff --git a/modules/users/browsers/firefox/default.nix b/modules/users/browsers/firefox/default.nix deleted file mode 100644 index b5212a2..0000000 --- a/modules/users/browsers/firefox/default.nix +++ /dev/null @@ -1,276 +0,0 @@ -{ - pkgs, - inputs, - config, - lib, - ... -}: -let - - cfg = config.nx.browsers.firefox; - inherit (lib) - mkOption - types - mkIf - optionalString - optionalAttrs - ; -in -{ - - options.nx.browsers.firefox = { - enable = mkOption { - description = "mozilla firefox"; - type = types.bool; - default = false; - }; - blockGoogle = mkOption { - description = "blocks google banner and other"; - type = types.bool; - default = true; - }; - transparent = mkOption { - description = "make firefox transparent"; - type = types.bool; - default = false; - }; - cleanHome = mkOption { - description = "clean up firefox home"; - type = types.bool; - default = true; - }; - hideRecommendations = mkOption { - description = "hide firefox recommendations"; - type = types.bool; - default = true; - }; - disablePasswordManager = mkOption { - description = "disable built-in browser password manager"; - type = types.bool; - default = true; - }; - }; - - config = mkIf cfg.enable { - programs.firefox = { - enable = true; - profiles.default = { - extensions = { - packages = with inputs.firefox-addons.packages.${pkgs.system}; [ - ublock-origin - istilldontcareaboutcookies - sponsorblock - decentraleyes - vimium-c - ]; - - force = true; - - settings."uBlock0@raymondhill.net".settings = { - UserMessaging = { - uiTheme = "dark"; - uiAccentCustom = true; - uiAccentCustom0 = "#2C2C2C"; - cloudStorageEnabled = false; - contextMenuEnabled = false; - }; - # Block annoying login with google banner - userFilters = optionalString cfg.blockGoogle '' - ||accounts.google.com/gsi/* - ''; - }; - }; - - search = { - default = "DuckDuckGo"; - engines = { - nix-packages = { - name = "Nix Packages"; - urls = [ - { - template = "https://search.nixos.org/packages"; - params = [ - { - name = "type"; - value = "packages"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - } - ]; - - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@np" ]; - }; - - nixos-wiki = { - name = "NixOS Wiki"; - urls = [ { template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; } ]; - iconMapObj."16" = "https://wiki.nixos.org/favicon.ico"; - definedAliases = [ "@nw" ]; - }; - - bing.metaData.hidden = true; - google.metaData.alias = "@g"; - }; - force = true; - }; - - userChrome = optionalString cfg.transparent '' - /* Hide Back, Forward, Reload, Stop, All Tabs, Firefox View buttons */ - #back-button, - #forward-button, - #reload-button, - #stop-button, - #alltabs-button, - #firefox-view-button { - display: none !important; - } - - .titlebar-buttonbox-container { - display: none; - } - - #tabbrowser-tabs { - border-inline: none !important; - } - - /* Transparent background tabs (above url bar) */ - #navigator-toolbox { - -moz-appearance: -moz-vibrant-titlebar !important; - background: rgba(0, 0, 0, 0.8) !important; - } - - /* Transparent background (behind url bar) */ - #nav-bar { - background: none !important; - box-shadow: none !important; - border-top: 0px !important; - } - - .tab-background[selected="true"] { - background-color: #393e43 !important; - background-image: none !important; - } - - .tab-background { - background-color: var(--background) !important; - color: var(--foreground) !important; - box-shadow: none !important;; - } - - .tab-background[selected] { - background-color: rgba(0, 0, 0, 0.30) !important; - color: var(--foreground) !important; - box-shadow: none !important; - } - - /* Needed for transparency in general */ - :root { - --tabpanel-background-color: transparent !important; - --chrome-content-separator-color: transparent !important; - --toolbar-bgcolor: rgba(0, 0, 0, 0.9) !important; - --newtab-background-color: rgba(0, 0, 0, 0.9) !important; - --newtab-background-color-secondary: transparent !important; - --toolbar-field-background-color: rgba(120, 120, 120, 0.10) !important; - } - ''; - userContent = optionalString cfg.transparent '' - @-moz-document url-prefix("about:"), url("about:home") { - /* Transparent about:settings about:config about:policies */ - :root { - background: rgba(0, 0, 0, 0.0) !important; - } - } - - /* Transparent about:home */ - * { - --newtab-background-color: transparent !important; - --newtab-background-color-secondary: transparent !important; - } - - /* Transparent elements in about:* */ - * { - --in-content-page-background: transparent !important; - --background-color-box: rgba(0, 0, 0, 0.5) !important; - } - ''; - }; - - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - PasswordManagerEnabled = !cfg.disablePasswordManager; - OfferToSaveLogins = !cfg.disablePasswordManager; - DisplayBookmarksToolbar = "never"; - NoDefaultBookmarks = true; - - Homepage = optionalAttrs cfg.cleanHome { - URL = "about:blank"; - Locked = true; - StartPage = "homepage"; - }; - - NewTabPage = !cfg.cleanHome; - - PictureInPicture = { - Enabled = false; - }; - - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - - EncryptedMediaExtensions = { - Enabled = true; - Locked = true; - }; - - FirefoxHome = { - Search = true; - TopSites = true; - SponsoredTopSites = !cfg.cleanHome; - Highlights = true; - Pocket = !cfg.cleanHome; - SponsoredPocket = !cfg.cleanHome; - Locked = true; - }; - - UserMessaging = { - ExtensionRecommendations = !cfg.hideRecommendations; - FeatureRecommendations = !cfg.hideRecommendations; - Locked = true; - MoreFromMozilla = !cfg.hideRecommendations; - SkipOnboarding = true; - UrlbarInterventions = !cfg.hideRecommendations; - }; - - Preferences = { - # Disable fullscreen notification - "full-screen-api.warning.timeout" = "0"; - - # Disable annoying translation popup - "browser.translations.automaticallyPopup" = false; - - # Enable all extensions automatically - "extensions.autoDisableScopes" = 0; - - # Hide ctr-tab tab preview menu - "browser.ctrlTab.sortByRecentlyUsed" = false; - } - // optionalAttrs cfg.transparent { - # transparency - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "browser.tabs.allow_transparent_browser" = true; - "gfx.webrender.all" = true; - }; - }; - }; - }; -} diff --git a/modules/users/cli/default.nix b/modules/users/cli/default.nix deleted file mode 100644 index 98fe1fb..0000000 --- a/modules/users/cli/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - imports = [ - ./tmux - ./opencode - ]; -} diff --git a/modules/users/cli/opencode/default.nix b/modules/users/cli/opencode/default.nix deleted file mode 100644 index 8c1071d..0000000 --- a/modules/users/cli/opencode/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.cli.opencode; - inherit (lib) mkOption types mkIf; -in -{ - - options.nx.cli.opencode = { - enable = mkOption { - description = "opencode open source ai coding agent"; - type = types.bool; - default = false; - }; - }; - - config = mkIf cfg.enable { - programs.opencode = { - enable = true; - settings = { - theme = "system"; - share = "disabled"; - autoupdate = false; - }; - }; - }; -} diff --git a/modules/users/cli/tmux/default.nix b/modules/users/cli/tmux/default.nix deleted file mode 100644 index 9259c0b..0000000 --- a/modules/users/cli/tmux/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.tmux; - -in -{ - options.nx.tmux = { - enable = mkOption { - description = "tmux"; - type = types.bool; - default = config.nx.terminal.multiplexer == "tmux"; - }; - }; - config = mkIf cfg.enable { - programs.tmux = { - enable = true; - keyMode = "vi"; - secureSocket = true; - shell = "${pkgs.${config.nx.terminal.defaultShell}}/bin/${config.nx.terminal.defaultShell}"; - terminal = "xterm-256color"; - extraConfig = '' - unbind C-b - set-option -g prefix C-a - bind-key C-a send-prefix - bind -n M-Left select-pane -L - bind -n M-Right select-pane -R - bind -n M-Up select-pane -U - bind -n M-Down select-pane -D - - # style - set -g status-position top - set -g status-justify absolute-centre - set -g status-style 'fg=color7 bg=default' - set -g status-right "" - # set -g status-right ' #(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)' - # set -g status-right "" - set -g status-left '#S' - set -g status-left-style 'fg=color8' - set -g status-right-length 0 - set -g status-left-length 100 - setw -g window-status-current-style 'fg=colour6 bg=default bold' - setw -g window-status-current-format '#I:#W ' - setw -g window-status-style 'fg=color8' - - set -g mouse on - ''; - }; - }; -} diff --git a/modules/users/default.nix b/modules/users/default.nix deleted file mode 100644 index 06999d5..0000000 --- a/modules/users/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: - -{ - imports = [ - ./browsers - ./cli - ./editors - ./git - ./gpg - ./media - ./productivity - ./shells - ./terminal - ./zathura - ]; -} diff --git a/modules/users/editors/default.nix b/modules/users/editors/default.nix deleted file mode 100644 index 76f3b96..0000000 --- a/modules/users/editors/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - imports = [ - ./neovim - ./vscode - ./zed - ]; -} diff --git a/modules/users/editors/neovim/default.nix b/modules/users/editors/neovim/default.nix deleted file mode 100644 index d6c8218..0000000 --- a/modules/users/editors/neovim/default.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ - config, - username, - lib, - pkgs, - ... -}: - -let - inherit (lib) - mkOption - types - mkIf - optionals - ; - cfg = config.nx.editors.neovim; -in -{ - options.nx.editors.neovim = { - enable = mkOption { - description = "Neovim editor"; - type = types.bool; - default = true; - }; - - langs = { - python = mkOption { - description = "enable the python integration"; - type = types.bool; - default = false; - }; - go = mkOption { - description = "enable go integration"; - type = types.bool; - default = false; - }; - ts = mkOption { - description = "enable the js/ts integration"; - type = types.bool; - default = false; - }; - nix = mkOption { - description = "enable the nix integration"; - type = types.bool; - default = true; - }; - lua = mkOption { - description = "enable the lua integration"; - type = types.bool; - default = true; - }; - latex = mkOption { - description = "enable latex integration"; - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf cfg.enable { - programs.neovim = { - defaultEditor = true; - enable = true; - package = pkgs.neovim-unwrapped; - extraPackages = - with pkgs; - [ - tree-sitter - git - ripgrep - fd - gcc - ] - ++ (optionals cfg.langs.ts [ pkgs.nodePackages.typescript-language-server ]) - ++ (optionals cfg.langs.python [ ]) - ++ (optionals cfg.langs.go [ pkgs.gopls ]) - ++ (optionals cfg.langs.nix [ - pkgs.nil - pkgs.nixfmt - ]) - ++ (optionals cfg.langs.lua [ pkgs.lua-language-server ]) - ++ (optionals cfg.langs.latex [ pkgs.texlab ]); - - plugins = with pkgs.vimPlugins; [ - gruvbox-nvim - mini-starter - gitsigns-nvim - nvim-autopairs - telescope-nvim - fidget-nvim - plenary-nvim - nvim-treesitter.withAllGrammars - nvim-lspconfig - nvim-cmp - cmp-nvim-lsp - cmp-buffer - cmp-path - cmp-cmdline - luasnip - cmp_luasnip - lspkind-nvim - ]; - - extraConfig = '' - luafile ${./init.lua} - ''; - }; - }; -} diff --git a/modules/users/editors/neovim/init.lua b/modules/users/editors/neovim/init.lua deleted file mode 100644 index efd021f..0000000 --- a/modules/users/editors/neovim/init.lua +++ /dev/null @@ -1,225 +0,0 @@ --- General settings -vim.g.mapleader = " " -vim.o.number = true -vim.o.relativenumber = true -vim.o.signcolumn = "yes" -vim.o.termguicolors = true -vim.o.wrap = false -vim.o.tabstop = 2 -vim.o.shiftwidth = 2 -vim.o.updatetime = 250 -vim.o.timeoutlen = 300 -vim.o.swapfile = false -vim.o.ignorecase = true -vim.o.smartcase = true -vim.o.winborder = "rounded" -vim.o.clipboard = "unnamedplus" - -local map = vim.keymap.set -map('n', 'o', 'updatesource %', { desc = 'Save & reload init.lua' }) -map('n', 'w', 'write') -map('n', 'q', 'quit') - - -require("mini.starter").setup({ - header = table.concat({ - " /l、 ", - "(゚、 。 7 ", - " l ~ ヽ ", - " じしf_,)ノ ", - }, "\n"), - footer = "", - content_hooks = { - require("mini.starter").gen_hook.adding_bullet("» "), - require("mini.starter").gen_hook.aligning("center", "center"), - }, -}) - -require("gitsigns").setup() -require("nvim-autopairs").setup() -require("fidget").setup() - -vim.cmd("colorscheme gruvbox") - -local hl = vim.api.nvim_set_hl -hl(0, 'Normal', { bg = 'none' }) -hl(0, 'NormalFloat', { bg = 'none' }) -hl(0, 'NormalNC', { bg = 'none' }) -hl(0, 'StatusLine', { bg = 'none' }) -hl(0, 'SignColumn', { bg = 'none' }) -hl(0, "DiagnosticError", { bg = "none" }) -hl(0, "DiagnosticSignError", { bg = "none" }) -hl(0, "DiagnosticSignHint", { bg = "none" }) -hl(0, "DiagnosticSignInfo", { bg = "none" }) -hl(0, "DiagnosticSignWarn", { bg = "none" }) - -hl(0, "Pmenu", { bg = "none" }) -hl(0, "PmenuSel", { bg = "none" }) -hl(0, "FloatBorder", { bg = "none" }) - -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if status_ok then - configs.setup({ - highlight = { enable = true }, - indent = { enable = true }, - }) -end - -local builtin = require('telescope.builtin') -local map = vim.keymap.set -map('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) -map('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) -map('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) -map('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) - - -local cmp = require("cmp") -cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { 'i', 's' }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, { - { name = 'buffer' }, - }) -}) - --- Add parentheses after selecting function or method -local cmp_autopairs = require('nvim-autopairs.completion.cmp') -cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() -) - -local capabilities = require('cmp_nvim_lsp').default_capabilities() - -vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) - local opts = { buffer = ev.buf, noremap = true, silent = true } - vim.keymap.set('n', 'lf', function() vim.lsp.buf.format { async = true } end, opts) - end, -}) - --- Native LSP setup (Neovim v0.11+) -vim.lsp.config('nixd', { - cmd = { 'nixd' }, - capabilities = capabilities, - settings = { - nixd = { - formatting = { - command = { "nixfmt" }, - }, - }, - }, -}) - -vim.lsp.config('nil_ls', { - cmd = { 'nil' }, - capabilities = capabilities, - settings = { - ['nil'] = { - nix = { - flake = { - autoArchive = true, - }, - }, - }, - }, -}) - -vim.lsp.config('lua_ls', { - cmd = { 'lua-language-server' }, - capabilities = capabilities, - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - }, - diagnostics = { - globals = { 'vim', 'require' }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - }, - telemetry = { - enable = false, - }, - }, - }, -}) - -vim.lsp.config('pyright', { - cmd = { 'pyright-langserver', '--stdio' }, - capabilities = capabilities, -}) - -vim.lsp.config('tailwindcss', { - cmd = { 'tailwindcss-language-server', '--stdio' }, - capabilities = capabilities, -}) - -vim.lsp.config('gopls', { - cmd = { 'gopls' }, - capabilities = capabilities, - settings = { - gopls = { - analyses = { - unusedparams = true, - unusedwrite = true, - }, - staticcheck = true, - }, - }, -}) - -vim.lsp.config('rust_analyzer', { - cmd = { 'rust-analyzer' }, - capabilities = capabilities, -}) - -vim.lsp.config('ts_ls', { - cmd = { 'typescript-language-server', '--stdio' }, - capabilities = capabilities, -}) - --- Enable all configured servers -vim.lsp.enable('nixd') -vim.lsp.enable('nil_ls') -vim.lsp.enable('lua_ls') -vim.lsp.enable('pyright') -vim.lsp.enable('tailwindcss') -vim.lsp.enable('gopls') -vim.lsp.enable('rust_analyzer') -vim.lsp.enable('ts_ls') - -vim.diagnostic.config({ - virtual_text = { source = "if_many" }, - underline = true, - severity_sort = true, -}) diff --git a/modules/users/editors/vscode/default.nix b/modules/users/editors/vscode/default.nix deleted file mode 100644 index fe2c444..0000000 --- a/modules/users/editors/vscode/default.nix +++ /dev/null @@ -1,142 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - inherit (lib) - mkOption - types - mkIf - optionals - ; - cfg = config.nx.editors.vscode; -in -{ - options.nx.editors.vscode = { - enable = mkOption { - description = "vscode editor"; - type = types.bool; - default = false; - }; - - useVSCodium = mkOption { - description = "Use vscodium instead of vscode"; - type = types.bool; - default = false; - }; - - theme = mkOption { - description = "Theme to use for vscode"; - type = types.enum [ - "minimal" - "dark" - "light" - ]; - default = "minimal"; - }; - - langs = { - cmake = mkOption { - description = "enable cmake integration"; - type = types.bool; - default = false; - }; - docker = mkOption { - description = "enable docker integration"; - type = types.bool; - default = false; - }; - python = mkOption { - description = "enable python integration"; - type = types.bool; - default = false; - }; - go = mkOption { - description = "enable go integration"; - type = types.bool; - default = false; - }; - rust = mkOption { - description = "enable rust integration"; - type = types.bool; - default = false; - }; - java = mkOption { - description = "enable java integration"; - type = types.bool; - default = false; - }; - lua = mkOption { - description = "enable lua integration"; - type = types.bool; - default = false; - }; - tailwindcss = mkOption { - description = "enable tailwindcss integration"; - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf cfg.enable { - programs.vscode = { - enable = true; - package = if cfg.useVSCodium then pkgs.vscodium else pkgs.vscode; - mutableExtensionsDir = false; - profiles.default = { - enableUpdateCheck = true; - enableExtensionUpdateCheck = true; - - userSettings = { - "update.mode" = "none"; - "workbench.colorTheme" = - if cfg.theme == "minimal" then - "Minimal" - else if cfg.theme == "dark" then - "Default Dark Modern" - else - "Default Light Modern"; - "editor.fontFamily" = "monospace"; - "editor.tabSize" = 2; - "editor.minimap.enabled" = false; - "terminal.integrated.cursorStyle" = "underline"; - "terminal.integrated.cursorStyleInactive" = "underline"; - "terminal.integrated.fontFamily" = "monospace"; - "terminal.integrated.fontSize" = 13; - "git.autofetch" = true; - "window.controlsStyle" = "custom"; - }; - - extensions = - with pkgs.vscode-extensions; - [ - github.copilot - adpyke.codesnap - esbenp.prettier-vscode - ] - ++ (optionals cfg.langs.cmake [ ms-vscode.cmake-tools ]) - ++ (optionals cfg.langs.docker [ ms-azuretools.vscode-docker ]) - ++ (optionals cfg.langs.python [ ms-python.python ]) - ++ (optionals cfg.langs.go [ golang.go ]) - ++ (optionals cfg.langs.rust [ rust-lang.rust-analyzer ]) - ++ (optionals cfg.langs.java [ vscjava.vscode-maven ]) - ++ (optionals cfg.langs.lua [ sumneko.lua ]) - ++ (optionals cfg.langs.tailwindcss [ bradlc.vscode-tailwindcss ]) - ++ (optionals (cfg.theme == "minimal") ( - pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - { - name = "minimalist-dark"; - publisher = "nichabosh"; - version = "1.0.0"; - sha256 = "sha256-lw+Scfada6DycLdRT2Cz+Fd12JucglIrw3uRd2ZhabQ="; - } - ] - )); - }; - }; - }; -} diff --git a/modules/users/editors/zed/default.nix b/modules/users/editors/zed/default.nix deleted file mode 100644 index 5ff0714..0000000 --- a/modules/users/editors/zed/default.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ - config, - lib, - ... -}: - -let - inherit (lib) - mkOption - types - mkIf - optionals - ; - cfg = config.nx.editors.zed-editor; -in -{ - options.nx.editors.zed-editor = { - enable = mkOption { - description = "Enable and setup zed editor"; - type = types.bool; - default = false; - }; - - langs = { - nix = mkOption { - description = "enable nix integration"; - type = types.bool; - default = true; - }; - python = mkOption { - description = "enable python integration"; - type = types.bool; - default = false; - }; - rust = mkOption { - description = "enable rust integration"; - type = types.bool; - default = false; - }; - go = mkOption { - description = "enable go integration"; - type = types.bool; - default = false; - }; - lua = mkOption { - description = "enable lua integration"; - type = types.bool; - default = false; - }; - docker = mkOption { - description = "enable docker integration"; - type = types.bool; - default = false; - }; - java = mkOption { - description = "enable java integration"; - type = types.bool; - default = false; - }; - cmake = mkOption { - description = "enable cmake integration"; - type = types.bool; - default = false; - }; - toml = mkOption { - description = "enable toml integration"; - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf cfg.enable { - programs.zed-editor = { - enable = true; - extensions = - [ ] - ++ (optionals cfg.langs.nix [ "nix" ]) - ++ (optionals cfg.langs.python [ "python" ]) - ++ (optionals cfg.langs.rust [ "rust" ]) - ++ (optionals cfg.langs.go [ "go" ]) - ++ (optionals cfg.langs.lua [ "lua" ]) - ++ (optionals cfg.langs.docker [ "dockerfile" ]) - ++ (optionals cfg.langs.java [ "java" ]) - ++ (optionals cfg.langs.cmake [ "cmake" ]) - ++ (optionals cfg.langs.toml [ "toml" ]); - userSettings = { - telemetry = { - metrics = false; - }; - }; - }; - }; -} diff --git a/modules/users/git/default.nix b/modules/users/git/default.nix deleted file mode 100644 index f1f555e..0000000 --- a/modules/users/git/default.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.git; - inherit (lib) mkOption mkIf types; -in -{ - options.nx.git = { - enable = mkOption { - description = "Enable git"; - type = types.bool; - default = false; - }; - - userName = mkOption { - description = "Git username"; - type = types.str; - default = "Leander Scherer"; - }; - - userEmail = mkOption { - description = "Git email"; - type = types.str; - default = "leander@schererleander.de"; - }; - - signKey = mkOption { - description = "Sign key"; - type = types.nullOr types.str; - default = "A3502B180BC1D41A"; - }; - - signFlavor = mkOption { - description = "Sign key flavor"; - type = types.enum [ - "ssh" - "openpgp" - ]; - default = "openpgp"; - }; - }; - - config = mkIf cfg.enable { - programs.git = { - enable = true; - - signing = mkIf (cfg.signKey != null) { - key = cfg.signKey; - signByDefault = true; - }; - - ignores = [ - "*~" - ".DS_Store" - ".direnv" - ".envrc" - ]; - - settings = { - user.name = cfg.userName; - user.email = cfg.userEmail; - help.autocorrect = 20; - alias = { - st = "status"; - co = "checkout"; - br = "branch"; - }; - pull.rebase = true; - gpg.format = cfg.signFlavor; - url."git@github.com:".insteadOf = "https://github.com"; - }; - }; - programs.diff-highlight = { - enable = true; - enableGitIntegration = true; - }; - }; -} diff --git a/modules/users/gpg/default.nix b/modules/users/gpg/default.nix deleted file mode 100644 index d5714b0..0000000 --- a/modules/users/gpg/default.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -let - inherit (lib) - mkOption - types - mkIf - ; - cfg = config.nx.gpg; -in -{ - - options.nx.gpg = { - enable = mkOption { - description = "GNU Privacy Guard"; - type = types.bool; - default = config.nx.git.enable; - }; - - gpgKey = mkOption { - description = "default gpg key"; - type = types.nullOr types.str; - default = ""; - }; - - pinentry = mkOption { - description = "pinentry flavor"; - type = types.enum [ - "curses" - "gnome3" - "qt" - "mac" - ]; - default = if pkgs.stdenv.isDarwin then "mac" else "curses"; - }; - }; - - config = lib.mkIf cfg.enable { - programs.gpg = { - enable = true; - #settings.default-key = mkIf (cfg.gpgKey != null) cfg.gpgKey; - }; - - services.gpg-agent = { - enable = true; - pinentry.package = - if cfg.pinentry == "gnome3" then - pkgs.pinentry-gnome3 - else if cfg.pinentry == "qt" then - pkgs.pinentry-qt - else if cfg.pinentry == "mac" then - pkgs.pinentry_mac - else - pkgs.pinentry-curses; - }; - }; -} diff --git a/modules/users/media/default.nix b/modules/users/media/default.nix deleted file mode 100644 index 89daaba..0000000 --- a/modules/users/media/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - imports = [ - ./nixcord - ./spicetify - ]; -} diff --git a/modules/users/media/nixcord/default.nix b/modules/users/media/nixcord/default.nix deleted file mode 100644 index d421abf..0000000 --- a/modules/users/media/nixcord/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.media.nixcord; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.media.nixcord = { - enable = lib.mkOption { - description = "Enable nixcord and setup"; - type = types.bool; - default = false; - }; - frameless = mkOption { - description = "Make discord frameless"; - type = types.bool; - default = true; - }; - }; - config = mkIf cfg.enable { - programs.nixcord = { - enable = true; - config = { - themeLinks = [ - "https://refact0r.github.io/system24/theme/system24.theme.css" - ]; - frameless = cfg.frameless; - plugins = { - alwaysAnimate.enable = false; - imageLink.enable = true; - imageZoom.enable = true; - translate.enable = true; - }; - }; - }; - }; -} diff --git a/modules/users/media/spicetify/default.nix b/modules/users/media/spicetify/default.nix deleted file mode 100644 index e78b779..0000000 --- a/modules/users/media/spicetify/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - config, - lib, - pkgs, - inputs, - ... -}: - -let - spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system}; - cfg = config.nx.media.spicetify; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.media.spicetify = { - enable = mkOption { - description = "Command-line tool to customize the official Spotify client"; - type = types.bool; - default = false; - }; - }; - - config = mkIf cfg.enable { - nixpkgs.config.allowUnfree = true; - programs.spicetify = { - enable = true; - enabledSnippets = with spicePkgs.snippets; [ - pointer - sonicDancing - modernScrollbar - nyanCatProgressBar - declutterNowPlayingBar - ]; - - enabledExtensions = with spicePkgs.extensions; [ - keyboardShortcut - ]; - - theme = spicePkgs.themes.sleek; - colorScheme = "Coral"; - }; - }; -} diff --git a/modules/users/productivity/anki/default.nix b/modules/users/productivity/anki/default.nix deleted file mode 100644 index 58d8f49..0000000 --- a/modules/users/productivity/anki/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.productivity.anki; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.productivity.anki = { - enable = mkOption { - description = "Anki free and open-source flashcard program"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - programs.anki = { - enable = true; - #style = "native"; - #addons = with pkgs.ankiAddons; [ - # anki-connect - # review-heatmap - #]; - }; - }; -} diff --git a/modules/users/productivity/default.nix b/modules/users/productivity/default.nix deleted file mode 100644 index 9e05dde..0000000 --- a/modules/users/productivity/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - imports = [ - ./anki - ./latex - ./obsidian - ./typst - ./nextcloud-client - ]; -} diff --git a/modules/users/productivity/latex/default.nix b/modules/users/productivity/latex/default.nix deleted file mode 100644 index 0720664..0000000 --- a/modules/users/productivity/latex/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - config, - options, - pkgs, - lib, - ... -}: -let - cfg = config.nx.productivity.latex; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.productivity.latex = { - enable = mkOption { - description = "LaTeX typesetting system"; - type = types.bool; - default = false; - }; - }; - - config = mkIf cfg.enable { - programs.texlive = { - enable = true; - # See https://mynixos.com/search?q=texlivepackages.collection for more collections - # and https://mynixos.com/search?q=texlivepackages for more individual packages. - extraPackages = tpkgs: { - inherit (tpkgs) - collection-basic - collection-latex - collection-latexrecommended - biblatex - ; - }; - }; - - home.packages = with pkgs; [ - biber - ]; - - programs.pandoc = { - enable = true; - defaults = { - pdf-engine = "pdfetex"; - }; - }; - }; -} diff --git a/modules/users/productivity/nextcloud-client/default.nix b/modules/users/productivity/nextcloud-client/default.nix deleted file mode 100644 index 1b92bb0..0000000 --- a/modules/users/productivity/nextcloud-client/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - username, - ... -}: - -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.productivity.nextcloud-client; -in -{ - options.nx.productivity.nextcloud-client = { - enable = mkOption { - description = "Client for nextcloud"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - #home.packages = with pkgs; [ nextcloud-client ]; - services.nextcloud-client = { - enable = true; - startInBackground = true; - }; - }; -} diff --git a/modules/users/productivity/obsidian/default.nix b/modules/users/productivity/obsidian/default.nix deleted file mode 100644 index 21b3f34..0000000 --- a/modules/users/productivity/obsidian/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.productivity.obsidian; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.productivity.obsidian = { - enable = mkOption { - description = "Obsidian note-taking application"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - programs.obsidian = { - enable = true; - }; - }; -} diff --git a/modules/users/productivity/typst/default.nix b/modules/users/productivity/typst/default.nix deleted file mode 100644 index f3e1981..0000000 --- a/modules/users/productivity/typst/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - cfg = config.nx.productivity.typst; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.productivity.typst = { - enable = mkOption { - description = "Typst markup-based typesetting system"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - typst - typst-fmt - ]; - }; -} diff --git a/modules/users/shells/bash/default.nix b/modules/users/shells/bash/default.nix deleted file mode 100644 index d17ffc5..0000000 --- a/modules/users/shells/bash/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkOption mkIf types; - cfg = config.nx.shells.bash; -in -{ - options.nx.shells.bash = { - enable = mkOption { - type = types.bool; - default = config.nx.terminal.defaultShell == "bash"; - }; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - zoxide - ]; - - programs.bash = { - enable = true; - enableCompletion = true; - initExtra = '' - # view man pages with nvim - export MANPAGER="nvim +Man!" - - # vim keybindings - set -o vi - - # zoxide smarter cd command - eval "$(zoxide init bash)" - ''; - shellAliases = { - ls = "ls --color=auto"; - }; - }; - }; -} diff --git a/modules/users/shells/default.nix b/modules/users/shells/default.nix deleted file mode 100644 index 9abd804..0000000 --- a/modules/users/shells/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - imports = [ - ./zsh - ./bash - ]; -} diff --git a/modules/users/shells/zsh/default.nix b/modules/users/shells/zsh/default.nix deleted file mode 100644 index 0b94c3d..0000000 --- a/modules/users/shells/zsh/default.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkOption mkIf types; - cfg = config.nx.shells.zsh; -in -{ - options.nx.shells.zsh = { - enable = mkOption { - type = types.bool; - default = config.nx.terminal.defaultShell == "zsh"; - }; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - zoxide - ]; - - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - initContent = '' - # view man pages with nvim - export MANPAGER="nvim +Man!" - - # Directory completion with trailing slash - zstyle ':completion:*' list-dirs-first true - zstyle ':completion:*' special-dirs true - zstyle ':completion:*' squeeze-slashes true - zstyle ':completion:*' add-space false - - # Case-insensitive completion - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' - # vim keybindings - bindkey -v - - # zoxide smarter cmd command - eval "$(zoxide init zsh)" - ''; - shellAliases = { - ls = "ls --color=auto"; - }; - - zplug = { - enable = true; - plugins = [ - { name = "mafredri/zsh-async"; } - { - name = "sindresorhus/pure"; - tags = [ - "as:theme" - "use:pure.zsh" - ]; - } - { name = "zdharma-continuum/fast-syntax-highlighting"; } - { name = "zsh-users/zsh-autosuggestions"; } - ]; - }; - }; - }; -} diff --git a/modules/users/terminal/default.nix b/modules/users/terminal/default.nix deleted file mode 100644 index 937c086..0000000 --- a/modules/users/terminal/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -let - inherit (lib) mkOption types; - cfg = config.nx.terminal; -in -{ - imports = [ - ./foot.nix - ./kitty.nix - ]; - options.nx.terminal = { - font = mkOption { - description = "default font"; - default = "Victor Mono"; - }; - - multiplexer = mkOption { - type = types.enum [ "tmux" ]; - default = "tmux"; - }; - - defaultShell = mkOption { - description = "default shell"; - type = types.enum [ - "bash" - "zsh" - ]; - default = "bash"; - }; - }; -} diff --git a/modules/users/terminal/foot.nix b/modules/users/terminal/foot.nix deleted file mode 100644 index fbaba8f..0000000 --- a/modules/users/terminal/foot.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -{ - options.nx.terminal.foot.enable = lib.mkEnableOption "Enable foot terminal"; - config = lib.mkIf config.nx.terminal.foot.enable { - home.packages = with pkgs; [ - nerd-fonts.space-mono - ]; - - programs.foot = { - enable = true; - settings = { - main = { - pad = "10x10"; - font = "SpaceMono Nerd Font Mono:size=10"; - line-height = 12; - }; - - cursor = { - style = "underline"; - unfocused-style = "unchanged"; - blink = true; - }; - - colors = { - alpha = 0.9; - # Gruvbox Theme - background = "000000"; - foreground = "ebdbb2"; - - regular0 = "282828"; - regular1 = "cc241d"; - regular2 = "98971a"; - regular3 = "d79921"; - regular4 = "458588"; - regular5 = "b16286"; - regular6 = "689d6a"; - regular7 = "a89984"; - - bright0 = "928374"; - bright1 = "fb4934"; - bright2 = "b8bb26"; - bright3 = "fabd2f"; - bright4 = "83a598"; - bright5 = "d3869b"; - bright6 = "8ec07c"; - bright7 = "ebdbb2"; - }; - }; - }; - }; -} diff --git a/modules/users/terminal/kitty.nix b/modules/users/terminal/kitty.nix deleted file mode 100644 index 02789cd..0000000 --- a/modules/users/terminal/kitty.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - lib, - ... -}: - -{ - options.nx.programs.kitty.enable = lib.mkEnableOption "Enable kitty"; - config = lib.mkIf config.nx.programs.kitty.enable { - programs.kitty = { - enable = true; - shellIntegration.enableFishIntegration = true; - font = { - name = "monospace"; - size = 11; - }; - settings = { - cursor_shape = "underline"; - cursor_blink_interval = "-1"; - cursor_stop_blinking_after = "15.0"; - - background_opacity = "0.3"; - - enable_audio_bell = false; - bell_on_tab = false; - - window_border_width = "0"; - window_margin_width = "4"; - window_padding_width = "5"; - }; - }; - }; -} diff --git a/modules/users/zathura/default.nix b/modules/users/zathura/default.nix deleted file mode 100644 index f07707c..0000000 --- a/modules/users/zathura/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.programs.zathura; - inherit (lib) mkOption mkIf types; -in -{ - options.nx.programs.zathura = { - enable = mkOption { - default = false; - description = "zathura document viewer"; - type = types.bool; - }; - }; - - config = mkIf cfg.enable { - programs.zathura = { - enable = true; - options = { - recolor-lightcolor = "rgba(0, 0, 0, 0)"; - recolor-darkcolor = "rgba(255, 255, 255, 1)"; - recolor = true; - adjust-open = "width"; - guioptions = "none"; - zoom-center = true; - page-padding = 0; - pages-per-row = 1; - scroll-page-aware = true; - }; - - mappings = { - i = "recolor"; - j = "navigate previous"; - k = "navigate next"; - }; - }; - }; -} -- cgit v1.3.1