-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
92 lines (92 loc) · 2.72 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
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{
self,
flake-utils,
nixpkgs,
home-manager,
nix-index-database,
...
}:
let
mkPkgs = (
system:
import nixpkgs {
inherit system;
# config.allowUnfree = true;
overlays = [
nix-index-database.overlays.nix-index
(import ./overlay inputs)
];
}
);
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = mkPkgs system;
in
{
# Make a system-specific package for every homeConfiguration
packages = nixpkgs.lib.attrsets.filterAttrs (_: v: v.system == system) (
builtins.mapAttrs (_: cfg: cfg.activationPackage) self.homeConfigurations
);
apps.default = flake-utils.lib.mkApp {
drv = pkgs.writeShellScriptBin "apply-config" ''
set -x
${home-manager.packages.${system}.home-manager}/bin/home-manager --flake "${./.}" switch
'';
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.nixfmt-rfc-style
pkgs.shfmt
pkgs.shellcheck
pkgs.nil
pkgs.sumneko-lua-language-server
];
buildInputs = [ ];
};
}
)
// {
homeConfigurations =
builtins.mapAttrs
(
_: cfg:
home-manager.lib.homeManagerConfiguration (
cfg // { modules = [ ./modules/home.nix ] ++ cfg.modules; }
)
)
{
"reeto@zeus" = {
modules = [ ./zeus.nix ];
pkgs = mkPkgs flake-utils.lib.system.x86_64-linux;
};
"reeto@iapetus.c.googlers.com" = {
modules = [ ./glinux.nix ];
pkgs = mkPkgs flake-utils.lib.system.x86_64-linux;
};
"reeto@kronos.lon.corp.google.com" = {
modules = [ ./glinux.nix ];
pkgs = mkPkgs flake-utils.lib.system.x86_64-linux;
};
"reeto@oceanus.roam.internal" = {
modules = [ ./oceanus.nix ];
pkgs = mkPkgs flake-utils.lib.system.x86_64-darwin;
};
"reeto@poseidon" = {
modules = [ ./poseidon.nix ];
pkgs = mkPkgs flake-utils.lib.system.aarch64-darwin;
};
};
};
}