How to deploy
omuhr opened this issue · 3 comments
I'm new to nixOS and have gotten a flake based setup going. It would be great to be able to declare the ngram data, as atm I just have it downloaded to my home directory.
How would I go about using this flake? The first step would be to input this flake into my system flake, but how would I then deploy the ngram data?
My current setup looks something like this. What would need to be passed to home configurations, and what would I need to do in the home configuration module to actually deploy the data?
{
description = "";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
nixpkgs-unstable.url =
"github:NixOS/nixpkgs/nixos-unstable"; # also see 'unstable-packages' overlay at 'overlays/default.nix"
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
ngrams.url = "github:Janik-Haag/nix-languagetool-ngram/main";
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
...
in {
...
nixosConfigurations = {
<hostname> = lib.nixosSystem {
modules = [ ./hosts/<hostname> ];
specialArgs = { inherit inputs outputs; };
};
};
homeConfigurations = {
<user@hostname> = lib.homeManagerConfiguration {
modules = [ ./home/username/hostname.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
};
};
};
}
Any help or nudge in the right direction would be greatly appreciated.
What would need to be passed to home configurations
you are already doing this by passing inputs as extraSpecialArgs
In my neovim config that I manage with home-manager I have something like:
require'lspconfig'.ltex.setup {
settings = {
ltex = {
language = "en-US",
additionalRules = {
languageModel = "${inputs.ngrams.packages.${pkgs.system}.ngrams-de}/share/languagetool/ngrams
},
},
},
}
the important part here is the ${}
which returns the path to the nix derivation with the ngram data
if you get a error because of not having the inputs argument just added it to the { lib, pkgs, ... }:
line at the start of your file like { lib, pkgs, inputs, ... }
.
If you need more then one language ngrams set you can use symlinkJoin to join them together.
btw you might want to add ngrams.inputs.nixpkgs.follows = "nixpkgs";
to your flake to reduce the amount of different nixpkgs versions in your /nix/store
Thanks a lot for the help 😄
I have yet move my Neovim config into home manager but was able to dump the data into my home folder for now using
home.file.ngrams.source = inputs.ngrams.packages.${pkgs.system}.ngrams-en;