add fromYaml and stuff

nix-components
pegasust 2022-11-09 13:00:23 +00:00
parent c6de5f2e8b
commit 2c7afc146c
6 changed files with 138 additions and 19 deletions

View File

@ -45,6 +45,22 @@
"type": "github" "type": "github"
} }
}, },
"from-yaml": {
"flake": false,
"locked": {
"lastModified": 1667993187,
"narHash": "sha256-JG1XYGCmR7Jqawvs8AO4c2mrOl37BXGGgU9cfeL0b8k=",
"owner": "pegasust",
"repo": "fromYaml",
"rev": "ef0ed4acfc4a6b7a0f1515cb48f5dbdda89dac3c",
"type": "github"
},
"original": {
"owner": "pegasust",
"repo": "fromYaml",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -53,11 +69,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1667708081, "lastModified": 1667981810,
"narHash": "sha256-FChEy05x4ed/pttjfTeKxjPCnHknMYrUtDyBiYbreT4=", "narHash": "sha256-p27zd5M+OkfND46gzbGkaHlNBZsYe95M48OJuFeuuSY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1ef0da321217c6c19b7a30509631c080a19321e5", "rev": "6ce3493a3c5c6a8f4cfa6f5f88723272e0cfd335",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -102,11 +118,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1667629849, "lastModified": 1667811565,
"narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", "rev": "667e5581d16745bcda791300ae7e2d73f49fff25",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -135,6 +151,7 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"from-yaml": "from-yaml",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
@ -147,11 +164,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1667943215, "lastModified": 1667962118,
"narHash": "sha256-FSD8RIL85Kbq3wVzxzYPuWkXtNaW/HldGpVVRDoPpnY=", "narHash": "sha256-RJi/HxlFxxJr1VeM3LLwrrRhiDGza+gphDMzt9QUS+M=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "01a89f997e49dd624c7f94813feceda63e91ee2e", "rev": "91af035847a74cbd49ce9f764f8ef5fc641cb9b0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -9,15 +9,27 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixgl.url = "github:guibou/nixGL"; nixgl.url = "github:guibou/nixGL";
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
from-yaml = {
url = "github:pegasust/fromYaml";
flake = false;
};
}; };
outputs = { nixpkgs, home-manager, nixgl, rust-overlay, flake-utils, ... }: outputs =
{ nixpkgs
, home-manager
, nixgl
, rust-overlay
, flake-utils
, from-yaml
, ...
}:
let let
system = "x86_64-linux"; system = "x86_64-linux";
overlays = [ nixgl.overlay rust-overlay.overlays.default ]; overlays = [ nixgl.overlay rust-overlay.overlays.default ];
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
lib = (import ../lib-nix { inherit pkgs; lib = pkgs.lib; }); lib = (import ../lib-nix { inherit pkgs from-yaml; lib = pkgs.lib; });
in in
rec { rec {
inherit pkgs; inherit pkgs;
@ -31,7 +43,7 @@
# we migrate this from in-place modules to allow flexibility # we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix # in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = { extraSpecialArgs = {
inherit lib; myLib = lib;
myHome = { myHome = {
username = "nixos"; username = "nixos";
homeDirectory = "/home/nixos"; homeDirectory = "/home/nixos";
@ -44,7 +56,7 @@
./home.nix ./home.nix
]; ];
extraSpecialArgs = { extraSpecialArgs = {
# inherit lib; myLib = lib;
myHome = { myHome = {
username = "ubuntu_admin"; username = "ubuntu_admin";
homeDirectory = "/home/ubuntu_admin"; homeDirectory = "/home/ubuntu_admin";
@ -57,7 +69,7 @@
./home.nix ./home.nix
]; ];
extraSpecialArgs = { extraSpecialArgs = {
# inherit lib; myLib = lib;
myHome = { myHome = {
username = "hwtr"; username = "hwtr";
homeDirectory = "/home/hwtr"; homeDirectory = "/home/hwtr";

View File

@ -16,7 +16,94 @@
inherit nixpkgs; inherit nixpkgs;
inherit from-yaml; inherit from-yaml;
inherit lib; inherit lib;
inherit pkgs;
fromYamlFn = lib.fromYaml; fromYamlFn = lib.fromYaml;
yamlCmd = str: (builtins.fromJSON(pkgs.runCommand "echo ${str} | yq"));
test_0 = ''
key_bindings:
- hello:
"N"
'';
key_bind = ''
key_bindings:
- { key: N, mods: Control, action: CreateNewWindow }
# - { key: Paste, action: Paste }
# - { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp }
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop }
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
- { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode }
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
#- { key: Y, mode: Vi|~Search, action: Copy }
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
#- { key: Return, mode: Vi|~Search, action: Open }
#- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor }
#- { key: K, mode: Vi|~Search, action: Up }
#- { key: J, mode: Vi|~Search, action: Down }
#- { key: H, mode: Vi|~Search, action: Left }
#- { key: L, mode: Vi|~Search, action: Right }
#- { key: Up, mode: Vi|~Search, action: Up }
#- { key: Down, mode: Vi|~Search, action: Down }
#- { key: Left, mode: Vi|~Search, action: Left }
#- { key: Right, mode: Vi|~Search, action: Right }
#- { key: Key0, mode: Vi|~Search, action: First }
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
#- { key: W, mode: Vi|~Search, action: SemanticRight }
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
#- { key: N, mode: Vi|~Search, action: SearchNext }
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
- { key: C, mods: Control|Shift, action: Copy }
'';
}; };
} }

View File

@ -2,7 +2,7 @@
{ config { config
, pkgs , pkgs
, myHome , myHome
# , lib , myLib
, ... , ...
}: }:
{ {
@ -22,6 +22,7 @@
pkgs.nodejs-18_x pkgs.nodejs-18_x
pkgs.rust-analyzer pkgs.rust-analyzer
pkgs.stdenv.cc.cc.lib pkgs.stdenv.cc.cc.lib
pkgs.yq
] ++ (myHome.packages or [ ]); ] ++ (myHome.packages or [ ]);
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -30,9 +31,12 @@
xdg.configFile."starship.toml".text = builtins.readFile ../starship/starship.toml; xdg.configFile."starship.toml".text = builtins.readFile ../starship/starship.toml;
## Programs ## ## Programs ##
programs.jq = {
enable = true;
};
programs.alacritty = myHome.programs.alacritty or { programs.alacritty = myHome.programs.alacritty or {
enable = true; enable = true;
# settings = lib.fromYaml builtins.readFile ../alacritty/alacritty.yml; # settings = myLib.fromYaml (builtins.readFile ../alacritty/alacritty.yml);
}; };
programs.direnv = { programs.direnv = {
enable = true; enable = true;

View File

@ -1,4 +1,4 @@
{pkgs, lib, ...}@flake_import: {pkgs, lib, from-yaml, ...}@flake_import:
{ {
fromYaml = import ./fromYaml/fromYaml.nix {inherit lib;}; fromYaml = import "${from-yaml}/fromYaml.nix" {inherit lib;};
} }

@ -1 +0,0 @@
Subproject commit f31858f94e3f05d4982754eab0e1f427d1ca2497