Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
91 lines (82 loc) · 2.4 KB
/
Copy pathflake.nix
File metadata and controls
91 lines (82 loc) · 2.4 KB
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
{
description = "Hannoeru's dotfiles, managed with nix-darwin and home-manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin = {
url = "github:nix-darwin/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nanorc = {
url = "github:scopatz/nanorc";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
nix-darwin,
home-manager,
nanorc,
}:
let
lib = nixpkgs.lib;
machines = import ./machines.nix;
mkHome =
{ system, machine }:
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = { inherit machine nanorc; };
modules = [ ./modules/home ];
};
in
{
darwinConfigurations = lib.mapAttrs (
name: machine:
nix-darwin.lib.darwinSystem {
specialArgs = { inherit machine nanorc; };
modules = [
./modules/darwin.nix
home-manager.darwinModules.home-manager
];
}
) (lib.filterAttrs (name: machine: machine.os == "darwin") machines);
homeConfigurations = lib.concatMapAttrs (name: machine: {
"${name}" = mkHome {
system = "x86_64-linux";
inherit machine;
};
"${name}-aarch64" = mkHome {
system = "aarch64-linux";
inherit machine;
};
}) (lib.filterAttrs (name: machine: machine.os == "linux") machines);
# Pinned entry points so bootstrap does not depend on the global
# flake registry.
apps =
let
mkApp = pkg: {
type = "app";
program = lib.getExe pkg;
};
in
lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: {
home-manager = mkApp home-manager.packages.${system}.home-manager;
})
// lib.genAttrs [ "aarch64-darwin" ] (system: {
darwin-rebuild = mkApp (
(import nixpkgs {
inherit system;
overlays = [ nix-darwin.overlays.default ];
}).darwin-rebuild
);
});
formatter = lib.genAttrs [ "aarch64-darwin" "x86_64-linux" "aarch64-linux" ] (
system: nixpkgs.legacyPackages.${system}.nixfmt-tree
);
};
}