Skip to content

feat: Add nix flake#30

Open
poelzi wants to merge 1 commit intoasonnino:mainfrom
poelzi:main
Open

feat: Add nix flake#30
poelzi wants to merge 1 commit intoasonnino:mainfrom
poelzi:main

Conversation

@poelzi
Copy link
Copy Markdown

@poelzi poelzi commented Apr 16, 2025

  • add shamir-bip39 package
  • add minimized + hardened iso / vm image
  • add devshell

I had to add the Cargo.lock file, so the build process can become deterministic, which is important for a tool like this. AFAIK it does not make problems when using this package as a lib. It should be published on crates.io anyways

@poelzi poelzi changed the title Add nix flake feat: Add nix flake Apr 16, 2025
@poelzi poelzi force-pushed the main branch 2 times, most recently from 0259137 to 6ca3f0a Compare April 16, 2025 10:39
* add shamir-bip39 package
* add minimized + hardened iso / vm image
* add devshell
Copy link
Copy Markdown
Owner

@asonnino asonnino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!

The PR lgtm, but I am not familiar with nix and flake

Comment on lines +75 to +79
# boot.kernelPackages = pkgs.linuxPackagesFor (
# pkgs.linuxPackages_latest.kernel.override {
# ignoreConfigErrors = true;
# }
# );
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this?

name = "minimize";
patch = null;
extraConfig = ''
NET N
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Comment on lines +85 to +87
environment.sessionVariables = {
MALLOC_PERTURB_ = ''42'';
};
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Welcome to shamir-bip39 secure environment
This system has no network or persistent storage for security.

Split a secret: shamir-bip39 split -t 2 -n 3 --secret "your mnemonic here\"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the backslash \ required in the string ”your mnemonic here\”? It doesn’t appear to break a line or perform any typical escaping function (I’m not familiar with Flakes).

# Use bash as the shell but add our welcome message
users.users.root.shell = pkgs.bashInteractive;

# Add a welcome message via profile
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not important): Is there an easy way to load this message from file (or something similar) so that we can have the same in the readme of the repo? Or a way to ensure we don't forget to update it if we ever update the readme/cli?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh or it doesn't actually matter since a number of settings are hardcoded in this file for security reasons anyway?

description = "shamir-bip39 - Shamir's Secret Sharing for BIP-39 mnemonics";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way to only use stable nixos in this case?

before = [ "shutdown.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

@asonnino asonnino requested a review from Copilot April 17, 2025 01:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a nix flake to support generating a hardened and minimized ISO/VM image along with a devshell and adds the shamir-bip39 package. Key changes include:

  • Excluding specific nix configuration files from typos checks via typos.toml.
  • Adding instructions in README.md for building and deploying an optimized boot image.
  • Introducing a Cargo.lock file to ensure deterministic builds.

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

File Description
typos.toml Added file exclusion configuration for nix configs in typos checks
README.md New Boot Image section providing build instructions for generating the hardened/minimized ISO
Files not reviewed (2)
  • .editorconfig: Language not supported
  • flake.nix: Language not supported

```
And copy the resulting `result/iso/nixos-25.05.*-x86_64-linux.iso` to a USB drive.

This image uses a hardened linux kernel, is minimized (no network, no harddisk mounting, no unecesarry services, ... ) and clears memory after usage and reboot to minimize data leakage.
Copy link

Copilot AI Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo found in 'unecesarry'. It should be corrected to 'unnecessary'.

Suggested change
This image uses a hardened linux kernel, is minimized (no network, no harddisk mounting, no unecesarry services, ... ) and clears memory after usage and reboot to minimize data leakage.
This image uses a hardened linux kernel, is minimized (no network, no harddisk mounting, no unnecessary services, ... ) and clears memory after usage and reboot to minimize data leakage.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants