Skip to content

Commit

Permalink
treewide: Introduce statix
Browse files Browse the repository at this point in the history
  • Loading branch information
TLATER committed Nov 23, 2023
1 parent 9da8955 commit ad5eb8c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ in {
alejandra = callPackage ./alejandra.nix {};
deadnix = callPackage ./deadnix.nix {};
shellcheck = callPackage ./shellcheck.nix {};
statix = callPackage ./statix.nix {};
}
19 changes: 19 additions & 0 deletions checks/statix.nix
Original file line number Diff line number Diff line change
@@ -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
'';
}
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion home-config/config/desktop/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion home-config/config/graphical-applications/keepassxc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; [
Expand Down
2 changes: 1 addition & 1 deletion home-config/config/xdg-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"] ''
Expand Down
2 changes: 1 addition & 1 deletion home-modules/firefox-webapp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion nixos-config/greeter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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} - -"
Expand Down
2 changes: 1 addition & 1 deletion nixos-config/ren/disko.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{...}: let
_: let
disks = [
"/dev/sda"
];
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/deepfilternet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ad5eb8c

Please sign in to comment.