hallettj

joined 1 year ago
[–] hallettj@beehaw.org 4 points 6 months ago

I think you can mount an ISO image under your running system and make changes. I found a couple of guides that might be helpful:

How to Mount an ISO File on Linux

Edit and repack .iso bootable image

I haven't done this before, but I think you can chroot into the mount directory, and run package manager commands in the mounted image to install another package.

Or I have an alternative suggestion that might or might not be easier. I've been hearing a lot about immutable/atomic distros, and people designing their own images. You could make your own ublue image, for example, with whatever you want on it.

A promising looking starting point is github:ublue-os/startingpoint. Ignore the "Installation" instructions, and follow the "ISO" instructions instead.

Or I saw recently an announcement of a new way to build atomic images that is supposed to be easier than ever, BlueBuild

[–] 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 2 points 7 months ago (1 children)

It scrolls smoothly, it doesn't snap line by line. Although once the scroll animation is complete the final positions of lines and columns do end up aligned to a grid.

Neovim (as opposed to Vim) is not limited to terminal rendering. It's designed to be a UI-agnostic backend. It happens that the default frontend runs in a terminal.

[–] hallettj@beehaw.org 2 points 7 months ago (6 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 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 3 points 7 months ago

I haven't used Krita. But I can tell you that those wrappers are "options" defined by NixOS modules. There is documentation for writing them in the NixOS Manual.

Built-in NixOS options are documented in the Configuration Options Appendix with links to implementations which provide helpful examples when writing your own options.

[–] 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.

 

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.

1
submitted 11 months ago* (last edited 11 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.

 

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'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 ›