Skip to content

Commit d3c25b4

Browse files
committed
Merge branch 'main' of https://github.com/svnlto/nix-config
2 parents 9257fff + f0639a1 commit d3c25b4

File tree

8 files changed

+56
-0
lines changed

8 files changed

+56
-0
lines changed

.claude/settings.local.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"includeCoAuthoredBy": false,
23
"permissions": {
34
"allow": [
45
"Bash(git:*)",

common/programs/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ in {
4040

4141
initContent = ''
4242
${sharedZsh.tools}
43+
${sharedZsh.functions}
4344
${sharedZsh.historyOptions}
4445
${sharedZsh.options}
4546
${sharedZsh.completion}

common/zsh/shared.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,13 @@ rec {
154154
source <(carapace _carapace zsh)
155155
fi
156156
'';
157+
158+
# Shell functions
159+
functions = ''
160+
# Initialize a new flake from template
161+
flake-init() {
162+
local template="''${1:-minimal}"
163+
nix --extra-experimental-features 'nix-command flakes' flake init --accept-flake-config -t "path:$HOME/.config/nix#$template"
164+
}
165+
'';
157166
}

flake.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,14 @@
160160
"aarch64-linux"
161161
"x86_64-linux"
162162
] (system: { default = mkDevShell system; });
163+
164+
# Flake templates for project scaffolding
165+
templates = {
166+
minimal = {
167+
path = ./templates/minimal;
168+
description = "Minimal development environment with devShell";
169+
};
170+
default = self.templates.minimal;
171+
};
163172
};
164173
}

templates/minimal/.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

templates/minimal/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.direnv/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-merge-conflict
9+
- id: detect-private-key

templates/minimal/flake.nix

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
description = "Development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { nixpkgs, flake-utils, ... }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let pkgs = import nixpkgs { inherit system; };
12+
in {
13+
devShells.default = pkgs.mkShell {
14+
buildInputs = with pkgs;
15+
[
16+
pre-commit
17+
# Add packages here
18+
];
19+
20+
shellHook = ''
21+
echo "dev environment loaded"
22+
'';
23+
};
24+
});
25+
}

0 commit comments

Comments
 (0)