Refactor nix config
This commit is contained in:
@@ -1,44 +1,88 @@
|
||||
{
|
||||
description = "NixOS Shared Configuration";
|
||||
description = "Unified Nix Configuration";
|
||||
|
||||
inputs = {
|
||||
# Use nixos-unstable for latest packages
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# NixOS-WSL for WSL-specific functionality
|
||||
nixos-wsl = {
|
||||
url = "github:nix-community/NixOS-WSL";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Home Manager for user configuration
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-wsl, home-manager, ... }:
|
||||
outputs = { self, nixpkgs, nixos-wsl, home-manager, nix-darwin, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
linuxSystem = "x86_64-linux";
|
||||
darwinSystem = "aarch64-darwin";
|
||||
|
||||
pkgsLinux = nixpkgs.legacyPackages.${linuxSystem};
|
||||
pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem};
|
||||
in
|
||||
{
|
||||
|
||||
# --- NixOS Systems ---
|
||||
nixosConfigurations = {
|
||||
nix = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
# Work WSL
|
||||
work = nixpkgs.lib.nixosSystem {
|
||||
system = linuxSystem;
|
||||
specialArgs = { inherit self; };
|
||||
modules = [
|
||||
nixos-wsl.nixosModules.wsl
|
||||
|
||||
./hosts/work/configuration.nix
|
||||
|
||||
./hosts/work/nixos/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.pan = import ./hosts/work/home.nix;
|
||||
home-manager.users.pan = import ./hosts/work/nixos/home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Home
|
||||
home = nixpkgs.lib.nixosSystem {
|
||||
system = linuxSystem;
|
||||
specialArgs = { inherit self; };
|
||||
modules = [
|
||||
./hosts/home/nixos/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.martin = import ./hosts/home/nixos/home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# --- Darwin Systems (Mac) ---
|
||||
darwinConfigurations."Martins-MacBook-Pro" = nix-darwin.lib.darwinSystem {
|
||||
system = darwinSystem;
|
||||
specialArgs = { inherit self; };
|
||||
modules = [ ./hosts/home/darwin/configuration.nix ];
|
||||
};
|
||||
|
||||
# --- Standalone Home Manager ---
|
||||
homeConfigurations = {
|
||||
"pan@work" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = pkgsLinux;
|
||||
modules = [ ./hosts/work/nix/home.nix ];
|
||||
};
|
||||
|
||||
"martin@mac" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = pkgsDarwin;
|
||||
modules = [ ./hosts/home/nix/home.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user