From 008b4ad3a40d91433fdc0d44742e52ccbf1e8a65 Mon Sep 17 00:00:00 2001 From: L-Nafaryus Date: Mon, 8 Jul 2024 15:07:24 +0500 Subject: [PATCH] flake: reformat all new: packages: bonvim, nixvim configuration of neovim remove: config: hyprland -> declarative remove: config: nvim nixosModules: structure with categories new: configurations: concept of preconfigured modules catarina: disable papermc server catarina: hydra server flake: hydraJobs outputs --- .editorconfig | 4 + apps/default.nix | 28 +- config/git/config | 31 - config/hypr/hyprland.conf | 281 ------- config/nvim/.neoconf.json | 15 - config/nvim/ginit.vim | 29 - config/nvim/init.lua | 7 - config/nvim/lua/config/autocmds.lua | 3 - config/nvim/lua/config/keymaps.lua | 15 - config/nvim/lua/config/lazy.lua | 46 - config/nvim/lua/config/options.lua | 3 - config/nvim/lua/plugins/user.lua | 70 -- config/nvim/stylua.toml | 4 - configurations/bonvim.nix | 629 ++++++++++++++ configurations/default.nix | 7 + devShells/bonfire.nix | 20 +- devShells/default.nix | 35 +- devShells/go.nix | 18 +- devShells/netgen.nix | 16 +- devShells/openfoam.nix | 16 +- devShells/rust-x11.nix | 44 +- devShells/rust.nix | 12 +- flake.lock | 364 ++++++-- flake.nix | 198 +++-- lib/default.nix | 22 +- lib/maintainers.nix | 12 +- nixosConfigurations/astora/default.nix | 372 +++++---- nixosConfigurations/astora/hardware.nix | 403 +++++---- nixosConfigurations/astora/users.nix | 788 ++++++++++++------ nixosConfigurations/catarina/default.nix | 510 ++++++------ nixosConfigurations/catarina/hardware.nix | 311 +++---- .../catarina/services/gitea.nix | 206 +++-- .../catarina/services/papermc.nix | 423 +++++----- nixosConfigurations/catarina/users.nix | 30 +- nixosModules/default.nix | 41 +- nixosModules/misc/bonfire/default.nix | 84 +- nixosModules/misc/bonfire/secrets/default.nix | 80 +- nixosModules/services/papermc.nix | 459 +++++----- nixosModules/services/qbittorrent-nox.nix | 229 ++--- nixosModules/services/spoofdpi.nix | 110 +-- packages/bonfire-docs/default.nix | 275 +++--- packages/bonvim/default.nix | 16 + packages/cargo-shuttle/default.nix | 52 +- packages/dearpygui/default.nix | 101 +-- packages/default.nix | 62 +- packages/lego/default.nix | 59 +- packages/netgen/default.nix | 101 +-- packages/nix-minimal/default.nix | 240 +++--- packages/nix-runner/default.nix | 59 +- packages/openfoam/default.nix | 111 +-- packages/spoofdpi/default.nix | 52 +- packages/ultimmc/default.nix | 138 +-- templates/rust/flake.nix | 90 +- 53 files changed, 4126 insertions(+), 3205 deletions(-) create mode 100644 .editorconfig delete mode 100644 config/git/config delete mode 100644 config/hypr/hyprland.conf delete mode 100644 config/nvim/.neoconf.json delete mode 100644 config/nvim/ginit.vim delete mode 100644 config/nvim/init.lua delete mode 100644 config/nvim/lua/config/autocmds.lua delete mode 100644 config/nvim/lua/config/keymaps.lua delete mode 100644 config/nvim/lua/config/lazy.lua delete mode 100644 config/nvim/lua/config/options.lua delete mode 100644 config/nvim/lua/plugins/user.lua delete mode 100644 config/nvim/stylua.toml create mode 100644 configurations/bonvim.nix create mode 100644 configurations/default.nix create mode 100644 packages/bonvim/default.nix diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..27d5aa5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +indent_style = "space" +indent_size = 4 +end_of_line = "cr" +charset = "utf-8" diff --git a/apps/default.nix b/apps/default.nix index 54fa8d1..3d03c2a 100644 --- a/apps/default.nix +++ b/apps/default.nix @@ -1,14 +1,16 @@ -{ self, nixpkgs, ... }: -let - forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ]; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); +{ + self, + nixpkgs, + ... +}: let + forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux"]; + nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); +in + forAllSystems (system: let + pkgs = nixpkgsFor.${system}; -in forAllSystems(system: let - pkgs = nixpkgsFor.${system}; - - bonfire = self; - bonfire-lib = self.lib; - bonfire-pkgs = self.packages.${system}; - in { - -}) + bonfire = self; + bonfire-lib = self.lib; + bonfire-pkgs = self.packages.${system}; + in { + }) diff --git a/config/git/config b/config/git/config deleted file mode 100644 index 2598039..0000000 --- a/config/git/config +++ /dev/null @@ -1,31 +0,0 @@ -[user] - name = L-Nafaryus - email = l.nafaryus@gmail.com - signingKey = 86F1EA98B48FFB19 -[commit] - gpgsign = true -[tag] - gpgsign = true -[init] - defaultBranch = master -[diff] - submodule = log -[color] - diff = auto - status = auto - branch = auto -[core] - quotePath = false - commitGraph = true - whitespace = trailing-space -[receive] - advertisePushOptions = true -[gc] - writeCommitGraph = true -[alias] - lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -[filter "lfs"] - required = true - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf deleted file mode 100644 index 35c43ac..0000000 --- a/config/hypr/hyprland.conf +++ /dev/null @@ -1,281 +0,0 @@ - -# ####################################################################################### -# AUTOGENERATED HYPR CONFIG. -# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT, -# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. -# ####################################################################################### - -autogenerated = 0 # remove this line to remove the warning - -# This is an example Hyprland config file. -# Refer to the wiki for more information. -# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/ - -# Please note not all available settings / options are set here. -# For a full list, see the wiki - -# You can split this configuration into multiple files -# Create your files separately and then link them to this file like this: -# source = ~/.config/hypr/myColors.conf - - -################ -### MONITORS ### -################ - -# See https://wiki.hyprland.org/Configuring/Monitors/ -monitor = desc:AOC Q27B3MA 17ZPAHA006135, 2560x1440@75, 0x0, auto -monitor = desc:AOC Q27G2G3R3B 137P4HA000540, 2560x1440@165, 2560x0, auto -monitor = Unknown-1, disable - -################### -### MY PROGRAMS ### -################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ - -# Set programs that you use -$terminal = alacritty -$fileManager = dolphin -$menu = rofi -show drun - - -################# -### AUTOSTART ### -################# - -# Autostart necessary processes (like notifications daemons, status bars, etc.) -# Or execute your favorite apps at launch like this: - -# exec-once = $terminal -# exec-once = nm-applet & -# exec-once = waybar & hyprpaper & firefox -exec-once = eww daemon -exec-once = eww open topbar -exec-once = nm-applet --indicator & -exec-once = blueman-applet & -exec-once = wl-gammarelay-rs run & -exec-once = systemctl --user start hypridle -exec-once = wl-paste --type text --watch cliphist store #Stores only text data -exec-once = wl-paste --type image --watch cliphist store #Stores only image data -exec-once = swww-daemon & swww img ~/Pictures/wallpapers/emily-in-the-cyberpunk-city.3840x2160.png & swww img ~/Pictures/wallpapers/emily-in-the-cyberpunk-city.3840x2160a.gif - -############################# -### ENVIRONMENT VARIABLES ### -############################# - -# See https://wiki.hyprland.org/Configuring/Environment-variables/ - -env = XCURSOR_SIZE,16 -env = HYPRCURSOR_SIZE,16 -env = WLR_DRM_NO_ATOMIC,1 - - -##################### -### LOOK AND FEEL ### -##################### - -# Refer to https://wiki.hyprland.org/Configuring/Variables/ - -# https://wiki.hyprland.org/Configuring/Variables/#general -general { - gaps_in = 5 - gaps_out = 5 - - border_size = 2 - - # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors - col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg - col.inactive_border = rgba(595959aa) - - # Set to true enable resizing windows by clicking and dragging on borders and gaps - resize_on_border = true - - # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on - allow_tearing = true - - layout = dwindle -} - -# https://wiki.hyprland.org/Configuring/Variables/#decoration -decoration { - rounding = 5 - - # Change transparency of focused and unfocused windows - active_opacity = 1.0 - inactive_opacity = 0.95 - - drop_shadow = true - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) - - # https://wiki.hyprland.org/Configuring/Variables/#blur - blur { - enabled = true - size = 3 - passes = 1 - - vibrancy = 0.1696 - } -} - -# https://wiki.hyprland.org/Configuring/Variables/#animations -animations { - enabled = true - - # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - - animation = windows, 1, 7, myBezier - animation = windowsOut, 1, 7, default, popin 80% - animation = border, 1, 10, default - animation = borderangle, 1, 8, default - animation = fade, 1, 7, default - animation = workspaces, 1, 6, default -} - -# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more -dwindle { - pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = true # You probably want this -} - -# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more -master { - new_is_master = true -} - -# https://wiki.hyprland.org/Configuring/Variables/#misc -misc { - force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers - disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :( -} - -############# -### INPUT ### -############# - -# https://wiki.hyprland.org/Configuring/Variables/#input -input { - kb_layout = us,ru - kb_variant = - kb_model = - kb_options = - kb_rules = - - follow_mouse = 1 - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. - - touchpad { - natural_scroll = false - } -} - -# https://wiki.hyprland.org/Configuring/Variables/#gestures -gestures { - workspace_swipe = false -} - -# Example per-device config -# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more -device { - name = epic-mouse-v1 - sensitivity = -0.5 -} - - -#################### -### KEYBINDINGSS ### -#################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ - -# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = SUPER, Q, exec, $terminal -bind = SUPER, C, killactive, -bind = SUPER, M, exit, -bind = SUPER, E, exec, $fileManager -bind = SUPER, V, togglefloating, -bind = SUPER, F, fullscreen, -bind = SUPER, R, exec, $menu -bind = SUPER, P, pseudo, # dwindle -bind = SUPER, J, togglesplit, # dwindle - -# Move focus with mainMod + arrow keys -bind = SUPER, left, movefocus, l -bind = SUPER, right, movefocus, r -bind = SUPER, up, movefocus, u -bind = SUPER, down, movefocus, d - -# Switch workspaces with mainMod + [0-9] -bind = SUPER, 1, workspace, 1 -bind = SUPER, 2, workspace, 2 -bind = SUPER, 3, workspace, 3 -bind = SUPER, 4, workspace, 4 -bind = SUPER, 5, workspace, 5 -bind = SUPER, 6, workspace, 6 -bind = SUPER, 7, workspace, 7 -bind = SUPER, 8, workspace, 8 -bind = SUPER, 9, workspace, 9 -bind = SUPER, 0, workspace, 10 - -# Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = SUPER SHIFT, 1, movetoworkspace, 1 -bind = SUPER SHIFT, 2, movetoworkspace, 2 -bind = SUPER SHIFT, 3, movetoworkspace, 3 -bind = SUPER SHIFT, 4, movetoworkspace, 4 -bind = SUPER SHIFT, 5, movetoworkspace, 5 -bind = SUPER SHIFT, 6, movetoworkspace, 6 -bind = SUPER SHIFT, 7, movetoworkspace, 7 -bind = SUPER SHIFT, 8, movetoworkspace, 8 -bind = SUPER SHIFT, 9, movetoworkspace, 9 -bind = SUPER SHIFT, 0, movetoworkspace, 10 - -# Example special workspace (scratchpad) -bind = SUPER, S, togglespecialworkspace, magic -bind = SUPER SHIFT, S, movetoworkspace, special:magic - -# Scroll through existing workspaces with mainMod + scroll -bind = SUPER, mouse_down, workspace, e+1 -bind = SUPER, mouse_up, workspace, e-1 - -# Move/resize windows with mainMod + LMB/RMB and dragging -bindm = SUPER, mouse:272, movewindow -bindm = SUPER, mouse:273, resizewindow - -bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle -bindl = , XF86AudioPrev, exec, playerctl previous -bindl = , XF86AudioPlay, exec, playerctl play-pause -bindl = , XF86AudioNext, exec, playerctl next -bindl = , XF86MonBrightnessDown, exec, busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n -500 -bindl = , XF86MonBrightnessUp, exec, busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n +500 -bindl = SUPER, XF86MonBrightnessDown, exec, busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay Brightness d -0.1 -bindl = SUPER, XF86MonBrightnessUp, exec, busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay Brightness d +0.1 - -bind = SUPER, SPACE, exec, hyprctl switchxkblayout keychron-keychron-k3-pro next -bind = , PRINT, exec, hyprshot -m region -bind = SUPER, H, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy -#bind = CTRL, V, exec, wl-paste - -############################## -### WINDOWS AND WORKSPACES ### -############################## - -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules - -# Example windowrule v1 -# windowrule = float, ^(kitty)$ - -# Example windowrule v2 -# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ - -windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. -windowrulev2 = float, class:^(steam_app.*)$ -windowrulev2 = immediate, class:^(steam_app.*)$ -windowrulev2 = float, class:^(steam_proton.*)$ diff --git a/config/nvim/.neoconf.json b/config/nvim/.neoconf.json deleted file mode 100644 index 6e89f00..0000000 --- a/config/nvim/.neoconf.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} diff --git a/config/nvim/ginit.vim b/config/nvim/ginit.vim deleted file mode 100644 index cc27af7..0000000 --- a/config/nvim/ginit.vim +++ /dev/null @@ -1,29 +0,0 @@ -" Enable Mouse -set mouse=a - -" Set Editor Font -if exists(':GuiFont') - " Use GuiFont! to ignore font errors - GuiFont MesloLGS Nerd Font Mono:h10 -endif - -" Disable GUI Tabline -if exists(':GuiTabline') - GuiTabline 0 -endif - -" Disable GUI Popupmenu -if exists(':GuiPopupmenu') - GuiPopupmenu 0 -endif - -" Enable GUI ScrollBar -if exists(':GuiScrollBar') - GuiScrollBar 0 -endif - -" Right Click Context Menu (Copy-Cut-Paste) -nnoremap :call GuiShowContextMenu() -inoremap :call GuiShowContextMenu() -xnoremap :call GuiShowContextMenu()gv -snoremap :call GuiShowContextMenu()gv diff --git a/config/nvim/init.lua b/config/nvim/init.lua deleted file mode 100644 index 1dd52c0..0000000 --- a/config/nvim/init.lua +++ /dev/null @@ -1,7 +0,0 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") - -vim.o.tabstop = 4 -- A TAB character looks like 4 spaces -vim.o.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character -vim.o.softtabstop = 4 -- Number of spaces inserted instead of a TAB character -vim.o.shiftwidth = 4 -- Number of spaces inserted when indenting diff --git a/config/nvim/lua/config/autocmds.lua b/config/nvim/lua/config/autocmds.lua deleted file mode 100644 index d9ea6db..0000000 --- a/config/nvim/lua/config/autocmds.lua +++ /dev/null @@ -1,3 +0,0 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- Add any additional autocmds here diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua deleted file mode 100644 index 5756b96..0000000 --- a/config/nvim/lua/config/keymaps.lua +++ /dev/null @@ -1,15 +0,0 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here - --- Move to window -vim.keymap.set("n", "", "h", { desc = "Go to left window", remap = true }) -vim.keymap.set("n", "", "j", { desc = "Go to lower window", remap = true }) -vim.keymap.set("n", "", "k", { desc = "Go to upper window", remap = true }) -vim.keymap.set("n", "", "l", { desc = "Go to right window", remap = true }) - --- Resize window using arrow keys -vim.keymap.set("n", "", "resize +2", { desc = "Increase window height" }) -vim.keymap.set("n", "", "resize -2", { desc = "Decrease window height" }) -vim.keymap.set("n", "", "vertical resize -2", { desc = "Decrease window width" }) -vim.keymap.set("n", "", "vertical resize +2", { desc = "Increase window width" }) diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua deleted file mode 100644 index 2d56dcb..0000000 --- a/config/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,46 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - -- bootstrap lazy.nvim - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) -end -vim.opt.rtp:prepend(vim.env.LAZY or lazypath) - -require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import any extras modules here - -- { import = "lazyvim.plugins.extras.lang.typescript" }, - -- { import = "lazyvim.plugins.extras.lang.json" }, - -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, - -- import/override with your plugins - { import = "plugins" }, - }, - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver - }, - install = { colorscheme = { "tokyonight", "habamax" } }, - checker = { enabled = true }, -- automatically check for plugin updates - performance = { - rtp = { - -- disable some rtp plugins - disabled_plugins = { - "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - }, - }, - }, -}) diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua deleted file mode 100644 index 415944a..0000000 --- a/config/nvim/lua/config/options.lua +++ /dev/null @@ -1,3 +0,0 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here diff --git a/config/nvim/lua/plugins/user.lua b/config/nvim/lua/plugins/user.lua deleted file mode 100644 index b980cff..0000000 --- a/config/nvim/lua/plugins/user.lua +++ /dev/null @@ -1,70 +0,0 @@ -return { - - { - "ellisonleao/gruvbox.nvim", - }, - - { - "folke/tokyonight.nvim", - style = "moon", - priority = 1000, - }, - - { "skywind3000/asyncrun.vim" }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "tokyonight", - }, - }, - - { "equalsraf/neovim-gui-shim" }, - - { - "nvim-neo-tree/neo-tree.nvim", - opts = { - filesystem = { - filtered_items = { - hide_dotfiles = false, - hide_gitignored = false, - }, - use_libuv_file_watcher = true, - }, - }, - }, - - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - }, - - { - "nvim-orgmode/orgmode", - dependencies = { - { "nvim-treesitter/nvim-treesitter", lazy = true }, - }, - event = "VeryLazy", - config = function() - require("orgmode").setup_ts_grammar() - - require("nvim-treesitter.configs").setup({ - highlight = { - enable = true, - additional_vim_regex_highlighting = { "org" }, - }, - ensure_installed = { "org" }, - }) - - require("orgmode").setup() - end, - }, - - { - "williamboman/mason.nvim", - config = function() - require("mason").setup({ PATH = "append" }) - end - } -} diff --git a/config/nvim/stylua.toml b/config/nvim/stylua.toml deleted file mode 100644 index 6dc96a7..0000000 --- a/config/nvim/stylua.toml +++ /dev/null @@ -1,4 +0,0 @@ -indent_type = "Spaces" -indent_width = 4 -column_width = 120 - diff --git a/configurations/bonvim.nix b/configurations/bonvim.nix new file mode 100644 index 0000000..c3009be --- /dev/null +++ b/configurations/bonvim.nix @@ -0,0 +1,629 @@ +{ + config, + lib, + pkgs, + rustc ? pkgs.rustc, + cargo ? pkgs.cargo, + rust-analyzer ? pkgs.rust-analyzer, + ... +}: { + # General + globals.mapleader = " "; + + opts = { + # Show line numbers + number = true; + relativenumber = true; + # Tab need 4 spaces please + expandtab = true; + tabstop = 4; + softtabstop = 4; + shiftwidth = 4; + showtabline = 4; + # Hide * markup + conceallevel = 2; + # Confirm on save + confirm = true; + + cursorline = true; + # Invisible characters I see you + list = true; + + ignorecase = true; + + grepprg = "${lib.getExe pkgs.ripgrep} --vimgrep"; + + termguicolors = true; + # Splits + splitbelow = true; + splitright = true; + splitkeep = "screen"; + # U, u, undo + undofile = true; + undolevels = 10000; + updatetime = 200; + # Command line completion mode + wildmode = "longest:full,full"; + + smoothscroll = true; + + autowrite = true; + }; + + globals = { + bigfile_size = 1024 * 1024 * 1.5; + }; + + editorconfig.enable = true; + + # Clipboard + clipboard = { + register = "unnamedplus"; + providers.wl-copy.enable = true; + }; + + # Copy/paste + plugins.yanky = { + enable = true; + systemClipboard.syncWithRing = true; + }; + + extraPlugins = with pkgs.vimPlugins; [nvim-web-devicons]; + + # Theme + colorschemes.catppuccin = { + enable = true; + settings = { + flavour = "macchiato"; + no_bold = false; + no_italic = false; + no_underline = false; + integrations = { + cmp = true; + notify = true; + gitsigns = true; + neotree = true; + which_key = true; + illuminate = { + enabled = true; + }; + treesitter = true; + telescope.enabled = true; + indent_blankline.enabled = true; + mini.enabled = true; + native_lsp = { + enabled = true; + inlay_hints = { + background = true; + }; + underlines = { + errors = ["underline"]; + hints = ["underline"]; + information = ["underline"]; + warnings = ["underline"]; + }; + }; + }; + }; + }; + + # File tree + plugins.neo-tree = { + enable = true; + filesystem = { + useLibuvFileWatcher = true; + filteredItems = { + hideDotfiles = false; + hideGitignored = false; + }; + }; + defaultComponentConfigs = { + indent = { + withExpanders = true; + expanderCollapsed = ""; + expanderExpanded = ""; + expanderHighlight = "NeoTreeExpander"; + }; + }; + }; + + # UI + plugins.noice = { + enable = true; + lsp.override = { + "cmp.entry.get_documentation" = true; + "vim.lsp.util.convert_input_to_markdown_lines" = true; + "vim.lsp.util.stylize_markdown" = true; + }; + presets = { + long_message_to_split = true; + }; + }; + + plugins.dressing = { + enable = true; + }; + + # Status line + plugins.bufferline = { + enable = true; + diagnostics = "nvim_lsp"; + mode = "buffers"; + + offsets = [ + { + filetype = "neo-tree"; + text = "Neo-tree"; + highlight = "Directory"; + text_align = "left"; + } + ]; + }; + + plugins.lualine = { + enable = true; + globalstatus = true; + extensions = ["neo-tree"]; + sections = { + lualine_a = [ + { + name = "mode"; + separator.right = ""; + } + ]; + lualine_b = [ + { + name = "branch"; + icon = ""; + separator.right = ""; + } + ]; + lualine_c = [ + { + name = "diagnostics"; + separator.right = ">"; + extraConfig = { + sources = ["nvim_lsp"]; + symbols = { + error = " "; + warn = " "; + info = " "; + hint = "󰝶 "; + }; + }; + } + { + name = "filetype"; + extraConfig = { + icon_only = true; + separator = ""; + padding = { + left = 1; + right = 0; + }; + }; + } + { + name = "filename"; + extraConfig = { + path = 1; + }; + } + ]; + lualine_x = [ + { + name = "diff"; + extraConfig = { + symbols = { + added = " "; + modified = " "; + removed = " "; + }; + source.__raw = '' + function() + local gitsings = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitigns.added, + modified = gitigns.changed, + removed = gitigns.removed + } + end + end + ''; + }; + } + ]; + lualine_y = [ + { + separator.left = ""; + name = "progress"; + padding = { + left = 1; + right = 0; + }; + } + { + name = "location"; + padding = { + left = 0; + right = 1; + }; + } + ]; + lualine_z = [ + { + separator.left = ""; + fmt = '' + function(text) + return " " .. os.date("%R") + end + ''; + } + ]; + }; + }; + + plugins.notify.enable = true; + + plugins.project-nvim = { + enable = true; + enableTelescope = true; + showHidden = true; + }; + + # Syntax highlight + plugins.treesitter = { + enable = true; + }; + + plugins.treesitter-textobjects.enable = true; + + # Double trouble of your code + plugins.trouble = { + enable = true; + }; + + # Multifile search/replace + plugins.spectre = { + enable = true; + findPackage = pkgs.ripgrep; + replacePackage = pkgs.gnused; + }; + + plugins.which-key = { + enable = true; + icons.group = "+"; + registrations = { + "g" = "+ Git"; + "c" = "+ Code"; + "s" = "+ Search"; + "w" = "+ Window"; + "q" = "+ Quit"; + }; + }; + + # LSP + plugins = { + lsp-lines.enable = true; + lsp-format.enable = true; + lsp = { + enable = true; + inlayHints = true; + keymaps = { + # vim.diagnostic. + diagnostic = { + "cd" = { + action = "open_float"; + desc = "Line diagnostics"; + }; + }; + # vim.lsp.buf. + lspBuf = { + "K" = "hover"; + "gK" = "signature_help"; + "gr" = "references"; + "gd" = "definition"; + "gi" = "implementation"; + "gt" = "type_definition"; + "cr" = "rename"; + "cf" = "format"; + }; + extra = [ + { + key = "cf"; + action.__raw = "vim.lsp.buf.format"; + options.desc = "Format"; + } + ]; + }; + servers = { + clangd = { + enable = true; + cmd = [ + "${config.plugins.lsp.servers.clangd.package}/bin/clangd" + "--background-index" + "--clang-tidy" + "--header-insertion=iwyu" + "--completion-style=detailed" + "--function-arg-placeholders" + "--fallback-style=llvm" + ]; + }; + cmake.enable = true; + nil-ls.enable = true; + # pylyzer.enable = true; # not working with virtual environments currently :( + pylsp = { + enable = true; + settings.plugins = { + pyflakes.enabled = true; + black.enabled = true; + }; + }; + rust-analyzer = { + enable = true; + package = rust-analyzer; + cargoPackage = cargo; + rustcPackage = rustc; + installCargo = true; + installRustc = true; + }; + volar.enable = true; + tailwindcss.enable = true; + marksman.enable = true; + }; + }; + }; + + # VCS + plugins.gitsigns = { + enable = true; + settings = { + signs = { + add = { + text = "▎"; + }; + change = { + text = "▎"; + }; + delete = { + text = ""; + }; + untracked = { + text = "▎"; + }; + topdelete = { + text = ""; + }; + changedelete = { + text = "▎"; + }; + }; + }; + }; + + plugins.lazygit.enable = true; + + # Formatting + plugins.none-ls = { + enable = true; + # nix + sources.formatting.alejandra.enable = true; + }; + + # Search, search, search + plugins.telescope = { + enable = true; + extensions.fzf-native.enable = true; + keymaps = { + "sgf" = { + action = "git_files"; + options = { + desc = "Files"; + }; + }; + "sgc" = { + action = "git_commits"; + options = { + desc = "Commits"; + }; + }; + "sgs" = { + action = "git_status"; + options = { + desc = "Status"; + }; + }; + "sk" = { + action = "keymaps"; + options = { + desc = "Key Maps"; + }; + }; + "sf" = { + action = "live_grep"; + options = { + desc = "Grep Root Directory"; + }; + }; + }; + }; + + plugins.todo-comments.enable = true; + + # Terminal + plugins.toggleterm = { + enable = true; + settings = { + direction = "float"; + open_mapping = "[[]]"; + }; + }; + + # Completion + plugins = { + cmp = { + enable = true; + settings = { + sources = [ + { + name = "nvim_lsp"; + } + { + name = "path"; + } + { + name = "buffer"; + } + ]; + experimental = { + ghost_text = { + hl_group = "CmpGhostText"; + }; + }; + mapping = { + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true; })"; + }; + }; + }; + cmp-nvim-lsp.enable = true; + cmp-path.enable = true; + cmp-buffer.enable = true; + }; + + # Keymaps + keymaps = [ + # General + { + mode = "n"; + key = "qq"; + action = "qa"; + options = {desc = "Quit All";}; + } + + { + mode = "n"; + key = "ww"; + action = "p"; + options = {desc = "Other Window";}; + } + { + mode = "n"; + key = "wd"; + action = "c"; + options = {desc = "Delete Window";}; + } + { + mode = "n"; + key = "ws"; + action = "s"; + options = {desc = "Split Below";}; + } + { + mode = "n"; + key = "wv"; + action = "v"; + options = {desc = "Split Right";}; + } + { + mode = "n"; + key = ""; + action = "h"; + options = {desc = "Go To Left Window";}; + } + { + mode = "n"; + key = ""; + action = "j"; + options = {desc = "Go To Lower Window";}; + } + { + mode = "n"; + key = ""; + action = "k"; + options = {desc = "Go To Upper Window";}; + } + { + mode = "n"; + key = ""; + action = "l"; + options = {desc = "Go To Right Window";}; + } + + { + mode = "v"; + key = ">"; + action = ">gv"; + options = {desc = "Indent right selected text";}; + } + { + mode = "v"; + key = "<"; + action = " 0) playerlist; - whitelist = map (player: removeAttrs player [ "level" ]) playerlist; + operators = lib.filter (player: player.level > 0) playerlist; + whitelist = map (player: removeAttrs player ["level"]) playerlist; - # Plugins + # Plugins - passky = stdenv.mkDerivation rec { - pname = "Passky"; - version = "2.1.1"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/Black1_TV/Passky/versions/${version}/PAPER/Passky-${version}.jar"; - hash = "sha256-D5NpFrkGLgZNMS5WlMRM3Uv07hPsI9Hdsii2whTAZ2o="; - }; - meta.homepage = "https://hangar.papermc.io/Black1_TV/Passky"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + passky = stdenv.mkDerivation rec { + pname = "Passky"; + version = "2.1.1"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/Black1_TV/Passky/versions/${version}/PAPER/Passky-${version}.jar"; + hash = "sha256-D5NpFrkGLgZNMS5WlMRM3Uv07hPsI9Hdsii2whTAZ2o="; }; + meta.homepage = "https://hangar.papermc.io/Black1_TV/Passky"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - grimAnticheat = stdenv.mkDerivation rec { - pname = "GrimAC"; - version = "2.3.46"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/GrimAnticheat/GrimAnticheat/versions/${version}/PAPER/grimac-${version}.jar"; - hash = "sha256-tG8pBDMU4N/Ijn5RfdsQrtY4/gEhN1wEDCopqOSIqB4="; - }; - meta.homepage = "https://hangar.papermc.io/GrimAnticheat/GrimAnticheat"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + grimAnticheat = stdenv.mkDerivation rec { + pname = "GrimAC"; + version = "2.3.46"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/GrimAnticheat/GrimAnticheat/versions/${version}/PAPER/grimac-${version}.jar"; + hash = "sha256-tG8pBDMU4N/Ijn5RfdsQrtY4/gEhN1wEDCopqOSIqB4="; }; + meta.homepage = "https://hangar.papermc.io/GrimAnticheat/GrimAnticheat"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - viaVersion = stdenv.mkDerivation rec { - pname = "ViaVersion"; - version = "4.9.2"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/ViaVersion/ViaVersion/versions/${version}/PAPER/ViaVersion-${version}.jar"; - hash = "sha256-dvcyqCpIjArKCnUAD/L+lG/5gRQ9fLMKcl/+o8sLmYs="; - }; - meta.homepage = "https://hangar.papermc.io/ViaVersion/ViaVersion"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + viaVersion = stdenv.mkDerivation rec { + pname = "ViaVersion"; + version = "4.9.2"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/ViaVersion/ViaVersion/versions/${version}/PAPER/ViaVersion-${version}.jar"; + hash = "sha256-dvcyqCpIjArKCnUAD/L+lG/5gRQ9fLMKcl/+o8sLmYs="; }; + meta.homepage = "https://hangar.papermc.io/ViaVersion/ViaVersion"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - directionHUD = stdenv.mkDerivation rec { - pname = "DirectionHUD"; - version = "1.2.2"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/other/DirectionHUD/versions/${version}%2B1.18-1.20.2/PAPER/directionhud-spigot-${version}%2B1.18-1.20.2.jar"; - hash = "sha256-F+86Q58+3VoqNoD8P38bu8u1Hx8Si0lxNXZnF/R4hAg="; - }; - meta.homepage = "https://hangar.papermc.io/other/DirectionHUD"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + directionHUD = stdenv.mkDerivation rec { + pname = "DirectionHUD"; + version = "1.2.2"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/other/DirectionHUD/versions/${version}%2B1.18-1.20.2/PAPER/directionhud-spigot-${version}%2B1.18-1.20.2.jar"; + hash = "sha256-F+86Q58+3VoqNoD8P38bu8u1Hx8Si0lxNXZnF/R4hAg="; }; + meta.homepage = "https://hangar.papermc.io/other/DirectionHUD"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - miniMOTD = stdenv.mkDerivation rec { - pname = "MiniMOTD"; - version = "2.0.14"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/jmp/MiniMOTD/versions/${version}/PAPER/minimotd-bukkit-${version}.jar"; - hash = "sha256-d7l/pZGxteS2A9c9PIZASDTACGev8HY5SHZRvcxBc5A="; - }; - meta.homepage = "https://hangar.papermc.io/jmp/MiniMOTD"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + miniMOTD = stdenv.mkDerivation rec { + pname = "MiniMOTD"; + version = "2.0.14"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/jmp/MiniMOTD/versions/${version}/PAPER/minimotd-bukkit-${version}.jar"; + hash = "sha256-d7l/pZGxteS2A9c9PIZASDTACGev8HY5SHZRvcxBc5A="; }; + meta.homepage = "https://hangar.papermc.io/jmp/MiniMOTD"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - skinsRestorer = stdenv.mkDerivation rec { - pname = "SkinsRestorer"; - version = "15.0.2"; - src = fetchurl { - url = "https://github.com/SkinsRestorer/SkinsRestorerX/releases/download/${version}/SkinsRestorer.jar"; - hash = "sha256-fhAegFtl22xKXMi5MbsXCYOjbfqOlQTnILoEJxCDbkc="; - }; - meta.homepage = "https://hangar.papermc.io/SRTeam/SkinsRestorer"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + skinsRestorer = stdenv.mkDerivation rec { + pname = "SkinsRestorer"; + version = "15.0.2"; + src = fetchurl { + url = "https://github.com/SkinsRestorer/SkinsRestorerX/releases/download/${version}/SkinsRestorer.jar"; + hash = "sha256-fhAegFtl22xKXMi5MbsXCYOjbfqOlQTnILoEJxCDbkc="; }; + meta.homepage = "https://hangar.papermc.io/SRTeam/SkinsRestorer"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - squaremap = stdenv.mkDerivation rec { - pname = "squaremap"; - version = "1.2.2"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/jmp/squaremap/versions/${version}/PAPER/squaremap-paper-mc1.20.2-${version}.jar"; - hash = "sha256-Z8AWzZLlZavF8YYs1kslhtCvzq5fZ7O97mTx3hCgj78="; - }; - meta.homepage = "https://hangar.papermc.io/jmp/squaremap"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + squaremap = stdenv.mkDerivation rec { + pname = "squaremap"; + version = "1.2.2"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/jmp/squaremap/versions/${version}/PAPER/squaremap-paper-mc1.20.2-${version}.jar"; + hash = "sha256-Z8AWzZLlZavF8YYs1kslhtCvzq5fZ7O97mTx3hCgj78="; }; + meta.homepage = "https://hangar.papermc.io/jmp/squaremap"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - stargate = stdenv.mkDerivation rec { - pname = "Stargate"; - version = "0.11.5.6"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/Stargate/Stargate/versions/${version}/PAPER/Stargate-${version}.jar"; - hash = "sha256-Ilz0z3juQ9c4/pUnHnvJO+PnJF1+vXBxW2pbERuEBo4="; - }; - meta.homepage = "https://hangar.papermc.io/Stargate/Stargate"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + stargate = stdenv.mkDerivation rec { + pname = "Stargate"; + version = "0.11.5.6"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/Stargate/Stargate/versions/${version}/PAPER/Stargate-${version}.jar"; + hash = "sha256-Ilz0z3juQ9c4/pUnHnvJO+PnJF1+vXBxW2pbERuEBo4="; }; + meta.homepage = "https://hangar.papermc.io/Stargate/Stargate"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - chunky = stdenv.mkDerivation rec { - pname = "Chunky"; - version = "1.3.92"; - src = fetchurl { - url = "https://hangarcdn.papermc.io/plugins/pop4959/Chunky/versions/${version}/PAPER/Chunky-${version}.jar"; - hash = "sha256-ABHfKJK0LQI2ZLt1D83897RAnE9xWu6+34IOlwTh17w="; - }; - meta.homepage = "https://hangar.papermc.io/pop4959/Chunky"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + chunky = stdenv.mkDerivation rec { + pname = "Chunky"; + version = "1.3.92"; + src = fetchurl { + url = "https://hangarcdn.papermc.io/plugins/pop4959/Chunky/versions/${version}/PAPER/Chunky-${version}.jar"; + hash = "sha256-ABHfKJK0LQI2ZLt1D83897RAnE9xWu6+34IOlwTh17w="; }; + meta.homepage = "https://hangar.papermc.io/pop4959/Chunky"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - xclaim = stdenv.mkDerivation rec { - pname = "XClaim"; - version = "1.11.0"; - src = fetchurl { - url = "https://github.com/WasabiThumb/xclaim/releases/download/${version}/xclaim-${version}.jar"; - hash = "sha256-49R9cj1NnOx9n0yBtOj+m4V+56P4Ko/Co/LOgdhd2y4="; - }; - meta.homepage = "https://hangar.papermc.io/WasabiThumbs/XClaim"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/${pname}.jar - ''; + xclaim = stdenv.mkDerivation rec { + pname = "XClaim"; + version = "1.11.0"; + src = fetchurl { + url = "https://github.com/WasabiThumb/xclaim/releases/download/${version}/xclaim-${version}.jar"; + hash = "sha256-49R9cj1NnOx9n0yBtOj+m4V+56P4Ko/Co/LOgdhd2y4="; }; + meta.homepage = "https://hangar.papermc.io/WasabiThumbs/XClaim"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname}.jar + ''; + }; - plugins = [ - passky grimAnticheat viaVersion directionHUD miniMOTD skinsRestorer squaremap stargate chunky xclaim - ]; - + plugins = [ + passky + grimAnticheat + viaVersion + directionHUD + miniMOTD + skinsRestorer + squaremap + stargate + chunky + xclaim + ]; in { - services.papermc = { - enable = true; - eula = true; - openFirewall = true; - serverProperties = { - server-port = 25565; - gamemode = "survival"; - motd = "GoodOmens"; - max-players = 10; - level-seed = "66666666"; - enable-status = true; - enforce-secure-profile = false; - difficulty = "normal"; - online-mode = false; - enable-rcon = true; - "rcon.port" = 25600; - white-list = false; - }; - jvmOpts = "-Xms512M -Xmx2048M"; - rconPasswordFile = config.sops.secrets."papermc/rcon".path; - whitelist = whitelist; - ops = operators; - extraPreStart = '' - mkdir -p ${builtins.concatStringsSep " " (map (v: "plugins/${v.pname}") plugins)} - '' + builtins.concatStringsSep "\n" (map (v: "ln -sf ${v.outPath}/bin/${v.pname}.jar plugins/") plugins) + '' - - ln -sf ${config.bonfire.configDir}/goodomens/plugins/MiniMOTD/main.conf plugins/MiniMOTD/ - mkdir -p plugins/MiniMOTD/icons - ln -sf ${config.bonfire.configDir}/goodomens/plugins/MiniMOTD/icons/goodomens-logo.png plugins/MiniMOTD/icons/ - ln -sf ${config.bonfire.configDir}/goodomens/plugins/Tablist/config.yml plugins/Tablist/ - ln -sf ${config.bonfire.configDir}/goodomens/plugins/squaremap/config.yml plugins/squaremap/ - ln -sf ${config.bonfire.configDir}/goodomens/plugins/squaremap/advanced.yml plugins/squaremap/ - ln -sf ${config.bonfire.configDir}/goodomens/plugins/squaremap/advanced.yml plugins/squaremap/ - ln -sf ${config.bonfire.configDir}/goodomens/site/map/index.html plugins/squaremap/web/ - ''; - }; - - services.nginx.virtualHosts."mc.elnafo.ru" = { - forceSSL = true; - useACMEHost = "elnafo.ru"; - locations."/".root = "/var/www/goodomens"; - locations."^~ /map/".proxyPass = "http://127.0.0.1:8088/"; - locations."/gallery/".root = "/var/www/goodomens"; - locations."/gallery/images/" = { - root = "/var/www/goodomens"; - extraConfig = ''autoindex on;''; - }; + services.papermc = { + enable = true; + eula = true; + openFirewall = true; + serverProperties = { + server-port = 25565; + gamemode = "survival"; + motd = "GoodOmens"; + max-players = 10; + level-seed = "66666666"; + enable-status = true; + enforce-secure-profile = false; + difficulty = "normal"; + online-mode = false; + enable-rcon = true; + "rcon.port" = 25600; + white-list = false; }; + jvmOpts = "-Xms512M -Xmx2048M"; + rconPasswordFile = config.sops.secrets."papermc/rcon".path; + whitelist = whitelist; + ops = operators; + extraPreStart = + '' + mkdir -p ${builtins.concatStringsSep " " (map (v: "plugins/${v.pname}") plugins)} + '' + + builtins.concatStringsSep "\n" (map (v: "ln -sf ${v.outPath}/bin/${v.pname}.jar plugins/") plugins) + + '' + + ln -sf ${config.bonfire.configDir}/goodomens/plugins/MiniMOTD/main.conf plugins/MiniMOTD/ + mkdir -p plugins/MiniMOTD/icons + ln -sf ${config.bonfire.configDir}/goodomens/plugins/MiniMOTD/icons/goodomens-logo.png plugins/MiniMOTD/icons/ + ln -sf ${config.bonfire.configDir}/goodomens/plugins/Tablist/config.yml plugins/Tablist/ + ln -sf ${config.bonfire.configDir}/goodomens/plugins/squaremap/config.yml plugins/squaremap/ + ln -sf ${config.bonfire.configDir}/goodomens/plugins/squaremap/advanced.yml plugins/squaremap/ + ln -sf ${config.bonfire.configDir}/goodomens/plugins/squaremap/advanced.yml plugins/squaremap/ + ln -sf ${config.bonfire.configDir}/goodomens/site/map/index.html plugins/squaremap/web/ + ''; + }; + + services.nginx.virtualHosts."mc.elnafo.ru" = { + forceSSL = true; + useACMEHost = "elnafo.ru"; + locations."/".root = "/var/www/goodomens"; + locations."^~ /map/".proxyPass = "http://127.0.0.1:8088/"; + locations."/gallery/".root = "/var/www/goodomens"; + locations."/gallery/images/" = { + root = "/var/www/goodomens"; + extraConfig = ''autoindex on;''; + }; + }; } diff --git a/nixosConfigurations/catarina/users.nix b/nixosConfigurations/catarina/users.nix index 700eab5..b10cb3b 100644 --- a/nixosConfigurations/catarina/users.nix +++ b/nixosConfigurations/catarina/users.nix @@ -1,17 +1,21 @@ -{ config, pkgs, lib, ... }: { -# Users - users.users.root.hashedPasswordFile = config.sops.secrets."users/root".path; + config, + pkgs, + lib, + ... +}: { + # Users + users.users.root.hashedPasswordFile = config.sops.secrets."users/root".path; - users.users.l-nafaryus = { - isNormalUser = true; - description = "L-Nafaryus"; - extraGroups = [ "networkmanager" "wheel" ]; - group = "users"; - uid = 1000; - shell = pkgs.fish; - hashedPasswordFile = config.sops.secrets."users/l-nafaryus".path; - }; + users.users.l-nafaryus = { + isNormalUser = true; + description = "L-Nafaryus"; + extraGroups = ["networkmanager" "wheel"]; + group = "users"; + uid = 1000; + shell = pkgs.fish; + hashedPasswordFile = config.sops.secrets."users/l-nafaryus".path; + }; - users.users.nginx.extraGroups = [ "acme" "papermc" ]; + users.users.nginx.extraGroups = ["acme" "papermc"]; } diff --git a/nixosModules/default.nix b/nixosModules/default.nix index 79922ba..6f8aae2 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -1,20 +1,27 @@ -{ lib, check ? true, self, ... }: -rec { - modules = [ - ./misc/bonfire/default.nix - ./services/papermc.nix - ./services/qbittorrent-nox.nix - ./services/spoofdpi.nix - ]; +{ + lib, + check ? true, + self, + ... +}: rec { + modules = [ + ./misc/bonfire/default.nix + ./services/papermc.nix + ./services/qbittorrent-nox.nix + ./services/spoofdpi.nix + ]; - configModule = { config, pkgs, ... }: { - - config = { - # Module type checking - _module.check = check; - #_module.args.baseModules = modules; - #_module.args.pkgs = lib.mkDefault pkgs; - _module.args.bonpkgs = self.packages.${pkgs.system}; - }; + configModule = { + config, + pkgs, + ... + }: { + config = { + # Module type checking + _module.check = check; + #_module.args.baseModules = modules; + #_module.args.pkgs = lib.mkDefault pkgs; + _module.args.bonpkgs = self.packages.${pkgs.system}; }; + }; } diff --git a/nixosModules/misc/bonfire/default.nix b/nixosModules/misc/bonfire/default.nix index 58fd959..5280c37 100644 --- a/nixosModules/misc/bonfire/default.nix +++ b/nixosModules/misc/bonfire/default.nix @@ -1,45 +1,51 @@ -{ config, lib, ... }: -with lib; -let cfg = config.bonfire; +{ + config, + lib, + ... +}: +with lib; let + cfg = config.bonfire; in { - options = { - bonfire = { - home = mkOption { - type = types.path; - default = ../../../.; - description = "Bonfire root directory"; - }; - - configDir = mkOption { - type = types.path; - default = "${cfg.home}/config"; - description = "Path to Bonfire static configuration files"; - }; + options = { + bonfire = { + home = mkOption { + type = types.path; + default = ../../../.; + description = "Bonfire root directory"; + }; - withSecrets = mkOption { - type = types.bool; - default = false; - description = "Enables the Bonfire secrets"; - }; + configDir = mkOption { + type = types.path; + default = "${cfg.home}/config"; + description = "Path to Bonfire static configuration files"; + }; - secrets = mkOption { - type = types.attrs; - description = "Secrets will be here after evaluation"; - default = {}; - }; - }; + withSecrets = mkOption { + type = types.bool; + default = false; + description = "Enables the Bonfire secrets"; + }; + + secrets = mkOption { + type = types.attrs; + description = "Secrets will be here after evaluation"; + default = {}; + }; + }; + }; + + config = { + assertions = mkIf cfg.withSecrets [ + { + assertion = builtins.pathExists ./secrets/default.nix; + message = "Missed git submodule 'bonfire-secrets'"; + } + ]; + + environment.sessionVariables = { + BONFIRE_HOME = cfg.home; }; - config = { - assertions = mkIf cfg.withSecrets [{ - assertion = (builtins.pathExists ./secrets/default.nix); - message = "Missed git submodule 'bonfire-secrets'"; - }]; - - environment.sessionVariables = { - BONFIRE_HOME = cfg.home; - }; - - bonfire.secrets = mkIf cfg.withSecrets (import ./secrets { inherit config; }); - }; + bonfire.secrets = mkIf cfg.withSecrets (import ./secrets {inherit config lib;}); + }; } diff --git a/nixosModules/misc/bonfire/secrets/default.nix b/nixosModules/misc/bonfire/secrets/default.nix index a5067a1..147c438 100644 --- a/nixosModules/misc/bonfire/secrets/default.nix +++ b/nixosModules/misc/bonfire/secrets/default.nix @@ -1,41 +1,55 @@ -{ config }: { - catarina = { - sops = { - defaultSopsFile = ./catarina.yaml; - age.keyFile = "/var/lib/secrets/sops-nix/catarina.txt"; - secrets = { - "dns" = {}; - - "users/root" = { neededForUsers = true; }; - "users/l-nafaryus" = { neededForUsers = true; }; + config, + lib, +}: { + catarina = { + sops = { + defaultSopsFile = ./catarina.yaml; + age.keyFile = "/var/lib/secrets/sops-nix/catarina.txt"; + secrets = { + "dns" = {}; - "database/git" = { owner = "git"; group = "gitea"; }; + "users/root" = {neededForUsers = true;}; + "users/l-nafaryus" = {neededForUsers = true;}; - "mail/l-nafaryus" = {}; - "mail/git" = {}; - "mail/kirill" = {}; - - "gitea/mail" = { owner = "git"; group = "gitea"; }; - "gitea-runner/master-token" = {}; - - "papermc/rcon" = { owner = "papermc"; group = "papermc"; }; - - discordToken = { owner = "oscuro"; group = "oscuro"; }; - }; + "database/git" = { + owner = "git"; + group = "gitea"; }; - mailAccounts = { - "l.nafaryus@elnafo.ru" = { - hashedPasswordFile = config.sops.secrets."mail/l-nafaryus".path; - aliases = [ "l-nafaryus@elnafo.ru" ]; - }; - "kirill@elnafo.ru" = { - hashedPasswordFile = config.sops.secrets."mail/kirill".path; - }; - "git@elnafo.ru" = { - hashedPasswordFile = config.sops.secrets."mail/git".path; - }; + "mail/l-nafaryus" = {}; + "mail/git" = {}; + "mail/kirill" = {}; + + "gitea/mail" = { + owner = "git"; + group = "gitea"; }; + "gitea-runner/master-token" = {}; + + "papermc/rcon" = lib.mkIf config.services.papermc.enable { + owner = "papermc"; + group = "papermc"; + }; + + discordToken = { + owner = "oscuro"; + group = "oscuro"; + }; + }; }; + + mailAccounts = { + "l.nafaryus@elnafo.ru" = { + hashedPasswordFile = config.sops.secrets."mail/l-nafaryus".path; + aliases = ["l-nafaryus@elnafo.ru"]; + }; + "kirill@elnafo.ru" = { + hashedPasswordFile = config.sops.secrets."mail/kirill".path; + }; + "git@elnafo.ru" = { + hashedPasswordFile = config.sops.secrets."mail/git".path; + }; + }; + }; } diff --git a/nixosModules/services/papermc.nix b/nixosModules/services/papermc.nix index faf8fc1..841bc57 100644 --- a/nixosModules/services/papermc.nix +++ b/nixosModules/services/papermc.nix @@ -1,237 +1,258 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.services.papermc; +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.services.papermc; - eulaFile = builtins.toFile "eula.txt" '' - # eula.txt managed by NixOS Configuration - eula=true - ''; + eulaFile = builtins.toFile "eula.txt" '' + # eula.txt managed by NixOS Configuration + eula=true + ''; - whitelistFile = pkgs.writeText "whitelist.json" - (builtins.toJSON cfg.whitelist); + whitelistFile = + pkgs.writeText "whitelist.json" + (builtins.toJSON cfg.whitelist); - opsFile = pkgs.writeText "ops.json" - (builtins.toJSON cfg.ops); + opsFile = + pkgs.writeText "ops.json" + (builtins.toJSON cfg.ops); - cfgToString = v: if builtins.isBool v then boolToString v else toString v; + cfgToString = v: + if builtins.isBool v + then boolToString v + else toString v; - serverPropertiesFile = let - serverProperties' = if (cfg.rconPasswordFile == null) then cfg.serverProperties else - (removeAttrs cfg.serverProperties [ "rcon.password" ]); - in pkgs.writeText "server.properties" ('' + serverPropertiesFile = let + serverProperties' = + if (cfg.rconPasswordFile == null) + then cfg.serverProperties + else (removeAttrs cfg.serverProperties ["rcon.password"]); + in + pkgs.writeText "server.properties" ('' # server.properties managed by NixOS configuration - '' + concatStringsSep "\n" (mapAttrsToList - (n: v: "${n}=${cfgToString v}") serverProperties') + - lib.optionalString (cfg.rconPasswordFile != null) "\nrcon.password=#rconpass#"); + '' + + concatStringsSep "\n" (mapAttrsToList + (n: v: "${n}=${cfgToString v}") + serverProperties') + + lib.optionalString (cfg.rconPasswordFile != null) "\nrcon.password=#rconpass#"); - stopScript = pkgs.writeShellScript "minecraft-server-stop" '' - echo stop > ${config.systemd.sockets.papermc.socketConfig.ListenFIFO} + stopScript = pkgs.writeShellScript "minecraft-server-stop" '' + echo stop > ${config.systemd.sockets.papermc.socketConfig.ListenFIFO} - # Wait for the PID of the minecraft server to disappear before - # returning, so systemd doesn't attempt to SIGKILL it. - while kill -0 "$1" 2> /dev/null; do - sleep 1s - done - ''; + # Wait for the PID of the minecraft server to disappear before + # returning, so systemd doesn't attempt to SIGKILL it. + while kill -0 "$1" 2> /dev/null; do + sleep 1s + done + ''; - defaultServerPort = 25565; + defaultServerPort = 25565; - serverPort = cfg.serverProperties.server-port or defaultServerPort; + serverPort = cfg.serverProperties.server-port or defaultServerPort; - rconPort = if cfg.serverProperties.enable-rcon or false - then cfg.serverProperties."rcon.port" or 25575 - else null; - - queryPort = if cfg.serverProperties.enable-query or false - then cfg.serverProperties."query.port" or 25565 - else null; + rconPort = + if cfg.serverProperties.enable-rcon or false + then cfg.serverProperties."rcon.port" or 25575 + else null; + queryPort = + if cfg.serverProperties.enable-query or false + then cfg.serverProperties."query.port" or 25565 + else null; in { - options.services.papermc = { - enable = mkEnableOption "PaperMC service"; - - openFirewall = mkOption { - type = types.bool; - default = false; - description = '' - Whether to open ports in the firewall for the server. - ''; - }; + options.services.papermc = { + enable = mkEnableOption "PaperMC service"; - eula = mkOption { - type = types.bool; - default = false; - description = '' - Whether you agree to [Mojangs EULA](https://account.mojang.com/documents/minecraft_eula). - This option must be set to `true` to run Minecraft server. - ''; - }; - - dataDir = mkOption { - type = types.path; - default = "/var/lib/papermc"; - description = '' - Directory to store Minecraft database and other state/data files. - ''; - }; - - whitelist = mkOption { - type = types.listOf types.attrs; - default = {}; - description = '' - This is a mapping from Minecraft usernames to UUIDs. - ''; - }; - - ops = mkOption { - type = types.listOf types.attrs; - description = "Whitelist with players / operators."; - default = []; - }; - - serverProperties = mkOption { - type = with types; attrsOf (oneOf [ bool int str ]); - default = { - "rcon.password" = mkIf (cfg.rconPasswordFile != null) "#rconpass#"; - }; - example = literalExpression '' - { - server-port = 43000; - difficulty = 3; - gamemode = 1; - max-players = 5; - motd = "NixOS Minecraft server!"; - white-list = true; - enable-rcon = true; - "rcon.password" = "hunter2"; - } - ''; - description = '' - Minecraft server properties for the server.properties file. See - - for documentation on these values. - ''; - }; - - rconPasswordFile = mkOption { - type = types.nullOr types.str; - default = null; - description = "Path to file with rcon password."; - example = "/var/lib/secrets/papermc/rconpw"; - }; - - package = mkPackageOption pkgs "papermc" {}; - - jvmOpts = mkOption { - type = types.separatedString " "; - default = "-Xmx2048M -Xms2048M"; - # Example options from https://minecraft.gamepedia.com/Tutorials/Server_startup_script - example = "-Xms4092M -Xmx4092M -XX:+UseG1GC -XX:+CMSIncrementalPacing " - + "-XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 " - + "-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10"; - description = "JVM options for the Minecraft server."; - }; - - extraPreStart = mkOption { - type = types.lines; - description = "Extra shell commands for service pre-start hook."; - default = ''''; - }; + openFirewall = mkOption { + type = types.bool; + default = false; + description = '' + Whether to open ports in the firewall for the server. + ''; }; - config = mkIf cfg.enable { - users.users.papermc = { - description = "Minecraft server service user."; - home = cfg.dataDir; - createHome = true; - isSystemUser = true; - group = "papermc"; - }; - users.groups.papermc = {}; - - systemd.sockets.papermc = { - bindsTo = [ "papermc.service" ]; - socketConfig = { - ListenFIFO = "/run/papermc.stdin"; - SocketMode = "0660"; - SocketUser = "papermc"; - SocketGroup = "papermc"; - RemoveOnStop = true; - FlushPending = true; - }; - }; - - systemd.services.papermc = { - description = "PaperMC Service"; - wantedBy = [ "multi-user.target" ]; - requires = [ "papermc.socket" ]; - after = [ "network.target" "papermc.socket" ]; - - serviceConfig = { - ExecStart = "${cfg.package}/bin/minecraft-server ${cfg.jvmOpts}"; - ExecStop = "${stopScript} $MAINPID"; - Restart = "always"; - User = "papermc"; - WorkingDirectory = cfg.dataDir; - - StandardInput = "socket"; - StandardOutput = "journal"; - StandardError = "journal"; - - # Hardening - CapabilityBoundingSet = [ "" ]; - DeviceAllow = [ "" ]; - LockPersonality = true; - PrivateDevices = true; - PrivateTmp = true; - PrivateUsers = true; - ProtectClock = true; - ProtectControlGroups = true; - ProtectHome = true; - ProtectHostname = true; - ProtectKernelLogs = true; - ProtectKernelModules = true; - ProtectKernelTunables = true; - ProtectProc = "invisible"; - RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ]; - RestrictNamespaces = true; - RestrictRealtime = true; - RestrictSUIDSGID = true; - SystemCallArchitectures = "native"; - UMask = "0077"; - }; - - preStart = let - replaceSecretBin = "${pkgs.replace-secret}/bin/replace-secret"; - in '' - ln -sf ${eulaFile} eula.txt - - cp -b --suffix=.stateful ${whitelistFile} whitelist.json - cp -b --suffix=.stateful ${opsFile} ops.json - cp -b --suffix=.stateful ${serverPropertiesFile} server.properties - - chmod +w whitelist.json ops.json server.properties - - ${lib.optionalString (cfg.rconPasswordFile != null) '' - ${replaceSecretBin} '#rconpass#' '${cfg.rconPasswordFile}' server.properties - ''} - '' + cfg.extraPreStart; - }; - - networking.firewall = mkIf cfg.openFirewall ({ - allowedUDPPorts = [ serverPort ]; - allowedTCPPorts = [ serverPort ] - ++ optional (queryPort != null) queryPort - ++ optional (rconPort != null) rconPort; - }); - - assertions = [ - { assertion = cfg.eula; - message = "You must agree to Mojangs EULA to run minecraft-server." - + " Read https://account.mojang.com/documents/minecraft_eula and" - + " set `services.minecraft-server.eula` to `true` if you agree."; - } - ]; + eula = mkOption { + type = types.bool; + default = false; + description = '' + Whether you agree to [Mojangs EULA](https://account.mojang.com/documents/minecraft_eula). + This option must be set to `true` to run Minecraft server. + ''; }; + + dataDir = mkOption { + type = types.path; + default = "/var/lib/papermc"; + description = '' + Directory to store Minecraft database and other state/data files. + ''; + }; + + whitelist = mkOption { + type = types.listOf types.attrs; + default = {}; + description = '' + This is a mapping from Minecraft usernames to UUIDs. + ''; + }; + + ops = mkOption { + type = types.listOf types.attrs; + description = "Whitelist with players / operators."; + default = []; + }; + + serverProperties = mkOption { + type = with types; attrsOf (oneOf [bool int str]); + default = { + "rcon.password" = mkIf (cfg.rconPasswordFile != null) "#rconpass#"; + }; + example = literalExpression '' + { + server-port = 43000; + difficulty = 3; + gamemode = 1; + max-players = 5; + motd = "NixOS Minecraft server!"; + white-list = true; + enable-rcon = true; + "rcon.password" = "hunter2"; + } + ''; + description = '' + Minecraft server properties for the server.properties file. See + + for documentation on these values. + ''; + }; + + rconPasswordFile = mkOption { + type = types.nullOr types.str; + default = null; + description = "Path to file with rcon password."; + example = "/var/lib/secrets/papermc/rconpw"; + }; + + package = mkPackageOption pkgs "papermc" {}; + + jvmOpts = mkOption { + type = types.separatedString " "; + default = "-Xmx2048M -Xms2048M"; + # Example options from https://minecraft.gamepedia.com/Tutorials/Server_startup_script + example = + "-Xms4092M -Xmx4092M -XX:+UseG1GC -XX:+CMSIncrementalPacing " + + "-XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 " + + "-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10"; + description = "JVM options for the Minecraft server."; + }; + + extraPreStart = mkOption { + type = types.lines; + description = "Extra shell commands for service pre-start hook."; + default = ''''; + }; + }; + + config = mkIf cfg.enable { + users.users.papermc = { + description = "Minecraft server service user."; + home = cfg.dataDir; + createHome = true; + isSystemUser = true; + group = "papermc"; + }; + users.groups.papermc = {}; + + systemd.sockets.papermc = { + bindsTo = ["papermc.service"]; + socketConfig = { + ListenFIFO = "/run/papermc.stdin"; + SocketMode = "0660"; + SocketUser = "papermc"; + SocketGroup = "papermc"; + RemoveOnStop = true; + FlushPending = true; + }; + }; + + systemd.services.papermc = { + description = "PaperMC Service"; + wantedBy = ["multi-user.target"]; + requires = ["papermc.socket"]; + after = ["network.target" "papermc.socket"]; + + serviceConfig = { + ExecStart = "${cfg.package}/bin/minecraft-server ${cfg.jvmOpts}"; + ExecStop = "${stopScript} $MAINPID"; + Restart = "always"; + User = "papermc"; + WorkingDirectory = cfg.dataDir; + + StandardInput = "socket"; + StandardOutput = "journal"; + StandardError = "journal"; + + # Hardening + CapabilityBoundingSet = [""]; + DeviceAllow = [""]; + LockPersonality = true; + PrivateDevices = true; + PrivateTmp = true; + PrivateUsers = true; + ProtectClock = true; + ProtectControlGroups = true; + ProtectHome = true; + ProtectHostname = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + ProtectProc = "invisible"; + RestrictAddressFamilies = ["AF_INET" "AF_INET6"]; + RestrictNamespaces = true; + RestrictRealtime = true; + RestrictSUIDSGID = true; + SystemCallArchitectures = "native"; + UMask = "0077"; + }; + + preStart = let + replaceSecretBin = "${pkgs.replace-secret}/bin/replace-secret"; + in + '' + ln -sf ${eulaFile} eula.txt + + cp -b --suffix=.stateful ${whitelistFile} whitelist.json + cp -b --suffix=.stateful ${opsFile} ops.json + cp -b --suffix=.stateful ${serverPropertiesFile} server.properties + + chmod +w whitelist.json ops.json server.properties + + ${lib.optionalString (cfg.rconPasswordFile != null) '' + ${replaceSecretBin} '#rconpass#' '${cfg.rconPasswordFile}' server.properties + ''} + '' + + cfg.extraPreStart; + }; + + networking.firewall = mkIf cfg.openFirewall { + allowedUDPPorts = [serverPort]; + allowedTCPPorts = + [serverPort] + ++ optional (queryPort != null) queryPort + ++ optional (rconPort != null) rconPort; + }; + + assertions = [ + { + assertion = cfg.eula; + message = + "You must agree to Mojangs EULA to run minecraft-server." + + " Read https://account.mojang.com/documents/minecraft_eula and" + + " set `services.minecraft-server.eula` to `true` if you agree."; + } + ]; + }; } diff --git a/nixosModules/services/qbittorrent-nox.nix b/nixosModules/services/qbittorrent-nox.nix index 0048a3a..46cc459 100644 --- a/nixosModules/services/qbittorrent-nox.nix +++ b/nixosModules/services/qbittorrent-nox.nix @@ -1,119 +1,122 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.services.qbittorrent-nox; +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.services.qbittorrent-nox; in { - options.services.qbittorrent-nox = { - enable = mkEnableOption "Enables the qbittorrent-nox services."; + options.services.qbittorrent-nox = { + enable = mkEnableOption "Enables the qbittorrent-nox services."; - port = mkOption rec { - type = types.int; - default = 6969; - example = default; - description = "Torrenting port."; - }; - - webuiPort = mkOption rec { - type = types.port; - default = 8080; - example = default; - description = "WebUI port."; - }; - - dataDir = mkOption rec { - type = types.path; - default = "/var/lib/qbittorrent-nox"; - example = default; - description = "Directory to store qbittorrent-nox data files."; - }; - - user = mkOption { - type = types.str; - default = "qbittorrent-nox"; - description = "User account under which qbittorrent-nox runs."; - }; - - group = mkOption { - type = types.str; - default = "qbittorrent-nox"; - description = "Group under which qbittorrent-nox runs."; - }; - - openFirewall = mkOption { - type = types.bool; - default = false; - description = "Open `services.qbittorrent-nox.port`."; - }; - - package = mkOption { - type = types.package; - default = pkgs.qbittorrent-nox; - defaultText = literalExpression "pkgs.qbittorrent-nox"; - description = "The qbittorrent package to use."; - }; + port = mkOption rec { + type = types.int; + default = 6969; + example = default; + description = "Torrenting port."; }; - config = mkIf cfg.enable { - users.users.qbittorrent-nox = { - description = "qbittorrent-nox service user."; - home = cfg.dataDir; - createHome = true; - isSystemUser = true; - group = "qbittorrent-nox"; - }; - users.groups.qbittorrent-nox = {}; - - networking.firewall = mkIf cfg.openFirewall { - allowedTCPPorts = [ cfg.port ]; - allowedUDPPorts = [ cfg.port ]; - }; - - systemd.services.qbittorrent-nox = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - - serviceConfig = { - Type = "simple"; - ExecStart = "${cfg.package}/bin/qbittorrent-nox --torrenting-port=${toString cfg.port} --webui-port=${toString cfg.webuiPort}"; - Restart = "always"; - User = cfg.user; - Group = cfg.group; - WorkingDirectory = cfg.dataDir; - # Runtime directory and mode - RuntimeDirectory = "qbittorrent-nox"; - RuntimeDirectoryMode = "0755"; - # Proc filesystem - ProcSubset = "pid"; - ProtectProc = "invisible"; - # Access write directories - ReadWritePaths = [ cfg.dataDir ]; - UMask = "0027"; - # Capabilities - CapabilityBoundingSet = ""; - # Security - NoNewPrivileges = true; - # Sandboxing - ProtectSystem = "strict"; - ProtectHome = true; - PrivateTmp = true; - PrivateDevices = true; - PrivateUsers = true; - ProtectHostname = true; - ProtectClock = true; - ProtectKernelTunables = true; - ProtectKernelModules = true; - ProtectKernelLogs = true; - ProtectControlGroups = true; - RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ]; - RestrictNamespaces = true; - LockPersonality = true; - MemoryDenyWriteExecute = true; - RestrictRealtime = true; - RestrictSUIDSGID = true; - RemoveIPC = true; - PrivateMounts = true; - }; - - }; + webuiPort = mkOption rec { + type = types.port; + default = 8080; + example = default; + description = "WebUI port."; }; + + dataDir = mkOption rec { + type = types.path; + default = "/var/lib/qbittorrent-nox"; + example = default; + description = "Directory to store qbittorrent-nox data files."; + }; + + user = mkOption { + type = types.str; + default = "qbittorrent-nox"; + description = "User account under which qbittorrent-nox runs."; + }; + + group = mkOption { + type = types.str; + default = "qbittorrent-nox"; + description = "Group under which qbittorrent-nox runs."; + }; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = "Open `services.qbittorrent-nox.port`."; + }; + + package = mkOption { + type = types.package; + default = pkgs.qbittorrent-nox; + defaultText = literalExpression "pkgs.qbittorrent-nox"; + description = "The qbittorrent package to use."; + }; + }; + + config = mkIf cfg.enable { + users.users.qbittorrent-nox = { + description = "qbittorrent-nox service user."; + home = cfg.dataDir; + createHome = true; + isSystemUser = true; + group = "qbittorrent-nox"; + }; + users.groups.qbittorrent-nox = {}; + + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [cfg.port]; + allowedUDPPorts = [cfg.port]; + }; + + systemd.services.qbittorrent-nox = { + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + + serviceConfig = { + Type = "simple"; + ExecStart = "${cfg.package}/bin/qbittorrent-nox --torrenting-port=${toString cfg.port} --webui-port=${toString cfg.webuiPort}"; + Restart = "always"; + User = cfg.user; + Group = cfg.group; + WorkingDirectory = cfg.dataDir; + # Runtime directory and mode + RuntimeDirectory = "qbittorrent-nox"; + RuntimeDirectoryMode = "0755"; + # Proc filesystem + ProcSubset = "pid"; + ProtectProc = "invisible"; + # Access write directories + ReadWritePaths = [cfg.dataDir]; + UMask = "0027"; + # Capabilities + CapabilityBoundingSet = ""; + # Security + NoNewPrivileges = true; + # Sandboxing + ProtectSystem = "strict"; + ProtectHome = true; + PrivateTmp = true; + PrivateDevices = true; + PrivateUsers = true; + ProtectHostname = true; + ProtectClock = true; + ProtectKernelTunables = true; + ProtectKernelModules = true; + ProtectKernelLogs = true; + ProtectControlGroups = true; + RestrictAddressFamilies = ["AF_UNIX" "AF_INET" "AF_INET6"]; + RestrictNamespaces = true; + LockPersonality = true; + MemoryDenyWriteExecute = true; + RestrictRealtime = true; + RestrictSUIDSGID = true; + RemoveIPC = true; + PrivateMounts = true; + }; + }; + }; } diff --git a/nixosModules/services/spoofdpi.nix b/nixosModules/services/spoofdpi.nix index edd577d..affc8f4 100644 --- a/nixosModules/services/spoofdpi.nix +++ b/nixosModules/services/spoofdpi.nix @@ -1,59 +1,63 @@ -{ config, lib, bonpkgs, ... }: -with lib; -let - cfg = config.services.spoofdpi; +{ + config, + lib, + bonpkgs, + ... +}: +with lib; let + cfg = config.services.spoofdpi; in { - options.services.spoofdpi = { - enable = mkEnableOption "SpoofDPI service"; + options.services.spoofdpi = { + enable = mkEnableOption "SpoofDPI service"; - package = mkOption { - type = types.package; - default = bonpkgs.spoofdpi; - defaultText = literalExpression "bonpkgs.spoofdpi"; - description = "The package to use."; - }; - - address = mkOption rec { - type = types.str; - default = "127.0.0.1"; - example = default; - description = "Listen address."; - }; - - port = mkOption rec { - type = types.port; - default = 8080; - example = default; - description = "Port."; - }; - - openFirewall = mkOption { - type = types.bool; - default = false; - description = "Open `services.spoofdpi.port`."; - }; - - dns = mkOption rec { - type = types.str; - default = "8.8.8.8"; - example = default; - description = "DNS server."; - }; + package = mkOption { + type = types.package; + default = bonpkgs.spoofdpi; + defaultText = literalExpression "bonpkgs.spoofdpi"; + description = "The package to use."; }; - config = mkIf cfg.enable { - systemd.services.spoofdpi = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - serviceConfig = { - Restart = "on-failure"; - ExecStart = "${lib.getExe cfg.package} -no-banner -addr ${cfg.address} -port ${toString cfg.port} -dns ${cfg.dns}"; - DynamicUser = "yes"; - }; - }; - - networking.firewall = mkIf cfg.openFirewall { - allowedTCPPorts = [ cfg.port ]; - }; + address = mkOption rec { + type = types.str; + default = "127.0.0.1"; + example = default; + description = "Listen address."; }; + + port = mkOption rec { + type = types.port; + default = 8080; + example = default; + description = "Port."; + }; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = "Open `services.spoofdpi.port`."; + }; + + dns = mkOption rec { + type = types.str; + default = "8.8.8.8"; + example = default; + description = "DNS server."; + }; + }; + + config = mkIf cfg.enable { + systemd.services.spoofdpi = { + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + serviceConfig = { + Restart = "on-failure"; + ExecStart = "${lib.getExe cfg.package} -no-banner -addr ${cfg.address} -port ${toString cfg.port} -dns ${cfg.dns}"; + DynamicUser = "yes"; + }; + }; + + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [cfg.port]; + }; + }; } diff --git a/packages/bonfire-docs/default.nix b/packages/bonfire-docs/default.nix index 2286df3..fe1486b 100644 --- a/packages/bonfire-docs/default.nix +++ b/packages/bonfire-docs/default.nix @@ -1,167 +1,196 @@ -{ - bonfire, - lib, - pkgs, - ... -}: -let - version = bonfire.shortRev or bonfire.dirtyShortRev or "unknown"; - projectPath = ../../.; - modulesPath = ../../nixosModules; +{ + bonfire, + lib, + pkgs, + ... +}: let + version = bonfire.shortRev or bonfire.dirtyShortRev or "unknown"; + projectPath = ../../.; + modulesPath = ../../nixosModules; - links = [ - { - hostname = "vcs-elnafo"; - url = "https://vcs.elnafo.ru/L-Nafaryus/bonfire/src/branch/master"; - } - { - hostname = "github"; - url = "https://github.com/L-Nafaryus/bonfire/blob/master"; - } + links = [ + { + hostname = "vcs-elnafo"; + url = "https://vcs.elnafo.ru/L-Nafaryus/bonfire/src/branch/master"; + } + { + hostname = "github"; + url = "https://github.com/L-Nafaryus/bonfire/blob/master"; + } + ]; + + formatDeclaration = declaration: + if lib.hasPrefix (toString modulesPath) (toString declaration) + then let + subpath = lib.removePrefix (toString projectPath + "/") (toString declaration); + in + map ({ + hostname, + url, + }: { + url = "${url}/${subpath}"; + name = "<${hostname}:bonfire/${subpath}>"; + }) + links + else + # skip external declarations + lib.singleton declaration; + + nixosModules = import modulesPath { + inherit lib; + self = bonfire; + check = false; + }; + + evaluatedModules = lib.evalModules { + modules = nixosModules.modules ++ [nixosModules.configModule]; + }; + + optionsDoc = pkgs.nixosOptionsDoc { + options = builtins.removeAttrs evaluatedModules.options [ + "_module" + "system" ]; - formatDeclaration = declaration: - if lib.hasPrefix (toString modulesPath) (toString declaration) then - let subpath = lib.removePrefix (toString projectPath + "/") (toString declaration); - in map ({ hostname, url }: { - url = "${url}/${subpath}"; - name = "<${hostname}:bonfire/${subpath}>"; - }) links - else - # skip external declarations - lib.singleton declaration; + transformOptions = option: + option + // { + declarations = lib.unique ( + lib.flatten (map (declaration: formatDeclaration declaration) option.declarations) + ++ option.declarations + ); + }; + documentType = "none"; + revision = version; + }; - nixosModules = (import modulesPath { inherit lib; self = bonfire; check = false; }); + systems = builtins.attrNames bonfire.packages; + derivations = lib.flatten ( + map (packages: ( + map (name: packages.${name}) (builtins.attrNames packages) + )) (map (system: bonfire.packages.${system}) systems) + ); - evaluatedModules = lib.evalModules { - modules = nixosModules.modules ++ [ nixosModules.configModule ]; - }; - - optionsDoc = pkgs.nixosOptionsDoc { - options = builtins.removeAttrs evaluatedModules.options [ - "_module" - "system" - ]; - - transformOptions = option: option // { - declarations = lib.unique ( - lib.flatten (map (declaration: formatDeclaration declaration) option.declarations) ++ - option.declarations - ); - }; - documentType = "none"; - revision = version; - }; - - systems = builtins.attrNames bonfire.packages; - derivations = lib.flatten ( - map (packages: ( - map (name: packages.${name}) (builtins.attrNames packages) - )) (map (system: bonfire.packages.${system}) systems)); - - renderMaintainers = maintainers: lib.concatStringsSep ", " ( - let - maintainer = mt: if mt?github then "[${mt.name}](https://github.com/${mt.github})" else mt.name; - email = mt: if mt?email then "<[${mt.email}](mailto:${mt.email})>" else ""; - in map (mt: maintainer mt + email mt) maintainers + renderMaintainers = maintainers: + lib.concatStringsSep ", " ( + let + maintainer = mt: + if mt ? github + then "[${mt.name}](https://github.com/${mt.github})" + else mt.name; + email = mt: + if mt ? email + then "<[${mt.email}](mailto:${mt.email})>" + else ""; + in + map (mt: maintainer mt + email mt) maintainers ); - renderPlatforms = platforms: if platforms != lib.platforms.none then - if platforms == lib.platforms.all then - "all" - else - lib.concatStringsSep ", " (map (platform: "__${platform}__") platforms) + renderPlatforms = platforms: + if platforms != lib.platforms.none + then + if platforms == lib.platforms.all + then "all" + else lib.concatStringsSep ", " (map (platform: "__${platform}__") platforms) else ""; - renderPackage = drv: '' - ## ${drv.pname} - - ${lib.optionalString (drv.meta?description) drv.meta.description} - - ${lib.optionalString (drv.meta?homepage) "[Homepage](${drv.meta.homepage})"} + renderPackage = drv: '' + ## ${drv.pname} - Version: __${drv.version}__ + ${lib.optionalString (drv.meta ? description) drv.meta.description} - ${lib.optionalString (drv.meta?license) "License: [${drv.meta.license.fullName}](${drv.meta.license.url})"} + ${lib.optionalString (drv.meta ? homepage) "[Homepage](${drv.meta.homepage})"} - Outputs: ${lib.concatStringsSep ", " (map (o: "__${o}__") drv.outputs)} + Version: __${drv.version}__ - ${lib.optionalString (drv.meta?mainProgram) "Provided programs: __${drv.meta.mainProgram}__"} + ${lib.optionalString (drv.meta ? license) "License: [${drv.meta.license.fullName}](${drv.meta.license.url})"} - ${lib.optionalString (drv.meta?maintainers) "Maintainers: ${renderMaintainers drv.meta.maintainers}"} + Outputs: ${lib.concatStringsSep ", " (map (o: "__${o}__") drv.outputs)} - ${lib.optionalString (drv.meta?platforms) "Platforms: ${renderPlatforms drv.meta.platforms}"} - ''; + ${lib.optionalString (drv.meta ? mainProgram) "Provided programs: __${drv.meta.mainProgram}__"} - renderImage = drv: '' - ## ${drv.imageName} + ${lib.optionalString (drv.meta ? maintainers) "Maintainers: ${renderMaintainers drv.meta.maintainers}"} - ${lib.optionalString (drv.meta?description) drv.meta.description} - - ${lib.optionalString (drv.meta?homepage) "[Homepage](${drv.meta.homepage})"} + ${lib.optionalString (drv.meta ? platforms) "Platforms: ${renderPlatforms drv.meta.platforms}"} + ''; - Tag: __${drv.imageTag}__ + renderImage = drv: '' + ## ${drv.imageName} - ${lib.optionalString (drv.fromImage != null) "From: __${drv.fromImage.imageName}__"} + ${lib.optionalString (drv.meta ? description) drv.meta.description} - ${lib.optionalString (drv.meta?license) "License: ${if lib.isList drv.meta.license then (map (license: "[${drv.meta.license.fullName}](${drv.meta.license.url})") drv.meta.license) else "[${drv.meta.license.fullName}](${drv.meta.license.url})"}"} + ${lib.optionalString (drv.meta ? homepage) "[Homepage](${drv.meta.homepage})"} - ${lib.optionalString (drv.meta?maintainers) "Maintainers: ${renderMaintainers drv.meta.maintainers}"} + Tag: __${drv.imageTag}__ - ${lib.optionalString (drv.meta?platforms) "Platforms: ${renderPlatforms drv.meta.platforms}"} - ''; + ${lib.optionalString (drv.fromImage != null) "From: __${drv.fromImage.imageName}__"} - packagesDoc = pkgs.writeText "packages.md" - (lib.concatStringsSep "\n" (map (drv: - if drv?imageTag then renderImage drv else renderPackage drv) derivations)); - -in -pkgs.stdenvNoCC.mkDerivation { + ${lib.optionalString (drv.meta ? license) "License: ${ + if lib.isList drv.meta.license + then (map (license: "[${drv.meta.license.fullName}](${drv.meta.license.url})") drv.meta.license) + else "[${drv.meta.license.fullName}](${drv.meta.license.url})" + }"} + + ${lib.optionalString (drv.meta ? maintainers) "Maintainers: ${renderMaintainers drv.meta.maintainers}"} + + ${lib.optionalString (drv.meta ? platforms) "Platforms: ${renderPlatforms drv.meta.platforms}"} + ''; + + packagesDoc = + pkgs.writeText "packages.md" + (lib.concatStringsSep "\n" (map (drv: + if drv ? imageTag + then renderImage drv + else if drv ? pname + then renderPackage drv + else "") + derivations)); +in + pkgs.stdenvNoCC.mkDerivation { pname = "bonfire-docs"; inherit version; src = lib.fileset.toSource { - root = ./.; - fileset = lib.fileset.unions [ - ./src - ./book.toml - ./theme - ]; + root = ./.; + fileset = lib.fileset.unions [ + ./src + ./book.toml + ./theme + ]; }; - nativeBuildInputs = [ pkgs.mdbook ]; + nativeBuildInputs = [pkgs.mdbook]; dontPatch = true; dontConfigure = true; doCheck = false; buildPhase = '' - runHook preBuild - ln -s ${../../README.md} src/README.md - ln -s ${optionsDoc.optionsCommonMark} src/options/modules.md - ln -s ${packagesDoc} src/packages/packages.md - mdbook build - runHook postBuild + runHook preBuild + ln -s ${../../README.md} src/README.md + ln -s ${optionsDoc.optionsCommonMark} src/options/modules.md + ln -s ${packagesDoc} src/packages/packages.md + mdbook build + runHook postBuild ''; installPhase = '' - runHook preInstall - mv book $out - runHook postInstall + runHook preInstall + mv book $out + runHook postInstall ''; passthru = { - serve = pkgs.writeShellApplication { - name = "server"; - runtimeInputs = [ pkgs.python3 ]; - text = "python -m http.server --bind 127.0.0.1"; - }; + serve = pkgs.writeShellApplication { + name = "server"; + runtimeInputs = [pkgs.python3]; + text = "python -m http.server --bind 127.0.0.1"; + }; }; meta = with lib; { - description = "Bonfire HTML documentation."; - license = licenses.mit; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - platforms = lib.platforms.all; + description = "Bonfire HTML documentation."; + license = licenses.mit; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + platforms = lib.platforms.all; }; -} - + } diff --git a/packages/bonvim/default.nix b/packages/bonvim/default.nix new file mode 100644 index 0000000..b74ade5 --- /dev/null +++ b/packages/bonvim/default.nix @@ -0,0 +1,16 @@ +{ + pkgs, + nixvim-pkgs, + bonconfigs, + fenix-pkgs, + ... +}: +nixvim-pkgs.makeNixvimWithModule { + pkgs = pkgs; + module = import bonconfigs.bonvim; + extraSpecialArgs = { + rustc = fenix-pkgs.complete.rustc; + cargo = fenix-pkgs.complete.cargo; + rust-analyzer = fenix-pkgs.complete.rust-analyzer; + }; +} diff --git a/packages/cargo-shuttle/default.nix b/packages/cargo-shuttle/default.nix index b95c659..e44c962 100644 --- a/packages/cargo-shuttle/default.nix +++ b/packages/cargo-shuttle/default.nix @@ -1,43 +1,45 @@ { - bonfire, - crane-lib, - lib, - pkgs, - version ? "v0.44.0", - hash ? "sha256-3u2GWgDQpa4sU/66vS6S+JwCEL/fvy8MTsATRs7RGVs=", - ... -}: -let pkg = { + bonfire, + crane-lib, + lib, + pkgs, + version ? "v0.44.0", + hash ? "sha256-3u2GWgDQpa4sU/66vS6S+JwCEL/fvy8MTsATRs7RGVs=", + ... +}: let + pkg = { pname = "cargo-shuttle"; inherit version; src = pkgs.fetchFromGitHub { - owner = "shuttle-hq"; - repo = "shuttle"; - rev = version; - hash = hash; + owner = "shuttle-hq"; + repo = "shuttle"; + rev = version; + hash = hash; }; strictDeps = true; doCheck = false; nativeBuildInputs = with pkgs; [ - pkg-config + pkg-config ]; buildInputs = with pkgs; [ - openssl - zlib + openssl + zlib ]; meta = with lib; { - description = "A cargo command for the shuttle platform"; - license = licenses.asl20; - homepage = "https://shuttle.rs/"; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; + description = "A cargo command for the shuttle platform"; + license = licenses.asl20; + homepage = "https://shuttle.rs/"; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; }; -}; -in let cargoArtifacts = crane-lib.buildDepsOnly pkg; -in crane-lib.buildPackage ( - pkg // { inherit cargoArtifacts; } -) + }; +in let + cargoArtifacts = crane-lib.buildDepsOnly pkg; +in + crane-lib.buildPackage ( + pkg // {inherit cargoArtifacts;} + ) diff --git a/packages/dearpygui/default.nix b/packages/dearpygui/default.nix index 619ca5a..ce3c616 100644 --- a/packages/dearpygui/default.nix +++ b/packages/dearpygui/default.nix @@ -1,61 +1,64 @@ -{ - bonfire, - stdenv, lib, pkgs, - version ? "1.10.0", - sha256 ? "sha256-36GAGfvHZyNZe/Z7o3VrCCwApkZpJ+r2E8+1Hy32G5Q=", ... +{ + bonfire, + stdenv, + lib, + pkgs, + version ? "1.10.0", + sha256 ? "sha256-36GAGfvHZyNZe/Z7o3VrCCwApkZpJ+r2E8+1Hy32G5Q=", + ... }: pkgs.python3.pkgs.buildPythonPackage { - pname = "dearpygui"; - inherit version; + pname = "dearpygui"; + inherit version; - src = pkgs.fetchFromGitHub { - owner = "hoffstadt"; - repo = "DearPyGui"; - rev = "v${version}"; - fetchSubmodules = true; - sha256 = sha256; - }; + src = pkgs.fetchFromGitHub { + owner = "hoffstadt"; + repo = "DearPyGui"; + rev = "v${version}"; + fetchSubmodules = true; + sha256 = sha256; + }; - cmakeFlags = [ - "-DMVDIST_ONLY=True" - ]; + cmakeFlags = [ + "-DMVDIST_ONLY=True" + ]; - postConfigure = '' - cd $cmakeDir - mv build cmake-build-local - ''; + postConfigure = '' + cd $cmakeDir + mv build cmake-build-local + ''; - nativeBuildInputs = with pkgs; [ - pkg-config - cmake - ]; + nativeBuildInputs = with pkgs; [ + pkg-config + cmake + ]; - buildInputs = with pkgs; [ - xorg.libX11.dev - xorg.libXrandr.dev - xorg.libXinerama.dev - xorg.libXcursor.dev - xorg.xinput - xorg.libXi.dev - xorg.libXext - libxcrypt + buildInputs = with pkgs; [ + xorg.libX11.dev + xorg.libXrandr.dev + xorg.libXinerama.dev + xorg.libXcursor.dev + xorg.xinput + xorg.libXi.dev + xorg.libXext + libxcrypt - glfw - glew - ]; + glfw + glew + ]; - dontUseSetuptoolsCheck = true; + dontUseSetuptoolsCheck = true; - pythonImportsCheck = [ - "dearpygui" - ]; + pythonImportsCheck = [ + "dearpygui" + ]; - meta = with pkgs.lib; { - homepage = "https://dearpygui.readthedocs.io/en/"; - description = "Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies."; - license = licenses.mit; - platforms = platforms.linux; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - broken = pkgs.stdenv.isDarwin; - }; + meta = with pkgs.lib; { + homepage = "https://dearpygui.readthedocs.io/en/"; + description = "Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies."; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + broken = pkgs.stdenv.isDarwin; + }; } diff --git a/packages/default.nix b/packages/default.nix index 718dce2..58ae8fd 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,42 +1,48 @@ # self.packages.${system} # -{ self, nixpkgs, ... }: -let - forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ]; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); +{ + self, + inputs, + ... +}: let + forAllSystems = inputs.nixpkgs.lib.genAttrs ["x86_64-linux"]; + nixpkgsFor = forAllSystems (system: import inputs.nixpkgs {inherit system;}); +in + forAllSystems (system: let + pkgs = nixpkgsFor.${system}; -in forAllSystems(system: - let - pkgs = nixpkgsFor.${system}; + bonfire = self; + bonlib = self.lib; + bonpkgs = self.packages.${system}; + bonconfigs = self.configurations; - bonfire = self; - bonlib = self.lib; - bonpkgs = self.packages.${system}; + crane = self.inputs.crane; + crane-lib = self.inputs.crane.mkLib pkgs; - crane = self.inputs.crane; - crane-lib = self.inputs.crane.mkLib pkgs; + fenix = self.inputs.fenix; + fenix-pkgs = self.inputs.fenix.packages.${system}; - fenix = self.inputs.fenix; - in { - - bonfire-docs = pkgs.callPackage ./bonfire-docs { inherit bonfire; }; + nixvim-pkgs = self.inputs.nixvim.legacyPackages.${system}; + in { + bonfire-docs = pkgs.callPackage ./bonfire-docs {inherit bonfire;}; - netgen = pkgs.callPackage ./netgen { inherit bonfire; }; - - dearpygui = pkgs.callPackage ./dearpygui { inherit bonfire; }; + netgen = pkgs.callPackage ./netgen {inherit bonfire;}; - openfoam = pkgs.callPackage ./openfoam { inherit bonfire; }; + dearpygui = pkgs.callPackage ./dearpygui {inherit bonfire;}; - spoofdpi = pkgs.callPackage ./spoofdpi { inherit bonfire; }; + openfoam = pkgs.callPackage ./openfoam {inherit bonfire;}; - lego = pkgs.callPackage ./lego { inherit bonfire; }; + spoofdpi = pkgs.callPackage ./spoofdpi {inherit bonfire;}; - ultimmc = pkgs.libsForQt5.callPackage ./ultimmc { inherit bonfire; }; + lego = pkgs.callPackage ./lego {inherit bonfire;}; - cargo-shuttle = pkgs.callPackage ./cargo-shuttle { inherit bonfire crane-lib; }; + ultimmc = pkgs.libsForQt5.callPackage ./ultimmc {inherit bonfire;}; - nix-minimal = pkgs.callPackage ./nix-minimal { inherit bonpkgs bonlib; }; + cargo-shuttle = pkgs.callPackage ./cargo-shuttle {inherit bonfire crane-lib;}; - nix-runner = pkgs.callPackage ./nix-runner { inherit bonpkgs bonlib; }; -}) -# map (ps: (map (p: { name = p; systems = [ ps.${p}.system ]; type = if ps.${p}?imageTag then "image" else "package"; }) (builtins.attrNames ps))) (map (s: bf.packages.${s}) (builtins.attrNames bf.packages)) + nix-minimal = pkgs.callPackage ./nix-minimal {inherit bonpkgs bonlib;}; + + nix-runner = pkgs.callPackage ./nix-runner {inherit bonpkgs bonlib;}; + + bonvim = import ./bonvim {inherit nixvim-pkgs pkgs bonconfigs fenix-pkgs;}; + }) diff --git a/packages/lego/default.nix b/packages/lego/default.nix index 6b6a1c5..70452c8 100644 --- a/packages/lego/default.nix +++ b/packages/lego/default.nix @@ -1,38 +1,41 @@ -{ - bonfire, - lib, - fetchFromGitHub, buildGoModule, nixosTests, - version ? "c847ac4a4c55d6a5a457f6ef494cf45a47299e01", - hash ? "sha256-g9OxhM+iNUrAZgM1we8qPsismPy5a0eN654tSYuM/No=", - vendorHash ? "sha256-wG0x86lptEY3x+7kVN7v1XZniliMOxaJ6Y95YS6ivJY=", ... +{ + bonfire, + lib, + fetchFromGitHub, + buildGoModule, + nixosTests, + version ? "c847ac4a4c55d6a5a457f6ef494cf45a47299e01", + hash ? "sha256-g9OxhM+iNUrAZgM1we8qPsismPy5a0eN654tSYuM/No=", + vendorHash ? "sha256-wG0x86lptEY3x+7kVN7v1XZniliMOxaJ6Y95YS6ivJY=", + ... }: buildGoModule rec { - pname = "lego"; - inherit version; + pname = "lego"; + inherit version; - src = fetchFromGitHub { - owner = "go-acme"; - repo = "lego"; - rev = version; - hash = hash; - }; + src = fetchFromGitHub { + owner = "go-acme"; + repo = "lego"; + rev = version; + hash = hash; + }; - inherit vendorHash; + inherit vendorHash; - doCheck = false; + doCheck = false; - subPackages = [ "cmd/lego" ]; + subPackages = ["cmd/lego"]; - ldflags = [ - "-X main.version=${version}" - ]; + ldflags = [ + "-X main.version=${version}" + ]; - meta = with lib; { - description = "Let's Encrypt client and ACME library written in Go"; - license = licenses.mit; - homepage = "https://go-acme.github.io/lego/"; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - }; + meta = with lib; { + description = "Let's Encrypt client and ACME library written in Go"; + license = licenses.mit; + homepage = "https://go-acme.github.io/lego/"; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + }; - passthru.tests.lego = nixosTests.acme; + passthru.tests.lego = nixosTests.acme; } diff --git a/packages/netgen/default.nix b/packages/netgen/default.nix index 4f2cf32..310bc9a 100644 --- a/packages/netgen/default.nix +++ b/packages/netgen/default.nix @@ -1,72 +1,77 @@ -{ - bonfire, - stdenv, lib, pkgs, - version ? "6.2.2402", - sha256 ? "sha256-o3cj5k2VtYiGcs9Z9FyfwtOpDlZZlcO3kRgBSer6KAw=", ... -}: -let pkg = stdenv.mkDerivation { +{ + bonfire, + stdenv, + lib, + pkgs, + version ? "6.2.2402", + sha256 ? "sha256-o3cj5k2VtYiGcs9Z9FyfwtOpDlZZlcO3kRgBSer6KAw=", + ... +}: let + pkg = stdenv.mkDerivation { pname = "netgen"; inherit version; src = pkgs.fetchFromGitHub { - owner = "NGSolve"; - repo = "netgen"; - rev = "v${version}"; - sha256 = sha256; + owner = "NGSolve"; + repo = "netgen"; + rev = "v${version}"; + sha256 = sha256; }; patches = [ - ./regex-version.patch + ./regex-version.patch ]; cmakeFlags = [ - "-G Ninja" - "-D CMAKE_BUILD_TYPE=Release" - "-D USE_NATIVE_ARCH:BOOL=OFF" - "-D USE_OCC:BOOL=ON" - "-D USE_PYTHON:BOOL=ON" - "-D USE_GUI:BOOL=ON" - "-D USE_MPI:BOOL=ON" - "-D USE_SUPERBUILD:BOOL=OFF" - "-D PREFER_SYSTEM_PYBIND11:BOOL=ON" + "-G Ninja" + "-D CMAKE_BUILD_TYPE=Release" + "-D USE_NATIVE_ARCH:BOOL=OFF" + "-D USE_OCC:BOOL=ON" + "-D USE_PYTHON:BOOL=ON" + "-D USE_GUI:BOOL=ON" + "-D USE_MPI:BOOL=ON" + "-D USE_SUPERBUILD:BOOL=OFF" + "-D PREFER_SYSTEM_PYBIND11:BOOL=ON" ]; nativeBuildInputs = with pkgs; [ - cmake - ninja - git - (python3.withPackages (ps: with ps; [ - pybind11 - mpi4py + cmake + ninja + git + (python3.withPackages (ps: + with ps; [ + pybind11 + mpi4py ])) ]; buildInputs = with pkgs; [ - zlib - tcl - tk - mpi - opencascade-occt - libGL - libGLU - xorg.libXmu - metis + zlib + tcl + tk + mpi + opencascade-occt + libGL + libGLU + xorg.libXmu + metis ]; passthru = { - shellHook = with pkgs; '' - export PYTHONPATH="${python3}/${python3.sitePackages}" - export PYTHONPATH="$PYTHONPATH:${pkg}/${python3.sitePackages}" - ''; + shellHook = with pkgs; '' + export PYTHONPATH="${python3}/${python3.sitePackages}" + export PYTHONPATH="$PYTHONPATH:${pkg}/${python3.sitePackages}" + ''; }; meta = with pkgs.lib; { - homepage = "https://github.com/NGSolve/netgen"; - description = "NETGEN is an automatic 3d tetrahedral mesh generator"; - license = licenses.lgpl21Only; - platforms = platforms.linux; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - broken = pkgs.stdenv.isDarwin; + homepage = "https://github.com/NGSolve/netgen"; + description = "NETGEN is an automatic 3d tetrahedral mesh generator"; + license = licenses.lgpl21Only; + platforms = platforms.linux; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + broken = pkgs.stdenv.isDarwin; }; -}; -in pkg + }; +in + pkg diff --git a/packages/nix-minimal/default.nix b/packages/nix-minimal/default.nix index 9b9a8d3..6769ee2 100644 --- a/packages/nix-minimal/default.nix +++ b/packages/nix-minimal/default.nix @@ -1,136 +1,150 @@ -{ - pkgs, - lib, - bonlib, - extraPaths ? [], - ... -}: -let - nixPath = pkgs.writeText "nixpkgsError" ''_: throw ''' - This container doesn't include nixpkgs. - Hint: override the NIX_PATH environment variable with eg: - "NIX_PATH=nixpkgs=channel:nixos-unstable" - ''' ''; +{ + pkgs, + lib, + bonlib, + extraPaths ? [], + ... +}: let + nixPath = pkgs.writeText "nixpkgsError" '' _: throw ''' + This container doesn't include nixpkgs. + Hint: override the NIX_PATH environment variable with eg: + "NIX_PATH=nixpkgs=channel:nixos-unstable" + ''' ''; - builderIds = let forEach = n: if n == 1 then [n] else [n] ++ forEach (n - 1); in forEach 32; + builderIds = let + forEach = n: + if n == 1 + then [n] + else [n] ++ forEach (n - 1); + in + forEach 32; - withFakeNss = with pkgs; [ - (writeTextDir "etc/passwd" ( - builtins.concatStringsSep "\n" ( - map (n: "nixbld${toString n}:x:${toString (30000 + n)}:30000:Nix build user ${toString n}:/var/empty:/bin/false") builderIds) - + "\n" + '' - root:x:0:0:System administrator:/root:${bashInteractive}/bin/bash - nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:${shadow}/bin/nologin - '')) + withFakeNss = with pkgs; [ + (writeTextDir "etc/passwd" ( + builtins.concatStringsSep "\n" ( + map (n: "nixbld${toString n}:x:${toString (30000 + n)}:30000:Nix build user ${toString n}:/var/empty:/bin/false") builderIds + ) + + "\n" + + '' + root:x:0:0:System administrator:/root:${bashInteractive}/bin/bash + nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:${shadow}/bin/nologin + '' + )) - (writeTextDir "etc/group" '' - root:x:0: - wheel:x:1: - kmem:x:2: - tty:x:3: - messagebus:x:4: - disk:x:6: - audio:x:17: - floppy:x:18: - uucp:x:19: - lp:x:20: - cdrom:x:24: - tape:x:25: - video:x:26: - dialout:x:27: - utmp:x:29: - adm:x:55: - keys:x:96: - users:x:100: - input:x:174: - nixbld:x:30000:${builtins.concatStringsSep "," (map (n: "nixbld${toString n}") builderIds)} - nogroup:x:65534: - '') + (writeTextDir "etc/group" '' + root:x:0: + wheel:x:1: + kmem:x:2: + tty:x:3: + messagebus:x:4: + disk:x:6: + audio:x:17: + floppy:x:18: + uucp:x:19: + lp:x:20: + cdrom:x:24: + tape:x:25: + video:x:26: + dialout:x:27: + utmp:x:29: + adm:x:55: + keys:x:96: + users:x:100: + input:x:174: + nixbld:x:30000:${builtins.concatStringsSep "," (map (n: "nixbld${toString n}") builderIds)} + nogroup:x:65534: + '') - (writeTextDir "etc/nsswitch.conf" '' - passwd: files mymachines systemd - group: files mymachines systemd - shadow: files + (writeTextDir "etc/nsswitch.conf" '' + passwd: files mymachines systemd + group: files mymachines systemd + shadow: files - hosts: files mymachines dns myhostname - networks: files + hosts: files mymachines dns myhostname + networks: files - ethers: files - services: files - protocols: files - rpc: files - '') - ]; + ethers: files + services: files + protocols: files + rpc: files + '') + ]; - withNixConf = with pkgs; [ - (writeTextDir "etc/nix/nix.conf" '' - accept-flake-config = true - experimental-features = nix-command flakes - show-trace = true - max-jobs = auto - trusted-users = root - '') - ]; - -in pkgs.dockerTools.buildImageWithNixDb { + withNixConf = with pkgs; [ + (writeTextDir "etc/nix/nix.conf" '' + accept-flake-config = true + experimental-features = nix-command flakes + show-trace = true + max-jobs = auto + trusted-users = root + '') + ]; +in + pkgs.dockerTools.buildImageWithNixDb { name = "nix-minimal"; tag = "latest"; copyToRoot = pkgs.buildEnv { - name = "image-root"; - pathsToLink = [ "/bin" "/etc" ]; - paths = with pkgs; [ - dockerTools.usrBinEnv + name = "image-root"; + pathsToLink = ["/bin" "/etc"]; + paths = with pkgs; + [ + dockerTools.usrBinEnv - coreutils - bashInteractive - nix + coreutils + bashInteractive + nix - cacert - gnutar - gzip - xz - openssh - ((git.override { - perlSupport = false; - pythonSupport = false; - withpcre2 = false; - withManual = false; - }).overrideAttrs (_: { doInstallCheck = false; })) + cacert + gnutar + gzip + xz + openssh + ((git.override { + perlSupport = false; + pythonSupport = false; + withpcre2 = false; + withManual = false; + }) + .overrideAttrs (_: {doInstallCheck = false;})) - iana-etc - ] ++ withFakeNss ++ withNixConf ++ extraPaths; + iana-etc + ] + ++ withFakeNss + ++ withNixConf + ++ extraPaths; }; runAsRoot = with pkgs; '' - #!${runtimeShell} - ${dockerTools.shadowSetup} + #!${runtimeShell} + ${dockerTools.shadowSetup} ''; config = { - Cmd = [ "/bin/bash" ]; - Env = [ - "USER=root" - "PATH=/bin:/usr/bin:/nix/var/nix/profiles/default/bin" - "PAGER=cat" - "ENV=/etc/profile.d/nix.sh" - "BASH_ENV=/etc/profile.d/nix.sh" - "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" - "NIX_BUILD_SHELL=/bin/bash" - "NIX_PATH=nixpkgs=${nixPath}" - ]; + Cmd = ["/bin/bash"]; + Env = [ + "USER=root" + "PATH=/bin:/usr/bin:/nix/var/nix/profiles/default/bin" + "PAGER=cat" + "ENV=/etc/profile.d/nix.sh" + "BASH_ENV=/etc/profile.d/nix.sh" + "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" + "NIX_BUILD_SHELL=/bin/bash" + "NIX_PATH=nixpkgs=${nixPath}" + ]; }; -} // { + } + // { meta = with lib; { - homepage = "https://vcs.elnafo.ru/L-Nafaryus/bonfire"; - description = "Minimal image with a Nix package manager"; - longDescription = '' - Minimal docker image with Nix package manager (https://nixos.org/). - Enabled features: nix-command, flakes. - Versions: latest - ''; - platforms = platforms.linux; - license = licenses.lgpl21Plus; - maintainers = with bonlib.maintainers; [ L-Nafaryus ]; + homepage = "https://vcs.elnafo.ru/L-Nafaryus/bonfire"; + description = "Minimal image with a Nix package manager"; + longDescription = '' + Minimal docker image with Nix package manager (https://nixos.org/). + Enabled features: nix-command, flakes. + Versions: latest + ''; + platforms = platforms.linux; + license = licenses.lgpl21Plus; + maintainers = with bonlib.maintainers; [L-Nafaryus]; }; -} + } diff --git a/packages/nix-runner/default.nix b/packages/nix-runner/default.nix index d15674d..00edfd1 100644 --- a/packages/nix-runner/default.nix +++ b/packages/nix-runner/default.nix @@ -1,34 +1,39 @@ { - pkgs, - lib, - bonpkgs, - bonlib, - extraPaths ? [], - ... + pkgs, + lib, + bonpkgs, + bonlib, + extraPaths ? [], + ... }: pkgs.dockerTools.buildImage { - name = "nix-runner"; - tag = "latest"; - fromImage = bonpkgs.nix-minimal; + name = "nix-runner"; + tag = "latest"; + fromImage = bonpkgs.nix-minimal; - copyToRoot = pkgs.buildEnv { - name = "image-root"; - pathsToLink = [ "/bin" ]; - paths = with pkgs; [ - nodejs - jq - cachix - ] ++ extraPaths; - }; + copyToRoot = pkgs.buildEnv { + name = "image-root"; + pathsToLink = ["/bin"]; + paths = with pkgs; + [ + nodejs + jq + cachix + ] + ++ extraPaths; + }; - config.Cmd = [ "/bin/bash" ]; -} // { - meta = bonpkgs.nix-minimal.meta // { - description = "Image for action runners with a Nix package manager"; - longDescription = '' - Docker image for action runners with Nix package manager (https://nixos.org/). - Enabled features: nix-command, flakes. - Versions: latest - ''; + config.Cmd = ["/bin/bash"]; +} +// { + meta = + bonpkgs.nix-minimal.meta + // { + description = "Image for action runners with a Nix package manager"; + longDescription = '' + Docker image for action runners with Nix package manager (https://nixos.org/). + Enabled features: nix-command, flakes. + Versions: latest + ''; }; } diff --git a/packages/openfoam/default.nix b/packages/openfoam/default.nix index c8b8792..f441747 100644 --- a/packages/openfoam/default.nix +++ b/packages/openfoam/default.nix @@ -1,84 +1,87 @@ -{ - bonfire, - stdenv, lib, pkgs, - version ? "11.20240116", - sha256 ? "sha256-bNWlza3cL/lUrwrVEmPECvKbFkwR2rTMaccsn8amGFQ=", ... -}: -let - version' = lib.strings.splitString "." version; - major = lib.elemAt version' 0; - revision = lib.elemAt version' 1; - realname = "OpenFOAM"; -in -let pkg = stdenv.mkDerivation { +{ + bonfire, + stdenv, + lib, + pkgs, + version ? "11.20240116", + sha256 ? "sha256-bNWlza3cL/lUrwrVEmPECvKbFkwR2rTMaccsn8amGFQ=", + ... +}: let + version' = lib.strings.splitString "." version; + major = lib.elemAt version' 0; + revision = lib.elemAt version' 1; + realname = "OpenFOAM"; +in let + pkg = stdenv.mkDerivation { pname = "openfoam"; inherit version major; src = pkgs.fetchFromGitHub { - owner = realname; - repo = "${realname}-${major}"; - rev = "${revision}"; - sha256 = sha256; + owner = realname; + repo = "${realname}-${major}"; + rev = "${revision}"; + sha256 = sha256; }; - nativeBuildInputs = with pkgs; [ bash m4 flex bison ]; + nativeBuildInputs = with pkgs; [bash m4 flex bison]; - buildInputs = with pkgs; [ fftw mpi scotch boost cgal zlib ]; + buildInputs = with pkgs; [fftw mpi scotch boost cgal zlib]; postPatch = '' - substituteInPlace etc/bashrc \ - --replace '[ "$BASH" -o "$ZSH_NAME" ] && \' '#' \ - --replace 'export FOAM_INST_DIR=$(cd $(dirname ${"$"}{BASH_SOURCE:-$0})/../.. && pwd -P) || \' '#' \ - --replace 'export FOAM_INST_DIR=$HOME/$WM_PROJECT' '# __inst_dir_placeholder__' + substituteInPlace etc/bashrc \ + --replace '[ "$BASH" -o "$ZSH_NAME" ] && \' '#' \ + --replace 'export FOAM_INST_DIR=$(cd $(dirname ${"$"}{BASH_SOURCE:-$0})/../.. && pwd -P) || \' '#' \ + --replace 'export FOAM_INST_DIR=$HOME/$WM_PROJECT' '# __inst_dir_placeholder__' - patchShebangs Allwmake - patchShebangs etc - patchShebangs wmake - patchShebangs applications - patchShebangs bin + patchShebangs Allwmake + patchShebangs etc + patchShebangs wmake + patchShebangs applications + patchShebangs bin ''; configurePhase = '' - export FOAM_INST_DIR=$NIX_BUILD_TOP/source - export WM_PROJECT_DIR=$FOAM_INST_DIR/${realname}-${major} - mkdir $WM_PROJECT_DIR + export FOAM_INST_DIR=$NIX_BUILD_TOP/source + export WM_PROJECT_DIR=$FOAM_INST_DIR/${realname}-${major} + mkdir $WM_PROJECT_DIR - mv $(find $FOAM_INST_DIR/ -maxdepth 1 -not -path $WM_PROJECT_DIR -not -path $FOAM_INST_DIR/) \ - $WM_PROJECT_DIR/ + mv $(find $FOAM_INST_DIR/ -maxdepth 1 -not -path $WM_PROJECT_DIR -not -path $FOAM_INST_DIR/) \ + $WM_PROJECT_DIR/ - set +e - . $WM_PROJECT_DIR/etc/bashrc - set -e + set +e + . $WM_PROJECT_DIR/etc/bashrc + set -e ''; buildPhase = '' - sh $WM_PROJECT_DIR/Allwmake -j$CORES - wclean all - wmakeLnIncludeAll + sh $WM_PROJECT_DIR/Allwmake -j$CORES + wclean all + wmakeLnIncludeAll ''; installPhase = '' - mkdir -p $out/${realname}-${major} + mkdir -p $out/${realname}-${major} - substituteInPlace $WM_PROJECT_DIR/etc/bashrc \ - --replace '# __inst_dir_placeholder__' "export FOAM_INST_DIR=$out" + substituteInPlace $WM_PROJECT_DIR/etc/bashrc \ + --replace '# __inst_dir_placeholder__' "export FOAM_INST_DIR=$out" - cp -Ra $WM_PROJECT_DIR/* $out/${realname}-${major} + cp -Ra $WM_PROJECT_DIR/* $out/${realname}-${major} ''; passthru = { - shellHook = '' - . ${pkg}/${realname}-${major}/etc/bashrc - ''; + shellHook = '' + . ${pkg}/${realname}-${major}/etc/bashrc + ''; }; meta = with pkgs.lib; { - homepage = "https://www.openfoam.org/"; - description = "OpenFOAM is a free, open source CFD software released and developed by OpenFOAM Foundation"; - license = licenses.gpl3; - platforms = platforms.linux; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - broken = pkgs.stdenv.isDarwin; + homepage = "https://www.openfoam.org/"; + description = "OpenFOAM is a free, open source CFD software released and developed by OpenFOAM Foundation"; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + broken = pkgs.stdenv.isDarwin; }; -}; -in pkg + }; +in + pkg diff --git a/packages/spoofdpi/default.nix b/packages/spoofdpi/default.nix index 5bb6c1a..753dcee 100644 --- a/packages/spoofdpi/default.nix +++ b/packages/spoofdpi/default.nix @@ -1,33 +1,35 @@ -{ - bonfire, - lib, pkgs, - version ? "0.8", - hash ? "sha256-kPCdOZl4m7KBb970TjJokXorKfnCvuV5Uq7lFQIh1z8=", - vendorHash ? "sha256-ib9xRklkLfrDCuLf7zDkJE8lJiNiUMPZ01MDxvqho6o=", ... +{ + bonfire, + lib, + pkgs, + version ? "0.8", + hash ? "sha256-kPCdOZl4m7KBb970TjJokXorKfnCvuV5Uq7lFQIh1z8=", + vendorHash ? "sha256-ib9xRklkLfrDCuLf7zDkJE8lJiNiUMPZ01MDxvqho6o=", + ... }: pkgs.buildGoModule { - pname = "spoofdpi"; - inherit version; + pname = "spoofdpi"; + inherit version; - src = pkgs.fetchFromGitHub { - owner = "xvzc"; - repo = "SpoofDPI"; - rev = version; - hash = hash; - }; + src = pkgs.fetchFromGitHub { + owner = "xvzc"; + repo = "SpoofDPI"; + rev = version; + hash = hash; + }; - inherit vendorHash; + inherit vendorHash; - doCheck = false; + doCheck = false; - ldflags = ["-s" "-w" "-X main.version=${version}" "-X main.builtBy=nixpkgs"]; + ldflags = ["-s" "-w" "-X main.version=${version}" "-X main.builtBy=nixpkgs"]; - meta = with lib; { - homepage = "https://github.com/xvzc/SpoofDPI"; - description = "A simple and fast anti-censorship tool written in Go"; - license = licenses.asl20; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - broken = false; - mainProgram = "spoof-dpi"; - }; + meta = with lib; { + homepage = "https://github.com/xvzc/SpoofDPI"; + description = "A simple and fast anti-censorship tool written in Go"; + license = licenses.asl20; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + broken = false; + mainProgram = "spoof-dpi"; + }; } diff --git a/packages/ultimmc/default.nix b/packages/ultimmc/default.nix index fae3f2a..db75c0e 100644 --- a/packages/ultimmc/default.nix +++ b/packages/ultimmc/default.nix @@ -1,75 +1,83 @@ -{ - bonfire, - lib, stdenv, - fetchFromGitHub, wrapQtAppsHook, - extra-cmake-modules, cmake, - file, jdk17, - copyDesktopItems, makeDesktopItem, - xorg, libpulseaudio, libGL +{ + bonfire, + lib, + stdenv, + fetchFromGitHub, + wrapQtAppsHook, + extra-cmake-modules, + cmake, + file, + jdk17, + copyDesktopItems, + makeDesktopItem, + xorg, + libpulseaudio, + libGL, }: stdenv.mkDerivation rec { - version = "faf3c966c43465d6f6c245ed78556222240398ee"; - pname = "ultimmc"; + version = "faf3c966c43465d6f6c245ed78556222240398ee"; + pname = "ultimmc"; - src = fetchFromGitHub { - fetchSubmodules = true; - owner = "UltimMC"; - repo = "Launcher"; - rev = "faf3c966c43465d6f6c245ed78556222240398ee"; - sha256 = "sha256-/+cYbAzf84PrgzJHUsc3tVU9E+mDMtx5eGEJK9ZBM2w="; - }; + src = fetchFromGitHub { + fetchSubmodules = true; + owner = "UltimMC"; + repo = "Launcher"; + rev = "faf3c966c43465d6f6c245ed78556222240398ee"; + sha256 = "sha256-/+cYbAzf84PrgzJHUsc3tVU9E+mDMtx5eGEJK9ZBM2w="; + }; - nativeBuildInputs = [ - wrapQtAppsHook - extra-cmake-modules - cmake - file - jdk17 - copyDesktopItems - ]; + nativeBuildInputs = [ + wrapQtAppsHook + extra-cmake-modules + cmake + file + jdk17 + copyDesktopItems + ]; - desktopItems = [ - (makeDesktopItem { - name = "ultimmc"; - desktopName = "UltimMC"; - icon = "ultimmc"; - comment = "Cracked Minecraft launcher"; - exec = "UltimMC %u"; - categories = [ "Game" ]; - }) - ]; + desktopItems = [ + (makeDesktopItem { + name = "ultimmc"; + desktopName = "UltimMC"; + icon = "ultimmc"; + comment = "Cracked Minecraft launcher"; + exec = "UltimMC %u"; + categories = ["Game"]; + }) + ]; - cmakeFlags = [ "-DLauncher_LAYOUT=lin-nodeps" ]; - -# TODO: fix broken data directory location - postInstall = let - libpath = with xorg; lib.makeLibraryPath [ - libX11 - libXext - libXcursor - libXrandr - libXxf86vm - libpulseaudio - libGL - ]; - in '' - install -Dm0644 ${src}/notsecrets/logo.svg $out/share/icons/hicolor/scalable/apps/ultimmc.svg + cmakeFlags = ["-DLauncher_LAYOUT=lin-nodeps"]; - chmod -x $out/bin/*.so - wrapProgram $out/bin/UltimMC \ - "''${qtWrapperArgs[@]}" \ - --set GAME_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \ - --prefix PATH : ${lib.makeBinPath [xorg.xrandr]} \ - --add-flags '-d ~/.local/share/ultimmc' + # TODO: fix broken data directory location + postInstall = let + libpath = with xorg; + lib.makeLibraryPath [ + libX11 + libXext + libXcursor + libXrandr + libXxf86vm + libpulseaudio + libGL + ]; + in '' + install -Dm0644 ${src}/notsecrets/logo.svg $out/share/icons/hicolor/scalable/apps/ultimmc.svg - rm $out/UltimMC - ''; + chmod -x $out/bin/*.so + wrapProgram $out/bin/UltimMC \ + "''${qtWrapperArgs[@]}" \ + --set GAME_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \ + --prefix PATH : ${lib.makeBinPath [xorg.xrandr]} \ + --add-flags '-d ~/.local/share/ultimmc' - meta = with lib; { - homepage = "https://github.com/UltimMC/Launcher"; - description = "Cracked Minecraft Launcher"; - license = licenses.asl20; - platforms = platforms.linux; - maintainers = with bonfire.lib.maintainers; [ L-Nafaryus ]; - }; + rm $out/UltimMC + ''; + + meta = with lib; { + homepage = "https://github.com/UltimMC/Launcher"; + description = "Cracked Minecraft Launcher"; + license = licenses.asl20; + platforms = platforms.linux; + maintainers = with bonfire.lib.maintainers; [L-Nafaryus]; + }; } diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index 09c0959..9f097d5 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -1,52 +1,62 @@ { - description = "Basic rust template"; + description = "Basic rust template"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - crane = { url = "github:ipetkov/crane"; inputs.nixpkgs.follows = "nixpkgs"; }; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + crane = { + url = "github:ipetkov/crane"; + inputs.nixpkgs.follows = "nixpkgs"; }; + }; - outputs = inputs @ { self, nixpkgs, crane, ... }: - let - forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ]; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); - in { - packages = forAllSystems (system: { - my-crate = let - pkgs = nixpkgsFor.${system}; - craneLib = crane.lib.${system}; - in craneLib.buildPackage { - src = craneLib.cleanCargoSource (craneLib.path ./.); - strictDeps = true; + outputs = inputs @ { + self, + nixpkgs, + crane, + ... + }: let + forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux"]; + nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); + in { + packages = forAllSystems (system: { + my-crate = let + pkgs = nixpkgsFor.${system}; + craneLib = crane.lib.${system}; + in + craneLib.buildPackage { + src = craneLib.cleanCargoSource (craneLib.path ./.); + strictDeps = true; - buildInputs = []; - }; + buildInputs = []; + }; - default = self.packages.${system}.my-crate; - }); + default = self.packages.${system}.my-crate; + }); - checks = forAllSystems (system: { - inherit (self.packages.${system}.my-crate); + checks = forAllSystems (system: { + inherit (self.packages.${system}.my-crate); - my-crate-fmt = let craneLib = crane.lib.${system}; in craneLib.cargoFmt { - src = craneLib.cleanCargoSource (craneLib.path ./.); - }; - }); + my-crate-fmt = let + craneLib = crane.lib.${system}; + in + craneLib.cargoFmt { + src = craneLib.cleanCargoSource (craneLib.path ./.); + }; + }); - apps = forAllSystems (system: { - default = { - type = "app"; - program = "${self.packages.${system}.my-crate}/bin/rust-example"; - }; - }); + apps = forAllSystems (system: { + default = { + type = "app"; + program = "${self.packages.${system}.my-crate}/bin/rust-example"; + }; + }); - devShells = forAllSystems (system: { - default = crane.lib.${system}.devShell { - checks = self.checks.${system}; - - packages = []; - }; - }); - }; + devShells = forAllSystems (system: { + default = crane.lib.${system}.devShell { + checks = self.checks.${system}; + packages = []; + }; + }); + }; }