6AXNWM6FCBLT2AVGBIH7KXZ64PTF6RMRZ3U3LVQR5BSOFLW3RJCQC
{ lib, ... }:
{
loadHosts = hostsPath:
let
rakeLeaves = dirPath:
# Adapted from digga (https://github.com/divnix/digga/blob/main/src/importers.nix)
# This version does not support nested hosts; your host derivation must either reside in hosts/<hostname>.nix or hosts/<hostname>/default.nix
let
seive = file: type:
(type == "regular" && lib.hasSuffix ".nix" file) || (type == "directory");
collect = file: type: {
name = lib.removeSuffix ".nix" file;
value =
let
path = dirPath + "/${file}";
in
if (type == "regular") || (type == "directory" && builtins.pathExists (path + "/default.nix"))
then path
else throw "Your host must be a file named <hostname>.nix or a directory named <hostname> with a default.nix file in it";
};
files = lib.filterAttrs seive (builtins.readDir dirPath);
in
lib.filterAttrs (n: v: v != {}) (lib.mapAttrs' collect files);
in
{
nixosConfigurations = lib.mapAttrs
(name: value:
import value {
utils = import ./. {
inherit lib;
};
}
) (rakeLeaves hostsPath);
};
}
{ channel, ... }:
{
mkHost = { channel, allowUnfree ? true, sys, features }:
# Adapted from https://github.com/wiltaylor/dotfiles/blob/master/lib/host.nix
# let
# pkgs = import channel {
# system = sys;
# config = {
# inherit allowUnfree;
# };
# };
# in
channel.lib.nixosSystem {
system = sys;
modules = [];
};
}
{ channel, lib, ... }:
{
utils = import ./utils.nix { inherit lib; };
host = import ./host.nix { inherit channel; };
}
{ channel, utils, ... }:
utils.mkHost {
inherit channel;
sys = "x86_64-linux";
features = [];
}
{
description = "jmc-figueira's Delightful Declarative Dotfiles Deluxe";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# nixpkgs-master.url = "github:NixOS/nixpkgs/master";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
impermanence.url = "github:nix-community/impermanence";
};
outputs = { self, nixpkgs, home-manager, nur, impermanence }:
let
utils = import ./lib {
inherit (nixpkgs) lib;
}.utils;
in
utils.loadHosts ./hosts;
}
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1635808137,
"narHash": "sha256-UE/AYGHzp3PTvNjYaWaCmhRxkUJGUqh6vSQ7Yv8vNrs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "21590d40c1575ff77c96bbb0c7b151cfa788e100",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1635517258,
"narHash": "sha256-8iV8f9eZ/5cE0DmG7VmNSiCqpe00yL5HbOO7nZJm1Oo=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "ce77ed9bd069e57a7a688d360196e576ca63a842",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1635702959,
"narHash": "sha256-ZKxX9DjJJGJqq20pE4dIj1G4ssCLVXXRFerM6lNuF0k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e544ee88fa4590df75e221e645a03fe157a99e5b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1635820896,
"narHash": "sha256-DZZLlyggR182XQUnJgmknFJxxYdMLabYK0v0/jV2z6s=",
"owner": "nix-community",
"repo": "NUR",
"rev": "1855a9f4945cc24d2011d093b7f4f4efb388bc7b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixpkgs": "nixpkgs",
"nur": "nur"
}
}
},
"root": "root",
"version": 7
}