diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-03-16 02:00:43 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-03-16 02:00:43 +0300 |
commit | 4ec1c2d2908db7405867fb7a9f379a0e04b9fafe (patch) | |
tree | 9cffe3213d9510e810815c4f57db7274dfeca899 | |
parent | 2023-03-11 (diff) |
2023-03-16
Diffstat (limited to '')
-rw-r--r-- | flake.lock | 48 | ||||
-rw-r--r-- | modules/common/common/nix/default.nix | 15 | ||||
-rw-r--r-- | modules/common/profiles/dev/default.nix | 4 | ||||
-rw-r--r-- | modules/common/profiles/headful.nix | 3 | ||||
-rw-r--r-- | modules/nixos/games/lutris.nix | 1 | ||||
-rw-r--r-- | modules/nixos/loki.nix | 5 | ||||
-rw-r--r-- | modules/nixos/promtail.nix | 62 |
7 files changed, 101 insertions, 37 deletions
diff --git a/flake.lock b/flake.lock index 3f35797..b518d32 100644 --- a/flake.lock +++ b/flake.lock @@ -528,11 +528,11 @@ ] }, "locked": { - "lastModified": 1678271387, - "narHash": "sha256-H2dv/i1LRlunRtrESirELzfPWdlG/6ElDB1ksO529H4=", + "lastModified": 1678729503, + "narHash": "sha256-j+h4Bdqbe+qjzhxdhkRmVgSx2lxJ8HnKeYcAhhnd1zM=", "owner": "nix-community", "repo": "home-manager", - "rev": "36999b8d19eb6eebb41983ef017d7e0095316af2", + "rev": "24c1a6335e3da6a3ecf82f33ac50c2ad66aee346", "type": "github" }, "original": { @@ -600,11 +600,11 @@ ] }, "locked": { - "lastModified": 1678154054, - "narHash": "sha256-yFQwkmWZgQrcgHagP/7HP/Vg2/h6JfZuAs7AhbEsCMc=", + "lastModified": 1678757075, + "narHash": "sha256-nB4O3vdGSKFVZF3tF7Mq5BLh4SxhJBNBTsJzL3dI9C8=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "8118891606aa521d2c8f87da25d2a769c356eb4a", + "rev": "7de21a83e4d945d01dc9125a9467a9a0d309630f", "type": "github" }, "original": { @@ -616,11 +616,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1678095239, - "narHash": "sha256-4F6jovFJcwh6OkMsY94ZrHdrvVqZi1FX5pYv6V9LIQw=", + "lastModified": 1678397099, + "narHash": "sha256-5xq8YJe+h19TlD+EI4AE/3H3jcCcQ2AWU6CWBVc5tRc=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "f6610997b0fc5ea5f9e142c348fca27497efe1c7", + "rev": "556101ff85bd6e20900ec73ee525b935154bc8ea", "type": "github" }, "original": { @@ -632,11 +632,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1678237502, - "narHash": "sha256-J4cAbmC9RK+Jus3U88WaxkTsnNlZSroE2xZ9A0rSxL4=", + "lastModified": 1678724065, + "narHash": "sha256-MjeRjunqfGTBGU401nxIjs7PC9PZZ1FBCZp/bRB3C2M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1eeea1f1922fb79a36008ba744310ccbf96130e2", + "rev": "b8afc8489dc96f29f69bec50fdc51e27883f89c1", "type": "github" }, "original": { @@ -648,11 +648,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1678280833, - "narHash": "sha256-0SPxdBYly0eL+CY/z4HjGqAjAfh9evtvTLsqKnS2prk=", + "lastModified": 1678816457, + "narHash": "sha256-uADLj4wb0/0yrnu/dvZ5+l0XKyGIi3W8RGyAxZr3leI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e40b5250ab10f98a5343d78e2c6c83db6a6c4bec", + "rev": "8889512934037f08a9d09104d604b231095f8d02", "type": "github" }, "original": { @@ -664,11 +664,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1678266329, - "narHash": "sha256-rawge6yca5wvm+vcBB0pTp2q1Bf5Nc2Lk05dP7W+Q1E=", + "lastModified": 1678803540, + "narHash": "sha256-nHCi/KLdawIyDW68VPqBchIFvwyVmJlq9MJFGzRq4tc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1e56d76f106e626764ee91785fe32b2342cc836e", + "rev": "b0bdfe19cde52b55c811fb05b22dde0cf7f6a1d8", "type": "github" }, "original": { @@ -714,11 +714,11 @@ }, "nur": { "locked": { - "lastModified": 1678286808, - "narHash": "sha256-jC/AwS4HmeV255+tYRFOTkC0+sLGUSQFgNV98HjQYvE=", + "lastModified": 1678816247, + "narHash": "sha256-Zz8+vqaAcuRxjJWG7zr2PrpEKQIxUVDbWlMBosOuxj8=", "owner": "nix-community", "repo": "NUR", - "rev": "fc66688b4a56184061191482536f1d8de3aea462", + "rev": "4b8c2bae188553e8c5461e4824d732f86ec85a42", "type": "github" }, "original": { @@ -770,11 +770,11 @@ ] }, "locked": { - "lastModified": 1677832802, - "narHash": "sha256-XQf+k6mBYTiQUjWRf/0fozy5InAs03O1b30adCpWeXs=", + "lastModified": 1678376203, + "narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "382bee738397ca005206eefa36922cc10df8a21c", + "rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", "type": "github" }, "original": { diff --git a/modules/common/common/nix/default.nix b/modules/common/common/nix/default.nix index 9f80838..b328e4c 100644 --- a/modules/common/common/nix/default.nix +++ b/modules/common/common/nix/default.nix @@ -4,7 +4,6 @@ lib, localUsername ? lib.my.username, pkgs, - pkgsPR, this, ... }: @@ -99,13 +98,16 @@ with lib; { patches = [./patches/alejandra-no-ads.patch]; }); - logcli = super.grafana-loki.overrideAttrs (_: _: { + logcli = super.grafana-loki.overrideAttrs (_: final: { + nativeBuildInputs = final.nativeBuildInputs ++ [pkgs.installShellFiles]; subPackages = ["cmd/logcli"]; + postInstall = '' + installShellCompletion --cmd logcli \ + --bash <($out/bin/logcli --completion--script-bash) \ + --zsh <($out/bin/logcli --completion-script-zsh) + ''; + preFixup = null; }); - - inherit (pkgsPR "215704" "sha256-o2F/ZAugljJKlVIAHMTBK6+Lj6BiBwteA5OuaWPKXm0=") dendrite; - - inherit (pkgsPR "216465" "sha256-ik3e+KM27hGkKWTOOUWj1YtiqHTJvl04dx0/X08P1A0=") amdvlk; } // (with super; let np = nodePackages; @@ -135,6 +137,7 @@ with lib; { environment.systemPackages = with pkgs; optionals this.isHeadful [ + hydra-check nix-top nix-tree ]; diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix index 366590f..210924a 100644 --- a/modules/common/profiles/dev/default.nix +++ b/modules/common/profiles/dev/default.nix @@ -38,14 +38,14 @@ in { templates.params = rec { author-name = my.fullname; author-email = my.email; - copyright = "Copyright (c) ${author-name} <${author-email}>"; + copyright = "Copyright (c) 2023 ${author-name} <${author-email}>"; github-username = my.username; }; }; ".stack/global-project/stack.yaml".text = generators.toYAML {} { packages = []; - resolver = "lts-20.3"; + resolver = "lts-20.14"; }; }; diff --git a/modules/common/profiles/headful.nix b/modules/common/profiles/headful.nix index 1c1f43b..809605c 100644 --- a/modules/common/profiles/headful.nix +++ b/modules/common/profiles/headful.nix @@ -33,10 +33,13 @@ in { packages = with pkgs; [ fd + logcli ripgrep ripgrep-all sd ]; + + sessionVariables.LOKI_ADDR = "https://loki.${config.networking.domain}"; }; accounts.email = { diff --git a/modules/nixos/games/lutris.nix b/modules/nixos/games/lutris.nix index 72179fc..2737953 100644 --- a/modules/nixos/games/lutris.nix +++ b/modules/nixos/games/lutris.nix @@ -27,6 +27,7 @@ in { }; }) vkBasalt + winetricks ]; }; } diff --git a/modules/nixos/loki.nix b/modules/nixos/loki.nix index 1582164..fe3c2eb 100644 --- a/modules/nixos/loki.nix +++ b/modules/nixos/loki.nix @@ -73,6 +73,11 @@ in { }; }; + limits_config = { + max_streams_per_user = 0; + max_global_streams_per_user = 0; + }; + schema_config.configs = [ { from = "2020-01-01"; diff --git a/modules/nixos/promtail.nix b/modules/nixos/promtail.nix index 552df82..c038d7b 100644 --- a/modules/nixos/promtail.nix +++ b/modules/nixos/promtail.nix @@ -34,17 +34,69 @@ in { log_level = "warn"; }; - clients = [{url = "${cfg.loki.url}/loki/api/v1/push";}]; + clients = [ + { + url = "${cfg.loki.url}/loki/api/v1/push"; + external_labels.host_id = config.networking.hostId; + } + ]; positions.filename = "/tmp/positions.yaml"; scrape_configs = [ { job_name = "journal"; - journal = { - max_age = "24h"; - labels.job = "systemd-journal"; - }; + journal.max_age = "24h"; + relabel_configs = + map (n: let + label = toLower n; + in { + source_labels = ["__journal_${label}"]; + target_label = + if hasPrefix "_" label + then substring 1 (stringLength label - 1) label + else label; + }) [ + # Derived from systemd.journal fields[1][2]. + # + # [1]: https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html + # [2]: https://github.com/coreos/go-systemd/blob/main/sdjournal/journal.go#L335 + + "MESSAGE" + "MESSAGE_ID" + "PRIORITY" + # "CODE_FILE" + # "CODE_LINE" + # "CODE_FUNC" + "ERRNO" + "SYSLOG_FACILITY" + "SYSLOG_IDENTIFIER" + "SYSLOG_PID" + "_PID" + "_UID" + "_GID" + # "_COMM" + # "_EXE" + "_CMDLINE" + # "_CAP_EFFECTIVE" + # "_AUDIT_SESSION" + # "_AUDIT_LOGINUID" + # "_SYSTEMD_CGROUP" + # "_SYSTEMD_SESSION" + "_SYSTEMD_UNIT" + "_SYSTEMD_USER_UNIT" + # "_SYSTEMD_OWNER_UID" + # "_SYSTEMD_SLICE" + # "_SELINUX_CONTEXT" + # "_SOURCE_REALTIME_TIMESTAMP" + "_BOOT_ID" + "_MACHINE_ID" + "_HOSTNAME" + "_TRANSPORT" + # "__CURSOR" + # "__REALTIME_TIMESTAMP" + # "__MONOTONIC_TIMESTAMP" + ]; } ]; }; |