mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
61 lines
1.6 KiB
Nix
61 lines
1.6 KiB
Nix
{
|
|
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
|
inputs.impermanence.url = "github:nix-community/impermanence";
|
|
|
|
outputs = { self, nixpkgs, impermanence }:
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
|
|
mypkgs = pkgs:
|
|
self.lib.dirToAttrs ./pkgs (x: pkgs.callPackage x { }) //
|
|
{
|
|
iso = import lib/gen-iso.nix lib pkgs.system;
|
|
};
|
|
|
|
forAllSystems = lib.genAttrs [ "x86_64-linux" ];
|
|
|
|
in
|
|
{
|
|
formatter = forAllSystems (system:
|
|
nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
|
|
|
|
lib = {
|
|
gen-ssh-config = import lib/gen-ssh-config.nix lib;
|
|
ssh-keys = import lib/ssh-keys.nix;
|
|
|
|
dirToAttrs = dir: f: lib.mapAttrs'
|
|
(name: _: {
|
|
name = lib.removeSuffix ".nix" name;
|
|
value = f "${toString dir}/${name}";
|
|
})
|
|
(builtins.readDir dir);
|
|
};
|
|
|
|
nixosModules =
|
|
{
|
|
inherit (impermanence.nixosModules) impermanence;
|
|
pkgs.nixpkgs.overlays = [ (_: mypkgs) ];
|
|
pins.nix.registry.bck.to = {
|
|
owner = "buckley310";
|
|
repo = "nixos-config";
|
|
type = "github";
|
|
};
|
|
} //
|
|
self.lib.dirToAttrs ./modules import;
|
|
|
|
nixosConfigurations = self.lib.dirToAttrs ./hosts
|
|
(dir:
|
|
let cfg = import dir;
|
|
in lib.nixosSystem {
|
|
inherit (cfg) system;
|
|
modules =
|
|
cfg.modules ++
|
|
[{ networking.hostName = builtins.baseNameOf dir; }] ++
|
|
(builtins.attrValues self.nixosModules);
|
|
}
|
|
);
|
|
|
|
packages = forAllSystems (system:
|
|
mypkgs nixpkgs.legacyPackages.${system});
|
|
};
|
|
}
|