mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +00:00
meta: add flake-compat & expose flakeless interface
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a6964afc8b84fe10106f0a90d4bf3acaeee85
This commit is contained in:
parent
0c9b4d0d80
commit
c1fea30214
4 changed files with 72 additions and 14 deletions
15
default.nix
Normal file
15
default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
(import (
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
inherit (lock.nodes.flake-compat.locked) url rev narHash;
|
||||
in
|
||||
builtins.fetchTarball {
|
||||
url = "${url}/archive/${rev}.tar.gz";
|
||||
sha256 = narHash;
|
||||
}
|
||||
) {
|
||||
src = ./.;
|
||||
copySourceTreeToStore = false;
|
||||
useBuiltinsFetchTree = true;
|
||||
})
|
||||
.defaultNix
|
17
flake.lock
generated
17
flake.lock
generated
|
@ -1,5 +1,21 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1751685974,
|
||||
"narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1",
|
||||
"revCount": 92,
|
||||
"type": "git",
|
||||
"url": "https://git.lix.systems/lix-project/flake-compat.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.lix.systems/lix-project/flake-compat.git"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
|
@ -73,6 +89,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils",
|
||||
"mnw": "mnw",
|
||||
|
|
47
flake.nix
47
flake.nix
|
@ -5,8 +5,9 @@
|
|||
self,
|
||||
...
|
||||
} @ inputs: let
|
||||
# call the extended library with `inputs`
|
||||
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
|
||||
# Call the extended library with `inputs`.
|
||||
# inputs is used to get the original standard library, and to pass inputs
|
||||
# to the plugin autodiscovery function
|
||||
lib = import ./lib/stdlib-extended.nix {inherit inputs self;};
|
||||
in
|
||||
flake-parts.lib.mkFlake {
|
||||
|
@ -29,6 +30,8 @@
|
|||
inherit (lib.nvim) neovimConfiguration;
|
||||
};
|
||||
|
||||
inherit (lib.importJSON ./npins/sources.json) pins;
|
||||
|
||||
homeManagerModules = {
|
||||
nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
|
||||
default = self.homeManagerModules.nvf;
|
||||
|
@ -50,21 +53,33 @@
|
|||
''
|
||||
self.nixosModules.nvf;
|
||||
};
|
||||
|
||||
inherit (lib.importJSON ./npins/sources.json) pins;
|
||||
};
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
# Provide the default formatter. `nix fmt` in project root
|
||||
# will format available files with the correct formatter.
|
||||
# P.S: Please do not format with nixfmt! It messes with many
|
||||
# syntax elements and results in unreadable code.
|
||||
formatter = pkgs.alejandra;
|
||||
# Provides the default formatter for 'nix fmt', which will format the
|
||||
# entire tree with Alejandra. The wrapper script is necessary due to
|
||||
# changes to the behaviour of Nix, which now encourages wrappers for
|
||||
# tree-wide formatting.
|
||||
formatter = pkgs.writeShellApplication {
|
||||
name = "nix3-fmt-wrapper";
|
||||
|
||||
# Check if codebase is properly formatted.
|
||||
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||
# or with `nix flake check`
|
||||
runtimeInputs = [
|
||||
pkgs.alejandra
|
||||
pkgs.fd
|
||||
];
|
||||
|
||||
text = ''
|
||||
# Find Nix files in the tree and format them with Alejandra
|
||||
fd "$@" -t f -e nix -x alejandra -q '{}'
|
||||
'';
|
||||
};
|
||||
|
||||
# Provides checks to be built an ran on 'nix flake check'. They can also
|
||||
# be built individually with 'nix build' as described below.
|
||||
checks = {
|
||||
# Check if codebase is properly formatted.
|
||||
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||
# or with `nix flake check`
|
||||
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
||||
alejandra --check ${self} < /dev/null | tee $out
|
||||
'';
|
||||
|
@ -72,8 +87,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
# Flake inputs
|
||||
inputs = {
|
||||
systems.url = "github:nix-systems/default";
|
||||
|
||||
## Basic Inputs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
|
@ -87,7 +103,10 @@
|
|||
inputs.systems.follows = "systems";
|
||||
};
|
||||
|
||||
systems.url = "github:nix-systems/default";
|
||||
flake-compat = {
|
||||
url = "git+https://git.lix.systems/lix-project/flake-compat.git";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Alternate neovim-wrapper
|
||||
mnw.url = "github:Gerg-L/mnw";
|
||||
|
|
7
shell.nix
Normal file
7
shell.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Make the behaviour of `nix-shell` consistent with the one of `nix develop`
|
||||
# by returning the default devShell output from the flake. This is useful when
|
||||
# I do not want to work with direnv, or simply need backwards compatibility.
|
||||
{system ? builtins.currentSystem}: let
|
||||
nvf = import ./.;
|
||||
in
|
||||
nvf.devShells.${system}.default
|
Loading…
Add table
Add a link
Reference in a new issue