!dGrjXvKnCwVLevgmzo:matrix.org

Stockholm NixOS meetup group

19 Members
Monthly meetups in Stockholm, Sweden around Nix releated topics(nixos.org)5 Servers

Load older messages


SenderMessageTime
25 Apr 2024
@lillecarl:matrix.orgLilleCarl (Salsa9) *

I've got some questions for everyone:

  • What's your biggest painpoints using NixOS &/ home-manager today?

Mine's still packaging things that doesn't quite fit the "norm". (https://github.com/dawsers/hyprscroller comes to mind right now).

12:10:13
@erinvanderveen:matrix.orgErinOh nice! I packed that one recently too!12:10:58
@lillecarl:matrix.orgLilleCarl (Salsa9) *

I've got some questions for everyone:

  • What's your biggest painpoints using NixOS &/ home-manager today?
  • What package update solution are you using to update your own derivations?

Mine's still packaging things that doesn't quite fit the "norm". (https://github.com/dawsers/hyprscroller comes to mind right now).

12:11:01
@erinvanderveen:matrix.orgErinI used the nixpkgs function to create Hyprland plugins12:11:21
@erinvanderveen:matrix.orgErinhttps://github.com/NixOS/nixpkgs/blob/572af610f6151fd41c212f897c71f7056e3fb518/pkgs/applications/window-managers/hyprwm/hyprland/plugins.nix#L812:12:34
@lillecarl:matrix.orgLilleCarl (Salsa9)
In reply to @erinvanderveen:matrix.org
I used the nixpkgs function to create Hyprland plugins
Thanks for the tip, I'll give it a shot. I've tried niri and really liked how to manage things with it, but the surrounding tooling isn't quite there yet 😄
12:12:37
@erinvanderveen:matrix.orgErinI went exactly the same route niri -> hyprscroller12:13:14
@lillecarl:matrix.orgLilleCarl (Salsa9)
In reply to @erinvanderveen:matrix.org
I used the nixpkgs function to create Hyprland plugins
* Thanks for the tip, I'll give it a shot. I've tried niri and really liked how to manage windows with it, but the surrounding tooling isn't quite there yet 😄
12:13:22
@lillecarl:matrix.orgLilleCarl (Salsa9) Erin: I must admit, since you talked about Silvan arguing against flakes I've noticed some warts here and there in the UX/DX too. My opinion is still "It gives more good than headache" 😁 12:33:09
@lillecarl:matrix.orgLilleCarl (Salsa9)Redacted or Malformed Event13:31:40
@maedas:matrix.orgmaedas
In reply to @lillecarl:matrix.org
What's the purpose of the setattr and getattr for namespace? Looks a bit overcomplicated for my eyes

writing it that adds the module to a namespace of your choice (replace namespace) , so you dont have to add it manually in every module. Looking into it we realised there might be more readable ways to set it, but for now it works.

The way we get the filename doesnt though. Ill get an update on the final result

14:08:35
@lillecarl:matrix.orgLilleCarl (Salsa9)Aah, so the intention is creation options that align with the file path?14:10:15
@lillecarl:matrix.orgLilleCarl (Salsa9)if you wanna use __curPos, stick this in the args attrs: { __curPos ? __curPos } if you use the nil LSP, it doesn't know about __curPos so we kinda have to trick it 😄14:14:47
@claesatwork:matrix.orgClaes
In reply to @lillecarl:matrix.org

I've got some questions for everyone:

  • What's your biggest painpoints using NixOS &/ home-manager today?
  • What package update solution are you using to update your own derivations?

Mine's still packaging things that doesn't quite fit the "norm". (https://github.com/dawsers/hyprscroller comes to mind right now).

No pain point that comes to mind but I am not especially advanced in my Nix usage. I need to learn more about packaging of other software. I have done that only a handful of times.
16:03:01
@lillecarl:matrix.orgLilleCarl (Salsa9) Erin: Could you share your hyprscroller derivation? 😸 16:07:59
@erinvanderveen:matrix.orgErin
  hyprscroller = pkgs.unstable.hyprlandPlugins.mkHyprlandPlugin pkgs.hyprland {
    pluginName = "hyprscroller";
    version = pkgs.hyprland.version; # No version present in repo, just use hyprland version instead

    src = inputs.hyprscroller;

    installPhase = ''
      mkdir -p $out/lib/
      cp hyprscroller.so $out/lib/libhyprscroller.so
    '';

    dontStrip = true;

    nativeBuildInputs = with pkgs; [ cmake ];

    meta = with pkgs.lib; {
      homepage = "https://github.com/dawsers/hyprscroller";
      description = "Hyprland layout plugin providing a scrolling layout like PaperWM";
      license = licenses.mit;
      platforms = platforms.linux;
      maintainers = [ maintainers.erin ];
    };
  };

16:10:13
@lillecarl:matrix.orgLilleCarl (Salsa9)dank je wel16:13:28
@lillecarl:matrix.orgLilleCarl (Salsa9)Hehe, I was doing the right thing. I'm ofc overdoing it a bit stupidly with this module: https://gist.github.com/Lillecarl/5ce2ce445dc67889f3eca9b225b99a6a The issue was i yanked and pasted the fetchfromgithub function, forgot to clear the sha256 so I was pulling hyprland source instead of hyprscroller16:38:05
@erinvanderveen:matrix.orgErinhttps://nix-community.github.io/home-manager/options.xhtml#opt-wayland.windowManager.hyprland.plugins Home Manager already has a way to add plugins. No need to make that module yourself 😉16:53:50
@alxplus:matrix.orgalxplus
In reply to @erinvanderveen:matrix.org
  hyprscroller = pkgs.unstable.hyprlandPlugins.mkHyprlandPlugin pkgs.hyprland {
    pluginName = "hyprscroller";
    version = pkgs.hyprland.version; # No version present in repo, just use hyprland version instead

    src = inputs.hyprscroller;

    installPhase = ''
      mkdir -p $out/lib/
      cp hyprscroller.so $out/lib/libhyprscroller.so
    '';

    dontStrip = true;

    nativeBuildInputs = with pkgs; [ cmake ];

    meta = with pkgs.lib; {
      homepage = "https://github.com/dawsers/hyprscroller";
      description = "Hyprland layout plugin providing a scrolling layout like PaperWM";
      license = licenses.mit;
      platforms = platforms.linux;
      maintainers = [ maintainers.erin ];
    };
  };

Thanks! Speaking of pain points before, this is something I struggle with, trying to figure out what the most appropriate function, in the end whatever I do feels like a series of functions kept together by duct tape and a prayer 😅
17:13:19
@lillecarl:matrix.orgLilleCarl (Salsa9)
In reply to @erinvanderveen:matrix.org

https://nix-community.github.io/home-manager/options.xhtml#opt-wayland.windowManager.hyprland.plugins

Home Manager already has a way to add plugins. No need to make that module yourself 😉

Hehe yeah, that's a NixOS module, there's something something that isn't handled by HM mod, so I specify package and plugins in nixos and read it from the HM module
17:19:23
@lillecarl:matrix.orgLilleCarl (Salsa9)https://github.com/Lillecarl/nixos/commit/0dc04aa307eae85563c7e04abb7a9d5b36f4c53b17:20:30
@markuskowa:matrix.orgmarkuskowa LilleCarl (Salsa9): the latest and greatest: https://releases.nixos.org/nix/nix-2.22.0/manual/release-notes/rl-2.22.html 19:05:19
26 Apr 2024
@maedas:matrix.orgmaedas
In reply to @lillecarl:matrix.org
Aah, so the intention is creation options that align with the file path?

Final template. Reading a filename elegantly isn't supported by the builtins, the nameBaseOf returns the current dir-name so we reorganized to a folder structure supporting it (and more future proof anyway)

{ config, lib, pkgs, ... }:

let
  name = baseNameOf ./.;
  cfg = lib.getAttr name config.oatmeal;
in
{
  imports = [
  ];

  options.oatmeal.${name} = with lib; {
    enable = mkEnableOption (name + " module");
  };

  config = {
  };
}
00:03:23
@maedas:matrix.orgmaedas
In reply to @lillecarl:matrix.org
Aah, so the intention is creation options that align with the file path?
*

Don't know what __curPos, looks cursed 😄
Final template. Reading a filename elegantly isn't supported by the builtins, the nameBaseOf returns the current dir-name so we reorganized to a folder structure supporting it (and more future proof anyway)

{ config, lib, pkgs, ... }:

let
  name = baseNameOf ./.;
  cfg = lib.getAttr name config.oatmeal;
in
{
  imports = [
  ];

  options.oatmeal.${name} = with lib; {
    enable = mkEnableOption (name + " module");
  };

  config = {
  };
}
00:05:01
@maedas:matrix.orgmaedas`{ config, inputs, secrets, lib, pkgs, ... }: let cfg = config.oatmeal; dir-content = builtins.readDir ./.; in { imports = lib.filter lib.isPath (lib.forEach (lib.attrNames dir-content) (key: if (lib.getAttr key dir-content) == "directory" then (./. + ("/" + key)) else null )) ++ [ ]; options.oatmeal = with lib; { users = mkOption { type = types.listOf types.str; }; }; config = { home-manager = { extraSpecialArgs = { inherit inputs secrets; }; users = lib.foldl' (acc: user: { "${user}" = import (../../users + ("/" + user + "/home.nix")); } // acc) {} cfg.users; }; }; `00:07:29
@maedas:matrix.orgmaedas *
{ config, inputs, secrets, lib, pkgs, ... }:

let
  cfg = config.oatmeal;
  dir-content = builtins.readDir ./.;
in
{
  imports = lib.filter lib.isPath (lib.forEach (lib.attrNames dir-content) (key: if (lib.getAttr key dir-content) == "directory" then (./. + ("/" + key)) else null )) ++ \[
  \];

  options.oatmeal = with lib; {
    users = mkOption {
      type = types.listOf types.str;
    };
  };

  config = {
    home-manager = {
      extraSpecialArgs = { inherit inputs secrets; };
      users =
        lib.foldl'
          (acc: user: { "${user}" = import (../../users + ("/" + user + "/home.nix")); } // acc)
          {}
          cfg.users;
    };
 };
}
00:08:00
@maedas:matrix.orgmaedas *

Module importer/scheduler also got a glow-up, pulling in all modules dynamically from the path.

The single import line is pretty macho though, but I'm pretty happy with it after I figured it out.

{ config, inputs, secrets, lib, pkgs, ... }:

let
  cfg = config.oatmeal;
  dir-content = builtins.readDir ./.;
in
{
  imports = lib.filter lib.isPath (lib.forEach (lib.attrNames dir-content) (key: if (lib.getAttr key dir-content) == "directory" then (./. + ("/" + key)) else null )) ++ \[
  \];

  options.oatmeal = with lib; {
    users = mkOption {
      type = types.listOf types.str;
    };
  };

  config = {
    home-manager = {
      extraSpecialArgs = { inherit inputs secrets; };
      users =
        lib.foldl'
          (acc: user: { "${user}" = import (../../users + ("/" + user + "/home.nix")); } // acc)
          {}
          cfg.users;
    };
 };
}
00:11:21
@erinvanderveen:matrix.orgErin
In reply to @alxplus:matrix.org
Thanks! Speaking of pain points before, this is something I struggle with, trying to figure out what the most appropriate function, in the end whatever I do feels like a series of functions kept together by duct tape and a prayer 😅

Which is mostly correct I think XD

Functional programming has a tendency to feel like that. Especially Nix where there are no real types.

07:24:49
@alxplus:matrix.orgalxplusYeah that's a good point, types help with keeping you on the right track. But no matter, just seeing the kind of stuff you good people are doing helps, like language immersion :)09:07:13

There are no newer messages yet.


Back to Room ListRoom Version: 10