Just a basic programmer living in California

  • 16 Posts
  • 212 Comments
Joined 2 years ago
cake
Cake day: February 23rd, 2024

help-circle
  • Whoops! Guess I was wrong. After some experimenting it looks like the flake system parses, but does not evaluate flake.nix to read inputs. I also experimented with string concatenation, and that failed with the same error:

    nixpkgs.url = "github:nixos/nixpkgs" ++ "/nixos-25.05"; # error: expected a string or path, but got a thunk
    

    A “thunk” is an expression whose evaluation has been delayed. It’s a key piece of lazy evaluation. Remember that every expression in Nix is lazily evaluated.

    It looks only literal attribute set, string, and path expressions will work in inputs. I think that means it is not possible to split inputs over multiple files.



  • I think you can use import to load the expression from each file, and the // operator to combine imported attribute sets. Like this:

    Edit: This doesn’t work - see replies

    # flake.nix
    {
      inputs =
        import ./inputs/nixpkgs.nix //
        import ./inputs/nix-index.nix;
    
      # ...
    }
    
    # inputs/nixpkgs.nix
    {
      nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
      nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    }
    
    # inputs/nix-index.nix
    {
      nix-index-database = {
        url = "github:Mic92/nix-index-database";
        inputs.nixpkgs.follows = "nixpkgs";
      };
    }
    



  • I haven’t tried it, but I know people use it to run Minecraft Bedrock Edition. Although I’m reading reports that that broke recently, so I’m not sure if it’s working at the moment.

    Minecraft BE is very frustrating - there is a native Linux build for Android, that works great when you can get it to run on a proper computer. But Microsoft’s authentication system makes it very difficult to do that. Minecraft Java Edition works without problems, and is probably the better Minecraft; but the two editions don’t interoperate without server mods, a lot of people run BE, and the kids want to be able to play online with their friends.




  • Oh yeah, I do find Helix interesting! I sometimes recommend it to people who don’t have a background with modal editing as a batteries-included option for getting started. I have tried it a little bit myself. It’s hard for me to give up leap.nvim and fugitive, which is holding me back.

    I’ve been meaning to try out dedicated git programs to see how comfortable I can be without fugitive. Tig is one that caught my eye. Or sometimes I even think about using Gitbutler because its virtual branch feature seems very useful, and I haven’t seen any other tool that does that.



  • I certainly see the value in this strategy! But I’m not going to give up my top-level aliases. I enjoy saving two keystrokes too much!

    Here are my most used aliases (these ones use Nushell syntax):

    alias st = git status
    alias sw = git switch
    alias ci = git commit
    alias lg = git log --color --graph '--pretty=format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
    alias push = git push
    

    I was also delighted to learn that I could get the same short aliases for corresponding fugitive commands in vim/neovim using the vim-alias plugin:

    -- This is a lazy.nvim plugin module
    return {
      'Konfekt/vim-alias',
      config = function()
        -- Shortcuts for git operations to match some of the shell aliases I have.
        -- For example, `:sw ` expands to `:Git switch `
        vim.cmd [[Alias sw Git\ switch]]
        vim.cmd [[Alias ci Git\ commit]]
        vim.cmd [[Alias pull Git\ pull]]
        vim.cmd [[Alias push Git\ push]]
        vim.cmd [[Alias show Git\ show]]
        vim.cmd [[Alias re Git\ restore]]
        vim.cmd [[Alias lg GV]]
      end,
    }
    

    Fugitive is very nice for integrating git workflows in the editor, and its commands have very nice tab completion for branches and such.


  • I have to dual boot for work, so every day I have to reboot into a different OS install. It’s on its own drive with its own bootloader, so I can’t use systemctl reboot --boot-loader-entry. But I was able get a smooth process using efibootmgr.

    This is my Nushell implementation:

    def boot-to [
      device: string@boot-devices # Identifier of device to boot to (e.g. 0003)
    ] {
      sudo efibootmgr --bootnext $device
      systemctl reboot
    }
    
    # This function exists to provide tab completion for boot-to
    def boot-devices [] {
      efibootmgr | parse --regex 'Boot(?<value>\S+)\* (?<description>(?:\w+ )*\w+)'
    }
    

  • I like mkcd! I have the same thing. Although what I use more is a function I pair with it that specifically creates a temporary directory, and cds to it. It’s useful for temporary work, like extracting from a zip file.

    These are my Nushell implementations:

    # Create a directory, and immediately cd into it.
    # The --env flag propagates the PWD environment variable to the caller, which is
    # necessary to make the directory change stick.
    def --env dir [dirname: string] {
      mkdir $dirname
      cd $dirname
    }
    
    # Create a temporary directory, and cd into it.
    def --env tmp [
      dirname?: string # the name of the directory - if omitted the directory is named randomly
    ] {
      if ($dirname != null) {
        dir $"/tmp/($dirname)"
      } else {
        cd (mktemp -d)
      }
    }
    


  • Not OP, but I’ve been using Niri as my daily driver for almost two years (since v0.1.2). The stability and polish have really impressed me. In addition to the scrolling workflow it has some especially nice features for screen sharing & capturing, like key binds to quickly switch which window you are sharing, and customizable rules to block certain windows when showing your whole desktop.

    I do use a 40" ultrawide. Looking for options for getting the most out of an ultrawide was how I got into scrolling window managers.

    I only occasionally use my 13" laptop display. I still like scrolling because I like spatial navigation. Even if windows end up mostly or entirely off the screen I still think about my windows in terms of whether they’re left, right, up, or down from where I’m currently looking.

    I don’t like traditional tiling as much because I find squishing every window to be fully in view to be awkward; and with e.g. i3-style wms if I want to stash a window out of view, like in a tab that’s a separate metaphor I have to keep track of, with another axis where windows might be. Scrolling consistently uses on spatial metaphor, placing all windows on one 2D plane with one coordinate system.


  • Home Manager is a Nix tool for managing configuration for a single user, usually on a Linux or MacOS system, or possibly WSL. You configure installed programs, program configuration (such as dot files), and a number of other things, and you get a reproducible environment that’s easy to apply to multiple machines, or to roll back configuration, etc. I find it helpful for having a clear record of how everything is set up. It’s the sort of thing that people sometimes use GNU Stow or Ansible for, but it’s much more powerful.

    A Home Manager configuration is very similar to a NixOS configuration, except that NixOS configures the entire system instead of just configuring user level stuff. (The lines do blur in Nix because unlike traditional package managers where packages are installed at the system level, using Nix packages can be installed at the system, user, project, or shell session level.) Home Manager is often paired with NixOS. Or on Macs Home Manager is often paired with nix-darwin. As I mentioned, the Home Manager portion of my config is portable to OSes other than NixOS. In my case I’m sharing it in another Linux distro, but you can also use Home Manager to share configurations between Linux, MacOS, and WSL.



    • NixOS + Home Manager
    • Niri
    • Kitty
    • Neovim, via Neovide

    For work it’s Fedora + Home Manager because the remote admin software doesn’t support NixOS. Thankfully I’ve been able to define my dev environment almost fully in a Home Manager config that I can use at work and at home.

    I use lots of Neovim plugins. Beyond the basic LSP and completion plugins, some of my indispensables are:

    • Leap for in-buffer navigation & remote text copying
    • Oil for file management
    • Fugitive + Git Signs + gv.vim + diffview.nvim for git integration
    • nvim-surround to add/change/remove delimiters
    • vim-auto-save
    • kitty-scrollback


  • I like rofi for this use case, but it uses fuzzy search instead of labels. You might have to type more than one letter, depending on what windows you have open. OTOH if you know any part of the window title you can start typing immediately without having to scan a list for a label first.

    Labels work well for jumping to something you can already see, because the label appears where you are already looking, so you see it immediately. I’m guessing the process of finding the label for a window that is not visible would be clunkier - you’d have to find the label in a possibly long window list.