authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-04-19 10:06:25-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-04-19 10:06:25-07:00
loge994781056b1537d2ab2e644323633de85cd1d8d
tree440fc0cde2610808e51cde871f540208e651428c
parentdce01a98324143d9a18111b2cfe2fbd7fa83912b
signature Commit is signed but in an unrecognized format.

refactor mkSystem


4 files changed, 28 insertions(+), 16 deletions(-)

hosts/desktop/configuration.nix+1-1
......@@ -11,7 +11,7 @@
1111
1212 ../../modules/shared/nix.nix
1313 ../../modules/nixos/nvidia.nix
14 ../../modules/nixos/boot.ni
14 ../../modules/nixos/boot.nix
1515 ];
1616 services.avahi = {
1717 enable = true;
hosts/laptop/configuration.nix-3
......@@ -5,12 +5,9 @@
55 ...
66}: {
77 imports = [
8 ../../modules/shared/vars.nix
98 ../../modules/shared/nix.nix
109 ../../modules/shared/extras.nix
11 ../../modules/shared/modules.nix
1210
13 ../../modules/shared/home-manager.nix
1411 ./modules/icons.nix
1512 ];
1613
lib/mkSystem.nix+25-12
......@@ -10,24 +10,31 @@
1010 darwin ? false,
1111 extraModules ? [],
1212}: let
13 # True if this is a WSL system.
14 # True if Linux, which is a heuristic for not being Darwin.
15 mkIfElse = p: yes: no:
16 nixpkgs.lib.mkMerge [
17 (nixpkgs.lib.mkIf p yes)
18 (nixpkgs.lib.mkIf (!p) no)
19 ];
20
21 nixindex = mkIfElse darwin inputs.nix-index-database.darwinModules.nix-index inputs.nix-index-database.nixosModules.nix-index;
13 # mkIfElse = p: yes: no:
14 # nixpkgs.lib.mkMerge [
15 # (nixpkgs.lib.mkIf p yes)
16 # (nixpkgs.lib.mkIf (!p) no)
17 # ];
18 nixindex =
19 if darwin
20 then inputs.nix-index-database.darwinModules.nix-index
21 else inputs.nix-index-database.nixosModules.nix-index;
2222
23 host = mkIfElse darwin "laptop" "desktop";
23 host =
24 if darwin
25 then "laptop"
26 else "desktop";
2427
2528 # The config files for this system.
2629
2730 hostConfig = ../hosts/${host}/configuration.nix;
2831
2932 # 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
3138 home-manager =
3239 if darwin
3340 then inputs.home-manager.darwinModules
......@@ -42,7 +49,13 @@ in
4249 # to go through and apply our system type. We do this first so
4350 # the overlays are available globally.
4451 {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
4659 hostConfig
4760 nixindex
4861 home-manager.home-manager
modules/shared/extras.nix+2
......@@ -6,4 +6,6 @@
66}: {
77 networking = {
88 };
9
10 inputs.programs.nix-index-database.comma.enable = true;
911}