Remove flake-utils from root flake.nix

This commit is contained in:
Luc Perkins 2023-07-13 17:26:57 -07:00
parent 7e121d224d
commit ba5f6a2fbd
No known key found for this signature in database
GPG key ID: CED8419FB058467A
3 changed files with 60 additions and 90 deletions

View file

@ -1,23 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1689261696, "lastModified": 1689261696,
@ -36,24 +18,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

110
flake.nix
View file

@ -1,13 +1,64 @@
{ {
description = description = "Ready-made templates for easily creating flake-driven environments";
"Ready-made templates for easily creating flake-driven environments";
inputs = { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; outputs = { self, nixpkgs }:
let
overlays = [
(final: prev:
let
exec = pkg: "${prev.${pkg}}/bin/${pkg}";
in
{
format = prev.writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
'';
dvt = prev.writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
TEMPLATE=$1
${exec "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
update = prev.writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${exec "nix"} flake update # Update flake.lock
${exec "nix"} flake check # Make sure things work after the update
)
done
'';
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ format update ];
}; };
});
packages = forEachSupportedSystem ({ pkgs }: rec {
default = dvt;
inherit (pkgs) dvt;
});
}
//
outputs = { self, flake-utils, nixpkgs }:
{ {
templates = rec { templates = rec {
clojure = { clojure = {
@ -153,52 +204,5 @@
# Aliases # Aliases
rt = rust-toolchain; rt = rust-toolchain;
}; };
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell writeScriptBin;
exec = pkg: "${pkgs.${pkg}}/bin/${pkg}";
format = writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
'';
dvt = writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
TEMPLATE=$1
${exec "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
update = writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${exec "nix"} flake update # Update flake.lock
${exec "nix"} flake check # Make sure things work after the update
)
done
'';
in
{
devShells = {
default = mkShell {
packages = [ format update ];
}; };
};
packages = rec {
default = dvt;
inherit dvt;
};
});
} }

View file

@ -11,7 +11,7 @@
outputs = { self, nixpkgs, easy-purescript-nix }: outputs = { self, nixpkgs, easy-purescript-nix }:
let let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; # "aarch64-linux" not supported
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
}); });