diff --git a/flakes/flake.lock b/flakes/flake.lock deleted file mode 100644 index 3664df1..0000000 --- a/flakes/flake.lock +++ /dev/null @@ -1,48 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1757745802, - "narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "c23193b943c6c689d70ee98ce3128239ed9e32d1", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1757989933, - "narHash": "sha256-9cpKYWWPCFhgwQTww8S94rTXgg8Q8ydFv9fXM6I8xQM=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "8249aa3442fb9b45e615a35f39eca2fe5510d7c3", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flakes/flake.nix b/flakes/flake.nix deleted file mode 100644 index eb37cb3..0000000 --- a/flakes/flake.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - description = "My rust development shell"; - inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - #zig.url = "github:mitchellh/zig-overlay"; - }; - outputs = {nixpkgs, ...} @ inputs: let - system = "x86_64-linux"; - overlays = [(import inputs.rust-overlay)]; - pkgs = import nixpkgs { - inherit system overlays; - }; - in { - devShells."${system}" = { - c = pkgs.mkShell { - buildInputs = with pkgs; [ - gcc - gnumake - ]; - }; - - rust = pkgs.mkShell { - buildInputs = with pkgs; [ - gcc - gnumake - rust-bin.stable.latest.default - evcxr - ]; - }; - - zig = pkgs.mkShell { - buildInputs = with pkgs; [ - zig - ]; - }; - - c-sharp = pkgs.mkShell { - buildInputs = with pkgs; [ - dotnetCorePackages.sdk_9_0-bin - ]; - }; - - python = pkgs.mkShell { - packages = [ - (pkgs.python3.withPackages (python-pkgs: [ - python-pkgs.numpy - python-pkgs.pandas - ])) - ]; - }; - - rice = pkgs.mkShell { - buildInputs = with pkgs; [ - cmatrix - asciiquarium - lavat - cbonsai - pipes - cava - ]; - }; - }; - }; -} diff --git a/home/modules/shells.nix b/home/modules/shells.nix index ec02b74..9e7b36f 100644 --- a/home/modules/shells.nix +++ b/home/modules/shells.nix @@ -49,7 +49,6 @@ } let git_result = do { git rev-parse --show-toplevel } | complete - if $git_result.exit_code != 0 { nvim $file return @@ -57,16 +56,22 @@ let root = $git_result.stdout | str trim let flake_path = $root | path join "flake.nix" - if not ($flake_path | path exists) { nvim $file return } - if ($user_file | is-empty) { - nix develop $root --command nvim + # nix develop will exit with error if no devShell exists + let dev_check = do { nix develop $root --command true } | complete + + if $dev_check.exit_code == 0 { + if ($user_file | is-empty) { + nix develop $root --command nvim + } else { + nix develop $root --command nvim $file + } } else { - nix develop $root --command nvim $file + nvim $file } } @@ -89,9 +94,9 @@ shellAliases = { zel = "zellij"; - system = "nvim /home/maxag/.nix-config/flake.nix"; - home = "nvim /home/maxag/.nix-config/home/${device-name}/home.nix"; - config = "nvim /home/maxag/.nix-config/configuration/${device-name}/configuration.nix"; + system = "edit /home/maxag/.nix-config/flake.nix"; + home = "edit /home/maxag/.nix-config/home/${device-name}/home.nix"; + config = "edit /home/maxag/.nix-config/configuration/${device-name}/configuration.nix"; cat = "bat -p -P"; nvim = "edit"; nix-shell = "nix-shell --run nu";