flake: export raw modules

This commit is contained in:
Pedro Alves 2023-04-21 01:34:40 +01:00
parent a6eec507cc
commit ffe3b6d3d8

View file

@ -10,12 +10,12 @@
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
outputs = { outputs =
self, { self
nixpkgs, , nixpkgs
flake-utils, , flake-utils
pre-commit-hooks, , pre-commit-hooks
... , ...
} @ inputs: } @ inputs:
with nixpkgs.lib; with nixpkgs.lib;
with builtins; let with builtins; let
@ -43,11 +43,13 @@
flakeOutput = flakeOutput =
flake-utils.lib.eachDefaultSystem flake-utils.lib.eachDefaultSystem
(system: let (system:
let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
extractRustAnalyzer = { extractRustAnalyzer =
stdenv, { stdenv
pkgs, , pkgs
,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "extract_rust_analyzer"; pname = "extract_rust_analyzer";
@ -65,7 +67,8 @@
''; '';
}; };
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer { }; extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer { };
in { in
{
checks = checks =
(import ./tests { (import ./tests {
inherit pkgs; inherit pkgs;
@ -97,9 +100,9 @@
}; };
runUpdates = runUpdates =
pkgs.callPackage pkgs.callPackage
({ ({ pkgs
pkgs, , stdenv
stdenv, ,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "run-updates"; pname = "run-updates";
@ -132,15 +135,16 @@
}; };
}; };
}; };
formatter = let formatter =
let
# We need to exclude the plugins/_sources/* files as they are autogenerated # We need to exclude the plugins/_sources/* files as they are autogenerated
# nix formatter only takes a derivation so we need to make a proxy that passes # nix formatter only takes a derivation so we need to make a proxy that passes
# the correct flags # the correct flags
excludeWrapper = { excludeWrapper =
stdenv, { stdenv
alejandra, , alejandra
writeShellScript, , writeShellScript
... , ...
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "alejandra-excludes"; pname = "alejandra-excludes";
@ -148,11 +152,13 @@
dontUnpack = true; dontUnpack = true;
dontBuild = true; dontBuild = true;
installPhase = let installPhase =
let
script = writeShellScript "alejandra-excludes.sh" '' script = writeShellScript "alejandra-excludes.sh" ''
${alejandra}/bin/alejandra --exclude ./plugins/_sources "$@" ${alejandra}/bin/alejandra --exclude ./plugins/_sources "$@"
''; '';
in '' in
''
mkdir -p $out/bin mkdir -p $out/bin
cp ${script} $out/bin/alejandra-excludes cp ${script} $out/bin/alejandra-excludes
''; '';
@ -171,13 +177,16 @@
nixosModules.nixvim = import ./wrappers/nixos.nix modules; nixosModules.nixvim = import ./wrappers/nixos.nix modules;
homeManagerModules.nixvim = import ./wrappers/hm.nix modules; homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules; nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
rawModules.nixvim = modules;
templates = let templates =
let
simple = { simple = {
path = ./templates/simple; path = ./templates/simple;
description = "A simple nix flake template for getting started with nixvim"; description = "A simple nix flake template for getting started with nixvim";
}; };
in { in
{
default = simple; default = simple;
}; };
}; };