diff options
-rw-r--r-- | configurations/melian/default.nix | 5 | ||||
-rw-r--r-- | flake.lock | 48 | ||||
-rw-r--r-- | flake.nix | 48 | ||||
-rw-r--r-- | modules/nixfiles/alacritty.nix | 2 | ||||
-rw-r--r-- | modules/nixfiles/common/nix/default.nix | 17 | ||||
-rw-r--r-- | modules/nixfiles/common/xdg.nix | 67 | ||||
-rw-r--r-- | modules/nixfiles/games/minecraft.nix | 12 | ||||
-rw-r--r-- | modules/nixfiles/profiles/common.nix | 106 | ||||
-rw-r--r-- | modules/nixfiles/profiles/default.nix | 109 | ||||
-rw-r--r-- | modules/nixfiles/profiles/dev/common.nix | 267 | ||||
-rw-r--r-- | modules/nixfiles/profiles/dev/containers.nix (renamed from modules/nixfiles/profiles/dev/containers/default.nix) | 10 | ||||
-rw-r--r-- | modules/nixfiles/profiles/dev/default.nix | 274 | ||||
-rw-r--r-- | modules/nixfiles/profiles/dev/sql.nix (renamed from modules/nixfiles/profiles/dev/sql/default.nix) | 7 | ||||
-rw-r--r-- | modules/nixfiles/profiles/headful.nix | 15 | ||||
-rw-r--r-- | modules/nixfiles/profiles/headless.nix | 13 | ||||
-rw-r--r-- | modules/nixfiles/x11.nix | 4 | ||||
-rw-r--r-- | modules/nixfiles/zathura.nix | 6 | ||||
-rw-r--r-- | packages/ultimmc.nix | 64 |
18 files changed, 528 insertions, 546 deletions
diff --git a/configurations/melian/default.nix b/configurations/melian/default.nix index a3dbe35..94e799e 100644 --- a/configurations/melian/default.nix +++ b/configurations/melian/default.nix @@ -5,11 +5,6 @@ }: with lib; { nixfiles.modules = { - profiles.dev = { - containers.enable = true; - sql.enable = true; - }; - games = { lutris.enable = true; minecraft.client.enable = true; diff --git a/flake.lock b/flake.lock index 5d912e7..b0ba0bb 100644 --- a/flake.lock +++ b/flake.lock @@ -243,6 +243,7 @@ }, "original": { "owner": "edolstra", + "ref": "master", "repo": "flake-compat", "type": "github" } @@ -342,6 +343,22 @@ "type": "github" } }, + "libnbtplusplus": { + "flake": false, + "locked": { + "lastModified": 1650031308, + "narHash": "sha256-TvVOjkUobYJD9itQYueELJX3wmecvEdCbJ0FinW2mL4=", + "owner": "PolyMC", + "repo": "libnbtplusplus", + "rev": "2203af7eeb48c45398139b583615134efd8d407f", + "type": "github" + }, + "original": { + "owner": "PolyMC", + "repo": "libnbtplusplus", + "type": "github" + } + }, "nix-doom-emacs": { "inputs": { "doom-emacs": "doom-emacs", @@ -355,7 +372,9 @@ "evil-org-mode": "evil-org-mode", "evil-quick-diff": "evil-quick-diff", "explain-pause-mode": "explain-pause-mode", - "flake-compat": "flake-compat", + "flake-compat": [ + "flake-compat" + ], "flake-utils": [ "flake-utils" ], @@ -657,6 +676,31 @@ "type": "github" } }, + "pollymc": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "libnbtplusplus": "libnbtplusplus", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1662670318, + "narHash": "sha256-SZdKI85G+Aa9Oz3FgZydpKfAjyG3ZcF4ZE0jv2pG6wE=", + "owner": "fn2006", + "repo": "PollyMC", + "rev": "d2a9dd88db564cf31b600ef2828d7636bffdcb52", + "type": "github" + }, + "original": { + "owner": "fn2006", + "ref": "1.4.2", + "repo": "PollyMC", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-utils": [ @@ -703,6 +747,7 @@ "azahi-cc": "azahi-cc", "dns-nix": "dns-nix", "emacs-overlay": "emacs-overlay", + "flake-compat": "flake-compat", "flake-registry": "flake-registry", "flake-utils": "flake-utils", "flake-utils-plus": "flake-utils-plus", @@ -717,6 +762,7 @@ "nmap-vulners": "nmap-vulners", "nmap-vulscan": "nmap-vulscan", "nur": "nur", + "pollymc": "pollymc", "pre-commit-hooks": "pre-commit-hooks", "simple-nixos-mailserver": "simple-nixos-mailserver", "xmonad-ng": "xmonad-ng" diff --git a/flake.nix b/flake.nix index 6d38577..5fd0fb5 100644 --- a/flake.nix +++ b/flake.nix @@ -83,8 +83,9 @@ repo = "nix-doom-emacs"; ref = "master"; inputs = { - flake-utils.follows = "flake-utils"; emacs-overlay.follows = "emacs-overlay"; + flake-compat.follows = "flake-compat"; + flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; }; }; @@ -100,6 +101,17 @@ }; }; + pollymc = { + type = "github"; + owner = "fn2006"; + repo = "PollyMC"; + ref = "1.4.2"; + inputs = { + flake-compat.follows = "flake-compat"; + nixpkgs.follows = "nixpkgs"; + }; + }; + dns-nix = { type = "github"; owner = "kirelagin"; @@ -140,19 +152,6 @@ ref = "master"; }; - # NOTE Used indirectly by nix-minecraft-servers. - # This is declared explicitly because nested follows are broken[1]. - # - # [1]: https://github.com/NixOS/nix/issues/5790 - # [1]: https://github.com/NixOS/nix/pull/6621 - flake-utils-plus = { - type = "github"; - owner = "gytis-ivaskevicius"; - repo = "flake-utils-plus"; - ref = "master"; - inputs.flake-utils.follows = "flake-utils"; - }; - flake-registry = { type = "github"; owner = "NixOS"; @@ -216,6 +215,26 @@ ref = "master"; flake = false; }; + + # NOTE These inputs are used indirectly by other inputs. These are declared + # explicitly because nested follows are broken[1]. + # + # [1]: https://github.com/NixOS/nix/issues/5790 + # [1]: https://github.com/NixOS/nix/pull/6621 + flake-utils-plus = { + type = "github"; + owner = "gytis-ivaskevicius"; + repo = "flake-utils-plus"; + ref = "master"; + inputs.flake-utils.follows = "flake-utils"; + }; + flake-compat = { + type = "github"; + owner = "edolstra"; + repo = "flake-compat"; + ref = "master"; + flake = false; + }; }; outputs = inputs: @@ -268,7 +287,6 @@ # TODO Make it so that self.packages also can use this. overlays.default = final: _: { - UltimMC = final.libsForQt5.callPackage ./packages/ultimmc.nix {}; bruh = final.callPackage ./packages/bruh.nix {}; mpv-autosub = final.callPackage ./packages/mpv-autosub.nix {}; myip = final.callPackage ./packages/myip.nix {}; diff --git a/modules/nixfiles/alacritty.nix b/modules/nixfiles/alacritty.nix index 4afd11b..728e6ee 100644 --- a/modules/nixfiles/alacritty.nix +++ b/modules/nixfiles/alacritty.nix @@ -43,7 +43,7 @@ in { }; inherit size; }; - colors = with profiles.common.colourScheme; { + colors = with config.colourScheme; { primary = {inherit background foreground;}; cursor = { text = "CellBackground"; diff --git a/modules/nixfiles/common/nix/default.nix b/modules/nixfiles/common/nix/default.nix index 550749a..9fc585b 100644 --- a/modules/nixfiles/common/nix/default.nix +++ b/modules/nixfiles/common/nix/default.nix @@ -14,10 +14,9 @@ with lib; { _module.args = let importNixpkgs = nixpkgs: - import nixpkgs { - inherit (config.nixpkgs) localSystem crossSystem config; - }; + import nixpkgs {inherit (config.nixpkgs) config localSystem;}; in rec { + pkgsLocal = importNixpkgs "${config.my.home}/src/nixpkgs"; # Impure! pkgsMaster = importNixpkgs inputs.nixpkgs-master; pkgsStable = importNixpkgs inputs.nixpkgs-stable; pkgsRev = rev: hash: @@ -27,7 +26,6 @@ with lib; { inherit rev hash; }); pkgsPR = pr: pkgsRev "refs/pull/${toString pr}/head"; - pkgsLocal = importNixpkgs "${config.my.home}/src/nixpkgs"; }; nix = let @@ -51,9 +49,7 @@ with lib; { registry = mapAttrs (_: flake: {inherit flake;}) filteredInputs - // { - nixfiles.flake = inputs.self; - }; + // {nixfiles.flake = inputs.self;}; settings = { trusted-users = ["root" "@wheel"]; @@ -96,7 +92,7 @@ with lib; { // (with super; let np = nodePackages; in { - # Normalises package names. + # Normalises package names. This is done purely for aesthetics. dockerfile-language-server = np.dockerfile-language-server-nodejs; editorconfig = editorconfig-core-c; inherit (np) bash-language-server; @@ -113,6 +109,7 @@ with lib; { emacs-overlay.overlay nix-minecraft-servers.overlays.default nur.overlay + pollymc.overlay xmonad-ng.overlays.default ]; @@ -123,9 +120,9 @@ with lib; { localBinInPath = true; - defaultPackages = mkForce []; + defaultPackages = []; systemPackages = with pkgs; - optionals config.profile.headful [ + optionals this.isHeadful [ nix-top nix-tree ]; diff --git a/modules/nixfiles/common/xdg.nix b/modules/nixfiles/common/xdg.nix index 72a8e4c..60d5286 100644 --- a/modules/nixfiles/common/xdg.nix +++ b/modules/nixfiles/common/xdg.nix @@ -38,45 +38,50 @@ with lib; { }; } (mkIf this.isHeadful { - mimeApps = let - images = [ - "image/bmp" - "image/gif" - "image/jpeg" - "image/jpg" - "image/png" - "image/svg+xml" - "image/tiff" - "image/webp" - ]; - media = [ - "audio/aac" - "audio/flac" - "audio/mp3" - "audio/ogg" - "audio/wav" - "audio/webm" - "video/mkv" - "video/mp4" - "video/ogg" - "video/webm" - "video/x-matroska" - ]; - in { + mimeApps = { enable = true; - defaultApplications = mkMerge (mapAttrsToList - (n: ms: genAttrs ms (_: ["${n}.desktop"])) + (n: v: genAttrs v (_: ["${n}.desktop"])) { - aria2 = ["application/x-bittorrent" "x-scheme-handler/magnet"]; - emacsclient = ["x-scheme-handler/mailto"]; + emacsclient = [ + "application/json" + "application/vnd.ms-publisher" + "application/x-desktop" + "application/x-shellscript" + "application/x-trash" + "application/x-wine-extension-ini" + "application/xml" + "text/markdown" + "text/plain" + ]; firefox = [ "text/html" "x-scheme-handler/http" "x-scheme-handler/https" ]; - gwenview = images; - mpv = media; + gwenview = [ + "image/bmp" + "image/gif" + "image/jpeg" + "image/jpg" + "image/png" + "image/svg+xml" + "image/tiff" + "image/webp" + ]; + mpv = [ + "audio/aac" + "audio/flac" + "audio/mp3" + "audio/ogg" + "audio/wav" + "audio/webm" + "video/mkv" + "video/mp4" + "video/ogg" + "video/webm" + "video/x-matroska" + ]; }); }; }) diff --git a/modules/nixfiles/games/minecraft.nix b/modules/nixfiles/games/minecraft.nix index 2fc9bd8..e53f9eb 100644 --- a/modules/nixfiles/games/minecraft.nix +++ b/modules/nixfiles/games/minecraft.nix @@ -2,7 +2,6 @@ config, lib, pkgs, - pkgsPR, ... }: with lib; let @@ -21,16 +20,13 @@ in { }; }; - # Configurations, opslist, whitelist and plugins are managed imperatively. - # TODO Make it declarative. config = mkMerge [ (mkIf cfg.client.enable { - hm.home.packages = with pkgs; [ - UltimMC # I refuse to use a Microsoft account. Using GitHub is painful enough. - jre # Unfortunately, this cannot be provided as a PATH injection to UltimMC. - ]; + hm.home.packages = with pkgs; [pollymc]; }) (mkIf cfg.server.enable { + # Configurations, opslist, whitelist and plugins are managed imperatively. + # TODO Make it declarative. services.minecraft-server = { enable = true; eula = true; @@ -47,7 +43,7 @@ in { + " "; }; - # Found in /var/lib/minecraft/server.properties. + # Defined in /var/lib/minecraft/server.properties. networking.firewall.allowedTCPPorts = [55565]; }) ]; diff --git a/modules/nixfiles/profiles/common.nix b/modules/nixfiles/profiles/common.nix deleted file mode 100644 index 3f77da6..0000000 --- a/modules/nixfiles/profiles/common.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ - config, - lib, - pkgs, - this, - ... -}: -with lib; let - cfg = config.nixfiles.modules.profiles.common; -in { - imports = [ - (mkAliasOptionModule ["colourScheme"] [ - "nixfiles" - "modules" - "profiles" - "common" - "colourScheme" - ]) - ]; - - options.nixfiles.modules.profiles.common = { - enable = mkEnableOption "The most common profiles of all profiles."; - - colourScheme = let - mkColour = default: - mkOption { - type = types.str; - inherit default; - description = "Color in a standard hexademical notation."; - example = "#000000"; - }; - in rec { - black = mkColour "#161719"; - red = mkColour "#cc6666"; - green = mkColour "#b5bd68"; - yellow = mkColour "#f0c674"; - blue = mkColour "#81a2be"; - magenta = mkColour "#b294bb"; - cyan = mkColour "#8abeb7"; - white = mkColour "#c5c8c6"; - - brightBlack = mkColour "#969896"; - brightRed = mkColour "#cc6666"; - brightGreen = mkColour "#b5bd68"; - brightYellow = mkColour "#f0c674"; - brightBlue = mkColour "#81a2be"; - brightMagenta = mkColour "#b294bb"; - brightCyan = mkColour "#8abeb7"; - brightWhite = mkColour "#ffffff"; - - background = black; - foreground = white; - }; - }; - - config = mkIf cfg.enable { - assertions = [ - { - assertion = !(with this; isHeadless && isHeadful); - message = '' - The configuration cannot be both "headful" and "headless" at the same - time. - ''; - } - ]; - - profile = with this; { - headless = isHeadless; - headful = isHeadful; - }; - - nixfiles.modules = { - htop.enable = true; - tmux.enable = true; - vim.enable = true; - }; - - home-manager.users.root.home.file.".bash_history".source = - config.hm.lib.file.mkOutOfStoreSymlink "/dev/null"; - - hm.home.language = { - collate = "C"; - messages = "C"; - }; - - programs.less = { - enable = true; - envVariables.LESSHISTFILE = "-"; - }; - - environment.systemPackages = with pkgs; [ - cryptsetup - ddrescue - file - git - gnupg - lshw - lsof - pciutils - psmisc - tree - usbutils - util-linux - ]; - }; -} diff --git a/modules/nixfiles/profiles/default.nix b/modules/nixfiles/profiles/default.nix index 3df88f8..c236722 100644 --- a/modules/nixfiles/profiles/default.nix +++ b/modules/nixfiles/profiles/default.nix @@ -1,5 +1,108 @@ -{lib, ...}: { - imports = [./common.nix ./dev ./headful.nix ./headless.nix]; +{ + config, + lib, + pkgs, + this, + ... +}: +with lib; let + cfg = config.nixfiles.modules.profiles.default; +in { + imports = [ + ./dev + ./headful.nix + ./headless.nix + (mkAliasOptionModule ["colourScheme"] [ + "nixfiles" + "modules" + "profiles" + "default" + "colourScheme" + ]) + ]; - config.nixfiles.modules.profiles.common.enable = lib.mkDefault true; + options.nixfiles.modules.profiles.default = { + enable = + mkEnableOption "The most default profile of them all." + // { + default = true; + }; + + colourScheme = let + mkColour = default: + mkOption { + type = types.str; + inherit default; + description = "Colour in a standard hexadecimal notation."; + example = "#000000"; + }; + in rec { + black = mkColour "#161719"; + red = mkColour "#cc6666"; + green = mkColour "#b5bd68"; + yellow = mkColour "#f0c674"; + blue = mkColour "#81a2be"; + magenta = mkColour "#b294bb"; + cyan = mkColour "#8abeb7"; + white = mkColour "#c5c8c6"; + + brightBlack = mkColour "#969896"; + brightRed = mkColour "#cc6666"; + brightGreen = mkColour "#b5bd68"; + brightYellow = mkColour "#f0c674"; + brightBlue = mkColour "#81a2be"; + brightMagenta = mkColour "#b294bb"; + brightCyan = mkColour "#8abeb7"; + brightWhite = mkColour "#ffffff"; + + background = black; + foreground = white; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + { + assertion = !(with this; isHeadless && isHeadful); + message = '' + The configuration cannot be both "headful" and "headless" at the same + time. + ''; + } + ]; + + nixfiles.modules = { + htop.enable = true; + tmux.enable = true; + vim.enable = true; + }; + + home-manager.users.root.home.file.".bash_history".source = + config.hm.lib.file.mkOutOfStoreSymlink "/dev/null"; + + hm.home.language = { + collate = "C"; + messages = "C"; + }; + + programs.less = { + enable = true; + envVariables.LESSHISTFILE = "-"; + }; + + environment.systemPackages = with pkgs; [ + cryptsetup + ddrescue + file + git + gnupg + lshw + lsof + pciutils + psmisc + tree + usbutils + util-linux + ]; + }; } diff --git a/modules/nixfiles/profiles/dev/common.nix b/modules/nixfiles/profiles/dev/common.nix deleted file mode 100644 index 497a573..0000000 --- a/modules/nixfiles/profiles/dev/common.nix +++ /dev/null @@ -1,267 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.nixfiles.modules.profiles.dev.common; -in { - options.nixfiles.modules.profiles.dev.common.enable = mkEnableOption ""; - - config = mkIf cfg.enable { - nixfiles.modules = { - bat.enable = true; - curl.enable = true; - direnv.enable = true; - git.enable = true; - gnupg.enable = true; - nmap.enable = true; - wget.enable = true; - }; - - hm.home = { - file = { - ".editorconfig".text = '' - root = true - - [*] - charset = utf-8 - end_of_line = lf - indent_size = 4 - indent_style = space - insert_final_newline = true - max_line_length = 80 - trim_trailing_whitespace = true - - [*.nix] - indent_size = 2 - indent_style = space - - [*.{S,s,asm}] - indent_size = 4 - indent_style = tab - - [*.{C,H,c,c++,cc,cpp,cxx,h,h++,hh,hpp,hxx}] - indent_size = 4 - indent_style = tab - - [*.{cl,clj,el,l,lisp,lsp,rkt,scm,ss}] - indent_size = 2 - indent_style = space - - [*.go] - indent_size = 4 - indent_style = tab - - [*.{py,pyx}] - indent_size = 4 - indent_style = space - - [*.{hs,lhs}] - indent_size = 2 - indent_style = space - - [*.{html,xhtml,xml}] - indent_size = 4 - indent_style = tab - - [*.json] - indent_size = 2 - indent_style = space - - [*.{yaml,yml}] - indent_size = 2 - indent_style = space - - [*.{toml,tml}] - indent_size = 4 - indent_style = space - - [*.{py,pyx}] - indent_size = 4 - indent_style = space - max_line_length = 72 - - [*.zig] - indent_size = 4 - indent_style = tab - - [configure.ac] - indent_size = 4 - indent_style = tab - - [{Makefile*,*.mk}] - indent_size = 4 - indent_style = tab - - [{CMakeLists.txt,*.cmake}] - indent_size = 8 - indent_style = tab - - [*.tex] - indent_size = 4 - indent_style = tab - - [*.{md,adoc,rtf,txt}] - indent_size = 4 - indent_style = tab - ''; - - ".ghc/ghci.conf".source = ./ghci.conf; - - "${config.dirs.data}/stack/config.yaml".text = generators.toYAML {} { - templates.params = rec { - author-name = my.fullname; - author-email = my.email; - copyright = "Copyright (c) ${author-name} <${author-email}>"; - github-username = my.username; - }; - }; - - ".clang-format".text = generators.toYAML {} { - AccessModifierOffset = -4; - AlignAfterOpenBracket = "Align"; - AlignConsecutiveAssignments = "Consecutive"; - AlignConsecutiveBitFields = "Consecutive"; - AlignConsecutiveDeclarations = "Consecutive"; - AlignConsecutiveMacros = "Consecutive"; - AlignEscapedNewlines = "Right"; - AlignOperands = "Align"; - AlignTrailingComments = false; - AllowAllArgumentsOnNextLine = false; - AllowAllConstructorInitializersOnNextLine = true; - AllowAllParametersOfDeclarationOnNextLine = true; - AllowShortBlocksOnASingleLine = "Never"; - AllowShortCaseLabelsOnASingleLine = false; - AllowShortEnumsOnASingleLine = false; - AllowShortFunctionsOnASingleLine = "None"; - AllowShortIfStatementsOnASingleLine = "Never"; - AllowShortLambdasOnASingleLine = "Inline"; - AllowShortLoopsOnASingleLine = false; - AlwaysBreakAfterDefinitionReturnType = "All"; - AlwaysBreakAfterReturnType = "AllDefinitions"; - AlwaysBreakBeforeMultilineStrings = false; - AlwaysBreakTemplateDeclarations = "Yes"; - BinPackArguments = false; - BinPackParameters = false; - BreakBeforeBinaryOperators = "None"; - BreakBeforeBraces = "Allman"; - BreakBeforeTernaryOperators = true; - BreakConstructorInitializers = "BeforeComma"; - BreakInheritanceList = "BeforeComma"; - BreakStringLiterals = true; - ColumnLimit = 80; - CommentPragmas = "^ IWYU pragma:"; - CompactNamespaces = false; - ConstructorInitializerAllOnOneLineOrOnePerLine = false; - ConstructorInitializerIndentWidth = 4; - ContinuationIndentWidth = 4; - Cpp11BracedListStyle = true; - DeriveLineEnding = false; - DerivePointerAlignment = false; - DisableFormat = false; - ExperimentalAutoDetectBinPacking = false; - FixNamespaceComments = true; - IncludeBlocks = "Regroup"; - IndentCaseBlocks = false; - IndentCaseLabels = false; - IndentExternBlock = "NoIndent"; - IndentGotoLabels = false; - IndentPPDirectives = "None"; - IndentWidth = 4; - IndentWrappedFunctionNames = false; - KeepEmptyLinesAtTheStartOfBlocks = false; - Language = "Cpp"; - MaxEmptyLinesToKeep = 1; - NamespaceIndentation = "None"; - PointerAlignment = "Left"; - ReflowComments = false; - SortIncludes = "CaseSensitive"; - SortUsingDeclarations = true; - SpaceAfterCStyleCast = false; - SpaceAfterLogicalNot = false; - SpaceAfterTemplateKeyword = true; - SpaceBeforeAssignmentOperators = true; - SpaceBeforeCpp11BracedList = false; - SpaceBeforeCtorInitializerColon = true; - SpaceBeforeInheritanceColon = true; - SpaceBeforeParens = "ControlStatements"; - SpaceBeforeRangeBasedForLoopColon = true; - SpaceInEmptyParentheses = false; - SpacesBeforeTrailingComments = 1; - SpacesInAngles = false; - SpacesInCStyleCastParentheses = false; - SpacesInContainerLiterals = false; - SpacesInParentheses = false; - SpacesInSquareBrackets = false; - Standard = "Latest"; - TabWidth = 4; - UseTab = "Always"; - }; - - ".gdbinit".text = '' - set confirm off - set verbose off - set editing off - - set history expansion on - - set height 0 - set width 0 - - handle SIGALRM nostop print nopass - handle SIGBUS stop print nopass - handle SIGPIPE nostop print nopass - handle SIGSEGV stop print nopass - - set print address on - set print elements 0 - set print object on - set print pretty on - set print repeats 0 - set print static-members on - set print vtbl on - - set output-radix 10 - - set demangle-style gnu-v3 - - set disassembly-flavor intel - - alias iv=info variables - - alias da=disassemble - - define fs - finish - step - end - - define btc - backtrace - continue - end - ''; - }; - - sessionVariables = with config.dirs; { - ANDROID_HOME = "${data}/android"; - CABAL_CONFIG = "${data}/cabal/config"; - CABAL_DIR = "${data}/cabal"; - CARGO_HOME = "${data}/cargo"; - GOPATH = "${data}/go"; - PYTHONSTARTUP = ./pystartup.py; - STACK_ROOT = "${data}/stack"; - }; - - packages = with pkgs; [ - htmlq - jq - yq - ]; - }; - - my.extraGroups = ["kvm"]; - }; -} diff --git a/modules/nixfiles/profiles/dev/containers/default.nix b/modules/nixfiles/profiles/dev/containers.nix index c03a30c..c9e82d7 100644 --- a/modules/nixfiles/profiles/dev/containers/default.nix +++ b/modules/nixfiles/profiles/dev/containers.nix @@ -8,13 +8,13 @@ with lib; let cfg = config.nixfiles.modules.profiles.dev.containers; in { options.nixfiles.modules.profiles.dev.containers.enable = - mkEnableOption "Wether to enable tools for working with Kubernetes."; + mkEnableOption "Tools for working with containers and container orchestration" + // { + default = config.nixfiles.modules.profiles.dev.default.enable; + }; config = mkIf cfg.enable { - nixfiles.modules = { - profiles.dev.common.enable = true; - podman.enable = true; - }; + nixfiles.modules.podman.enable = true; hm = let minikubeHome = "${config.dirs.data}/minikube"; diff --git a/modules/nixfiles/profiles/dev/default.nix b/modules/nixfiles/profiles/dev/default.nix index 1e0bd01..14c0730 100644 --- a/modules/nixfiles/profiles/dev/default.nix +++ b/modules/nixfiles/profiles/dev/default.nix @@ -1 +1,273 @@ -_: {imports = [./common.nix ./containers ./sql];} +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.profiles.dev.default; +in { + imports = [ + ./containers.nix + ./sql.nix + ]; + + options.nixfiles.modules.profiles.dev.default.enable = + mkEnableOption "Catch-all profile for stuff related to software development and etc."; + + config = mkIf cfg.enable { + nixfiles.modules = { + bat.enable = true; + curl.enable = true; + direnv.enable = true; + git.enable = true; + gnupg.enable = true; + nmap.enable = true; + wget.enable = true; + }; + + hm.home = { + file = { + ".editorconfig".text = '' + root = true + + [*] + charset = utf-8 + end_of_line = lf + indent_size = 4 + indent_style = space + insert_final_newline = true + max_line_length = 80 + trim_trailing_whitespace = true + + [*.nix] + indent_size = 2 + indent_style = space + + [*.{S,s,asm}] + indent_size = 4 + indent_style = tab + + [*.{C,H,c,c++,cc,cpp,cxx,h,h++,hh,hpp,hxx}] + indent_size = 4 + indent_style = tab + + [*.{cl,clj,el,l,lisp,lsp,rkt,scm,ss}] + indent_size = 2 + indent_style = space + + [*.go] + indent_size = 4 + indent_style = tab + + [*.{py,pyx}] + indent_size = 4 + indent_style = space + + [*.{hs,lhs}] + indent_size = 2 + indent_style = space + + [*.{html,xhtml,xml}] + indent_size = 4 + indent_style = tab + + [*.json] + indent_size = 2 + indent_style = space + + [*.{yaml,yml}] + indent_size = 2 + indent_style = space + + [*.{toml,tml}] + indent_size = 4 + indent_style = space + + [*.{py,pyx}] + indent_size = 4 + indent_style = space + max_line_length = 72 + + [*.zig] + indent_size = 4 + indent_style = tab + + [configure.ac] + indent_size = 4 + indent_style = tab + + [{Makefile*,*.mk}] + indent_size = 4 + indent_style = tab + + [{CMakeLists.txt,*.cmake}] + indent_size = 8 + indent_style = tab + + [*.tex] + indent_size = 4 + indent_style = tab + + [*.{md,adoc,rtf,txt}] + indent_size = 4 + indent_style = tab + ''; + + ".ghc/ghci.conf".source = ./ghci.conf; + + "${config.dirs.data}/stack/config.yaml".text = generators.toYAML {} { + templates.params = rec { + author-name = my.fullname; + author-email = my.email; + copyright = "Copyright (c) ${author-name} <${author-email}>"; + github-username = my.username; + }; + }; + + ".clang-format".text = generators.toYAML {} { + AccessModifierOffset = -4; + AlignAfterOpenBracket = "Align"; + AlignConsecutiveAssignments = "Consecutive"; + AlignConsecutiveBitFields = "Consecutive"; + AlignConsecutiveDeclarations = "Consecutive"; + AlignConsecutiveMacros = "Consecutive"; + AlignEscapedNewlines = "Right"; + AlignOperands = "Align"; + AlignTrailingComments = false; + AllowAllArgumentsOnNextLine = false; + AllowAllConstructorInitializersOnNextLine = true; + AllowAllParametersOfDeclarationOnNextLine = true; + AllowShortBlocksOnASingleLine = "Never"; + AllowShortCaseLabelsOnASingleLine = false; + AllowShortEnumsOnASingleLine = false; + AllowShortFunctionsOnASingleLine = "None"; + AllowShortIfStatementsOnASingleLine = "Never"; + AllowShortLambdasOnASingleLine = "Inline"; + AllowShortLoopsOnASingleLine = false; + AlwaysBreakAfterDefinitionReturnType = "All"; + AlwaysBreakAfterReturnType = "AllDefinitions"; + AlwaysBreakBeforeMultilineStrings = false; + AlwaysBreakTemplateDeclarations = "Yes"; + BinPackArguments = false; + BinPackParameters = false; + BreakBeforeBinaryOperators = "None"; + BreakBeforeBraces = "Allman"; + BreakBeforeTernaryOperators = true; + BreakConstructorInitializers = "BeforeComma"; + BreakInheritanceList = "BeforeComma"; + BreakStringLiterals = true; + ColumnLimit = 80; + CommentPragmas = "^ IWYU pragma:"; + CompactNamespaces = false; + ConstructorInitializerAllOnOneLineOrOnePerLine = false; + ConstructorInitializerIndentWidth = 4; + ContinuationIndentWidth = 4; + Cpp11BracedListStyle = true; + DeriveLineEnding = false; + DerivePointerAlignment = false; + DisableFormat = false; + ExperimentalAutoDetectBinPacking = false; + FixNamespaceComments = true; + IncludeBlocks = "Regroup"; + IndentCaseBlocks = false; + IndentCaseLabels = false; + IndentExternBlock = "NoIndent"; + IndentGotoLabels = false; + IndentPPDirectives = "None"; + IndentWidth = 4; + IndentWrappedFunctionNames = false; + KeepEmptyLinesAtTheStartOfBlocks = false; + Language = "Cpp"; + MaxEmptyLinesToKeep = 1; + NamespaceIndentation = "None"; + PointerAlignment = "Left"; + ReflowComments = false; + SortIncludes = "CaseSensitive"; + SortUsingDeclarations = true; + SpaceAfterCStyleCast = false; + SpaceAfterLogicalNot = false; + SpaceAfterTemplateKeyword = true; + SpaceBeforeAssignmentOperators = true; + SpaceBeforeCpp11BracedList = false; + SpaceBeforeCtorInitializerColon = true; + SpaceBeforeInheritanceColon = true; + SpaceBeforeParens = "ControlStatements"; + SpaceBeforeRangeBasedForLoopColon = true; + SpaceInEmptyParentheses = false; + SpacesBeforeTrailingComments = 1; + SpacesInAngles = false; + SpacesInCStyleCastParentheses = false; + SpacesInContainerLiterals = false; + SpacesInParentheses = false; + SpacesInSquareBrackets = false; + Standard = "Latest"; + TabWidth = 4; + UseTab = "Always"; + }; + + ".gdbinit".text = '' + set confirm off + set verbose off + set editing off + + set history expansion on + + set height 0 + set width 0 + + handle SIGALRM nostop print nopass + handle SIGBUS stop print nopass + handle SIGPIPE nostop print nopass + handle SIGSEGV stop print nopass + + set print address on + set print elements 0 + set print object on + set print pretty on + set print repeats 0 + set print static-members on + set print vtbl on + + set output-radix 10 + + set demangle-style gnu-v3 + + set disassembly-flavor intel + + alias iv=info variables + + alias da=disassemble + + define fs + finish + step + end + + define btc + backtrace + continue + end + ''; + }; + + sessionVariables = with config.dirs; { + ANDROID_HOME = "${data}/android"; + CABAL_CONFIG = "${data}/cabal/config"; + CABAL_DIR = "${data}/cabal"; + CARGO_HOME = "${data}/cargo"; + GOPATH = "${data}/go"; + PYTHONSTARTUP = ./pystartup.py; + STACK_ROOT = "${data}/stack"; + }; + + packages = with pkgs; [ + htmlq + jq + yq + ]; + }; + + my.extraGroups = ["kvm"]; + }; +} diff --git a/modules/nixfiles/profiles/dev/sql/default.nix b/modules/nixfiles/profiles/dev/sql.nix index e448e08..d6bcba8 100644 --- a/modules/nixfiles/profiles/dev/sql/default.nix +++ b/modules/nixfiles/profiles/dev/sql.nix @@ -8,7 +8,10 @@ with lib; let cfg = config.nixfiles.modules.profiles.dev.sql; in { options.nixfiles.modules.profiles.dev.sql.enable = - mkEnableOption "SQL database management tools"; + mkEnableOption "SQL stuff and database management tools" + // { + default = config.nixfiles.modules.profiles.dev.default.enable; + }; config = mkIf cfg.enable { hm = { @@ -27,7 +30,7 @@ in { table_format = "fancy_grid"; }; - colorsSection = with config.nixfiles.modules.profiles.common.colourScheme; { + colorsSection = with config.colourScheme; { "arg-toolbar" = "noinherit bold"; "arg-toolbar.text" = "nobold"; "bottom-toolbar" = "bg:${black} ${white}"; diff --git a/modules/nixfiles/profiles/headful.nix b/modules/nixfiles/profiles/headful.nix index 94c0d28..f4d3dc9 100644 --- a/modules/nixfiles/profiles/headful.nix +++ b/modules/nixfiles/profiles/headful.nix @@ -2,26 +2,19 @@ config, lib, pkgs, + this, ... }: with lib; let cfg = config.nixfiles.modules.profiles.headful; in { - imports = [ - (mkAliasOptionModule ["profile" "headful"] [ - "nixfiles" - "modules" - "profiles" - "headful" - "enable" - ]) - ]; - options.nixfiles.modules.profiles.headful.enable = - mkEnableOption "headful profile"; + mkEnableOption "headful profile" // {default = this.isHeadful;}; config = mkIf cfg.enable { nixfiles.modules = { + profiles.dev.default.enable = true; + alacritty.enable = true; aria2.enable = true; chromium.enable = true; diff --git a/modules/nixfiles/profiles/headless.nix b/modules/nixfiles/profiles/headless.nix index b3c5c86..6ac91c1 100644 --- a/modules/nixfiles/profiles/headless.nix +++ b/modules/nixfiles/profiles/headless.nix @@ -2,23 +2,14 @@ config, lib, pkgs, + this, ... }: with lib; let cfg = config.nixfiles.modules.profiles.headless; in { - imports = [ - (mkAliasOptionModule ["profile" "headless"] [ - "nixfiles" - "modules" - "profiles" - "headless" - "enable" - ]) - ]; - options.nixfiles.modules.profiles.headless.enable = - mkEnableOption "headless profile"; + mkEnableOption "headless profile" // {default = this.isHeadless;}; config = mkIf cfg.enable { nixfiles.modules = { diff --git a/modules/nixfiles/x11.nix b/modules/nixfiles/x11.nix index 03c11cb..cd8dfbe 100644 --- a/modules/nixfiles/x11.nix +++ b/modules/nixfiles/x11.nix @@ -20,7 +20,7 @@ in { xsession.scriptPath = ".xinitrc"; - xresources.properties = with config.nixfiles.modules; + xresources.properties = (let font = with config.fontScheme.monospaceFont; "${family}:style=${style}:size=${toString size}"; in { @@ -34,7 +34,7 @@ in { "Xft.lcdfilter" = "lcddefault"; "Xft.rgba" = "rgb"; }) - // (with profiles.common.colourScheme; { + // (with config.colourScheme; { "*.color0" = black; "*.color8" = brightBlack; "*.color1" = red; diff --git a/modules/nixfiles/zathura.nix b/modules/nixfiles/zathura.nix index fd38ab0..03a8311 100644 --- a/modules/nixfiles/zathura.nix +++ b/modules/nixfiles/zathura.nix @@ -14,7 +14,7 @@ in { enable = true; options = - (with profiles.common.colourScheme; { + (with config.colourScheme; { default-fg = white; default-bg = black; @@ -55,7 +55,7 @@ in { highlight-transparency = "0.3"; - font = fonts.fontScheme.monospaceFont.family; + font = config.fontScheme.monospaceFont.family; n-completion-items = 10; @@ -112,7 +112,7 @@ in { scroll-wrap = true; scroll-page-aware = false; - selection-clipboard = + selection-clipboard = with config.nixfiles.modules; if (kde.enable || gnome.enable) then "clipboard" else "primary"; diff --git a/packages/ultimmc.nix b/packages/ultimmc.nix deleted file mode 100644 index 0259a7a..0000000 --- a/packages/ultimmc.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - cmake, - fetchFromGitHub, - jdk, - makeDesktopItem, - ninja, - qtbase, - stdenv, - wrapQtAppsHook, - zlib, -}: -stdenv.mkDerivation rec { - pname = "UltimMC"; - version = "git"; - - src = fetchFromGitHub { - owner = "UltimMC"; - repo = "Launcher"; - rev = "a522ec3ad4602de1f457a25bce98ef912a29d7d6"; - fetchSubmodules = true; - hash = "sha256-+UgBblyEx0cKH8UMBOPtjhQLv2YUKj91UokQWKCEPbY="; - }; - - nativeBuildInputs = [cmake jdk ninja wrapQtAppsHook]; - - buildInputs = [qtbase zlib]; - - postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace 'LIBRARY_DEST_DIR "bin"' 'LIBRARY_DEST_DIR "lib"' \ - --replace 'JARS_DEST_DIR "bin/jars"' 'JARS_DEST_DIR "share/${pname}/jar"' - - substituteInPlace launcher/Application.cpp \ - --replace '"jars"' '"../share/${pname}/jar"'; - ''; - - desktopItem = makeDesktopItem { - name = pname; - exec = pname; - icon = pname; - desktopName = pname; - genericName = "Custom Minecraft launcher"; - categories = ["Game"]; - }; - - dontWrapQtApps = true; - - postInstall = '' - rm $out/${pname} - - install -Dm644 \ - ${desktopItem}/share/applications/${pname}.desktop \ - $out/share/applications/${pname}.desktop - install -Dm644 \ - $src/notsecrets/logo.svg \ - $out/share/icons/hicolor/scalable/apps/${pname}.svg - ''; - - postFixup = '' - wrapProgram $out/bin/${pname} \ - --add-flags "--dir \''${XDG_DATA_HOME:-~/.local/share}/${pname}" \ - "''${qtWrapperArgs[@]}" - ''; -} |