diff options
author | Zhongheng Liu <z.liu@outlook.com.gr> | 2025-03-30 21:44:59 +0300 |
---|---|---|
committer | Zhongheng Liu <z.liu@outlook.com.gr> | 2025-03-30 21:44:59 +0300 |
commit | 56cbdd91782bcb1fdce68af5acbb557995baba36 (patch) | |
tree | a682ad9f9da849a97ae41c20abddae0ff763e025 | |
parent | f286d56b74c9fcc36da3dd5e4f73be28484c57a3 (diff) | |
download | nix-templates-56cbdd91782bcb1fdce68af5acbb557995baba36.tar.gz nix-templates-56cbdd91782bcb1fdce68af5acbb557995baba36.tar.bz2 nix-templates-56cbdd91782bcb1fdce68af5acbb557995baba36.zip |
feat: change flake template dir structure
-rw-r--r-- | flake.nix | 54 | ||||
-rw-r--r-- | rust-devenv/flake.nix | 43 |
2 files changed, 59 insertions, 38 deletions
@@ -1,43 +1,21 @@ { - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - systems.url = "github:nix-systems/default"; - devenv.url = "github:cachix/devenv"; - devenv.inputs.nixpkgs.follows = "nixpkgs"; - }; - - nixConfig = { - extra-trusted-public-keys = - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; - extra-substituters = "https://devenv.cachix.org"; - }; + outputs = { self }: { - outputs = { self, nixpkgs, devenv, systems, ... }@inputs: - let forEachSystem = nixpkgs.lib.genAttrs (import systems); - in { - packages = forEachSystem (system: { - devenv-up = self.devShells.${system}.default.config.procfileScript; - devenv-test = self.devShells.${system}.default.config.test; - }); + templates.rust = { + path = ./rust-devenv; + description = "A simple Rust/Cargo project"; + welcomeText = '' + # Simple Rust/Cargo Template + ## Intended usage + The intended usage of this flake is... - devShells = forEachSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in { - default = devenv.lib.mkShell { - inherit inputs pkgs; - modules = [rec { - # https://devenv.sh/reference/options/ - packages = with pkgs; [ - hello - ]; - enterShell = '' - hello - ''; - env = { LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages; }; - languages.rust = { enable = true; }; - processes.hello.exec = "hello"; - }]; - }; - }); + ## More info + - [Rust language](https://www.rust-lang.org/) + - [Rust on the NixOS Wiki](https://wiki.nixos.org/wiki/Rust) + - ... + ''; }; + + templates.default = self.templates.rust; + }; } diff --git a/rust-devenv/flake.nix b/rust-devenv/flake.nix new file mode 100644 index 0000000..745235b --- /dev/null +++ b/rust-devenv/flake.nix @@ -0,0 +1,43 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default"; + devenv.url = "github:cachix/devenv"; + devenv.inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixConfig = { + extra-trusted-public-keys = + "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + extra-substituters = "https://devenv.cachix.org"; + }; + + outputs = { self, nixpkgs, devenv, systems, ... }@inputs: + let forEachSystem = nixpkgs.lib.genAttrs (import systems); + in { + packages = forEachSystem (system: { + devenv-up = self.devShells.${system}.default.config.procfileScript; + devenv-test = self.devShells.${system}.default.config.test; + }); + + devShells = forEachSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + default = devenv.lib.mkShell { + inherit inputs pkgs; + modules = [rec { + # https://devenv.sh/reference/options/ + packages = with pkgs; [ + hello + ]; + enterShell = '' + hello + ''; + env = { LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages; }; + languages.rust = { enable = true; }; + processes.hello.exec = "hello"; + }]; + }; + }); + }; +} |