-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutputs.nix
94 lines (78 loc) · 2.22 KB
/
outputs.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
{ self, ... } @ inputs:
let
nixpkgs = inputs.nixpkgs;
lib = nixpkgs.lib;
# It's a personal repo, not supporting other systems right now
supportedSystems = lib.singleton "x86_64-linux";
forAllSystems = function: lib.genAttrs
supportedSystems
(system: function nixpkgs.legacyPackages.${system});
# My custom lib functions, stored in a separate repo.
# This instance only holds pure functions, and isn't passed
# to anywhere. We just use it when we need a custom function,
# but don't have system access.
pureLlakaLib = inputs.llakaLib.pureLib;
mkNixos = hostname:
{ system }: let llakaLib = inputs.llakaLib.fullLib.${system};
in lib.nixosSystem
{
specialArgs =
{
inherit inputs llakaLib self;
pkgs-unstable = import inputs.nixpkgs-unstable
{
config.allowUnfree = true;
inherit system;
};
};
# Use custom function that grabs all files within a folder and filters out non-nix files
modules = llakaLib.resolveAndFilter
[
./config/core
./config/features
./config/gnome
./config/hyprland
./config/baseVars.nix
./apps/core
./apps/dev
./apps/extras
./apps/gui
./hosts/${hostname}/config
./hosts/${hostname}/hardware-configuration.nix
./hosts/${hostname}/${hostname}Vars.nix
self.nixosModules.default
];
};
in
{
# Run mkNixos for each host
nixosConfigurations = builtins.mapAttrs mkNixos
{
framework.system = "x86_64-linux";
desktop.system = "x86_64-linux";
};
# Call all packages automatically in directory, while letting packages refer to each other
# via custom lib function
legacyPackages = forAllSystems
(
pkgs: let llakaLib = inputs.llakaLib.fullLib.${pkgs.system};
in llakaLib.collectDirectoryPackages
{
inherit pkgs;
directory = ./extras/packages;
extras = { inherit llakaLib; }; # So custom packages can rely on llakaLib
}
);
# for easier access, this lets us add all our modules by just importing self.nixosModules.default
nixosModules.default =
{
imports = pureLlakaLib.resolveAndFilter
[
./extras/nixosModules
];
};
formatter = forAllSystems
(
pkgs: pkgs.nixfmt-rfc-style
);
}