blob: e7bf6b1ec735003c1aabaf9fb7129f9e78e3d21c (
plain)
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
|
let
hosts = {
turing = {
user = "grace";
home = "/Users/grace";
system = "aarch64-darwin";
type = "darwin";
};
"cs.purdue.edu" = {
user = "yoder177";
home = "/homes/yoder177";
system = "x86_64-linux";
type = "home";
};
vulcan = {
user = "scie";
home = "/home/scie";
system = "x86_64-linux";
type = "home";
};
dijkstra = {
user = "scie";
home = "/home/scie";
system = "x86_64-linux";
type = "home";
};
knuth = {
user = "grace";
home = "/home/scie";
system = "x86_64-linux";
type = "nixos";
};
};
hostname = builtins.getEnv "NIX_HOST";
name =
if builtins.match "(.+\\.)?cs\\.purdue\\.edu" hostname != null then
"cs.purdue.edu"
else
builtins.head (builtins.split "\\." hostname);
in
(hosts.${name} or (throw "Set NIX_HOST to a host in hosts.nix (got '${hostname}')."))
// { inherit name; }
|