Skip to content

Commit ffbdfd4

Browse files
committed
readme: subjectively improve examples
Link: nix-community#132
1 parent 41be95a commit ffbdfd4

File tree

1 file changed

+38
-31
lines changed

1 file changed

+38
-31
lines changed

README.md

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,23 @@ Include the nixos module in your configuration:
3232
inputs = {
3333
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
3434
35-
nix-index-database.url = "github:nix-community/nix-index-database";
36-
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
35+
nix-index-database = {
36+
inputs.nixpkgs.follows = "nixpkgs";
37+
url = "github:nix-community/nix-index-database";
38+
};
3739
};
3840
3941
outputs = { self, nixpkgs, nix-index-database, ... }: {
40-
nixosConfigurations = {
41-
my-nixos = nixpkgs.lib.nixosSystem {
42-
system = "x86_64-linux";
43-
modules = [
44-
./configuration.nix
45-
nix-index-database.nixosModules.nix-index
46-
# optional to also wrap and install comma
47-
# { programs.nix-index-database.comma.enable = true; }
48-
];
49-
};
42+
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
43+
system = "x86_64-linux";
44+
45+
modules = [
46+
./configuration.nix
47+
nix-index-database.nixosModules.nix-index
48+
49+
# Optionally wrap and install pkgs.comma.
50+
{ programs.nix-index-database.comma.enable = true; }
51+
];
5052
};
5153
};
5254
}
@@ -61,21 +63,23 @@ You can then call `nix-locate` as usual, it will automatically use the database
6163
inputs = {
6264
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
6365
64-
nix-index-database.url = "github:nix-community/nix-index-database";
65-
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
66+
nix-index-database = {
67+
inputs.nixpkgs.follows = "nixpkgs";
68+
url = "github:nix-community/nix-index-database";
69+
};
6670
};
6771
6872
outputs = { self, nixpkgs, nix-index-database, ... }: {
69-
darwinConfigurations = {
70-
my-machine = nixpkgs.lib.nixosSystem {
71-
system = "x86_64-linux";
72-
modules = [
73-
./configuration.nix
74-
nix-index-database.darwinModules.nix-index
75-
# optional to also wrap and install comma
76-
# { programs.nix-index-database.comma.enable = true; }
77-
];
78-
};
73+
darwinConfigurations.my-darwin = nixpkgs.lib.nixosSystem {
74+
system = "x86_64-linux";
75+
76+
modules = [
77+
./configuration.nix
78+
nix-index-database.darwinModules.nix-index
79+
80+
# Optionally wrap and install pkgs.comma.
81+
{ programs.nix-index-database.comma.enable = true; }
82+
];
7983
};
8084
};
8185
}
@@ -93,32 +97,35 @@ You can then call `nix-locate` as usual, it will automatically use the database
9397
```nix
9498
{
9599
inputs = {
96-
# Specify the source of Home Manager and Nixpkgs.
97100
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
101+
98102
home-manager = {
99103
url = "github:nix-community/home-manager";
100104
inputs.nixpkgs.follows = "nixpkgs";
101105
};
102106
103-
nix-index-database.url = "github:nix-community/nix-index-database";
104-
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
107+
nix-index-database = {
108+
inputs.nixpkgs.follows = "nixpkgs";
109+
url = "github:nix-community/nix-index-database";
110+
};
105111
};
112+
106113
outputs = { nixpkgs, home-manager, nix-index-database, ... }:
107114
let
108115
system = "x86_64-linux";
109116
pkgs = nixpkgs.legacyPackages.${system};
110117
in {
111-
homeConfigurations.jdoe = home-manager.lib.homeManagerConfiguration {
118+
homeConfigurations.my-home = home-manager.lib.homeManagerConfiguration {
112119
inherit pkgs;
113120
114121
modules = [
115122
nix-index-database.hmModules.nix-index
116-
# optional to also wrap and install comma
117-
# { programs.nix-index-database.comma.enable = true; }
123+
124+
# Optionally wrap and install pkgs.comma.
125+
{ programs.nix-index-database.comma.enable = true; }
118126
];
119127
};
120128
};
121-
122129
}
123130
```
124131

0 commit comments

Comments
 (0)