flake.nix: modularize (pt 1)

This commit is contained in:
Mihai Fufezan 2023-02-10 19:40:13 +02:00
commit 2f84ce13c4
No known key found for this signature in database
GPG key ID: 5899325F2F120900
4 changed files with 124 additions and 58 deletions

21
flake/apps.nix Normal file
View file

@ -0,0 +1,21 @@
{lib, ...}: {
perSystem = {
system,
config,
...
}: {
apps =
{
nix.program = lib.getExe config.packages.nix;
maximal.program = lib.getExe config.packages.maximal;
default = config.apps.nix;
}
// (
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
then {
tidal.program = lib.getExe config.packages.tidal;
}
else {}
);
};
}

19
flake/legacyPackages.nix Normal file
View file

@ -0,0 +1,19 @@
{inputs, ...}: {
perSystem = {
system,
inputs',
...
}: {
legacyPackages = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.tidalcycles.overlays.default
inputs.self.overlays.default
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
nil = inputs'.nil.packages.default;
})
];
};
};
}

65
flake/packages.nix Normal file
View file

@ -0,0 +1,65 @@
{inputs, ...}: {
# imports = [
# inputs.flake-parts.flakeModules.easyOverlay
# ];
perSystem = {
system,
pkgs,
config,
...
}: let
# inherit (import ../extra.nix inputs) neovimConfiguration mainConfig;
# tidalConfig = {
# config.vim.tidal.enable = true;
# };
# buildPkg = pkgs: modules:
# (neovimConfiguration {
# inherit pkgs modules;
# })
# .neovim;
# nixConfig = mainConfig false;
# maximalConfig = mainConfig true;
in {
# overlayAttrs =
# {
# inherit neovimConfiguration;
# neovim-nix = config.packages.nix;
# neovim-maximal = config.packages.maximal;
# }
# // (
# if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
# then {neovim-tidal = config.packages.tidal;}
# else {}
# );
packages = let
docs = import ../docs {
inherit pkgs;
nmdSrc = inputs.nmd;
};
in
{
# Documentation
docs = docs.manual.html;
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
# nvim configs
# nix = buildPkg pkgs [nixConfig];
# maximal = buildPkg pkgs [maximalConfig];
nix = config.legacyPackages.neovim-nix;
maximal = config.legacyPackages.neovim-maximal;
}
// (
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
# then {tidal = buildPkg pkgs [tidalConfig];}
then {tidal = config.legacyPackages.neovim-tidal;}
else {}
);
};
}