Nix / NixOS

!nix

@programming.dev
Create post
hardware.{graphics VS. amdgpu} OR. combined?

hardware.{graphics VS. amdgpu} OR. combined?

Maaaybe a stupid question as it might just be the same thing done differently. I'm not bright enough to understand the differences.

hardware.graphics was recently introduced which replaced hardware.opengl. Now, I've got my amdvlk, libva and such configured via hardware.graphics — recently I came across hardware.amdgpu which offers a bunch of options.

Should one combine, use one or the other, or does it make any difference at all?

hardware.amdgpu.opencl.enable
hardware.amdgpu.legacySupport.enable
hardware.amdgpu.initrd.enable
hardware.amdgpu.amdvlk.supportExperimental.enable
hardware.amdgpu.amdvlk.support32Bit.package
hardware.amdgpu.amdvlk.support32Bit.enable
hardware.amdgpu.amdvlk.settings
hardware.amdgpu.amdvlk.package
hardware.amdgpu.amdvlk.enable
hardware.graphics.extraPackages32
hardware.graphics.extraPackages
hardware.graphics.enable32Bit
hardware.graphics.enable

That is, are these two examples the same for all intents and purposes or do either bring anything else?

hardware.amdgpu.amdvlk = {
  enable = true;
  support32Bit.enable = true;
};

# VS.

hardware.graphics = {
  enable = true;
  enable32Bit = true;
  extraPackages = with pkgs; [
    amdvlk
  ];
  extraPackages32 = with pkgs; [
    driversi686Linux.amdvlk
  ];
};
[Non-NixOS] Nix (or Lix, or whatever) with SELinux?

[Non-NixOS] Nix (or Lix, or whatever) with SELinux?

Title says it all. The Determinate Systems installer is supposed to have support, but it doesn’t work – from what I can tell, the contexts are wrong. Running restorecon reports changes, but I’m still getting denials. Running on Fedora Asahi Remix 40, if that’s relevant.

Is there any way to make this work? AppArmor is unsupported on Fedora, so I can’t switch to it…

Problem with Modularzing config

Problem with Modularzing config

Hi all;

This is a bit of a long shot; but I'm having an issue with trying to modularize my config in preparation for a new laptop.

In particular the issue I have is around passing a path through to an import statement for a home-managed user.

In particular I'm getting undefinedVariable hmPath; but it doesn't seem to be having the same issue when I'm mapping groups and shell; so I can only assume that imports has to be treated differently but I'm at a loss.

Any help on what I've misunderstood would be greatly appreciated.

Snippet below

{ pkgs, config, options, lib, home-manager, ... }:

with lib; let
  cfg = config.ltp.home;

  user = types.submodule ({name, ...}: {
    options = {
      doas.enable = mkEnableOption {
        default = false;
        type = types.bool;
      };

      groups = mkOption {
        default = [];
        type = types.listOf string;
      };

      shell = mkOption {
        default = pkgs.bash;
        type = types.package;
      };

      hmPath = mkOption {
        type = types.path;
      };
    };
  });
in
{
  options.ltp.home = {
    users = mkOption {
      description = Attrset of home-manager users;
      default = {};
      type = types.attrsOf user;
    };
  };

  config = mkIf (cfg.users != {}) (mkMerge [
    {
      users.users = let mkUser =
        lib.attrsets.mapAttrs'
        (
          name: value:
          lib.attrsets.nameValuePair
            "${builtins.baseNameOf name}"
            {
              isNormalUser = true;
              extraGroups = "${groups}";
              shell = "${shell}";
            }
        )
        cfg.users;
      in
      mkUser;
      
      home-manager.users = let mkHmUser =
        lib.attrsets.mapAttrs'
        (
          name: value:
          lib.attrsets.nameValuePair
            "${builtins.baseNameOf name}"
            {
              imports = [ "${hmPath}" ];
            }
        )
        cfg.users;
      in
      mkHmUser;
    }
  ]);
}

Edit...

Solved the initial issue I was confusing myself and should've been using value.hmPath and equivalent inside the lib functions.

Next issue; I'm having is I can't seem to pass through the path for the home-manager module for the user that is give to the import statement.

Edit 2...

I didn't manage to get it working how I was doing it so I've changed my approach; to implicitly reference the users home-manager base module based on the folder structure e.g. ./hosts/${hostname}/users/${builtins.baseNameOf name}

Nix in 100 Seconds - YouTube

Nix in 100 Seconds - YouTube

Open link in next tab

https://youtube.com/watch?v=FJVFXsNzYZQ

The Scrolls of Nix

The Scrolls of Nix

A big part of why nix documentation is sub par. The essential tomes of nix - the nix manual, the nixos manual, the nixos options, the nixpkgs manual - each of these documents is just one long page.

They are the digital equivalent of scrolls, rather than books (codices?).

Rather than having a page number (or page link), one must unroll the scroll to the point of interest. One cannot simply flip between two points of interest. One cannot have bookmarks, or refer to page numbers. Ctrl-F is helpful, sure, but not great.

For instance, I was just looking for the documentation of the systemd.services.<name> options. Its near the end of the colossally long scroll known as the Nixos Options Appendix. Ctrl-F on systemctl.services will get one million hits on all the myriad services nixos offers before you finally get to the relevant section. And if you do find that section (with single pixel movements of the scroll bar) and then ctrl-f, woe betide you, you're now at the top of the document and your place is lost!

Nix develop shell not using custom TSL certificates

Nix develop shell not using custom TSL certificates

Hi!

I've ran into an issue with nix develop shells.

My setup:

  • Nix Darwin (macos)
  • Custom TLS certificates installed via nix darwin

Everything works as expected with the installed certificates, but as soon as I enter into a development shell with nix develop, the certificates are not available and thus, I get TLS errors that break whatever I'm doing in the dev shell. If I use an impure development shell, the issue disappears.

Is there a way to use pure nix develop shells which respect the installed certificates?

Finally a half-decent CUDA solution on NixOS

Finally a half-decent CUDA solution on NixOS

Open link in next tab

CUDA on NixOS Without Sacrificing One's Sanity - lavafroth

https://lavafroth.is-a.dev/post/cuda-on-nixos-without-sacrificing-ones-sanity/

What is CUDA? CUDA, also known as Compute Unified Device Architecture is a proprietary parallel computing platform and application programming interface that allows software to use certain types of graphics processing units for accelerated general-purpose processing, an approach called general-purpose computing on GPUs. according to Wikipedia. According to me, it is a proprietary vendor lock-in for machine learning folks and the bane of my existence. There’s no other API out there that competes with CUDA as of writing.

Changing Hardware config

Changing Hardware config

I want to change my hardware config from 2 btrfs partitions to 1 partition with subvolumes for root, /nix, /home, and maybe some other like /log.

I mainly want to optimize the /nix/store. And possibly being ready to integrate the impermanence module down the line

What would be the easiest way to accomplish this without reinstalling or breaking too much?

Alternativly I thought about using disko and nixos-install the overwrite my second disk

Thank you

Anybody know how I can adjust my scroll speed in the config?

Anybody know how I can adjust my scroll speed in the config?

I'm using Nixos 24.05 on my asus zenbook 14 and the scroll speed of the touchpad is rather high.

Is there any way to adjust it from the config? I don't see an option in gnome/wayland