Skip to content

Commit

Permalink
misc(nix): port template from himkt/nix-templates
Browse files Browse the repository at this point in the history
  • Loading branch information
himkt committed Dec 5, 2024
1 parent 19c2377 commit 61df959
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
13 changes: 13 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
description = "My templates of nix";

outputs = { self, ... }:
{
templates = {
devenv-uv = {
path = ./nix/template.d/devenv-uv;
description = "devenv template with uv";
};
};
};
}
26 changes: 26 additions & 0 deletions nix/template.d/devenv-uv/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions nix/template.d/devenv-uv/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
description = "devenv";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};

outputs = { self, nixpkgs }: let
pkgs = import nixpkgs {
system = "x86_64-darwin";
};

uv = import ./uv.nix { inherit pkgs; };
shell = pkgs.mkShellNoCC {
packages = [
uv
];
shellHook = ''
export SHELL=$(which zsh)
exec $SHELL
'';
};
in {
devShells = {
x86_64-darwin.default = shell;
aarch64-darwin.default = shell;
};
};
}
23 changes: 23 additions & 0 deletions nix/template.d/devenv-uv/uv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ pkgs }:

pkgs.stdenv.mkDerivation {
pname = "uv";
version = "0.5.6";

src = pkgs.fetchurl {
url = "https://github.com/astral-sh/uv/releases/download/0.5.6/uv-x86_64-apple-darwin.tar.gz";
sha256 = "sha256-nEXSCeWr3PpCqkTPRW32wJUrnXGbAdnJ54eIaxelCA4=";
};

installPhase = ''
mkdir -p $out/bin
cp uv $out/bin/
'';

meta = with pkgs.lib; {
description = "An extremely fast Python package and project manager, written in Rust.";
homepage = "https://github.com/astral-sh/uv";
license = licenses.mit;
platforms = platforms.x86_64;
};
}

0 comments on commit 61df959

Please sign in to comment.