Split shell.nix files per language

This allows to only download and build environment for the actual
language one is playing with.
Also do not use downloaded binary but provide a derivation for exercism
binary.
This commit is contained in:
Daniel Siepmann 2024-03-25 09:10:41 +01:00
parent 8cd12c1122
commit 184bf48147
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
7 changed files with 83 additions and 28 deletions

11
c/shell.nix Normal file
View file

@ -0,0 +1,11 @@
{
pkgs ? import <nixpkgs> { }
}:
pkgs.mkShellNoCC {
name = "exercism";
buildInputs = [
pkgs.coreutils
(pkgs.callPackage ../exercism.nix { })
];
}

25
exercism.nix Normal file
View file

@ -0,0 +1,25 @@
{
buildGoModule
, fetchFromGitHub
, lib
}:
buildGoModule rec {
pname = "exercism";
version = "3.3.0";
src = fetchFromGitHub {
owner = "exercism";
repo = "cli";
rev = "v${version}";
sha256 = "Mtb5c1/k8kp7bETOSE0X969BV176jpoprr1/mQ3E4Vg=";
};
vendorHash = "sha256-fnsSvbuVGRAndU88su2Ck7mV8QBDhxozdmwI3XGtxcA=";
meta = with lib; {
homepage = "https://github.com/exercism/cli";
description = "Command line interface for exercism website";
license = licenses.mit;
platforms = platforms.linux;
};
}

11
go/shell.nix Normal file
View file

@ -0,0 +1,11 @@
{
pkgs ? import <nixpkgs> { }
}:
pkgs.mkShellNoCC {
name = "exercism";
buildInputs = [
pkgs.go
(pkgs.callPackage ../exercism.nix { })
];
}

11
lua/shell.nix Normal file
View file

@ -0,0 +1,11 @@
{
pkgs ? import <nixpkgs> { }
}:
pkgs.mkShellNoCC {
name = "exercism";
buildInputs = [
(pkgs.lua.withPackages(ps: with ps; [ busted]))
(pkgs.callPackage ../exercism.nix { })
];
}

11
python/shell.nix Normal file
View file

@ -0,0 +1,11 @@
{
pkgs ? import <nixpkgs> { }
}:
pkgs.mkShellNoCC {
name = "exercism";
buildInputs = [
(pkgs.python311.withPackages(ps: with ps; [ pytest ]))
(pkgs.callPackage ../exercism.nix { })
];
}

14
rust/shell.nix Normal file
View file

@ -0,0 +1,14 @@
{
pkgs ? import <nixpkgs> { }
}:
pkgs.mkShellNoCC {
name = "exercism";
buildInputs = [
pkgs.gcc
pkgs.rustc
pkgs.cargo
(pkgs.callPackage ../exercism.nix { })
];
}

View file

@ -1,28 +0,0 @@
{
pkgs ? import <nixpkgs> { }
}:
pkgs.mkShellNoCC {
name = "exercism";
buildInputs = [
# coreutils provides "make" for c compiling
pkgs.coreutils
(pkgs.lua.withPackages(ps: with ps; [ busted]))
(pkgs.python311.withPackages(ps: with ps; [ pytest ]))
pkgs.go
# Rust (needs gcc compiler)
pkgs.gcc
pkgs.rustc
pkgs.cargo
];
shellHook = ''
# Expose exercism binary to PATH, see: https://exercism.org/cli-walkthrough
export PATH="$(pwd):$PATH"
'';
}