From c29a87a53ecd06da3c5befc5605a99adf6ee2837 Mon Sep 17 00:00:00 2001 From: Vivian Roest Date: Sat, 10 Sep 2022 19:44:16 +0200 Subject: [PATCH] fix flake check errors + add gha --- .github/workflows/nixos.yml | 18 +++++++++++++++ flake.nix | 4 ++-- util.nix | 44 +++++++++++++++++++++++-------------- 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/.github/workflows/nixos.yml b/.github/workflows/nixos.yml index c297f790..073086b5 100644 --- a/.github/workflows/nixos.yml +++ b/.github/workflows/nixos.yml @@ -37,3 +37,21 @@ jobs: - name: "Build NixOS config ❄️" run: | 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 + diff --git a/flake.nix b/flake.nix index 57e434c2..749a4b66 100644 --- a/flake.nix +++ b/flake.nix @@ -36,7 +36,7 @@ inherit (nixpkgs) lib; inherit (builtins) filter mapAttrs attrValues concatLists; - util = import ./util.nix inputs; + util = import ./util.nix inputs; system = "x86_64-linux"; # import and add realm to list of tags @@ -64,7 +64,7 @@ in { # Make the nixosConfigurations, mostly for vault-secrets - nixosConfigurations = util.mkNixosConfigurations specialArgs hosts; + nixosConfigurations = util.mkNixosConfigurations specialArgs nixHosts; # Make the coleman configuration colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el) diff --git a/util.nix b/util.nix index ae4bd8d5..a33e6667 100644 --- a/util.nix +++ b/util.nix @@ -28,27 +28,39 @@ rec { mkNixosSystem = specialArgs: { hostname, realm, system ? "x86_64-linux", ... }@host: { "${hostname}.${realm}" = lib.nixosSystem { 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 - name = if realm == "thalassa" then hostname else "${hostname}.${realm}"; - in{ - "${name}" = { - imports = resolve_imports host; - networking = { - hostName = hostname; - domain = realm; - }; - deployment = { - inherit tags; - targetHost = ip; - allowLocalDeployment = (type == "local"); - targetUser = null; # Defaults to $USER + mkColmenaHost = { ip ? null, hostname, tags, realm, type ? "lxc", ... }@host: + let + name = if realm == "thalassa" then hostname else "${hostname}.${realm}"; + in + { + "${name}" = { + imports = resolve_imports host; + networking = { + hostName = hostname; + domain = realm; + }; + deployment = { + inherit tags; + targetHost = ip; + allowLocalDeployment = (type == "local"); + targetUser = null; # Defaults to $USER + }; }; }; - }; mkNixosConfigurations = specialArgs: hosts: lib.foldr (el: acc: acc // mkNixosSystem specialArgs el) { } hosts; }