summaryrefslogtreecommitdiffstats
path: root/hosts/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/default.nix')
-rw-r--r--hosts/default.nix91
1 files changed, 40 insertions, 51 deletions
diff --git a/hosts/default.nix b/hosts/default.nix
index fc18d556..4a3d52fc 100644
--- a/hosts/default.nix
+++ b/hosts/default.nix
@@ -1,64 +1,53 @@
-# nixos-config - My current NixOS configuration
-#
-# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
-# SPDX-License-Identifier: GPL-3.0-or-later
-#
-# This file is part of my nixos-config.
-#
-# You should have received a copy of the License along with this program.
-# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
self,
- sources,
- nixpkgs,
+ extra_lib,
+ module_args,
+ extra_modules,
+ special_args,
+ nixpkgs-stable,
+ nixpkgs-unstable,
+ deploy-rs,
system,
- openPRsNixpkgs,
- packageSets,
- libraries,
- modules,
- externalDependencies,
- externalBinaries,
}: let
- hosts = libraries.extra.mkByName {
+ hosts = extra_lib.mkByName {
useShards = false;
baseDirectory = ./by-name;
fileName = "configuration.nix";
};
- generateHost = _: path:
+ mkNixosConfiguration = name: path: let
+ host_file = builtins.fromTOML (builtins.readFile (path + "/../host.toml"));
+ nixpkgs =
+ if host_file.nixpkgs == "stable"
+ then nixpkgs-stable
+ else nixpkgs-unstable;
+ in
nixpkgs.lib.nixosSystem {
- specialArgs = {
- inherit
- self
- libraries
- modules
- ;
- };
- modules = [
- {
- _module.args = {
- inherit
- sources
- # extra package sources
- openPRsNixpkgs
- packageSets
- # extra information
- system
- # nix registry
- externalDependencies
- # bins
- # TODO: Integrate these into `pkgs/by-name` <2024-05-22>
- externalBinaries
- ;
- };
- }
- path
+ specialArgs = special_args;
+ modules =
+ extra_modules
+ ++ [
+ {
+ _module.args = module_args;
+ }
+ path
- ../modules
- ../modules/common
- ];
+ ../modules
+ # ../modules/common
+ ];
};
+ mkDeployHost = name: path: let
+ host_file = builtins.fromTOML (builtins.readFile path + "/host.toml");
+ in {
+ inherit (host_file) hostname;
+ profiles.system = {
+ user = "root";
+ path = deploy-rs.lib."${system}".activate.nixos self.nixosConfigurations."${name}";
+ };
+ };
- generatedHosts = builtins.mapAttrs generateHost hosts;
-in
- generatedHosts
+ nixosConfigurations = builtins.mapAttrs mkNixosConfiguration hosts;
+ nodes = builtins.mapAttrs mkDeployHost hosts;
+in {
+ inherit nixosConfigurations nodes;
+}