flake: refactor

This commit is contained in:
Guanran Wang 2024-03-09 12:06:08 +08:00
parent db92d6ed01
commit f457676f1c
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8

View file

@ -118,8 +118,10 @@
};
};
outputs = inputs: let
inherit (inputs.flake-utils.lib) eachDefaultSystemMap;
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = inputs.nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
mkNixOS = system: modules:
inputs.nixpkgs.lib.nixosSystem {
@ -132,13 +134,20 @@
inherit system modules;
specialArgs = {inherit inputs;};
};
treefmtEval = eachDefaultSystemMap (system: inputs.treefmt-nix.lib.evalModule inputs.nixpkgs.legacyPackages.${system} ./treefmt.nix);
in {
formatter = eachDefaultSystemMap (system: treefmtEval.${system}.config.build.wrapper);
checks = eachDefaultSystemMap (system: {formatting = treefmtEval.${system}.config.build.check inputs.self;});
packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system});
### nix fmt
formatter = treefmtEval.config.build.wrapper;
### nix flake check
checks = {formatting = treefmtEval.config.build.check inputs.self;};
### nix {run,shell,build}
packages = import ./pkgs pkgs;
### nixpkgs.overlays = [];
overlays = import ./overlays;
### imports = [];
nixosModules.default = ./nixos/modules;
darwinModules.default = ./darwin/modules;
homeManagerModules.default = ./home/modules;
@ -154,5 +163,5 @@
"plato" = mkDarwin "x86_64-darwin" [./hosts/plato];
"whitesteel" = mkDarwin "x86_64-darwin" [./hosts/whitesteel];
};
};
});
}