-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
111 lines (91 loc) · 3.22 KB
/
flake.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
inputs = {
# dmux <https://github.com/zdcthomas/dmux>
dmux.url = "github:zdcthomas/dmux";
dmux.inputs.nixpkgs.follows = "nixpkgs";
# Flake parts <https://github.com/hercules-ci/flake-parts>
flake-parts.url = "github:hercules-ci/flake-parts";
# Home Manager <https://github.com/nix-community/home-manager>
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Nix packages <https://github.com/NixOS/nixpkgs>
nixpkgs.url = "github:NixOS/nixpkgs";
# Nix User Repository <https://github.com/nix-community/NUR>
nur.url = "github:nix-community/NUR";
# Nix default systems <https://github.com/nix-systems/default>
systems.url = "github:nix-systems/default";
};
outputs = { home-manager, nixpkgs, ... } @ inputs: let
system = "x86_64-linux";
overlays = import ./overlays {
inherit inputs;
};
pkgs = import nixpkgs {
inherit overlays;
inherit system;
config.allowUnfree = true;
};
utils = rec {
type = {
browserExtension = "browserExtensions";
font = "fonts";
language = "languages";
package = "packages";
workflow = "workflows";
};
mkModule = config: type: name: obj: {
options.${type}.${name}.enable = nixpkgs.lib.mkEnableOption name;
config = mkIfEnabled config type name obj;
};
mkLanguage = config: mkModule config type.language;
mkPackage = config: mkModule config type.package;
mkWorkflow = config: mkModule config type.workflow;
mkFont = config: mkModule config type.font;
mkBrowserExtension = config: name: obj: mkModule config type.browserExtension name {
programs.firefox.policies.ExtensionSettings.${obj.firefox.uuid} = {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${obj.firefox.shortId}/latest.xpi";
installation_mode = "normal_installed";
};
};
mkIfEnabled = config: type: name: nixpkgs.lib.mkIf config.${type}.${name}.enable;
mkIfBrowserExtensionEnabled = config: mkIfEnabled config type.browserExtension;
mkIfFontEnabled = config: mkIfEnabled config type.font;
mkIfLanguageEnabled = config: mkIfEnabled config type.language;
mkIfPackageEnabled = config: mkIfEnabled config type.package;
mkIfWorkflowEnabled = config: mkIfEnabled config type.workflow;
};
forEachDevice = fn: devices:
builtins.listToAttrs (builtins.map
(name: {
inherit name;
value = (fn name);
})
devices);
devices = devices: {
devShells.${system} = import ./shell.nix {
inherit pkgs;
};
nixosConfigurations = forEachDevice
(hostname: nixpkgs.lib.nixosSystem {
modules = [];
})
devices;
homeConfigurations = forEachDevice
(hostname: home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [./systems/${hostname}/home.nix];
extraSpecialArgs = {
inherit inputs utils;
};
})
devices;
};
in devices [
"elysium"
"NB-99KZST3"
"zephyr"
];
nixConfig = {
warn-dirty = false;
};
}