-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
147 lines (127 loc) · 4.05 KB
/
Copy pathflake.nix
File metadata and controls
147 lines (127 loc) · 4.05 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
# my-dotfiles | Copyright (C) 2025 eth-p
# Repository: https://github.com/eth-p/my-dotfiles
#
# This flake holds my configurations.
# ==============================================================================
{
description = ''
Flake to configure my dotfiles and user packages.
'';
inputs = {
# home-manager is used to manage dotfiles and user config.
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# nixpkgs is for installing packages.
nixpkgs.url = "nixpkgs/nixos-unstable";
# vicinae: https://github.com/vicinaehq/vicinae
vicinae.url = "github:vicinaehq/vicinae/v0.22.0";
# My own packages:
kubesel.url = "github:eth-p/kubesel";
# systems lists the default nix systems.
systems.url = "github:nix-systems/default";
};
outputs =
{
self,
nixpkgs,
home-manager,
systems,
vicinae,
kubesel,
...
}@inputs:
let
inherit (nixpkgs) lib;
defaultSystems = import systems;
forDefaultSystems = fn: forEachSystem fn defaultSystems;
forEachSystem = fn: systems: lib.genAttrs systems (system: fn system);
selfLibOnly = { inherit (self) lib; };
selfLibPackages = { inherit (self) lib packages legacyPackages; };
# Default home-manager overlays and modules.
hmOverlays = [
self.overlays.default
vicinae.overlays.default
kubesel.overlays.default
];
hmModules = [
self.homeManagerModules.default
vicinae.homeManagerModules.default
];
myProfiles = {
minimal = [ ./profiles/minimal.nix ];
standard = [ ./profiles/standard.nix ];
development = [ ./profiles/development.nix ];
};
# mkHomeConfiguration provides a way to create a home-manager configuration
# without having to set up all the manual boilerplate.
mkHomeConfiguration =
{
system,
modules,
profile ? null,
overlays ? [ ],
extraSpecialArgs ? { },
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
overlays = hmOverlays ++ overlays;
};
modules = hmModules ++ modules ++ (if profile == null then [ ] else myProfiles."${profile}");
extraSpecialArgs = extraSpecialArgs // {
my-dotfiles = selfLibPackages;
};
};
# The library functions exported from this flake.
# It only has access to the nixpkgs lib and itself.
my-dotfiles-lib = (import ./lib/nix) {
inherit lib;
my-dotfiles = selfLibOnly;
};
in
{
# lib provides reusable library functions.
#
# These rely on the nixpkgs standard library.
lib = my-dotfiles-lib // {
home = { inherit mkHomeConfiguration; }; # alias
inherit mkHomeConfiguration;
};
# overlays exports overlays used to insert the packages exported from
# this flake into the standard `pkgs` variable accessible in home-manager
# modules.
overlays = (import ./overlays) {
inherit lib;
my-dotfiles = selfLibPackages;
};
# packages exports custom packages.
packages = forDefaultSystems (
system:
(import ./packages) {
pkgs = (import nixpkgs { inherit system; });
}
);
# legacyPackages exports custom package sets.
legacyPackages = forDefaultSystems (system: {
vscode-extensions = (
import ./packages/vscode-extensions.nix {
pkgs = nixpkgs.legacyPackages.${system};
my-dotfiles = self;
}
);
});
# homeManagerModules declares reusable home-manager modules.
#
# In the `default` module set, `extraSpecialArgs` must contain this flake
# passed through as `my-dotfiles`.
homeManagerModules = {
default = {
imports = (import ./programs) ++ [
./programs/globals.nix
];
};
};
};
}