2020-08-26 08:13:05 +02:00
|
|
|
{
|
|
|
|
description = "Home Manager for Nix";
|
|
|
|
|
2022-06-07 20:45:06 +02:00
|
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
inputs.utils.url = "github:numtide/flake-utils";
|
2020-08-27 18:38:15 +02:00
|
|
|
|
2022-06-26 20:55:07 +02:00
|
|
|
outputs = { self, nixpkgs, utils, ... }:
|
2022-06-07 20:45:06 +02:00
|
|
|
{
|
|
|
|
nixosModules = rec {
|
|
|
|
home-manager = import ./nixos;
|
|
|
|
default = home-manager;
|
|
|
|
};
|
|
|
|
# deprecated in Nix 2.8
|
|
|
|
nixosModule = self.nixosModules.default;
|
2021-11-23 07:36:55 +01:00
|
|
|
|
2022-06-07 20:45:06 +02:00
|
|
|
darwinModules = rec {
|
|
|
|
home-manager = import ./nix-darwin;
|
|
|
|
default = home-manager;
|
|
|
|
};
|
|
|
|
# unofficial; deprecated in Nix 2.8
|
|
|
|
darwinModule = self.darwinModules.default;
|
2021-11-23 07:36:55 +01:00
|
|
|
|
2022-08-27 04:37:16 +02:00
|
|
|
templates = {
|
|
|
|
standalone = {
|
|
|
|
path = ./templates/standalone;
|
|
|
|
description = "Standalone setup";
|
|
|
|
};
|
|
|
|
nixos = {
|
|
|
|
path = ./templates/nixos;
|
|
|
|
description = "Home Manager as a NixOS module,";
|
|
|
|
};
|
|
|
|
nix-darwin = {
|
|
|
|
path = ./templates/nix-darwin;
|
|
|
|
description = "Home Manager as a nix-darwin module,";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultTemplate = self.templates.standalone;
|
|
|
|
|
2021-04-11 23:46:27 +02:00
|
|
|
lib = {
|
2022-07-22 21:29:04 +02:00
|
|
|
hm = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).hm;
|
2022-06-20 01:37:57 +02:00
|
|
|
homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib
|
|
|
|
, extraSpecialArgs ? { }, check ? true
|
|
|
|
# Deprecated:
|
|
|
|
, configuration ? null, extraModules ? null, stateVersion ? null
|
|
|
|
, username ? null, homeDirectory ? null, system ? null }@args:
|
|
|
|
let
|
2022-09-27 07:07:03 +02:00
|
|
|
msgForRemovedArg = ''
|
|
|
|
The 'homeManagerConfiguration' arguments
|
2021-04-20 22:19:24 +02:00
|
|
|
|
2022-09-27 07:07:03 +02:00
|
|
|
- 'configuration',
|
|
|
|
- 'username',
|
|
|
|
- 'homeDirectory'
|
|
|
|
- 'stateVersion',
|
|
|
|
- 'extraModules', and
|
|
|
|
- 'system'
|
2022-06-20 01:37:57 +02:00
|
|
|
|
2022-09-27 07:07:03 +02:00
|
|
|
have been removed. Instead use the arguments 'pkgs' and
|
|
|
|
'modules'. See the 22.11 release notes for more.
|
|
|
|
'';
|
|
|
|
|
|
|
|
throwForRemovedArgs = v:
|
|
|
|
let
|
|
|
|
used = builtins.filter (n: (args.${n} or null) != null) [
|
|
|
|
"configuration"
|
|
|
|
"username"
|
|
|
|
"homeDirectory"
|
|
|
|
"stateVersion"
|
|
|
|
"extraModules"
|
|
|
|
"system"
|
|
|
|
];
|
|
|
|
msg = msgForRemovedArg + ''
|
|
|
|
|
|
|
|
|
|
|
|
Deprecated args passed: ''
|
|
|
|
+ builtins.concatStringsSep " " used;
|
|
|
|
in lib.throwIf (used != [ ]) msg v;
|
2022-06-20 01:37:57 +02:00
|
|
|
|
|
|
|
in throwForRemovedArgs (import ./modules {
|
2022-04-18 00:14:41 +02:00
|
|
|
inherit pkgs lib check extraSpecialArgs;
|
2021-04-11 23:46:27 +02:00
|
|
|
configuration = { ... }: {
|
2022-06-20 01:37:57 +02:00
|
|
|
imports = modules;
|
2021-04-20 22:19:24 +02:00
|
|
|
nixpkgs = { inherit (pkgs) config overlays; };
|
2021-04-11 23:46:27 +02:00
|
|
|
};
|
2022-06-20 01:37:57 +02:00
|
|
|
});
|
2021-04-11 23:46:27 +02:00
|
|
|
};
|
2022-06-07 20:45:06 +02:00
|
|
|
} // utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
2022-06-16 12:25:39 +02:00
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2022-06-26 20:55:07 +02:00
|
|
|
docs = import ./docs { inherit pkgs; };
|
2022-11-27 01:37:24 +01:00
|
|
|
tests = import ./tests { inherit pkgs; };
|
2022-06-07 20:45:06 +02:00
|
|
|
in {
|
2022-11-27 01:37:24 +01:00
|
|
|
devShells.tests = tests.run;
|
2022-06-07 20:45:06 +02:00
|
|
|
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;
|
|
|
|
});
|
2020-08-26 08:13:05 +02:00
|
|
|
}
|