Hi,

how would one create a development environment for #xmonad contained within my nixos system configuration?

My flake for my system sets up xmonad with a custom config.hs and I’d like to get a suitable dev environment when editing the config.hs. Usually when developing for haskell, I’ll use a flake and setup a devShell which then gets loaded by direnv.

  • is there best practice?
  • my config.hs is in a subdirectory

My first attempt would be to just provide a shell.nix next to my config.hs - but that wouldn’t load the exact same xmonad as the system one, since it’s separate from the flake.

  • demesisx@infosec.pub
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    9 months ago

    Good question. I have an xmonad config in my setup and I’d also love this.

    Here’s a project where I’m using Haskell with nix flakes if it’s helpful at all: https://github.com/cardanonix/pelotero-engine/blob/main/flake.nix

    I’m betting we could use and alter that flake file to achieve something to that effect. It would be a game-changer for me. I currently do the whole eval thing to test my changes and it takes FOREVER to know if I’ve done something dumb.

    Here’s my meta-config, if that helps at all: https://github.com/harryprayiv/nix-config

    The Haskell and Xmonad part:

    home manager: https://github.com/harryprayiv/nix-config/tree/intelTower/home/programs/xmonad

    Base system: https://github.com/harryprayiv/nix-config/blob/intelTower/system/wm/xmonad.nix

    Ps. I started an xmonad community here on Lemmy: https://infosec.pub/c/xmonad

    Edit: surely OP will reply……💀

    • jakalx@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      Hi, I didn’t get a notification and then totally forgot to manually check :(

      Thanks for your links, I’ll check them out! My setup is quite similar to yours.

      Another idea could be to extract the home/programs/xmonad thingy into its own flake somehow.

      Currently I’m trying to figure out if direnv is able to load a particular devShell somehow (and then limim it to a particular host), but didn’t make progress yet. My idea is to have a devShells entry that pulls in xmonad etc. but only gets activated if I enter the xmonad subdirectory… Mh maybe a simple shell.nix with manually managed pinning for nixpkgs could be a way forward.

      I’m currently also doing the nixos-rebuild step to check the config.