refactor nix flake to be easier to read
This commit is contained in:
parent
4d020ff3e2
commit
71d82c875f
2 changed files with 143 additions and 164 deletions
17
flake.lock
generated
17
flake.lock
generated
|
@ -16,22 +16,6 @@
|
||||||
"type": "github"
|
"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": {
|
"nvim_plugin-Almo7aya/openingh.nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -947,7 +931,6 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
|
||||||
"nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim",
|
"nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim",
|
||||||
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim": "nvim_plugin-CopilotC-Nvim/CopilotChat.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",
|
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring",
|
||||||
|
|
46
flake.nix
46
flake.nix
|
@ -2,7 +2,7 @@
|
||||||
description = "RingOfStorms's Neovim configuration using nix flake for portability";
|
description = "RingOfStorms's Neovim configuration using nix flake for portability";
|
||||||
# Nixpkgs / NixOS version to use.
|
# Nixpkgs / NixOS version to use.
|
||||||
inputs = {
|
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";
|
nixpkgs.url = "github:nixos/nixpkgs/master";
|
||||||
|
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
|
@ -140,7 +140,8 @@
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-stable,
|
# nixpkgs-stable,
|
||||||
|
rust-overlay,
|
||||||
...
|
...
|
||||||
}@inputs:
|
}@inputs:
|
||||||
let
|
let
|
||||||
|
@ -151,28 +152,24 @@
|
||||||
version = "hydrogen";
|
version = "hydrogen";
|
||||||
# ===================
|
# ===================
|
||||||
|
|
||||||
|
# Utilities
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
withSystem =
|
# Define the systems to support (all Linux systems exposed by nixpkgs)
|
||||||
f:
|
systems = lib.intersectLists lib.systems.flakeExposed lib.platforms.linux;
|
||||||
lib.fold lib.recursiveUpdate { } (
|
forAllSystems = lib.genAttrs systems;
|
||||||
map f [
|
# Create a mapping from system to corresponding nixpkgs : https://nixos.wiki/wiki/Overlays#In_a_Nix_flake
|
||||||
"x86_64-linux"
|
nixpkgsFor = forAllSystems (system: (nixpkgs.legacyPackages.${system}.extend rustOverlay));
|
||||||
"x86_64-darwin"
|
|
||||||
"aarch64-linux"
|
# =========
|
||||||
"aarch64-darwin"
|
rustOverlay = import rust-overlay;
|
||||||
]
|
|
||||||
);
|
|
||||||
in
|
in
|
||||||
withSystem (
|
{
|
||||||
|
packages = forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
# pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
overlays = [ (import inputs.rust-overlay) ];
|
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
|
||||||
stable_pkgs = import nixpkgs-stable { inherit system overlays; };
|
|
||||||
|
|
||||||
lazyPath = inputs."nvim_plugin-folke/lazy.nvim";
|
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;
|
"nvim_plugin-nvim-treesitter/nvim-treesitter" = nvim-treesitter.withAllGrammars;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -283,9 +280,9 @@
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.${system} = {
|
|
||||||
default = self.packages.${system}.neovim;
|
default = self.packages.${system}.neovim;
|
||||||
neovim =
|
neovim =
|
||||||
(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
|
(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
|
||||||
|
@ -294,7 +291,7 @@
|
||||||
customRC = ''
|
customRC = ''
|
||||||
lua ${luaNixGlobal}
|
lua ${luaNixGlobal}
|
||||||
luafile ${./.}/init.lua
|
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
|
)).overrideAttrs
|
||||||
|
@ -378,8 +375,8 @@
|
||||||
"ALL_PROXY"
|
"ALL_PROXY"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
);
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
default =
|
default =
|
||||||
{
|
{
|
||||||
|
@ -392,6 +389,5 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue