Setting up wallust in a flake

It’s so hard, trying to find simple stripped down examples for flakes and well everything in Nixos. I want to start using homemanager and flakes. So, the below is a flake, which now will only install wallust. I can’t get it to build. I get a weird error:

error:
Failed assertions:
- The ‘fileSystems’ option does not specify your root file system.
- You must set the option ‘boot.loader.grub.devices’ or ‘boot.loader.grub.mirroredBoots’ to make the system bootable.

I just want it to install wallust and later any other ricing things. I’ll make flakes to setup bash and sutff later. SIde Note: I feel like if somebody wrote an app that helped automate & build things like flakes and home-manager configs, they’d become a millionare.

{
description = “Ricing flake”;
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
};

outputs = { self, nixpkgs, … }: {
nixosConfigurations.ricer = nixpkgs.lib.nixosSystem {
system = “x86_64-linux”;
modules = [
({ config, pkgs, … }: {
# Install Wallust as a system package from Nixpkgs
environment.systemPackages = [ pkgs.wallust ];

      # Configure Wallust as needed
      # Example configuration:
      #services.wallust = {
      #  enable = true;
      #  # Add Wallust configuration here if required
      #};

      # Other system configurations
    })
  ];
};

};
}

Flake’s output nixosConfiguration is meant to describe a complete NixOS system that one could install on their machine. To that end, it needs something to boot off – which is what the error message is about.

What is your atarting point? Are you on NixOS or another operating system?

If you just want to try out packages in temporary environments, you could just run nix shell nixpkgs#<pkgname>.

For the first error, you need to source a hardware-configuration.nix in your flake.
You can create it with:

nixos-generate-config --show-hardware-config > hardware.nix

and use it by adding it as an import to the NixOS config:

...
({ config, pkgs, … }: {
imports = [
  ./hardware.nix
];

# Install Wallust as a system package from Nixpkgs
environment.systemPackages = [ pkgs.wallust ];
...

I don’t use GRUB now, but I did for a bit. So, for the second error, I think you need to set boot.loader.grub.devices to "nodev"
and of course other GRUB config

Here what mine was:

boot.loader = {
  efi.canTouchEfiVariables = true;
  systemd-boot.enable = false;

  grub = {
    enable = true;
    efiSupport = true;
    device = "nodev";
    memtest86.enable = true;
    theme = pkgs.nixos-grub2-theme;
    useOSProber = true;
  };
};

Im on NIxOS. Defining an entire system. I just want to install a package, enable it, and maybe set some options or something. Do you not want to use flakes to do this?

I want separate files for ricing, window managers, etc … Modulaarize it all.

Do you not want to use flakes to do this?

You can, but you do not have to. And this is not my trying to sway you away from using flakes, just stating the fact.

I want separate files for ricing, window managers, etc … Modulaarize it all.

That is the purpose of nix modules. You can inline them or import them as files.

In your case what I believe you want to do then is to include all your existing modules (probably from /etc/nixos) in this flake as @railwhale suggested. If you are using git, you would need to move them into the flake’s directory though.

I’m not wanting to define any hardware of anything else. I just want a separate file flake or module that installs, enables, and may sets up any options for, in this case, wallust.

I learn from examples & that’s the program. I can’t find any examples. Everything seems so advanced.

In a nixos configuration, I can say:

environment.systemPackages = with pkgs; [
    wget
    git
    home-manager
    wallust
  ];

and I don’t know how to bring it into home-manager. I get an error about environment not existing or something.

I need the flakes or modules super bare bone, cause I don’t like replicating a bunch of code. It might be, say 10 lines of extra code, but what if you had 1000 modules “extreme unrealistic example” … that’d be 10000 lines of repeating code.