nix-server/flake.nix

63 lines
1.7 KiB
Nix
Executable file

{
description = "a collection of personal nix configurations";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
hardware.url = "github:nixos/nixos-hardware";
amdl.url = "git+https://git.reidlab.pink/reidlab/amdl.git";
vscode-server.url = "github:nix-community/nixos-vscode-server";
};
outputs = inputs @ { self, nixpkgs, systems, ... }:
let
inherit (lib.my) mapModules mapModulesRec mapHosts;
eachSystem = nixpkgs.lib.genAttrs (import systems);
lib = nixpkgs.lib.extend (final: prev: {
my = import ./lib {
inherit inputs;
lib = final;
pkgs = null;
};
});
mkPkgs = system: pkgs: extraOverlays:
import pkgs {
inherit system;
config.allowUnfree = true;
config.allowAliases = true;
overlays = extraOverlays ++ (lib.attrValues self.overlays);
};
pkgsFor = eachSystem (system:
mkPkgs system nixpkgs [
self.overlays.default
]
);
in {
lib = lib.my;
overlays = (mapModules ./overlays import) // {
default = final: prev: {
my = self.packages.${final.stdenv.hostPlatform.system};
};
};
packages = eachSystem (system: let
pkgs = pkgsFor.${system};
in
mapModules ./packages (p: pkgs.callPackage p {})
);
nixosModules = mapModulesRec ./modules import;
nixosConfigurations = mapHosts ./hosts { inherit pkgsFor; };
};
}