feat: init
This commit is contained in:
commit
cd417d2b12
6 changed files with 193 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
### direnv ###
|
||||||
|
.direnv
|
||||||
|
|
||||||
|
### Rust ###
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
debug/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
# Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
|
||||||
|
/target
|
||||||
6
Cargo.toml
Normal file
6
Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "complete-rss"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
69
flake.lock
generated
Normal file
69
flake.lock
generated
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1754487366,
|
||||||
|
"narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756266583,
|
||||||
|
"narHash": "sha256-cr748nSmpfvnhqSXPiCfUPxRz2FJnvf/RjJGvFfaCsM=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "8a6d5427d99ec71c64f0b93d45778c889005d9c2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756348497,
|
||||||
|
"narHash": "sha256-xJp3VnoYh4kpsaKFO/7SsGbwOz7pI1ZmjbqpXEuR2cw=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "0adf92c70d23fb4f703aea5d3ebb51ac65994f7f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
91
flake.nix
Normal file
91
flake.nix
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
rust-overlay = {
|
||||||
|
url = "github:oxalica/rust-overlay";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
# wild = {
|
||||||
|
# url = "github:davidlattimore/wild";
|
||||||
|
# inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs:
|
||||||
|
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
|
systems = ["x86_64-linux"];
|
||||||
|
perSystem = {
|
||||||
|
self',
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
runtimeDeps = with pkgs; [];
|
||||||
|
buildDeps = with pkgs; [pkg-config rustPlatform.bindgenHook];
|
||||||
|
devDeps = with pkgs; [];
|
||||||
|
|
||||||
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
|
msrv = cargoToml.package.rust-version;
|
||||||
|
|
||||||
|
rustPackage = features:
|
||||||
|
(pkgs.makeRustPlatform {
|
||||||
|
cargo = pkgs.rust-bin.stable.latest.minimal;
|
||||||
|
rustc = pkgs.rust-bin.stable.latest.minimal;
|
||||||
|
}).buildRustPackage {
|
||||||
|
inherit (cargoToml.package) name version;
|
||||||
|
src = ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
buildFeatures = features;
|
||||||
|
buildInputs = runtimeDeps;
|
||||||
|
nativeBuildInputs = buildDeps;
|
||||||
|
# Uncomment if your cargo tests require networking or otherwise
|
||||||
|
# don't play nicely with the Nix build sandbox:
|
||||||
|
# doCheck = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkDevShell = rustc:
|
||||||
|
pkgs.mkShell.override {
|
||||||
|
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
|
||||||
|
# stdenv = pkgs.useWildLinker pkgs.stdenv;
|
||||||
|
} {
|
||||||
|
shellHook = ''
|
||||||
|
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
|
||||||
|
'';
|
||||||
|
buildInputs = runtimeDeps;
|
||||||
|
nativeBuildInputs = buildDeps ++ devDeps ++ [rustc];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
_module.args.pkgs = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [
|
||||||
|
(import inputs.rust-overlay)
|
||||||
|
# inputs.wild.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.default = self'.packages.example;
|
||||||
|
devShells.default = self'.devShells.nightly;
|
||||||
|
|
||||||
|
packages.example = rustPackage "";
|
||||||
|
|
||||||
|
devShells.nightly = let
|
||||||
|
nightly = (pkgs.rust-bin.selectLatestNightlyWith
|
||||||
|
(toolchain: toolchain.default)).override {
|
||||||
|
extensions = ["rustc-codegen-cranelift-preview"];
|
||||||
|
};
|
||||||
|
devShell = mkDevShell nightly;
|
||||||
|
in
|
||||||
|
devShell.overrideAttrs (old: {
|
||||||
|
shellHook =
|
||||||
|
old.shellHook or ""
|
||||||
|
+ ''
|
||||||
|
export RUSTFLAGS="-Zcodegen-backend=cranelift"
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
devShells.stable = mkDevShell pkgs.rust-bin.stable.latest.default;
|
||||||
|
devShells.msrv = mkDevShell pkgs.rust-bin.stable.${msrv}.default;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
3
src/main.rs
Normal file
3
src/main.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue