my over complex system configurations
dotfiles.isabelroses.com/
nixos
nix
flake
dotfiles
linux
1# following https://github.com/NixOS/nixpkgs/blob/77ee426a4da240c1df7e11f48ac6243e0890f03e/lib/default.nix
2# as a rough template we can create our own extensible lib and expose it to the flake
3# we can then use that elsewhere like our hosts
4{ lib, inputs, ... }:
5let
6 gardenLib = lib.fixedPoints.makeExtensible (final: {
7 # keep-sorted start block=yes
8 hardware = import ./hardware.nix;
9 helpers = import ./helpers.nix { inherit lib; };
10 secrets = import ./secrets.nix { inherit inputs; };
11 services = import ./services.nix { inherit lib; };
12 template = import ./template; # templates, selections of code that are repeated
13 validators = import ./validators.nix { inherit lib; };
14 # keep-sorted end
15
16 # we have to rexport the functions we want to use, but don't want to refer to the whole lib
17 # "path". e.g. gardenLib.hardware.isx86Linux can be shortened to gardenLib.isx86Linux
18 # NOTE: never rexport templates
19 inherit (final.hardware) isx86Linux ldTernary;
20 inherit (final.helpers)
21 mkPubs
22 giturl
23 filterNixFiles
24 importNixFiles
25 importNixFilesAndDirs
26 boolToNum
27 containsStrings
28 indexOf
29 intListToStringList
30 ;
31 inherit (final.secrets) mkSecret;
32 inherit (final.services) mkGraphicalService mkServiceOption;
33 inherit (final.validators)
34 ifTheyExist
35 ifOneEnabled
36 anyHome
37 ;
38 });
39in
40{
41 # expose our custom lib to the flake
42 flake.lib = gardenLib;
43}