Compare commits

..

No commits in common. "9201edf9458e591aea3b48c082da0727ffd38a55" and "cd9c13f2e20f53ab8286b899545f6b5e5b799759" have entirely different histories.

56 changed files with 44 additions and 927 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
result*
.direnv/
build/

View file

@ -38,13 +38,8 @@ there are three or four:
1. The programming language
2. The build system used to compile/package the repository
3. The Nix evaluation system used in the flake itself
4. (Optional) Additional differences in project structure, including but not
limited to:
- `basic`: Minimal acceptable project structure
- `cli`: Sample CLI program
- `gui`: Sample GUI program
- `lib`: Library
3. The Nix library/evaluation system used in the flake itself
4. (Optional) Additional differences in project structure
For example, the `python_pyproject_nixpkgs_cli` template generates a Python
repository packaged in Pyproject format where the flake uses Nixpkgs' standard

View file

@ -1,6 +1,5 @@
{
stdenvNoCC,
bash,
{ stdenvNoCC
, bash
}:
stdenvNoCC.mkDerivation {

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
use flake

View file

@ -1,43 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1768783163,
"narHash": "sha256-tLj4KcRDLakrlpvboTJDKsrp6z2XLwyQ4Zmo+w8KsY4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bde09022887110deb780067364a0818e89258968",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,23 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs, systems, ... }:
let eachSystem = nixpkgs.lib.genAttrs (import systems);
in {
packages = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
hello = pkgs.callPackage ./package.nix {};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs; };
});
};
}

View file

@ -1,23 +0,0 @@
{
stdenv
}:
let
source = "src/hello.c";
exec = "hello";
in stdenv.mkDerivation {
pname = "hello";
version = "0.1";
src = ./.;
buildPhase = ''
runHook preBuild
gcc ${source} -o ${exec}.bin
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install ${exec}.bin $out/bin/${exec}
runHook postInstall
'';
}

View file

@ -1,8 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
let inherit (pkgs)
mkShell
llvmPackages_21
;
in mkShell {
packages = [ llvmPackages_21.clang-tools ];
}

View file

@ -1,6 +0,0 @@
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
use flake

View file

@ -1,37 +0,0 @@
##
# Example GCC Nix Project
#
# @file
# @version 0.1
SRC_DIR := ./src
BUILD_DIR := ./build
EXEC ?= hello
INSTALL ?= $(PREFIX)/bin/
# Find all the C files we want to compile
SRCS := $(shell find $(SRC_DIR) -name '*.c')
OBJS := $(SRCS:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o)
.PHONY: build install clean
build: $(BUILD_DIR)/$(EXEC)
install: build
mkdir -p $(INSTALL)
cp $(BUILD_DIR)/$(EXEC) $(INSTALL)
# Link
$(BUILD_DIR)/$(EXEC): $(OBJS)
$(CC) $^ -o $@ $(LDFLAGS)
# Compile
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
clean:
rm -r $(BUILD_DIR)
# end

View file

@ -1,43 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1768783163,
"narHash": "sha256-tLj4KcRDLakrlpvboTJDKsrp6z2XLwyQ4Zmo+w8KsY4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bde09022887110deb780067364a0818e89258968",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,23 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs, systems, ... }:
let eachSystem = nixpkgs.lib.genAttrs (import systems);
in {
packages = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
hello = pkgs.callPackage ./package.nix {};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs; };
});
};
}

View file

@ -1,10 +0,0 @@
{
stdenv
}:
stdenv.mkDerivation rec {
pname = "hello";
version = "0.1";
src = ./.;
installFlags = [ "PREFIX=$(out)" "EXEC=${pname}" ];
}

View file

@ -1,8 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
let inherit (pkgs)
mkShell
llvmPackages_21
;
in mkShell {
packages = [ llvmPackages_21.clang-tools ];
}

View file

@ -1,6 +0,0 @@
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}

View file

