From 030c61df52c182df940c2d7efcea21fde0f4cbc5 Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Sat, 3 May 2025 16:46:41 +0800 Subject: [PATCH] refactor: flake.nix --- flake.nix | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index 1cfffd9..17003a8 100644 --- a/flake.nix +++ b/flake.nix @@ -6,27 +6,26 @@ }; outputs = { nixpkgs, fenix, ... }: let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; in { - formatter.${system} = pkgs.nixpkgs-fmt; - devShells.${system}.default = pkgs.mkShell { - packages = with pkgs; [ - zsh - (fenix.packages.${system}.complete.withComponents [ - "cargo" - "clippy" - "rust-src" - "rustc" - "rustfmt" - "rust-analyzer" - ]) - ]; - shellHook = '' - zsh & disown - exit - ''; - }; + devShells = forAllSystems (system: + let pkgs = import nixpkgs { inherit system; }; in + { + default = pkgs.mkShell { + packages = with pkgs; [ + zsh + (fenix.packages.${system}.complete.withComponents [ + "cargo" + "clippy" + "rust-src" + "rustc" + "rustfmt" + "rust-analyzer" + ]) + ]; + }; + } + ); }; }