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,17 +15,19 @@
|
||||||
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-docs
|
dhall-bash
|
||||||
dhall-json
|
dhall-docs
|
||||||
dhall-lsp-server
|
dhall-json
|
||||||
dhall-nix
|
dhall-lsp-server
|
||||||
dhall-nixpkgs
|
dhall-nix
|
||||||
dhall-openapi
|
dhall-nixpkgs
|
||||||
dhall-toml
|
dhall-openapi
|
||||||
dhall-yaml
|
dhall-toml
|
||||||
] ++ optionals isLinux (with pkgs.haskellPackages; [ dhall-csv dhall-haskell dhall-text ]);
|
dhall-yaml
|
||||||
|
] ++ 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
|
||||||
|
}
|
105
flake.nix
105
flake.nix
|
@ -2,52 +2,81 @@
|
||||||
description =
|
description =
|
||||||
"Ready-made templates for easily creating flake-driven environments";
|
"Ready-made templates for easily creating flake-driven environments";
|
||||||
|
|
||||||
outputs = { self }: {
|
inputs = {
|
||||||
templates = {
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||||
gleam = {
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
path = ./gleam;
|
};
|
||||||
description = "Gleam development environment";
|
|
||||||
};
|
|
||||||
|
|
||||||
go_1_17 = {
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
path = ./go1.17;
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
description = "Go 1.17 development environment";
|
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 = {
|
||||||
|
gleam = {
|
||||||
|
path = ./gleam;
|
||||||
|
description = "Gleam development environment";
|
||||||
|
};
|
||||||
|
|
||||||
go_1_18 = {
|
go_1_17 = {
|
||||||
path = ./go1.18;
|
path = ./go1.17;
|
||||||
description = "Go 1.18 development environment";
|
description = "Go 1.17 development environment";
|
||||||
};
|
};
|
||||||
|
|
||||||
java = {
|
go_1_18 = {
|
||||||
path = ./java;
|
path = ./go1.18;
|
||||||
description = "Java development environment";
|
description = "Go 1.18 development environment";
|
||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
java = {
|
||||||
path = ./nix;
|
path = ./java;
|
||||||
description = "Nix development environment";
|
description = "Java development environment";
|
||||||
};
|
};
|
||||||
|
|
||||||
node = {
|
nix = {
|
||||||
path = ./node;
|
path = ./nix;
|
||||||
description = "Node.js development environment";
|
description = "Nix development environment";
|
||||||
};
|
};
|
||||||
|
|
||||||
rust = {
|
node = {
|
||||||
path = ./rust;
|
path = ./node;
|
||||||
description = "Rust development environment";
|
description = "Node.js development environment";
|
||||||
};
|
};
|
||||||
|
|
||||||
scala = {
|
rust = {
|
||||||
path = ./scala;
|
path = ./rust;
|
||||||
description = "Scala development environment";
|
description = "Rust development environment";
|
||||||
};
|
};
|
||||||
|
|
||||||
zig = {
|
scala = {
|
||||||
path = ./zig;
|
path = ./scala;
|
||||||
description = "Zig development environment";
|
description = "Scala development environment";
|
||||||
|
};
|
||||||
|
|
||||||
|
zig = {
|
||||||
|
path = ./zig;
|
||||||
|
description = "Zig development environment";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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