refactor: add perSystem func
This commit is contained in:
parent
d76c5a25a2
commit
807740ce7e
2 changed files with 21 additions and 19 deletions
|
@ -2,6 +2,7 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
home-manager,
|
||||||
nh,
|
nh,
|
||||||
nix-melt,
|
nix-melt,
|
||||||
nur,
|
nur,
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
|
|
||||||
nur.nixosModules.nur
|
nur.nixosModules.nur
|
||||||
nh.nixosModules.default
|
nh.nixosModules.default
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
@ -59,6 +61,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Global hm settings
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
home-manager.users = let
|
home-manager.users = let
|
||||||
default = {
|
default = {
|
||||||
imports = [
|
imports = [
|
||||||
|
|
34
flake.nix
34
flake.nix
|
@ -1,47 +1,43 @@
|
||||||
{
|
{
|
||||||
outputs = {
|
outputs = inputs @ {
|
||||||
self,
|
self,
|
||||||
home-manager,
|
home-manager,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
...
|
...
|
||||||
} @ attrs: let
|
}: let
|
||||||
supportedSystems = [
|
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
];
|
|
||||||
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
perSystem = attrs:
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
|
nixpkgs.lib.genAttrs supportedSystems (system: let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in
|
||||||
|
attrs system pkgs);
|
||||||
|
|
||||||
|
# Default system
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = inputs;
|
||||||
defaultModules = [
|
defaultModules = [
|
||||||
home-manager.nixosModules.home-manager
|
{home-manager.extraSpecialArgs = inputs;}
|
||||||
{
|
|
||||||
home-manager.extraSpecialArgs = attrs;
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
}
|
|
||||||
./common
|
./common
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
wim = nixpkgs.lib.nixosSystem {
|
wim = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system specialArgs;
|
||||||
specialArgs = attrs;
|
|
||||||
modules =
|
modules =
|
||||||
defaultModules
|
defaultModules
|
||||||
++ [./devices/wim];
|
++ [./devices/wim];
|
||||||
};
|
};
|
||||||
|
|
||||||
binto = nixpkgs.lib.nixosSystem {
|
binto = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system specialArgs;
|
||||||
specialArgs = attrs;
|
|
||||||
modules =
|
modules =
|
||||||
defaultModules
|
defaultModules
|
||||||
++ [./devices/binto];
|
++ [./devices/binto];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra);
|
formatter = perSystem (_: pkgs: pkgs.alejandra);
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
|
Loading…
Reference in a new issue