nixos-config/flake.nix
2025-03-10 21:11:14 +04:00

121 lines
3.3 KiB
Nix

{
description = "NixOS configuration of Laurent Le Houerou";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
self,
nixpkgs,
home-manager,
...
}: {
# Common configuration function to reduce repetition
nixosConfigurations = {
# VM configuration
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules = [
# Base system configuration
./system/base
# Desktop-specific configuration
./system/desktop
# Machine-specific configuration
./machines/vm
# Home-manager configuration
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = inputs;
home-manager.users.laurent = { ... }: {
imports = [
# Base home configuration
./home/base
# Desktop-specific home configuration
./home/desktop
];
};
}
];
};
# Desktop PC configuration
desktop-pc = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules = [
# Base system configuration
./system/base
# Desktop-specific configuration
./system/desktop
# Machine-specific configuration
./machines/desktop-pc
# Home-manager configuration
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = inputs;
home-manager.users.laurent = { ... }: {
imports = [
# Base home configuration
./home/base
# Desktop-specific home configuration
./home/desktop
];
};
}
];
};
# Home server configuration
home-server = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules = [
# Base system configuration
./system/base
# Server-specific configuration
./system/server
# Machine-specific configuration
./machines/home-server
# Home-manager configuration
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = inputs;
home-manager.users.laurent = { ... }: {
imports = [
# Base home configuration
./home/base
# Server-specific home configuration
./home/server
];
};
}
];
};
};
};
}