Commit 5313bb76a89b

Vincent Demeester <vincent@sbr.pm>
2025-01-12 18:01:32
systems: add carthage and nixos-generators
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 68c6c75
systems/hosts/carthage.nix
@@ -0,0 +1,27 @@
+{ modulesPath, pkgs, lib, ... }:
+
+let
+  hostname = "carthage";
+in
+{
+  imports = [
+    "${modulesPath}/virtualisation/amazon-image.nix"
+    (import ../../users/vincent)
+    (import ../../users/root)
+  ];
+
+  ec2.efi = true;
+
+  networking.hostName = hostname;
+
+  services = {
+    openssh = {
+      enable = true;
+      startWhenNeeded = false;
+    };
+    sshguard.enable = true;
+  };
+  programs.mosh.enable = true;
+
+}
+
systems/hosts/kerkouane.nix
@@ -60,8 +60,6 @@ let
     };
     extraConfig = nginxExtraConfig;
   };
-
-  sources = import ../../nix/sources.nix;
 in
 {
   imports = [
flake.lock
@@ -894,6 +894,42 @@
         "type": "github"
       }
     },
+    "nixlib": {
+      "locked": {
+        "lastModified": 1734829460,
+        "narHash": "sha256-dPhc+f2wkmhMqMIfq+hColJdysgVxKP9ilZ5bR0NRZI=",
+        "owner": "nix-community",
+        "repo": "nixpkgs.lib",
+        "rev": "0a31e8d833173ae63e43fd9dbff1ccf09c4f778c",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "nixpkgs.lib",
+        "type": "github"
+      }
+    },
+    "nixos-generators": {
+      "inputs": {
+        "nixlib": "nixlib",
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1734915500,
+        "narHash": "sha256-A7CTIQ8SW0hfbhKlwK+vSsu4pD+Oaelw3v6goX6go+U=",
+        "owner": "nix-community",
+        "repo": "nixos-generators",
+        "rev": "051d1b2dda3b2e81b38d82e2b691e5c2f4d335f4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "nixos-generators",
+        "type": "github"
+      }
+    },
     "nixos-hardware": {
       "locked": {
         "lastModified": 1735388221,
@@ -1289,6 +1325,7 @@
         "home-manager": "home-manager",
         "home-manager-24_05": "home-manager-24_05",
         "impermanence": "impermanence",
+        "nixos-generators": "nixos-generators",
         "nixos-hardware": "nixos-hardware",
         "nixos-wsl": "nixos-wsl",
         "nixpkgs": "nixpkgs_4",
flake.nix
@@ -43,7 +43,7 @@
             (_: prev: {
               inherit (inputs.devenv.packages.${prev.system}) devenv;
               inherit (inputs.buildkit-tekton.packages.${prev.system}) tkn-local;
-	      inherit (inputs.dagger.packages.${prev.system}) dagger;
+              inherit (inputs.dagger.packages.${prev.system}) dagger;
             })
           ];
         }
@@ -53,7 +53,7 @@
         ./systems/modules/dev/default.nix
         ./systems/modules/editors/default.nix
         ./systems/modules/hardware/default.nix
-	./systems/modules/profiles/default.nix
+        ./systems/modules/profiles/default.nix
         ./systems/modules/virtualisation/default.nix
         ./systems/modules/virtualisation/buildkit.nix
         ./systems/modules/services/default.nix
@@ -72,6 +72,15 @@
     in
     {
       images = {
+        # ami(s) (AWS)
+        carthage = inputs.nixos-generators.nixosGenerate rec {
+          system = "aarch64-linux";
+          format = "amazon";
+          modules = commonModules ++ stableModules ++ [
+            ./systems/hosts/carthage.nix
+          ];
+        };
+        # sdimages
         athena = (self.nixosConfigurations.athena.extendModules {
           modules = [
             "${inputs.nixpkgs-24_05}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
@@ -123,6 +132,12 @@
               ./systems/hosts/kerkouane.nix
             ];
           };
+          carthage = inputs.nixpkgs-24_05.lib.nixosSystem {
+            system = "aarch64-linux";
+            modules = commonModules ++ stableModules ++ [
+              ./systems/hosts/carthage.nix
+            ];
+          };
           # Raspberry PI
           # athena
           athena = inputs.nixpkgs-24_05.lib.nixosSystem {
@@ -214,5 +229,10 @@
       repo = "chapeau-rouge";
       inputs.nixpkgs.follows = "nixpkgs";
     };
+    # Used to generate NixOS images for other platforms
+    nixos-generators = {
+      url = "github:nix-community/nixos-generators";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
   };
 }
Makefile
@@ -13,6 +13,8 @@ host/%/boot: FORCE
 host/%/switch: FORCE
 	nixos-rebuild --build-host ${BUILDER_HOST} --target-host root@$*.sbr.pm --flake .#$* switch
 
+host/carthage/boot:
+	nixos-rebuild --target-host root@13.38.218.220 --flake .#carthage boot
 host/shikoku/boot:
 	nixos-rebuild --build-host root@shikoku.sbr.pm --target-host root@shikoku.sbr.pm --flake .#shikoku boot
 host/shikoku/switch: