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";
|
2020-08-27 18:38:15 +02:00
|
|
|
|
2023-04-14 12:42:03 +02:00
|
|
|
outputs = { self, nixpkgs, ... }:
|
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
|
2023-02-01 11:25:13 +01:00
|
|
|
'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.html#sec-release-22.11-highlights
|
2022-09-27 07:07:03 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
};
|
2023-04-14 12:42:03 +02:00
|
|
|
} // (let
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
|
|
|
in {
|
|
|
|
devShells = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
tests = import ./tests { inherit pkgs; };
|
2023-04-24 12:46:10 +02:00
|
|
|
in { tests = tests.run; });
|
2023-04-14 12:42:03 +02:00
|
|
|
|
|
|
|
packages = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
docs = import ./docs { inherit pkgs; };
|
|
|
|
hmPkg = pkgs.callPackage ./home-manager { };
|
|
|
|
in {
|
2023-02-26 16:21:03 +01:00
|
|
|
default = hmPkg;
|
|
|
|
home-manager = hmPkg;
|
|
|
|
|
2022-06-07 20:45:06 +02:00
|
|
|
docs-html = docs.manual.html;
|
|
|
|
docs-json = docs.options.json;
|
2023-02-26 16:21:03 +01:00
|
|
|
docs-manpages = docs.manPages;
|
2023-04-14 12:42:03 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
defaultPackage = forAllSystems (system: self.packages.${system}.default);
|
|
|
|
});
|
2020-08-26 08:13:05 +02:00
|
|
|
}
|