| ... | @@ -10,24 +10,31 @@ | ... | @@ -10,24 +10,31 @@ |
| 10 | darwin ? false, | 10 | darwin ? false, |
| 11 | extraModules ? [], | 11 | extraModules ? [], |
| 12 | }: let | 12 | }: let |
| 13 | # True if this is a WSL system. | 13 | # mkIfElse = p: yes: no: |
| 14 | # True if Linux, which is a heuristic for not being Darwin. | 14 | # nixpkgs.lib.mkMerge [ |
| 15 | mkIfElse = p: yes: no: | 15 | # (nixpkgs.lib.mkIf p yes) |
| 16 | nixpkgs.lib.mkMerge [ | 16 | # (nixpkgs.lib.mkIf (!p) no) |
| 17 | (nixpkgs.lib.mkIf p yes) | 17 | # ]; |
| 18 | (nixpkgs.lib.mkIf (!p) no) | 18 | nixindex = |
| 19 | ]; | 19 | if darwin |
| 20 | | 20 | then inputs.nix-index-database.darwinModules.nix-index |
| 21 | nixindex = mkIfElse darwin inputs.nix-index-database.darwinModules.nix-index inputs.nix-index-database.nixosModules.nix-index; | 21 | else inputs.nix-index-database.nixosModules.nix-index; |
| 22 | | 22 | |
| 23 | host = mkIfElse darwin "laptop" "desktop"; | 23 | host = |
| | 24 | if darwin |
| | 25 | then "laptop" |
| | 26 | else "desktop"; |
| 24 | | 27 | |
| 25 | # The config files for this system. | 28 | # The config files for this system. |
| 26 | | 29 | |
| 27 | hostConfig = ../hosts/${host}/configuration.nix; | 30 | hostConfig = ../hosts/${host}/configuration.nix; |
| 28 | | 31 | |
| 29 | # NixOS vs nix-darwin functions | 32 | # NixOS vs nix-darwin functions |
| 30 | systemFunc = mkIfElse darwin inputs.darwin.lib.darwinSystem nixpkgs.lib.nixosSystem; | 33 | systemFunc = |
| | 34 | if darwin |
| | 35 | then inputs.darwin.lib.darwinSystem |
| | 36 | else nixpkgs.lib.nixosSystem; |
| | 37 | |
| 31 | home-manager = | 38 | home-manager = |
| 32 | if darwin | 39 | if darwin |
| 33 | then inputs.home-manager.darwinModules | 40 | then inputs.home-manager.darwinModules |
| ... | @@ -42,7 +49,13 @@ in | ... | @@ -42,7 +49,13 @@ in |
| 42 | # to go through and apply our system type. We do this first so | 49 | # to go through and apply our system type. We do this first so |
| 43 | # the overlays are available globally. | 50 | # the overlays are available globally. |
| 44 | {nixpkgs.overlays = overlays;} | 51 | {nixpkgs.overlays = overlays;} |
| 45 | {inputs.programs.nix-index-database.comma.enable = true;} | 52 | |
| | 53 | # Enable caching for nix-index so we dont have to rebuild it |
| | 54 | |
| | 55 | #shared modules |
| | 56 | ../modules/shared/nix.nix |
| | 57 | ../modules/shared/extras.nix |
| | 58 | |
| 46 | hostConfig | 59 | hostConfig |
| 47 | nixindex | 60 | nixindex |
| 48 | home-manager.home-manager | 61 | home-manager.home-manager |