-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
131 lines (119 loc) · 3.77 KB
/
Copy pathflake.nix
File metadata and controls
131 lines (119 loc) · 3.77 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
126
127
128
129
130
131
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
nur.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# look into un-colocating jj repos when merged:
# https://github.com/helix-editor/helix/pull/12022
helix.url = "github:helix-editor/helix";
helix.inputs.nixpkgs.follows = "nixpkgs";
helix.inputs.rust-overlay.follows = "rust-overlay";
jj.url = "github:bryceberger/jj/mm";
jj.inputs.nixpkgs.follows = "nixpkgs";
jj.inputs.flake-utils.follows = "flake-utils";
jj.inputs.rust-overlay.follows = "rust-overlay";
};
outputs = {
nixpkgs,
home-manager,
...
} @ inputs: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
config.rocmSupport = true;
};
overlays = [
(import ./overlays.nix {inherit system inputs;})
inputs.nur.overlays.default
];
registry = {
# useful to do `nix shell np#hello` and get it from the *local* nixpkgs,
# instead of downloading the same commit again
nix.registry.np.flake = nixpkgs;
nixpkgs.config.allowUnfree = true;
home.packages = [
home-manager.packages.${system}.default
];
};
nixosConfigurations = let
make_system = hostname:
nixpkgs.lib.nixosSystem {
inherit system pkgs;
specialArgs.hostname = hostname;
modules = [
./system/common.nix
./system/${hostname}.nix
];
};
make = names:
builtins.listToAttrs (map (name: {
inherit name;
value = make_system name;
})
names);
in
make ["luna" "janus" "encaladus"];
homeConfigurations = let
make_home = args:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = args // {inherit inputs system;};
modules = [
./home/${args.hostname}.nix
registry
];
};
make = defaults: names:
builtins.listToAttrs (map (n: let
args.name = n.name or defaults.name;
args.hostname = n.hostname or n;
args.username = n.username or defaults.username;
args.email = n.email or defaults.email;
args.gpg-key = n.gpg-key or defaults.gpg-key;
in {
name = n.home-name or "${args.username}@${args.hostname}";
value = make_home args;
})
names);
in
make {
name = "Bryce Berger";
username = "bryce";
email = "bryce.z.berger@gmail.com";
gpg-key = "FDBF801F1CE5FB66EC3075C058CA4F9FEF8F4296";
} [
"luna"
"janus"
"encaladus"
{
hostname = "mimas";
username = "bryce.berger.local";
home-name = "bryce.berger.local";
gpg-key = "68DF074C1EA2114F91AD98E3F0353FDEC1417AFA";
}
];
both = user: host:
pkgs.linkFarm "both" {
system = nixosConfigurations.${host}.config.system.build.toplevel;
home = homeConfigurations."${user}@${host}".config.home.activationPackage;
};
in {
inherit pkgs nixosConfigurations homeConfigurations;
packages.${system}.home-manager = home-manager.packages.${system}.default;
devShells.${system}.default = pkgs.mkShellNoCC {
packages = with pkgs; [
just
];
};
luna = both "bryce" "luna";
janus = both "bryce" "janus";
encaladus = both "bryce" "encaladus";
};
}