Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
98 lines (89 loc) · 2.75 KB
/
Copy pathflake.nix
File metadata and controls
98 lines (89 loc) · 2.75 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
{
description = "MD's nix config";
inputs = {
# change to github:nixos/nixpkgs/nixos-unstable for unstable
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
home-manager = {
# change to github:nix-community/home-manager for unstable
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
self,
nixpkgs,
...
}: {
nixosConfigurations = let
user = "md89";
mkHost = host:
nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
inherit (nixpkgs) lib;
inherit inputs nixpkgs system user;
};
modules = [
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user} = {
imports = [
# common home-manager configuration
./home.nix
# host specific home-manager configuration
./hosts/${host}/home.nix
];
home = {
username = user;
homeDirectory = "/home/${user}";
# do not change this value
stateVersion = "23.05";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
};
};
}
# common configuration
./configuration.nix
# host specific configuration
./hosts/${host}/configuration.nix
# host specific hardware configuration
./hosts/${host}/hardware-configuration.nix
];
};
in {
# update with `nix flake update`
# rebuild with `nixos-rebuild switch --flake .#dev`
dev = mkHost "dev";
# update with `nix flake update`
# rebuild with `nixos-rebuild switch --flake .#gaming`
gaming = mkHost "gaming";
};
templates = let
welcomeText = ''
# `.devenv` and `direnv` should be added to `.gitignore`
```sh
echo .devenv >> .gitignore
echo .direnv >> .gitignore
```
'';
in {
# initialize with `nix flake init --template github.com:MD-2016/dotfiles#golang`
golang = {
inherit welcomeText;
path = ./templates/golang;
description = "devenv for golang";
};
# initialize with `nix flake init --template github.com:MD-2016/dotfiles#rust`
rust = {
inherit welcomeText;
path = ./templates/rust;
description = "devenv for rust";
};
};
};
}