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 @@...@@ -11,7 +11,7 @@
1111
12 ../../modules/shared/nix.nix12 ../../modules/shared/nix.nix
13 ../../modules/nixos/nvidia.nix13 ../../modules/nixos/nvidia.nix
14 ../../modules/nixos/boot.ni14 ../../modules/nixos/boot.nix
15 ];15 ];
16 services.avahi = {16 services.avahi = {
17 enable = true;17 enable = true;
hosts/laptop/configuration.nix-3
...@@ -5,12 +5,9 @@...@@ -5,12 +5,9 @@
5 ...5 ...
6}: {6}: {
7 imports = [7 imports = [
8 ../../modules/shared/vars.nix
9 ../../modules/shared/nix.nix8 ../../modules/shared/nix.nix
10 ../../modules/shared/extras.nix9 ../../modules/shared/extras.nix
11 ../../modules/shared/modules.nix
1210
13 ../../modules/shared/home-manager.nix
14 ./modules/icons.nix11 ./modules/icons.nix
15 ];12 ];
1613
lib/mkSystem.nix+25-12
...@@ -10,24 +10,31 @@...@@ -10,24 +10,31 @@
10 darwin ? false,10 darwin ? false,
11 extraModules ? [],11 extraModules ? [],
12}: let12}: 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
2020 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;
2222
23 host = mkIfElse darwin "laptop" "desktop";23 host =
24 if darwin
25 then "laptop"
26 else "desktop";
2427
25 # The config files for this system.28 # The config files for this system.
2629
27 hostConfig = ../hosts/${host}/configuration.nix;30 hostConfig = ../hosts/${host}/configuration.nix;
2831
29 # NixOS vs nix-darwin functions32 # 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 darwin39 if darwin
33 then inputs.home-manager.darwinModules40 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 so49 # 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 hostConfig59 hostConfig
47 nixindex60 nixindex
48 home-manager.home-manager61 home-manager.home-manager
modules/shared/extras.nix+2
...@@ -6,4 +6,6 @@...@@ -6,4 +6,6 @@
6}: {6}: {
7 networking = {7 networking = {
8 };8 };
9
10 inputs.programs.nix-index-database.comma.enable = true;
9}11}