Switch to nix provided exercism
Nixpkgs already provides exercism in latest version Add one on top level to get started with new languages.
This commit is contained in:
parent
eb80f955d7
commit
9ae08339c0
8 changed files with 38 additions and 34 deletions
|
@ -6,6 +6,6 @@ pkgs.mkShellNoCC {
|
|||
name = "exercism";
|
||||
buildInputs = [
|
||||
pkgs.coreutils
|
||||
(pkgs.callPackage ../exercism.nix { })
|
||||
pkgs.exercism
|
||||
];
|
||||
}
|
||||
|
|
25
exercism.nix
25
exercism.nix
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
}
|
|
@ -6,6 +6,6 @@ pkgs.mkShellNoCC {
|
|||
name = "exercism";
|
||||
buildInputs = [
|
||||
pkgs.go
|
||||
(pkgs.callPackage ../exercism.nix { })
|
||||
pkgs.exercism
|
||||
];
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@ pkgs.mkShellNoCC {
|
|||
name = "exercism";
|
||||
buildInputs = [
|
||||
(pkgs.lua.withPackages(ps: with ps; [ busted]))
|
||||
(pkgs.callPackage ../exercism.nix { })
|
||||
pkgs.exercism
|
||||
];
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@ pkgs.mkShellNoCC {
|
|||
name = "exercism";
|
||||
buildInputs = [
|
||||
(pkgs.python311.withPackages(ps: with ps; [ pytest ]))
|
||||
(pkgs.callPackage ../exercism.nix { })
|
||||
pkgs.exercism
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,10 +1,29 @@
|
|||
def equilateral(sides):
|
||||
pass
|
||||
def is_triangle(sides):
|
||||
for side in sides:
|
||||
if side <= 0:
|
||||
return False
|
||||
|
||||
if sides[0] + sides[1] >= sides[2]:
|
||||
return True
|
||||
if sides[1] + sides[2] >= sides[0]:
|
||||
return True
|
||||
if sides[0] + sides[2] >= sides[1]:
|
||||
return True
|
||||
|
||||
def equilateral(sides):
|
||||
if not is_triangle(sides):
|
||||
return False
|
||||
|
||||
return sides[0] == sides[1] == sides[2]
|
||||
|
||||
def isosceles(sides):
|
||||
pass
|
||||
if not is_triangle(sides):
|
||||
return false
|
||||
|
||||
return sides[0] == sides[1] or sides[0] == sides[2] or sides[1] == sides[2]
|
||||
|
||||
def scalene(sides):
|
||||
pass
|
||||
if not is_triangle(sides):
|
||||
return false
|
||||
|
||||
return sides[0] != sides[1] and sides[0] != sides[2] and sides[1] != sides[2]
|
||||
|
|
|
@ -9,6 +9,6 @@ pkgs.mkShellNoCC {
|
|||
pkgs.rustc
|
||||
pkgs.cargo
|
||||
|
||||
(pkgs.callPackage ../exercism.nix { })
|
||||
pkgs.exercism
|
||||
];
|
||||
}
|
||||
|
|
10
shell.nix
Normal file
10
shell.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
pkgs ? import <nixpkgs> { }
|
||||
}:
|
||||
|
||||
pkgs.mkShellNoCC {
|
||||
name = "exercism";
|
||||
buildInputs = [
|
||||
pkgs.exercism
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue