1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 16:19:44 +01:00
home-manager/flake.nix
contrun c4c761ba55
add flake attribute apps to make it easier to run (#2442)
Home Manager can be ran with
`nix run --no-write-lock-file github:nix-community/home-manager`.

This is useful for people who want to try out Home Manager or,
want to bootstrap their home-environment.
2021-11-23 01:36:55 -05:00

60 lines
2 KiB
Nix

{
description = "Home Manager for Nix";
outputs = { self, nixpkgs }:
let
# List of systems supported by home-manager binary
supportedSystems = nixpkgs.lib.platforms.unix;
# Function to generate a set based on supported systems
forAllSystems = f:
nixpkgs.lib.genAttrs supportedSystems (system: f system);
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;
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;
});
defaultPackage =
forAllSystems (system: self.packages.${system}.home-manager);
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
, check ? true, stateVersion ? "20.09" }@args:
assert nixpkgs.lib.versionAtLeast stateVersion "20.09";
import ./modules {
inherit pkgs check extraSpecialArgs;
configuration = { ... }: {
imports = [ configuration ] ++ extraModules;
home = { inherit homeDirectory stateVersion username; };
nixpkgs = { inherit (pkgs) config overlays; };
};
};
};
};
}