2020-08-26 06:13:05 +00:00
|
|
|
{
|
|
|
|
description = "Home Manager for Nix";
|
|
|
|
|
2024-01-17 07:36:04 +00:00
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
2020-08-27 16:38:15 +00:00
|
|
|
|
2023-04-14 10:42:03 +00:00
|
|
|
outputs = { self, nixpkgs, ... }:
|
2022-06-07 18:45:06 +00:00
|
|
|
{
|
|
|
|
nixosModules = rec {
|
|
|
|
home-manager = import ./nixos;
|
|
|
|
default = home-manager;
|
|
|
|
};
|
|
|
|
# deprecated in Nix 2.8
|
|
|
|
nixosModule = self.nixosModules.default;
|
2021-11-23 06:36:55 +00:00
|
|
|
|
2022-06-07 18:45:06 +00:00
|
|
|
darwinModules = rec {
|
|
|
|
home-manager = import ./nix-darwin;
|
|
|
|
default = home-manager;
|
|
|
|
};
|
|
|
|
# unofficial; deprecated in Nix 2.8
|
|
|
|
darwinModule = self.darwinModules.default;
|
2021-11-23 06:36:55 +00:00
|
|
|
|
2022-08-27 02:37:16 +00: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 21:46:27 +00:00
|
|
|
lib = {
|
2022-07-22 19:29:04 +00:00
|
|
|
hm = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).hm;
|
2022-06-19 23:37:57 +00: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 05:07:03 +00:00
|
|
|
msgForRemovedArg = ''
|
|
|
|
The 'homeManagerConfiguration' arguments
|
2021-04-20 20:19:24 +00:00
|
|
|
|
2022-09-27 05:07:03 +00:00
|
|
|
- 'configuration',
|
|
|
|
- 'username',
|
|
|
|
- 'homeDirectory'
|
|
|
|
- 'stateVersion',
|
|
|
|
- 'extraModules', and
|
|
|
|
- 'system'
|
2022-06-19 23:37:57 +00:00
|
|
|
|
2022-09-27 05:07:03 +00:00
|
|
|
have been removed. Instead use the arguments 'pkgs' and
|
2023-06-27 21:32:30 +00: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 05:07:03 +00: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-19 23:37:57 +00:00
|
|
|
|
|
|
|
in throwForRemovedArgs (import ./modules {
|
2022-04-17 22:14:41 +00:00
|
|
|
inherit pkgs lib check extraSpecialArgs;
|
2021-04-11 21:46:27 +00:00
|
|
|
configuration = { ... }: {
|
2023-05-07 09:26:13 +00:00
|
|
|
imports = modules
|
|
|
|
++ [{ programs.home-manager.path = toString ./.; }];
|
2023-10-06 23:32:49 +00:00
|
|
|
nixpkgs = {
|
|
|
|
config = nixpkgs.lib.mkDefault pkgs.config;
|
|
|
|
inherit (pkgs) overlays;
|
|
|
|
};
|
2021-04-11 21:46:27 +00:00
|
|
|
};
|
2022-06-19 23:37:57 +00:00
|
|
|
});
|
2021-04-11 21:46:27 +00:00
|
|
|
};
|
2023-04-14 10:42:03 +00: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-27 22:07:38 +00:00
|
|
|
in tests.run);
|
2023-04-14 10:42:03 +00:00
|
|
|
|
2023-06-27 21:32:30 +00:00
|
|
|
formatter = forAllSystems (system:
|
|
|
|
let pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in pkgs.linkFarm "format" [{
|
|
|
|
name = "bin/format";
|
|
|
|
path = ./format;
|
|
|
|
}]);
|
|
|
|
|
2023-04-14 10:42:03 +00:00
|
|
|
packages = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2023-06-28 21:55:00 +00:00
|
|
|
releaseInfo = nixpkgs.lib.importJSON ./release.json;
|
|
|
|
docs = import ./docs {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit (releaseInfo) release isReleaseBranch;
|
|
|
|
};
|
2023-05-07 09:26:13 +00:00
|
|
|
hmPkg = pkgs.callPackage ./home-manager { path = toString ./.; };
|
2023-04-14 10:42:03 +00:00
|
|
|
in {
|
2023-02-26 15:21:03 +00:00
|
|
|
default = hmPkg;
|
|
|
|
home-manager = hmPkg;
|
|
|
|
|
2022-06-07 18:45:06 +00:00
|
|
|
docs-html = docs.manual.html;
|
|
|
|
docs-json = docs.options.json;
|
2023-02-26 15:21:03 +00:00
|
|
|
docs-manpages = docs.manPages;
|
2023-04-14 10:42:03 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
defaultPackage = forAllSystems (system: self.packages.${system}.default);
|
|
|
|
});
|
2020-08-26 06:13:05 +00:00
|
|
|
}
|