@document.meta title: Nix description: Notes on this Nix config authors: ladas552 @end I start to have a life other than computers so I kinda begin to forget what I did and didn't. So here we are, there will be notes, todos, plans and tips(mostly for myself) * Notes ** Scripts I declare scripts with packages that allow to have them in nix format. It allows me to not hold dependencies for certain scripts, like `libnotify` for scripts that send notifications. There are several ways to do this, I prefer bash, but it isn't sufficient in certain places. I hold all of my scripts in {./pkgs/}[pkgs] folder *** writeShellScriptBin The `pkgs.writeShellScriptBin` is used to put a complete bash script into /nix/store with a correct Shebang for it to work. This one is only for `bash` and provides `#!/usr/bin/env bash` shebang Example: {./pkgs/word-lookup.nix}[Word look up script written in bash] *** writers.writeFishBin `pkgs.writers.writeFishBin "musnow.sh" {}` is a way to write scripts in any language, this example is for `fish` shell, but `writers` can be in many forms, from python and lua to rust. The `{}` is set of options can also hold environmental variables. Example: {./pkgs/musnow.nix}[To look up comment metadata of mpd track] ** Repository ** Nixos-hardware module Searchable hardware nodules with `nix repl` and command: @code nix (builtins.getFlake ''/home/ladas552/Flake-Ocean'').inputs.nixos-hardware.outputs.nixosModules @end ** Wayland + Electron apps Enable these environmental variables if `NIXOS_OZONE_WL = "1";` doesn't work for you. @code sh ELECTRON_LAUNCH_FLAGS = "--ozone-platform-hint=auto --ozone-platform=wayland --enable-webrtc-pipewire-capturer --enable-features=WaylandWindowDecorations"; @end And enable these for `fcitx5` @code sh ELECTRON_LAUNCH_FLAGS = "--enable-wayland-ime --wayland-text-input-version=3 --enable-features=WaylandLinuxDrmSyncobj"; @end ** xdg.mimeApps Better to declare them in both NixOS options and Home-Manager Example is here @code nix xdg = { enable = true; mime.enable = true; mimeApps = { enable = true; associations.added = { "text/plain" = [ "neovim.desktop" ]; "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ]; "image/*" = [ "imv.desktop" ]; "video/*" = [ "mpv.desktop" ]; }; defaultApplications = { "text/plain" = [ "" ]; "application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ]; "image/*" = [ "imv.desktop" ]; "video/*" = [ "mpv.desktop" ]; }; }; }; @end ** Sops and secrets Defined in `modules/secrets`, uses the ssh key from my host to decrypt secrets automatically. Can be used as a file, like `${config.sops.secrets."secret"}` and as a string, with `"$(cat ${config.sops.secrets."secret".path})"` Change secrets with `sops edit`, creating the keys as per documentation on `sops-nix` repository. ** ZFS I use ZFS as a file system, it provides me with snapshots and compression via zstd. You can't install zfs in calimaries, so need to use nixos iso and configure drive with a {:./docs/zfs.norg:}[script], after that it is simple `nixos-install --flake "github:Ladas552/Nixos-Is-Unbreakable#Host` and setting up a root password at the end Zfs is controlled by a {./modules/nixosModules/zfs.nix}[ZFS] module, that also houses my file system config, with a {:./docs/zfs.norg:}[script], they should all be the same, but would need adjustment, namely `/dev/sda` vs `/dev/nvme0n1p` stuff, but thous can be grabbed from Gparted that comes in NixIso *** To import zpool `sudo zpool import -d /dev/nbd0 -R /mnt zroot` ** Impermanence I got [Impermanence]{https://github.com/nix-community/impermanence}, and it uses 2 persist mounts. Persist for actual data that is snapshoted, and cache for stuff that I don't wanna redownload or relogin, but not need a back up of. Right now, only `NixPort` has impermanence enabled, and it doesn't bother other NixConfiguration hosts on the setup. It's tmpfs setup with zfs datasets. ** Passwords - root The root password is setup automatically because the users are immutable - user In NixOS, users are Mutual by default, so you can just `su` to change to root, and `passwd ladas552` to change password of user-Ladas552 when you can't login to the user. * TODOs ** Small tasks - (x) Update nextcloud to 32 then 33 on NixToks - ( ) Fix remote builder for NixWool - ( ) Wrap Bash to use the same programs as fish ** Notes ** Programs - *Xremap* or *Keyd*. The button that I have on Acer, binded to Shift+WinL+A. I need to bind ti to PrintScreen ** Modulations *** Impermanence Add impermanence for NixToks, but I would need to move all the things from /srv, /var/lib/, /home, and I am toooooooo lazy rn *** Terminal options for terminals, like what they support for different programs to navigate easely. For example, @code nix options.customhm.terminal.name = "kitty"; options.customhm.terminal.image = null or sixel or kitty; @end and so on. tho idk how can I pass the home-manager options to my nixos layer, and if I need to tbh **** update 2025-08-04 So, I am switching from foot to ghostty, and really need to get this working sometime. Most of the time, I don't have 2 terminals configured at the same time, so I can just make them options. Also I can make work of `optionalString` To add config based exception for niri. Because `journal` keybind doesn't like `''` in foot, but doesn't work with `""` in ghostty *** Sessions - I want to make wm independent variables for applications. So that I can have For example, 2 configured Launcher applications, but I only want one. Then I just change the variable, and every other module that uses variable `isLauncher` also follows. Basically to have a dozen of WM configs, but if I one day want to switch rofi for dmenu, keybinds would stay the same. *** Colors I am thinking of swithing to hjem fully one day, but stylix isn't hjem compatable. So I devised an idea. generate files using hjem.files or home.file, in the corresponding config directories. And define the base colorscheme in options. So basically `color16 = ${config.custom.pink}`. And the colors are added with different `import ./colors`, a reference to generated files in, for example kitty config. Similar to how Matugen modules works, It generates colors and then you can put them in different files to reference them in your config, it provides runtime based colorscheme solution. Nix Colors solution is how you would make colors stateful. Basically every color is defined in options, so it only changes on rebuilds. My approach will most similarly look like Nix Colors, while taking the different files approach. The only problem I can think of, a lot of manual working involving reading configuration docs. Also some programs may not allow to have imports for colorschemes. So maybe I will just settle with options.