yep, more dotfiles
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(templates): add rust-pkg, simplify templates

+76 -55
-16
templates/blank/flake.nix
··· 10 10 forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 11 11 forAllPkgs = function: forAllSystems (system: function pkgs.${system}); 12 12 13 - mkApp = (program: { type = "app"; inherit program; }); 14 - 15 13 pkgs = forAllSystems (system: (import nixpkgs { 16 14 inherit system; 17 15 overlays = [ ]; ··· 20 18 { 21 19 formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt); 22 20 23 - packages = forAllPkgs (pkgs: rec { 24 - # default = app; 25 - # app = pkgs.callPackage ./package.nix { inherit gitignore; }; 26 - }); 27 - apps = forAllSystems (system: rec { 28 - # default = app; 29 - # app = mkApp (pkgs.getExe self.packages.${system}.app); 30 - }); 31 - 32 21 devShells = forAllPkgs (pkgs: 33 22 with pkgs.lib; 34 - let 35 - # key = value; 36 - in 37 23 { 38 24 default = pkgs.mkShell rec { 39 25 nativeBuildInputs = with pkgs; [ ··· 44 30 ]; 45 31 46 32 LD_LIBRARY_PATH = makeLibraryPath buildInputs; 47 - 48 - # ENV_VAR = "true"; 49 33 }; 50 34 }); 51 35 };
+1 -18
templates/c/flake.nix
··· 10 10 forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 11 11 forAllPkgs = function: forAllSystems (system: function pkgs.${system}); 12 12 13 - mkApp = (program: { type = "app"; inherit program; }); 14 - 15 13 pkgs = forAllSystems (system: (import nixpkgs { 16 14 inherit system; 17 15 overlays = [ ]; ··· 20 18 { 21 19 formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt); 22 20 23 - packages = forAllPkgs (pkgs: rec { 24 - # default = app; 25 - # app = pkgs.callPackage ./package.nix { inherit gitignore; }; 26 - }); 27 - apps = forAllSystems (system: rec { 28 - # default = app; 29 - # app = mkApp (pkgs.getExe self.packages.${system}.app); 30 - }); 31 - 32 21 devShells = forAllPkgs (pkgs: 33 22 with pkgs.lib; 34 23 let 35 24 mkClangShell = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; }; 36 - 37 - # key = value; 38 25 in 39 26 { 40 27 default = mkClangShell rec { ··· 42 29 clang-tools 43 30 ] ++ (with llvmPackages; [ clang lldb ]); 44 31 45 - buildInputs = with pkgs; [ 46 - # openssl 47 - ]; 32 + buildInputs = with pkgs; [ ]; 48 33 49 34 LD_LIBRARY_PATH = makeLibraryPath buildInputs; 50 - 51 - # ENV_VAR = "true"; 52 35 }; 53 36 }); 54 37 };
+6
templates/default.nix
··· 20 20 description = "Flake for Rust setup"; 21 21 welcomeText = "`direnv allow`"; 22 22 }; 23 + 24 + rust-pkg = { 25 + path = ./rust-pkg; 26 + description = "Flake for Rust setup with intent to package"; 27 + welcomeText = "`direnv allow`"; 28 + }; 23 29 }
+1
templates/rust-pkg/.envrc
··· 1 + use flake
+61
templates/rust-pkg/flake.nix
··· 1 + { 2 + inputs = { 3 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; 4 + 5 + rust-overlay.url = "github:oxalica/rust-overlay"; 6 + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; 7 + 8 + gitignore.url = "github:hercules-ci/gitignore.nix"; 9 + gitignore.inputs.nixpkgs.follows = "nixpkgs"; 10 + }; 11 + 12 + outputs = { self, nixpkgs, rust-overlay, gitignore }: 13 + let 14 + inherit (nixpkgs.lib) genAttrs; 15 + 16 + forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 17 + forAllPkgs = function: forAllSystems (system: function pkgs.${system}); 18 + 19 + mkApp = (program: { type = "app"; inherit program; }); 20 + 21 + pkgs = forAllSystems (system: (import nixpkgs { 22 + inherit system; 23 + overlays = [ (import rust-overlay) ]; 24 + })); 25 + in 26 + { 27 + formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt); 28 + 29 + packages = forAllPkgs (pkgs: rec { 30 + default = app; 31 + app = pkgs.callPackage ./package.nix { inherit gitignore; }; 32 + }); 33 + apps = forAllSystems (system: rec { 34 + default = app; 35 + app = mkApp (pkgs.getExe self.packages.${system}.app); 36 + }); 37 + 38 + devShells = forAllPkgs (pkgs: 39 + with pkgs.lib; 40 + let 41 + file-rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; 42 + rust-toolchain = file-rust-toolchain.override { extensions = [ "rust-analyzer" ]; }; 43 + in 44 + { 45 + default = pkgs.mkShell rec { 46 + nativeBuildInputs = with pkgs; [ 47 + pkg-config 48 + rust-toolchain 49 + act 50 + ]; 51 + 52 + buildInputs = with pkgs; [ ]; 53 + 54 + RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; 55 + LD_LIBRARY_PATH = makeLibraryPath buildInputs; 56 + 57 + # RUST_LOG = ""; 58 + }; 59 + }); 60 + }; 61 + }
+2
templates/rust-pkg/rust-toolchain.toml
··· 1 + [toolchain] 2 + channel = "stable"
+1
templates/rust-pkg/rustfmt.toml
··· 1 + hard_tabs = true
+4 -21
templates/rust/flake.nix
··· 2 2 inputs = { 3 3 nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; 4 4 5 - rust-overlay = { 6 - url = "github:oxalica/rust-overlay"; 7 - inputs.nixpkgs.follows = "nixpkgs"; 8 - }; 9 - 10 - gitignore = { 11 - url = "github:hercules-ci/gitignore.nix"; 12 - inputs.nixpkgs.follows = "nixpkgs"; 13 - }; 5 + rust-overlay.url = "github:oxalica/rust-overlay"; 6 + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; 14 7 }; 15 8 16 - outputs = { self, nixpkgs, rust-overlay, gitignore }: 9 + outputs = { self, nixpkgs, rust-overlay }: 17 10 let 18 11 inherit (nixpkgs.lib) genAttrs; 19 12 20 13 forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 21 14 forAllPkgs = function: forAllSystems (system: function pkgs.${system}); 22 15 23 - mkApp = (program: { type = "app"; inherit program; }); 24 - 25 16 pkgs = forAllSystems (system: (import nixpkgs { 26 17 inherit system; 27 18 overlays = [ (import rust-overlay) ]; ··· 30 21 { 31 22 formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt); 32 23 33 - packages = forAllPkgs (pkgs: rec { 34 - default = app; 35 - app = pkgs.callPackage ./package.nix { inherit gitignore; }; 36 - }); 37 - apps = forAllSystems (system: rec { 38 - default = app; 39 - app = mkApp (pkgs.getExe self.packages.${system}.app); 40 - }); 41 - 42 24 devShells = forAllPkgs (pkgs: 43 25 with pkgs.lib; 44 26 let ··· 52 34 rust-toolchain 53 35 act 54 36 ]; 37 + 55 38 buildInputs = with pkgs; [ ]; 56 39 57 40 RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
templates/rust/package.nix templates/rust-pkg/package.nix