diff --git a/machines/luna/configuration.nix b/machines/luna/configuration.nix index 6b95a6a..159912a 100644 --- a/machines/luna/configuration.nix +++ b/machines/luna/configuration.nix @@ -12,6 +12,6 @@ ]; networking.hostName = "luna"; - + system.stateVersion = "24.11"; } diff --git a/machines/luna/modules.nix b/machines/luna/modules.nix index 69f1dbd..987f6c6 100644 --- a/machines/luna/modules.nix +++ b/machines/luna/modules.nix @@ -41,7 +41,8 @@ apps = { dev.enable = true; - + visual.enable = true; + terminal.enable = true; }; }; } diff --git a/misc/backup.sh b/misc/backup.sh new file mode 100755 index 0000000..f8eab6c --- /dev/null +++ b/misc/backup.sh @@ -0,0 +1,14 @@ +#!/run/current-system/sw/bin/zsh + +cd /home/horseman +file=backups/$(date +%Y-%m-%d).tar +tar -cf $file Documents + +if grep -q $(sha256sum $file) backups/sum; then + echo 'hashes match, quitting' + rm $file + exit 0 +fi +echo $(sha256sum $file) > backups/sum + +exit 0 diff --git a/misc/nixos_wallpaper_dark_3840x2160.png b/misc/nixos_wallpaper_dark_3840x2160.png new file mode 100644 index 0000000..879b65a Binary files /dev/null and b/misc/nixos_wallpaper_dark_3840x2160.png differ diff --git a/misc/nixos_wallpaper_light_3840x2160.png b/misc/nixos_wallpaper_light_3840x2160.png new file mode 100644 index 0000000..3fff85b Binary files /dev/null and b/misc/nixos_wallpaper_light_3840x2160.png differ diff --git a/misc/startup.sh b/misc/startup.sh new file mode 100755 index 0000000..3c0122f --- /dev/null +++ b/misc/startup.sh @@ -0,0 +1,3 @@ +#!/run/current-system/sw/bin/zsh + +sudo ethtool -s eno1 wol g diff --git a/misc/switch-to-dark-theme.sh b/misc/switch-to-dark-theme.sh new file mode 100755 index 0000000..102d70e --- /dev/null +++ b/misc/switch-to-dark-theme.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +lookandfeeltool -a org.kde.breezedark.desktop + +qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript ' +var allDesktops = desktops(); +for (i = 0; i < allDesktops.length; i++) { + d = allDesktops[i]; + d.wallpaperPlugin = "org.kde.image"; + d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General"); + d.writeConfig("Image", "file:///home/horseman/nix-config/misc/nixos_wallpaper_dark_3840x2160.png"); +}' diff --git a/misc/switch-to-light-theme.sh b/misc/switch-to-light-theme.sh new file mode 100755 index 0000000..d34fed6 --- /dev/null +++ b/misc/switch-to-light-theme.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +lookandfeeltool -a org.kde.breeze.desktop + +qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript ' +var allDesktops = desktops(); +for (i = 0; i < allDesktops.length; i++) { + d = allDesktops[i]; + d.wallpaperPlugin = "org.kde.image"; + d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General"); + d.writeConfig("Image", "file:///home/horseman/nix-config/misc/nixos_wallpaper_light_3840x2160.png"); +}' diff --git a/modules/apps/default.nix b/modules/apps/default.nix index 66839cb..f199841 100644 --- a/modules/apps/default.nix +++ b/modules/apps/default.nix @@ -1,7 +1,10 @@ {inputs, ...}: { imports = [ - ./terminal.nix - ./visual.nix ./dev.nix + + ./terminal.nix + + ./visual.nix + ./visual/firefox.nix ]; } diff --git a/modules/apps/terminal.nix b/modules/apps/terminal.nix index 763902e..60ec294 100644 --- a/modules/apps/terminal.nix +++ b/modules/apps/terminal.nix @@ -8,6 +8,7 @@ }: let inherit (lib) mkEnableOption mkIf mkOption types; cfg = config.horseman.apps.terminal; + homeCfg = config.horseman; in { options = { horseman.apps.terminal = { @@ -16,9 +17,20 @@ in { }; config = { + home-manager.users.${homeCfg.username} = { + imports = [./terminal/neovim.nix]; + }; + services.lorri.enable = true; environment.systemPackages = with pkgs; [ + gnupg + neofetch + sops + sxiv + termdown + unzip + wakeonlan ]; }; } diff --git a/modules/apps/terminal/lualine.vim b/modules/apps/terminal/lualine.vim new file mode 100644 index 0000000..8ef1150 --- /dev/null +++ b/modules/apps/terminal/lualine.vim @@ -0,0 +1,44 @@ +lua << EOF + +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} + +EOF diff --git a/modules/apps/terminal/neovim.nix b/modules/apps/terminal/neovim.nix new file mode 100644 index 0000000..97e5fb7 --- /dev/null +++ b/modules/apps/terminal/neovim.nix @@ -0,0 +1,149 @@ +{ + config, + lib, + pkgs, + ... +}: { + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + extraPackages = with pkgs; [ + # LazyVim + lua-language-server + stylua + # Telescope + ripgrep + ]; + + plugins = with pkgs.vimPlugins; [ + lazy-nvim + ]; + + extraLuaConfig = let + plugins = with pkgs.vimPlugins; [ + # LazyVim + LazyVim + bufferline-nvim + cmp-buffer + cmp-nvim-lsp + cmp-path + cmp_luasnip + conform-nvim + dashboard-nvim + dressing-nvim + flash-nvim + friendly-snippets + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + neo-tree-nvim + neoconf-nvim + neodev-nvim + noice-nvim + nui-nvim + nvim-cmp + nvim-lint + nvim-lspconfig + nvim-notify + nvim-spectre + nvim-treesitter + nvim-treesitter-context + nvim-treesitter-textobjects + nvim-ts-autotag + nvim-ts-context-commentstring + nvim-web-devicons + persistence-nvim + plenary-nvim + telescope-fzf-native-nvim + telescope-nvim + todo-comments-nvim + tokyonight-nvim + trouble-nvim + vim-illuminate + vim-startuptime + which-key-nvim + { + name = "LuaSnip"; + path = luasnip; + } + { + name = "catppuccin"; + path = catppuccin-nvim; + } + { + name = "mini.ai"; + path = mini-nvim; + } + { + name = "mini.bufremove"; + path = mini-nvim; + } + { + name = "mini.comment"; + path = mini-nvim; + } + { + name = "mini.indentscope"; + path = mini-nvim; + } + { + name = "mini.pairs"; + path = mini-nvim; + } + { + name = "mini.surround"; + path = mini-nvim; + } + ]; + mkEntryFromDrv = drv: + if lib.isDerivation drv + then { + name = "${lib.getName drv}"; + path = drv; + } + else drv; + lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins); + in '' + require("lazy").setup({ + defaults = { + lazy = true, + }, + dev = { + -- reuse files from pkgs.vimPlugins.* + path = "${lazyPath}", + patterns = { "." }, + -- fallback to download + fallback = true, + }, + spec = { + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- The following configs are needed for fixing lazyvim on nix + -- force enable telescope-fzf-native.nvim + { "nvim-telescope/telescope-fzf-native.nvim", enabled = true }, + -- disable mason.nvim, use programs.neovim.extraPackages + { "williamboman/mason-lspconfig.nvim", enabled = false }, + { "williamboman/mason.nvim", enabled = false }, + -- import/override with your plugins + { import = "plugins" }, + -- treesitter handled by xdg.configFile."nvim/parser", put this line at the end of spec to clear ensure_installed + { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } }, + }, + }) + ''; + }; + + # https://github.com/nvim-treesitter/nvim-treesitter#i-get-query-error-invalid-node-type-at-position + xdg.configFile."nvim/parser".source = let + parsers = pkgs.symlinkJoin { + name = "treesitter-parsers"; + paths = + (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: + with plugins; [ + c + lua + ])) + .dependencies; + }; + in "${parsers}/parser"; +} diff --git a/modules/apps/visual.nix b/modules/apps/visual.nix index bf630c7..169cba6 100644 --- a/modules/apps/visual.nix +++ b/modules/apps/visual.nix @@ -8,6 +8,7 @@ }: let inherit (lib) mkEnableOption mkIf mkOption types; cfg = config.horseman.apps.visual; + homeCfg = config.horseman; in { options = { horseman.apps.visual = { @@ -16,7 +17,27 @@ in { }; config = { + horseman.apps.visual = { + firefox.enable = true; + }; + environment.systemPackages = with pkgs; [ + alacritty + albert + bitwarden + discord-ptb + gnome-calculator + inkscape + keepassxc + krita + libreoffice + mullvad-vpn + parsec-bin + qbittorrent + reaper + solaar + spotify + vlc ]; }; } diff --git a/modules/apps/visual/firefox.nix b/modules/apps/visual/firefox.nix index 2b0730d..107a400 100644 --- a/modules/apps/visual/firefox.nix +++ b/modules/apps/visual/firefox.nix @@ -1,65 +1,88 @@ { + inputs, + outputs, + lib, config, pkgs, ... -}: { - programs.firefox = { - enable = true; - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - DisablePocket = true; - DisableAccounts = true; - DisableFirefoxScreenshots = true; - DisplayBookmarksToolbar = "never"; - PasswordManagerEnabled = false; +}: let + inherit (lib) mkEnableOption mkIf mkOption types; + cfg = config.horseman.apps.visual.firefox; - ExtensionSettings = { - "*".installation_mode = "blocked"; - # uBlock Origin: - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - # Dark Reader - "addon@darkreader.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; - installation_mode = "force_installed"; - }; - # Advent of Code delta-rank - "{78b07db2-25ed-4088-9c92-5c5dcfca3c3c}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/advent-of-code-delta-score/latest.xpi"; - installation_mode = "force_installed"; - }; - # SponsorBlock - "sponsorBlocker@ajay.app" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; - installation_mode = "force_installed"; - }; - # KeepassXC - "keepassxc-browser@keepassxc.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/latest.xpi"; - installation_mode = "force_installed"; - }; - # Cookie Blocker - "idcac-pub@guus.ninja" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/istilldontcareaboutcookies/latest.xpi"; - installation_mode = "force_installed"; - }; - # Ghostery - "firefox@ghostery.com" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ghostery/latest.xpi"; - installation_mode = "force_installed"; - }; - }; + lock-false = { + Value = false; + Status = "locked"; + }; + lock-true = { + Value = true; + Status = "locked"; + }; +in { + options = { + horseman.apps.visual.firefox = { + enable = mkEnableOption "Firefox"; + }; + }; - Preferences = { - general = { - autoScroll = true; + config = { + programs.firefox = { + enable = true; + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + DisplayBookmarksToolbar = "never"; + PasswordManagerEnabled = false; + + ExtensionSettings = { + "*".installation_mode = "blocked"; + # uBlock Origin: + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + # Dark Reader + "addon@darkreader.org" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; + installation_mode = "force_installed"; + }; + # Advent of Code delta-rank + "{78b07db2-25ed-4088-9c92-5c5dcfca3c3c}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/advent-of-code-delta-score/latest.xpi"; + installation_mode = "force_installed"; + }; + # SponsorBlock + "sponsorBlocker@ajay.app" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; + installation_mode = "force_installed"; + }; + # KeepassXC + "keepassxc-browser@keepassxc.org" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/latest.xpi"; + installation_mode = "force_installed"; + }; + # Cookie Blocker + "idcac-pub@guus.ninja" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/istilldontcareaboutcookies/latest.xpi"; + installation_mode = "force_installed"; + }; + # Ghostery + "firefox@ghostery.com" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ghostery/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + + Preferences = { + general = { + autoScroll = true; + }; + "browser.newtabpage.activity-stream.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; }; - "browser.newtabpage.activity-stream.showSponsored" = lock-false; - "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; - "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; }; }; }; diff --git a/modules/username.nix b/modules/username.nix index 1010103..bc9a2b2 100644 --- a/modules/username.nix +++ b/modules/username.nix @@ -11,7 +11,7 @@ in { options = { horseman = { - username = mkOption { type = types.str; }; + username = mkOption {type = types.str;}; }; }; } diff --git a/modules/users/horseman.nix b/modules/users/horseman.nix index d4ce0f9..6d24b68 100644 --- a/modules/users/horseman.nix +++ b/modules/users/horseman.nix @@ -17,7 +17,7 @@ in { config = { home-manager = { - extraSpecialArgs = { inherit inputs outputs; }; + extraSpecialArgs = {inherit inputs outputs;}; users.horseman = { home = { username = "horseman"; diff --git a/modules/wm/plasma/default.nix b/modules/wm/plasma/default.nix index 0e210f0..8e9d519 100644 --- a/modules/wm/plasma/default.nix +++ b/modules/wm/plasma/default.nix @@ -8,6 +8,7 @@ }: let inherit (lib) mkEnableOption mkIf mkOption types; cfg = config.horseman.wm.plasma; + homeCfg = config.horseman; in { options = { horseman.wm.plasma = { @@ -32,7 +33,7 @@ in { konsole ]; - home-manager.users.horseman = { + home-manager.users.${homeCfg.username} = { imports = [./config.nix]; }; };