Skip to content

Commit

Permalink
feat: add nix-index-database
Browse files Browse the repository at this point in the history
  • Loading branch information
Swarsel committed Jul 19, 2024
1 parent 6ea2eb0 commit 193cf57
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 41 deletions.
38 changes: 35 additions & 3 deletions SwarselSystems.org
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ Mind the comma at the end. You need this because the =...= is being passed as th
nixos-hardware,
nix-alien,
nswitch-rcm-nix,
nix-index-database,

#+end_src

Expand All @@ -429,8 +430,11 @@ A short overview over each input and what it does:
Provides specific hardware setting for some hardware configurations. For example, this sets some better defaults for my Lenovo Thinkpad P14s Gen2.
- [[https://github.com/thiagokokada/nix-alien][nix-alien]]
This is supposed to allow me to run unpatched libraries directly without a need for ELF patching or resorting to =steam-run=. However, I have not yet gotten this to work.
- nswitch-rcm-nix
- [[https://github.com/Swarsel/nswitch-rcm-nix][nswitch-rcm-nix]]
Allows auto injection of payloads upon connecting a Nintendo Switch.
- [[https://github.com/nix-community/nix-index-database][nix-index-database]]
This provides a database for =nix-index= that is updated weekly. This allows for declarative management, without needing to run the =nix-index= command for database assembly.


#+begin_src nix :tangle no :noweb-ref flakeinputs

Expand Down Expand Up @@ -499,6 +503,12 @@ A short overview over each input and what it does:
url = "github:Swarsel/nswitch-rcm-nix";
};

# weekly updated nix-index database
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};

#+end_src
*** let
:PROPERTIES:
Expand Down Expand Up @@ -545,6 +555,7 @@ Lastly I define some common module lists that I can simply load depending on the
];
# Home-Manager modules wanted on both NixOS and non-NixOS systems
mixedModules = [ sops-nix.homeManagerModules.sops
nix-index-database.hmModules.nix-index
./profiles/common/home.nix
];

Expand Down Expand Up @@ -5751,13 +5762,34 @@ This section is for programs that require no further configuration. zsh Integrat
yt-dlp.enable = true;
mpv.enable = true;
jq.enable = true;
nix-index.enable = true;
ripgrep.enable = true;
pandoc.enable = true;
fzf.enable = true;
zoxide.enable = true;
};
#+end_src

*** nix-index

nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for =command-not-found.sh=, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output.

#+begin_src nix :tangle profiles/common/home.nix

nix-index = let
command-not-found = pkgs.runCommandLocal "command-not-found.sh" { } ''
mkdir -p $out/etc/profile.d
substitute ${../../scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
--replace @tput@ ${pkgs.ncurses}/bin/tput
'';
in {
enable = true;
package = pkgs.symlinkJoin {
name = "nix-index";
paths = [ command-not-found ];
};
};
};
#+end_src

*** password-store
Expand Down
21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
nswitch-rcm-nix = {
url = "github:Swarsel/nswitch-rcm-nix";
};

# weekly updated nix-index database
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs @ {
Expand All @@ -82,6 +88,7 @@
nixos-hardware,
nix-alien,
nswitch-rcm-nix,
nix-index-database,
...
}: let
system = "x86_64-linux"; # not very portable, but I do not use other architectures at the moment
Expand Down Expand Up @@ -127,6 +134,7 @@
# Home-Manager modules wanted on both NixOS and non-NixOS systems
mixedModules = [
sops-nix.homeManagerModules.sops
nix-index-database.hmModules.nix-index
./profiles/common/home.nix
];
in {
Expand Down
Loading

0 comments on commit 193cf57

Please sign in to comment.