Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
xenia 2024-03-16 23:42:37 +01:00
commit a745c16de8
16 changed files with 314 additions and 1 deletions

1
c/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

58
c/flake.lock Normal file
View File

@ -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
}

29
c/flake.nix Normal file
View File

@ -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;
};
}
);
}

12
c/meson.build Normal file
View File

@ -0,0 +1,12 @@
project('mypkg', 'c',
default_options: ['c_std=c2x'])
srcs = ['src/main.c']
incs = []
deps = []
executable('mypkg',
sources: srcs,
dependencies: deps,
include_directories: incs,
install: true)

5
c/src/main.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
int main(void) {
puts("Hello World!");
}

View File

@ -27,10 +27,25 @@
description = "Minimal python flake";
welcomeText = "hisss 🐍🐍🐍";
};
templates.verilog= {
templates.verilog = {
path = ./fpga;
description = "FPGA flake, running verilog on ice40";
welcomeText = "mjau 🧊";
};
templates.julia = {
path = ./julia;
description = "Minimal julia flake";
welcomeText = ":3";
};
templates.idris2 = {
path = ./idris2;
description = "Minimal idris2 flake";
welcomeText = "mjau :3";
};
templates.c = {
path = ./c;
description = "Minimal c flake";
welcomeText = "sorry";
};
};
}

1
idris2/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

3
idris2/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/
result
.direnv

58
idris2/flake.lock Normal file
View File

@ -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
}

34
idris2/flake.nix Normal file
View File

@ -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 ];
};
}
);
}

7
idris2/package.ipkg Normal file
View File

@ -0,0 +1,7 @@
package package
depends = contrib
sourcedir = "src"
main = Main
executable = package

4
idris2/src/Main.idr Normal file
View File

@ -0,0 +1,4 @@
module Main
main : IO ()
main = putStrLn "mjau"

1
julia/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

1
julia/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.direnv

61
julia/flake.lock Normal file
View File

@ -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
}

23
julia/flake.nix Normal file
View File

@ -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 ];
};
}
);
}