Coder Social home page Coder Social logo

Comments (11)

mikepurvis avatar mikepurvis commented on August 11, 2024 2

Actually, it turns out it's pretty easy as of NixOS/nixpkgs#94660, just pass isoImage.squashfsCompression:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = { self, nixpkgs, nixos-generators, ... }: {
    packages.x86_64-linux = {
      iso = nixos-generators.nixosGenerate {
        system = "x86_64-linux";
        modules = [
          # you can include your own nixos configuration here, i.e.
          # ./configuration.nix
        ];

        customFormats = {
          install-iso-minimal = {
            imports = [
              "${toString nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
            ];

            systemd.services.sshd.wantedBy = nixpkgs.lib.mkForce ["multi-user.target"];

            isoImage.squashfsCompression = "zstd -Xcompression-level 3";
            formatAttr = "isoImage";
            filename = "*.iso";
          };
        };
        format = "install-iso-minimal";
      };
    };
  };
}

The iso part of that build is only 2m for me (and the final result is as expected a little bigger).

from nixos-generators.

copy avatar copy commented on August 11, 2024

Using --format-path is a way to do this.

from nixos-generators.

Lassulus avatar Lassulus commented on August 11, 2024

Not sure I follow you. Could you post a config to reproduce the issue?

also, yes the diskSize is currently hardcoded, making it dynamic requires upstream work. I'm trying to work on a modification to make-disk-image.nix to create the diskSize based on the files copied to it, with an optional parameter of addtionalDiskSpace

from nixos-generators.

copy avatar copy commented on August 11, 2024

Any sufficiently large built image should reproduce this, below is a slightly silly example.

{ config, pkgs, ... }: {
  environment.systemPackages = with pkgs; [
      firefox thunderbird
      awesome redshift xlockmore scrot
      zsh
      ripgrep
      neomutt offlineimap elinks
      git mercurial subversion
      kitty
      neovim
      evince mupdf
      chromium
      pulseaudio
      youtube-dl
      opam
      z3
      mpv cmus
      ffmpeg
      wireguard wireguard-tools
      gimp
      pandoc
      qemu
      docker
      wireshark-qt
      qutebrowser
      libreoffice
  ];

  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome3.enable = true;
}

from nixos-generators.

Lassulus avatar Lassulus commented on August 11, 2024

I implemented a PR for nixpkgs which could solve some of the issues: NixOS/nixpkgs#89331

from nixos-generators.

copy avatar copy commented on August 11, 2024

@Lassulus Thanks! What do you think about improving squashfs speed by letting the user specify a faster compression method? -f iso already supports large images, but takes very long to build the image.

from nixos-generators.

Lassulus avatar Lassulus commented on August 11, 2024

better late than never: It would be nice to have squashfs optionally, since compressing everything takes forever when debugging something. Sadly I don't know how to do this and I didn't find any easy exposed options in nixpkgs to allow for this

from nixos-generators.

SuperSandro2000 avatar SuperSandro2000 commented on August 11, 2024

Also run into this today because the build was timing out with 600 max-silent-time.

from nixos-generators.

Lassulus avatar Lassulus commented on August 11, 2024

well making squashfs optional is also something which needs to be done upstream. so not much I can do in nixos-generators I guess (but didn't really take a deep look)

from nixos-generators.

mikepurvis avatar mikepurvis commented on August 11, 2024

πŸ‘ to being able to lower the compression on the squashfs stepβ€” for quick iteration and one-off use-cases, it's often desirable to favor time over storage.

from nixos-generators.

copy avatar copy commented on August 11, 2024

Seems to be fixed then.

from nixos-generators.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.