@ -1,6 +1,5 @@
{
stdenvNoCC,
fish,
{ stdenvNoCC
, fish
}:
stdenvNoCC.mkDerivation {

View file

@ -2,50 +2,41 @@
description = "Hello World flake templates for various languages and build systems";
outputs = { self, ... }:
with builtins; let
concatMapAttrs = func: attr:
foldl' (x: y: x // y) {} (map func attr);
# Template Aliases
# Used to pick default template for each language
let
aliases = {
bash = "bash_script_nixpkgs";
fish = "fish_script_nixpkgs";
c = "c_make_nixpkgs";
python = "python_pyproject_nixpkgs_basic";
rust = "rust_cargo-nightly_crane+fenix";
};
# Files to filter out of the template
template-ignore = [ "flake.lock" "Cargo.lock" ];
# Get all subdirectories of the given path
# Returns [str]
# Get all project directories
subdirs = dir:
let subd = readDir dir;
in filter (d: subd.${d} == "directory") (attrNames subd);
let sub = __readDir dir;
in builtins.filter
(d: sub.${d} == "directory")
(builtins.attrNames sub);
concatMapAttrs = func: attr:
builtins.foldl' (x: y: x // y) {}
(builtins.map func attr);
# Get all proper recursive subdirectories with flakes in them
# Returns [[str]] (list of subdirectory sequences, for processing)
flakeSubdirs = dir:
concatMap (subd:
if pathExists /${dir}/${subd}/flake.nix then [ [ subd ] ] else
map (l: [ subd ] ++ l) (flakeSubdirs /${dir}/${subd}))
builtins.concatMap (sub:
if builtins.pathExists /${dir}/${sub}/flake.nix then [ [ sub ] ] else
builtins.map (l: [ sub ] ++ l) (flakeSubdirs /${dir}/${sub}))
(subdirs dir);
generateDesc = subds:
"${head subds} template - ${concatStringsSep ", " (tail subds)}";
in {
templates = concatMapAttrs (subds: {
${concatStringsSep "_" subds} = {
description = generateDesc subds;
path = filterSource
(p: _: !(elem (baseNameOf p) template-ignore))
(foldl' (dir: subd: /${dir}/${subd}) ./. subds);
templates = concatMapAttrs (path: {
${builtins.concatStringsSep "_" path} = {
description = "${builtins.head path} template - ${builtins.concatStringsSep
", " (builtins.tail path)}";
path = builtins.filterSource
(path: type: builtins.baseNameOf path != "flake.lock")
(builtins.foldl' (dir: sub: /${dir}/${sub}) ./. path);
};
}) (flakeSubdirs ./.) // mapAttrs (from: to:
self.templates.${to} // {
description = generateDesc (filter (p: p != []) (split "_" to));
}) aliases;
}) (flakeSubdirs ./.) // builtins.mapAttrs (lang: def:
self.templates.${def} // {
description = "${lang} template";
}) aliases;
};
}

View file

@ -17,7 +17,7 @@
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs; };
default = pkgs.callPackage ./shell.nix {};
});
};
}

View file

@ -1,5 +1,4 @@
{
python3,
{ python3
}:
python3.pkgs.buildPythonPackage {

View file

@ -1,9 +1,8 @@
{ pkgs ? import <nixpkgs> {} }:
let inherit (pkgs)
mkShellNoCC
python3
;
in mkShellNoCC {
{ mkShell
, python3
}:
mkShell {
inputsFrom = [ python3.buildEnv.env ];
packages = [ python3.pkgs.python-lsp-server ];
}

View file

@ -17,7 +17,7 @@
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs; };
default = pkgs.callPackage ./shell.nix {};
});
};
}

View file

