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 # Nix flake templates for easy dev environments
```shell ```shell
# Gleam
nix flake init --template github:the-nix-way/dev-templates#gleam
# Go 1.17 # Go 1.17
nix flake init --template github:the-nix-way/dev-templates#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 # Rust
nix flake init --template github:the-nix-way/dev-templates#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 }: { outputs = { self }: {
templates = { templates = {
gleam = {
path = ./gleam;
description = "Gleam development environment";
};
go_1_17 = { go_1_17 = {
path = ./go1.17; path = ./go1.17;
description = "Go 1.17 development environment"; description = "Go 1.17 development environment";
@ -17,6 +22,11 @@
path = ./rust; path = ./rust;
description = "Rust development environment"; 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 . 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 = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs"; nixpkgs.url = "github:NixOS/nixpkgs";
@ -11,6 +11,8 @@
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
goPkg = pkgs.go_1_17; goPkg = pkgs.go_1_17;
inherit (pkgs) mkShellNoCC;
in { in {
apps.default = { apps.default = {
type = "app"; type = "app";
@ -18,7 +20,7 @@
}; };
devShells = { devShells = {
default = pkgs.mkShellNoCC { default = mkShellNoCC {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
# go 1.17.1 # go 1.17.1
goPkg goPkg
@ -40,8 +42,7 @@
]; ];
shellHook = '' shellHook = ''
echo "Entering Go env" ${goPkg}/bin/go version
echo "Running `${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 . 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 = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs"; nixpkgs.url = "github:NixOS/nixpkgs";
@ -11,6 +11,8 @@
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
goPkg = pkgs.go_1_18; goPkg = pkgs.go_1_18;
inherit (pkgs) mkShellNoCC;
in { in {
apps.default = { apps.default = {
type = "app"; type = "app";
@ -18,7 +20,7 @@
}; };
devShells = { devShells = {
default = pkgs.mkShellNoCC { default = mkShellNoCC {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
# go 1.18.3 # go 1.18.3
goPkg goPkg
@ -40,8 +42,7 @@
]; ];
shellHook = '' shellHook = ''
echo "Entering Go env" ${goPkg}/bin/go version
echo "Running `${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 . 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; rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
inherit (pkgs) mkShell;
inherit (pkgs.lib) optionals; inherit (pkgs.lib) optionals;
inherit (pkgs.stdenv) isDarwin; inherit (pkgs.stdenv) isDarwin;
in { in {
packages.default = rust; packages.default = rust;
devShells = { devShells = {
default = pkgs.mkShell { default = mkShell {
nativeBuildInputs = [ nativeBuildInputs = [
rust rust
pkgs.pkg-config pkgs.pkg-config

View file

@ -1,2 +1,2 @@
[toolchain] [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`"
'';
};
};
}
);
}