2024-07-07 08:34:47 +02:00
|
|
|
{
|
|
|
|
inputs ? import ./inputs.nix {},
|
|
|
|
selfPath ? ./.
|
|
|
|
}:
|
2024-06-17 07:54:59 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { inherit inputs; });
|
|
|
|
|
|
|
|
self = {
|
2024-07-07 08:16:17 +02:00
|
|
|
inherit inputs lib self;
|
2024-09-10 02:06:42 +02:00
|
|
|
outPath = selfPath;
|
2024-06-17 07:54:59 +02:00
|
|
|
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
|
|
|
|
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
|
|
|
|
overlays = {
|
2024-10-02 18:38:26 +02:00
|
|
|
cosmicPackages = import ./pkgs/overlays/cosmic-packages.nix { inherit inputs; };
|
2024-06-17 07:54:59 +02:00
|
|
|
selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; };
|
2025-01-12 21:54:47 +01:00
|
|
|
unstableWithMeta = import ./pkgs/overlays/unstable-with-meta.nix { unstableSource = inputs.nixpkgs-unstable; revision = inputs.lock.nixpkgs-unstable.revision; };
|
2024-06-17 07:54:59 +02:00
|
|
|
versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; };
|
|
|
|
};
|
|
|
|
nixosConfigurations = let
|
|
|
|
# list nix file paths in ./hosts to attributes in nixosConfigurations
|
2024-07-02 23:24:19 +02:00
|
|
|
filePaths = lib.pipe ./hosts [
|
|
|
|
builtins.readDir
|
|
|
|
( lib.filterAttrs (name: type:
|
2024-08-03 22:15:32 +02:00
|
|
|
( # regular .nix files
|
|
|
|
(type == "regular" && lib.hasSuffix ".nix" name)
|
|
|
|
|| # directories that contain a default.nix file
|
|
|
|
(type == "directory" && builtins.pathExists "${./hosts}/${name}/default.nix")
|
|
|
|
)
|
2024-06-17 07:54:59 +02:00
|
|
|
# filter out files that start with .
|
2024-07-02 23:24:19 +02:00
|
|
|
&& !lib.hasPrefix "." name
|
|
|
|
))
|
|
|
|
];
|
2024-06-17 07:54:59 +02:00
|
|
|
nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix";
|
|
|
|
in
|
|
|
|
# mapped list of nix file paths to attrSet with initialized NixOS configurations,
|
|
|
|
# whose names are derived from file names
|
2024-07-02 23:24:19 +02:00
|
|
|
lib.pipe filePaths [
|
2024-08-03 22:15:32 +02:00
|
|
|
(builtins.mapAttrs (name: type: {
|
|
|
|
name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name;
|
2024-07-02 23:24:19 +02:00
|
|
|
value = nixosSystem {
|
|
|
|
inherit lib;
|
|
|
|
modules = [
|
|
|
|
./hosts/${name}
|
|
|
|
{
|
|
|
|
config.nixpkgs.overlays = [
|
2024-07-07 08:34:47 +02:00
|
|
|
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } )
|
2024-07-09 06:34:10 +02:00
|
|
|
( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" )
|
2024-07-02 23:24:19 +02:00
|
|
|
self.overlays.versionInfoFixup
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
specialArgs = { inherit self inputs; };
|
|
|
|
};
|
|
|
|
}))
|
2024-08-03 22:15:32 +02:00
|
|
|
builtins.attrValues
|
2024-07-02 23:24:19 +02:00
|
|
|
builtins.listToAttrs
|
|
|
|
];
|
2024-06-17 07:54:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
in self
|