|
28 | 28 | nixos-raspberrypi, |
29 | 29 | }: |
30 | 30 | let |
31 | | - systems = [ |
32 | | - "aarch64-darwin" |
33 | | - "aarch64-linux" |
34 | | - "x86_64-linux" |
35 | | - ]; |
36 | | - mkFlakeOutput = f: nixpkgs.lib.genAttrs systems f; |
37 | | - |
38 | | - # NOTE: used by ./home/git.nix |
| 31 | + # NOTE: a special arg used by ./home/git.nix |
39 | 32 | git = { |
40 | 33 | settings = { |
41 | 34 | user.name = "Gregory Conrad"; |
42 | 35 | |
43 | 36 | }; |
44 | 37 | }; |
| 38 | + in |
| 39 | + { |
| 40 | + lib = { |
| 41 | + mkFlakeOutput = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed f; |
45 | 42 |
|
46 | | - mkHomeManagerModule = specialArgs: homeManagerModules: { |
47 | | - home-manager.useGlobalPkgs = true; |
48 | | - home-manager.useUserPackages = true; |
49 | | - home-manager.extraSpecialArgs = specialArgs // { |
50 | | - inherit git; |
| 43 | + mkHomeManagerModule = specialArgs: homeManagerModules: { |
| 44 | + home-manager.useGlobalPkgs = true; |
| 45 | + home-manager.useUserPackages = true; |
| 46 | + home-manager.extraSpecialArgs = specialArgs; |
| 47 | + home-manager.users.${specialArgs.username} = nixpkgs.lib.mkMerge homeManagerModules; |
51 | 48 | }; |
52 | | - home-manager.users.${specialArgs.username} = nixpkgs.lib.mkMerge homeManagerModules; |
53 | 49 | }; |
54 | | - in |
55 | | - { |
56 | | - formatter = mkFlakeOutput (system: nixpkgs.legacyPackages.${system}.nixfmt-tree); |
57 | | - apps = mkFlakeOutput (system: { |
| 50 | + |
| 51 | + formatter = self.lib.mkFlakeOutput (system: nixpkgs.legacyPackages.${system}.nixfmt-tree); |
| 52 | + apps = self.lib.mkFlakeOutput (system: { |
58 | 53 | deploy-rs = deploy-rs.apps.${system}.deploy-rs; |
59 | 54 | }); |
60 | 55 | deploy = import ./deploy inputs; |
61 | | - devShells = mkFlakeOutput ( |
| 56 | + devShells = self.lib.mkFlakeOutput ( |
62 | 57 | system: |
63 | 58 | let |
64 | 59 | pkgs = nixpkgs.legacyPackages.${system}; |
|
83 | 78 | username = "gconrad"; |
84 | 79 | hostname = "Groog-MBP"; |
85 | 80 | specialArgs = inputs // { |
86 | | - inherit username hostname; |
| 81 | + inherit username hostname git; |
87 | 82 | }; |
88 | 83 | in |
89 | 84 | nix-darwin.lib.darwinSystem { |
90 | 85 | inherit specialArgs; |
91 | 86 | modules = [ |
92 | 87 | ./modules/darwin-common.nix |
| 88 | + ./modules/darwin-nix.nix |
93 | 89 | ./hosts/Groog-MBP.nix |
94 | 90 | home-manager.darwinModules.home-manager |
95 | | - (mkHomeManagerModule specialArgs [ |
| 91 | + (self.lib.mkHomeManagerModule specialArgs [ |
96 | 92 | (import ./home) |
97 | 93 | (import ./home/personal.nix) |
98 | 94 | ]) |
99 | 95 | ]; |
100 | 96 | }; |
101 | 97 |
|
102 | | - darwinConfigurations.Greg-Work-MBP = |
103 | | - let |
104 | | - username = "greg"; |
105 | | - hostname = "Greg-Work-MBP"; |
106 | | - specialArgs = inputs // { |
107 | | - inherit username hostname; |
108 | | - }; |
109 | | - workExtrasPath = "/Users/greg/Documents/work-darwin-config.nix"; |
110 | | - in |
111 | | - nix-darwin.lib.darwinSystem { |
112 | | - inherit specialArgs; |
113 | | - modules = [ |
114 | | - ./modules/darwin-common.nix |
115 | | - ./hosts/Greg-Work-MBP.nix |
116 | | - home-manager.darwinModules.home-manager |
117 | | - (mkHomeManagerModule specialArgs [ (import ./home) ]) |
118 | | - |
119 | | - # NOTE: this out-of-repo import is what requires impure. |
120 | | - # Frankly too much effort to do this a "proper" way, like: |
121 | | - # - A private git repo, that is added as a git submodule |
122 | | - # - Via secret management (never looked into this enough) |
123 | | - (if builtins.pathExists workExtrasPath then import workExtrasPath else { }) |
124 | | - ]; |
125 | | - }; |
126 | | - |
127 | 98 | nixosConfigurations.optimus = |
128 | 99 | let |
129 | 100 | username = "gconrad"; |
|
132 | 103 | nodeIP = "100.64.0.1"; |
133 | 104 | }; |
134 | 105 | specialArgs = inputs // { |
135 | | - inherit username hostname k3sConfig; |
| 106 | + inherit username hostname git k3sConfig; |
136 | 107 | }; |
137 | 108 | in |
138 | 109 | nixpkgs.lib.nixosSystem { |
|
145 | 116 | ./modules/k8s/leader.nix |
146 | 117 | ./hosts/optimus |
147 | 118 | home-manager.nixosModules.home-manager |
148 | | - (mkHomeManagerModule specialArgs [ (import ./home) ]) |
| 119 | + (self.lib.mkHomeManagerModule specialArgs [ (import ./home) ]) |
149 | 120 | ]; |
150 | 121 | }; |
151 | 122 |
|
|
0 commit comments