nibylandia/flake.nix

122 lines
3.8 KiB
Nix
Raw Permalink Normal View History

2023-09-03 13:35:16 +02:00
{
description = "Nibylandia configurations";
inputs = {
2024-12-14 15:35:20 +01:00
# nixpkgs.url = "git+file:///home/ar/scm/nixpkgs";
2024-03-30 19:57:36 +01:00
nixpkgs.url = "github:arachnist/nixpkgs/ar-patchset-unstable";
2023-09-03 13:35:16 +02:00
nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack";
deploy-rs.url = "github:serokell/deploy-rs";
2024-09-17 11:35:45 +02:00
colmena.url = "github:zhaofengli/colmena/main";
2023-09-03 13:35:16 +02:00
agenix = {
url = "github:ryantm/agenix";
inputs.darwin.follows = "";
};
lanzaboote = {
url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-10-14 23:24:33 +02:00
simple-nixos-mailserver = {
# url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
url = "github:arachnist/nixos-mailserver";
2023-10-14 23:24:33 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
jovian-nixos = {
2023-12-20 16:13:47 +01:00
url = "github:Jovian-Experiments/Jovian-NixOS";
2023-12-11 07:47:06 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
nix-comfyui.url = "github:dyscorv/nix-comfyui";
2024-12-04 13:37:17 +01:00
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-12-14 21:32:16 +01:00
raspberry-pi-nix.url = "github:nix-community/raspberry-pi-nix";
2023-09-03 13:35:16 +02:00
};
2024-12-04 13:37:17 +01:00
outputs = { self, nixpkgs, deploy-rs, ... }@inputs:
2023-10-09 01:21:05 +02:00
let
systems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
2023-10-09 01:21:05 +02:00
pkgsForDeploy =
forAllSystems (system: import nixpkgs { inherit system; });
deployPkgs = forAllSystems (system:
let pkgs = pkgsForDeploy.${system};
in import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlay
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
inherit (super.deploy-rs) lib;
};
})
];
});
inherit (nixpkgs) lib;
2023-11-30 21:55:15 +01:00
meta = import ./meta.nix;
2023-09-03 13:35:16 +02:00
in {
formatter = forAllSystems (system:
inputs.nix-formatter-pack.lib.mkFormatter {
2023-09-03 13:35:16 +02:00
inherit nixpkgs system;
config = {
tools = {
deadnix = {
enable = true;
noLambdaPatternNames = true;
noLambdaArg = true;
};
statix.enable = true;
nixfmt.enable = true;
};
};
});
2023-10-14 23:24:33 +02:00
overlays = import ./overlays;
2023-10-20 19:24:57 +02:00
nixosModules = lib.mapAttrs' (name: value:
lib.nameValuePair (builtins.replaceStrings [ ".nix" ] [ "" ] name) {
imports = [ (./modules/. + "/${name}") ];
}) (builtins.readDir ./modules);
nixosConfigurations = builtins.mapAttrs (name: value:
nixpkgs.lib.nixosSystem {
2023-11-30 21:55:15 +01:00
inherit (value) system;
modules = [
(./nixos/. + "/${name}")
{
nixpkgs.system = value.system;
} # need to set this explicitly for colmena
];
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
2023-10-20 00:11:57 +02:00
specialArgs = { inherit inputs; };
2023-11-30 21:55:15 +01:00
}) meta.hosts;
deploy.nodes = builtins.mapAttrs (name: value: {
2023-10-08 22:07:57 +00:00
fastConnection = false;
remoteBuild = true;
hostname = value.config.deployment.targetHost;
2023-10-08 22:07:57 +00:00
profiles.system = {
user = "root";
sshUser = "root";
path =
deployPkgs.${value.config.nixpkgs.system}.deploy-rs.lib.activate.nixos
value;
2023-10-08 22:07:57 +00:00
};
}) self.nixosConfigurations;
colmena = {
meta = {
nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs)
self.nixosConfigurations;
specialArgs.lib = lib;
2023-10-14 23:24:33 +02:00
};
} // builtins.mapAttrs (_: v: { imports = v._module.args.modules; })
self.nixosConfigurations;
2023-10-14 23:24:33 +02:00
2023-09-03 13:35:16 +02:00
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}