-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
95 lines (81 loc) · 2.77 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# my-dotfiles | Copyright (C) 2025 eth-p
# Repository: https://github.com/eth-p/my-dotfiles
#
# This flake holds my configurations.
# ==============================================================================
{
description = ''
Flake to configure my dotfiles and user packages.
'';
inputs = {
# home-manager is used to manage dotfiles and user config.
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# nixpkgs is for installing packages.
nixpkgs.url = "nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
# library functions.
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, nixpkgs-unstable, flake-utils, home-manager, ... } @ inputs:
let
inherit (home-manager.lib) homeManagerConfiguration;
# Load any lib nix files defined in this repo.
lib = (import ./lib/nix) { lib = nixpkgs.lib; } // inputs;
# Read information from the bootstrap data.
bootstrap = builtins.fromJSON (builtins.readFile ./bootstrap.json);
system = bootstrap.system;
in
{
inherit lib;
# homeConfigurations declares the home-manager profiles.
#
# This performs a map operation over each profile declared in
# `./profiles` to create a corresponding per-system
# `home-manager.lib.homeManagerConfiguration` instance.
homeConfigurations = (
let
# Get the nixpkgs for the current system (platform).
pkgs = import nixpkgs { inherit system; };
pkgs-unstable = import nixpkgs-unstable { inherit system; };
# Utilities to pass around.
ctx = {
inherit bootstrap;
isDarwin = (builtins.elem system nixpkgs.lib.platforms.darwin);
};
my-dotfiles = {
inherit lib;
};
# Get program modules.
modules = import ./programs;
# Get the declarative profiles.
profiles = {
minimal = ./profiles/minimal.nix;
standard = ./profiles/standard.nix;
development = ./profiles/development.nix;
};
in
# profile -> homeManagerConfiguration { (defaults), ...profile }
builtins.mapAttrs
(profileName: profileFile:
homeManagerConfiguration {
inherit pkgs;
modules = modules ++ [
./programs/globals.nix
profileFile
./bootstrap.nix
./config.nix
];
extraSpecialArgs = {
inherit ctx;
inherit pkgs-unstable;
inherit my-dotfiles;
};
}
)
profiles
);
};
}