diff options
30 files changed, 461 insertions, 453 deletions
diff --git a/checks.nix b/checks.nix index 2d60a1c..b169cb3 100644 --- a/checks.nix +++ b/checks.nix @@ -1,7 +1,7 @@ { - system, inputs, lib, + system, }: let pkgs = inputs.self.legacyPackages.${system}; in { diff --git a/flake.lock b/flake.lock index ba36087..6edfe51 100644 --- a/flake.lock +++ b/flake.lock @@ -147,11 +147,11 @@ ] }, "locked": { - "lastModified": 1699569089, - "narHash": "sha256-MdOnyXrmMdVU9o7GpcbWKgehoK9L76ihp8rTikPcC1k=", + "lastModified": 1699867978, + "narHash": "sha256-+arl45HUOcBdKiRGrKXZYXDyBQ6MQGkYPZa/28f6Yzo=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "c8f385766ba076a096caa794309c40f89894d88a", + "rev": "e67f2bf515343da378c3f82f098df8ca01bccc5f", "type": "github" }, "original": { @@ -266,11 +266,11 @@ ] }, "locked": { - "lastModified": 1699368917, - "narHash": "sha256-nUtGIWf86BOkUbtksWtfglvCZ/otP0FTZlQH8Rzc7PA=", + "lastModified": 1699783872, + "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", "owner": "nix-community", "repo": "home-manager", - "rev": "6a8444467c83c961e2f5ff64fb4f422e303c98d3", + "rev": "280721186ab75a76537713ec310306f0eba3e407", "type": "github" }, "original": { @@ -309,11 +309,11 @@ ] }, "locked": { - "lastModified": 1699492773, - "narHash": "sha256-VsW4ZMGC/9LMs1iv3jVPjtbyKZ7sUejp6tpXILBXVWI=", + "lastModified": 1699924656, + "narHash": "sha256-w1L/6pxu2wWSQD/mB8JNUi/BOwDwmg5C30k7bFK1kt0=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "7be0b495e1413fdac957b1f223430190a4d27f81", + "rev": "218d8a6c07f0cb9fa26cc66f369bbf62ca3a6872", "type": "github" }, "original": { @@ -336,11 +336,11 @@ ] }, "locked": { - "lastModified": 1699579295, - "narHash": "sha256-W1HsyOFLmyWw46e+cuAIazQTD6g6dgxLMIIuaBoJzF8=", + "lastModified": 1700011274, + "narHash": "sha256-NtZqLNEjgaCGowT2+HEeOoZsXqVSAZMA/vk2t0jikN0=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "5d33996d98e9ff45a73a6f9ed293d548f6c14a39", + "rev": "a8c236477b4251ba739463de7e863a07b124fdd3", "type": "github" }, "original": { @@ -352,11 +352,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1699159446, - "narHash": "sha256-cL63IjsbPl2otS7R4kdXbVOJOXYMpGw5KGZoWgdCuCM=", + "lastModified": 1699997707, + "narHash": "sha256-ugb+1TGoOqqiy3axyEZpfF6T4DQUGjfWZ3Htry1EfvI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "627bc9b88256379578885a7028c9e791c29fb581", + "rev": "5689f3ebf899f644a1aabe8774d4f37eb2f6c2f9", "type": "github" }, "original": { @@ -368,11 +368,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1699343069, - "narHash": "sha256-s7BBhyLA6MI6FuJgs4F/SgpntHBzz40/qV0xLPW6A1Q=", + "lastModified": 1700014976, + "narHash": "sha256-dSGpS2YeJrXW5aH9y7Abd235gGufY3RuZFth6vuyVtU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ec750fd01963ab6b20ee1f0cb488754e8036d89d", + "rev": "592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3", "type": "github" }, "original": { @@ -384,11 +384,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1699654502, - "narHash": "sha256-1IskzzUp5G7k76GjPJp4u46l4jLQaBQA0pY4wvwJw98=", + "lastModified": 1700082562, + "narHash": "sha256-1sXJRzIECv/2xfxBNfwbDkE3nlm3KfS01BdCXXtXNxU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a27b0a663b7c4fcac7a6bbb92b6b7f21d85cd3c4", + "rev": "7a1d45811ea4420dea5b2818c9790a86c18c1170", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1699646590, - "narHash": "sha256-f81xS0qN6H1ULTyArpZgdjsly4FY0BnvPXdmSb7hq+o=", + "lastModified": 1700065082, + "narHash": "sha256-BdnIOPd39IW/mfha60I+xjqbGs2w/45KiqWeZJHI0sg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1d55765508b8316798429875712dc1ef5e62a2fa", + "rev": "48f92ae9de20777628d2a92d9d50fb4e2ab3d0f1", "type": "github" }, "original": { @@ -428,11 +428,11 @@ ] }, "locked": { - "lastModified": 1699308475, - "narHash": "sha256-sFHOFiE+GV1JkwDmHi0LLJLSRyggdIK1Yra02oj2eZg=", + "lastModified": 1700000610, + "narHash": "sha256-xvP14ulDdfx1MeBzIWreID3F3j0G4leAAeTC5yfE1h0=", "owner": "nix-community", "repo": "nixvim", - "rev": "6b93c8fa6db999320d53f13e0ebd555e33f86577", + "rev": "2fcbe50f4ba80e868bd55c7f3b40e2a55c8092d0", "type": "github" }, "original": { @@ -478,11 +478,11 @@ }, "nur": { "locked": { - "lastModified": 1699645538, - "narHash": "sha256-CKzsVfYM/9ccp0VDgzB91c33Ts8KSub7q5FWLNJouXk=", + "lastModified": 1700072577, + "narHash": "sha256-7jriJotHLpP/3jNoPW9Xc0mDKx2lOzOcLnwUfdpa51Y=", "owner": "nix-community", "repo": "NUR", - "rev": "9ffcf2dd6ac13cd0469a0ac2664296f45d879ffb", + "rev": "49a6f64d2b6dcba38a8fb2312315c13e3fe488f1", "type": "github" }, "original": { @@ -538,11 +538,11 @@ ] }, "locked": { - "lastModified": 1699271226, - "narHash": "sha256-8Jt1KW3xTjolD6c6OjJm9USx/jmL+VVmbooADCkdDfU=", + "lastModified": 1700064067, + "narHash": "sha256-1ZWNDzhu8UlVCK7+DUN9dVQfiHX1bv6OQP9VxstY/gs=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ea758da1a6dcde6dc36db348ed690d09b9864128", + "rev": "e558068cba67b23b4fbc5537173dbb43748a17e8", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 558ccfb..0a520e0 100644 --- a/flake.nix +++ b/flake.nix @@ -291,6 +291,6 @@ darwinModules.nixfiles = import ./modules/darwin; darwinConfigurations = import ./darwinConfigurations {inherit inputs lib;}; - overlays.default = final: prev: import ./overlays.nix final prev; + overlays.default = final: prev: import ./overlay.nix final prev; }; } diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix index c5cf7ed..b16fb83 100644 --- a/modules/common/emacs/default.nix +++ b/modules/common/emacs/default.nix @@ -58,36 +58,28 @@ in { text = concatLines [ ( let - # NOTE gopls will require the "go" executable which must be provided - # by the project's flake/shell. extraBins = with pkgs; [ (aspellWithDicts (p: with p; [en ru])) # :checkers (spell +aspell) - (python3.withPackages (p: - with p; [ - black # :lang python :editor format - isort # :lang python - pyflakes # :lang python - python-lsp-server # :lang (python +lsp) - ])) asmfmt # :editor format + cargo # :lang rust clang-tools # :lang (cc +lsp) :editor format - cmake # :term vterm cmake-format # :lang cc :editor format cmigemo # :lang japanese dockerfile-language-server-nodejs # :tools (docker +lsp) - dockfmt # :tools docker + dockfmt # :tools docker :editor format editorconfig-core-c # :tools editorconfig fd # doom! - gcc # :tools magit :term vterm - gnumake # :term vterm + ghc # :lang haskell gnuplot # :lang (org +gnuplot) gnutls # doom! - go # :lang go org + go # :lang go gocode # :lang go org + godef # :lang go gomodifytags # :lang go gopls # :lang (go +lsp) gore # :lang go + gotests # :lang go gotools # :lang go graphviz # :lang (org +roam2) :lang plantuml haskellPackages.cabal-fmt # :lang haskell :editor format @@ -95,10 +87,9 @@ in { haskellPackages.haskell-language-server # :lang (haskell +lsp) haskellPackages.hoogle # :lang haskell haskellPackages.ormolu # :lang haskell :editor format - html-tidy # :lang web + html-tidy # :lang web :editor format jre # :lang plantuml - libtool # :term vterm - libxml2 # :lang data + libxml2 # :lang data :editor format nil # :lang (nix +lsp) nodePackages.bash-language-server # :lang (sh +lsp) nodePackages.eslint # :lang (json +lsp) @@ -107,12 +98,22 @@ in { nodePackages.stylelint # :lang web nodejs # :tools debugger pandoc # :lang org markdown latex - perl # term vterm pinentry-emacs # doom! + pipenv # :lang python pre-commit # :tools magit + python3 # :lang python + python3Packages.black # :lang python :editor format + python3Packages.isort # :lang python :editor format + python3Packages.nose # :lang python + python3Packages.pyflakes # :lang python :editor format + python3Packages.pytest # :lang python + python3Packages.python-lsp-server # :lang python :editor format + racket # :lang racket :editor format ripgrep # doom! rust-analyzer # :lang (rust +lsp) + rustc # :lang rust rustfmt # :lang rust + sbcl # :lang common-lisp shellcheck # :lang sh shfmt # :lang sh :editor format sqlite # :lang (org +roam2) :tools lookup @@ -121,6 +122,7 @@ in { unzip # :tools debugger wordnet # :tools (lookup +dictionary +offline) yaml-language-server # :lang (yaml +lsp) + zig # :lang zig :editor format zls # :lang (zig +lsp) zstd # :emacs undo ] @@ -142,7 +144,7 @@ in { concatMapStringsSep ":" (x: "${x}/bin") extraBins }")) - (appendq! auth-sources '("${config.secrets.authinfo.path}")) + (appendq! auth-sources '(("${config.secrets.authinfo.path}"))) ;; The font must be set to n+2, otherwise it looks too small. (setq doom-font (font-spec @@ -165,7 +167,7 @@ in { (setq migemo-dictionary "${pkgs.cmigemo}/share/migemo/utf-8/migemo-dict") ;; :input japanese - ;; (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L") + (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L") ;; :lang nix (setq nix-nixfmt-bin "${pkgs.writeShellScript "nixfmt" '' @@ -210,7 +212,49 @@ in { programs.emacs = { enable = true; - package = pkgs.emacs29; # Pin to avoid surprises. + package = + (pkgs.emacs29.override (finalAttrs: { + stdenv = with pkgs; + useMoldLinker + (withCFlags ["-O2"] + (impureUseNativeOptimizations finalAttrs.stdenv)); + })) + .overrideAttrs (_: final: { + configureFlags = + final.configureFlags + ++ [ + "--without-mailutils" + "--without-pop" + ]; + }); + # TODO https://github.com/NixOS/nixpkgs/issues/267548 + # packageX = let + # emacs = "emacs29"; # Pin the version to avoid surprises. + # in + # (pkgs.${emacs}.pkgs.overrideScope + # (_: super: { + # emacs = + # (pkgs.${emacs}.override (finalAttrs: { + # stdenv = with pkgs; + # useMoldLinker + # (withCFlags ["-O2"] + # (impureUseNativeOptimizations finalAttrs.stdenv)); + # })) + # .overrideAttrs (_: final: { + # configureFlags = + # final.configureFlags + # ++ [ + # "--without-mailutils" + # "--without-pop" + # ]; + # }); + # })) + # .withPackages (p: + # with p; [ + # emacsql # :tools magit + # mu4e # :email mu4e + # vterm # :term vterm + # ]); }; }; }; diff --git a/modules/common/emacs/doom/config.el b/modules/common/emacs/doom/config.el index 7cecfba..257a3ea 100644 --- a/modules/common/emacs/doom/config.el +++ b/modules/common/emacs/doom/config.el @@ -29,7 +29,7 @@ (setq lsp-enable-suggest-server-download nil lsp-enable-file-watchers t - lsp-file-watch-threshold 2048 + lsp-file-watch-threshold 4096 lsp-modeline-code-actions-enable nil) ;; @@ -154,7 +154,7 @@ (setq elfeed-db-directory "~/.elfeed" elfeed-enclosure-default-dir (concat elfeed-db-directory "/enclosures") - rmh-elfeed-org-files (list (concat elfeed-db-directory "/index.org")) + rmh-elfeed-org-files '((concat elfeed-db-directory "/index.org")) elfeed-goodies/powerline-default-separator nil elfeed-goodies/entry-pane-size 0.75 elfeed-goodies/entry-pane-position 'bottom) @@ -213,16 +213,3 @@ (setq-local company-idle-delay 0.1)))) :init (setq hledger-input-buffer-height 20)) - -;; -;;; Kubernetes -;; - -(use-package! kubernetes - :defer t - :commands (kubernetes-overview) - :init (setq kubernetes-poll-frequency 3600 - kubernetes-redraw-frequency 3600)) - -(use-package! kubernetes-evil - :after kubernetes-overview) diff --git a/modules/common/emacs/doom/init.el b/modules/common/emacs/doom/init.el index 0acd008..3796fac 100644 --- a/modules/common/emacs/doom/init.el +++ b/modules/common/emacs/doom/init.el @@ -81,7 +81,7 @@ (dhall +lsp +tree-sitter) (emacs-lisp +lsp +tree-sitter) (go +lsp +tree-sitter) - (:if IS-LINUX (haskell +lsp +tree-sitter)) + (haskell +lsp +tree-sitter) (java +lsp +tree-sitter) (javascript +lsp +tree-sitter) (json +lsp +tree-sitter) @@ -92,9 +92,9 @@ (org +pandoc +roam2) plantuml (python +lsp +tree-sitter) - (:if IS-LINUX (racket +lsp +tree-sitter)) + (racket +lsp +tree-sitter) (rust +lsp +tree-sitter) - (:if IS-LINUX (scheme +lsp +tree-sitter +racket)) + (scheme +lsp +tree-sitter +racket) (sh +lsp +tree-sitter) web (yaml +lsp +tree-sitter) diff --git a/modules/common/emacs/doom/packages.el b/modules/common/emacs/doom/packages.el index 61ac680..26a1d31 100644 --- a/modules/common/emacs/doom/packages.el +++ b/modules/common/emacs/doom/packages.el @@ -10,6 +10,3 @@ :branch "main")) (package! hledger-mode) - -(package! kubernetes) -(package! kubernetes-evil) diff --git a/modules/common/profiles/dev/containers.nix b/modules/common/profiles/dev/containers.nix index 61a9f09..38852ad 100644 --- a/modules/common/profiles/dev/containers.nix +++ b/modules/common/profiles/dev/containers.nix @@ -44,7 +44,6 @@ in { kubelogin-oidc kubent kubernetes-helm - # kubescape kubeseal kubespy minikube @@ -57,7 +56,7 @@ in { }; programs.bash = { - shellAliases = with pkgs; { + shellAliases = { b = "buildah"; h = "helm"; k = "kubectl"; diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix index 4f2a80f..4c52961 100644 --- a/modules/common/profiles/dev/default.nix +++ b/modules/common/profiles/dev/default.nix @@ -45,11 +45,11 @@ in { ".stack/global-project/stack.yaml".text = generators.toYAML {} { packages = []; - resolver = "lts-20.14"; + resolver = "lts-21.20"; }; }; - sessionVariables = with config.dirs; rec { + sessionVariables = rec { CABAL_DIR = "${config.my.home}/.cabal"; CABAL_CONFIG = pkgs.writeText "cabal-config" '' repository hackage.haskell.org @@ -87,6 +87,8 @@ in { yq htmlq sops + httpie + logcli ]; }; }; diff --git a/modules/common/profiles/dev/sql.nix b/modules/common/profiles/dev/sql.nix index 7a2a09c..6a32a76 100644 --- a/modules/common/profiles/dev/sql.nix +++ b/modules/common/profiles/dev/sql.nix @@ -73,25 +73,25 @@ in { { name = "pgcli"; custom = { + prompt = "'\\u@\\h:\\d> '"; + multi_line_mode = "psql"; + on_error = "STOP"; auto_expand = "True"; - casing_file = "/dev/null"; expand = "True"; - history_file = "/dev/null"; keyring = "False"; - multi_line_mode = "psql"; - on_error = "STOP"; - prompt = "'\\u@\\h:\\d> '"; vi = "True"; + casing_file = "/dev/null"; + history_file = "/dev/null"; }; } { name = "litecli"; custom = { - audit_log = "/dev/null"; - key_bindings = "vi"; prompt = "'\\d> '"; prompt_continuation = "'-> '"; auto_vertical_output = "True"; + key_bindings = "vi"; + audit_log = "/dev/null"; }; } ]); diff --git a/modules/darwin/common/networking.nix b/modules/darwin/common/networking.nix index 6c503bc..2843bc4 100644 --- a/modules/darwin/common/networking.nix +++ b/modules/darwin/common/networking.nix @@ -1,6 +1,6 @@ { - this, localHostname ? this.hostname, + this, ... }: { networking = { diff --git a/modules/darwin/common/nix.nix b/modules/darwin/common/nix.nix index 08379f8..0d216aa 100644 --- a/modules/darwin/common/nix.nix +++ b/modules/darwin/common/nix.nix @@ -1,31 +1,9 @@ { - config, - inputs, lib, this, ... }: with lib; { - _module.args = let - importNixpkgsx86 = nixpkgs: - import nixpkgs { - inherit (config.nixpkgs) config; - system = "x86_64-darwin"; - }; - in rec { - pkgsx86 = importNixpkgsx86 inputs.nixpkgs; - pkgsLocalx86 = importNixpkgsx86 "${config.my.home}/src/nixpkgs"; # Impure! - pkgsMasterx86 = importNixpkgsx86 inputs.nixpkgs-master; - pkgsStablex86 = importNixpkgsx86 inputs.nixpkgs-stable; - pkgsRevx86 = rev: hash: - importNixpkgsx86 (pkgs.fetchFromGitHub { - owner = "NixOS"; - repo = "nixpkgs"; - inherit rev hash; - }); - pkgsPrx86 = pr: pkgsRevx86 "refs/pull/${toString pr}/head"; - }; - nix = { daemonIOLowPriority = false; daemonProcessType = "Standard"; diff --git a/modules/nixos/git/default.nix b/modules/nixos/git/default.nix index 67cc07b..cbe14bd 100644 --- a/modules/nixos/git/default.nix +++ b/modules/nixos/git/default.nix @@ -1,8 +1,8 @@ { config, + lib, libNginx, libPlausible, - lib, pkgs, ... }: diff --git a/modules/nixos/grafana.nix b/modules/nixos/grafana.nix index ae79d17..ddf7f67 100644 --- a/modules/nixos/grafana.nix +++ b/modules/nixos/grafana.nix @@ -1,8 +1,8 @@ { config, - libNginx, inputs, lib, + libNginx, ... }: with lib; let diff --git a/modules/nixos/ipfs.nix b/modules/nixos/ipfs.nix index bf93a3c..99ce6c9 100644 --- a/modules/nixos/ipfs.nix +++ b/modules/nixos/ipfs.nix @@ -1,7 +1,7 @@ { config, - libNginx, lib, + libNginx, this, ... }: diff --git a/modules/nixos/loki.nix b/modules/nixos/loki.nix index c5194e1..c213832 100644 --- a/modules/nixos/loki.nix +++ b/modules/nixos/loki.nix @@ -1,7 +1,7 @@ { config, - libNginx, lib, + libNginx, pkgs, ... }: diff --git a/modules/nixos/monitoring/default.nix b/modules/nixos/monitoring/default.nix index a09b7e7..57adf1c 100644 --- a/modules/nixos/monitoring/default.nix +++ b/modules/nixos/monitoring/default.nix @@ -6,223 +6,217 @@ }: with lib; let cfg = config.nixfiles.modules.monitoring; -in - { - options.nixfiles.modules.monitoring.enable = mkEnableOption '' - a glue to provision a monitoring stack - ''; +in { + options.nixfiles.modules.monitoring.enable = mkEnableOption '' + a glue to provision a monitoring stack + ''; - config = mkIf cfg.enable { - nixfiles.modules = { - alertmanager.enable = true; - grafana.enable = true; - loki.enable = true; - prometheus.enable = true; - }; + config = mkIf cfg.enable { + nixfiles.modules = { + alertmanager.enable = true; + grafana.enable = true; + loki.enable = true; + prometheus.enable = true; + }; - services = { - grafana = { - declarativePlugins = with pkgs.grafanaPlugins; [ - redis-app - redis-datasource - redis-explorer-app - ]; + services = { + grafana = { + declarativePlugins = with pkgs.grafanaPlugins; [ + redis-app + redis-datasource + redis-explorer-app + ]; - provision = { - enable = true; + provision = { + enable = true; - # https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources - datasources.settings.datasources = with config.nixfiles.modules; [ - { - name = "Alertmanager"; - type = "alertmanager"; - access = "proxy"; - jsonData.implementation = "prometheus"; - url = "https://${alertmanager.domain}"; - } - { - name = "Loki"; - type = "loki"; - access = "proxy"; - url = "https://${loki.domain}"; - isDefault = true; - } - { - name = "Prometheus"; - type = "prometheus"; - access = "proxy"; - url = "https://${prometheus.domain}"; - } - (mkIf config.nixfiles.modules.redis.enable { - name = "Redis"; - type = "redis-datasource"; - access = "proxy"; - url = with config.services.redis.servers.default; "redis://${bind}:${toString port}"; - jsonData.client = "standalone"; - }) - ]; - datasources.settings.deleteDatasources = [ - { - name = "PostgreSQL"; - orgId = 1; - } - ]; + # https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources + datasources.settings.datasources = with config.nixfiles.modules; [ + { + name = "Alertmanager"; + type = "alertmanager"; + access = "proxy"; + jsonData.implementation = "prometheus"; + url = "https://${alertmanager.domain}"; + } + { + name = "Loki"; + type = "loki"; + access = "proxy"; + url = "https://${loki.domain}"; + isDefault = true; + } + { + name = "Prometheus"; + type = "prometheus"; + access = "proxy"; + url = "https://${prometheus.domain}"; + } + (mkIf config.nixfiles.modules.redis.enable { + name = "Redis"; + type = "redis-datasource"; + access = "proxy"; + url = with config.services.redis.servers.default; "redis://${bind}:${toString port}"; + jsonData.client = "standalone"; + }) + ]; + datasources.settings.deleteDatasources = [ + { + name = "PostgreSQL"; + orgId = 1; + } + ]; - # https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards - dashboards.settings.providers = [ - { - name = "node"; - options.path = ./dashboards/node.json; - } - { - name = "ntfy"; - options.path = ./dashboards/ntfy.json; - } - { - name = "endlessh"; - options.path = ./dashboards/endlessh.json; - } - { - name = "unbound"; - options.path = ./dashboards/unbound.json; - } - { - name = "nginx"; - options.path = ./dashboards/nginx.json; - } - { - name = "postgersql"; - options.path = ./dashboards/postgresql.json; - } - { - name = "redis"; - options.path = ./dashboards/redis.json; - } - { - name = "redis-streaming"; - options.path = ./dashboards/redis-streaming.json; - } - ]; + # https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards + dashboards.settings.providers = [ + { + name = "node"; + options.path = ./dashboards/node.json; + } + { + name = "ntfy"; + options.path = ./dashboards/ntfy.json; + } + { + name = "endlessh"; + options.path = ./dashboards/endlessh.json; + } + { + name = "unbound"; + options.path = ./dashboards/unbound.json; + } + { + name = "nginx"; + options.path = ./dashboards/nginx.json; + } + { + name = "postgersql"; + options.path = ./dashboards/postgresql.json; + } + { + name = "redis"; + options.path = ./dashboards/redis.json; + } + { + name = "redis-streaming"; + options.path = ./dashboards/redis-streaming.json; + } + ]; - # https://grafana.com/docs/grafana/latest/administration/provisioning/#alerting - alerting.contactPoints.settings.contactPoints = [ - { - name = "Alertmanager"; - receivers = [ - { - uid = 1; - type = "prometheus-alertmanager"; - settings.url = "https://${config.nixfiles.modules.alertmanager.domain}"; - } - ]; - } - ]; - }; + # https://grafana.com/docs/grafana/latest/administration/provisioning/#alerting + alerting.contactPoints.settings.contactPoints = [ + { + name = "Alertmanager"; + receivers = [ + { + uid = 1; + type = "prometheus-alertmanager"; + settings.url = "https://${config.nixfiles.modules.alertmanager.domain}"; + } + ]; + } + ]; }; + }; - loki.configuration.ruler.alertmanager_url = "https://${config.nixfiles.modules.alertmanager.domain}"; + loki.configuration.ruler.alertmanager_url = "https://${config.nixfiles.modules.alertmanager.domain}"; - prometheus = { - scrapeConfigs = with my.configurations; - mapAttrsToList - ( - name: value: { - job_name = name; - static_configs = [ + prometheus = { + scrapeConfigs = with my.configurations; + mapAttrsToList + ( + name: value: { + job_name = name; + static_configs = [ + { + targets = with value; + map (host: + concatStringsSep ":" [ + ( + if isAttrs host + then host.hostname + else host + ) + (toString port) + ]) + hosts; + } + ]; + relabel_configs = + [ { - targets = with value; - map (host: - concatStringsSep ":" [ - ( - if isAttrs host - then host.hostname - else host - ) - (toString port) - ]) - hosts; + source_labels = ["__address__"]; + regex = "([^:]+):\\d+"; + target_label = "instance"; } - ]; - relabel_configs = - [ - { - source_labels = ["__address__"]; - regex = "([^:]+):\\d+"; - target_label = "instance"; - } - ] - ++ optionals (hasAttr "relabel" value) value.relabel; - } - ) - { - promtail = { - hosts = [manwe varda yavanna]; - inherit (config.nixfiles.modules.promtail) port; - }; - ntfy = { - hosts = [manwe]; - inherit (config.nixfiles.modules.ntfy.prometheus) port; - }; - soju = { - hosts = ["127.0.0.1"]; - inherit (config.nixfiles.modules.soju.prometheus) port; - }; - endlessh-go = { - hosts = [manwe varda yavanna]; - inherit (config.services.endlessh-go.prometheus) port; - }; - nginx = { - hosts = [manwe yavanna]; - inherit (config.services.prometheus.exporters.nginx) port; - }; - node = { - hosts = [manwe varda yavanna]; - inherit (config.services.prometheus.exporters.node) port; - }; - postgres = { - hosts = [manwe]; - inherit (config.services.prometheus.exporters.postgres) port; - }; - redis = { - hosts = [manwe]; - inherit (config.services.prometheus.exporters.redis) port; - }; - unbound = { - hosts = [manwe]; - inherit (config.services.prometheus.exporters.unbound) port; - }; - wireguard = { - hosts = [manwe]; - inherit (config.services.prometheus.exporters.wireguard) port; - }; - # TODO Wait for https://github.com/NixOS/nixpkgs/pull/265696 - exportarr-lidarr = { - hosts = [yavanna]; - port = 9708; - }; + ] + ++ optionals (hasAttr "relabel" value) value.relabel; + } + ) + { + promtail = { + hosts = [manwe varda yavanna]; + inherit (config.nixfiles.modules.promtail) port; + }; + ntfy = { + hosts = [manwe]; + inherit (config.nixfiles.modules.ntfy.prometheus) port; + }; + soju = { + hosts = ["127.0.0.1"]; + inherit (config.nixfiles.modules.soju.prometheus) port; + }; + endlessh-go = { + hosts = [manwe varda yavanna]; + inherit (config.services.endlessh-go.prometheus) port; }; + nginx = { + hosts = [manwe yavanna]; + inherit (config.services.prometheus.exporters.nginx) port; + }; + node = { + hosts = [manwe varda yavanna]; + inherit (config.services.prometheus.exporters.node) port; + }; + postgres = { + hosts = [manwe]; + inherit (config.services.prometheus.exporters.postgres) port; + }; + redis = { + hosts = [manwe]; + inherit (config.services.prometheus.exporters.redis) port; + }; + unbound = { + hosts = [manwe]; + inherit (config.services.prometheus.exporters.unbound) port; + }; + wireguard = { + hosts = [manwe]; + inherit (config.services.prometheus.exporters.wireguard) port; + }; + # TODO Wait for https://github.com/NixOS/nixpkgs/pull/265696 + exportarr-lidarr = { + hosts = [yavanna]; + port = 9708; + }; + }; - ruleFiles = [ - ./rules/nginx.yaml - ./rules/node.yaml - ./rules/postgres.yaml - ./rules/redis.yaml - ]; + ruleFiles = [ + ./rules/nginx.yaml + ./rules/node.yaml + ./rules/postgres.yaml + ./rules/redis.yaml + ]; - alertmanagers = [ - { - scheme = "https"; - static_configs = [ - {targets = [config.nixfiles.modules.alertmanager.domain];} - ]; - } - ]; - }; + alertmanagers = [ + { + scheme = "https"; + static_configs = [ + {targets = [config.nixfiles.modules.alertmanager.domain];} + ]; + } + ]; }; }; - } - # FIXME https://nixpk.gs/pr-tracker.html?pr=265696 - // lib.moduleFromRef - "services/monitoring/prometheus/exporters.nix" - "Stunkymonkey:nixos-exportarr" - "0c9n3dc8l64bshynpbzaplvxhi2f0ihh6wcslh42y9kilwjp2zjv" + }; +} diff --git a/modules/nixos/plausible.nix b/modules/nixos/plausible.nix index 172da3f..d346bde 100644 --- a/modules/nixos/plausible.nix +++ b/modules/nixos/plausible.nix @@ -6,125 +6,119 @@ }: with lib; let cfg = config.nixfiles.modules.plausible; -in - { - options.nixfiles.modules.plausible = { - enable = mkEnableOption "Plausible Analytics"; +in { + options.nixfiles.modules.plausible = { + enable = mkEnableOption "Plausible Analytics"; - port = mkOption { - description = "Port."; - type = with types; port; - default = 8000; - }; + port = mkOption { + description = "Port."; + type = with types; port; + default = 8000; + }; - domain = mkOption { - description = "Domain name sans protocol scheme."; - type = with types; nullOr str; - default = "plausible.${config.networking.domain}"; - }; + domain = mkOption { + description = "Domain name sans protocol scheme."; + type = with types; nullOr str; + default = "plausible.${config.networking.domain}"; }; + }; - config = let - db = "plausible"; - in - mkIf cfg.enable { - _module.args.libPlausible = { - htmlPlausibleScript = { - domain ? "$host", - src ? "https://${cfg.domain}/js/script.js", - }: ''<script defer data-domain="${domain}" src="${src}"></script>''; - }; + config = let + db = "plausible"; + in + mkIf cfg.enable { + _module.args.libPlausible = { + htmlPlausibleScript = { + domain ? "$host", + src ? "https://${cfg.domain}/js/script.js", + }: ''<script defer data-domain="${domain}" src="${src}"></script>''; + }; - secrets = { - plausible-key.file = "${inputs.self}/secrets/plausible-key"; - plausible-admin-password.file = "${inputs.self}/secrets/plausible-admin-password"; - plausible-smtp-password.file = "${inputs.self}/secrets/smtp-password"; - }; + secrets = { + plausible-key.file = "${inputs.self}/secrets/plausible-key"; + plausible-admin-password.file = "${inputs.self}/secrets/plausible-admin-password"; + plausible-smtp-password.file = "${inputs.self}/secrets/smtp-password"; + }; - nixfiles.modules = { - nginx = { - enable = true; - upstreams.plausible.servers."127.0.0.1:${toString cfg.port}" = {}; - virtualHosts.${cfg.domain}.locations."/" = { - proxyPass = "http://plausible"; - proxyWebsockets = true; - }; - }; - postgresql = { - enable = true; - extraPostStart = [ - '' - $PSQL "${db}" -tAc 'GRANT ALL ON SCHEMA "public" TO "${db}"' - $PSQL "${db}" -tAc 'CREATE EXTENSION IF NOT EXISTS citext' - '' - ]; + nixfiles.modules = { + nginx = { + enable = true; + upstreams.plausible.servers."127.0.0.1:${toString cfg.port}" = {}; + virtualHosts.${cfg.domain}.locations."/" = { + proxyPass = "http://plausible"; + proxyWebsockets = true; }; - clickhouse.enable = true; }; - - services.postgresql = { - ensureDatabases = [db]; - ensureUsers = [ - { - name = db; - ensurePermissions."DATABASE \"${db}\"" = "ALL"; - } + postgresql = { + enable = true; + extraPostStart = [ + '' + $PSQL "${db}" -tAc 'GRANT ALL ON SCHEMA "public" TO "${db}"' + $PSQL "${db}" -tAc 'CREATE EXTENSION IF NOT EXISTS citext' + '' ]; }; + clickhouse.enable = true; + }; - services.plausible = { - enable = true; + services.postgresql = { + ensureDatabases = [db]; + ensureUsers = [ + { + name = db; + ensurePermissions."DATABASE \"${db}\"" = "ALL"; + } + ]; + }; - adminUser = { - name = "admin"; - email = "admin@${my.domain.shire}"; - passwordFile = config.secrets.plausible-admin-password.path; - activate = false; - }; + services.plausible = { + enable = true; - mail = { - email = "admin+plausible@${my.domain.shire}"; - smtp = { - hostAddr = my.domain.shire; - hostPort = 465; - enableSSL = true; - user = "azahi@${my.domain.shire}"; - passwordFile = config.secrets.plausible-smtp-password.path; - }; - }; + adminUser = { + name = "admin"; + email = "admin@${my.domain.shire}"; + passwordFile = config.secrets.plausible-admin-password.path; + activate = false; + }; - database = { - clickhouse = { - setup = false; - url = "http://127.0.0.1:8123/default"; - }; + mail = { + email = "admin+plausible@${my.domain.shire}"; + smtp = { + hostAddr = my.domain.shire; + hostPort = 465; + enableSSL = true; + user = "azahi@${my.domain.shire}"; + passwordFile = config.secrets.plausible-smtp-password.path; + }; + }; - postgres = { - setup = true; - dbname = db; - }; + database = { + clickhouse = { + setup = false; + url = "http://127.0.0.1:8123/default"; }; - server = { - baseUrl = "https://${cfg.domain}"; - disableRegistration = true; - listenAddress = "127.0.0.1"; - inherit (cfg) port; - secretKeybaseFile = config.secrets.plausible-key.path; + postgres = { + setup = true; + dbname = db; }; }; - systemd.services.plausible = rec { - after = [ - "postgresql.service" - "clickhouse.service" - ]; - requires = after; + server = { + baseUrl = "https://${cfg.domain}"; + disableRegistration = true; + listenAddress = "127.0.0.1"; + inherit (cfg) port; + secretKeybaseFile = config.secrets.plausible-key.path; }; }; - } - # FIXME https://nixpk.gs/pr-tracker.html?pr=266702 - // lib.moduleFromRef - "services/web-apps/plausible.nix" - "nh2:plausible-listen-address-no-distributed-erlang" - "080c1rdz99xj8y876cw1p3zxmmaqq75jhrpf9f5z1da8v7yvs078" + + systemd.services.plausible = rec { + after = [ + "postgresql.service" + "clickhouse.service" + ]; + requires = after; + }; + }; +} diff --git a/modules/nixos/podman.nix b/modules/nixos/podman.nix index ceb748b..ec9b346 100644 --- a/modules/nixos/podman.nix +++ b/modules/nixos/podman.nix @@ -1,7 +1,7 @@ { config, - lib, inputs, + lib, pkgs, ... }: diff --git a/modules/nixos/prometheus.nix b/modules/nixos/prometheus.nix index 5e61e73..0320e82 100644 --- a/modules/nixos/prometheus.nix +++ b/modules/nixos/prometheus.nix @@ -1,7 +1,7 @@ { config, - libNginx, lib, + libNginx, ... }: with lib; let diff --git a/modules/nixos/radicale.nix b/modules/nixos/radicale.nix index 3c6a230..588ed51 100644 --- a/modules/nixos/radicale.nix +++ b/modules/nixos/radicale.nix @@ -1,8 +1,8 @@ { - libNginx, config, inputs, lib, + libNginx, ... }: with lib; let diff --git a/modules/nixos/syncthing.nix b/modules/nixos/syncthing.nix index 755e2db..39579f8 100644 --- a/modules/nixos/syncthing.nix +++ b/modules/nixos/syncthing.nix @@ -1,8 +1,8 @@ { config, - libNginx, inputs, lib, + libNginx, this, ... }: diff --git a/modules/nixos/victoriametrics.nix b/modules/nixos/victoriametrics.nix index 89d3ddb..6b037b9 100644 --- a/modules/nixos/victoriametrics.nix +++ b/modules/nixos/victoriametrics.nix @@ -1,7 +1,7 @@ { config, - libNginx, lib, + libNginx, ... }: with lib; let diff --git a/nixosConfigurations/manwe/webserver.nix b/nixosConfigurations/manwe/webserver.nix index 324036a..d0784e8 100644 --- a/nixosConfigurations/manwe/webserver.nix +++ b/nixosConfigurations/manwe/webserver.nix @@ -1,8 +1,8 @@ { - libNginx, - libPlausible, inputs, lib, + libNginx, + libPlausible, ... }: with lib; { diff --git a/overlays.nix b/overlay.nix index 7229f42..b8e8807 100644 --- a/overlays.nix +++ b/overlay.nix @@ -23,7 +23,7 @@ final: prev: { preFixup = null; }); - grc = prev.grc.overrideAttrs (_: _: { + grc = prev.grc.overrideAttrs (_: super: { version = "unstable-2021-08-12"; src = final.fetchFromGitHub { owner = "garabik"; @@ -31,37 +31,51 @@ final: prev: { rev = "4d6a51fd78ad7e19af8dd12b2a828d1807267079"; hash = "sha256-SmOZrgV0lgLryFoxADU15IKJ7jhxXar0MgbsV/z1GaE="; }; - patches = [ - (final.fetchpatch { - url = "https://patch-diff.githubusercontent.com/raw/garabik/grc/pull/214.patch"; - hash = "sha256-VNr9jl5oFbFNJbGsjflwFV3oTbCzJ0lBIZA4eyeoXLY="; - }) - ]; + patches = + (super.patches or []) + ++ [ + (final.fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/garabik/grc/pull/214.patch"; + hash = "sha256-VNr9jl5oFbFNJbGsjflwFV3oTbCzJ0lBIZA4eyeoXLY="; + }) + ]; }); alejandra = prev.alejandra.overrideAttrs (_: super: { - patches = super.patches ++ [./patches/alejandra-no-noise.patch]; + patches = + (super.patches or []) + ++ [ + ./patches/alejandra-no-noise.patch + ]; }); prismlauncher-unwrapped = (prev.prismlauncher-unwrapped.override (finalAttrs: { - stdenv = final.useMoldLinker finalAttrs.stdenv; + stdenv = final.useMoldLinker (final.impureUseNativeOptimizations finalAttrs.stdenv); })) .overrideAttrs (_: super: { - patches = super.patches ++ [./patches/prismlauncher-allow-offline-accounts.patch]; + patches = + (super.patches or []) + ++ [ + ./patches/prismlauncher-allow-offline-accounts.patch + ]; }); telegram-desktop = (prev.telegram-desktop.override (finalAttrs: { - stdenv = final.useMoldLinker finalAttrs.stdenv; + stdenv = final.useMoldLinker (final.impureUseNativeOptimizations finalAttrs.stdenv); })) .overrideAttrs (_: super: { - patches = super.patches ++ [./patches/telegram-desktop-no-ads.patch]; + patches = + (super.patches or []) + ++ [ + ./patches/telegram-desktop-no-ads.patch + ]; }); vesktop = prev.vesktop.overrideAttrs (_: super: { nativeBuildInputs = super.nativeBuildInputs ++ [final.imagemagick]; - patches = super.patches ++ [./patches/vesktop-no-anime.patch]; + patches = (super.patches or []) ++ [./patches/vesktop-no-anime.patch]; postInstall = '' rm -rf $out/share/icons/hicolor/* for size in 16 24 32 48 64 96; do diff --git a/packages/bruh.nix b/packages/bruh.nix index 2b274f1..bad8aa0 100644 --- a/packages/bruh.nix +++ b/packages/bruh.nix @@ -27,6 +27,7 @@ stdenv.mkDerivation (finalAttrs: { description = "Bruh sound, but as a program"; inherit (finalAttrs.src.meta) homepage; license = licenses.gpl3Only; + platforms = platforms.linux; maintainers = with maintainers; [azahi]; }; }) diff --git a/packages/myip.nix b/packages/myip.nix index 67ea1ed..f91872b 100644 --- a/packages/myip.nix +++ b/packages/myip.nix @@ -17,6 +17,7 @@ writeShellApplication { description = "A dumb tool to get host's current public IP"; homepage = "https://git.azahi.cc/nixfiles"; license = licenses.wtfpl; + platforms = platforms.unix; maintainers = with maintainers; [azahi]; }; } diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix index a114bab..782a193 100644 --- a/packages/nixfiles.nix +++ b/packages/nixfiles.nix @@ -178,6 +178,7 @@ in description = "A helper utility to manage NixOS configurations with Nix flakes"; homepage = "https://git.azahi.cc/nixfiles"; license = licenses.wtfpl; + platforms = platforms.unix; maintainers = with maintainers; [azahi]; }; } diff --git a/packages/openssl_1_0_0.nix b/packages/openssl_1_0_0.nix index b1572d1..228922a 100644 --- a/packages/openssl_1_0_0.nix +++ b/packages/openssl_1_0_0.nix @@ -33,6 +33,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { description = "Ancient OpenSSL version that some GOG games require"; homepage = "https://downloads.dotslashplay.it/resources/openssl"; license = licenses.asl20; + platforms = ["x86_64-linux"]; sourceProvenance = with lib.sourceTypes; [binaryBytecode]; maintainers = with maintainers; [azahi]; }; diff --git a/patches/prismlauncher-allow-offline-accounts.patch b/patches/prismlauncher-allow-offline-accounts.patch index c245066..4454551 100644 --- a/patches/prismlauncher-allow-offline-accounts.patch +++ b/patches/prismlauncher-allow-offline-accounts.patch @@ -1,24 +1,19 @@ diff --git i/launcher/ui/pages/global/AccountListPage.cpp w/launcher/ui/pages/global/AccountListPage.cpp -index 278f45c4..b65cbbfb 100644 +index 3a21cdd9..de665694 100644 --- i/launcher/ui/pages/global/AccountListPage.cpp +++ w/launcher/ui/pages/global/AccountListPage.cpp -@@ -188,19 +188,6 @@ void AccountListPage::on_actionAddMicrosoft_triggered() +@@ -146,14 +146,6 @@ void AccountListPage::on_actionAddMicrosoft_triggered() void AccountListPage::on_actionAddOffline_triggered() { - if (!m_accounts->anyAccountIsValid()) { -- QMessageBox::warning( -- this, -- tr("Error"), -- tr( -- "You must add a Microsoft or Mojang account that owns Minecraft before you can add an offline account." -- "<br><br>" -- "If you have lost your account you can contact Microsoft for support." -- ) -- ); +- QMessageBox::warning(this, tr("Error"), +- tr("You must add a Microsoft account that owns Minecraft before you can add an offline account." +- "<br><br>" +- "If you have lost your account you can contact Microsoft for support.")); - return; - } - - MinecraftAccountPtr account = OfflineLoginDialog::newAccount( - this, - tr("Please enter your desired username to add your offline account.") + MinecraftAccountPtr account = + OfflineLoginDialog::newAccount(this, tr("Please enter your desired username to add your offline account.")); + |