From 2867f0e8e26ef2a03809e55e91027709b6a8153f Mon Sep 17 00:00:00 2001 From: Parthiv Seetharaman Date: Wed, 20 Apr 2022 21:13:28 -0700 Subject: [PATCH] Switch to alejandra for formatting --- devShell.nix | 4 ++-- examples/devos/overlays/overrides.nix | 2 +- examples/devos/shell/devos.nix | 2 +- examples/devos/shell/hooks/pre-commit.sh | 2 +- flake.lock | 27 +++++------------------- flake.nix | 7 +++--- 6 files changed, 13 insertions(+), 31 deletions(-) diff --git a/devShell.nix b/devShell.nix index a656db7..f50459a 100644 --- a/devShell.nix +++ b/devShell.nix @@ -92,7 +92,7 @@ devshell.mkShell { name = "digga"; packages = with pkgs; [ fd - nixpkgs-fmt + alejandra nixUnstable ]; @@ -130,7 +130,7 @@ devshell.mkShell { (utils { name = "fmt"; help = "Check Nix formatting"; - command = "nixpkgs-fmt \${@} $PRJ_ROOT"; + command = "alejandra \${@} $PRJ_ROOT"; }) (utils { name = "evalnix"; diff --git a/examples/devos/overlays/overrides.nix b/examples/devos/overlays/overrides.nix index e35ad7e..77d55ee 100644 --- a/examples/devos/overlays/overrides.nix +++ b/examples/devos/overlays/overrides.nix @@ -8,8 +8,8 @@ channels: final: prev: { discord element-desktop rage - nixpkgs-fmt qutebrowser + alejandra signal-desktop starship deploy-rs diff --git a/examples/devos/shell/devos.nix b/examples/devos/shell/devos.nix index 581aee9..9c04ad2 100644 --- a/examples/devos/shell/devos.nix +++ b/examples/devos/shell/devos.nix @@ -39,7 +39,7 @@ in help = pkgs.nvfetcher-bin.meta.description; command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@"; } - (linter nixpkgs-fmt) + (linter alejandra) (linter editorconfig-checker) # (docs python3Packages.grip) too many deps (docs mdbook) diff --git a/examples/devos/shell/hooks/pre-commit.sh b/examples/devos/shell/hooks/pre-commit.sh index 985d3b4..296063d 100755 --- a/examples/devos/shell/hooks/pre-commit.sh +++ b/examples/devos/shell/hooks/pre-commit.sh @@ -15,7 +15,7 @@ all_files=($($diff)) # Format staged nix files. if [[ -n "${nix_files[@]}" ]]; then - nixpkgs-fmt "${nix_files[@]}" \ + alejandra "${nix_files[@]}" \ && git add "${nix_files[@]}" fi diff --git a/flake.lock b/flake.lock index 28fbdaf..b0947fd 100644 --- a/flake.lock +++ b/flake.lock @@ -19,7 +19,7 @@ "inputs": { "flake-compat": "flake-compat", "nixpkgs": [ - "latest" + "nixpkgs" ], "utils": "utils" }, @@ -138,22 +138,6 @@ "type": "github" } }, - "latest": { - "locked": { - "lastModified": 1638198142, - "narHash": "sha256-plU9b8r4St6q4U7VHtG9V7oF8k9fIpfXl/KDaZLuY9k=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "8a308775674e178495767df90c419425474582a1", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixlib": { "locked": { "lastModified": 1641688481, @@ -171,16 +155,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1648648646, - "narHash": "sha256-pHAq/GvsP7zRHkUTCs+4d31C0IEtTIuC6/TFASIA+zg=", + "lastModified": 1650161686, + "narHash": "sha256-70ZWAlOQ9nAZ08OU6WY7n4Ij2kOO199dLfNlvO/+pf8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "efea022d6fe0da84aa6613d4ddeafb80de713457", + "rev": "1ffba9f2f683063c2b14c9f4d12c55ad5f4ed887", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-21.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -193,7 +177,6 @@ "flake-compat": "flake-compat_2", "flake-utils-plus": "flake-utils-plus", "home-manager": "home-manager", - "latest": "latest", "nixlib": "nixlib", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index f3c32b9..04a75e6 100644 --- a/flake.nix +++ b/flake.nix @@ -8,14 +8,13 @@ inputs = { # Track channels with commits tested and built by hydra - nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11"; - latest.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixlib.url = "github:nix-community/nixpkgs.lib"; blank.url = "github:divnix/blank"; deploy.url = "github:serokell/deploy-rs"; - deploy.inputs.nixpkgs.follows = "latest"; + deploy.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager/release-21.11"; home-manager.inputs.nixpkgs.follows = "nixlib"; @@ -33,7 +32,6 @@ { self , nixlib , nixpkgs - , latest , deploy , devshell , flake-utils-plus @@ -125,6 +123,7 @@ ''; # digga-local use + formatter = nixlib.lib.genAttrs supportedSystems (s: nixpkgs.legacyPackages.${s}.alejandra); # system-space and pass sytem and input to each file jobs = polyfillOutput ./jobs; checks = polyfillOutput ./checks;