infra/nix/flake.nix

103 lines
2.6 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.disko.url = "github:nix-community/disko";
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
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,
disko,
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
];
};
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 []
);
};
}
);
};
}