|
10 | 10 | # Track channels with commits tested and built by hydra |
11 | 11 | nixos.url = "github:nixos/nixpkgs/nixos-21.11"; |
12 | 12 | latest.url = "github:nixos/nixpkgs/nixos-unstable"; |
| 13 | + # For darwin hosts: it can be helpful to track this darwin-specific stable |
| 14 | + # channel equivalent to the `nixos-*` channels for NixOS. For one, these |
| 15 | + # channels are more likely to provide cached binaries for darwin systems. |
| 16 | + # But, perhaps even more usefully, it provides a place for adding |
| 17 | + # darwin-specific overlays and packages which could otherwise cause build |
| 18 | + # failures on Linux systems. |
| 19 | + nixpkgs-darwin-stable.url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; |
13 | 20 |
|
14 | 21 | digga.url = "github:divnix/digga"; |
15 | 22 | digga.inputs.nixpkgs.follows = "nixos"; |
|
25 | 32 | home.inputs.nixpkgs.follows = "nixos"; |
26 | 33 |
|
27 | 34 | darwin.url = "github:LnL7/nix-darwin"; |
28 | | - darwin.inputs.nixpkgs.follows = "nixos"; |
| 35 | + darwin.inputs.nixpkgs.follows = "nixpkgs-darwin-stable"; |
29 | 36 |
|
30 | 37 | deploy.url = "github:serokell/deploy-rs"; |
31 | 38 | deploy.inputs.nixpkgs.follows = "nixos"; |
|
55 | 62 | , agenix |
56 | 63 | , nvfetcher |
57 | 64 | , deploy |
| 65 | + , nixpkgs |
58 | 66 | , ... |
59 | 67 | } @ inputs: |
60 | 68 | digga.lib.mkFlake |
|
66 | 74 | channels = { |
67 | 75 | nixos = { |
68 | 76 | imports = [ (digga.lib.importOverlays ./overlays) ]; |
69 | | - overlays = [ |
70 | | - nur.overlay |
71 | | - agenix.overlay |
72 | | - nvfetcher.overlay |
73 | | - ./pkgs/default.nix |
74 | | - ]; |
| 77 | + overlays = [ ]; |
| 78 | + }; |
| 79 | + nixpkgs-darwin-stable = { |
| 80 | + imports = [ (digga.lib.importOverlays ./overlays) ]; |
| 81 | + overlays = [ ]; |
75 | 82 | }; |
76 | 83 | latest = { }; |
77 | 84 | }; |
|
85 | 92 | our = self.lib; |
86 | 93 | }); |
87 | 94 | }) |
| 95 | + |
| 96 | + nur.overlay |
| 97 | + agenix.overlay |
| 98 | + nvfetcher.overlay |
| 99 | + |
| 100 | + (import ./pkgs) |
88 | 101 | ]; |
89 | 102 |
|
90 | 103 | nixos = { |
|
102 | 115 | ]; |
103 | 116 | }; |
104 | 117 |
|
105 | | - imports = [ (digga.lib.importHosts ./hosts) ]; |
| 118 | + imports = [ (digga.lib.importHosts ./hosts/nixos) ]; |
106 | 119 | hosts = { |
107 | | - /* set host specific properties here */ |
| 120 | + /* set host-specific properties here */ |
108 | 121 | NixOS = { }; |
109 | 122 | }; |
110 | 123 | importables = rec { |
111 | 124 | profiles = digga.lib.rakeLeaves ./profiles // { |
112 | 125 | users = digga.lib.rakeLeaves ./users; |
113 | 126 | }; |
114 | 127 | suites = with profiles; rec { |
115 | | - base = [ core users.nixos users.root ]; |
| 128 | + base = [ core.nixos users.nixos users.root ]; |
| 129 | + }; |
| 130 | + }; |
| 131 | + }; |
| 132 | + |
| 133 | + darwin = { |
| 134 | + hostDefaults = { |
| 135 | + system = "x86_64-darwin"; |
| 136 | + channelName = "nixpkgs-darwin-stable"; |
| 137 | + imports = [ (digga.lib.importExportableModules ./modules) ]; |
| 138 | + modules = [ |
| 139 | + { lib.our = self.lib; } |
| 140 | + digga.darwinModules.nixConfig |
| 141 | + home.darwinModules.home-manager |
| 142 | + agenix.nixosModules.age |
| 143 | + ]; |
| 144 | + }; |
| 145 | + |
| 146 | + imports = [ (digga.lib.importHosts ./hosts/darwin) ]; |
| 147 | + hosts = { |
| 148 | + /* set host-specific properties here */ |
| 149 | + Mac = { }; |
| 150 | + }; |
| 151 | + importables = rec { |
| 152 | + profiles = digga.lib.rakeLeaves ./profiles // { |
| 153 | + users = digga.lib.rakeLeaves ./users; |
| 154 | + }; |
| 155 | + suites = with profiles; rec { |
| 156 | + base = [ core.darwin users.darwin ]; |
116 | 157 | }; |
117 | 158 | }; |
118 | 159 | }; |
|
127 | 168 | }; |
128 | 169 | }; |
129 | 170 | users = { |
| 171 | + # TODO: does this naming convention still make sense with darwin support? |
| 172 | + # |
| 173 | + # - it doesn't make sense to make a 'nixos' user available on |
| 174 | + # darwin, and vice versa |
| 175 | + # |
| 176 | + # - the 'nixos' user might have special significance as the default |
| 177 | + # user for fresh systems |
| 178 | + # |
| 179 | + # - perhaps a system-agnostic home-manager user is more appropriate? |
| 180 | + # something like 'primaryuser'? |
| 181 | + # |
| 182 | + # all that said, these only exist within the `hmUsers` attrset, so |
| 183 | + # it could just be left to the developer to determine what's |
| 184 | + # appropriate. after all, configuring these hm users is one of the |
| 185 | + # first steps in customizing the template. |
130 | 186 | nixos = { suites, ... }: { imports = suites.base; }; |
| 187 | + darwin = { suites, ... }: { imports = suites.base; }; |
131 | 188 | }; # digga.lib.importers.rakeLeaves ./users/hm; |
132 | 189 | }; |
133 | 190 |
|
134 | 191 | devshell = ./shell; |
135 | 192 |
|
136 | | - homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; |
| 193 | + # TODO: similar to the above note: does it make sense to make all of |
| 194 | + # these users available on all systems? |
| 195 | + homeConfigurations = digga.lib.mergeAny |
| 196 | + (digga.lib.mkHomeConfigurations self.darwinConfigurations) |
| 197 | + (digga.lib.mkHomeConfigurations self.nixosConfigurations) |
| 198 | + ; |
137 | 199 |
|
138 | 200 | deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; |
139 | 201 |
|
|
0 commit comments