nixos/flake.nix

116 lines
3.2 KiB
Nix

{
description = "Nix Config";
inputs = {
# Nixpkgs
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Home manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Declarative partitioning and formatting
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Secrets management
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-secrets = {
url = "git+ssh://git@git.bitlab21.com/sam/nix-secrets.git";
flake = false;
};
};
outputs = {
self,
nixpkgs,
home-manager,
disko,
...
} @ inputs:
let
inherit (self) outputs;
systems = [
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
specialArgs = { inherit inputs outputs; };
in {
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
overlays = import ./overlays {inherit inputs;};
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
# System level configs
nixosConfigurations = {
nixdev = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/nixdev
home-manager.nixosModules.home-manager{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
fileserver = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/fileserver
home-manager.nixosModules.home-manager{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
bootstrap = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
#disko.nixosModules.disko
#./hosts/common/disks/gpt-bios-compact.nix
#./hosts/common/disks/std-disk-config.nix
./hosts/bootstrap
];
};
media = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
#disko.nixosModules.disko
#./hosts/common/disks/gpt-bios-compact.nix
#./hosts/common/disks/std-disk-config.nix
./hosts/media
];
};
};
# # Standalone home-manager configuration entrypoint
# # Available through 'home-manager --flake .#your-username@your-hostname'
# homeConfigurations = {
# # FIXME replace with your username@hostname
# "sam@nixdev" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = {inherit inputs outputs ;};
# modules = [
# # > Our main home-manager configuration file <
# ./home/nixdev.nix
# ];
# };
# "admin@fileserver" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = {inherit inputs outputs ;};
# modules = [
# # > Our main home-manager configuration file <
# ./home/nixdev.nix
# ];
# };
# };
};
}