From ca26aaf782dbe8bc33ed8412ba966da4f11e2233 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Tue, 5 Mar 2024 16:52:45 +0100 Subject: [PATCH 1/5] idris2 template --- idris2/.envrc | 1 + idris2/.gitignore | 3 +++ idris2/flake.lock | 58 +++++++++++++++++++++++++++++++++++++++++++++ idris2/flake.nix | 34 ++++++++++++++++++++++++++ idris2/package.ipkg | 7 ++++++ idris2/src/Main.idr | 4 ++++ 6 files changed, 107 insertions(+) create mode 100644 idris2/.envrc create mode 100644 idris2/.gitignore create mode 100644 idris2/flake.lock create mode 100644 idris2/flake.nix create mode 100644 idris2/package.ipkg create mode 100644 idris2/src/Main.idr diff --git a/idris2/.envrc b/idris2/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/idris2/.envrc @@ -0,0 +1 @@ +use flake diff --git a/idris2/.gitignore b/idris2/.gitignore new file mode 100644 index 0000000..5c97574 --- /dev/null +++ b/idris2/.gitignore @@ -0,0 +1,3 @@ +build/ +result +.direnv diff --git a/idris2/flake.lock b/idris2/flake.lock new file mode 100644 index 0000000..480320b --- /dev/null +++ b/idris2/flake.lock @@ -0,0 +1,58 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1707091808, + "narHash": "sha256-LahKBAfGbY836gtpVNnWwBTIzN7yf/uYM/S0g393r0Y=", + "path": "/nix/store/ws5098bfhd2kzvg3yxwb2ggvl05h7gfd-source", + "rev": "9f2ee8c91ac42da3ae6c6a1d21555f283458247e", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/idris2/flake.nix b/idris2/flake.nix new file mode 100644 index 0000000..be1c477 --- /dev/null +++ b/idris2/flake.nix @@ -0,0 +1,34 @@ +{ + description = "A Idris2 template"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (sys: + let pkgs = import nixpkgs { system = sys; }; + deps = [ pkgs.idris2 pkgs.chez ]; + name = "package"; + repl = pkgs.writeScriptBin "repl" '' + ${pkgs.idris2}/bin/idris2 --repl ./${name}.ipkg + ''; + in { + packages.default = pkgs.stdenv.mkDerivation { + name = name; + src = ./.; + nativeBuildInputs = deps; + buildPhase = '' + ${pkgs.idris2}/bin/idris2 --build $src/${name}.ipkg --build-dir $PWD/build + ''; + installPhase = '' + mkdir -p $out/bin + cp -r build/exec/* $out/bin + ''; + }; + devShells.default = pkgs.mkShell { + packages = deps ++ [ repl ]; + }; + } + ); +} diff --git a/idris2/package.ipkg b/idris2/package.ipkg new file mode 100644 index 0000000..d4fb781 --- /dev/null +++ b/idris2/package.ipkg @@ -0,0 +1,7 @@ +package package + +depends = contrib +sourcedir = "src" + +main = Main +executable = package diff --git a/idris2/src/Main.idr b/idris2/src/Main.idr new file mode 100644 index 0000000..4ad6744 --- /dev/null +++ b/idris2/src/Main.idr @@ -0,0 +1,4 @@ +module Main + +main : IO () +main = putStrLn "mjau" From 11ed112837d967de04a3d89edd3342ba5f759fd1 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Tue, 5 Mar 2024 17:19:18 +0100 Subject: [PATCH 2/5] julia devshell --- julia/.envrc | 1 + julia/.gitignore | 1 + julia/flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ julia/flake.nix | 23 ++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 julia/.envrc create mode 100644 julia/.gitignore create mode 100644 julia/flake.lock create mode 100644 julia/flake.nix diff --git a/julia/.envrc b/julia/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/julia/.envrc @@ -0,0 +1 @@ +use flake diff --git a/julia/.gitignore b/julia/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/julia/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/julia/flake.lock b/julia/flake.lock new file mode 100644 index 0000000..9290712 --- /dev/null +++ b/julia/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/julia/flake.nix b/julia/flake.nix new file mode 100644 index 0000000..184b3ce --- /dev/null +++ b/julia/flake.nix @@ -0,0 +1,23 @@ +{ + description = "A bare julia flake"; + + inputs = { + # julia language support only in unstable so far + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (sys: + let pkgs = nixpkgs.legacyPackages.${sys}; + overrides = {}; + julia = (pkgs.julia_19.withPackages.override overrides) [ + "Plots" + ]; + in { + devShells.default = pkgs.mkShell { + packages = [ julia ]; + }; + } + ); +} From a27820eb9986222625072e771738b39d352be96c Mon Sep 17 00:00:00 2001 From: depsterr Date: Tue, 5 Mar 2024 19:09:59 +0100 Subject: [PATCH 3/5] doh --- flake.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flake.nix b/flake.nix index ae75542..eaf26ca 100644 --- a/flake.nix +++ b/flake.nix @@ -27,5 +27,15 @@ description = "Minimal python flake"; welcomeText = "hisss 🐍🐍🐍"; }; + templates.julia = { + path = ./julia; + description = "Minimal julia flake"; + welcomeText = ":3"; + }; + templates.idris2 = { + path = ./idris2; + description = "Minimal idris2 flake"; + welcomeText = "mjau :3"; + }; }; } From 042af47d5f850edc5af407e303c5c2ce7d6bbc17 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Wed, 13 Mar 2024 23:33:31 +0100 Subject: [PATCH 4/5] c template using meson --- c/.envrc | 1 + c/flake.lock | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ c/flake.nix | 29 ++++++++++++++++++++++++++ c/meson.build | 12 +++++++++++ c/src/main.c | 5 +++++ flake.nix | 5 +++++ 6 files changed, 110 insertions(+) create mode 100644 c/.envrc create mode 100644 c/flake.lock create mode 100644 c/flake.nix create mode 100644 c/meson.build create mode 100644 c/src/main.c diff --git a/c/.envrc b/c/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/c/.envrc @@ -0,0 +1 @@ +use flake diff --git a/c/flake.lock b/c/flake.lock new file mode 100644 index 0000000..8ba0907 --- /dev/null +++ b/c/flake.lock @@ -0,0 +1,58 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1707091808, + "narHash": "sha256-LahKBAfGbY836gtpVNnWwBTIzN7yf/uYM/S0g393r0Y=", + "path": "/nix/store/ws5098bfhd2kzvg3yxwb2ggvl05h7gfd-source", + "rev": "9f2ee8c91ac42da3ae6c6a1d21555f283458247e", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/c/flake.nix b/c/flake.nix new file mode 100644 index 0000000..7fbcddf --- /dev/null +++ b/c/flake.nix @@ -0,0 +1,29 @@ +{ + description = "A bare minimum c flake"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (sys: + let pkgs = import nixpkgs { system = sys; }; + devTools = [ + pkgs.meson + pkgs.ninja + pkgs.pkg-config + ]; + in rec { + packages.default = packages.mypkg; + packages.mypkg = pkgs.stdenv.mkDerivation { + name = "mypkg"; + version = "0.1.0"; + src = ./.; + nativeBuildInputs = devTools; + }; + devShells.default = pkgs.mkShell { + packages = devTools; + }; + } + ); +} diff --git a/c/meson.build b/c/meson.build new file mode 100644 index 0000000..c4254d8 --- /dev/null +++ b/c/meson.build @@ -0,0 +1,12 @@ +project('mypkg', 'c', + default_options: ['c_std=c23']) + +srcs = ['src/main.c'] +incs = [] +deps = [] + +executable('mypkg', + sources: srcs, + dependencies: deps, + include_directories: incs, + install: true) diff --git a/c/src/main.c b/c/src/main.c new file mode 100644 index 0000000..72a8b32 --- /dev/null +++ b/c/src/main.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + puts("Hello World!"); +} diff --git a/flake.nix b/flake.nix index eaf26ca..539c335 100644 --- a/flake.nix +++ b/flake.nix @@ -37,5 +37,10 @@ description = "Minimal idris2 flake"; welcomeText = "mjau :3"; }; + templates.c = { + path = ./c; + description = "Minimal c flake"; + welcomeText = "sorry"; + }; }; } From 8d260e8e012ae5aa733df54d0550f8f5f9071e61 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Wed, 13 Mar 2024 23:39:21 +0100 Subject: [PATCH 5/5] c2x --- c/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/meson.build b/c/meson.build index c4254d8..42397ae 100644 --- a/c/meson.build +++ b/c/meson.build @@ -1,5 +1,5 @@ project('mypkg', 'c', - default_options: ['c_std=c23']) + default_options: ['c_std=c2x']) srcs = ['src/main.c'] incs = []