-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
67 lines (61 loc) · 2.38 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
# TODO: Tangle parts of the copied bits from source
# The idea is that my dotfiles becomes the one-stop shop for my entire config
# setup. No more will I work with separate nixos-configuration and home-manager
# setups.
{
description = "David's Darwin (macOS) system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
linsk.url = "github:vidbina/linsk/vid/init-nix-flake";
linsk.inputs.nixpkgs.follows = "nixpkgs";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
vscode-extensions.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, nix-darwin, home-manager, ... }:
let
machines = [
{ name = "tokyo23-m2"; system = "aarch64-darwin"; username = "vidbina"; }
{ name = "berlin-4corei7"; system = "x86_64-darwin"; username = "vidbina"; }
];
darwinConfigurationFor = machine: nix-darwin.lib.darwinSystem {
inherit (machine) system;
# See https://github.com/LnL7/nix-darwin#using-flake-inputs
specialArgs = {
inherit inputs;
# TODO: Refactor to DRY-up shared specialArgs use across configs
inherit (machine) username;
};
modules = [
./configuration-darwin.nix
# https://nix-community.github.io/home-manager/nix-darwin-options.html
home-manager.darwinModules.home-manager
{
home-manager.backupFileExtension = "backup";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${machine.username} = import ./home-darwin.nix;
home-manager.verbose = true;
}
];
};
in
{
darwinConfigurations =
builtins.listToAttrs (map
(machine: {
inherit (machine) name;
value = darwinConfigurationFor machine;
})
machines);
# TODO: Bring Linux configuration into scope
# See https://github.com/vidbina/nixos-configuration
# nixosConfigurations.""
};
}