Compare commits
10 commits
7977b528cd
...
46f856d6f5
| Author | SHA1 | Date | |
|---|---|---|---|
| 46f856d6f5 | |||
| 1b87665ea2 | |||
| 153272ff91 | |||
| 5a43617060 | |||
| e4a9cca607 | |||
| 3db75de0e2 | |||
| 70bf5ebc0f | |||
| 3a586b93f0 | |||
| fc49e86428 | |||
| f30a0e06d5 |
19 changed files with 372 additions and 3 deletions
|
|
@ -7,13 +7,13 @@ some personal flakes
|
||||||
### create a new dir
|
### create a new dir
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix flake new -t https://git.elisiei.xyz:elisiei/nix-environments#ENV_HERE
|
nix flake new -t github:elisiei/nix-envs#ENV_HERE DIR_NAME
|
||||||
```
|
```
|
||||||
|
|
||||||
### or init an existing dir
|
### or init an existing dir
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix flake init -t https://git.elisiei.xyz:elisiei/nix-environments#ENV_HERE
|
nix flake init -t github:elisiei/nix-envs#ENV_HERE
|
||||||
```
|
```
|
||||||
|
|
||||||
# license
|
# license
|
||||||
|
|
|
||||||
1
c/.envrc
Normal file
1
c/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
57
c/.gitignore
vendored
Normal file
57
c/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Linker output
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Kernel Module Compile Results
|
||||||
|
*.mod*
|
||||||
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
||||||
|
|
||||||
|
# debug information files
|
||||||
|
*.dwo
|
||||||
|
|
||||||
|
.direnv
|
||||||
43
c/flake.nix
Normal file
43
c/flake.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
description = "minimal flake for c dev";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem =
|
||||||
|
f:
|
||||||
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{ pkgs }:
|
||||||
|
{
|
||||||
|
default =
|
||||||
|
pkgs.mkShell.override
|
||||||
|
{
|
||||||
|
# Override stdenv in order to change compiler:
|
||||||
|
# stdenv = pkgs.clangStdenv;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
packages = with pkgs; [
|
||||||
|
gnumake
|
||||||
|
tinycc
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
1
crystal/.envrc
Normal file
1
crystal/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
34
crystal/flake.nix
Normal file
34
crystal/flake.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
description = "minimal flake for crystal dev";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem =
|
||||||
|
f:
|
||||||
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{ pkgs }:
|
||||||
|
{
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [ crystal ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
1
elixir/.envrc
Normal file
1
elixir/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
18
elixir/.gitignore
vendored
Normal file
18
elixir/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/elixir
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=elixir
|
||||||
|
|
||||||
|
### Elixir ###
|
||||||
|
/_build
|
||||||
|
/cover
|
||||||
|
/deps
|
||||||
|
/doc
|
||||||
|
/.fetch
|
||||||
|
erl_crash.dump
|
||||||
|
*.ez
|
||||||
|
*.beam
|
||||||
|
/config/*.secret.exs
|
||||||
|
.elixir_ls/
|
||||||
|
|
||||||
|
### Elixir Patch ###
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/elixir
|
||||||
56
elixir/flake.nix
Normal file
56
elixir/flake.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
description = "minimal flake for elixir dev";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
|
|
||||||
|
outputs = {self, ...} @ inputs: let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem = f:
|
||||||
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
inherit system;
|
||||||
|
pkgs = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [inputs.self.overlays.default];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
overlays.default = final: prev: rec {
|
||||||
|
erlang = final.beam.interpreters.erlang_27;
|
||||||
|
pkgs-beam = final.beam.packagesWith erlang;
|
||||||
|
elixir = pkgs-beam.elixir_1_17;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
}: {
|
||||||
|
default = pkgs.mkShellNoCC {
|
||||||
|
packages = with pkgs;
|
||||||
|
[
|
||||||
|
elixir
|
||||||
|
self.formatter.${system}
|
||||||
|
]
|
||||||
|
++
|
||||||
|
# Linux only
|
||||||
|
pkgs.lib.optionals pkgs.stdenv.isLinux (
|
||||||
|
with pkgs; [
|
||||||
|
gigalixir
|
||||||
|
inotify-tools
|
||||||
|
libnotify
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.nixfmt);
|
||||||
|
};
|
||||||
|
}
|
||||||
24
flake.nix
24
flake.nix
|
|
@ -5,10 +5,34 @@
|
||||||
{ self }:
|
{ self }:
|
||||||
{
|
{
|
||||||
templates = {
|
templates = {
|
||||||
|
c = {
|
||||||
|
path = ./c;
|
||||||
|
description = "c template";
|
||||||
|
};
|
||||||
go = {
|
go = {
|
||||||
path = ./go;
|
path = ./go;
|
||||||
description = "go template";
|
description = "go template";
|
||||||
};
|
};
|
||||||
|
elixir = {
|
||||||
|
path = ./elixir;
|
||||||
|
description = "elixir template";
|
||||||
|
};
|
||||||
|
zig = {
|
||||||
|
path = ./zig;
|
||||||
|
description = "zig template";
|
||||||
|
};
|
||||||
|
odin = {
|
||||||
|
path = ./odin;
|
||||||
|
description = "odin template";
|
||||||
|
};
|
||||||
|
psql = {
|
||||||
|
path = ./psql;
|
||||||
|
description = "psql template";
|
||||||
|
};
|
||||||
|
crystal = {
|
||||||
|
path = ./crystal;
|
||||||
|
description = "crystal template";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultTemplate = self.templates.go;
|
defaultTemplate = self.templates.go;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
outputs =
|
outputs =
|
||||||
inputs:
|
inputs:
|
||||||
let
|
let
|
||||||
goVersion = 24;
|
goVersion = 25;
|
||||||
|
|
||||||
supportedSystems = [
|
supportedSystems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
|
|
|
||||||
1
odin/.envrc
Normal file
1
odin/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
34
odin/flake.nix
Normal file
34
odin/flake.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
description = "minimal flake for odin dev";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem =
|
||||||
|
f:
|
||||||
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{ pkgs }:
|
||||||
|
{
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [ odin ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
1
psql/.envrc
Normal file
1
psql/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
1
psql/.gitignore
vendored
Normal file
1
psql/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.postgres*
|
||||||
57
psql/flake.nix
Normal file
57
psql/flake.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
# original via @estebxn
|
||||||
|
description = "Tiny PostgreSQL flake";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs, ... }:
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
pg = pkgs.postgresql_16;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
apps.${system}.default = {
|
||||||
|
type = "app";
|
||||||
|
program = toString (
|
||||||
|
pkgs.writeShellScript "run-postgres" ''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
: ''${PGDATA:=$PWD/.postgres}
|
||||||
|
: ''${PGHOST:=$PWD/.postgres-socket}
|
||||||
|
: ''${PGPORT:=5432}
|
||||||
|
: ''${PGUSER:=postgres}
|
||||||
|
: ''${PGDATABASE:=app}
|
||||||
|
|
||||||
|
mkdir -p "$PGHOST"
|
||||||
|
|
||||||
|
if [ ! -d "$PGDATA" ]; then
|
||||||
|
${pg}/bin/initdb -D "$PGDATA" --auth=trust --username="$PGUSER"
|
||||||
|
cat >> "$PGDATA/postgresql.conf" <<EOF
|
||||||
|
listen_addresses = '127.0.0.1'
|
||||||
|
port = $PGPORT
|
||||||
|
unix_socket_directories = '$PGHOST'
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
${pg}/bin/pg_ctl -D "$PGDATA" -l "$PGDATA/postgres.log" start
|
||||||
|
trap '${pg}/bin/pg_ctl -D "$PGDATA" stop' EXIT
|
||||||
|
|
||||||
|
until ${pg}/bin/pg_isready -h "$PGHOST" -p "$PGPORT" >/dev/null 2>&1; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
${pg}/bin/psql -h "$PGHOST" -p "$PGPORT" -U "$PGUSER" postgres \
|
||||||
|
-tc "SELECT 1 FROM pg_database WHERE datname = '$PGDATABASE'" \
|
||||||
|
| grep -q 1 || ${pg}/bin/createdb -h "$PGHOST" -p "$PGPORT" -U "$PGUSER" "$PGDATABASE"
|
||||||
|
|
||||||
|
echo "Postgres is running on port $PGPORT"
|
||||||
|
echo "psql -h $PGHOST -p $PGPORT -U $PGUSER $PGDATABASE"
|
||||||
|
|
||||||
|
while true; do sleep 60; done
|
||||||
|
''
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
1
zig/.envrc
Normal file
1
zig/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
3
zig/.gitignore
vendored
Normal file
3
zig/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
.zig-cache/
|
||||||
|
zig-out/
|
||||||
|
*.o
|
||||||
36
zig/flake.nix
Normal file
36
zig/flake.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
description = "minimal flake for zig dev";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem =
|
||||||
|
f:
|
||||||
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{ pkgs }:
|
||||||
|
{
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
zig
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue