Merge pull request 'templates: rename 'new_clan' to default' (#4244) from templates into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4244
This commit is contained in:
@@ -105,7 +105,7 @@ git+file:///home/lhebendanz/Projects/clan-core
|
|||||||
│ ├───editor omitted (use '--all-systems' to show)
|
│ ├───editor omitted (use '--all-systems' to show)
|
||||||
└───templates
|
└───templates
|
||||||
├───default: template: Initialize a new clan flake
|
├───default: template: Initialize a new clan flake
|
||||||
└───new-clan: template: Initialize a new clan flake
|
└───default: template: Initialize a new clan flake
|
||||||
```
|
```
|
||||||
|
|
||||||
You can execute every test separately by following the tree path `nix run .#checks.x86_64-linux.clan-pytest -L` for example.
|
You can execute every test separately by following the tree path `nix run .#checks.x86_64-linux.clan-pytest -L` for example.
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ def test_clan_core_templates(
|
|||||||
"default",
|
"default",
|
||||||
"flake-parts",
|
"flake-parts",
|
||||||
"minimal",
|
"minimal",
|
||||||
"minimal-flake-parts",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# clan.default
|
# clan.default
|
||||||
@@ -55,18 +54,18 @@ def test_clan_core_templates(
|
|||||||
template_path = default_template.get("path", None)
|
template_path = default_template.get("path", None)
|
||||||
assert template_path is not None
|
assert template_path is not None
|
||||||
|
|
||||||
new_clan = temporary_home / "new_clan"
|
my_clan = temporary_home / "my_clan"
|
||||||
|
|
||||||
copy_from_nixstore(
|
copy_from_nixstore(
|
||||||
Path(template_path),
|
Path(template_path),
|
||||||
new_clan,
|
my_clan,
|
||||||
)
|
)
|
||||||
|
|
||||||
flake_nix = new_clan / "flake.nix"
|
flake_nix = my_clan / "flake.nix"
|
||||||
assert (flake_nix).exists()
|
assert (flake_nix).exists()
|
||||||
assert (flake_nix).is_file()
|
assert (flake_nix).is_file()
|
||||||
|
|
||||||
assert (new_clan / "machines").is_dir()
|
assert (my_clan / "machines").is_dir()
|
||||||
|
|
||||||
# Test if we can write to the flake.nix file
|
# Test if we can write to the flake.nix file
|
||||||
with flake_nix.open("r+") as f:
|
with flake_nix.open("r+") as f:
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ def create_clan(opts: CreateOptions) -> None:
|
|||||||
if opts.update_clan:
|
if opts.update_clan:
|
||||||
run(nix_command(["flake", "update"]), RunOpts(cwd=dest))
|
run(nix_command(["flake", "update"]), RunOpts(cwd=dest))
|
||||||
|
|
||||||
|
if opts.setup_git:
|
||||||
|
run(git_command(dest, "add", "."))
|
||||||
|
run(git_command(dest, "commit", "-m", "Initial commit"))
|
||||||
|
|
||||||
if opts.initial:
|
if opts.initial:
|
||||||
inventory_store = InventoryStore(flake=Flake(str(opts.dest)))
|
inventory_store = InventoryStore(flake=Flake(str(opts.dest)))
|
||||||
inventory_store.write(opts.initial, message="Init inventory")
|
inventory_store.write(opts.initial, message="Init inventory")
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ def test_clan_create_api(
|
|||||||
assert public_key.exists()
|
assert public_key.exists()
|
||||||
assert public_key.is_file()
|
assert public_key.is_file()
|
||||||
|
|
||||||
dest_clan_dir = Path("~/new-clan").expanduser()
|
dest_clan_dir = Path("~/default").expanduser()
|
||||||
|
|
||||||
# ===== CREATE CLAN ======
|
# ===== CREATE CLAN ======
|
||||||
# TODO: We need to generate a lock file for the templates
|
# TODO: We need to generate a lock file for the templates
|
||||||
|
|||||||
2
templates/clan/default/.gitignore
vendored
Normal file
2
templates/clan/default/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
result
|
||||||
|
.direnv/
|
||||||
2
templates/clan/flake-parts/.gitignore
vendored
Normal file
2
templates/clan/flake-parts/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
result
|
||||||
|
.direnv/
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
result
|
|
||||||
.direnv/
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{ self, ... }:
|
|
||||||
{
|
|
||||||
perSystem =
|
|
||||||
{
|
|
||||||
self',
|
|
||||||
lib,
|
|
||||||
system,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
checks =
|
|
||||||
let
|
|
||||||
nixosMachines = lib.mapAttrs' (
|
|
||||||
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
|
|
||||||
) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
|
|
||||||
|
|
||||||
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
|
|
||||||
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
|
|
||||||
in
|
|
||||||
nixosMachines // packages // devShells;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{ self, inputs, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
inputs.clan.flakeModules.default
|
|
||||||
];
|
|
||||||
clan = {
|
|
||||||
meta.name = "__CHANGE_ME__";
|
|
||||||
inherit self;
|
|
||||||
specialArgs = {
|
|
||||||
inherit inputs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
_: {
|
|
||||||
perSystem =
|
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
inputs',
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
devShells = {
|
|
||||||
default = pkgs.mkShellNoCC {
|
|
||||||
packages = [
|
|
||||||
inputs'.clan.packages.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
clan.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz";
|
|
||||||
nixpkgs.follows = "clan/nixpkgs";
|
|
||||||
|
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
||||||
flake-parts.inputs.nixpkgs-lib.follows = "clan/nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs =
|
|
||||||
inputs@{ flake-parts, ... }:
|
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } (
|
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
systems = [
|
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
"x86_64-darwin"
|
|
||||||
"aarch64-darwin"
|
|
||||||
];
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
./checks.nix
|
|
||||||
./clan.nix
|
|
||||||
./devshells.nix
|
|
||||||
./formatter.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
_: {
|
|
||||||
perSystem =
|
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
formatter = pkgs.nixfmt;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
2
templates/clan/minimal/.gitignore
vendored
Normal file
2
templates/clan/minimal/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
result
|
||||||
|
.direnv/
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
clan = {
|
clan = {
|
||||||
default = {
|
default = {
|
||||||
description = "Initialize a new clan flake";
|
description = "Initialize a new clan flake";
|
||||||
path = ./clan/new-clan;
|
path = ./clan/default;
|
||||||
};
|
};
|
||||||
minimal = {
|
minimal = {
|
||||||
description = "for clans managed via (G)UI";
|
description = "for clans managed via (G)UI";
|
||||||
@@ -35,10 +35,6 @@
|
|||||||
description = "Flake-parts";
|
description = "Flake-parts";
|
||||||
path = ./clan/flake-parts;
|
path = ./clan/flake-parts;
|
||||||
};
|
};
|
||||||
minimal-flake-parts = {
|
|
||||||
description = "Minimal flake-parts clan template";
|
|
||||||
path = ./clan/minimal-flake-parts;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
Reference in New Issue
Block a user