refactor mkSystem
This commit is contained in:
parent
dce01a9832
commit
e994781056
4 changed files with 28 additions and 16 deletions
|
@ -11,7 +11,7 @@
|
|||
|
||||
../../modules/shared/nix.nix
|
||||
../../modules/nixos/nvidia.nix
|
||||
../../modules/nixos/boot.ni
|
||||
../../modules/nixos/boot.nix
|
||||
];
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
|
|
|
@ -5,12 +5,9 @@
|
|||
...
|
||||
}: {
|
||||
imports = [
|
||||
../../modules/shared/vars.nix
|
||||
../../modules/shared/nix.nix
|
||||
../../modules/shared/extras.nix
|
||||
../../modules/shared/modules.nix
|
||||
|
||||
../../modules/shared/home-manager.nix
|
||||
./modules/icons.nix
|
||||
];
|
||||
|
||||
|
|
|
@ -10,24 +10,31 @@
|
|||
darwin ? false,
|
||||
extraModules ? [],
|
||||
}: let
|
||||
# True if this is a WSL system.
|
||||
# True if Linux, which is a heuristic for not being Darwin.
|
||||
mkIfElse = p: yes: no:
|
||||
nixpkgs.lib.mkMerge [
|
||||
(nixpkgs.lib.mkIf p yes)
|
||||
(nixpkgs.lib.mkIf (!p) no)
|
||||
];
|
||||
# mkIfElse = p: yes: no:
|
||||
# nixpkgs.lib.mkMerge [
|
||||
# (nixpkgs.lib.mkIf p yes)
|
||||
# (nixpkgs.lib.mkIf (!p) no)
|
||||
# ];
|
||||
nixindex =
|
||||
if darwin
|
||||
then inputs.nix-index-database.darwinModules.nix-index
|
||||
else inputs.nix-index-database.nixosModules.nix-index;
|
||||
|
||||
nixindex = mkIfElse darwin inputs.nix-index-database.darwinModules.nix-index inputs.nix-index-database.nixosModules.nix-index;
|
||||
|
||||
host = mkIfElse darwin "laptop" "desktop";
|
||||
host =
|
||||
if darwin
|
||||
then "laptop"
|
||||
else "desktop";
|
||||
|
||||
# The config files for this system.
|
||||
|
||||
hostConfig = ../hosts/${host}/configuration.nix;
|
||||
|
||||
# NixOS vs nix-darwin functions
|
||||
systemFunc = mkIfElse darwin inputs.darwin.lib.darwinSystem nixpkgs.lib.nixosSystem;
|
||||
systemFunc =
|
||||
if darwin
|
||||
then inputs.darwin.lib.darwinSystem
|
||||
else nixpkgs.lib.nixosSystem;
|
||||
|
||||
home-manager =
|
||||
if darwin
|
||||
then inputs.home-manager.darwinModules
|
||||
|
@ -42,7 +49,13 @@ in
|
|||
# to go through and apply our system type. We do this first so
|
||||
# the overlays are available globally.
|
||||
{nixpkgs.overlays = overlays;}
|
||||
{inputs.programs.nix-index-database.comma.enable = true;}
|
||||
|
||||
# Enable caching for nix-index so we dont have to rebuild it
|
||||
|
||||
#shared modules
|
||||
../modules/shared/nix.nix
|
||||
../modules/shared/extras.nix
|
||||
|
||||
hostConfig
|
||||
nixindex
|
||||
home-manager.home-manager
|
||||
|
|
|
@ -6,4 +6,6 @@
|
|||
}: {
|
||||
networking = {
|
||||
};
|
||||
|
||||
inputs.programs.nix-index-database.comma.enable = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue