new-clan: update template and add test
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{ self, ... }: {
|
{ self, ... }: {
|
||||||
perSystem = { pkgs, lib, ... }:
|
perSystem = { pkgs, lib, self', ... }:
|
||||||
let
|
let
|
||||||
impureChecks = {
|
impureChecks = {
|
||||||
check-clan-template = pkgs.writeShellScriptBin "check-clan-template" ''
|
check-clan-template = pkgs.writeShellScriptBin "check-clan-template" ''
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
trap "${pkgs.coreutils}/bin/chmod -R +w '$TMPDIR'; ${pkgs.coreutils}/bin/rm -rf '$TMPDIR'" EXIT
|
trap "${pkgs.coreutils}/bin/chmod -R +w '$TMPDIR'; ${pkgs.coreutils}/bin/rm -rf '$TMPDIR'" EXIT
|
||||||
export PATH="${lib.makeBinPath [
|
export PATH="${lib.makeBinPath [
|
||||||
pkgs.gitMinimal
|
pkgs.gitMinimal
|
||||||
|
pkgs.gnugrep
|
||||||
|
pkgs.jq
|
||||||
pkgs.openssh
|
pkgs.openssh
|
||||||
pkgs.nix
|
pkgs.nix
|
||||||
]}"
|
]}"
|
||||||
@@ -18,8 +20,21 @@
|
|||||||
echo initialize new clan
|
echo initialize new clan
|
||||||
nix flake init -t ${self}#new-clan
|
nix flake init -t ${self}#new-clan
|
||||||
|
|
||||||
|
echo override clan input to the current version
|
||||||
|
nix flake lock --override-input clan-core ${self}
|
||||||
|
nix flake lock --override-input nixpkgs ${self.inputs.nixpkgs}
|
||||||
|
|
||||||
echo ensure flake outputs can be listed
|
echo ensure flake outputs can be listed
|
||||||
nix flake show
|
nix flake show
|
||||||
|
|
||||||
|
echo create a machine
|
||||||
|
${self'.packages.clan-cli}/bin/clan machines create machine1
|
||||||
|
|
||||||
|
echo check machine1 exists
|
||||||
|
${self'.packages.clan-cli}/bin/clan machines list | grep -q machine1
|
||||||
|
|
||||||
|
echo check machine1 appears in nixosConfigurations
|
||||||
|
nix flake show --json | jq '.nixosConfigurations' | grep -q machine1
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -3,9 +3,21 @@
|
|||||||
|
|
||||||
inputs.clan-core.url = "git+https://git.clan.lol/clan/clan-core";
|
inputs.clan-core.url = "git+https://git.clan.lol/clan/clan-core";
|
||||||
|
|
||||||
outputs = { clan-core, ... }: {
|
outputs = { clan-core, nixpkgs, ... }:
|
||||||
nixosConfigurations = clan-core.lib.buildClan {
|
let
|
||||||
directory = ./.;
|
system = "x86_64-linux";
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# all machines managed by cLAN
|
||||||
|
nixosConfigurations = clan-core.lib.buildClan {
|
||||||
|
directory = ./.;
|
||||||
|
};
|
||||||
|
# add the cLAN cli tool to the dev shell
|
||||||
|
devShells.${system}.default = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
clan-core.packages.${system}.clan-cli
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user