2020-08-26 08:13:05 +02:00
|
|
|
{
|
|
|
|
description = "Home Manager for Nix";
|
|
|
|
|
2023-07-01 12:33:55 +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
|
2024-01-15 10:38:28 +01:00
|
|
|
'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.xhtml#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 = { ... }: {
|
2024-04-02 02:05:46 +02:00
|
|
|
imports = modules ++ [{ programs.home-manager.path = "${./.}"; }];
|
2023-10-07 01:32:49 +02:00
|
|
|
nixpkgs = {
|
|
|
|
config = nixpkgs.lib.mkDefault pkgs.config;
|
|
|
|
inherit (pkgs) 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-28 00:07:38 +02:00
|
|
|
in tests.run);
|
2023-04-14 12:42:03 +02:00
|
|
|
|
2023-06-27 23:32:30 +02:00
|
|
|
formatter = forAllSystems (system:
|
|
|
|
let pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in pkgs.linkFarm "format" [{
|
|
|
|
name = "bin/format";
|
|
|
|
path = ./format;
|
|
|
|
}]);
|
|
|
|
|
2023-04-14 12:42:03 +02:00
|
|
|
packages = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2023-12-14 08:05:51 +01:00
|
|
|
lib = pkgs.lib;
|
2023-06-28 23:55:00 +02:00
|
|
|
releaseInfo = nixpkgs.lib.importJSON ./release.json;
|
|
|
|
docs = import ./docs {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit (releaseInfo) release isReleaseBranch;
|
|
|
|
};
|
2024-04-02 02:05:46 +02:00
|
|
|
hmPkg = pkgs.callPackage ./home-manager { path = "${./.}"; };
|
2023-12-14 08:05:51 +01:00
|
|
|
|
|
|
|
testPackages = let
|
|
|
|
tests = import ./tests { inherit pkgs; };
|
|
|
|
renameTestPkg = n: lib.nameValuePair "test-${n}";
|
|
|
|
in lib.mapAttrs' renameTestPkg tests.build;
|
2024-02-12 23:35:55 +01:00
|
|
|
|
|
|
|
integrationTestPackages = let
|
|
|
|
tests = import ./tests/integration { inherit pkgs; };
|
|
|
|
renameTestPkg = n: lib.nameValuePair "integration-test-${n}";
|
|
|
|
in lib.mapAttrs' renameTestPkg tests;
|
2023-04-14 12:42:03 +02:00
|
|
|
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;
|
2024-02-12 23:35:55 +01:00
|
|
|
} // testPackages // integrationTestPackages);
|
2023-04-14 12:42:03 +02:00
|
|
|
|
|
|
|
defaultPackage = forAllSystems (system: self.packages.${system}.default);
|
|
|
|
});
|
2020-08-26 08:13:05 +02:00
|
|
|
}
|