home-manager/flake.nix
Naïm Camille Favier 64ab7d6e8d
Prepare inclusion in nixos-search (#2971)
* Add flake.lock and clean up flake.nix

Add a lockfile to work around https://github.com/NixOS/nix/issues/6541
(and because it's a good idea anyway).

Also use flake-utils, and restrict ourselves to the five platforms
supported by nixpkgs. Otherwise, the IFD for nmd fails on weird
platforms. This fixes `nix flake check`.

Remove the redundant `apps` output, see https://github.com/nix-community/home-manager/pull/2442#issuecomment-1133670487

* nixos,nix-darwin: factor out into a common module

* nixos,nix-darwin: make `home-managers.users` shallowly visible

Make sure the option is included in the NixOS/nix-darwin manual (but the
HM submodule options aren't).

Also add a static description to the HM submodule type so that we don't need to
evaluate the submodules just to build the option manual. This makes
nixos-search able to index the home-manager flake.

Also clean up some TODOs.

* flake: add nmd and nmt

This avoids having to use `pkgs.fetchFromGitLab` in an IFD, which causes
issues when indexing packages with nixos-search because `pkgs` is
instantiated with every platform.
2022-06-07 20:45:06 +02:00

66 lines
2.1 KiB
Nix

{
description = "Home Manager for Nix";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nmd.url = "gitlab:rycee/nmd";
inputs.nmd.flake = false;
inputs.nmt.url = "gitlab:rycee/nmt";
inputs.nmt.flake = false;
inputs.utils.url = "github:numtide/flake-utils";
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;
outputs = { self, nixpkgs, nmd, utils, ... }:
{
nixosModules = rec {
home-manager = import ./nixos;
default = home-manager;
};
# deprecated in Nix 2.8
nixosModule = self.nixosModules.default;
darwinModules = rec {
home-manager = import ./nix-darwin;
default = home-manager;
};
# unofficial; deprecated in Nix 2.8
darwinModule = self.darwinModules.default;
lib = {
hm = import ./modules/lib { lib = nixpkgs.lib; };
homeManagerConfiguration = { configuration, system, homeDirectory
, username, extraModules ? [ ], extraSpecialArgs ? { }
, pkgs ? builtins.getAttr system nixpkgs.outputs.legacyPackages
, lib ? pkgs.lib, check ? true, stateVersion ? "20.09" }@args:
assert nixpkgs.lib.versionAtLeast stateVersion "20.09";
import ./modules {
inherit pkgs lib check extraSpecialArgs;
configuration = { ... }: {
imports = [ configuration ] ++ extraModules;
home = { inherit homeDirectory stateVersion username; };
nixpkgs = { inherit (pkgs) config overlays; };
};
};
};
} // utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
docs = import ./docs {
inherit pkgs;
nmdSrc = nmd;
};
in {
packages = rec {
home-manager = pkgs.callPackage ./home-manager { };
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
default = home-manager;
};
# deprecated in Nix 2.7
defaultPackage = self.packages.${system}.default;
});
}