diff --git a/checks/default.nix b/checks/default.nix index afdf69b0..cda4f0c2 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -38,4 +38,5 @@ in { alejandra = callPackage ./alejandra.nix {}; deadnix = callPackage ./deadnix.nix {}; shellcheck = callPackage ./shellcheck.nix {}; + statix = callPackage ./statix.nix {}; } diff --git a/checks/statix.nix b/checks/statix.nix new file mode 100644 index 00000000..65ae8686 --- /dev/null +++ b/checks/statix.nix @@ -0,0 +1,19 @@ +{ + self, + lib, + mkTest, + statix, + generatedFiles, +}: let + inherit (lib) concatStringsSep sourceFilesBySuffices; + excludes = "--ignore ${concatStringsSep " " generatedFiles}"; +in + mkTest { + name = "lint-statix"; + src = sourceFilesBySuffices self [".nix"]; + checkInputs = [statix]; + checkPhase = '' + mkdir -p $out + statix check ${excludes} | tee $out/test.log + ''; + } diff --git a/flake.nix b/flake.nix index a657c777..13363ec1 100644 --- a/flake.nix +++ b/flake.nix @@ -119,14 +119,14 @@ }; checks.x86_64-linux = import ./checks { + inherit (nixpkgs) lib; pkgs = nixpkgs.legacyPackages.x86_64-linux; - lib = nixpkgs.lib; flake-inputs = inputs; }; devShells.x86_64-linux.default = let inherit (sops-nix.packages.x86_64-linux) sops-init-gpg-key sops-import-keys-hook; - commit-nvfetcher = self.packages.x86_64-linux.commit-nvfetcher; + inherit (self.packages.x86_64-linux) commit-nvfetcher; home-manager-bin = home-manager.packages.x86_64-linux.default; in nixpkgs.legacyPackages.x86_64-linux.mkShell { diff --git a/home-config/config/desktop/hyprland.nix b/home-config/config/desktop/hyprland.nix index 7e990bde..3eea2ddf 100644 --- a/home-config/config/desktop/hyprland.nix +++ b/home-config/config/desktop/hyprland.nix @@ -57,7 +57,7 @@ in { xdg.configFile."hypr/hyprland.conf" = { source = ../../dotfiles/hyprland.conf; onChange = let - hyprland = flake-inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprland; + inherit (flake-inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}) hyprland; in '' ( # execute in subshell so that `shopt` won't affect other scripts shopt -s nullglob # so that nothing is done if /tmp/hypr/ does not exist or is empty diff --git a/home-config/config/graphical-applications/keepassxc.nix b/home-config/config/graphical-applications/keepassxc.nix index 9596ef3a..6807b7c4 100644 --- a/home-config/config/graphical-applications/keepassxc.nix +++ b/home-config/config/graphical-applications/keepassxc.nix @@ -5,7 +5,7 @@ flake-inputs, ... }: let - nextcloudcmd = flake-inputs.self.packages.${pkgs.system}.nextcloudcmd; + inherit (flake-inputs.self.packages.${pkgs.system}) nextcloudcmd; in { config = lib.mkIf config.custom.graphical-applications { home.packages = with pkgs; [ diff --git a/home-config/config/xdg-settings.nix b/home-config/config/xdg-settings.nix index ed42fc0a..77d39648 100644 --- a/home-config/config/xdg-settings.nix +++ b/home-config/config/xdg-settings.nix @@ -6,7 +6,7 @@ }: let inherit (pkgs) writeText; inherit (lib.strings) concatStringsSep; - xdg = config.xdg; + inherit (config) xdg; in { home.activation = { xdg-dir-prep = lib.hm.dag.entryAfter ["writeBoundary"] '' diff --git a/home-modules/firefox-webapp.nix b/home-modules/firefox-webapp.nix index f031aed4..e13180d9 100644 --- a/home-modules/firefox-webapp.nix +++ b/home-modules/firefox-webapp.nix @@ -11,7 +11,7 @@ make-app-profiles = cfg: mapAttrs' (name: cfg: nameValuePair "home-manager-webapp-${name}" { - id = cfg.id; + inherit (cfg) id; userChrome = '' @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); diff --git a/nixos-config/greeter/default.nix b/nixos-config/greeter/default.nix index 1f9c2d20..30321fa4 100644 --- a/nixos-config/greeter/default.nix +++ b/nixos-config/greeter/default.nix @@ -71,7 +71,7 @@ in { ''; systemd.tmpfiles.rules = let - user = config.services.greetd.settings.default_session.user; + inherit (config.services.greetd.settings.default_session) user; in [ "d /var/log/gtkgreet 0755 greeter ${user} - -" "d /var/cache/gtkgreet 0755 greeter ${user} - -" diff --git a/nixos-config/ren/disko.nix b/nixos-config/ren/disko.nix index eb99ba9e..0faec2bf 100644 --- a/nixos-config/ren/disko.nix +++ b/nixos-config/ren/disko.nix @@ -1,4 +1,4 @@ -{...}: let +_: let disks = [ "/dev/sda" ]; diff --git a/pkgs/applications/deepfilternet.nix b/pkgs/applications/deepfilternet.nix index a9de2451..b8b1dd93 100644 --- a/pkgs/applications/deepfilternet.nix +++ b/pkgs/applications/deepfilternet.nix @@ -14,7 +14,7 @@ # Need to use unstable rust platform until this is resolved: # https://github.com/rust-lang/rust/issues/63292 rustPlatform = let - toolchain = flake-inputs.fenix.packages.${system}.minimal.toolchain; + inherit (flake-inputs.fenix.packages.${system}.minimal) toolchain; in makeRustPlatform { cargo = toolchain;