refactor: add perSystem func

This commit is contained in:
matt1432 2023-12-03 04:50:17 -05:00
parent d76c5a25a2
commit 807740ce7e
2 changed files with 21 additions and 19 deletions

View file

@ -2,6 +2,7 @@
config,
lib,
nixpkgs,
home-manager,
nh,
nix-melt,
nur,
@ -18,6 +19,7 @@
nur.nixosModules.nur
nh.nixosModules.default
home-manager.nixosModules.home-manager
];
nixpkgs.config.allowUnfree = true;
@ -59,6 +61,10 @@
};
};
# Global hm settings
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users = let
default = {
imports = [

View file

@ -1,47 +1,43 @@
{
outputs = {
outputs = inputs @ {
self,
home-manager,
nixpkgs,
...
} @ attrs: let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
perSystem = attrs:
nixpkgs.lib.genAttrs supportedSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in
attrs system pkgs);
# Default system
system = "x86_64-linux";
specialArgs = inputs;
defaultModules = [
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = attrs;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
{home-manager.extraSpecialArgs = inputs;}
./common
];
in {
nixosConfigurations = {
wim = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
inherit system specialArgs;
modules =
defaultModules
++ [./devices/wim];
};
binto = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
inherit system specialArgs;
modules =
defaultModules
++ [./devices/binto];
};
};
formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra);
formatter = perSystem (_: pkgs: pkgs.alejandra);
};
inputs = {