173 lines
9.5 KiB
Org Mode
173 lines
9.5 KiB
Org Mode
:PROPERTIES:
|
|
:roam_refs: https://discourse.nixos.org/t/the-manual-appears-to-depend-on-the-location-of-nixpkgs/19183
|
|
:ID: 20220526T143555.660133
|
|
:END:
|
|
#+title: "The manual appears to depend on the location of Nixpkgs"
|
|
#+filetags: :Archive:
|
|
#+ARCOLOGY_KEY: cce/nix-path
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
|
|
For the last month or so I haven't been able to update [[id:cce/my_nixos_configuration][My NixOS configuration]] because [[id:c75d20e6-8888-4c5a-ac97-5997e2f1c711][nixpkgs]] build would fail. I can build and deploy the system once with an updated =nixpkgs= but future invocations would fail:
|
|
|
|
#+BEGIN_src
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/rename.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/services/x11/desktop-managers/cinnamon.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/system/etc/etc.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/system/etc/etc.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/system/etc/etc.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/system/etc/etc.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/system/etc/etc.nix" />
|
|
[...redacting much of this]
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix" />
|
|
<string value="3y2ymjdad71ilw7rpl71xwsj0pv9js36-nixpkgs/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix" />
|
|
The manual appears to depend on the location of Nixpkgs, which is bad
|
|
since this prevents sharing via the NixOS channel. This is typically
|
|
caused by an option default that refers to a relative path (see above
|
|
for hints about the offending path).
|
|
#+END_src
|
|
|
|
Something about my system's invocation of the subsystems which dynamically generate the OS configuration manpages =man configuration.nix= and co were failing to strip the =nixpkgs= path from the docbooks which were being generated. I could disable the documentation but I *use* the documentation a lot when developing [[id:arroyo/arroyo][Arroyo]], when assembling the [[id:20211120T220054.226284][Wobserver]], when updating my system. I can't simply disable that and rely on "oh just grep the nixpkgs source code or use this webpage someone else hosts"... In fact I'm using it right now to draft this blog post which will then reintegrate in to my system!
|
|
|
|
But I couldn't update *more than once*:
|
|
|
|
- =nix channel --update=
|
|
- =morph deploy # works=
|
|
- =morph deploy # fails=
|
|
- =nix channel --rollback= to known-working nixpkgs+nixos
|
|
- =morph deploy= # still fails!
|
|
- =switch-to-configuration= to the previous build
|
|
- =morph build # works=
|
|
|
|
Frustrating. And no one really has seen anything like this or could tell me much about how to fix it. I spent some time the last few weeks trying to figure out how to build [[id:cce/my_nixos_configuration][My NixOS configuration]] as a [[https://nixos.wiki/wiki/Flakes][nix flake]] since that would make it easier to bisect or narrow down problems without having to do all this =nix-channel= chicanery but [[id:cce/morph][Morph]] cannot deploy a flake right property [[https://github.com/DBCDK/morph/issues/124][right now]] without a shim that someone describes but does not show and so I am resorting to sillier methodologies.
|
|
|
|
* Briefly: =NIX_PATH=
|
|
:PROPERTIES:
|
|
:ID: 20220526T160154.411398
|
|
:END:
|
|
|
|
The [[https://nixos.org/guides/nix-pills/nix-search-paths.html][Nix Pills]] guide talks about =NIX_PATH= in chapter 15.
|
|
=NIX_PATH= is used to resolve things like =import <nixpkgs>= and in the default configuration this points to a few places:
|
|
|
|
- =/home/rrix/.nix-defexpr/channels=
|
|
- =nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos=
|
|
- =nixos-config=/etc/nixos/configuration.nix=
|
|
- =/nix/var/nix/profiles/per-user/root/channels=
|
|
|
|
#+begin_src shell :exports both
|
|
nix-instantiate --eval -E '<nixpkgs>'
|
|
NIX_PATH=/home/rrix/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels nix-instantiate --eval -E '<nixpkgs>'
|
|
NIX_PATH=/home/rrix.nix-defexpr/channels:nixpkgs=/home/rrix/Code/nixpkgs nix-instantiate --eval -E '<nixpkgs>'
|
|
NIX_PATH=nixpkgs=/home/rrix/Code/nixpkgs nix-instantiate --eval -E '<nixpkgs>'
|
|
#+end_src
|
|
|
|
#+results:
|
|
| /home/rrix/Code/nixpkgs |
|
|
| /nix/var/nix/profiles/per-user/root/channels/nixos |
|
|
| /home/rrix/Code/nixpkgs |
|
|
| /home/rrix/Code/nixpkgs |
|
|
|
|
* Overriding my =NIX_PATH= to build with local [[id:c75d20e6-8888-4c5a-ac97-5997e2f1c711][nixpkgs]]
|
|
:PROPERTIES:
|
|
:ID: 20220526T151642.467904
|
|
:END:
|
|
|
|
To bootstrap my system back together I updated my =nixpkgs= checkout to the version listed on [[https://status.nixos.org/][status.nixos.org]] and then [[id:cce/morph][Morph]]'d [[id:cce/morph-meadow-crush][Meadow Crush]], my [[id:6834cb8f-319f-4dd9-bade-2521417f584b][GPD Pocket]], as a [[https://en.wikipedia.org/wiki/Development_mule][development mule]] to validate that it wouldn't have the same issues.
|
|
|
|
#+begin_src
|
|
[nix-shell:~/Code/nixpkgs]$ export NIX_PATH=nixos=/home/rrix/Code/nixpkgs/nixos:nixpkgs=/home/rrix/Code/nixpkgs:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels;
|
|
[nix-shell:~/Code/nixpkgs]$ morph deploy ~/org/cce/nixlib/nixops/laptops.nix switch --on=meadow-crush --passwd
|
|
#+end_src
|
|
|
|
And then I did it again. And then I did it from within [[id:cce/morph-meadow-crush][Meadow Crush]]. The only problems are that a few GUI applications miss =cache.nixos.org= the [[https://nixos.wiki/wiki/Binary_Cache][Binary Cache]], well okay, that's fine at least I'm not running out of date software with bugs fixed upstream.
|
|
|
|
I took the plunge and had Meadow Crush deploy *back* to my [[id:20211030T172526.854851][Framework laptop]], [[id:20211029T115928.954970][Virtuous Cassette]], and *that* worked:
|
|
|
|
#+begin_src
|
|
[nix-shell:~/Code/nixpkgs]$ cat /etc/os-release | grep BUILD_ID
|
|
BUILD_ID="22.05.git.41cc1d5d958"
|
|
#+end_src
|
|
|
|
But I still cannot "simply" update my system channels and deploy! In theory I could spend some time tracking down the differences in the evaluation, but I simply would rather not. In fact, I have wanted to move away from using channels in general so that I could have a declarative pin for my =nixpkgs= version. I could just ... have that. With flakes you don't need to have a =nixpkgs= lying around to bootstrap your system and with this model you still do, though frankly I am not so concerned with that as I use [[id:cce/syncthing][Syncthing]] already to keep this all in a reasonable state of flow.
|
|
|
|
And so what if I just make my single-admin systems use the =nixpkgs= i already have cloned?
|
|
|
|
#+ARROYO_NIXOS_MODULE: nixos/nix-path.nix
|
|
#+ARROYO_SYSTEM_EXCLUDE: droid
|
|
#+AUTO_TANGLE: t
|
|
|
|
#+begin_src nix :tangle ~/arroyo-nix/nixos/nix-path.nix
|
|
{ ... }:
|
|
|
|
{
|
|
nix.nixPath = [
|
|
"nixos=/home/rrix/Code/nixpkgs/nixos"
|
|
"nixpkgs=/home/rrix/Code/nixpkgs"
|
|
"arroyo=/home/rrix/arroyo-nix"
|
|
];
|
|
}
|
|
#+end_src
|
|
|
|
This can and should be set to the local user's [[https://nixos.org/manual/nix/stable/command-ref/nix-env.html#files][=defexpr= file]] as well, which prevents Nix from recreating the channel definitions and modifying =NIX_PATH= to include them:
|
|
|
|
#+begin_src nix :tangle ~/arroyo-nix/defexpr.nix
|
|
{
|
|
nixpkgs = import /home/rrix/Code/nixpkgs {};
|
|
nixos = import /home/rrix/Code/nixpkgs/nixos {};
|
|
}
|
|
#+end_src
|
|
|
|
#+ARROYO_HOME_MODULE: hm/defexpr.nix
|
|
|
|
#+begin_src nix :tangle ~/arroyo-nix/hm/defexpr.nix
|
|
{ config, pkgs, ... }:
|
|
|
|
{
|
|
home.activation.defexpr = pkgs.lib.mkActivationLocalLink config
|
|
"/home/rrix/org/cce/nixlib/defexpr.nix"
|
|
".nix-defexpr";
|
|
}
|
|
#+end_src
|
|
|
|
We'll see how fucked up this is, but now at least I can [[id:20211130T215142.470274][Flood the Arroyo]]. I had to move =~/.nix-defexpr/= away because the =nix-daemon= module which defines this nixPath variable adds a bit to the default system profile without a disablement flag.
|
|
|
|
#+begin_src shell
|
|
if [ -e "$HOME/.nix-defexpr/channels" ]; then
|
|
export NIX_PATH="$HOME/.nix-defexpr/channels${NIX_PATH:+:$NIX_PATH}"
|
|
fi
|
|
#+end_src
|
|
|
|
ehehehehe thanks homie.
|
|
|
|
* Keeping my =nixpkgs= checkout up to date
|
|
:PROPERTIES:
|
|
:ID: 20220526T160150.431487
|
|
:ROAM_ALIASES: cce/update-nixpkgs-checkout
|
|
:END:
|
|
|
|
Updating the Nixpkgs checkout can be by invoking something like =cce/update-nixpkgs-checkout=:
|
|
|
|
#+ARROYO_EMACS_MODULE: nixpkgs
|
|
|
|
#+begin_src emacs-lisp :results none :tangle ~/org/cce/nixpkgs.el
|
|
(use-package plz)
|
|
(defun cce/update-nixpkgs-checkout ()
|
|
(interactive)
|
|
(let ((path "/home/rrix/Code/nixpkgs/"))
|
|
(with-current-buffer (find-file-noselect path)
|
|
(let* ((channel-status (split-string
|
|
(plz 'get "https://channels.nix.gsc.io/nixos-23.11/latest")
|
|
" "))
|
|
(nixpkgs-unstable-ts (string-to-number (second channel-status)))
|
|
(nixpkgs-unstable (first channel-status)))
|
|
(shell-command "git fetch --all")
|
|
;; (magit-fetch-all nil)
|
|
(magit-merge-plain "origin/nixos-23.11")
|
|
(message "updated nixpkgs checkout to %s"
|
|
(format-time-string "%c" nixpkgs-unstable-ts))))))
|
|
(provide 'cce/nixpkgs)
|
|
#+end_src
|
|
|
|
This relies on =plz= pulled in by [[id:cce/ement.el][Ement.el]], and [[id:cce/magit][Magit]]. I'm sure the continuing tarpit of the lovely little local minima I've constructed here will continue to be sustainable.
|
|
|