repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
nixmod.nixNix43 lines2.2 KiBraw download
# modules/home/nixmod.nix — `nixmod`: make and remove modules from templates.
#
#   nixmod firefox                  programs.firefox: enable, editable settings, upstream examples
#   nixmod new gallery-dl --set settings.extractor.base-directory=~/Downloads/gallery-dl
#   nixmod new --nixos steam        the same from NixOS → modules/features/steam.nix
#   nixmod new -t script backup     a command of your own (writeShellApplication)
#   nixmod new -t service tunnel    a systemd (user) service + timer
#   nixmod new -t packages recon    a bundle of packages
#   nixmod new -t config foot       config files: xdg.configFile, home.file, out-of-store links
#   nixmod new -t feature --nixos lab   daemon.lab.enable with typed options
#   nixmod new -t package mytool    perSystem.packages.mytool (nix build .#mytool)
#   nixmod rm firefox               delete it again: file, import lines, git
#   nixmod list | templates | search fire | doc git | check gallery-dl
#
# Options come from evaluating this flake's own nixosConfigurations (the
# home-manager and nixpkgs pinned in flake.lock). New files are `git add`ed and
# named in the host's imports list (modules/home/default.nix or
# modules/hosts/laptop/configuration.nix on the laptop, modules/hosts/generic/
# on the generic host). `rm` only deletes files carrying nixmod's "Started by
# nixmod" line unless --force, never anything under modules/hosts/, and stops
# while another file still uses the module.
# Program templates evaluate the selected host by default. `--check` evaluates
# both hosts, `--no-check` skips host evaluation. No command activates NixOS.
# See docs/nixmod.md for editing, --set values, and checking later edits.
# Source: _nixmod/nixmod.py, and _nixmod/options.nix for what it asks Nix.
{ ... }:
{
  flake.homeModules.nixmod =
  { pkgs, ... }:
  {
    home.packages = [
      (pkgs.writeShellApplication {
        name = "nixmod";
        # nix itself comes from the system, so it matches the daemon.
        runtimeInputs = [ pkgs.python3 pkgs.git pkgs.gnugrep ];
        text = ''
          export NIXMOD_PROBE=${./_nixmod/options.nix}
          exec python3 ${./_nixmod/nixmod.py} "$@"
        '';
      })
    ];
  };
}