-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
44 lines (39 loc) · 1.59 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
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# home-manager, used for managing user configuration
home-manager = {
url = "github:nix-community/home-manager";
# 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";
};
};
outputs = inputs@{ nixpkgs, home-manager, ... }: {
nixosConfigurations = {
# 这里的 my-nixos 替换成你的主机名称
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
# 将 home-manager 配置为 nixos 的一个 module
# 这样在 nixos-rebuild switch 时,home-manager 配置也会被自动部署
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# 这里的 ryan 也得替换成你的用户名
# 这里的 import 函数在前面 Nix 语法中介绍过了,不再赘述
home-manager.users.rxda = import ./home.nix;
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home.nix 的参数
# 取消注释下面这一行,就可以在 home.nix 中使用 flake 的所有 inputs 参数了
# home-manager.extraSpecialArgs = inputs;
}
];
};
};
};
}