Files
dot/flake.nix
2026-03-11 09:45:47 +01:00

150 lines
4.7 KiB
Nix

{
description = "Unified Nix Configuration";
inputs = {
# Unstable for standalone configurations and overlays
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.11";
nixpkgs-wsl-stable.url = "github:nixos/nixpkgs/nixos-25.11";
nixos-wsl = {
url = "github:nix-community/nixos-wsl/release-25.11";
inputs.nixpkgs.follows = "nixpkgs-wsl-stable";
};
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
home-manager-wsl = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs-wsl-stable";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
# individual packages
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-vscode-server = {
url = "github:nix-community/nixos-vscode-server";
inputs.nixpkgs.follows = "nixpkgs";
};
tasksquire = {
url = "git+ssh://git@git.pander.me/martin/tasksquire.git?ref=dev";
};
};
outputs = { self, nixpkgs, nixpkgs-stable, nixpkgs-wsl-stable, nixos-wsl, home-manager, home-manager-wsl, nix-darwin, ... }@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
"nixos@work" = nixpkgs-wsl-stable.lib.nixosSystem {
specialArgs = { inherit self inputs; };
modules = [
nixos-wsl.nixosModules.wsl
./hosts/work/nixos/configuration.nix
home-manager.nixosModules.home-manager
{
nixpkgs.hostPlatform = linuxSystem;
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ (import ./modules/overlays/unstable.nix nixpkgs) ];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit self inputs;
};
home-manager.users.pan = import ./hosts/work/nixos/home.nix;
}
inputs.nixos-vscode-server.nixosModules.default
({ pkgs, ... }: {
services.vscode-server.enable = true;
})
];
};
# Home
"nixos@home" = nixpkgs-stable.lib.nixosSystem {
specialArgs = {
inherit self inputs;
};
modules = [
./hosts/home/nixos/configuration.nix
home-manager.nixosModules.home-manager
{
nixpkgs.hostPlatform = linuxAarchSystem;
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ (import ./modules/overlays/unstable.nix nixpkgs) ];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit self inputs;
};
home-manager.users.martin = import ./hosts/home/nixos/home.nix;
}
];
};
};
# --- Darwin Systems (Mac) ---
darwinConfigurations."Martins-MacBook-Pro" = nix-darwin.lib.darwinSystem {
specialArgs = { inherit self inputs; };
modules = [
./hosts/home/darwin/configuration.nix
{
nixpkgs.hostPlatform = darwinSystem;
}
];
};
# --- Standalone Home Manager ---
homeConfigurations = {
"nix@work" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs-stable.legacyPackages.${linuxSystem};
extraSpecialArgs = { inherit self inputs; };
modules = [
./hosts/work/nix/home.nix
{
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ (import ./modules/overlays/unstable.nix nixpkgs) ];
}
];
};
"nix@home" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs-stable.legacyPackages.${darwinSystem};
extraSpecialArgs = { inherit self inputs; };
modules = [
./hosts/home/nix/home.nix
{
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ (import ./modules/overlays/unstable.nix nixpkgs) ];
}
];
};
};
};
}