infra/nix/flake.nix

145 lines
3.7 KiB
Nix
Raw Normal View History

2023-10-15 22:16:06 +02:00
{
description = "NixOS configuration for all the things (as many as we can get)";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-10-15 22:16:06 +02:00
inputs.disko.url = "github:nix-community/disko";
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master";
2023-10-15 22:16:06 +02:00
inputs.agenix.url = "github:ryantm/agenix";
inputs.agenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.sops-nix.url = "github:Mic92/sops-nix";
inputs.attic.url = "github:zhaofengli/attic";
inputs.authentik-nix.url = "github:mayflower/authentik-nix";
outputs = {
self,
nixpkgs,
home-manager,
2023-10-15 22:16:06 +02:00
disko,
nixos-hardware,
2023-10-15 22:16:06 +02:00
agenix,
sops-nix,
attic,
authentik-nix,
...
}: let
projname = "nix-infra";
2023-11-05 00:17:44 +01:00
# nix.registry.nixpkgs.flake = nixpkgs;
2023-10-15 22:16:06 +02:00
system = "x86_64-linux";
supportedSystems = ["x86_64-linux" "aarch64-linux"];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [
# no overlay imports atm
];
});
2023-11-05 00:17:44 +01:00
# pkgs = nixpkgs.legacyPackages.${system};
pkgs = nixpkgsFor.${system};
inherit (nixpkgs.lib) nixosSystem;
2023-10-15 22:16:06 +02:00
in {
formatter = forAllSystems (
system:
nixpkgsFor.${system}.alejandra
);
# formatter.${system} = pkgs.alejandra;
nixosConfigurations.loki = nixpkgs.lib.nixosSystem {
2023-11-05 00:17:44 +01:00
# inherit pkgs system;
2023-10-15 22:16:06 +02:00
modules = [
disko.nixosModules.disko
agenix.nixosModules.default
sops-nix.nixosModules.sops
attic.nixosModules.atticd
authentik-nix.nixosModules.default
./hosts/loki/configuration.nix
];
};
nixosConfigurations.t14 = nixpkgs.lib.nixosSystem {
# inherit pkgs system;
modules = let
usr = "mko";
in [
nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen2
disko.nixosModules.disko
sops-nix.nixosModules.sops
./hosts/t14/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {inherit usr;};
home-manager.users.${usr} = {
home.stateVersion = "23.11";
imports = [
./hosts/t14/home.nix
];
};
}
];
};
nixosConfigurations.monoceros = nixpkgs.lib.nixosSystem {
# inherit pkgs system;
modules = [
disko.nixosModules.disko
sops-nix.nixosModules.sops
./hosts/monoceros/configuration.nix
];
};
2023-11-05 00:17:44 +01:00
nixosConfigurations.nixpi = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
# pkgs = nixpkgs.legacyPackages.${system};
# pkgs = nixpkgsFor.${system};
modules = [
sops-nix.nixosModules.sops
./hosts/nixpi/configuration.nix
];
};
2023-10-15 22:16:06 +02:00
devShells = forAllSystems (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
];
};
in {
default = with pkgs;
mkShell
{
name = "${projname}";
shellHook = ''
echo " -- in ${projname} dev shell..."
'';
nativeBuildInputs = [
];
packages =
[cachix]
++ (
if stdenv.isLinux
then [
]
else []
);
};
}
);
};
}