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

View file

@ -18,6 +18,10 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
templates = {
url = "./templates";
};
}; };
outputs = { outputs = {
@ -26,6 +30,7 @@
home-manager, home-manager,
agenix, agenix,
flake-utils, flake-utils,
templates,
... ...
} @ inputs: let } @ inputs: let
system = "x86_64-linux"; system = "x86_64-linux";
@ -46,6 +51,7 @@
nixpkgs.flake = nixpkgs; nixpkgs.flake = nixpkgs;
p.flake = nixpkgs; p.flake = nixpkgs;
pkgs.flake = nixpkgs; pkgs.flake = nixpkgs;
templates.flake = templates;
}; };
} }
]; ];
@ -58,7 +64,7 @@
apps = import ./apps/rekey.nix inputs localSystem; apps = import ./apps/rekey.nix inputs localSystem;
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "patricks tolle nix config"; name = "nixos config";
packages = with pkgs; [ packages = with pkgs; [
alejandra 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 = { programs.zsh = {
enable = true; enable = true;
dotDir = ".config/zsh"; dotDir = ".config/zsh";
# Atuin makes completion and this really _really_ slows zsh startup time down
enableCompletion = false;
initExtra = lib.mkAfter ('' initExtra = lib.mkAfter (''
function atuin-prefix-search() { function atuin-prefix-search() {
if out=$(${pkgs.sqlite}/bin/sqlite3 -readonly ~/.local/share/atuin/history.db \ 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 "%" ORDER BY timestamp DESC LIMIT 1 OFFSET '"$_atuin_search_offset"); then
[[ -z "$out" ]] && return 1 [[ -z "$out" ]] && return 1
BUFFER=$out BUFFER=$out