diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-30 14:26:34 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-30 14:26:34 +0100 |
| commit | 981060cf79e468da091b7bb359d19e514fa23ab1 (patch) | |
| tree | b900fec93ee6524e49c12f52c5003b128fbb10e6 /hosts | |
| parent | notes/deploy: Add a very basic version of a deploy guide (diff) | |
| download | nixos-config-981060cf79e468da091b7bb359d19e514fa23ab1.zip | |
treewide: Align files with the same files in the `nixos-server` repo
This facilitates overlaying the two repos over each other.
Diffstat (limited to 'hosts')
| -rw-r--r-- | hosts/default.nix | 91 | ||||
| -rw-r--r-- | hosts/hostinfo.toml | 15 |
2 files changed, 40 insertions, 66 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; +} diff --git a/hosts/hostinfo.toml b/hosts/hostinfo.toml deleted file mode 100644 index c2523a3a..00000000 --- a/hosts/hostinfo.toml +++ /dev/null @@ -1,15 +0,0 @@ -# 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>. - -[Tiamat] -description = "This is my main desktop" - -[Apzu] -description = "This is my light laptop, with modern hardware" |
