nixos/flake.nix

107 lines
3.0 KiB
Nix
Raw Normal View History

2024-05-08 00:45:54 +01:00
{
2024-05-15 21:46:48 +01:00
description = "Nix Config";
2024-05-08 00:45:54 +01:00
inputs = {
2024-05-09 12:03:13 +01:00
# Nixpkgs
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2024-05-08 00:45:54 +01:00
2024-05-09 12:03:13 +01:00
# Home manager
2024-05-15 21:46:48 +01:00
home-manager = {
2024-05-15 20:44:17 +01:00
url = "github:nix-community/home-manager";
2024-05-15 19:44:13 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
2024-05-12 19:58:55 +01:00
2024-05-14 14:51:09 +01:00
# Declarative partitioning and formatting
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-05-12 19:58:55 +01:00
# 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;
};
2024-05-08 00:45:54 +01:00
};
2024-05-09 12:03:13 +01:00
outputs = {
self,
nixpkgs,
home-manager,
2024-05-14 14:51:09 +01:00
disko,
2024-05-09 12:03:13 +01:00
...
2024-05-15 21:46:48 +01:00
} @ inputs:
let
2024-05-09 12:03:13 +01:00
inherit (self) outputs;
systems = [
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
2024-05-13 22:17:40 +01:00
specialArgs = { inherit inputs outputs; };
2024-05-09 12:03:13 +01:00
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;
2024-05-15 21:46:48 +01:00
# System level configs
2024-05-09 12:03:13 +01:00
nixosConfigurations = {
2024-05-11 13:49:12 +01:00
nixdev = nixpkgs.lib.nixosSystem {
2024-05-13 22:17:40 +01:00
inherit specialArgs;
2024-05-08 00:45:54 +01:00
modules = [
2024-05-11 13:49:12 +01:00
./hosts/nixdev
2024-05-13 22:17:40 +01:00
home-manager.nixosModules.home-manager{
home-manager.extraSpecialArgs = specialArgs;
}
2024-05-08 00:45:54 +01:00
];
};
2024-05-14 14:51:09 +01:00
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
2024-05-14 14:51:09 +01:00
./hosts/bootstrap
];
};
2024-05-08 00:45:54 +01:00
};
2024-05-09 12:03:13 +01:00
2024-05-13 22:17:40 +01:00
# # 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
# ];
# };
# };
2024-05-08 00:45:54 +01:00
};
}