From e4dae7955a778bf170341cb2a0025b57a1574cd3 Mon Sep 17 00:00:00 2001 From: emily Date: Sun, 18 Aug 2024 21:48:41 +0200 Subject: [PATCH] Add build-worker container image --- .gitignore | 1 + config/common/default.nix | 7 ++++--- config/hosts/build-worker-oci/configuration.nix | 15 +++++++++++++++ config/profiles/graphical/nixvim.nix | 3 ++- flake.nix | 5 ++++- modules/machine-type/default.nix | 5 +++++ pkgs/overlay.nix | 6 +++--- 7 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 config/hosts/build-worker-oci/configuration.nix diff --git a/.gitignore b/.gitignore index 99b271c..fe28ab4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ testing/** +result diff --git a/config/common/default.nix b/config/common/default.nix index 7fd0b2d..3ea6162 100644 --- a/config/common/default.nix +++ b/config/common/default.nix @@ -9,7 +9,6 @@ with lib; { ../../modules ]; environment.systemPackages = with pkgs; [ - kitty.terminfo bat dig htop @@ -23,7 +22,9 @@ with lib; { unzip zip figlet - ]; + ] ++ lib.optionals (!config.kyouma.machine-type.container) [ + kitty.terminfo + ]; programs = { mtr.enable = true; fish.enable = true; @@ -57,7 +58,7 @@ with lib; { nix.gc.automatic = true; nix.gc.options = "--delete-older-than 7d"; nix.optimise.automatic = true; - nix.registry.nixpkgs.to = { + nix.registry.nixpkgs.to = lib.mkIf (!config.kyouma.machine-type.container) { type = "path"; path = pkgs.path; }; diff --git a/config/hosts/build-worker-oci/configuration.nix b/config/hosts/build-worker-oci/configuration.nix new file mode 100644 index 0000000..51f8127 --- /dev/null +++ b/config/hosts/build-worker-oci/configuration.nix @@ -0,0 +1,15 @@ +{ lib, modulesPath, ... }: { + imports = [ + "${modulesPath}/virtualisation/docker-image.nix" + ../../common + ../../profiles/builder.nix + ../../profiles/headless.nix + ]; + + networking.hostName = "build-worker-oci"; + services.resolved.enable = lib.mkForce false; + kyouma = { + machine-type.container = true; + deployment.auto-upgrade.enable = lib.mkForce false; + }; +} diff --git a/config/profiles/graphical/nixvim.nix b/config/profiles/graphical/nixvim.nix index 508e1c4..1dbe494 100644 --- a/config/profiles/graphical/nixvim.nix +++ b/config/profiles/graphical/nixvim.nix @@ -212,7 +212,8 @@ plugins.luasnip.enable = true; plugins.nvim-autopairs.enable = true; plugins.rainbow-delimiters.enable = true; - plugins.rustaceanvim.enable = true; + # Broken + plugins.rustaceanvim.enable = false; plugins.treesitter-context.enable = true; }; } diff --git a/flake.nix b/flake.nix index 701ee35..3e95ca1 100644 --- a/flake.nix +++ b/flake.nix @@ -107,7 +107,10 @@ ]; }; }; - images.lain = self.nixosConfigurations.lain-minimal.config.system.build.sdImage; + images = { + lain = self.nixosConfigurations.lain-minimal.config.system.build.sdImage; + build-worker-oci = self.nixosConfigurations.build-worker-oci.config.system.build.tarball; + }; overlays = { kyouma = import ./pkgs/overlay.nix; diff --git a/modules/machine-type/default.nix b/modules/machine-type/default.nix index 29c0994..3b1e845 100644 --- a/modules/machine-type/default.nix +++ b/modules/machine-type/default.nix @@ -38,6 +38,11 @@ in { default = false; description = mdDoc "Mark machine as portable."; }; + container = mkOption { + type = types.bool; + default = false; + description = mdDoc "Mark machine as container image."; + }; }; config = { assertions = [ diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 1b6be83..ea2309a 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -1,5 +1,5 @@ final: prev: { - nyastodon = final.callPackage ./nyastodon/default.nix { }; - upgrade-system = final.callPackage ./upgrade-system/default.nix { }; - update-nixfiles = final.callPackage ./update-nixfiles/default.nix { }; + nyastodon = final.callPackage ./nyastodon/default.nix {}; + upgrade-system = final.callPackage ./upgrade-system/default.nix {}; + update-nixfiles = final.callPackage ./update-nixfiles/default.nix {}; }