diff options
Diffstat (limited to 'modules/nixfiles/profiles')
-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 |
8 files changed, 395 insertions, 406 deletions
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 = { |