diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-09-21 17:22:11 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-09-22 00:18:59 +0200 |
commit | fcf6b18857fa8cfe618aac31c502576fa9475309 (patch) | |
tree | 2dce8e5702d98256f61391f31488fc71db1a22f8 | |
parent | mkHost: Add extraOverlays argument (diff) | |
download | nixos-config-fcf6b18857fa8cfe618aac31c502576fa9475309.tar.gz nixos-config-fcf6b18857fa8cfe618aac31c502576fa9475309.tar.bz2 nixos-config-fcf6b18857fa8cfe618aac31c502576fa9475309.zip |
Move hosts declaration to flake.nix
-rw-r--r-- | flake.nix | 20 | ||||
-rw-r--r-- | hosts/default.nix | 19 |
2 files changed, 22 insertions, 17 deletions
diff --git a/flake.nix b/flake.nix index 3d61545..7338341 100644 --- a/flake.nix +++ b/flake.nix @@ -26,9 +26,27 @@ outputs = inputs @ { self, nixpkgs, home-manager, ... }: let user = "baitinq"; + + secrets = import ./secrets; + + dotfiles = ./dotfiles; + + hosts = [ + { host = "phobos"; system = "x86_64-linux"; extraOverlays = [ ]; timezone = secrets.main_timezone; location = secrets.main_location; } + { host = "luna"; system = "x86_64-linux"; extraOverlays = [ ]; timezone = secrets.main_timezone; location = secrets.main_location; } + ]; + + hardwares = [ + { hardware = "laptop"; } + { hardware = "chromebook"; } + { hardware = "virtualbox"; } + ]; + + commonInherits = { inherit (nixpkgs) lib; - inherit inputs user nixpkgs home-manager; + inherit inputs nixpkgs home-manager; + inherit user secrets dotfiles hosts hardwares; extraModules = [ ]; }; in diff --git a/hosts/default.nix b/hosts/default.nix index 7ddb3ad..6be70b0 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,20 +1,5 @@ -{ lib, inputs, extraModules, isNixOS, isIso, isHardware, user, nixpkgs, home-manager, ... }: +{ lib, inputs, secrets, dotfiles, hosts, hardwares, extraModules, isNixOS, isIso, isHardware, user, nixpkgs, home-manager, ... }: let - secrets = import ../secrets; - - dotfiles = ../dotfiles; - - hosts = [ - { host = "phobos"; system = "x86_64-linux"; extraOverlays = [ ]; timezone = secrets.main_timezone; location = secrets.main_location; } - { host = "luna"; system = "x86_64-linux"; extraOverlays = [ ]; timezone = secrets.main_timezone; location = secrets.main_location; } - ]; - - hardwares = [ - { hardware = "laptop"; } - { hardware = "chromebook"; } - { hardware = "virtualbox"; } - ]; - mkHost = { host, hardware, system, timezone, location, extraOverlays }: extraModules: isNixOS: isIso: isHardware: let pkgs = import nixpkgs { @@ -29,7 +14,9 @@ let (import ../overlays) ] ++ extraOverlays; }; + extraArgs = { inherit pkgs inputs isIso isHardware user secrets dotfiles timezone location; hostname = host; }; + extraSpecialModules = extraModules ++ lib.optional isHardware ../hardware/${hardware} ++ lib.optional isIso "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; in if isNixOS |