-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
151 lines (134 loc) · 6.4 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
description = "NixOS Flake";
# This is the standard format for flake.nix.
# `inputs` are the dependencies of the flake,
# and `outputs` function will return all the build results of the flake.
# Each item in `inputs` will be passed as a parameter to
# the `outputs` function after being pulled and built.
inputs = {
# There are many ways to reference flake inputs.
# The most widely used is `github:owner/name/reference`,
# which represents the GitHub repository URL + branch/commit-id/tag.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # NixOS unstable channel
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11"; # NixOS release channel
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
# Also see the 'stable-packages' and 'master-packages' overlays at 'overlays/default.nix'.
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; # NixOS hardware channel
home-manager = {
url = "github:nix-community/home-manager"; # Home Manager release channel
# The `follows` keyword in inputs is used for inheritance.
# Here, `inputs.nixpkgs` of home-manager is kept consistent with
# the `inputs.nixpkgs` of the current flake,
# to avoid problems caused by different versions of nixpkgs.
inputs.nixpkgs.follows = "nixpkgs";
};
plasma-manager.url = "github:pjones/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.inputs.home-manager.follows = "home-manager";
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/nur";
jovian-nixos = {
url = "github:Jovian-Experiments/Jovian-NixOS";
inputs.nixpkgs.follows = "nixpkgs";
};
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
nixarr.url = "github:rasmus-kirk/nixarr";
};
outputs = {
self,
nixpkgs,
home-manager,
nixos-hardware,
plasma-manager,
nix-vscode-extensions,
...
} @ inputs: let
inherit (self) outputs;
# Supported systems for your flake packages, shell, etc.
systems = [
"x86_64-linux"
];
# 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;
genericModules = [
{
# Enable flakes and new 'nix' command
nix.settings. experimental-features = "nix-command flakes";
# This fixes things that don't use Flakes, but do want to use NixPkgs.
nix.registry.nixos.flake = inputs.self;
environment.etc."nix/inputs/nixpkgs".source = nixpkgs.outPath;
nix.nixPath = ["nixpkgs=${nixpkgs.outPath}"];
}
];
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;
# By default, NixOS will try to refer the nixosConfiguration with its hostname.
# However, the configuration name can also be specified using:
# sudo nixos-rebuild switch --flake /path/to/flakes/directory#<name>
#
# The `nixpkgs.lib.nixosSystem` function is used to build this
# configuration, the following attribute set is its parameter.
#
# Run the following command in the flake's directory to
# deploy this configuration on any NixOS system:
# sudo nixos-rebuild switch --flake .#zephyrus
nixosConfigurations = {
zephyrus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
# The Nix module system can modularize configuration,
# improving the maintainability of configuration.
#
# Each parameter in the `modules` is a Nixpkgs Module, and
# there is a partial introduction to it in the nixpkgs manual:
# <https://nixos.org/manual/nixpkgs/unstable/#module-system-introduction>
# It is said to be partial because the documentation is not
# complete, only some simple introductions.
# such is the current state of Nix documentation...
#
# A Nixpkgs Module can be an attribute set, or a function that
# returns an attribute set. By default, if a Nixpkgs Module is a
# function, this function have the following default parameters:
#
# lib: the nixpkgs function library, which provides many
# useful functions for operating Nix expressions:
# https://nixos.org/manual/nixpkgs/stable/#id-1.4
# config: all config options of the current flake, very useful
# options: all options defined in all NixOS Modules
# in the current flake
# pkgs: a collection of all packages defined in nixpkgs,
# plus a set of functions related to packaging.
# you can assume its default value is
# `nixpkgs.legacyPackages."${system}"` for now.
# can be customed by `nixpkgs.pkgs` option
# modulesPath: the default path of nixpkgs's modules folder,
# used to import some extra modules from nixpkgs.
# this parameter is rarely used,
# you can ignore it for now.
#
# The default parameters mentioned above are automatically
# generated by Nixpkgs.
# Pass other non-default parameters to the submodules:
specialArgs = {inherit inputs outputs;}; # Set all input parameters as input key of specialArgs (ex: inputs.nixos-hardware)
# specialArgs = inputs; # Set all input parameters as specialArgs of all sub-modules so that we can use them in sub-modules directly.
modules = genericModules ++ [./hosts/zephyrus];
};
};
};
}