-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
117 lines (100 loc) · 3.52 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
description = "Maksar Nix system configs, and some other useful stuff.";
inputs = {
# Package sets
nixpkgs.url = "github:nixos/nixpkgs/master";
# Environment/system management
darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Other sources
comma.url = "github:DavHau/comma/flake";
comma.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, darwin, home-manager, flake-utils, ... }@inputs:
let
nixpkgsConfig = {
config = { allowUnfree = true; };
};
homeManagerCommonConfig = { imports = [ ./home ]; };
# Modules shared by most `nix-darwin` personal configurations.
nixDarwinCommonModules = [
# Include extra `nix-darwin`
self.darwinModules.users
# Main `nix-darwin` config
./darwin
# `home-manager` module
home-manager.darwinModules.home-manager
({ config, lib, ... }:
let inherit (config.users) primaryUser;
in {
nixpkgs = nixpkgsConfig;
users.users.${primaryUser}.home = "/Users/${primaryUser}";
home-manager.useGlobalPkgs = true;
home-manager.users.${primaryUser} = homeManagerCommonConfig // {
os = "darwin";
dropboxEnabled = true;
};
})
];
in {
# Personal configuration ------------------------------------------------------------------- {{{
# My `nix-darwin` configs
darwinConfigurations = {
# Mininal configuration to bootstrap systems
bootstrap = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [ ./darwin/nix { nixpkgs = nixpkgsConfig; } ];
};
# Config with small modifications needed/desired for CI with GitHub workflow
githubCI = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = nixDarwinCommonModules ++ [
({ lib, ... }: {
users.primaryUser = "runner";
homebrew.enable = lib.mkForce false;
dropboxEnabled = false;
})
];
};
# My macOS main laptop config
macbook = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = nixDarwinCommonModules ++ [{
system.stateVersion = 5;
users.primaryUser = "maksar";
networking.computerName = "Maksar 💻";
networking.hostName = "MaksarBookPro";
}];
};
};
# Build and activate with `nix build .#cloudVM.activationPackage; ./result/activate`
cloudVM = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs ( nixpkgsConfig // {
system = "x86_64-linux";
});
modules = [
homeManagerCommonConfig
{
os = "linux";
home.username = "maksar";
home.homeDirectory = "/home/maksar";
dropboxEnabled = false;
}
];
};
overlays = with inputs;
[
(final: prev: {
# Some packages
comma = import comma { inherit (prev) pkgs; };
})
];
# My `nix-darwin` modules that are pending upstream, or patched versions waiting on upstream fixes.
darwinModules = {
users = import ./modules/darwin/users.nix;
};
};
}