yep, more dotfiles

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

-16
templates/blank/flake.nix
···
forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
forAllPkgs = function: forAllSystems (system: function pkgs.${system});
-
mkApp = (program: { type = "app"; inherit program; });
-
pkgs = forAllSystems (system: (import nixpkgs {
inherit system;
overlays = [ ];
···
{
formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt);
-
packages = forAllPkgs (pkgs: rec {
-
# default = app;
-
# app = pkgs.callPackage ./package.nix { inherit gitignore; };
-
});
-
apps = forAllSystems (system: rec {
-
# default = app;
-
# app = mkApp (pkgs.getExe self.packages.${system}.app);
-
});
-
devShells = forAllPkgs (pkgs:
with pkgs.lib;
-
let
-
# key = value;
-
in
{
default = pkgs.mkShell rec {
nativeBuildInputs = with pkgs; [
···
];
LD_LIBRARY_PATH = makeLibraryPath buildInputs;
-
-
# ENV_VAR = "true";
};
});
};
+1 -18
templates/c/flake.nix
···
forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
forAllPkgs = function: forAllSystems (system: function pkgs.${system});
-
mkApp = (program: { type = "app"; inherit program; });
-
pkgs = forAllSystems (system: (import nixpkgs {
inherit system;
overlays = [ ];
···
{
formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt);
-
packages = forAllPkgs (pkgs: rec {
-
# default = app;
-
# app = pkgs.callPackage ./package.nix { inherit gitignore; };
-
});
-
apps = forAllSystems (system: rec {
-
# default = app;
-
# app = mkApp (pkgs.getExe self.packages.${system}.app);
-
});
-
devShells = forAllPkgs (pkgs:
with pkgs.lib;
let
mkClangShell = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; };
-
-
# key = value;
in
{
default = mkClangShell rec {
···
clang-tools
] ++ (with llvmPackages; [ clang lldb ]);
-
buildInputs = with pkgs; [
-
# openssl
-
];
+
buildInputs = with pkgs; [ ];
LD_LIBRARY_PATH = makeLibraryPath buildInputs;
-
-
# ENV_VAR = "true";
};
});
};
+6
templates/default.nix
···
description = "Flake for Rust setup";
welcomeText = "`direnv allow`";
};
+
+
rust-pkg = {
+
path = ./rust-pkg;
+
description = "Flake for Rust setup with intent to package";
+
welcomeText = "`direnv allow`";
+
};
}
+1
templates/rust-pkg/.envrc
···
+
use flake
+61
templates/rust-pkg/flake.nix
···
+
{
+
inputs = {
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
+
+
rust-overlay.url = "github:oxalica/rust-overlay";
+
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
+
+
gitignore.url = "github:hercules-ci/gitignore.nix";
+
gitignore.inputs.nixpkgs.follows = "nixpkgs";
+
};
+
+
outputs = { self, nixpkgs, rust-overlay, gitignore }:
+
let
+
inherit (nixpkgs.lib) genAttrs;
+
+
forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
+
forAllPkgs = function: forAllSystems (system: function pkgs.${system});
+
+
mkApp = (program: { type = "app"; inherit program; });
+
+
pkgs = forAllSystems (system: (import nixpkgs {
+
inherit system;
+
overlays = [ (import rust-overlay) ];
+
}));
+
in
+
{
+
formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt);
+
+
packages = forAllPkgs (pkgs: rec {
+
default = app;
+
app = pkgs.callPackage ./package.nix { inherit gitignore; };
+
});
+
apps = forAllSystems (system: rec {
+
default = app;
+
app = mkApp (pkgs.getExe self.packages.${system}.app);
+
});
+
+
devShells = forAllPkgs (pkgs:
+
with pkgs.lib;
+
let
+
file-rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
+
rust-toolchain = file-rust-toolchain.override { extensions = [ "rust-analyzer" ]; };
+
in
+
{
+
default = pkgs.mkShell rec {
+
nativeBuildInputs = with pkgs; [
+
pkg-config
+
rust-toolchain
+
act
+
];
+
+
buildInputs = with pkgs; [ ];
+
+
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
+
LD_LIBRARY_PATH = makeLibraryPath buildInputs;
+
+
# RUST_LOG = "";
+
};
+
});
+
};
+
}
+2
templates/rust-pkg/rust-toolchain.toml
···
+
[toolchain]
+
channel = "stable"
+1
templates/rust-pkg/rustfmt.toml
···
+
hard_tabs = true
+4 -21
templates/rust/flake.nix
···
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
-
rust-overlay = {
-
url = "github:oxalica/rust-overlay";
-
inputs.nixpkgs.follows = "nixpkgs";
-
};
-
-
gitignore = {
-
url = "github:hercules-ci/gitignore.nix";
-
inputs.nixpkgs.follows = "nixpkgs";
-
};
+
rust-overlay.url = "github:oxalica/rust-overlay";
+
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
-
outputs = { self, nixpkgs, rust-overlay, gitignore }:
+
outputs = { self, nixpkgs, rust-overlay }:
let
inherit (nixpkgs.lib) genAttrs;
forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
forAllPkgs = function: forAllSystems (system: function pkgs.${system});
-
mkApp = (program: { type = "app"; inherit program; });
-
pkgs = forAllSystems (system: (import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
···
{
formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt);
-
packages = forAllPkgs (pkgs: rec {
-
default = app;
-
app = pkgs.callPackage ./package.nix { inherit gitignore; };
-
});
-
apps = forAllSystems (system: rec {
-
default = app;
-
app = mkApp (pkgs.getExe self.packages.${system}.app);
-
});
-
devShells = forAllPkgs (pkgs:
with pkgs.lib;
let
···
rust-toolchain
act
];
+
buildInputs = with pkgs; [ ];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
templates/rust/package.nix templates/rust-pkg/package.nix