some refactor in WIP

This commit is contained in:
2025-12-19 07:46:32 +03:00
parent 6c36a5ec30
commit c47ad94679
9 changed files with 266 additions and 73 deletions
+37 -41
View File
@@ -17,63 +17,59 @@
inputs.home-manager.follows = "home-manager";
};
# Per-user settings (override locally; keep stub tracked)
personal = {
url = "path:./personal.stub.nix";
flake = false;
};
# Per-machine hardware config (override locally; keep stub tracked)
hw = {
url = "path:./nixos/hardware-stub.nix";
flake = false;
};
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
personal = import inputs.personal;
username = personal.username or "krosh";
host = personal.host or "loki-nixos";
gitName = personal.gitName or "Dmitrii Gudov";
gitEmail = personal.gitEmail or "gudovdo@my.msu.ru";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations.${username} =
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home-manager/home.nix ];
extraSpecialArgs = { inherit inputs username gitName gitEmail; };
mkHost = { hostName, system ? "x86_64-linux" }:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs username gitName gitEmail hostName; };
modules = [
./hosts/${hostName}/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${username} = import ./home-manager/home.nix;
home-manager.extraSpecialArgs = {
inherit inputs username gitName gitEmail;
};
}
];
};
pkgsFor = system: nixpkgs.legacyPackages.${system};
nixosConfigurations.${host} = nixpkgs.lib.nixosSystem {
inherit system;
in {
# homeConfigurations.${username} =
# home-manager.lib.homeManagerConfiguration {
# pkgs = pkgsFor "x86_64-linux";
# modules = [ ./home-manager/home.nix ];
# extraSpecialArgs = { inherit inputs username gitName gitEmail; };
# };
# if your NixOS modules want these too
specialArgs = { inherit inputs username gitName gitEmail; };
modules = [
# hardware-configuration comes from `inputs.hw`
(import inputs.hw)
./nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${username} = import ./home-manager/home.nix;
home-manager.extraSpecialArgs = {
inherit inputs username gitName gitEmail;
};
}
];
nixosConfigurations = {
loki-nixos = mkHost {
hostName = "loki-nixos";
system = "x86_64-linux";
};
fenrir-nixos = mkHost {
hostName = "fenrir-nixos";
system = "x86_64-linux";
};
};
};
}