fix flake check errors + add gha
This commit is contained in:
parent
27b01771a0
commit
c29a87a53e
3 changed files with 48 additions and 18 deletions
18
.github/workflows/nixos.yml
vendored
18
.github/workflows/nixos.yml
vendored
|
@ -37,3 +37,21 @@ jobs:
|
||||||
- name: "Build NixOS config ❄️"
|
- name: "Build NixOS config ❄️"
|
||||||
run: |
|
run: |
|
||||||
nix run '.#' build
|
nix run '.#' build
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.2
|
||||||
|
|
||||||
|
- name: "Install Nix ❄️"
|
||||||
|
uses: cachix/install-nix-action@v15
|
||||||
|
|
||||||
|
- name: "Install Cachix ❄️"
|
||||||
|
uses: cachix/cachix-action@v10
|
||||||
|
with:
|
||||||
|
name: 0x76-infra
|
||||||
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
|
- name: "Build NixOS config ❄️"
|
||||||
|
run: |
|
||||||
|
nix flake check
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
inherit (builtins) filter mapAttrs attrValues concatLists;
|
inherit (builtins) filter mapAttrs attrValues concatLists;
|
||||||
|
|
||||||
util = import ./util.nix inputs;
|
util = import ./util.nix inputs;
|
||||||
|
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
# import and add realm to list of tags
|
# import and add realm to list of tags
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Make the nixosConfigurations, mostly for vault-secrets
|
# Make the nixosConfigurations, mostly for vault-secrets
|
||||||
nixosConfigurations = util.mkNixosConfigurations specialArgs hosts;
|
nixosConfigurations = util.mkNixosConfigurations specialArgs nixHosts;
|
||||||
|
|
||||||
# Make the coleman configuration
|
# Make the coleman configuration
|
||||||
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el)
|
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el)
|
||||||
|
|
44
util.nix
44
util.nix
|
@ -28,27 +28,39 @@ rec {
|
||||||
mkNixosSystem = specialArgs: { hostname, realm, system ? "x86_64-linux", ... }@host: {
|
mkNixosSystem = specialArgs: { hostname, realm, system ? "x86_64-linux", ... }@host: {
|
||||||
"${hostname}.${realm}" = lib.nixosSystem {
|
"${hostname}.${realm}" = lib.nixosSystem {
|
||||||
inherit system specialArgs;
|
inherit system specialArgs;
|
||||||
modules = resolve_imports host;
|
modules =
|
||||||
|
[
|
||||||
|
({ config, pkgs, ... }: {
|
||||||
|
nixpkgs.overlays = [ (import ./nixos/pkgs) ];
|
||||||
|
networking = {
|
||||||
|
hostName = hostname;
|
||||||
|
domain = realm;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
] ++
|
||||||
|
(resolve_imports host);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkColmenaHost = { ip ? null, hostname, tags, realm, type ? "lxc", ... }@host: let
|
mkColmenaHost = { ip ? null, hostname, tags, realm, type ? "lxc", ... }@host:
|
||||||
name = if realm == "thalassa" then hostname else "${hostname}.${realm}";
|
let
|
||||||
in{
|
name = if realm == "thalassa" then hostname else "${hostname}.${realm}";
|
||||||
"${name}" = {
|
in
|
||||||
imports = resolve_imports host;
|
{
|
||||||
networking = {
|
"${name}" = {
|
||||||
hostName = hostname;
|
imports = resolve_imports host;
|
||||||
domain = realm;
|
networking = {
|
||||||
};
|
hostName = hostname;
|
||||||
deployment = {
|
domain = realm;
|
||||||
inherit tags;
|
};
|
||||||
targetHost = ip;
|
deployment = {
|
||||||
allowLocalDeployment = (type == "local");
|
inherit tags;
|
||||||
targetUser = null; # Defaults to $USER
|
targetHost = ip;
|
||||||
|
allowLocalDeployment = (type == "local");
|
||||||
|
targetUser = null; # Defaults to $USER
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
mkNixosConfigurations = specialArgs: hosts: lib.foldr (el: acc: acc // mkNixosSystem specialArgs el) { } hosts;
|
mkNixosConfigurations = specialArgs: hosts: lib.foldr (el: acc: acc // mkNixosSystem specialArgs el) { } hosts;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue