Test configuration

This commit is contained in:
2026-04-15 16:44:47 -05:00
parent bc2154400c
commit 5eb7399945
4 changed files with 302 additions and 22 deletions

108
flake.nix
View File

@@ -1,30 +1,94 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03";
description = "sonja - nixos configs - custom packages - home manager";
outputs = { self, nixpkgs }: {
inputs = {
lib-aggregate.url = "github:nix-community/lib-aggregate";
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
[ ({ pkgs, ... }: {
boot.isContainer = true;
cmpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
# Network configuration.
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [ 80 ];
# Enable a web server.
services.httpd = {
enable = true;
adminAddr = "morty@example.org";
};
})
];
home-manager = {
url = "github:nix-community/home-manager?ref=master";
inputs.nixpkgs.follows = "cmpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
sops-nix = {
url = "github:Mic92/sops-nix/master";
inputs.nixpkgs.follows = "cmpkgs";
};
determinate.url = "github:DeterminateSystems/determinate";
};
outputs = inputs:
let
defaultSystems = [ "x86_64-linux" ];
lib = inputs.lib-aggregate.lib;
importPkgs = npkgs: extraCfg:
lib.genAttrs defaultSystems (system:
import npkgs {
inherit system;
config = { allowAliases = false; } // extraCfg;
}
);
pkgs = importPkgs inputs.cmpkgs { };
pkgsUnfree = importPkgs inputs.cmpkgs { allowUnfree = true; };
mkSystem = n: _v:
let
defaults = {
npkgs = inputs.cmpkgs;
path = ./hosts/${n}/configuration.nix;
extraModules = [ ];
};
v = defaults // _v;
in
v.npkgs.lib.nixosSystem {
modules = [
v.path
inputs.home-manager.nixosModules.home-manager
] ++ v.extraModules;
specialArgs = { inherit inputs; };
};
## Top-level nixos configs, keyed by system
nixosConfigsEx = {
"x86_64-linux" = {
coven = { };
# circle = { };
};
};
nixosConfigs = lib.foldl' (op: nul: nul // op) { } (lib.attrValues nixosConfigsEx);
nixosConfigurations = lib.mapAttrs (n: v: mkSystem n v) nixosConfigs;
toplevels = lib.mapAttrs (_: v: v.config.system.build.toplevel) nixosConfigurations;
nixosModules = { };
overlays = { };
in
lib.recursiveUpdate
{
inherit nixosConfigs nixosConfigsEx nixosConfigurations toplevels;
inherit nixosModules overlays;
inherit pkgs pkgsUnfree;
}
(lib.flake-utils.eachSystem defaultSystems (system:
{
formatter = pkgs.${system}.nixfmt;
checks =
let
c_toplevels = lib.mapAttrs'
(n: v: lib.nameValuePair "toplevel-${n}" v.config.system.build.toplevel)
(lib.mapAttrs (n: v: mkSystem n v) nixosConfigsEx.${system});
in
c_toplevels;
}
));
}