refactor(flake): extract more stuff in flake modules

`pkgs` redefinition (with overlays)
`nix-topology` setup
`agenix-rekey` setup
This commit is contained in:
reo101 2024-07-19 12:35:01 +03:00
parent b4e7901780
commit eeae48b5d8
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
4 changed files with 54 additions and 26 deletions

View file

@ -147,24 +147,16 @@
];
imports = [
inputs.agenix-rekey.flakeModule
inputs.nix-topology.flakeModule
] ++ [
./nix/pkgs.nix
./nix/machines.nix
./nix/modules.nix
./nix/configurations.nix
./nix/agenix.nix
./nix/deploy.nix
./nix/topology.nix
];
perSystem = { lib, pkgs, system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = lib.attrValues outputs.overlays ++ [
inputs.nix-topology.overlays.default
];
config = { };
};
# Packages (`nix build`)
packages = import ./pkgs { inherit pkgs; };
@ -176,21 +168,6 @@
# Formatter (`nix fmt`)
formatter = pkgs.nixpkgs-fmt;
topology = {
modules = [
];
nixosConfigurations = {
inherit (self.nixosConfigurations)
jeeves;
};
};
agenix-rekey = {
nodes = {
inherit (self.nixosConfigurations) jeeves;
};
};
};
flake = {

15
nix/agenix.nix Normal file
View file

@ -0,0 +1,15 @@
{ lib, config, self, inputs, ... }:
{
imports = [
inputs.agenix-rekey.flakeModule
];
perSystem = {
agenix-rekey = {
nodes = {
inherit (self.nixosConfigurations) jeeves;
};
};
};
}

13
nix/pkgs.nix Normal file
View file

@ -0,0 +1,13 @@
{ lib, config, self, inputs, ... }:
{
perSystem = { lib, pkgs, system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = lib.attrValues self.overlays ++ [
inputs.nix-topology.overlays.default
];
config = { };
};
};
}

23
nix/topology.nix Normal file
View file

@ -0,0 +1,23 @@
{ lib, config, self, inputs, ... }:
let
modules = [
{
}
];
in
{
imports = [
inputs.nix-topology.flakeModule
];
perSystem = {
topology = {
inherit modules;
nixosConfigurations = {
inherit (self.nixosConfigurations)
jeeves;
};
};
};
}