mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +00:00
Merge pull request #1025 from NotAShelf/notashelf/push-pknrorvklyzy
meta: add flake-compat & expose flakeless interface
This commit is contained in:
commit
a5a202584f
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": {
|
"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": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
|
@ -73,6 +89,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"mnw": "mnw",
|
"mnw": "mnw",
|
||||||
|
|
43
flake.nix
43
flake.nix
|
@ -5,8 +5,9 @@
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
} @ inputs: let
|
} @ inputs: let
|
||||||
# call the extended library with `inputs`
|
# Call the extended library with `inputs`.
|
||||||
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
|
# 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;};
|
lib = import ./lib/stdlib-extended.nix {inherit inputs self;};
|
||||||
in
|
in
|
||||||
flake-parts.lib.mkFlake {
|
flake-parts.lib.mkFlake {
|
||||||
|
@ -29,6 +30,8 @@
|
||||||
inherit (lib.nvim) neovimConfiguration;
|
inherit (lib.nvim) neovimConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inherit (lib.importJSON ./npins/sources.json) pins;
|
||||||
|
|
||||||
homeManagerModules = {
|
homeManagerModules = {
|
||||||
nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
|
nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
|
||||||
default = self.homeManagerModules.nvf;
|
default = self.homeManagerModules.nvf;
|
||||||
|
@ -50,21 +53,33 @@
|
||||||
''
|
''
|
||||||
self.nixosModules.nvf;
|
self.nixosModules.nvf;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (lib.importJSON ./npins/sources.json) pins;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = {pkgs, ...}: {
|
perSystem = {pkgs, ...}: {
|
||||||
# Provide the default formatter. `nix fmt` in project root
|
# Provides the default formatter for 'nix fmt', which will format the
|
||||||
# will format available files with the correct formatter.
|
# entire tree with Alejandra. The wrapper script is necessary due to
|
||||||
# P.S: Please do not format with nixfmt! It messes with many
|
# changes to the behaviour of Nix, which now encourages wrappers for
|
||||||
# syntax elements and results in unreadable code.
|
# tree-wide formatting.
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.writeShellApplication {
|
||||||
|
name = "nix3-fmt-wrapper";
|
||||||
|
|
||||||
|
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.
|
# Check if codebase is properly formatted.
|
||||||
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||||
# or with `nix flake check`
|
# or with `nix flake check`
|
||||||
checks = {
|
|
||||||
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
||||||
alejandra --check ${self} < /dev/null | tee $out
|
alejandra --check ${self} < /dev/null | tee $out
|
||||||
'';
|
'';
|
||||||
|
@ -72,8 +87,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Flake inputs
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
systems.url = "github:nix-systems/default";
|
||||||
|
|
||||||
## Basic Inputs
|
## Basic Inputs
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
|
@ -87,7 +103,10 @@
|
||||||
inputs.systems.follows = "systems";
|
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
|
# Alternate neovim-wrapper
|
||||||
mnw.url = "github:Gerg-L/mnw";
|
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