-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix.template
242 lines (193 loc) · 8.87 KB
/
flake.nix.template
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
{
description = "Your new nix config";
# sudo nixos-rebuild switch --flake .#hostname
# home-manager switch --flake .#username@hostname
# Inputs
# https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html#flake-inputs
inputs = {
# currentDir.url = "."; # The flake in the current directory.
# otherDir.url = "/home/alice/src/patchelf"; # A flake in some other directory.
# # A flake in some absolute path
# otherDir.url = "path:/home/alice/src/patchelf";
# # The nixpkgs entry in the flake registry.
# nixpkgsRegistry.url = "nixpkgs";
# # The nixpkgs entry in the flake registry, overriding it to use a specific Git revision.
# nixpkgsRegistryOverride.url = "nixpkgs/a3a3dda3bacf61e8a39258a0ed9c924eeca8e293";
# # The master branch of the NixOS/nixpkgs repository on GitHub.
# nixpkgsGitHub.url = "github:NixOS/nixpkgs";
# # The nixos-20.09 branch of the NixOS/nixpkgs repository on GitHub.
# nixpkgsGitHubBranch.url = "github:NixOS/nixpkgs/nixos-20.09";
# # A specific revision of the NixOS/nixpkgs repository on GitHub.
# nixpkgsGitHubRevision.url = "github:NixOS/nixpkgs/a3a3dda3bacf61e8a39258a0ed9c924eeca8e293";
# # A flake in a subdirectory of a GitHub repository.
# nixpkgsGitHubDir.url = "github:edolstra/nix-warez?dir=blender";
# # A git repository.
# gitRepo.url = "git+https://github.com/NixOS/patchelf";
# # A specific branch of a Git repository.
# gitRepoBranch.url = "git+https://github.com/NixOS/patchelf?ref=master";
# # A specific revision of a Git repository.
# gitRepoRev.url = "git+https://github.com/NixOS/patchelf?ref=master&rev=f34751b88bd07d7f44f5cd3200fb4122bf916c7e";
# # A tarball flake
# tarFlake.url = "https://github.com/NixOS/patchelf/archive/master.tar.gz";
# # A GitHub repository.
# import-cargo = {
# type = "github";
# owner = "edolstra";
# repo = "import-cargo";
# };
# # Inputs as attrsets.
# # An indirection through the flake registry.
# nixpkgsIndirect = {
# type = "indirect";
# id = "nixpkgs";
# };
# # Non-flake inputs. These provide a variable of type path.
# grcov = {
# type = "github";
# owner = "mozilla";
# repo = "grcov";
# flake = false;
# };
# # Transitive inputs can be overridden from a flake.nix file. For example, the following overrides the nixpkgs input of the nixops input:
# nixops.inputs.nixpkgs = {
# type = "github";
# owner = "NixOS";
# repo = "nixpkgs";
# };
# # It is also possible to "inherit" an input from another input. This is useful to minimize
# # flake dependencies. For example, the following sets the nixpkgs input of the top-level flake
# # to be equal to the nixpkgs input of the nixops input of the top-level flake:
# nixpkgs.url = "nixpkgs";
# nixpkgs.follows = "nixops/nixpkgs";
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
# # The value of the follows attribute is a sequence of input names denoting the path
# # of inputs to be followed from the root flake. Overrides and follows can be combined, e.g.
# nixops.url = "nixops";
# dwarffs.url = "dwarffs";
# dwarffs.inputs.nixpkgs.follows = "nixpkgs";
# # For more information about well-known outputs checked by `nix flake check`:
# # https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake-check.html#evaluation-checks
# # These examples all use "x86_64-linux" as the system.
# # Please see the c-hello template for an example of how to handle multiple systems.
# c-hello.url = "github:NixOS/templates?dir=c-hello";
# rust-web-server.url = "github:NixOS/templates?dir=rust-web-server";
# nix-bundle.url = "github:NixOS/bundlers";
# # Work-in-progress: refer to parent/sibling flakes in the same repository
# c-hello.url = "path:../c-hello";
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
# You can access packages and modules from different nixpkgs revs
# at the same time. Here's an working example:
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
# Home manager
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
inherit (self) outputs;
# Supported systems for your flake packages, shell, etc.
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
# Default user
# username = "jrizzo";
in {
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# config.username = "jrizzo";
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
# > Our main nixos configuration file <
./hosts/nixos/configuration.nix
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
"jrizzo@nixos" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [
# > Our main home-manager configuration file <
./homes/jrizzo.nix
];
};
};
# Utilized by `nix flake check`
# checks.x86_64-linux.test = c-hello.checks.x86_64-linux.test;
# Utilized by `nix build .`
# defaultPackage.x86_64-linux = c-hello.defaultPackage.x86_64-linux;
# Utilized by `nix build`
# packages.x86_64-linux.hello = c-hello.packages.x86_64-linux.hello;
# Utilized by `nix run .#<name>`
# apps.x86_64-linux.hello = {
# type = "app";
# program = c-hello.packages.x86_64-linux.hello;
# };
# Utilized by `nix bundle -- .#<name>` (should be a .drv input, not program path?)
# bundlers.x86_64-linux.example = nix-bundle.bundlers.x86_64-linux.toArx;
# Utilized by `nix bundle -- .#<name>`
# defaultBundler.x86_64-linux = self.bundlers.x86_64-linux.example;
# Utilized by `nix run . -- <args?>`
# defaultApp.x86_64-linux = self.apps.x86_64-linux.hello;
# Utilized for nixpkgs packages, also utilized by `nix build .#<name>`
# legacyPackages.x86_64-linux.hello = c-hello.defaultPackage.x86_64-linux;
# Default overlay, for use in dependent flakes
# overlay = final: prev: { };
# # Same idea as overlay but a list or attrset of them.
# overlays = { exampleOverlay = self.overlay; };
# Default module, for use in dependent flakes. Deprecated, use nixosModules.default instead.
# nixosModule = { config, ... }: { options = {}; config = {}; };
# Same idea as nixosModule but a list or attrset of them.
# nixosModules = { exampleModule = self.nixosModule; };
# Used with `nixos-rebuild --flake .#<hostname>`
# nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
# nixosConfigurations.example = nixpkgs.lib.nixosSystem {
# system = "x86_64-linux";
# modules = [{boot.isContainer=true;}] ;
# };
# Utilized by `nix develop`
# devShell.x86_64-linux = rust-web-server.devShell.x86_64-linux;
# Utilized by `nix develop .#<name>`
# devShells.x86_64-linux.example = self.devShell.x86_64-linux;
# Utilized by Hydra build jobs
# hydraJobs.example.x86_64-linux = self.defaultPackage.x86_64-linux;
# Utilized by `nix flake init -t <flake>`
# defaultTemplate = {
# path = c-hello;
# description = "template description";
# };
# Utilized by `nix flake init -t <flake>#<name>`
# templates.example = self.defaultTemplate;
};
}