@ -1,5 +1,4 @@
{
python3,
{ python3
}:
python3.pkgs.buildPythonApplication {

View file

@ -1,9 +1,8 @@
{ pkgs ? import <nixpkgs> {} }:
let inherit (pkgs)
mkShellNoCC
python3
;
in mkShellNoCC {
{ mkShell
, python3
}:
mkShell {
inputsFrom = [ python3.buildEnv.env ];
packages = [ python3.pkgs.python-lsp-server ];
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
use flake

View file

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "hello"
version = "0.1.0"

View file

@ -1,6 +0,0 @@
[package]
name = "hello"
version = "0.1.0"
edition = "2024"
[dependencies]

View file

@ -1,98 +0,0 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1763938834,
"narHash": "sha256-j8iB0Yr4zAvQLueCZ5abxfk6fnG/SJ5JnGUziETjwfg=",
"owner": "ipetkov",
"repo": "crane",
"rev": "d9e753122e51cee64eb8d2dddfe11148f339f5a2",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1764226020,
"narHash": "sha256-FzUCFwXNjLnnZmVqYj/FjlBhUpat59SExflEaIGT62s=",
"owner": "nix-community",
"repo": "fenix",
"rev": "2d8176c02f7be6d13578d24d5fd5049f1b46a4c5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1764138170,
"narHash": "sha256-2bCmfCUZyi2yj9FFXYKwsDiaZmizN75cLhI/eWmf3tk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb813de6d2241bcb1b5af2d3059f560c66329967",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1764175386,
"narHash": "sha256-LfgFqvPz3C80VjaffSjy8lLyRWfbThhB7gE7IWXHjYU=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "71ddf07c1c75046df3bb496cf824de5c053d99ad",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,59 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
crane.url = "github:ipetkov/crane";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, systems, crane, fenix, ... }:
let
eachSystem = nixpkgs.lib.genAttrs (import systems);
fenixToolchain = "default";
in {
packages = eachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
in {
hello = pkgs.callPackage ./package.nix {
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs crane fenix fenixToolchain; };
});
checks = eachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
crate = self.packages.${system}.default;
in {
inherit crate;
clippy = craneLib.cargoClippy (
crate.commonArgs
// {
inherit (crate) cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
doc = craneLib.cargoDoc (
crate.commonArgs
// {
inherit (crate) cargoArtifacts;
env.RUSTDOCFLAGS = "--deny warnings";
}
);
});
};
}

View file

@ -1,19 +0,0 @@
{
craneLib,
}:
let
commonArgs = {
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
buildInputs = [
# Additional runtime dependencies
];
passthru.commonArgs = commonArgs;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
crate = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
in crate

View file

@ -1,12 +0,0 @@
{ pkgs ? import <nixpkgs> {},
crane ? builtins.getFlake "github:ipetkov/crane",
fenix ? builtins.getFlake "github:nix-community/fenix",
fenixToolchain ? "default"
}:
let
fenixPkgs = fenix.packages.${pkgs.system};
toolchain = fenixPkgs.${fenixToolchain}.toolchain;
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
in craneLib.devShell {
packages = [ fenixPkgs.rust-analyzer ];
}

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, World!");
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
use flake

View file

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "hello"
version = "0.1.0"

View file

@ -1,6 +0,0 @@
[package]
name = "hello"
version = "0.1.0"
edition = "2024"
[dependencies]

View file

@ -1,82 +0,0 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1764226020,
"narHash": "sha256-FzUCFwXNjLnnZmVqYj/FjlBhUpat59SExflEaIGT62s=",
"owner": "nix-community",
"repo": "fenix",
"rev": "2d8176c02f7be6d13578d24d5fd5049f1b46a4c5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1764138170,
"narHash": "sha256-2bCmfCUZyi2yj9FFXYKwsDiaZmizN75cLhI/eWmf3tk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb813de6d2241bcb1b5af2d3059f560c66329967",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1764175386,
"narHash": "sha256-LfgFqvPz3C80VjaffSjy8lLyRWfbThhB7gE7IWXHjYU=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "71ddf07c1c75046df3bb496cf824de5c053d99ad",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,35 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, systems, fenix, ... }:
let
eachSystem = nixpkgs.lib.genAttrs (import systems);
fenixToolchain = "default";
in {
packages = eachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
toolchain = fenix.packages.${system}.${fenixToolchain}.toolchain;
in {
hello = pkgs.callPackage ./package.nix {
rustPlatform = pkgs.makeRustPlatform {
rustc = toolchain;
cargo = toolchain;
};
};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs fenix fenixToolchain; };
});
};
}

