| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
testRustSimple wouldn’t work with all the rust functions, so let’s
just use it internally and expose the tests via the conventional
`doCheck` attribute instead.
|
|
|
|
|
| |
I think nman is of general interest, so general pointers on setting
it up may be useful for others.
|
|
|
|
|
| |
Should give the user more information about what exactly went wrong in
the event of a store path being garbage.
|
|
|
|
|
|
|
|
|
|
| |
Instead of generating n hypothetical filenames for the man page we
search for and checking if one of them exists, we now iterate through
the files in the man dir we are checking and match each of them against
our desired man page and section.
I feel like this makes the code more cumbersome, but on the upside it is
now more unit-testable.
|
| |
|
|
|
|
|
|
|
| |
This is parsing and rendering of stuff currently mostly, since our main
logic is relatively interwoven with IO stuff (to avoid copying stuff a
lot). This is fine however as the application logic is tested using the
nixos vm test we also have!
|
| |
|
|
|
|
| |
Now shortest is listed first.
|
|
|
|
|
|
|
|
|
| |
This relieves us of the burden to print the error message and lets the
user see what's going on, for example why they have to wait for years
when running `nman duplicity` (we have to fetch all transitive python
dependencies). We also print the exit status in case of errors and
the signal that killed a process (in the case of SIGKILL, SIGSEGV and
maybe more?).
|
| |
|
|
|
|
|
|
|
| |
In the Profpatsch universe, execline reigns surpreme. Therefore we must
bow to its (understandable) rejection of POSIX and use 100 as the user
error instead of the 64 of sysexits.h. This makes a lot of sense, as we
are already using execline conventions for the other exit codes.
|
|
|
|
|
|
|
|
| |
We want to discourage scripting with nman, as we may want to tweak the
user interface or internal behavior of nman in the future without
maintaining backwards compatibilty.
In other words: You have been warned.
|
| |
|
|
|
|
| |
(as suggested by Profpatsch)
|
| |
|
|
|
|
|
| |
Just copy path instead of having a harder to maintain reset mechanism.
Copying strings is not really a performance concern in this case.
|
|
|
|
|
|
|
| |
We reuse std::io::Error's Display trait to print precisely the error
that occurred to the user as well. This will probably help a lot if an
IO error should ever occurr, as they will only ever occurr in very weird
situations (mktemp(3) failed or share/man is not a readable directory).
|
| |
|
|
|
|
| |
Proof-reading would be very welcome!
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes share/man contains directories that are not of the form
man<section> which we are checking in build_man_page. However, this
check can't deal with directories that are shorter than 3 characters due
to the use of split_at() which panics if the index is out of range (for
somer reason…).
In nixpkgs it is relatively common to have directories like "de" in
share/man.
This has been resolved.
|
|
|
|
|
|
|
|
|
| |
The path field wasn't used in DrvWithOutput as we only ever needed
rendered. rendered however is a bit of a confusing name as it is not in
fact fully rendered in all cases. Since we can pass rendered to
nix-store --realise without preprocessing in all cases we rename it to
path and add a note in the documentation. The old path field is removed
for this without replacement.
|
|
|
|
|
| |
* parse_drv_output → DrvOutput::parse
* parse_drv_path → DrvWithOutput::parse
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we would always assume section 1 was requested if no section
was given on the command line. Now the section is treated as if it was
unknown and we search for a matching man page by looking through the sub
directories of $output/share/man.
This means the following invokation works as expected:
nman libunwind unw_getcontext
instead of requiring
nman libunwind 3 unw_getcontext
|
|
|
|
|
| |
temp is essentially the old TempDir code from nman, but using libc's
mkdtemp(3) directly instead of mktemp(1) and a slightly better API.
|
|
|
|
|
| |
Most notably stderr produced by nix-instantiate and nix-store will now
be printed on an error.
|
| |
|
|
|
|
| |
Should save on copying a bit.
|
| |
|
|
|
|
|
|
|
|
| |
man pages are usually pretty small and therefore often also included in
out whereas doc seems to seldomly contain any man pages.
TODO: confirm this and get a better overview over man pages in doc
outputs
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nix-instantiate unfortunately prints the plain .drv path for <attr>.out
wheras it prints <name>.drv!<output> for all non-default outputs. If we
realise the plain .drv path, _all_ outputs are realised which is not
desireable since we may not need extra store path being created by this,
e. g. for a derivation with outputs = [ "out" "lib" "dev" ] we only need
to realise "out" if the man pages are located in there, saving a bit of
time and disk space.
We implement this better behavior by adding the render function to
DrvWithOutput which converts a DrvWithOutput (at the cost of copying) to
an OsString. If the output is out, "!out" is appended to the path
meaning nix-store will only realise the default output.
|
| |
|
|
|
|
|
|
| |
* make exit code determination nicer syntactically by using an impl
* add .msg() function which returns an appropriate error message for
every error type.
|
|
|
|
|
|
|
|
|
|
| |
Unfortunately, nix-instantiate prints only the drv path for the `out`
output which causes nix-store to realise all drv outputs. This of course
breaks build_man_page since it expects the output to be just one path.
We fix this (for now) by using split(). Ideally we would use
<drv_path>!out for realising the default output which only builds the
output we need. However this is a bit annoying to solve since it means
we have to allocate a bit of memory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a complete and user interface compatible rewrite of nman.go in
Rust which aleviates a few flaws of the previous implementation:
* Garbage collector roots for both the derivation and the build outputs
are created in a temporary directory which is cleaned afterwards. This
prevents a race condition between nman and nix-store --gc and doesn't
pollute the user's working directory.
* Instead of building just one build output, nman now checks every
output for the requested man page which fixes nman for derivations
which have their man pages split between multiple outputs, e. g. man
and devman.
Future work:
* Improve error messages reported to the user
* Man page
* Implement man page search heuristics if no section is specified:
Instead of falling back to section 1, all sections should be checked
for the desired page (in an ascending order?)
|
|
|
|
|
|
| |
This reverts commit 5bd756eaf27882820cb59e0ecf9c305f08b3b3e3.
Committed more than I meant to.
|
|
|
|
|
|
| |
sway needs opengl driver's to be enabled and loadable in order to start.
I previously didn't notice this oversight as I still had them loaded and
did not reboot after the rebuild.
|
|
|
|
| |
Before, nman had a habit of leaving result* links lying around.
|
|
|
|
|
|
|
| |
`runCommandLocal` was added to nixpkgs in
https://github.com/NixOS/nixpkgs/pull/74642
to speed up trivial `runCommand` derivations by always building them
locally. We have a few places where that’s good to use.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Apart from using the go compiler, switch from `nix-shell -p`, which only worked
in certain cases, to a `nix-build` with fallback for `man` and default outputs.
Thanks to @muesli for the golang intro.
|
|
|