From 055d5ea7847679afae9c6e677f512c214464b258 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Fri, 29 Jul 2022 00:07:43 +0200 Subject: [PATCH] Add Nix env --- README.md | 3 +++ gleam/flake.lock | 6 +++--- go1.17/flake.lock | 6 +++--- go1.18/flake.lock | 6 +++--- java/flake.lock | 6 +++--- nix/.envrc | 1 + nix/flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ nix/flake.nix | 31 +++++++++++++++++++++++++++++++ node/flake.lock | 6 +++--- rust/flake.lock | 6 +++--- scala/flake.lock | 6 +++--- zig/flake.lock | 6 +++--- 12 files changed, 101 insertions(+), 24 deletions(-) create mode 100644 nix/.envrc create mode 100644 nix/flake.lock create mode 100644 nix/flake.nix diff --git a/README.md b/README.md index e86db2b..daa682e 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ nix flake init --template github:the-nix-way/dev-templates#go_1_18 # Java nix flake init --template github:the-nix-way/dev-templates#java +# Nix +nix flake init --template github:the-nix-way/dev-templates#nix + # Node.js nix flake init --template github:the-nix-way/dev-templates#node diff --git a/gleam/flake.lock b/gleam/flake.lock index 26c4e97..de65a66 100644 --- a/gleam/flake.lock +++ b/gleam/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/go1.17/flake.lock b/go1.17/flake.lock index 26c4e97..de65a66 100644 --- a/go1.17/flake.lock +++ b/go1.17/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/go1.18/flake.lock b/go1.18/flake.lock index 26c4e97..de65a66 100644 --- a/go1.18/flake.lock +++ b/go1.18/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/java/flake.lock b/java/flake.lock index 26c4e97..de65a66 100644 --- a/java/flake.lock +++ b/java/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/nix/.envrc b/nix/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/nix/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/nix/flake.lock b/nix/flake.lock new file mode 100644 index 0000000..de65a66 --- /dev/null +++ b/nix/flake.lock @@ -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": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/flake.nix b/nix/flake.nix new file mode 100644 index 0000000..95a1b89 --- /dev/null +++ b/nix/flake.nix @@ -0,0 +1,31 @@ +{ + description = "A Nix-flake-based Zig development environment"; + + 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; }; + + nix = pkgs.nixUnstable; + + helpers = with pkgs; [ nixpkgs-fmt statix ]; + + inherit (pkgs) mkShell; + in { + devShells = { + default = pkgs.mkShell { + buildInputs = [ nix ] ++ helpers; + + shellHook = '' + ${nix}/bin/nix --version + ''; + }; + }; + } + ); +} diff --git a/node/flake.lock b/node/flake.lock index 26c4e97..de65a66 100644 --- a/node/flake.lock +++ b/node/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/rust/flake.lock b/rust/flake.lock index c56572c..01c5a24 100644 --- a/rust/flake.lock +++ b/rust/flake.lock @@ -32,11 +32,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/scala/flake.lock b/scala/flake.lock index 26c4e97..de65a66 100644 --- a/scala/flake.lock +++ b/scala/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": { diff --git a/zig/flake.lock b/zig/flake.lock index 26c4e97..de65a66 100644 --- a/zig/flake.lock +++ b/zig/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1659041591, - "narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=", + "lastModified": 1659045899, + "narHash": "sha256-/vNGtQG19phpMfvkgNtOvSNkG2+na56wMlP/JEOaIjc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e", + "rev": "a9fb3ea0e746226a8bed539854f44ba87df03909", "type": "github" }, "original": {