From 871a24947c2a3ab06850d091616c862da19bf7f4 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 15 Sep 2024 01:49:47 +0200 Subject: [PATCH] flake: Add openstack image generator --- flake.lock | 37 +++++++++++++++++++++++++++++++++++++ flake.nix | 27 ++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 80305ab..74eb992 100644 --- a/flake.lock +++ b/flake.lock @@ -156,6 +156,42 @@ "url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git" } }, + "nixlib": { + "locked": { + "lastModified": 1725757153, + "narHash": "sha256-c1a6iLmCVPFI9EUVMrBN8xdmFxFXEjcVwiTSVmqajOs=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "68584f89dd0eb16fea5d80ae127f3f681f6a5df7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726102718, + "narHash": "sha256-u89QyfjtXryLHrO3Wre4kuWK5KDKiXe8lgRi6+cUOEw=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "5ae384b83b91080f0fead6bc1add1cff8277cb3f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1725198597, @@ -250,6 +286,7 @@ "matrix-next": "matrix-next", "minecraft-data": "minecraft-data", "nix-gitea-themes": "nix-gitea-themes", + "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", "pvv-calendar-bot": "pvv-calendar-bot", diff --git a/flake.nix b/flake.nix index 0286fdf..6407a2a 100644 --- a/flake.nix +++ b/flake.nix @@ -29,9 +29,12 @@ grzegorz-clients.inputs.nixpkgs.follows = "nixpkgs"; minecraft-data.url = "git+https://git.pvv.ntnu.no/Drift/minecraft-data.git"; + + nixos-generators.url = "github:nix-community/nixos-generators"; + nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, ... }@inputs: + outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, nixos-generators, ... }@inputs: let nixlib = nixpkgs.lib; systems = [ @@ -149,6 +152,28 @@ simplesamlphp = pkgs.callPackage ./packages/simplesamlphp { }; + openstack-image = nixos-generators.nixosGenerate { + system = "x86_64-linux"; + format = "openstack"; + + modules = [ + ({config, lib, pkgs, modulesPath, ... }: { + system.build.openstackImage = lib.mkForce (import "${modulesPath}/../lib/make-disk-image.nix" { + inherit config lib pkgs; + copyChannel = true; + additionalSpace = "1024M"; + format = "raw"; + configFile = pkgs.writeText "configuration.nix" + '' + { + imports = [ ]; + } + ''; + }); + }) + ]; + }; + } // (nixlib.pipe null [ (_: pkgs.callPackage ./packages/mediawiki-extensions { })