This repository has been archived by the owner on Dec 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdefault.nix
67 lines (54 loc) · 1.82 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ system ? builtins.currentSystem
, inputs ? import ./ufr-polyfills/flake.lock.nix ./.
# alternative 1 --------------------------------------------------
, pkgs ? import inputs.nixpkgs {
inherit system;
overlays = inputs.nixpkgs.lib.optionals
((inputs ? self) && (inputs.self ? overlays))
(builtins.attrValues inputs.self.overlays)
;
config = { };
}
# function config ------------------------------------------------
, budModules ? pkgs.lib.optionals
((inputs ? self) && (inputs.self ? budModules))
(builtins.attrValues inputs.self.budModules)
# pass the host's config for inferring the reverse dns fqdn of this host
# so that this script can accessor the _current_ host identifier in
# self.nixosConfigurations.<identifier>
, hostConfig ? null
# pass a string to the path where you hold a (writable) local copy of the flake repo
# so that this script can execute operations on that flake, such as updates, etc.
, editableFlakeRoot ? null
}:
let
lib = pkgs.lib;
name = "bud";
description = "Your highly customizable system ctl";
budModule = import ./module.nix;
stdProfile = import ./stdProfile.nix;
pkgsModule = { config, lib, ... }: {
config = {
_module.args.name = name;
_module.args.baseModules = [ budModule ];
_module.args.pkgs = lib.mkDefault pkgs;
_module.args.hostConfig = hostConfig;
_module.args.editableFlakeRoot = editableFlakeRoot;
};
};
budUtilsModule = { pkgs, lib, ... }: {
config = {
_module.args.budUtils = {
writeBashWithPaths = import ./writeBashWithPaths.nix {
inherit pkgs lib;
};
};
};
};
evaled = lib.evalModules {
modules = [ pkgsModule budUtilsModule budModule stdProfile ] ++ budModules;
};
in
evaled.config.bud.cmd // {
meta = { inherit description; };
}