hallettj

joined 1 year ago
[–] hallettj@beehaw.org 16 points 6 months ago (1 children)

Oh is that where all the memes went? My instance isn't federated with lemmy.world so it just looked like the star trek energy vanished.

While I'm here... I finally finished season 4 of Discovery. That show has been getting much stronger as it goes on IMO. I especially enjoyed the last ~3 episodes! I also like the take on the "villains" of the late season (the two humanoid ones). It's a refreshing departure from unsympathetic, plain evil antagonists.

[–] hallettj@beehaw.org 0 points 6 months ago (3 children)

I don't know if it's your cup of tea, but Neovide provides smooth scrolling at arbitrary refresh rates. (It's a graphical frontend for Neovim, my IDE of choice.)

[–] hallettj@beehaw.org 6 points 7 months ago

If I'm doing more than one cracking two together is best. For the last one, countertop.

I get the flat, inside-the-sink idea. But I'd want to clean either way, and I clean the counters more often than I clean the sides of the sink.

[–] hallettj@beehaw.org 7 points 7 months ago (1 children)

Well you're really feeding my Nix confirmation bias here. I used to use Ansible with my dot files to configure my personal computers to make it easy to get set up on a new machine or server shell account. But it wasn't great because I would have to remember to update my Ansible config whenever I installed stuff with my OS package manager (and usually I did not remember). Then along came Nix and Home Manager which combined package management and configuration management in exactly the way I wanted. Now my config stays in sync because editing it is how I install stuff.

Nix with either Home Manager or NixOps checks all of the benefits you listed, except arguably using a "known" programming language. What are you waiting for?

[–] hallettj@beehaw.org 1 points 7 months ago

For the PaperWM fans, this is a dedicated WM based on the same idea

[–] hallettj@beehaw.org 8 points 7 months ago

This is basically the plot of Loki

[–] hallettj@beehaw.org 4 points 7 months ago (1 children)

AFAIK the best thing you can do to improve your coffee-freezing process is to prevent moisture from getting into the beans when you thaw. If you let it, moisture from the air will condense on the cold beans. So keep the beans in a closed, airtight container until they come to room temperature. (Airtight because water vapor is air.) So yeah, jars are good for this. Or sealed freezer bags should work too.

[–] hallettj@beehaw.org 2 points 7 months ago

Hmm, good point. But it was Ursula Le Guin who coined the word. Maybe there's a workable reference in Left Hand of Darkness, or The Dispossessed.

[–] hallettj@beehaw.org 3 points 7 months ago

Well ok, they both use symlinks but in different ways. I think what I was trying to say is that in NixOS it's symlinks all the way down.

IIUC on Fedora Atomic you have an ostree image, and some directories in the image are actually symlinks to the mutable filesystem on /var. Files that are not symlinks to /var (and that are not inside those symlinked directories), are hard links to files in the ostree object store. (Basically like checked-out files in a git repository?)

On NixOS this is what happens if examine what's in my path:

$ which curl
/run/current-system/sw/bin/curl

$ ls -l /run | grep current-system
/run/current-system -> /nix/store/p92xzjwwykjj1ak0q6lcq7pr9psjzf6w-nixos-system-yu-23.11.20231231.32f6357

$ ls -l /run/current-system/sw/bin/curl
/run/current-system/sw/bin/curl -> /nix/store/r304lglsa9i2jy5hpbdz48z3j3x2n4a6-curl-8.4.0-bin/bin/curl

If I select a previous configuration when I boot I would get a different symlink target for /run/current-system. And what makes updates atomic is the last step is to switch the /run/current-system symlink which switches over all installed packages at once.

I can temporarily load up the version of curl from NixOS Unstable in a shell and see a different result,

$ nix shell nixpkgs-unstable#curl  # this works because I added nixpkgs-unstable to my flake registry
$ which curl
/nix/store/0mjq6w6cx1k9907vxm0k5pk7pm1ifib3-curl-8.4.0-bin/bin/curl  # note the hash is different

I could have a different version curl installed in my user profile than the one installed system-wide. In that case I'd see this:

$ which curl
/home/jesse/.nix-profile/bin/curl

$ ls -la /home/jesse | grep .nix-profile
.nix-profile -> /nix/var/nix/profiles/per-user/jesse/profile

$ ls -l /nix/var/nix/profiles/per-user/jesse
profile -> profile-133-link
profile-130-link -> /nix/store/ylysfs90018zc9k0p0dg7x6wvzqcq68j-user-environment
profile-131-link -> /nix/store/9hjiznbaii7a8aa36i8zah4c0xcd8w6d-user-environment
profile-132-link -> /nix/store/h4kkw1m5q6zdhr6mlwr26n638vdbbm2c-user-environment
profile-133-link -> /nix/store/jgxhrhqiagvhd6g42d17h4jhfpgxsk3n-user-environment

Basically symlinks upon symlinks everywhere you look. (And environment variables.)

So I guess at the end everything is symlinks on NixOS, and everything is hard links plus a set of mount paths on Fedora Atomic.

[–] hallettj@beehaw.org 7 points 7 months ago

If you put an FHS on the actual system you wouldn't be able to install multiple versions of the same package, updates wouldn't be atomic - you wouldn't get the big selling points of Nix.

[–] hallettj@beehaw.org 3 points 7 months ago

When science kills the mystery, semantics keeps the debate alive!

[–] hallettj@beehaw.org 4 points 7 months ago

To answer your other question, yes there are still single-cell organisms evolving into new species all the time, in the ocean and elsewhere. That includes new multi-cellular species evolving from single cells all the time. But it takes a long time to develop from cell, to clump of slime, to something with legs. So you might not notice the changes if you aren't super patient.

Or were those separate questions? Are you asking if chickens descended from single-cell organisms? Yes they did. With a lot of steps in between.

 

Posting just because I looked all over and didn't see an answer. This function expands its arguments to canonical, absolute file paths, and tests whether one is a string prefix of the other. It also works for checking whether a directory is inside of or is identical to another directory.

local is_file_in_directory = function(file_path, directory_path)
  local file = vim.fn.fnamemodify(file_path, ':p')
  local dir = vim.fn.fnamemodify(directory_path, ':p')
  return file ~= nil and dir ~= nil and
      -- is dir an initial substring of file?
      file:find(dir, 1, true) == 1
end

This came up because I'm setting up obsidian.nvim which looks like a handy way to get the best of both worlds between Obsidian and Neovim. I'm setting up some custom configuration to automatically change the selected Obsidian workspace when I cd into vault directory, and to set conceallevel = 1 only on files in a vault, and that requires checking whether the working directory or a file path is inside a given vault directory.

 

This is something that I struggle with. I know how to find top-level packages like git or cowsay. But what about utilities under nested paths? I always spend ages digging through the nixpkgs source code to try to find utilities to use in my nix expressions.

Today I want to use buildRustPackage. It's defined here, and is propagated here. But how do I access it given a pkgs variable? I have no idea!

https://search.nixos.org/packages is no help

nix search nixpkgs doesn't find it

I think I need to search by attribute name, not by derivation name. But I don't know how to do that.

3
submitted 10 months ago* (last edited 10 months ago) by hallettj@beehaw.org to c/nixos@lemmy.ml
 

It took me a while to figure this out. I use Home Manager to manage my Gnome settings by setting dconf.settings = { ... }. My settings are non-trivial (for example my paperwm module). So it's helpful for me to check the actual dconf settings that Home Manager produces.

To do that build your configuration with home-manager build, open result/activate, and find a line that looks like this:

$DRY_RUN_CMD $DCONF_DBUS_RUN_SESSION /nix/store/4ab7dx08wx640444m71axlqvbrvz73bv-dconf-0.40.0/bin/dconf load / 
  < /nix/store/0hdnvwx8d9sifd6ib8n2hhblyblq0ccp-hm-dconf.ini

The store path for hm-dconf.ini has the settings.

Edit: added a line break to the script line so you can see the relevant store path

 

I have a workaround so this isn't exactly a problem for me. I'm just curious about what is going on, and what best practices are.

I'm setting up Arion. I think it will be helpful for my development flow in a project where I have several services that need to run and communicate with each other. Docker-compose is a nice way to handle this, but you have to have a Docker image to run, and it's a pain to create a new image after each code change. OTOH Arion will run an arbitrary command, and creates Nix-friendly images automatically. Very promising!

The Nix expression for the service I'm developing is exported from a flake, while the arion executable reads its configuration from a Nix expression that is not a flake. There is an example configuration that recommends importing a flake using builtins.getFlake which you can see here: https://github.com/hercules-ci/arion/blob/main/examples/flake/arion-pkgs.nix

The problem is that builtins.getFlake is slow. It adds >20s to every arion command I run. That includes starting services, reading logs, removing stopped containers, etc.

The example config includes a fallback that loads the flake using flake-compat instead of builtins.getFlake. When I use flake-compat loading the flake is nearly instant.

So I'm using flake-compat, and that seems to be working. (Many thanks to the flake-compat author!) But I'm curious why builtins.getFlake is so slow.

 

I've had a problem making commits with fugitive for a long time, over a number of versions of Neovim. Has anyone seen this error before? I've searched a number of times but not found anything.

I use the cc binding in a fugitive window to open a split to write a commit message. Then I run :x to close the split and finish the commit. Most times - but not every time - I get this error message, the commit is not made, and the fugitive window becomes blank.

g`"                                                                                                                            
Error detected while processing BufEnter Autocommands for "fugitive://*//"..function 81_ReloadWinStatus[11]..81_Reloa
dStatusBuffer[6]..fugitive#BufReadStatus[364]..BufEnter Autocommands for "fugitive://*//"..function 81_ReloadWinStatus[11]
..81_ReloadStatusBuffer[6]..fugitive#BufReadStatus[292]..BufReadPost Autocommands for "*"..function fugitive#Resume[5]..<s>81_RunWait:                                                                                                                 
line   29:                                                                                                                     
E242: Can't split a window while closing another

I don't know what the deal is with the g`" line in messages. That might be a clue?

This does not happen when I make a commit without writing a message - for example when I use ce to amend the last commit without editing the commit message.

 

Instead of getting plugins through nixpkgs I prefer to use my neovim-specific plugin manager. (In my case that's lazy.nvim.) Mostly this works without problems - but some setup is required when a plugin needs to compile something. The plugin that has given me the most trouble is Treesitter which wants to compile grammars. Here is how I got that working.

tl;dr: Configure Treesitter to compile grammars with gcc instead of clang.

As has been reported in https://github.com/nvim-treesitter/nvim-treesitter/issues/1449 Treesitter will try to use clang to compile Treesitter grammars, and on NixOS for some reason clang is not able to locate necessary C++ libraries. The fix that works for me is to configure Treesitter to use gcc instead. Here is the relevant part of my plugin config:

return {
  'nvim-treesitter/nvim-treesitter',
  build = ':TSUpdate',
  config = function()
    -- Set compiler to get grammar installation working in NixOS. See
    -- https://github.com/nvim-treesitter/nvim-treesitter/issues/1449
    require('nvim-treesitter.install').compilers = { 'gcc' }
    require('nvim-treesitter.configs').setup {
      ensure_installed = 'all', -- "all", or list of languages
      ignore_install = { 't32' }, -- t32 is failing to download for me
    }
  end,
}

I still had a problem with the t32 grammar, but I don't need that one so I disable it.

Of course you need to make sure that gcc is available. You could put it in your user profile, but I prefer to make sure by using the extraPackages option from Home Manager's neovim module. Here's my full config:

programs.neovim = {
  enable = true;
  defaultEditor = true;
  withPython3 = true;
  extraPackages = with pkgs; [
    fd
    gh # for github integration
    ripgrep

    # needed to compile fzf-native for telescope-fzf-native.nvim
    gcc
    gnumake

    # language servers
    nil # Nix LSP
    lua-language-server

    nixpkgs-fmt # I have nil configured to call this for formatting
  ];
};
 

I'm using a PaperWM which is a scrolling window manager extension for Gnome, and I love it! But it's an extensive extension which means it is sometimes brittle. I've thought it would be nice to find a window manager that is natively designed with a workflow that I like. There don't seem to be any actively-maintained scrolling window managers out there. But scrolling is kind of a special type of tiling - I was hoping that someone with tiling experience could give me some tips on how to configure Hyprland, Sway, or something else to customize it for my particular working style.

I've realized that generally what I want is to be able to look at 2 windows at a time. But often I want to keep one of those windows in view, while swapping out the second window. For example,

  • When programming I want to keep my editor in view while switching between a terminal or a browser as my second window.
  • When researching I have a browser window in view, and for my second window I'll switch between my notes app, my todo list, my password manager, a map, etc.

And there are some features I'd like,

  • When programming I'd like to be able to make my editor full screen sometimes, and be able to quickly switch back to editor-and-terminal side-by-side.
  • When there are more than 2 windows on my workspace I'd like the ones I'm not looking at to go away without having to think about moving them to a specific other workspace.
  • When I open a new window I'd like to automatically see that window next to the previous window I was looking at, ideally moving other windows out of the way instead of making my previous window smaller.

I know most of this could be done with two monitors. But I have one ultrawide instead. Besides, I'd like to be able to use a 3/4-1/4 or 2/3-1/3 split in some cases.

So what do you think? Do you have a workflow that you love that you'd like to share?

 

I've been searching for a way to do this, but I haven't found anything. After I have refactored my Home Manager configuration is there a way I can test the changes in a shell before I switch?

From what I understand the next-best option is to switch, and then find and run the activate script of the previous generation to switch back.

 

It's a story as old as time. I moved into a new place with great fiber internet - but the modem is in the garage, my desktop PC is not, and the place is a rental so I have limited options for making modifications. The signal is not bad, but I'm getting dropouts.

Since the PC and router are fixed in place I thought maybe a directional antenna or two would help? 5GHz directional antennae are kinda scarce which makes me wonder if I'm on the wrong track. Does this new "beamforming" thing supersede directional antennae?

I have 802.11ax (a.k.a. Wi-Fi 6) on both sides of the connection. Maybe I could upgrade to Wi-Fi 6E and give 6GHz a go? Maybe that would be worse due to the intervening wall...

 

I'm trying to set up Lutris to play games with Wine. I don't understand how I am supposed to install wine runners? Can anyone help?

Edit:* It seems the answer is to install runners through the Lutris UI as usual. The Lutris package runs in an FHS which makes everything work even though the runners are not built for NixOS.

It turns out that what I was missing (I think) was 32-bit DRI support. I enabled that with these lines in my NixOS configuration:

# in /etc/nix/configuration.nix

hardware.opengl = {
  driSupport = true;
  driSupport32Bit = true;
};

Everything below this edit is red herrings.

/end of edit*

I tried installing a runner, lutris-GE-Proton8, through Lutris itself as I do in another distro. That crashed with some sort of error - instead of spending time investigating that I thought I'm probably supposed to install things the Nix way so that dependencies are set up correctly.

I tried installing Wine from nixpkgs like this, and configuring Lutris to use the system Wine:

home.packages = with pkgs; [
  (lutris.override {
    extraPkgs = lutrisPkgs: [
      wine
    ];
  })
];

But when I start up a game I get a warning telling me that I need a version of Wine with esync.

I found a Nix expression for wine-ge in the nix-gaming repo. So I tried building Lutris with that. Here is an excerpt of my Home Manager flake.nix:

{
  inputs = {
    # ...
    nix-gaming = {
      url = "github:fufexan/nix-gaming";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, home-manager, nix-gaming, ... }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      homeConfigurations."jesse" = home-manager.lib.homeManagerConfiguration {
        # ...
        modules = [
          ./home.nix
          # ...
        ];
        extraSpecialArgs.inputs = { inherit nix-gaming; };
      };
    };
}

And the my attempt at a Lutris config in home.nix:

home.packages = with pkgs; [
  (lutris.override {
    extraPkgs = lutrisPkgs: [
      wine
      inputs.nix-gaming.packages.${pkgs.system}.wine-ge
    ];
  })
];

After a great deal of compiling I believe that I have wine-ge installed... somewhere. (I did try to use the nix-gaming binary cache. I probably messed that up by forcing my version of nixpkgs. I'll probably let nix-gaming use its own nixpkgs version next time.)

I've read that the lutris package creates an FHS (Filesystem Hierarchy Standard) environment. That is a filesystem somewhere with the directory layout you see in other distros. I expected that wine-ge would be linked into the FHS somewhere. I had the thought that I would configure Lutris with the path to wine-ge. But the file browser that I get in Lutris seems to show me the host file system, not the FHS.

I thought that maybe I could give Lutris the store path to wine-ge. Then if when I upgrade I'll have to track that down and set the path again. Is there a better way?

 

I've been thinking about trying NixOS for a while. I think the concepts are elegant, and I have been finding Nix flakes to be very nice for software development. I'm about to get a new machine so I'm ready to take the plunge. Any advice before I dive in?

I'd like to set up Gnome with some extensions. One of the things I especially want to learn is how to set up graphics drivers, Vulkan, and Lutris.

For anyone who hasn't heard of it, Nix is a "declarative" package manager. Each package is stored with a hash that encodes its exact source, build script, dependencies, etc. You can have packages installed with mutually-incompatible library dependencies, and Nix makes it just work. For purposes of setting up per-project dependencies Nix does what Docker does, but faster, with more cache hits, and without emulation / containerization. If you want to deploy Docker images, Nix can build images that are more efficient than what you get from dockerfiles.

You can use Nix as an additional package layer in Linux, MacOS, or Windows with WSL. Think of it as an alternative to Homebrew.

NixOS is a Linux distro that uses Nix as its primary package manager, and uses Nix principles to manage configuration. Instead of running commands to install things, and then later forgetting what you installed or why, packages are listed in config files. The system installs and links packages as necessary. Anything you remove from your config is unlinked. When you want to reclaim space you can garbage-collect unused packages.

view more: next ›