Skip to content

Commit

Permalink
Rewrite CLI in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Jul 21, 2023
1 parent f415d8c commit 0e1a7b3
Show file tree
Hide file tree
Showing 15 changed files with 856 additions and 681 deletions.
4 changes: 0 additions & 4 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Used by https://direnv.net
set -euo pipefail

# Use our own last built devenv/nix in CLI
devenv_bin=$(nix build --print-out-paths --accept-flake-config)
PATH_add "$devenv_bin/bin"

# External users should use `source_url` to load this file
source_env ./direnvrc

Expand Down
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Nix & devenv
result
.env*
.devenv*
/.cache
/.pre-commit-config.yaml
/bin
/include
/lib
pyvenv.cfg
/.direnv
/.venv

# examples
examples/rust/app/target

# Python
/.venv
*.pyc
6 changes: 3 additions & 3 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

{
packages = [
(import ./src/devenv.nix { inherit pkgs; nix = inputs.nix; })
pkgs.cairo
pkgs.xorg.libxcb
pkgs.yaml2json
inputs.nix.packages.${pkgs.stdenv.system}.nix
];

languages.nix.enable = true;
languages.python.enable = true;
languages.python.venv.enable = true;
languages.python.poetry.enable = true;
languages.python.poetry.install.installRootPackage = true;
languages.python.poetry.install.groups = [ "docs" ];

devcontainer.enable = true;
devcontainer.settings.customizations.vscode.extensions = [ "bbenoist.Nix" ];
Expand All @@ -21,7 +22,6 @@

# bin/mkdocs serve --config-file mkdocs.insiders.yml
processes.docs.exec = "mkdocs serve";
processes.build.exec = "${pkgs.watchexec}/bin/watchexec -e nix nix build";

scripts.devenv-bump-version.exec = ''
# TODO: ask for the new version
Expand Down
91 changes: 84 additions & 7 deletions flake.lock

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

8 changes: 5 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
url = "github:domenkozar/nix/relaxed-flakes";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, pre-commit-hooks, nix, ... }@inputs:
let
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems);
mkPackage = pkgs: import ./src/devenv.nix {
inherit pkgs nix;
};
mkPackage = pkgs: import ./package.nix { inherit pkgs inputs; };
mkDevShellPackage = config: pkgs: import ./src/devenv-devShell.nix { inherit config pkgs; };
mkDocOptions = pkgs:
let
Expand Down
8 changes: 8 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ pkgs, inputs }:

(inputs.poetry2nix.legacyPackages.${pkgs.stdenv.system}.mkPoetryApplication {
projectDir = ./.;
}).overrideAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ])
++ [ inputs.nix.packages.${pkgs.stdenv.system}.nix ];
})
Loading

0 comments on commit 0e1a7b3

Please sign in to comment.