mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
replace nixpkgs-fmt with nixfmt-rfc-style
This commit is contained in:
parent
a51bd670d6
commit
5f8bbf7681
10 changed files with 127 additions and 89 deletions
13
default.nix
13
default.nix
|
|
@ -1,4 +1,10 @@
|
||||||
{ resholve, lib, coreutils, direnv, nix }:
|
{
|
||||||
|
resholve,
|
||||||
|
lib,
|
||||||
|
coreutils,
|
||||||
|
direnv,
|
||||||
|
nix,
|
||||||
|
}:
|
||||||
|
|
||||||
# resholve does not yet support `finalAttrs` call pattern hence `rec`
|
# resholve does not yet support `finalAttrs` call pattern hence `rec`
|
||||||
# https://github.com/abathur/resholve/issues/107
|
# https://github.com/abathur/resholve/issues/107
|
||||||
|
|
@ -24,7 +30,10 @@ resholve.mkDerivation rec {
|
||||||
default = {
|
default = {
|
||||||
scripts = [ "share/${pname}/direnvrc" ];
|
scripts = [ "share/${pname}/direnvrc" ];
|
||||||
interpreter = "none";
|
interpreter = "none";
|
||||||
inputs = [ coreutils nix ];
|
inputs = [
|
||||||
|
coreutils
|
||||||
|
nix
|
||||||
|
];
|
||||||
fake = {
|
fake = {
|
||||||
builtin = [
|
builtin = [
|
||||||
"PATH_add"
|
"PATH_add"
|
||||||
|
|
|
||||||
41
flake.nix
41
flake.nix
|
|
@ -2,7 +2,9 @@
|
||||||
description = "A faster, persistent implementation of `direnv`'s `use_nix`, to replace the built-in one.";
|
description = "A faster, persistent implementation of `direnv`'s `use_nix`, to replace the built-in one.";
|
||||||
|
|
||||||
nixConfig.extra-substituters = [ "https://cache.thalheim.io" ];
|
nixConfig.extra-substituters = [ "https://cache.thalheim.io" ];
|
||||||
nixConfig.extra-trusted-public-keys = [ "cache.thalheim.io-1:R7msbosLEZKrxk/lKxf9BTjOOH7Ax3H0Qj0/6wiHOgc=" ];
|
nixConfig.extra-trusted-public-keys = [
|
||||||
|
"cache.thalheim.io-1:R7msbosLEZKrxk/lKxf9BTjOOH7Ax3H0Qj0/6wiHOgc="
|
||||||
|
];
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
@ -16,9 +18,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ { flake-parts, ... }:
|
outputs =
|
||||||
flake-parts.lib.mkFlake { inherit inputs; }
|
inputs@{ flake-parts, ... }:
|
||||||
({ lib, ... }: {
|
flake-parts.lib.mkFlake { inherit inputs; } (
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./treefmt.nix
|
./treefmt.nix
|
||||||
./pkgs/bash4/flake-module.nix
|
./pkgs/bash4/flake-module.nix
|
||||||
|
|
@ -30,20 +34,26 @@
|
||||||
"x86_64-darwin"
|
"x86_64-darwin"
|
||||||
"aarch64-darwin"
|
"aarch64-darwin"
|
||||||
];
|
];
|
||||||
perSystem = { config, pkgs, self', ... }: {
|
perSystem =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
self',
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
packages = {
|
packages = {
|
||||||
nix-direnv = pkgs.callPackage ./default.nix { };
|
nix-direnv = pkgs.callPackage ./default.nix { };
|
||||||
default = config.packages.nix-direnv;
|
default = config.packages.nix-direnv;
|
||||||
test-runner-stable = pkgs.callPackage ./test-runner.nix {
|
test-runner-stable = pkgs.callPackage ./test-runner.nix { nixVersion = "stable"; };
|
||||||
nixVersion = "stable";
|
test-runner-latest = pkgs.callPackage ./test-runner.nix { nixVersion = "latest"; };
|
||||||
};
|
|
||||||
test-runner-latest = pkgs.callPackage ./test-runner.nix {
|
|
||||||
nixVersion = "latest";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.callPackage ./shell.nix {
|
devShells.default = pkgs.callPackage ./shell.nix {
|
||||||
packages = [ config.treefmt.build.wrapper pkgs.shellcheck ];
|
packages = [
|
||||||
|
config.treefmt.build.wrapper
|
||||||
|
pkgs.shellcheck
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
checks =
|
checks =
|
||||||
|
|
@ -54,13 +64,12 @@
|
||||||
packages // devShells;
|
packages // devShells;
|
||||||
};
|
};
|
||||||
flake = {
|
flake = {
|
||||||
overlays.default = final: _prev: {
|
overlays.default = final: _prev: { nix-direnv = final.callPackage ./default.nix { }; };
|
||||||
nix-direnv = final.callPackage ./default.nix { };
|
|
||||||
};
|
|
||||||
templates.default = {
|
templates.default = {
|
||||||
path = ./templates/flake;
|
path = ./templates/flake;
|
||||||
description = "nix flake new -t github:Mic92/nix-direnv .";
|
description = "nix flake new -t github:Mic92/nix-direnv .";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,11 @@ bash.overrideAttrs (_old: {
|
||||||
};
|
};
|
||||||
|
|
||||||
# generated with update-patch-set.sh from nixpkgs/pkgs/shells/bash
|
# generated with update-patch-set.sh from nixpkgs/pkgs/shells/bash
|
||||||
patches = import ./bash-4.4-patches.nix (nr: sha256: fetchurl {
|
patches = import ./bash-4.4-patches.nix (
|
||||||
|
nr: sha256:
|
||||||
|
fetchurl {
|
||||||
url = "mirror://gnu/bash/bash-4.4-patches/bash44-${nr}";
|
url = "mirror://gnu/bash/bash-4.4-patches/bash44-${nr}";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
{ self, withSystem, ... }: {
|
{ self, withSystem, ... }:
|
||||||
flake.packages.x86_64-linux = withSystem "x86_64-linux"
|
{
|
||||||
({ pkgs, ... }: {
|
flake.packages.x86_64-linux = withSystem "x86_64-linux" (
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
bash4 = pkgs.callPackage ./. { };
|
bash4 = pkgs.callPackage ./. { };
|
||||||
direnv-bash4 = pkgs.direnv.override {
|
direnv-bash4 = pkgs.direnv.override { bash = self.packages.x86_64-linux.bash4; };
|
||||||
bash = self.packages.x86_64-linux.bash4;
|
|
||||||
};
|
|
||||||
test-runner-bash4 = pkgs.callPackage ../../test-runner.nix {
|
test-runner-bash4 = pkgs.callPackage ../../test-runner.nix {
|
||||||
nixVersion = "stable";
|
nixVersion = "stable";
|
||||||
direnv = self.packages.x86_64-linux.direnv-bash4;
|
direnv = self.packages.x86_64-linux.direnv-bash4;
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
{ pkgs ? import <nixpkgs> { }, packages ? [ ] }:
|
{
|
||||||
|
pkgs ? import <nixpkgs> { },
|
||||||
|
packages ? [ ],
|
||||||
|
}:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
mkShell {
|
mkShell {
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,15 @@
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
outputs = { nixpkgs, flake-utils, ... }:
|
outputs =
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
{ nixpkgs, flake-utils, ... }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell { packages = [ pkgs.bashInteractive ]; };
|
||||||
packages = [ pkgs.bashInteractive ];
|
}
|
||||||
};
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,23 @@
|
||||||
{ writeShellScriptBin
|
{
|
||||||
, direnv
|
writeShellScriptBin,
|
||||||
, python3
|
direnv,
|
||||||
, lib
|
python3,
|
||||||
, coreutils
|
lib,
|
||||||
, gnugrep
|
coreutils,
|
||||||
, nixVersions
|
gnugrep,
|
||||||
, nixVersion
|
nixVersions,
|
||||||
|
nixVersion,
|
||||||
}:
|
}:
|
||||||
writeShellScriptBin "test-runner-${nixVersion}" ''
|
writeShellScriptBin "test-runner-${nixVersion}" ''
|
||||||
set -e
|
set -e
|
||||||
export PATH=${lib.makeBinPath [ direnv nixVersions.${nixVersion} coreutils gnugrep ]}
|
export PATH=${
|
||||||
|
lib.makeBinPath [
|
||||||
|
direnv
|
||||||
|
nixVersions.${nixVersion}
|
||||||
|
coreutils
|
||||||
|
gnugrep
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
echo run unittest
|
echo run unittest
|
||||||
${lib.getExe' python3.pkgs.pytest "pytest"} .
|
${lib.getExe' python3.pkgs.pytest "pytest"} .
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,9 @@
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
# deadnix: skip
|
# deadnix: skip
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs =
|
||||||
|
{ nixpkgs, flake-utils, ... }:
|
||||||
flake-utils.lib.eachDefaultSystem (system: {
|
flake-utils.lib.eachDefaultSystem (system: {
|
||||||
devShell = import ./shell.nix {
|
devShell = import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; };
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
{ pkgs ? import (builtins.getFlake (toString ./.)).inputs.nixpkgs { }
|
{
|
||||||
, someArg ? null
|
pkgs ? import (builtins.getFlake (toString ./.)).inputs.nixpkgs { },
|
||||||
, shellHook ? ''
|
someArg ? null,
|
||||||
|
shellHook ? ''
|
||||||
echo "Executing shellHook."
|
echo "Executing shellHook."
|
||||||
''
|
'',
|
||||||
}:
|
}:
|
||||||
pkgs.mkShellNoCC {
|
pkgs.mkShellNoCC {
|
||||||
inherit shellHook;
|
inherit shellHook;
|
||||||
|
|
@ -10,5 +11,7 @@ pkgs.mkShellNoCC {
|
||||||
nativeBuildInputs = [ pkgs.hello ];
|
nativeBuildInputs = [ pkgs.hello ];
|
||||||
SHOULD_BE_SET = someArg;
|
SHOULD_BE_SET = someArg;
|
||||||
|
|
||||||
passthru = { subshell = pkgs.mkShellNoCC { THIS_IS_A_SUBSHELL = "OK"; }; };
|
passthru = {
|
||||||
|
subshell = pkgs.mkShellNoCC { THIS_IS_A_SUBSHELL = "OK"; };
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
treefmt.nix
14
treefmt.nix
|
|
@ -1,9 +1,10 @@
|
||||||
{ inputs, ... }: {
|
{ inputs, ... }:
|
||||||
imports = [
|
{
|
||||||
inputs.treefmt-nix.flakeModule
|
imports = [ inputs.treefmt-nix.flakeModule ];
|
||||||
];
|
|
||||||
|
|
||||||
perSystem = {
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
treefmt = {
|
treefmt = {
|
||||||
# Used to find the project root
|
# Used to find the project root
|
||||||
projectRootFile = ".git/config";
|
projectRootFile = ".git/config";
|
||||||
|
|
@ -14,7 +15,8 @@
|
||||||
mypy.enable = true;
|
mypy.enable = true;
|
||||||
ruff.check = true;
|
ruff.check = true;
|
||||||
ruff.format = true;
|
ruff.format = true;
|
||||||
nixpkgs-fmt.enable = true;
|
nixfmt.enable = true;
|
||||||
|
nixfmt.package = pkgs.nixfmt-rfc-style;
|
||||||
shellcheck.enable = true;
|
shellcheck.enable = true;
|
||||||
shfmt.enable = true;
|
shfmt.enable = true;
|
||||||
statix.enable = true;
|
statix.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue