Merge branch 'wrapped'

This commit is contained in:
2026-07-03 19:28:21 +01:00
2 changed files with 87 additions and 84 deletions

37
flake.lock generated
View File

@@ -16,9 +16,44 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1780336545,
"narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"wrappers": "wrappers"
}
},
"wrappers": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1782135443,
"narHash": "sha256-vAmbArdCyjqpVW+37aCy/PMBOLIqukUXLQuEKLwUhA4=",
"owner": "BirdeeHub",
"repo": "nix-wrapper-modules",
"rev": "6e7f66fa2cdf4d63162580b438f7fcf87c28a46f",
"type": "github"
},
"original": {
"owner": "BirdeeHub",
"repo": "nix-wrapper-modules",
"type": "github"
}
}
},

View File

@@ -3,13 +3,24 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
wrappers.url = "github:BirdeeHub/nix-wrapper-modules";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux"; # change if needed
pkgs = import nixpkgs { inherit system; };
outputs = {
self,
nixpkgs,
...
} @ inputs: let
# Define the systems you want to support
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
# A helper function to generate outputs for each system
# It imports nixpkgs for the system and passes the resulting 'pkgs' to the function 'f'
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f (import nixpkgs {inherit system;}));
in {
# Use the helper to generate the packages attribute for every system
packages = forAllSystems (
pkgs: let
pkgList = with pkgs; [
# LSPs
lua-language-server
@@ -38,57 +49,14 @@
imagemagick
luarocks
];
nvimRemoteConfig = pkgs.runCommand "nvim-remote-config" { } ''
mkdir -p $out/nvim-remote
cp ${./init.lua} $out/nvim-remote/init.lua
cp -r ${./lua} $out/nvim-remote/lua
'';
mkWrappedNvim =
{
name,
extraWrapArgs ? "",
}:
pkgs.symlinkJoin {
inherit name;
paths = [ pkgs.neovim ];
buildInputs = [ pkgs.makeWrapper ];
meta.mainProgram = "nvim";
postBuild = ''
wrapProgram $out/bin/nvim \
--prefix PATH : ${pkgs.lib.makeBinPath pkgList} \
--set TREE_SITTER_LIB_PATH "${pkgs.tree-sitter}/lib" \
${extraWrapArgs}
'';
};
nvim-wrapped = mkWrappedNvim { name = "nvim"; };
nvim-remote = mkWrappedNvim {
name = "nvim-remote";
extraWrapArgs = ''
--set NVIM_APPNAME "nvim-remote" \
--set XDG_CONFIG_HOME "${nvimRemoteConfig}"
'';
};
in
{
packages.${system} = {
default = nvim-wrapped;
remote = nvim-remote;
};
devShells.${system}.default = pkgs.mkShell {
packages = [
nvim-wrapped
];
shellHook = ''
export TREE_SITTER_LIB_PATH="${pkgs.tree-sitter}/lib"
export DEVSHELL_NAME="󱄅 flake/#89dceb| neovim/green"
'';
};
in {
# Define the default package for this system
default = inputs.wrappers.wrappers.neovim.wrap {
inherit pkgs;
runtimePkgs = pkgList;
settings.config_directory = ./.;
};
}
);
};
}