View file

@ -1,12 +0,0 @@
{
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "hello";
version = "0.1";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
}

View file

@ -1,11 +0,0 @@
{ pkgs ? import <nixpkgs> {},
fenix ? builtins.getFlake "github:nix-community/fenix",
fenixToolchain ? "default"
}:
let
inherit (pkgs) mkShellNoCC;
fenixPkgs = fenix.packages.${pkgs.system};
toolchain = fenixPkgs.${fenixToolchain}.toolchain;
in mkShellNoCC {
packages = [ toolchain fenixPkgs.rust-analyzer ];
}

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, World!");
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
use flake

View file

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "hello"
version = "0.1.0"

View file

@ -1,6 +0,0 @@
[package]
name = "hello"
version = "0.1.0"
edition = "2024"
[dependencies]

View file

@ -1,59 +0,0 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1763938834,
"narHash": "sha256-j8iB0Yr4zAvQLueCZ5abxfk6fnG/SJ5JnGUziETjwfg=",
"owner": "ipetkov",
"repo": "crane",
"rev": "d9e753122e51cee64eb8d2dddfe11148f339f5a2",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1764138170,
"narHash": "sha256-2bCmfCUZyi2yj9FFXYKwsDiaZmizN75cLhI/eWmf3tk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb813de6d2241bcb1b5af2d3059f560c66329967",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,52 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
crane.url = "github:ipetkov/crane";
};
outputs = { self, nixpkgs, systems, crane, ... }:
let eachSystem = nixpkgs.lib.genAttrs (import systems);
in {
packages = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
hello = pkgs.callPackage ./package.nix {
craneLib = crane.mkLib pkgs;
};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs crane; };
});
checks = eachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
crate = self.packages.${system}.default;
in {
inherit crate;
clippy = craneLib.cargoClippy (
crate.commonArgs
// {
inherit (crate) cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
doc = craneLib.cargoDoc (
crate.commonArgs
// {
inherit (crate) cargoArtifacts;
env.RUSTDOCFLAGS = "--deny warnings";
}
);
});
};
}

View file

@ -1,19 +0,0 @@
{
craneLib,
}:
let
commonArgs = {
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
buildInputs = [
# Additional runtime dependencies
];
passthru.commonArgs = commonArgs;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
crate = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
in crate

View file

@ -1,10 +0,0 @@
{ pkgs ? import <nixpkgs> {},
crane ? builtins.getFlake "github:ipetkov/crane"
}:
let
inherit (pkgs)
rust-analyzer
;
in (crane.mkLib pkgs).devShell {
packages = [ rust-analyzer ];
}

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, World!");
}

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
use flake

View file

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "hello"
version = "0.1.0"

View file

@ -1,6 +0,0 @@
[package]
name = "hello"
version = "0.1.0"
edition = "2024"
[dependencies]

View file

@ -1,43 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1764138170,
"narHash": "sha256-2bCmfCUZyi2yj9FFXYKwsDiaZmizN75cLhI/eWmf3tk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb813de6d2241bcb1b5af2d3059f560c66329967",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,23 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs, systems, ... }:
let eachSystem = nixpkgs.lib.genAttrs (import systems);
in {
packages = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
hello = pkgs.callPackage ./package.nix {};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./shell.nix { inherit pkgs; };
});
};
}

View file

@ -1,12 +0,0 @@
{
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "hello";
version = "0.1";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
}

View file

@ -1,10 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
let inherit (pkgs)
mkShellNoCC
rustc
cargo
rust-analyzer
;
in mkShellNoCC {
packages = [ rustc cargo rust-analyzer ];
}

View file

@ -1,3 +0,0 @@
fn main() {
println!("Hello, World!");
}