Add helper scripts via Nix
This commit is contained in:
parent
35ae8135a0
commit
127ed335af
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
inherit (pkgs.lib) optionals;
|
inherit (pkgs.lib) optionals;
|
||||||
inherit (pkgs.stdenv) isLinux;
|
inherit (pkgs.stdenv) isLinux;
|
||||||
|
|
||||||
otherFormats = with pkgs.haskellPackages; [
|
otherFormats = with pkgs.haskellPackages;
|
||||||
|
[
|
||||||
dhall-bash
|
dhall-bash
|
||||||
dhall-docs
|
dhall-docs
|
||||||
dhall-json
|
dhall-json
|
||||||
|
@ -25,7 +26,8 @@
|
||||||
dhall-openapi
|
dhall-openapi
|
||||||
dhall-toml
|
dhall-toml
|
||||||
dhall-yaml
|
dhall-yaml
|
||||||
] ++ optionals isLinux (with pkgs.haskellPackages; [ dhall-csv dhall-haskell dhall-text ]);
|
] ++ optionals isLinux
|
||||||
|
(with pkgs.haskellPackages; [ dhall-csv dhall-haskell dhall-text ]);
|
||||||
|
|
||||||
inherit (pkgs) mkShell;
|
inherit (pkgs) mkShell;
|
||||||
in {
|
in {
|
||||||
|
|
42
flake.lock
Normal file
42
flake.lock
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1656928814,
|
||||||
|
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659047146,
|
||||||
|
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
31
flake.nix
31
flake.nix
|
@ -2,7 +2,36 @@
|
||||||
description =
|
description =
|
||||||
"Ready-made templates for easily creating flake-driven environments";
|
"Ready-made templates for easily creating flake-driven environments";
|
||||||
|
|
||||||
outputs = { self }: {
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
inherit (pkgs) mkShell;
|
||||||
|
format = pkgs.writeScriptBin "format" ''
|
||||||
|
${pkgs.nixfmt}/bin/nixfmt **/*.nix
|
||||||
|
'';
|
||||||
|
update = pkgs.writeScriptBin "update" ''
|
||||||
|
for dir in `ls -d */`; do # Iterate through all the templates
|
||||||
|
(
|
||||||
|
cd $dir
|
||||||
|
${pkgs.nix}/bin/nix flake update # Update flake.lock
|
||||||
|
${pkgs.direnv}/bin/direnv reload # Make sure things work after the update
|
||||||
|
)
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
devShells = {
|
||||||
|
default = mkShell {
|
||||||
|
buildInputs = with pkgs; [ format update ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
) // {
|
||||||
templates = {
|
templates = {
|
||||||
gleam = {
|
gleam = {
|
||||||
path = ./gleam;
|
path = ./gleam;
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
use flake .
|
use flake .
|
||||||
|
use flake .
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -14,18 +14,20 @@
|
||||||
nix = pkgs.nixUnstable;
|
nix = pkgs.nixUnstable;
|
||||||
dhallNix = pkgs.haskellPackages.dhall-nix;
|
dhallNix = pkgs.haskellPackages.dhall-nix;
|
||||||
|
|
||||||
helpers = with pkgs; [ cachix dhallNix lorri niv nixfmt nixpkgs-fmt statix ];
|
nixRelatedTools = with pkgs; [
|
||||||
|
cachix
|
||||||
|
dhallNix
|
||||||
|
lorri
|
||||||
|
niv
|
||||||
|
nixfmt
|
||||||
|
nixpkgs-fmt
|
||||||
|
statix
|
||||||
|
];
|
||||||
|
|
||||||
inherit (pkgs) mkShell;
|
inherit (pkgs) mkShell;
|
||||||
in {
|
in {
|
||||||
devShells = {
|
devShells = {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell { buildInputs = [ nix ] ++ nixRelatedTools; };
|
||||||
buildInputs = [ nix ] ++ helpers;
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
${nix}/bin/nix --version
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
for dir in `ls -d */`; do # Iterate through all the templates
|
|
||||||
(
|
|
||||||
cd $dir
|
|
||||||
nix flake update # Update flake.lock
|
|
||||||
direnv reload # Make sure things work after the update
|
|
||||||
)
|
|
||||||
done
|
|
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659047146,
|
"lastModified": 1659047633,
|
||||||
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
|
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
|
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
Loading…
Reference in a new issue