diff --git a/flake.lock b/flake.lock index ec98f01..6b10ce5 100644 --- a/flake.lock +++ b/flake.lock @@ -89,11 +89,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1672349765, - "narHash": "sha256-Ul3lSGglgHXhgU3YNqsNeTlRH1pqxbR64h+2hM+HtnM=", + "lastModified": 1672770368, + "narHash": "sha256-iO6Z9blIe8dcPh3VT2nkej9EimORCoskGQR6xNjICWI=", "owner": "nix-community", "repo": "home-manager", - "rev": "dd99675ee81fef051809bc87d67eb07f5ba022e8", + "rev": "d01e7280ad7d13a5a0fae57355bd0dbfe5b81969", "type": "github" }, "original": { @@ -124,17 +124,14 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1661367362, - "narHash": "sha256-Qc8MXcV+YCPREu8kk6oggk23ZBKLqeQRAIsLbHEviPE=", - "owner": "guibou", - "repo": "nixGL", - "rev": "7165ffbccbd2cf4379b6cd6d2edd1620a427e5ae", - "type": "github" + "lastModified": 1, + "narHash": "sha256-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=", + "path": "out-of-tree/nixGL", + "type": "path" }, "original": { - "owner": "guibou", - "repo": "nixGL", - "type": "github" + "path": "out-of-tree/nixGL", + "type": "path" } }, "nixpkgs": { @@ -154,11 +151,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1672262501, - "narHash": "sha256-ZNXqX9lwYo1tOFAqrVtKTLcJ2QMKCr3WuIvpN8emp7I=", + "lastModified": 1672617983, + "narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e182da8622a354d44c39b3d7a542dc12cd7baa5f", + "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", "type": "github" }, "original": { @@ -201,11 +198,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1672367043, - "narHash": "sha256-4/40kfJysfDEfSpXJ3inuMetn40czz5Mh73SjxsKTX0=", + "lastModified": 1672712534, + "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e6b2214363f5e18576a3b2ca0e0483d8f42fe531", + "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6091d69..efd1cd2 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; - nixgl.url = "github:guibou/nixGL"; + nixgl.url = "path:out-of-tree/nixGL"; rust-overlay.url = "github:oxalica/rust-overlay"; # Allows default.nix to call onto flake.nix. Useful for nix eval and automations flake-compat = { diff --git a/nix-conf/home-manager/base/keepass.nix b/nix-conf/home-manager/base/keepass.nix index b845f58..84f6ca3 100644 --- a/nix-conf/home-manager/base/keepass.nix +++ b/nix-conf/home-manager/base/keepass.nix @@ -56,9 +56,5 @@ in KEEPASSDB_TIMEOUT = cfg.copy_timeout_secs; }; }); - # xdg.dataFile."keepass.kdbx".path = - # base.shells.shellAliases = { - # kp = "kpcli --kdb=${cfg.path}"; - # }; }; } diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index f1e51c5..dc3f0be 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -47,9 +47,12 @@ let # Language-specific stuffs pkgs.sumneko-lua-language-server - pkgs.rust-analyzer - rust_pkgs - pkgs.evcxr # Rust REPL for Conjure! + # TODO: the devShell should provide rust-analyzer so that + # cargo test builds binaries compatible with rust-analyzer + + # pkgs.rust-analyzer + # rust_pkgs + # pkgs.evcxr # Rust REPL for Conjure! # Python3 as alternative to bash scripts :^) # (pkgs.python310Full.withPackages (pypkgs: [ @@ -77,6 +80,11 @@ in vimAlias = true; withPython3 = true; withNodeJs = true; + # Attempt 4: Correct way to make neovim aware of packages + # homeConfigurations.config.programs.neovim takes UNWRAPPED neovim + # and wraps it. + # Ideally, we build our own neovim and add that to config.home.packages + # to share it with nixOS. But we don't really need to share extraPackages = nvim_pkgs; # only for here for archive-documentation # extraPython3Packages = (pypkgs: [ diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 6465d36..16cae97 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -69,11 +69,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1672349765, - "narHash": "sha256-Ul3lSGglgHXhgU3YNqsNeTlRH1pqxbR64h+2hM+HtnM=", + "lastModified": 1672770368, + "narHash": "sha256-iO6Z9blIe8dcPh3VT2nkej9EimORCoskGQR6xNjICWI=", "owner": "nix-community", "repo": "home-manager", - "rev": "dd99675ee81fef051809bc87d67eb07f5ba022e8", + "rev": "d01e7280ad7d13a5a0fae57355bd0dbfe5b81969", "type": "github" }, "original": { @@ -106,11 +106,11 @@ "locked": { "lastModified": 1, "narHash": "sha256-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=", - "path": "/nix/store/qcm4676fqkcdrizjkn4j0796ybddwlxm-source/out-of-tree/nixGL", + "path": "./../../out-of-tree/nixGL", "type": "path" }, "original": { - "path": "/nix/store/qcm4676fqkcdrizjkn4j0796ybddwlxm-source/out-of-tree/nixGL", + "path": "./../../out-of-tree/nixGL", "type": "path" } }, @@ -131,11 +131,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1672262501, - "narHash": "sha256-ZNXqX9lwYo1tOFAqrVtKTLcJ2QMKCr3WuIvpN8emp7I=", + "lastModified": 1672617983, + "narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e182da8622a354d44c39b3d7a542dc12cd7baa5f", + "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", "type": "github" }, "original": { @@ -178,11 +178,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1672367043, - "narHash": "sha256-4/40kfJysfDEfSpXJ3inuMetn40czz5Mh73SjxsKTX0=", + "lastModified": 1672712534, + "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e6b2214363f5e18576a3b2ca0e0483d8f42fe531", + "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index a6ac1e5..2eb9188 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -7,7 +7,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; - nixgl.url = "./../../out-of-tree/nixGL"; + nixgl.url = "path:./../../out-of-tree/nixGL"; rust-overlay.url = "github:oxalica/rust-overlay"; # Allows default.nix to call onto flake.nix. Useful for nix eval and automations flake-compat = { diff --git a/nix-conf/system/flake.lock b/nix-conf/system/flake.lock index 64f2e8c..2761459 100644 --- a/nix-conf/system/flake.lock +++ b/nix-conf/system/flake.lock @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1671359686, - "narHash": "sha256-3MpC6yZo+Xn9cPordGz2/ii6IJpP2n8LE8e/ebUXLrs=", + "lastModified": 1672525397, + "narHash": "sha256-WASDnyxHKWVrEe0dIzkpH+jzKlCKAk0husv0f/9pyxg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "04f574a1c0fde90b51bf68198e2297ca4e7cccf4", + "rev": "8ba56d7c0d7490680f2d51ba46a141eca7c46afa", "type": "github" }, "original": { diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index 6ff6f5b..9477978 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -7,6 +7,9 @@ echo "SCRIPT_DIR: ${SCRIPT_DIR}" HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager" +# Mason is bad: it puts binaries onto xdg.data +rm -rf ~/.local/share/nvim/mason + # test if we have home-manager, if not, attempt to use nix to put home-manager to # our environment if [ $(home-manager >/dev/null 2>&1) ]; then diff --git a/templates/default.nix b/templates/default.nix index 041b23b..70d9fe4 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -12,4 +12,8 @@ path = ./rust-monorepo; description = "Opinionated Rust monorepo, extended from ./rust, using Cargo workspace"; }; + ts-turborepo = { + path = ./ts/turborepo; + description = "Typescript monorepo with tsconfig, eslint, but with minimal framework attached"; + }; } diff --git a/templates/rust-monorepo/flake.nix b/templates/rust-monorepo/flake.nix index bb75c40..f352b18 100644 --- a/templates/rust-monorepo/flake.nix +++ b/templates/rust-monorepo/flake.nix @@ -11,23 +11,21 @@ let overlays = [ rust-overlay.overlays.default ]; pkgs = import nixpkgs { inherit system overlays; }; + rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith + ( + toolchain: + toolchain.default.override { + extensions = [ "rust-src" "rust-analyzer" "rust-docs" "clippy" "miri" ]; + } + )); naersk-lib = pkgs.callPackage naersk { }; in { defaultPackage = naersk-lib.buildPackage ./.; devShell = with pkgs; mkShell { buildInputs = [ - (pkgs.rust-bin.selectLatestNightlyWith - ( - toolchain: - toolchain.default.override { - extensions = [ "rust-src" ]; - } - )) - pkgs.rust-analyzer - pkgs.bacon # rust background code checker + rust_pkgs ]; - RUST_SRC_PATH = rustPlatform.rustLibSrc; shellHook = '' # nix flake update # is this even needed? ''; diff --git a/templates/ts/turborepo/flake.nix b/templates/ts/turborepo/flake.nix new file mode 100644 index 0000000..8446117 --- /dev/null +++ b/templates/ts/turborepo/flake.nix @@ -0,0 +1,53 @@ +{ + description = "Provides devShell for Nodejs + pnpm"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + # https://github.com/vercel/turbo/issues/2293#issuecomment-1296094236 + # work-around for turbo-repo on nix + turbo.url = "github:dlip/turbo"; + }; + + outputs = { self, turbo, flake-utils, nixpkgs }: + with flake-utils; lib.eachSystem lib.defaultSystems (sys: + let + overlays = [ turbo.overlay ]; + # pkgs is our tweaked nixpkgs + pkgs = import nixpkgs { system = sys; overlays = overlays; }; + shellMsg = '' + echo "Hello from nix ${sys}" + echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)" + echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)" + echo "See more on CONTRIBUTING.md" + ''; + in + { + devShell = pkgs.mkShell { + nativeBuildInputs = [ pkgs.bashInteractive ]; + buildInputs = [ + pkgs.nodejs-18_x + pkgs.nodePackages.pnpm + pkgs.nodePackages.prisma + pkgs.prisma-engines + pkgs.turbo + # pkgs.turbo-tooling + pkgs.jq + pkgs.pscale + pkgs.act # Github workflow + ]; + shellHook = + # https://github.com/prisma/prisma/issues/3026#issuecomment-927258138 + # nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv + '' + export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine" + export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine" + export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node" + export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine" + export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt" + export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo" + pnpm install + '' + shellMsg; + }; + }); +}