Files
dot/nix/flake.nix
2026-02-09 12:17:34 +01:00

152 lines
4.6 KiB
Nix

{
description = "Unified Nix Configuration";
inputs = {
# Unstable for home-manager
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Stable for home system (aarch64 server)
nixpkgs-home-stable.url = "github:nixos/nixpkgs/nixos-25.11";
# Stable for work system (WSL)
nixpkgs-work-stable.url = "github:nixos/nixpkgs/nixos-25.05";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs-work-stable";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
tasksquire = {
url = "git+ssh://git@git.pander.me/martin/tasksquire.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-home-stable, nixpkgs-work-stable, nixos-wsl, home-manager, nix-darwin, sops-nix, ... }@inputs:
let
linuxSystem = "x86_64-linux";
linuxAarchSystem = "aarch64-linux";
darwinSystem = "aarch64-darwin";
pkgsLinux = nixpkgs.legacyPackages.${linuxSystem};
pkgsLinuxAarch = nixpkgs.legacyPackages.${linuxAarchSystem};
pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem};
in
{
# --- NixOS Systems ---
nixosConfigurations = {
# Work WSL
work = nixpkgs-work-stable.lib.nixosSystem {
system = linuxSystem;
specialArgs = {
inherit self inputs;
# Provide both stable and unstable pkgs
pkgs-stable = import nixpkgs-work-stable {
system = linuxSystem;
config.allowUnfree = true;
};
pkgs-unstable = import nixpkgs {
system = linuxSystem;
config.allowUnfree = true;
};
};
modules = [
nixos-wsl.nixosModules.wsl
./hosts/work/nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = false;
home-manager.useUserPackages = false;
home-manager.extraSpecialArgs = {
inherit self inputs;
pkgs = import nixpkgs {
system = linuxSystem;
config.allowUnfree = true;
};
};
home-manager.users.pan = import ./hosts/work/nixos/home.nix;
}
];
};
# Home
home = nixpkgs-home-stable.lib.nixosSystem {
system = linuxAarchSystem;
specialArgs = {
inherit self inputs;
# Provide both stable and unstable pkgs
pkgs-stable = import nixpkgs-home-stable {
system = linuxAarchSystem;
config.allowUnfree = true;
};
pkgs-unstable = import nixpkgs {
system = linuxAarchSystem;
config.allowUnfree = true;
};
};
modules = [
./hosts/home/nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = false;
home-manager.useUserPackages = false;
home-manager.extraSpecialArgs = {
inherit self inputs;
pkgs = import nixpkgs {
system = linuxAarchSystem;
config.allowUnfree = 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 inputs; };
modules = [ ./hosts/home/darwin/configuration.nix ];
};
# --- Standalone Home Manager ---
homeConfigurations = {
"pan@work" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = linuxSystem;
config.allowUnfree = true;
};
extraSpecialArgs = { inherit self inputs; };
modules = [ ./hosts/work/nix/home.nix ];
};
"martin@mac" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = darwinSystem;
config.allowUnfree = true;
};
extraSpecialArgs = { inherit self inputs; };
modules = [ ./hosts/home/nix/home.nix ];
};
};
};
}