diff options
author | Soispha <soispha@vhack.eu> | 2023-04-29 17:31:00 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-05-09 19:32:58 +0200 |
commit | fb206f9be18b4936ef716935c2343531acaf92c2 (patch) | |
tree | 88a86e5ae9f27a050d22397cc2d991a8b9e9b70b | |
parent | Docs(todo): Update (diff) | |
download | nixos-config-fb206f9be18b4936ef716935c2343531acaf92c2.tar.gz nixos-config-fb206f9be18b4936ef716935c2343531acaf92c2.zip |
Refactor(treewide): Use separate shell library
-rw-r--r-- | bootstrap/activate/default.nix | 5 | ||||
-rw-r--r-- | bootstrap/config_setup/default.nix | 5 | ||||
-rw-r--r-- | bootstrap/install/default.nix | 5 | ||||
-rw-r--r-- | bootstrap/setup/default.nix | 5 | ||||
-rw-r--r-- | flake.nix | 22 | ||||
-rw-r--r-- | flake/default.nix | 24 | ||||
-rw-r--r-- | flake/nixosConfigurations/default.nix | 2 | ||||
-rw-r--r-- | flake/packages/default.nix | 11 | ||||
-rw-r--r-- | home-manager/config/zsh/default.nix | 5 | ||||
-rw-r--r-- | lib/default.nix | 56 | ||||
-rwxr-xr-x | update | 3 |
11 files changed, 44 insertions, 99 deletions
diff --git a/bootstrap/activate/default.nix b/bootstrap/activate/default.nix index 9d01e57a..c60d8e73 100644 --- a/bootstrap/activate/default.nix +++ b/bootstrap/activate/default.nix @@ -1,12 +1,11 @@ # vim: ts=2 { pkgs, - shell-library, + sysLib, ... }: let dependencies = builtins.attrValues {inherit (pkgs) jq gawk curl coreutils libuuid nix git;}; name = "activate"; script = ./activate.sh; - lib = import ../../lib {inherit pkgs shell-library;}; in - lib.makeShellScriptWithLibrary {inherit dependencies name script;} + sysLib.makeShellScriptWithLibrary {inherit dependencies name script;} diff --git a/bootstrap/config_setup/default.nix b/bootstrap/config_setup/default.nix index 19ee84dc..20de9542 100644 --- a/bootstrap/config_setup/default.nix +++ b/bootstrap/config_setup/default.nix @@ -1,12 +1,11 @@ # vim: ts=2 { pkgs, - shell-library, + sysLib, ... }: let dependencies = builtins.attrValues {inherit (pkgs) git neovim;}; name = "config_setup"; script = ./config_setup.sh; - lib = import ../../lib {inherit pkgs shell-library;}; in - lib.makeShellScriptWithLibrary {inherit dependencies name script;} + sysLib.makeShellScriptWithLibrary {inherit dependencies name script;} diff --git a/bootstrap/install/default.nix b/bootstrap/install/default.nix index 71548e90..054c28ec 100644 --- a/bootstrap/install/default.nix +++ b/bootstrap/install/default.nix @@ -1,12 +1,11 @@ # vim: ts=2 { pkgs, - shell-library, + sysLib, ... }: let dependencies = builtins.attrValues {inherit (pkgs) jq dash curl gawk btrfs-progs coreutils libuuid gptfdisk dosfstools toybox nix git;}; name = "install"; script = ./install.sh; - lib = import ../../lib {inherit pkgs shell-library;}; in - lib.makeShellScriptWithLibrary {inherit dependencies name script;} + sysLib.makeShellScriptWithLibrary {inherit dependencies name script;} diff --git a/bootstrap/setup/default.nix b/bootstrap/setup/default.nix index b6d925a2..b32a822b 100644 --- a/bootstrap/setup/default.nix +++ b/bootstrap/setup/default.nix @@ -1,12 +1,11 @@ # vim: ts=2 { pkgs, - shell-library, + sysLib, ... }: let dependencies = builtins.attrValues {inherit (pkgs) dash gawk curl git nix gnugrep nixos-install-tools coreutils libuuid;}; name = "setup"; script = ./setup.sh; - lib = import ../../lib {inherit pkgs shell-library;}; in - lib.makeShellScriptWithLibrary {inherit dependencies name script;} + sysLib.makeShellScriptWithLibrary {inherit dependencies name script;} diff --git a/flake.nix b/flake.nix index 0c4167d5..0923bd25 100644 --- a/flake.nix +++ b/flake.nix @@ -107,9 +107,13 @@ flake-utils.follows = "flake-utils"; }; }; - shell-library = { - url = "git+https://git.sils.li/ene/lib-sh.git"; - flake = false; + shell_library = { + url = "git+https://codeberg.org/soispha/shell_library.git"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + systems.follows = "systems"; + }; }; river_init_lesser = { url = "git+https://git.sils.li/ene/river-lesser-init.git"; @@ -165,14 +169,14 @@ # my binaries video_pause, strip_js_comments, - shell-library, + shell_library, river_init_lesser, yambar_memory, yambar_cpu, grades, ... }: let - sysLib = import ./lib {inherit pkgs shell-library;}; + sysLib = shell_library.lib.${system}; system = "x86_64-linux"; pkgs = import nixpkgs (import ./system/nixpkgs { inherit (nixpkgs) lib; @@ -187,23 +191,23 @@ sysLib nixpkgs # modules - + home-manager nixos-generators impermanence agenix ragenix # external dependencies - + neovim_config user_js snap-sync templates # my binaries - + video_pause strip_js_comments - shell-library + shell_library river_init_lesser yambar_memory yambar_cpu diff --git a/flake/default.nix b/flake/default.nix index 0af0c127..cb090466 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -19,7 +19,7 @@ # my binaries video_pause, strip_js_comments, - shell-library, + shell_library, river_init_lesser, yambar_memory, yambar_cpu, @@ -35,24 +35,24 @@ pkgs sysLib # extra information - + system # bins - + video_pause yambar_cpu yambar_memory strip_js_comments river_init_lesser grades - shell-library + shell_library # external deps - + user_js neovim_config snap-sync # modules - + impermanence ; }; @@ -83,32 +83,32 @@ in { nixpkgs sysLib # configs - + defaultModules defaultSpecialArgs # bins - + video_pause yambar_cpu yambar_memory strip_js_comments river_init_lesser grades - shell-library + shell_library # external deps - + user_js neovim_config snap-sync templates # modules - + impermanence home-manager agenix ; }; - packages."${system}" = import ./packages {inherit nixos-generators defaultSpecialArgs pkgs shell-library;}; + packages."${system}" = import ./packages {inherit nixos-generators defaultSpecialArgs pkgs sysLib;}; apps."${system}" = import ./apps {inherit self system;}; diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix index 0698da76..0c7ada1a 100644 --- a/flake/nixosConfigurations/default.nix +++ b/flake/nixosConfigurations/default.nix @@ -14,7 +14,7 @@ strip_js_comments, river_init_lesser, grades, - shell-library, + shell_library, # external deps user_js, neovim_config, diff --git a/flake/packages/default.nix b/flake/packages/default.nix index 470ea05c..a7274aeb 100644 --- a/flake/packages/default.nix +++ b/flake/packages/default.nix @@ -1,8 +1,9 @@ +# vim: ts=2 { nixos-generators, defaultSpecialArgs, pkgs, - shell-library, + sysLib, ... }: { iso = nixos-generators.nixosGenerate { @@ -16,25 +17,25 @@ install = import ../../bootstrap/install { inherit pkgs - shell-library + sysLib ; }; activate = import ../../bootstrap/activate { inherit pkgs - shell-library + sysLib ; }; setup = import ../../bootstrap/setup { inherit pkgs - shell-library + sysLib ; }; config_setup = import ../../bootstrap/config_setup { inherit pkgs - shell-library + sysLib ; }; } diff --git a/home-manager/config/zsh/default.nix b/home-manager/config/zsh/default.nix index 4c52b829..f9e5e4e5 100644 --- a/home-manager/config/zsh/default.nix +++ b/home-manager/config/zsh/default.nix @@ -2,7 +2,8 @@ config, pkgs, lib, - shell-library, + shell_library, + system, ... }: { # TODO ADD THIS ADDON @@ -72,7 +73,7 @@ + builtins.readFile ./config/zsh-prompt.sh + builtins.readFile ./config/custom_cursor.sh + builtins.readFile "${pkgs.fzf}/share/fzf/key-bindings.zsh" - + "source ${shell-library}/lib"; + + "source ${shell_library.rawLib.${system}}"; shellAliases = { ls = "ls -a --color=auto"; ll = ". ll"; diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 2704944f..00000000 --- a/lib/default.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - pkgs, - shell-library, - ... -}: let - shellLibraryDeps = - builtins.attrValues {inherit (pkgs) mktemp dash;}; -in { - makeShellScriptWithLibrary = { - dependencies, - name, - script, - ... - }: let - shellDependencies = dependencies ++ shellLibraryDeps; - in - pkgs.runCommandLocal name { - nativeBuildInputs = [pkgs.makeWrapper] ++ shellDependencies; - } '' - install -m755 ${script} -D "$out/bin/${name}" - sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}" - patchShebangs "$out/bin/${name}" - wrapProgram "$out/bin/${name}" --set PATH ${pkgs.lib.makeBinPath shellDependencies} - ''; - - # This dumps the extra things in the default path; TODO fix this - makeShellScriptWithLibraryAndKeepPath = { - dependencies, - name, - script, - ... - }: let - shellDependencies = dependencies ++ shellLibraryDeps; - in - pkgs.runCommandLocal name { - nativeBuildInputs = [pkgs.makeWrapper] ++ shellDependencies; - } '' - install -m755 ${script} -D "$out/bin/${name}" - sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}" - patchShebangs "$out/bin/${name}" - wrapProgram "$out/bin/${name}" --prefix PATH : ${pkgs.lib.makeBinPath shellDependencies} - ''; - - makeShellScriptWithLibraryUnwrapped = { - name, - script, - ... - }: - pkgs.runCommandLocal name { - nativeBuildInputs = []; - } '' - install -m755 ${script} -D "$out/bin/${name}" - sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}" - patchShebangs "$out/bin/${name}" - ''; -} diff --git a/update b/update index 38c27247..d3c0f526 100755 --- a/update +++ b/update @@ -1,7 +1,6 @@ #!/bin/sh # shellcheck disable=SC2086 -nix flake update ./home-manager/config/firefox/scripts/update_extensions -! grep '[^0-9]_[0-9]' flake.lock +nix run git+https://codeberg.org/soispha/flake_update |