Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add liveusb generator to flake via nixos-generators #291

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
];
}
Loading