-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
125 lines (113 loc) · 3.56 KB
/
Copy pathflake.nix
File metadata and controls
125 lines (113 loc) · 3.56 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
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
118
119
120
121
122
123
124
125
{
description = "rain personal dotfiles";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, home-manager, deploy-rs, self, ... }:
let
lib = nixpkgs.lib;
hosts = import ./nix/nixos/hosts/map.nix;
infraPath = ./nix/infra.nix;
infra =
if builtins.pathExists infraPath
then import infraPath
else import ./nix/infra.nix.example;
local = import ./nix/local.nix;
mkHome =
{
system,
username,
homeDirectory,
dotfilesPath,
flakeHost,
extraModules ? [ ],
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { inherit system; };
modules = [
./nix/hm/default.nix
./nix/hm/from-flake-local.nix
] ++ extraModules;
extraSpecialArgs = {
inherit self username homeDirectory dotfilesPath flakeHost local;
};
};
# builtins.currentSystem is unset under flake eval — system comes from darwin-local.nix
homeConfigurationsDarwin =
let
localPath = ./nix/hm/darwin-local.nix;
in
if builtins.pathExists localPath then
let
l = import localPath;
in
lib.optionalAttrs (lib.hasSuffix "-darwin" l.system) {
darwin = mkHome {
system = l.system;
username = l.username;
homeDirectory = l.homeDirectory;
dotfilesPath = l.dotfilesPath;
flakeHost = "darwin";
extraModules = [
./nix/hm/profiles/darwin.nix
];
};
}
else
{ };
in
{
deploy.nodes.lovefield = {
hostname = hosts.lovefield.ethernet.ipv4;
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.lovefield;
};
remoteBuild = true;
};
# deploy-rs README suggests deployChecks for all deploy-rs.lib systems; that pulls
# x86_64-linux builds under `nix flake check` on Darwin. Re-enable selectively if you want.
# checks.x86_64-linux = deploy-rs.lib.x86_64-linux.deployChecks self.deploy;
nixosConfigurations.lovefield = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit self hosts infra; };
modules = [
home-manager.nixosModules.home-manager
./nix/nixos/hosts/lovefield/configuration.nix
];
};
homeConfigurations = {
lovefield = mkHome {
system = "x86_64-linux";
username = "rain";
homeDirectory = "/home/rain";
dotfilesPath = "/home/rain/build/dotfiles";
flakeHost = "lovefield";
};
realbox = mkHome {
system = "x86_64-linux";
username = "rain";
homeDirectory = "/home/rain";
dotfilesPath = "/home/rain/dev/dotfiles";
flakeHost = "realbox";
};
powerbox = mkHome {
system = "x86_64-linux";
username = "busybox";
homeDirectory = "/home/busybox";
dotfilesPath = "/home/busybox/dev/dotfiles";
flakeHost = "powerbox";
};
} // homeConfigurationsDarwin;
};
}