refactor nix flake to be easier to read

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-01-02 12:10:37 -06:00
parent 4d020ff3e2
commit 71d82c875f
2 changed files with 143 additions and 164 deletions

17
flake.lock generated
View file

@ -16,22 +16,6 @@
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1735531152,
"narHash": "sha256-As8I+ebItDKtboWgDXYZSIjGlKeqiLBvjxsQHUmAf1Q=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3ffbbdbac0566a0977da3d2657b89cbcfe9a173b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nvim_plugin-Almo7aya/openingh.nvim": {
"flake": false,
"locked": {
@ -947,7 +931,6 @@
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim",
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim": "nvim_plugin-CopilotC-Nvim/CopilotChat.nvim",
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring",

View file

@ -2,7 +2,7 @@
description = "RingOfStorms's Neovim configuration using nix flake for portability";
# Nixpkgs / NixOS version to use.
inputs = {
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
# nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs.url = "github:nixos/nixpkgs/master";
rust-overlay.url = "github:oxalica/rust-overlay";
@ -140,7 +140,8 @@
{
self,
nixpkgs,
nixpkgs-stable,
# nixpkgs-stable,
rust-overlay,
...
}@inputs:
let
@ -151,28 +152,24 @@
version = "hydrogen";
# ===================
# Utilities
inherit (nixpkgs) lib;
withSystem =
f:
lib.fold lib.recursiveUpdate { } (
map f [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
]
);
# Define the systems to support (all Linux systems exposed by nixpkgs)
systems = lib.intersectLists lib.systems.flakeExposed lib.platforms.linux;
forAllSystems = lib.genAttrs systems;
# Create a mapping from system to corresponding nixpkgs : https://nixos.wiki/wiki/Overlays#In_a_Nix_flake
nixpkgsFor = forAllSystems (system: (nixpkgs.legacyPackages.${system}.extend rustOverlay));
# =========
rustOverlay = import rust-overlay;
in
withSystem (
{
packages = forAllSystems (
system:
let
# pkgs = nixpkgs.legacyPackages.${system};
overlays = [ (import inputs.rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
stable_pkgs = import nixpkgs-stable { inherit system overlays; };
pkgs = nixpkgsFor.${system};
lazyPath = inputs."nvim_plugin-folke/lazy.nvim";
nixPkgsPlugins = with stable_pkgs.vimPlugins; {
nixPkgsPlugins = with pkgs.vimPlugins; {
"nvim_plugin-nvim-treesitter/nvim-treesitter" = nvim-treesitter.withAllGrammars;
};
@ -283,9 +280,9 @@
];
})
];
in
{
packages.${system} = {
default = self.packages.${system}.neovim;
neovim =
(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
@ -294,7 +291,7 @@
customRC = ''
lua ${luaNixGlobal}
luafile ${./.}/init.lua
set runtimepath^=${builtins.concatStringsSep "," (builtins.attrValues stable_pkgs.vimPlugins.nvim-treesitter.grammarPlugins)}
set runtimepath^=${builtins.concatStringsSep "," (builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins)}
'';
}
)).overrideAttrs
@ -378,8 +375,8 @@
"ALL_PROXY"
];
});
};
}
);
nixosModules = {
default =
{
@ -392,6 +389,5 @@
];
};
};
}
);
};
}