ci: add deadnix #40

merged
opened by a.starrysky.fyi targeting main from private/minion/push-vmslusqkrqom

deadnix is a package to find unused nix code, we can add it to enforce that we don't leave let bindings/inputs/etc. around when they are not needed

+1 -1
packetmix/ci.nix
··· 7 7 project = base.extend { 8 8 modules = [ 9 9 ( 10 - { config, lib, ... }: 10 + { config, ... }: 11 11 { 12 12 config.inputs = ( 13 13 builtins.mapAttrs (
+1 -1
packetmix/homes/catppuccin/catppuccin.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { project, lib, ... }: 5 + { project, ... }: 6 6 { 7 7 imports = [ project.inputs.catppuccin.result.homeModules.catppuccin ]; 8 8 config.catppuccin.enable = true;
-1
packetmix/homes/coded/catppuccin.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { project, ... }: 6 5 { 7 6 config.catppuccin = { 8 7 flavor = "macchiato";
-1
packetmix/homes/common/gtk.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { pkgs, ... }: 6 5 { 7 6 gtk.enable = true; 8 7 }
-1
packetmix/homes/common/helix.nix
··· 4 4 5 5 { 6 6 config, 7 - pkgs, 8 7 project, 9 8 system, 10 9 ...
-3
packetmix/homes/default.nix
··· 4 4 # SPDX-License-Identifier: MIT 5 5 6 6 { config, ... }: 7 - let 8 - nixpkgs = config.inputs.nixpkgs.result; 9 - in 10 7 { 11 8 config.homes."maya:x86_64-linux" = { 12 9 modules = [
-2
packetmix/homes/development/helix.nix
··· 4 4 5 5 { 6 6 pkgs, 7 - project, 8 - system, 9 7 ... 10 8 }: 11 9 {
-1
packetmix/homes/development/tmux.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { lib, ... }: 6 5 { 7 6 programs.tmux.enable = true; 8 7 programs.fzf.tmux.enableShellIntegration = true; # Needed for using sesh - which relies on fzf+tmux
+4 -1
packetmix/homes/espanso/espanso.nix
··· 3 3 # 4 4 # SPDX-License-Identifier: MIT 5 5 6 - { config, lib, ... }: 6 + { 7 + config, 8 + ... 9 + }: 7 10 { 8 11 home.file = { 9 12 ".cache/espanso/kvs/has_completed_wizard" = {
-2
packetmix/homes/maya/niri.nix
··· 4 4 # SPDX-License-Identifier: MIT 5 5 6 6 { 7 - project, 8 - config, 9 7 pkgs, 10 8 lib, 11 9 ...
-3
packetmix/homes/minion/niri.nix
··· 3 3 # SPDX-License-Identifier: MIT 4 4 5 5 { 6 - project, 7 - config, 8 6 pkgs, 9 - lib, 10 7 ... 11 8 }: 12 9 {
-2
packetmix/homes/niri/niri.nix
··· 104 104 105 105 binds = 106 106 let 107 - inherit (config.lib.niri) actions; 108 - 109 107 mod = "Super"; 110 108 mod1 = "Alt"; 111 109
-1
packetmix/modules/nilla-home/home.nix
··· 4 4 5 5 { lib, config }: 6 6 let 7 - inherit (config) inputs; 8 7 homes-type = import ./homes-type.nix { inherit lib config; }; 9 8 in 10 9 {
-2
packetmix/modules/nilla-home/nixos.nix
··· 30 30 31 31 config.modules = 32 32 let 33 - system = submodule.config.pkgs.system; 34 33 warn' = builtins.warn or builtins.trace; # builtins.warn doesn't exist on some versions of nix/lix 35 34 warnIf = 36 35 condition: message: value: ··· 52 51 { 53 52 home, 54 53 homeName, 55 - username, 56 54 }@identity: 57 55 warnIf (home.home-manager != homeManager) 58 56 "The home \"${homeName}\" isn't using the same home-manager input as the NixOS system \"${name}\". This may work, but is not officially supported by the Nilla Home or Nilla NixOS maintainers. Please fix this before reporting any bugs you may find."
-2
packetmix/packages/bluesky-pds/default.nix
··· 9 9 systems = [ "x86_64-linux" ]; 10 10 package = 11 11 { 12 - system, 13 12 stdenv, 14 13 nodejs, 15 14 pnpm_9, 16 - lib, 17 15 srcOnly, 18 16 python3, 19 17 ...
+4 -1
packetmix/systems/common/fonts.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { pkgs, lib, ... }: 5 + { 6 + pkgs, 7 + ... 8 + }: 6 9 { 7 10 fonts.packages = [ 8 11 pkgs.cantarell-fonts
-1
packetmix/systems/common/inputs.nix
··· 4 4 5 5 { 6 6 project, 7 - pkgs, 8 7 lib, 9 8 ... 10 9 }:
+4 -1
packetmix/systems/default.nix
··· 3 3 # 4 4 # SPDX-License-Identifier: MIT 5 5 6 - { config, lib, ... }: 6 + { 7 + config, 8 + ... 9 + }: 7 10 let 8 11 nixpkgs = config.inputs.nixpkgs.result; 9 12 in
-1
packetmix/systems/emden/hardware-configuration.nix
··· 5 5 { 6 6 config, 7 7 lib, 8 - pkgs, 9 8 modulesPath, 10 9 ... 11 10 }:
-1
packetmix/systems/emden/steam.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { lib, ... }: 6 5 { 7 6 programs.steam = { 8 7 enable = true;
+1 -1
packetmix/systems/espanso/nixpkgs-328890--espanso-capdacoverride.nix
··· 42 42 43 43 config = lib.mkIf cfg.enable { 44 44 nixpkgs.overlays = [ 45 - (final: prev: { 45 + (_final: prev: { 46 46 _espanso-wayland-orig = prev.espanso-wayland; 47 47 espanso-wayland = 48 48 pkgs.callPackage ./nixpkgs-328890--espanso-capdacoverride/espanso-capdacoverride.nix
-1
packetmix/systems/gaming/steam.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { lib, ... }: 6 5 { 7 6 programs.steam = { 8 7 enable = true;
-1
packetmix/systems/marbled/hardware-configuration.nix
··· 6 6 { 7 7 config, 8 8 lib, 9 - pkgs, 10 9 modulesPath, 11 10 ... 12 11 }:
-1
packetmix/systems/niri/niri.nix
··· 5 5 # 6 6 # This file is based on some work from sodiboo's niri-flake, see https://github.com/sodiboo/niri-flake/blob/main/flake.nix 7 7 { 8 - project, 9 8 pkgs, 10 9 lib, 11 10 ...
-1
packetmix/systems/personal/configuration.nix
··· 8 8 9 9 { 10 10 project, 11 - config, 12 11 system, 13 12 pkgs, 14 13 ...
-1
packetmix/systems/redhead/hardware-configuration.nix
··· 5 5 { 6 6 config, 7 7 lib, 8 - pkgs, 9 8 modulesPath, 10 9 ... 11 10 }:
-4
packetmix/systems/redhead/remoteBuilds.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { 6 - lib, 7 - ... 8 - }: 9 5 { 10 6 nix = { 11 7 distributedBuilds = true;
+1 -2
packetmix/systems/teal/pds.nix
··· 4 4 5 5 { 6 6 project, 7 - pkgs, 8 7 system, 9 8 ... 10 9 }: ··· 15 14 ]; 16 15 17 16 nixpkgs.overlays = [ 18 - (final: prev: { 17 + (final: _prev: { 19 18 bluesky-pdsadmin = final.pdsadmin; 20 19 }) 21 20 ];
-1
packetmix/systems/teal/stalwart.nix
··· 5 5 { 6 6 project, 7 7 config, 8 - pkgs, 9 8 lib, 10 9 ... 11 10 }:
-2
packetmix/systems/teal/vaultwarden.nix
··· 3 3 # SPDX-License-Identifier: MIT 4 4 5 5 { 6 - pkgs, 7 - lib, 8 6 config, 9 7 ... 10 8 }:
+21
.tangled/workflows/deadnix.yml
··· 1 + # SPDX-FileCopyrightText: 2025 FreshlyBakedCake 2 + # 3 + # SPDX-License-Identifier: MIT 4 + 5 + when: 6 + - event: ["push", "pull_request"] 7 + branch: ["main"] 8 + 9 + engine: nixery 10 + 11 + dependencies: 12 + nixpkgs: 13 + - ansifilter 14 + - deadnix 15 + 16 + steps: 17 + - name: Check for unused nix bindings 18 + command: | 19 + set -eo pipefail 20 + 21 + deadnix --exclude **/npins --no-underscore --fail | ansifilter