75 lines
1.9 KiB
Nix
75 lines
1.9 KiB
Nix
{
|
|
description = "My NixOS configuration with flakes and home-manager";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
|
|
|
};
|
|
|
|
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
|
|
# Функция создания хоста
|
|
mkHost = { hostname, username, system ? "x86_64-linux", extraModules ? [ ] }:
|
|
nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
specialArgs = {
|
|
inherit inputs;
|
|
hostname = hostname;
|
|
username = username;
|
|
};
|
|
|
|
modules = [
|
|
# Системные модули
|
|
./hosts/default/configuration.nix
|
|
./hosts/${hostname}/configuration.nix
|
|
|
|
# Home Manager модуль
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager = {
|
|
useGlobalPkgs = true;
|
|
useUserPackages = true;
|
|
|
|
users.${username} = import ./home/users/${username}.nix;
|
|
|
|
# Дополнительные аргументы для home-manager
|
|
extraSpecialArgs = {
|
|
inherit inputs;
|
|
hostname = hostname;
|
|
};
|
|
};
|
|
}
|
|
] ++ extraModules;
|
|
};
|
|
|
|
in {
|
|
nixosConfigurations = {
|
|
desktop = mkHost {
|
|
hostname = "thek4n.ru";
|
|
username = "thek4n";
|
|
extraModules = [
|
|
./hosts/thek4n/hardware.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
devShells.${system}.default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
buildInputs = with nixpkgs.legacyPackages.${system}; [
|
|
nixpkgs-fmt
|
|
nixd
|
|
git
|
|
];
|
|
};
|
|
};
|
|
}
|