Commit Graph

66 Commits

Author SHA1 Message Date
Jeremy Fleischman
69b2e5e0b2 nixos/fish: programs.fish.generateCompletions fix spaces in filenames
`linux-manual` has this fun filename in it:

```console
$ find -L $(nix-build -A linux-manual) -name 'station table - introduction.9.gz'
/nix/store/q45mzaksp2ll04c363mxpyi252j6anrq-linux-manual-7.1.3/share/man/man9/station table - introduction.9.gz
```

Our `find ... | xargs ...` didn't handle this nicely, and would vomit in the
following way:

`repro.nix`:

```nix
$ cat repro.nix
let
  pkgs = import ./. { };
  nixosConfig = pkgs.nixos (
    { config, pkgs, ... }: {
      system.stateVersion = config.system.nixos.release;

      programs.fish.enable = true;
      programs.fish.generateCompletions = true;

      environment.systemPackages = [ pkgs.linux-manual ];
    }
  );
in
nixosConfig.config.environment.etc."fish/generated_completions".source
```

The crash:

```console
$ nix-build repro.nix
these 2 derivations will be built:
  /nix/store/qs213n0r723w59jdvfz5w87azd3wh405-linux-manual-7.1.3_fish-completions.drv
  /nix/store/1pwps30drz71icj5v4rdiaarmh37xcn8-system_fish-completions.drv
building '/nix/store/qs213n0r723w59jdvfz5w87azd3wh405-linux-manual-7.1.3_fish-completions.drv'...
usage: create_manpage_completions.py [-h] [-c CLEANUP_IN] [-d DIRECTORY] [-k]
                                     [-m] [-p] [-s] [-v {0,1,2}] [-z]
                                     [file_paths ...]
create_manpage_completions.py: error: unrecognized arguments: -introduction.9.gz /nix/store/q45mzaksp2ll04c363mxpyi252j6anrq-linux-manual-7.1.3/share/man/man9/DRBD State macros.9.gz /nix/store/q45mzaksp2ll04c363mxpyi252j6anrq-linux-manual-7.1.3/share/man/man9/DRM Client usage stats.9.gz /nix/store/q45mzaksp2ll04c363mxpyi252j6anrq-linux-manual-7.1.3/share/man/man9/DRM RAS Node Management.9.gz /nix/store/q45mzaksp2ll04c363mxpyi252j6anrq-linux-manual-7.1.3/share/man/man9/DRM_ACCEL_FOPS.9.gz
```

