-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
134 lines (119 loc) · 4.07 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# flake.nix
#
# Author: Edmund Miller <edmund.a.miller@gmail.com>
# URL: https://github.com/emiller88/dotfiles
# License: MIT
#
# Welcome to ground zero. Where the whole flake gets set up and all its modules
# are loaded.
{
description = "A grossly incandescent nixos config.";
inputs = {
# Core dependencies.
# Two inputs so I can track them separately at different rates.
nixpkgs.url = "nixpkgs/nixos-24.05"; # primary nixpkgs
nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; # for packages on the edge
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
# Utils
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
# NOTE https://github.com/danth/stylix/issues/359
stylix.url = "github:danth/stylix/release-24.05";
stylix.inputs.nixpkgs.follows = "nixpkgs";
stylix.inputs.home-manager.follows = "home-manager";
treefmt-nix.url = "github:numtide/treefmt-nix";
# Extras
emacs-overlay.url = "github:nix-community/emacs-overlay";
nixvim.url = "github:nix-community/nixvim/nixos-24.05";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:nixos/nixos-hardware";
ghostty.url = "git+ssh://git@github.com/ghostty-org/ghostty";
wezterm.url = "github:wez/wezterm?dir=nix";
wezterm.inputs.nixpkgs.follows = "nixpkgs";
"op-shell-plugins".url = "github:1Password/shell-plugins";
llm-prompt.url = "github:aldoborrero/llm-prompt";
llm-prompt.inputs.nixpkgs.follows = "nixpkgs";
zen-browser.url = "github:MarceColl/zen-browser-flake";
};
outputs =
inputs@{
self,
nix-darwin,
nixpkgs,
nixpkgs-unstable,
flake-parts,
...
}:
let
inherit (lib.my) mapModules mapModulesRec mapHosts;
system = "x86_64-linux";
mkPkgs =
pkgs: extraOverlays:
import pkgs {
inherit system;
config.allowUnfree = true; # forgive me Stallman senpai
overlays = extraOverlays ++ (lib.attrValues self.overlays);
};
pkgs = mkPkgs nixpkgs [ self.overlay ];
pkgs' = mkPkgs nixpkgs-unstable [ ];
lib = nixpkgs.lib.extend (
self: _super: {
my = import ./lib {
inherit pkgs inputs;
lib = self;
};
}
);
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.treefmt-nix.flakeModule ];
flake = {
lib = lib.my;
overlay = _final: _prev: {
unstable = pkgs';
my = self.packages."${system}";
};
overlays = mapModules ./overlays import;
packages."${system}" = mapModules ./packages (p: pkgs.callPackage p { });
nixosModules = {
dotfiles = import ./.;
} // mapModulesRec ./modules import;
nixosConfigurations = mapHosts ./hosts { };
darwinConfigurations."MacTraitor-Pro" = nix-darwin.lib.darwinSystem {
modules = [ ./hosts/MacTraitor-Pro/default.nix ];
};
templates = {
full = {
path = ./.;
description = "A grossly incandescent nixos config";
};
minimal = {
path = ./templates/minimal;
description = "A grossly incandescent and minimal nixos config";
};
default = self.templates.minimal;
};
apps."${system}".default = {
type = "app";
program = ./bin/hey;
};
};
systems = [ "x86_64-linux" ];
perSystem = _: {
treefmt = {
projectRootFile = ".git/config";
programs.deadnix.enable = true;
programs.nixfmt.enable = true;
programs.prettier.enable = true;
programs.statix.enable = true;
};
};
};
}