From 732ba9d176d212cf94a670e370841ca85176e975 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 27 Aug 2024 10:45:28 +0200 Subject: [PATCH] Template: fix flake-parts template --- lib/build-clan/module.nix | 2 +- pkgs/clan-cli/clan_cli/clan/create.py | 2 +- templates/flake-parts/flake.nix | 20 +++++++++++--------- templates/flake.nix | 4 ++++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index f7144a31c..947d63ed9 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -163,7 +163,7 @@ let ); ################################################## - allMachines = inventory.machines or { } // config.machines or { } // testMachines; + allMachines = inventory.machines or { } // machines // testMachines; supportedSystems = [ "x86_64-linux" diff --git a/pkgs/clan-cli/clan_cli/clan/create.py b/pkgs/clan-cli/clan_cli/clan/create.py index fa9e4aa08..7dcad907d 100644 --- a/pkgs/clan-cli/clan_cli/clan/create.py +++ b/pkgs/clan-cli/clan_cli/clan/create.py @@ -102,7 +102,7 @@ def register_create_parser(parser: argparse.ArgumentParser) -> None: parser.add_argument( "--template", type=str, - choices=["default", "minimal"], + choices=["default", "minimal", "flake-parts"], help="Clan template name", default="default", ) diff --git a/templates/flake-parts/flake.nix b/templates/flake-parts/flake.nix index 43963e791..5605fb790 100644 --- a/templates/flake-parts/flake.nix +++ b/templates/flake-parts/flake.nix @@ -2,7 +2,7 @@ description = ""; inputs.clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz"; - inputs.nixpkgs.url = "clan/nixpkgs"; + inputs.nixpkgs.follows = "clan-core/nixpkgs"; inputs.flake-parts.url = "github:hercules-ci/flake-parts"; inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; @@ -30,11 +30,11 @@ inherit (self) inputs nixosModules packages; }; directory = self; - machines = - { pkgs, ... }: - { - # "jon" will be the hostname of the machine - jon = { + machines = { + # "jon" will be the hostname of the machine + jon = + { pkgs, ... }: + { imports = [ ./modules/shared.nix ./modules/disko.nix @@ -66,8 +66,10 @@ # the controller can be offline and routing still works. clan.core.networking.zerotier.controller.enable = true; }; - # "sara" will be the hostname of the machine - sara = { + # "sara" will be the hostname of the machine + sara = + { pkgs, ... }: + { imports = [ ./modules/shared.nix ./modules/disko.nix @@ -102,7 +104,7 @@ */ # clan.core.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id; }; - }; + }; }; perSystem = { pkgs, inputs', ... }: diff --git a/templates/flake.nix b/templates/flake.nix index 438d8ab54..4ad730b8f 100644 --- a/templates/flake.nix +++ b/templates/flake.nix @@ -11,6 +11,10 @@ description = "for clans managed via (G)UI"; path = ./minimal; }; + flake-parts = { + description = "Flake-parts"; + path = ./flake-parts; + }; }; }; }