This fix is simple, use the `find -print0 ... | xargs -0 ...` pattern.
2026-07-05 09:38:35 -07:00
r-vdp
1260b0727b nixos/fish: extract completion generator from the fish binary
fish no longer installs share/fish/tools/ and instead embeds the
script in the binary. Extract it via `status get-file` and replace
the patch that stripped the autogenerated header with an inline sed
plus a test that fails the build if the upstream header format
changes.
2026-06-24 17:20:00 +02:00
Matt Moriarity
108d65727e nixos/fish: fix documentation eval error
`config.system.build.manual` being present requires both
`config.documentation.enable` and `config.documentation.nixos.enable` to
be true, so this check needs to match that.
2026-04-29 17:39:44 -06:00
Fernando Rodrigues
0a4a1b6b42 fish: nixos/programs/fish: remove references to __fish_datadir (#509034) 2026-04-28 14:18:30 +00:00
Fernando Rodrigues
46020f9e85 nixos/programs/fish: don't generate completions for configuration.nix(5) (#508401) 2026-04-28 14:13:43 +00:00
Gaute Ravndal
7cb2765180 fish: nixos/programs/fish: remove references to __fish_datadir
__fish_datadir was renamed to __fish_data_dir in fish 3.0b1, see the
release notes in fish-doc(1):

> fish 3.0b1 (released December 11, 2018)
>   ...
> Notable non-backward compatible changes
>   ...
>   • The internal variables __fish_datadir and __fish_sysconfdir are
>     now known as __fish_data_dir and __fish_sysconf_dir respectively.

That this has kept working (?) all the while might possibly be an
indication that this could have been removed a little over seven years
ago.

With the release of fish 4.2.0 the contest of __fish_data_dir is also
no longer used (with the exception of HTML docs, and vendor_*.d), as
the standalone build mode is now enabled by default. Fish refers to
embedded files by prefixing them with "embedded:", see `$ type cd`:
`# Defined in embedded:functions/cd.fish @ line 5`.
2026-04-11 19:51:27 +02:00
Sandro
69ca7f72a6 nixos/programs/fish: set absolute path in babelfishTranslate (#478669) 2026-04-10 16:53:03 +00:00
Gaute Ravndal
4ce11070ff nixos/programs/fish: don't generate completions for configuration.nix(5)
This can be a fairly large bottleneck on slower systems, and as there
obviously are no useful shell completions generated from this man page
it can safely be ignored.
2026-04-09 21:44:48 +02:00
Gaute Ravndal
8a81ac8bdd nixos/programs/fish: enable documentation.man.cache.generateAtRuntime by default 2026-02-19 15:51:44 +01:00
Gaute Ravndal
3fff19ce9c nixos/documentation: rename man.generateCaches to man.cache.enable 2026-02-19 15:16:02 +01:00
diniamo
1b9162d085 nixos/fish: add extraCompletionPackages option 2026-01-20 12:33:04 +01:00
NAHO
a2ed7e8d88 nixos: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --exclude doc/manual/release-notes \
      --type file \
      . \
      nixos \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2026-01-15 16:07:55 +01:00
Gaute Ravndal
40c21b15cd nixos/programs/fish: set absolute path in babelfishTranslate
Babelfish translates `source script.sh` to `argv0 < script.sh | source`,
which is impure, and breaks when babelfish isn't in `systemPackages`.

To fix this, exec babelfish with argv0 set to babelfish from the final
system.
2026-01-10 10:31:35 +01:00
Eman Resu
f14f194f43 nixos/programs/fish: remove unnecessary [] 2025-11-22 13:24:59 -05:00
Eman Resu
38cf8aa5c5 nixos/programs/fish: use inherit instead of with 2025-11-22 13:24:43 -05:00
Eman Resu
9aaf3433ed nixos/programs/fish: add llakala as maintainer 2025-11-22 13:20:27 -05:00
Eman Resu
713857fff6 nixos/programs/fish: cleanup formatting 2025-11-22 13:19:43 -05:00
Eman Resu
deecb455fe nixos/programs/fish: use runCommandLocal consistently 2025-11-22 13:17:51 -05:00
Eman Resu
4fc46a98a0 nixos/fish: prevent fish_indent from reading from config 2025-11-18 14:02:33 -05:00
Fernando Rodrigues
5f3a4babc6 nixos/fish: fix indentation of generated files (#460855) 2025-11-13 00:10:37 +00:00
Eman Resu
6aded38a2e nixos/fish: cleanup some extraneous newlines 2025-11-12 00:56:59 -05:00
Eman Resu
b02a857c1c nixos/fish: fix indentation of generated files 2025-11-12 00:56:54 -05:00
loner
c74faa8b19 nixos/fish: Remove redundant deroff.py script 2025-11-11 02:47:54 +08:00
Elliot
3a751c44e6 nixos/programs/fish: update abbr command 2025-09-22 12:01:38 +08:00
diniamo
ca7d60b6e3 nixos/fish: follow symlinks in completion generation
Wrapping programs is commonly done using `symlinkJoin`, which symlinks the man pages to the derivation that is actually installed. `-type f` by itself simply ignores such symlinks.
2025-06-29 10:46:03 +02:00
Sizhe Zhao
3045cecacf nixos/fish: allow disabling completion generation 2025-06-20 14:12:06 +08:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
nicoo
f6c5531461 nixos: Don't set !allowSubstitutes (#314664)
It is set by `runCommandLocal` and prevents fetching the build output
from `cache.nixos.org` or another trusted substituter.
2024-12-12 18:26:24 +00:00
Fernando Rodrigues
d4f3fe7de3 fish: add sigmasquadron as co-maintainer
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2024-11-23 20:14:05 -03:00
Ivan Trubach
7919709a23 nixos/modules: use mapAttrsToList instead of mapAttrsFlatten 2024-07-19 11:39:39 +03:00
Danielle Lancashire
d0e35cbd3e nixos/fish: Fix more lib references 2024-05-13 01:18:49 +02:00
Danielle Lancashire
f26c2aa2fc nixos/fish: fix reference to mapAttrsFlatten 2024-05-13 00:58:30 +02:00
Acid Bong
49f6869f71 treewide: remove file-wide with lib; in nixos/modules/programs 2024-05-12 10:11:06 +03:00
seth
3056f09554 nixos/fish: add package option 2024-05-07 00:34:38 -04:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
Adam Joseph
bc2d598878 treewide: change pythonForBuild to pythonOnBuildForHost 2023-11-05 17:42:12 -08:00
r-vdp
97e3336a5b fish: use the subcommand style for the status command
The flag style has been deprecated and will eventually be removed.
2023-10-19 08:40:56 +02:00
Artturi
87ee3c4fdf Merge pull request #176886 from hyperfekt/nonderivation_fish-completion 2023-09-23 06:28:23 +03:00
Artturin
ea580ebee8 nixos/fish: Fix completion generator cross-compilation 2023-08-08 23:21:38 +03:00
Yureka
0445837cc7 nixos/fish: fix cross build 2023-07-31 14:10:04 +02:00
figsoda
701bcdbead nixos: fix typos 2023-05-19 22:31:04 -04:00
hyperfekt
3fd98e7fcb nixos/fish: fix completion generation for non-derivation packages
environment.systemPackages can include any package, which means it can
be a top-level store path that is not a derivation and thus will not
have a name attribute - their name is extracted from the path instead.
2023-03-12 21:24:03 +01:00
Lin Jian
fb445b517e nixos/fish: use a local version of runCommand for babelfishTranslate
Building etc."fish/setEnvironment.fish" needs
config.system.build.setEnvironment, which can be very large. And what
babelfishTranslate does is to translate env vars exported by bash
syntax, which does not need much computing power.

This patch can reduce the network traffic when using remote builders
with almost no harm.
2022-11-04 18:35:18 -07:00
pennae
da37ca6760 nixos/programs: invariant option docs MD conversions 2022-07-24 13:01:18 +02:00
figsoda
2f6a9bb297 nixos/programs/fish: add shellAbbrs config 2021-04-14 17:37:14 -07:00
talyz
6230ff7dd8 nixos/fish: Fix foreign-env function path 2021-01-24 13:41:37 +01:00
Kevin Griffin
515d801aee fish: add babelfish translation option
Configuration may be ran through fenv at shell start time
(as previously) or translated to fish at build time with
the babelfish package.
2021-01-22 09:24:40 -08:00
pacien
d94921db12 fish-foreign-env: move to fishPlugins.foreign-env
And relocate the installed fish functions to the `vendor_functions.d` so
that they're automatically loaded.
2021-01-04 18:53:59 +01:00
rnhmjoj
296c415030 nixos/fish: make generateCaches easier to override 2020-12-03 22:00:33 +01:00
rnhmjoj
5b59329234 nixos/fish: enable man cache generation 2020-06-29 22:28:32 +02:00