From f5a36cbb7a7dbb62db66f9ca086baf6a3f02cbb1 Mon Sep 17 00:00:00 2001 From: kalipso Date: Tue, 22 Nov 2022 19:47:01 +0100 Subject: [PATCH] [lucia] remove old approach and build baseimg using nixos-generators --- flake.lock | 37 +++++++++++++++++++++++++++++++++++++ flake.nix | 5 +++++ machines/configuration.nix | 15 +++------------ outputs.nix | 14 ++++++++++++++ 4 files changed, 59 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 7a2b1c53..f112d442 100644 --- a/flake.lock +++ b/flake.lock @@ -40,6 +40,42 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1636849918, + "narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1669065280, + "narHash": "sha256-3+pq1oJWjGDLfd8G/vR3IIFZ+EQ/aglukA0bTiMlf3o=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "50aeec40f2072d2ab267c8ec8a345573704ec110", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1664628729, @@ -124,6 +160,7 @@ "inputs": { "home-manager": "home-manager", "mfsync": "mfsync", + "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", diff --git a/flake.nix b/flake.nix index f9dd13b4..41e358a5 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,11 @@ sops-nix.inputs.nixpkgs.follows = "nixpkgs"; mfsync.url = "github:k4lipso/mfsync"; + nixos-generators = { + url = "github:nix-community/nixos-generators"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager= { url = "github:nix-community/home-manager/release-22.05"; inputs = { diff --git a/machines/configuration.nix b/machines/configuration.nix index 65b277e0..eac25390 100644 --- a/machines/configuration.nix +++ b/machines/configuration.nix @@ -37,20 +37,11 @@ in ]; }; - rpi1_base_image = nixosSystem { + lucia = nixosSystem { system = "aarch64-linux"; + specialArgs.inputs = inputs; modules = [ - "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix" - ./modules/sshd.nix - { - nixpkgs.config.allowUnsupportedSystem = true; - nixpkgs.crossSystem.system = "aarch64-linux"; - - networking.hostName = "rp1_base_image"; - networking.networkmanager.enable = true; - - system.stateVersion = "22.05"; - } + ./lucia/configuration.nix ]; }; } diff --git a/outputs.nix b/outputs.nix index 8e74c408..a2f2ef3d 100644 --- a/outputs.nix +++ b/outputs.nix @@ -2,6 +2,7 @@ , utils , nixpkgs , nixpkgs-unstable +, nixos-generators , sops-nix , ... } @inputs: @@ -23,4 +24,17 @@ in (utils.lib.eachSystem (builtins.filter filter_system utils.lib.defaultSystems }); images.rpi1_base_image = nixosConfigurations.rpi1_base_image.config.system.build.sdImage; + packages.x86_64-linux = { + + lucia_base_img = nixos-generators.nixosGenerate { + system = "aarch64-linux"; + modules = [ + ./machines/modules/sshd.nix + { + networking.networkmanager.enable = true; + } + ]; + format = "sd-aarch64-installer"; + }; + }; }