-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.nix
60 lines (55 loc) · 1.41 KB
/
bootstrap.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
{
system,
inputs,
username ? "skip",
homeDirectory ? (
if system == "aarch64-linux" || system == "x86_64-linux" then
"/home/${username}"
else
"/Users/${username}"
),
specialArgs ? { },
server ? "infer",
}:
let
inherit (inputs) home-manager nixpkgs;
inherit (nixpkgs) lib;
isLinux = system == "x86_64-linux" || system == "aarch64-linux";
isDarwin = system == "aarch64-darwin" || system == "x86_64-darwin";
serverResolved = if server == "infer" then isLinux else server;
in
home-manager.lib.homeManagerConfiguration {
modules = [
./home.nix
../modules/hh3.nix
(
{ ... }:
{
home.username = username;
home.homeDirectory = homeDirectory;
}
)
];
# see: https://zimbatm.com/notes/1000-instances-of-nixpkgs
# do we _need_ to do this? maybe as long as we only do it once (here), it's ok.
pkgs = import nixpkgs {
config.allowUnfree = true;
inherit system;
};
extraSpecialArgs =
let
workstationArgs = {
# creates out-of-store symlinks for some configs so you don't
# constantly incur the overhead of a nix build
ergonomic = true;
ergonomicRepoPath = "${homeDirectory}/src/prj/nixfiles";
};
in
{
# always forward flake inputs
inherit inputs;
server = serverResolved;
}
// (lib.optionalAttrs (!serverResolved) workstationArgs)
// specialArgs;
}