From d63c10530e252489d82e9fa640c7b5d59e38b1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Mon, 6 Mar 2023 15:47:49 +0900 Subject: [PATCH] feat: added flake templates --- flake.lock | 39 ++++++++++++++++++++++++------------- flake.nix | 8 +++++++- templates/default/flake.nix | 23 ++++++++++++++++++++++ templates/flake.nix | 12 ++++++++++++ users/common/shells/zsh.nix | 20 ++++++++++--------- 5 files changed, 79 insertions(+), 23 deletions(-) create mode 100644 templates/default/flake.nix create mode 100644 templates/flake.nix diff --git a/flake.lock b/flake.lock index 1d5ab88..7c346e9 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/flake.nix b/flake.nix index 1a1ef7d..325f65e 100644 --- a/flake.nix +++ b/flake.nix @@ -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 diff --git a/templates/default/flake.nix b/templates/default/flake.nix new file mode 100644 index 0000000..d5c9f1c --- /dev/null +++ b/templates/default/flake.nix @@ -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 + ]; + }; + }); +} diff --git a/templates/flake.nix b/templates/flake.nix new file mode 100644 index 0000000..7f3cf19 --- /dev/null +++ b/templates/flake.nix @@ -0,0 +1,12 @@ +{ + description = "A collection of flake templates"; + + outputs = {self}: { + templates = { + default = { + path = ./default; + description = "My own basic flake template"; + }; + }; + }; +} diff --git a/users/common/shells/zsh.nix b/users/common/shells/zsh.nix index 0c660af..3479b8f 100644 --- a/users/common/shells/zsh.nix +++ b/users/common/shells/zsh.nix @@ -14,18 +14,20 @@ 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) ||\ + 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) || "%" ORDER BY timestamp DESC LIMIT 1 OFFSET '"$_atuin_search_offset"); then - [[ -z "$out" ]] && return 1 - BUFFER=$out - else - return 1 - fi + [[ -z "$out" ]] && return 1 + BUFFER=$out + else + return 1 + fi - }; zle -N atuin-prefix-search + }; zle -N atuin-prefix-search '' + (builtins.readFile ../../../data/zsh/zshrc)); plugins = [