chore(nix): move to flake-parts

dev
LeMarsu 2025-05-03 14:42:41 +02:00
parent 0df7f7399c
commit 14bc2d39de
7 changed files with 81 additions and 76 deletions

6
dev/default.nix Normal file
View File

@ -0,0 +1,6 @@
{
imports = [
./formatter.nix
./shell.nix
];
}

5
dev/formatter.nix Normal file
View File

@ -0,0 +1,5 @@
{
perSystem = {pkgs, ...}: {
formatter = pkgs.alejandra;
};
}

12
dev/shell.nix Normal file
View File

@ -0,0 +1,12 @@
{
perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
alejandra
git-cliff
nil
sumneko-lua-language-server
];
};
};
}

View File

@ -1,5 +1,23 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1739020877,
@ -16,6 +34,21 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1743296961,
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1660438583,
@ -33,44 +66,11 @@
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"utils": "utils",
"yants": "yants"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"yants": {
"inputs": {
"nixpkgs": "nixpkgs_2"

View File

@ -3,35 +3,17 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
yants.url = "github:divnix/yants";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = {
self,
nixpkgs,
utils,
yants,
...
} @ inputs: let
inherit (builtins) readFile replaceStrings;
fu = utils.lib;
versionFile = replaceStrings ["\n"] [""] (readFile ./VERSION);
version =
if self.sourceInfo ? dirtyShortRev
then "${versionFile}-${self.sourceInfo.dirtyShortRev}"
else versionFile;
outputs = {flake-parts, ...} @ inputs: let
in (flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux"];
forSystem = system: let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) nil;
in {
formatter = pkgs.alejandra;
devShells.default = import ./shell.nix {
inherit pkgs;
};
};
in
(fu.eachDefaultSystem forSystem)
// {lib = import ./lib {inherit version yants;};};
imports = [
./dev
./lib
];
});
}

View File

@ -1,9 +1,19 @@
{
version,
yants,
self,
inputs,
...
}: let
types = import ./types.nix {inherit yants;};
inherit (builtins) readFile replaceStrings;
versionFile = replaceStrings ["\n"] [""] (readFile ../VERSION);
version =
if self.sourceInfo ? dirtyShortRev
then "${versionFile}-${self.sourceInfo.dirtyShortRev}"
else versionFile;
types = import ./types.nix {inherit (inputs) yants;};
in {
mkNeovimPkg = import ./mkNeovimPkg.nix {inherit version types;};
mkPluginsFromInputs = import ./mkPluginsFromInputs.nix;
flake.lib = {
mkNeovimPkg = import ./mkNeovimPkg.nix {inherit version types;};
mkPluginsFromInputs = import ./mkPluginsFromInputs.nix;
};
}

View File

@ -1,10 +0,0 @@
{pkgs, ...}:
with pkgs;
mkShell {
buildInputs = [
alejandra
git-cliff
nil
sumneko-lua-language-server
];
}