1
1
Fork 0
mirror of https://github.com/the-nix-way/dev-templates synced 2024-05-21 19:36:12 +02:00

Basic repo cleanup

This commit is contained in:
Luc Perkins 2022-07-28 23:20:46 +02:00
parent 41744cc024
commit 20e8cf8675
No known key found for this signature in database
GPG Key ID: 4F102D0C16E232F2
21 changed files with 175 additions and 39 deletions

View File

View File

@ -1,6 +1,9 @@
# Nix flake templates for easy dev environments
```shell
# Gleam
nix flake init --template github:the-nix-way/dev-templates#gleam
# Go 1.17
nix flake init --template github:the-nix-way/dev-templates#go_1_17
@ -9,4 +12,7 @@ nix flake init --template github:the-nix-way/dev-templates#go_1_18
# Rust
nix flake init --template github:the-nix-way/dev-templates#rust
# Zig
nix flake init --template github:the-nix-way/dev-templates#rust
```

View File

@ -3,6 +3,11 @@
outputs = { self }: {
templates = {
gleam = {
path = ./gleam;
description = "Gleam development environment";
};
go_1_17 = {
path = ./go1.17;
description = "Go 1.17 development environment";
@ -17,6 +22,11 @@
path = ./rust;
description = "Rust development environment";
};
zip = {
path = ./zig;
description = "Zig development environment";
};
};
};
}

1
gleam/.envrc Normal file
View File

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

42
gleam/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": 1657982260,
"narHash": "sha256-k9hwUbpgBmIipH2ZkRS5BpqLKbQYLiB0ewI+e9HHK0I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d2bf29c02bfd0fc0cafb613c6b49d3e6c0d6361",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

30
gleam/flake.nix Normal file
View File

@ -0,0 +1,30 @@
{
description = "A Nix-flake-based Gleam 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; };
gleamPkg = pkgs.gleam;
inherit (pkgs) mkShell;
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
gleamPkg
];
shellHook = ''
${gleamPkg}/bin/gleam --version
'';
};
};
}
);
}

View File

@ -1,4 +1 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
fi
use flake .

1
go1.17/.gitignore vendored
View File

@ -1 +0,0 @@
.direnv/

View File

@ -1,5 +1,5 @@
{
description = "Go 1.17 development environment";
description = "A Nix-flake-based Go 1.17 development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
@ -11,6 +11,8 @@
let
pkgs = import nixpkgs { inherit system; };
goPkg = pkgs.go_1_17;
inherit (pkgs) mkShellNoCC;
in {
apps.default = {
type = "app";
@ -18,7 +20,7 @@
};
devShells = {
default = pkgs.mkShellNoCC {
default = mkShellNoCC {
buildInputs = with pkgs; [
# go 1.17.1
goPkg
@ -40,8 +42,7 @@
];
shellHook = ''
echo "Entering Go env"
echo "Running `${goPkg}/bin/go version`"
${goPkg}/bin/go version
'';
};
};

View File

@ -1,4 +1 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
fi
use flake .

1
go1.18/.gitignore vendored
View File

@ -1 +0,0 @@
.direnv/

View File

@ -1,5 +1,5 @@
{
description = "Go 1.17 development environment";
description = "A Nix-flake-based Go 1.18 development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
@ -11,6 +11,8 @@
let
pkgs = import nixpkgs { inherit system; };
goPkg = pkgs.go_1_18;
inherit (pkgs) mkShellNoCC;
in {
apps.default = {
type = "app";
@ -18,7 +20,7 @@
};
devShells = {
default = pkgs.mkShellNoCC {
default = mkShellNoCC {
buildInputs = with pkgs; [
# go 1.18.3
goPkg
@ -40,8 +42,7 @@
];
shellHook = ''
echo "Entering Go env"
echo "Running `${goPkg}/bin/go version`"
${goPkg}/bin/go version
'';
};
};

View File

@ -1,4 +1 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
fi
use flake .

7
rust/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "rust"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "rust"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -20,13 +20,14 @@
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
inherit (pkgs) mkShell;
inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isDarwin;
in {
packages.default = rust;
devShells = {
default = pkgs.mkShell {
default = mkShell {
nativeBuildInputs = [
rust
pkgs.pkg-config

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "1.61.0"
channel = "1.62.0"

View File

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

1
zig/.envrc Normal file
View File

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

42
zig/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": 1657982260,
"narHash": "sha256-k9hwUbpgBmIipH2ZkRS5BpqLKbQYLiB0ewI+e9HHK0I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d2bf29c02bfd0fc0cafb613c6b49d3e6c0d6361",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

30
zig/flake.nix Normal file
View File

@ -0,0 +1,30 @@
{
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; };
zigPkg = pkgs.zig;
inherit (pkgs) mkShell;
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
zigPkg
];
shellHook = ''
echo "`${zigPkg}/bin/zig version`"
'';
};
};
}
);
}