mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 14:31:55 +03:00
chore: use numtide devshell instead of nixpkgs mkShell for dream2nix development shell (#169)
chore: use newer devShells output instead of devShell
This commit is contained in:
parent
7e31c966fb
commit
90b353682e
17
flake.lock
17
flake.lock
@ -37,6 +37,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"devshell": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1653917170,
|
||||||
|
"narHash": "sha256-FyxOnEE/V4PNEcMU62ikY4FfYPo349MOhMM97HS0XEo=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "fc7a3e3adde9bbcab68af6d1e3c6eb738e296a92",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils-pre-commit": {
|
"flake-utils-pre-commit": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1644229661,
|
"lastModified": 1644229661,
|
||||||
@ -174,6 +190,7 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"alejandra": "alejandra",
|
"alejandra": "alejandra",
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
|
"devshell": "devshell",
|
||||||
"flake-utils-pre-commit": "flake-utils-pre-commit",
|
"flake-utils-pre-commit": "flake-utils-pre-commit",
|
||||||
"gomod2nix": "gomod2nix",
|
"gomod2nix": "gomod2nix",
|
||||||
"mach-nix": "mach-nix",
|
"mach-nix": "mach-nix",
|
||||||
|
58
flake.nix
58
flake.nix
@ -5,7 +5,7 @@
|
|||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
### dev dependencies
|
### dev dependencies
|
||||||
alejandra.url = github:kamadorueda/alejandra;
|
alejandra.url = "github:kamadorueda/alejandra";
|
||||||
alejandra.inputs.nixpkgs.follows = "nixpkgs";
|
alejandra.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||||
@ -14,6 +14,11 @@
|
|||||||
flake-utils-pre-commit.url = "github:numtide/flake-utils";
|
flake-utils-pre-commit.url = "github:numtide/flake-utils";
|
||||||
pre-commit-hooks.inputs.flake-utils.follows = "flake-utils-pre-commit";
|
pre-commit-hooks.inputs.flake-utils.follows = "flake-utils-pre-commit";
|
||||||
|
|
||||||
|
devshell = {
|
||||||
|
url = "github:numtide/devshell";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
### framework dependencies
|
### framework dependencies
|
||||||
# required for builder go/gomod2nix
|
# required for builder go/gomod2nix
|
||||||
gomod2nix = {
|
gomod2nix = {
|
||||||
@ -49,6 +54,7 @@
|
|||||||
outputs = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
alejandra,
|
alejandra,
|
||||||
|
devshell,
|
||||||
gomod2nix,
|
gomod2nix,
|
||||||
mach-nix,
|
mach-nix,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
@ -234,22 +240,42 @@
|
|||||||
|
|
||||||
# a dev shell for working on dream2nix
|
# a dev shell for working on dream2nix
|
||||||
# use via 'nix develop . -c $SHELL'
|
# use via 'nix develop . -c $SHELL'
|
||||||
devShell = forAllSystems (system: pkgs:
|
devShells = forAllSystems (system: pkgs: let
|
||||||
pkgs.mkShell {
|
makeDevshell = import "${inp.devshell}/modules" pkgs;
|
||||||
buildInputs =
|
mkShell = config:
|
||||||
(with pkgs; [
|
(makeDevshell {
|
||||||
nix
|
configuration = {
|
||||||
treefmt
|
inherit config;
|
||||||
])
|
imports = [];
|
||||||
++ [
|
};
|
||||||
alejandra.defaultPackage."${system}"
|
})
|
||||||
|
.shell;
|
||||||
|
in rec {
|
||||||
|
default = dream2nix-shell;
|
||||||
|
dream2nix-shell = mkShell {
|
||||||
|
devshell.name = "dream2nix-devshell";
|
||||||
|
|
||||||
|
commands =
|
||||||
|
[
|
||||||
|
{package = pkgs.nix;}
|
||||||
|
{
|
||||||
|
package = pkgs.treefmt;
|
||||||
|
category = "formatting";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
package = alejandra.defaultPackage.${system};
|
||||||
|
category = "formatting";
|
||||||
|
}
|
||||||
]
|
]
|
||||||
# using linux is highly recommended as cntr is amazing for debugging builds
|
# using linux is highly recommended as cntr is amazing for debugging builds
|
||||||
++ lib.optionals pkgs.stdenv.isLinux [pkgs.cntr];
|
++ lib.optional pkgs.stdenv.isLinux {
|
||||||
|
package = pkgs.cntr;
|
||||||
|
category = "debugging";
|
||||||
|
};
|
||||||
|
|
||||||
shellHook =
|
devshell.startup = {
|
||||||
self.checks.${system}.pre-commit-check.shellHook
|
preCommitHooks.text = self.checks.${system}.pre-commit-check.shellHook;
|
||||||
+ ''
|
dream2nixEnv.text = ''
|
||||||
export NIX_PATH=nixpkgs=${nixpkgs}
|
export NIX_PATH=nixpkgs=${nixpkgs}
|
||||||
export d2nExternalDir=${externalDirFor."${system}"}
|
export d2nExternalDir=${externalDirFor."${system}"}
|
||||||
export dream2nixWithExternals=${dream2nixFor."${system}".dream2nixWithExternals}
|
export dream2nixWithExternals=${dream2nixFor."${system}".dream2nixWithExternals}
|
||||||
@ -268,7 +294,9 @@
|
|||||||
echo -e "\nManually execute 'export dream2nixWithExternals={path to your dream2nix checkout}'"
|
echo -e "\nManually execute 'export dream2nixWithExternals={path to your dream2nix checkout}'"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
checks = forAllSystems (system: pkgs: {
|
checks = forAllSystems (system: pkgs: {
|
||||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
|
Loading…
Reference in New Issue
Block a user