Skip to content

Commit

Permalink
feat: add liveusb generator to flake via nixos-generators (#291)
Browse files Browse the repository at this point in the history
create liveusb
  • Loading branch information
TheButlah authored Nov 19, 2024
1 parent 28f7935 commit 0e6c2ac
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
38 changes: 38 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# Supports generating liveusbs
nixos-generators = {
url = "github:nix-community/nixos-generators/7c60ba4bc8d6aa2ba3e5b0f6ceb9fc07bc261565";
inputs.nixpkgs.follows = "nixpkgs";
};

# Replaces the need to have a git submodule.
seekSdk = {
url = "github:worldcoin/seek-thermal-sdk";
Expand Down
22 changes: 21 additions & 1 deletion nix/machines/flake-outputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# It gets directly combined with the toplevel flake.nix.
{ inputs, p, ... }:
let
inherit (inputs) nixpkgs home-manager;
inherit (inputs) nixpkgs home-manager nixos-generators;
in
let
# Helper function for all worldcoin NixOS machines.
Expand All @@ -15,6 +15,7 @@ let
};
modules = [
./${hostname}/configuration.nix
inputs.nixos-generators.nixosModules.all-formats
# setup home-manager
home-manager.nixosModules.home-manager
{
Expand Down Expand Up @@ -51,4 +52,23 @@ in
nixosConfigurations."worldcoin-hil-munich-1" = hilConfig {
hostname = "worldcoin-hil-munich-1";
};
packages.x86_64-linux.liveusb = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
{
# Pin nixpkgs to the flake input, so that the packages installed
# come from the flake inputs.nixpkgs.url.
nix.registry.nixpkgs.flake = nixpkgs;
}
./liveusb.nix
];
format = "raw-efi";

# optional arguments:
# explicit nixpkgs and lib:
# pkgs = nixpkgs.legacyPackages.x86_64-linux;
# lib = nixpkgs.legacyPackages.x86_64-linux.lib;
# additional arguments to pass to modules:
# specialArgs = { myExtraArg = "foobar"; };
};
}
11 changes: 11 additions & 0 deletions nix/machines/liveusb.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ config, pkgs, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
];
environment.systemPackages = with pkgs; [
neovim
parted
usbutils
];
}

0 comments on commit 0e6c2ac

Please sign in to comment.