1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00
home-manager/flake.nix

61 lines
2.1 KiB
Nix
Raw Normal View History

{
description = "Home Manager for Nix";
outputs = { self, nixpkgs }:
let
# List of systems supported by home-manager binary
supportedSystems = with nixpkgs.lib.platforms; linux ++ darwin;
# Function to generate a set based on supported systems
2022-04-20 20:18:39 +02:00
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
2020-08-27 18:38:15 +02:00
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in rec {
nixosModules.home-manager = import ./nixos;
nixosModule = self.nixosModules.home-manager;
darwinModules.home-manager = import ./nix-darwin;
darwinModule = self.darwinModules.home-manager;
2021-09-18 04:33:20 +02:00
packages = forAllSystems (system:
let docs = import ./docs { pkgs = nixpkgsFor.${system}; };
in {
home-manager = nixpkgsFor.${system}.callPackage ./home-manager { };
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
default = self.packages.${system}.home-manager;
2021-09-18 04:33:20 +02:00
});
# defaultPackage is deprecated as of Nix 2.7.0
defaultPackage = forAllSystems (system: self.packages.${system}.default);
apps = forAllSystems (system: {
home-manager = {
type = "app";
program = "${defaultPackage.${system}}/bin/home-manager";
};
});
defaultApp = forAllSystems (system: apps.${system}.home-manager);
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; };
};
};
};
};
}