refactor: pivot to lovesegfault's config structure

This commit is contained in:
oddlama 2022-12-08 23:41:07 +01:00
parent d7e6ab7071
commit 04fc94267a
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
29 changed files with 588 additions and 1150 deletions

170
flake.nix
View file

@ -1,122 +1,76 @@
{
description = "Personal Infrastructure";
inputs.std.url = "github:divnix/std";
inputs.std.inputs.nixpkgs.follows = "nixpkgs";
inputs.std.inputs.mdbook-kroki-preprocessor.follows = "std/blank";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
description = "oddlama's NixOS Infrastructure";
# tools
inputs = {
nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
nixos-generators.inputs.nixlib.follows = "nixpkgs";
colmena.url = "github:zhaofengli/colmena";
colmena.inputs.nixpkgs.follows = "nixpkgs";
colmena.inputs.stable.follows = "std/blank";
colmena.inputs.flake-utils.follows = "std/flake-utils";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:nixos/nixos-hardware";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
utils.follows = "flake-utils";
};
};
# nixpkgs & home-manager
inputs = {
nixos.follows = "nixpkgs";
home.url = "github:nix-community/home-manager";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
};
impermanence.url = "github:nix-community/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.flake-compat.follows = "flake-compat";
};
ragenix = {
url = "github:yaxitech/ragenix";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
templates.url = "github:NixOS/templates";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
std,
self,
nixpkgs,
flake-utils,
...
} @ inputs:
std.growOn {
inherit inputs;
cellsFrom = ./nix;
# debug = ["cells" "x86_64-linux"];
cellBlocks = with std.blockTypes; [
# modules implement
(functions "nixosModules")
(functions "homeModules")
(functions "devshellModules")
{
deploy = import ./nix/deploy.nix inputs;
overlays = import ./nix/overlay.nix inputs;
homeConfigurations = import ./nix/home-manager.nix inputs;
nixosConfigurations = import ./nix/nixos.nix inputs;
}
// flake-utils.lib.eachSystem ["aarch64-linux" "x86_64-linux"] (localSystem: {
checks = import ./nix/checks.nix inputs localSystem;
devShells.default = import ./nix/dev-shell.nix inputs localSystem;
# profiles activate
(functions "hardwareProfiles")
(functions "nixosProfiles")
(functions "homeProfiles")
(functions "devshellProfiles")
packages =
{
default = self.packages.${localSystem}.all;
}
// (import ./nix/host-drvs.nix inputs localSystem);
# suites aggregate profiles
(functions "nixosSuites")
(functions "homeSuites")
# configurations can be deployed
(data "nixosConfigurations")
(data "colmenaConfigurations")
(data "homeConfigurations")
(data "diskoConfigurations")
# devshells can be entered
(devshells "devshells")
# jobs can be run
(runnables "jobs")
# library holds shared knowledge made code
(functions "library")
];
nixpkgsConfig = {
allowUnfree = true;
pkgs = import nixpkgs {
inherit localSystem;
overlays = [
self.overlays.default
];
config.allowUnfree = true;
};
}
# soil
{
packages.x86_64-linux = {inherit (inputs.disko.packages.x86_64-linux) disko;};
devShells = std.harvest self ["_QUEEN" "devshells"];
}
{
# tool: colmena -- "fill the jar on the soil with the honey!"
colmenaHive = let
makeHoneyFrom = import ./make-honey.nix {
inherit (inputs) colmena nixpkgs;
cellBlock = "colmenaConfigurations";
};
in
makeHoneyFrom self;
# tool: nixos-generators -- "get drunk like a bear!"
nixosConfigurations = let
makeMeadFrom = import ./make-mead.nix {
inherit (inputs) nixpkgs;
cellBlock = "nixosConfigurations";
};
in
makeMeadFrom self;
# tool: home-manager -- "drunken sailor, sunken sailor; honeymoon pantaloon."
homeConfigurations = let
makeMoonshineFrom = import ./make-moonshine.nix {
inherit (inputs) nixpkgs;
cellBlock = "homeConfigurations";
};
in
makeMoonshineFrom self;
# tool: disko -- "Tiganizatia, tiganizatia - disko, disko partizani."
diskoConfigurations = let
makeShantyFrom = import ./make-shanty.nix {
inherit (inputs) nixpkgs;
cellBlock = "diskoConfigurations";
};
in
makeShantyFrom self;
};
# --- Flake Local Nix Configuration ----------------------------
# TODO: adopt spongix
nixConfig = {
extra-substituters = [];
extra-trusted-public-keys = [];
};
# --------------------------------------------------------------
});
}