mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
readme: add a basic flake usage example
This commit is contained in:
parent
1ed8e7ef98
commit
bfc66df13d
1 changed files with 54 additions and 0 deletions
54
README.md
54
README.md
|
@ -305,6 +305,60 @@ in your system configuration and
|
||||||
|
|
||||||
in your Home Manager configuration.
|
in your Home Manager configuration.
|
||||||
|
|
||||||
|
Flakes
|
||||||
|
------
|
||||||
|
|
||||||
|
Home Manager includes a flake.nix for compatibility with [NixOS flakes](https://nixos.wiki/wiki/Flakes) for those
|
||||||
|
that wish to use it as a module. A bare-minimum flake.nix would be as follows:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
description = "NixOS configuration";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
home-manager.url = "github:rycee/home-manager";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs: {
|
||||||
|
nixosConfigurations = {
|
||||||
|
hostname = let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
|
inherit (inputs.nixpkgs) lib;
|
||||||
|
|
||||||
|
# Things in this set are passed to modules and accessible
|
||||||
|
# in the top-level arguments (e.g. `{ pkgs, lib, inputs, ... }:`).
|
||||||
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
};
|
||||||
|
|
||||||
|
hm-nixos-as-super = { config, ... }: {
|
||||||
|
# Submodules have merge semantics, making it possible to amend
|
||||||
|
# the `home-manager.users` submodule for additional functionality.
|
||||||
|
options.home-manager.users = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (lib.types.submoduleWith {
|
||||||
|
modules = [ ];
|
||||||
|
# Makes specialArgs available to Home Manager modules as well.
|
||||||
|
specialArgs = specialArgs // {
|
||||||
|
# Allow accessing the parent NixOS configuration.
|
||||||
|
super = config;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
inputs.home.nixosModules.home-manager
|
||||||
|
hm-nixos-as-super
|
||||||
|
];
|
||||||
|
in lib.nixosSystem { inherit system modules specialArgs; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue