diff --git a/.github/workflows/update-flake.yaml b/.github/workflows/update-flake.yaml index 9f64121..90f7b4c 100644 --- a/.github/workflows/update-flake.yaml +++ b/.github/workflows/update-flake.yaml @@ -5,8 +5,61 @@ on: - cron: "30 00 * * 1" workflow_dispatch: # Allow manual triggering +# Set default permissions as read only +permissions: read-all + jobs: - build-and-update: + update-flake: + runs-on: ubuntu-latest + permissions: + # Only need contents write to update the flake lock file + contents: write + outputs: + update_available: ${{ steps.check_updates.outputs.update_available }} + + steps: + - name: Repository Checkout + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v16 + + - name: Check for Updates + id: check_updates + run: | + # Create a temporary copy of flake.lock + cp flake.lock flake.lock.backup + + # Try to update flake.lock + nix flake update + + # Check if there are differences + if ! cmp -s flake.lock flake.lock.backup; then + echo "update_available=true" >> "$GITHUB_OUTPUT" + # Restore original flake.lock + mv flake.lock.backup flake.lock + else + echo "update_available=false" >> "$GITHUB_OUTPUT" + fi + + - name: Update flake.lock + if: steps.check_updates.outputs.update_available == 'true' + uses: DeterminateSystems/update-flake-lock@v24 + with: + nix-options: --debug --log-format raw + token: ${{ secrets.FLAKE_TOKEN }} + pr-title: "deps: update flake.lock" + pr-labels: | + dependencies + automated + + build-and-check: + needs: update-flake + permissions: + # Needed for checking out code + contents: read + # Needed for creating issues + issues: write strategy: matrix: os: [ubuntu-latest, macos-latest] @@ -17,6 +70,8 @@ jobs: steps: - name: Repository Checkout uses: actions/checkout@v4 + with: + ref: update_flake_lock_action - name: Install Nix uses: DeterminateSystems/nix-installer-action@v16 @@ -25,17 +80,22 @@ jobs: id: build continue-on-error: true # Continue to next steps even if build fails run: | + set +e # Don't exit immediately on error # Run the build and capture output OUTPUT=$(nix build .# 2>&1) + BUILD_EXIT_CODE=$? echo "build_output<> $GITHUB_ENV echo "$OUTPUT" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV # Check if build succeeded - if [ $? -eq 0 ]; then + if [ $BUILD_EXIT_CODE -eq 0 ]; then echo "build_status=success" >> $GITHUB_ENV else echo "build_status=failure" >> $GITHUB_ENV + # Ensure the error is visible in the logs + echo "::error::Build failed with exit code $BUILD_EXIT_CODE" + echo "$OUTPUT" fi - name: Create Issue on Build Failure @@ -45,12 +105,33 @@ jobs: script: | const os = '${{ matrix.os }}'; const buildOutput = process.env.build_output; + const isUpdate = '${{ needs.update-flake.outputs.update_available }}' === 'true'; + + // Extract warnings and errors from build output + const warnings = buildOutput.match(/evaluation warning:[^\n]+/g) || []; + const errors = buildOutput.match(/error:[^\n]+/g) || []; + + // Create a summary section + const summary = [ + warnings.length > 0 ? `${warnings.length} evaluation warnings` : '', + errors.length > 0 ? `${errors.length} errors` : '' + ].filter(Boolean).join(' and '); + + // Get repository information from context + const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); await github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.name, - title: `🔨 Build Failed on ${os}`, - body: `Build failed during automated validation on ${os}. + owner, + repo, + title: `🔨 Build Failed on ${os}: ${summary}${isUpdate ? ' (Dependency Update)' : ''}`, + body: `Build failed during automated validation on ${os}${isUpdate ? ' while testing dependency updates.' : '.'}\n + ${isUpdate ? 'This failure occurred on the dependency update branch `deps/update-flake-lock`.' : 'This failure occurred on the main branch.'}\n + + ### Summary + ${summary}\n + + ${warnings.length > 0 ? `### Warnings\n\`\`\`\n${warnings.join('\n')}\n\`\`\`\n` : ''} + ${errors.length > 0 ? `### Errors\n\`\`\`\n${errors.join('\n')}\n\`\`\`\n` : ''}
Build Output @@ -61,60 +142,10 @@ jobs:
Please review the build output and fix any issues.`, - labels: ['build-failure', 'bug'] - }); - - - name: Update flake.lock - if: matrix.os == 'ubuntu-latest' && env.build_status == 'success' - uses: DeterminateSystems/update-flake-lock@v24 - with: - nix-options: --debug --log-format raw - token: ${{ secrets.FLAKE_TOKEN }} - pr-title: "deps: update flake.lock" - pr-labels: | - dependencies - automated - - - name: Run Checks - id: checks - if: env.build_status == 'success' - continue-on-error: true - run: | - # Run the checks and capture output - OUTPUT=$(nix flake check 2>&1) - echo "check_output<> $GITHUB_ENV - echo "$OUTPUT" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - # Check if checks succeeded - if [ $? -eq 0 ]; then - echo "check_status=success" >> $GITHUB_ENV - else - echo "check_status=failure" >> $GITHUB_ENV - fi - - - name: Create Issue on Check Failure - if: env.check_status == 'failure' - uses: actions/github-script@v7 - with: - script: | - const os = '${{ matrix.os }}'; - const checkOutput = process.env.check_output; - - await github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.name, - title: `⚠️ Checks Failed on ${os}`, - body: `Checks failed during automated validation on ${os}. - -
- Check Output - - \`\`\` - ${checkOutput} - \`\`\` -
- - Please review the check output and fix any issues.`, - labels: ['check-failure', 'bug'] + labels: [ + 'build-failure', + 'bug', + ...(warnings.length > 0 ? ['has-warnings'] : []), + ...(errors.length > 0 ? ['has-errors'] : []) + ] }); diff --git a/config/plugins/cmp/cmp-copilot.nix b/config/plugins/cmp/cmp-copilot.nix index 40db887..3417c01 100644 --- a/config/plugins/cmp/cmp-copilot.nix +++ b/config/plugins/cmp/cmp-copilot.nix @@ -3,12 +3,15 @@ enable = true; }; plugins.copilot-lua = { - enable = true; - suggestion = { - enabled = false; - }; - panel = { - enabled = false; + settings = { + copilot = { + suggestion = { + enabled = false; + }; + panel = { + enabled = false; + }; + }; }; }; diff --git a/config/plugins/lsp/fidget.nix b/config/plugins/lsp/fidget.nix index 3968923..f8924c4 100644 --- a/config/plugins/lsp/fidget.nix +++ b/config/plugins/lsp/fidget.nix @@ -1,98 +1,109 @@ { plugins.fidget = { enable = true; - logger = { - level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace” - floatPrecision = 1.0e-2; # Limit the number of decimals displayed for floats - }; - progress = { - pollRate = 0; # How and when to poll for progress messages - suppressOnInsert = true; # Suppress new messages while in insert mode - ignoreDoneAlready = false; # Ignore new tasks that are already complete - ignoreEmptyMessage = false; # Ignore new tasks that don't contain a message - clearOnDetach = - # Clear notification group when LSP server detaches - '' - function(client_id) - local client = vim.lsp.get_client_by_id(client_id) - return client and client.name or nil - end - ''; - notificationGroup = - # How to get a progress message's notification group key - '' - function(msg) return msg.lsp_client.name end - ''; - ignore = [ ]; # List of LSP servers to ignore - lsp = { - progressRingbufSize = 0; # Configure the nvim's LSP progress ring buffer size + settings = { + logger = { + level = "warn"; # "off", "error", "warn", "info", "debug", "trace" + float_precision = 1.0e-2; # Limit the number of decimals displayed for floats }; - display = { - renderLimit = 16; # How many LSP messages to show at once - doneTtl = 3; # How long a message should persist after completion - doneIcon = "✔"; # Icon shown when all LSP progress tasks are complete - doneStyle = "Constant"; # Highlight group for completed LSP tasks - progressTtl = "math.huge"; # How long a message should persist when in progress - progressIcon = { - pattern = "dots"; - period = 1; - }; # Icon shown when LSP progress tasks are in progress - progressStyle = "WarningMsg"; # Highlight group for in-progress LSP tasks - groupStyle = "Title"; # Highlight group for group name (LSP server name) - iconStyle = "Question"; # Highlight group for group icons - priority = 30; # Ordering priority for LSP notification group - skipHistory = true; # Whether progress notifications should be omitted from history - formatMessage = '' - require ("fidget.progress.display").default_format_message - ''; # How to format a progress message - formatAnnote = '' - function (msg) return msg.title end - ''; # How to format a progress annotation - formatGroupName = '' - function (group) return tostring (group) end - ''; # How to format a progress notification group's name - overrides = { - rust_analyzer = { - name = "rust-analyzer"; + progress = { + poll_rate = 0; # How and when to poll for progress messages + suppress_on_insert = true; # Suppress new messages while in insert mode + ignore_done_already = false; # Ignore new tasks that are already complete + ignore_empty_message = false; # Ignore new tasks that don't contain a message + clear_on_detach = + # Clear notification group when LSP server detaches + '' + function(client_id) + local client = vim.lsp.get_client_by_id(client_id) + return client and client.name or nil + end + ''; + notification_group = + # How to get a progress message's notification group key + '' + function(msg) return msg.lsp_client.name end + ''; + ignore = [ ]; # List of LSP servers to ignore + lsp = { + progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size + }; + display = { + render_limit = 16; # How many LSP messages to show at once + done_ttl = 3; # How long a message should persist after completion + done_icon = "✔"; # Icon shown when all LSP progress tasks are complete + done_style = "Constant"; # Highlight group for completed LSP tasks + progress_ttl = 10; # How long a message should persist when in progress + progress_icon = { + pattern = "dots"; + period = 1; + }; # Icon shown when LSP progress tasks are in progress + progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks + group_style = "Title"; # Highlight group for group name (LSP server name) + icon_style = "Question"; # Highlight group for group icons + priority = 30; # Ordering priority for LSP notification group + skip_history = true; # Whether progress notifications should be omitted from history + format_message = '' + require ("fidget.progress.display").default_format_message + ''; # How to format a progress message + format_annote = '' + function (msg) return msg.title end + ''; # How to format a progress annotation + format_group_name = '' + function (group) return tostring (group) end + ''; # How to format a progress notification group's name + overrides = { + rust_analyzer = { + name = "rust-analyzer"; + }; + }; # Override options from the default notification config + }; + }; + notification = { + poll_rate = 10; # How frequently to update and render notifications + filter = "info"; # "off", "error", "warn", "info", "debug", "trace" + history_size = 128; # Number of removed messages to retain in history + override_vim_notify = true; + redirect = { + __raw = '' + function(msg, level, opts) + if opts and opts.on_open then + return require("fidget.integration.nvim-notify").delegate(msg, level, opts) + end + end + ''; + }; + configs = { + default = { + name = "Notifications"; + icon = "󰏪"; + group = "Notifications"; + annote = true; + debug = false; + debug_rate = 0.25; }; - }; # Override options from the default notification config - }; - }; - notification = { - pollRate = 10; # How frequently to update and render notifications - filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace” - historySize = 128; # Number of removed messages to retain in history - overrideVimNotify = true; - redirect = '' - function(msg, level, opts) - if opts and opts.on_open then - return require("fidget.integration.nvim-notify").delegate(msg, level, opts) - end - end - ''; - configs = { - default = "require('fidget.notification').default_config"; - }; + }; - window = { - normalHl = "Comment"; - winblend = 0; - border = "none"; # none, single, double, rounded, solid, shadow - zindex = 45; - maxWidth = 0; - maxHeight = 0; - xPadding = 1; - yPadding = 0; - align = "bottom"; - relative = "editor"; - }; - view = { - stackUpwards = true; # Display notification items from bottom to top - iconSeparator = " "; # Separator between group name and icon - groupSeparator = "---"; # Separator between notification groups - groupSeparatorHl = - # Highlight group used for group separator - "Comment"; + window = { + normal_hl = "Comment"; + winblend = 0; + border = "none"; # none, single, double, rounded, solid, shadow + zindex = 45; + max_width = 0; + max_height = 0; + x_padding = 1; + y_padding = 0; + align = "bottom"; + relative = "editor"; + }; + view = { + stack_upwards = true; # Display notification items from bottom to top + icon_separator = " "; # Separator between group name and icon + group_separator = "---"; # Separator between notification groups + group_separator_hl = + # Highlight group used for group separator + "Comment"; + }; }; }; }; diff --git a/flake.lock b/flake.lock index 3c7e70f..d10c3ec 100644 --- a/flake.lock +++ b/flake.lock @@ -21,11 +21,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1740872218, - "narHash": "sha256-ZaMw0pdoUKigLpv9HiNDH2Pjnosg7NBYMJlHTIsHEUo=", + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3876f6b87db82f33775b1ef5ea343986105db764", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", "type": "github" }, "original": { @@ -124,11 +124,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1740828860, - "narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=", + "lastModified": 1741246872, + "narHash": "sha256-Q6pMP4a9ed636qilcYX8XUguvKl/0/LGXhHcRI91p0U=", "owner": "nixos", "repo": "nixpkgs", - "rev": "303bd8071377433a2d8f76e684ec773d70c5b642", + "rev": "10069ef4cf863633f57238f179a0297de84bd8d3", "type": "github" }, "original": { @@ -140,14 +140,17 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1740872140, - "narHash": "sha256-3wHafybyRfpUCLoE8M+uPVZinImg3xX+Nm6gEfN3G8I=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" + "lastModified": 1740877520, + "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" } }, "nixpkgs_2": { @@ -189,11 +192,11 @@ "nuschtosSearch": "nuschtosSearch" }, "locked": { - "lastModified": 1740520037, - "narHash": "sha256-TpZMYjOre+6GhKDVHFwoW2iBWqpNQppQTuqIAo+OBV8=", + "lastModified": 1741098523, + "narHash": "sha256-gXDSXDr6tAb+JgxGMvcEjKC9YO8tVOd8hMMZHJLyQ6Q=", "owner": "nix-community", "repo": "nixvim", - "rev": "6f8d8f7aee84f377f52c8bb58385015f9168a666", + "rev": "03065fd4708bfdf47dd541d655392a60daa25ded", "type": "github" }, "original": { @@ -232,11 +235,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1740915799, - "narHash": "sha256-JvQvtaphZNmeeV+IpHgNdiNePsIpHD5U/7QN5AeY44A=", + "lastModified": 1741350116, + "narHash": "sha256-QKp83UTH0hGc7TYkQdX5JdagvBnP5169WyxXkMrkPqY=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "42b1ba089d2034d910566bf6b40830af6b8ec732", + "rev": "ca78dfc9652483f3ae52cfe70fdfbfe664451e2b", "type": "github" }, "original": {