1
1
Fork 0
mirror of https://github.com/the-nix-way/dev-templates synced 2024-04-19 07:54:01 +02:00

Add helper scripts via Nix

This commit is contained in:
Luc Perkins 2022-07-29 00:42:22 +02:00
parent 35ae8135a0
commit 127ed335af
No known key found for this signature in database
GPG Key ID: 4F102D0C16E232F2
17 changed files with 164 additions and 96 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake .

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -15,17 +15,19 @@
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isLinux;
otherFormats = with pkgs.haskellPackages; [
dhall-bash
dhall-docs
dhall-json
dhall-lsp-server
dhall-nix
dhall-nixpkgs
dhall-openapi
dhall-toml
dhall-yaml
] ++ optionals isLinux (with pkgs.haskellPackages; [ dhall-csv dhall-haskell dhall-text ]);
otherFormats = with pkgs.haskellPackages;
[
dhall-bash
dhall-docs
dhall-json
dhall-lsp-server
dhall-nix
dhall-nixpkgs
dhall-openapi
dhall-toml
dhall-yaml
] ++ optionals isLinux
(with pkgs.haskellPackages; [ dhall-csv dhall-haskell dhall-text ]);
inherit (pkgs) mkShell;
in {

42
flake.lock Normal file
View 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
View File

@ -2,52 +2,81 @@
description =
"Ready-made templates for easily creating flake-driven environments";
outputs = { self }: {
templates = {
gleam = {
path = ./gleam;
description = "Gleam development environment";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
go_1_17 = {
path = ./go1.17;
description = "Go 1.17 development environment";
};
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 = {
gleam = {
path = ./gleam;
description = "Gleam development environment";
};
go_1_18 = {
path = ./go1.18;
description = "Go 1.18 development environment";
};
go_1_17 = {
path = ./go1.17;
description = "Go 1.17 development environment";
};
java = {
path = ./java;
description = "Java development environment";
};
go_1_18 = {
path = ./go1.18;
description = "Go 1.18 development environment";
};
nix = {
path = ./nix;
description = "Nix development environment";
};
java = {
path = ./java;
description = "Java development environment";
};
node = {
path = ./node;
description = "Node.js development environment";
};
nix = {
path = ./nix;
description = "Nix development environment";
};
rust = {
path = ./rust;
description = "Rust development environment";
};
node = {
path = ./node;
description = "Node.js development environment";
};
scala = {
path = ./scala;
description = "Scala development environment";
};
rust = {
path = ./rust;
description = "Rust development environment";
};
zig = {
path = ./zig;
description = "Zig development environment";
scala = {
path = ./scala;
description = "Scala development environment";
};
zig = {
path = ./zig;
description = "Zig development environment";
};
};
};
};
}

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -1 +1,2 @@
use flake .
use flake .

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -14,18 +14,20 @@
nix = pkgs.nixUnstable;
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;
in {
devShells = {
default = pkgs.mkShell {
buildInputs = [ nix ] ++ helpers;
shellHook = ''
${nix}/bin/nix --version
'';
};
default = pkgs.mkShell { buildInputs = [ nix ] ++ nixRelatedTools; };
};
});
}

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -32,11 +32,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {

View File

@ -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

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659047146,
"narHash": "sha256-2qZemVRDR5oCw0Hd32LQSWC7FaEy5sUp5ih9OxqE3yU=",
"lastModified": 1659047633,
"narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68716026a095a765c09ec29f06ba234a0298418c",
"rev": "496caa738a16d2bb3607243d9127df718bb50513",
"type": "github"
},
"original": {