feat: added flake templates

This commit is contained in:
Patrick Großmann 2023-03-06 15:47:49 +09:00
parent 63a3969e95
commit d63c10530e
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
5 changed files with 79 additions and 23 deletions

View file

@ -8,11 +8,11 @@
]
},
"locked": {
"lastModified": 1677247280,
"narHash": "sha256-sa+8MtoAOSLsWP9vf0qiJUyMovIEYgDzHE8TkoK04Hk=",
"lastModified": 1677969766,
"narHash": "sha256-AIp/ZYZMNLDZR/H7iiAlaGpu4lcXsVt9JQpBlf43HRY=",
"owner": "ryantm",
"repo": "agenix",
"rev": "833f87c8ff574a29aea3e091045cbaed3cf86bc1",
"rev": "03b51fe8e459a946c4b88dcfb6446e45efb2c24e",
"type": "github"
},
"original": {
@ -103,11 +103,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1677400245,
"narHash": "sha256-+/oDZltWUhYFYcIRjH0F5lSNWcBj+4o5kzmDSheiLRw=",
"lastModified": 1678006026,
"narHash": "sha256-cGOfrU7JsKHAWXbPVDTOu2yyMb7GeWdUtJQNQSqht+w=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "693d76eeb84124cc3110793ff127aeab3832f95c",
"rev": "68ba59578352815ac372b17fb3df9db39afb1407",
"type": "github"
},
"original": {
@ -118,11 +118,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1677342105,
"narHash": "sha256-kv1fpkfCJGb0M+LZaCHFUuIS9kRIwyVgupHu86Y28nc=",
"lastModified": 1677932085,
"narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b1f87ca164a9684404c8829b851c3586c4d9f089",
"rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89",
"type": "github"
},
"original": {
@ -161,11 +161,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1677160285,
"narHash": "sha256-tBzpCjMP+P3Y3nKLYvdBkXBg3KvTMo3gvi8tLQaqXVY=",
"lastModified": 1677832802,
"narHash": "sha256-XQf+k6mBYTiQUjWRf/0fozy5InAs03O1b30adCpWeXs=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "2bd861ab81469428d9c823ef72c4bb08372dd2c4",
"rev": "382bee738397ca005206eefa36922cc10df8a21c",
"type": "github"
},
"original": {
@ -180,7 +180,20 @@
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
"pre-commit-hooks": "pre-commit-hooks",
"templates": "templates"
}
},
"templates": {
"locked": {
"lastModified": 1,
"narHash": "sha256-yz2sQLloNEJZDDjhm25tJYLBlwS634FpQpu9MMyiNo8=",
"path": "/nix/store/njk5xm2mgimrn3wrnfyh9lrvk5qzq05w-source/templates",
"type": "path"
},
"original": {
"path": "/nix/store/njk5xm2mgimrn3wrnfyh9lrvk5qzq05w-source/templates",
"type": "path"
}
},
"utils": {

View file

@ -18,6 +18,10 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
templates = {
url = "./templates";
};
};
outputs = {
@ -26,6 +30,7 @@
home-manager,
agenix,
flake-utils,
templates,
...
} @ inputs: let
system = "x86_64-linux";
@ -46,6 +51,7 @@
nixpkgs.flake = nixpkgs;
p.flake = nixpkgs;
pkgs.flake = nixpkgs;
templates.flake = templates;
};
}
];
@ -58,7 +64,7 @@
apps = import ./apps/rekey.nix inputs localSystem;
devShells.default = pkgs.mkShell {
name = "patricks tolle nix config";
name = "nixos config";
packages = with pkgs; [
alejandra

View file

@ -0,0 +1,23 @@
{
description = "Patrick tolles flake template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpks,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpks {inherit system;};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
st
];
};
});
}

12
templates/flake.nix Normal file
View file

@ -0,0 +1,12 @@
{
description = "A collection of flake templates";
outputs = {self}: {
templates = {
default = {
path = ./default;
description = "My own basic flake template";
};
};
};
}

View file

@ -14,10 +14,12 @@
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
# Atuin makes completion and this really _really_ slows zsh startup time down
enableCompletion = false;
initExtra = lib.mkAfter (''
function atuin-prefix-search() {
if out=$(${pkgs.sqlite}/bin/sqlite3 -readonly ~/.local/share/atuin/history.db \
'SELECT command FROM history WHERE command LIKE cast('"x'$(str_to_hex "$_atuin_search_prefix")'"' as text) ||\
'SELECT command FROM history WHERE command LIKE cast('"x'$(str_to_hex "$_atuin_search_prefix")'"' as text) ||
"%" ORDER BY timestamp DESC LIMIT 1 OFFSET '"$_atuin_search_offset"); then
[[ -z "$out" ]] && return 1
BUFFER=$out