about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-19 16:55:05 +0100
committerene <ene@sils.li>2023-02-19 16:56:15 +0100
commit48e02230c3860a589b41d302b4d2b13d57d55bde (patch)
tree32d3e8accb505ff0b9dacb36afbeb9d43b43659d
parentFix(bootstrap): Finish the nix side of things (diff)
downloadnixos-config-48e02230c3860a589b41d302b4d2b13d57d55bde.tar.gz
nixos-config-48e02230c3860a589b41d302b4d2b13d57d55bde.zip
Fix(bootstrap): Declare dependencies
Diffstat (limited to '')
-rw-r--r--bootstrap/default.nix20
-rwxr-xr-xbootstrap/install6
-rw-r--r--flake.lock17
-rw-r--r--flake.nix11
4 files changed, 45 insertions, 9 deletions
diff --git a/bootstrap/default.nix b/bootstrap/default.nix
index 29dda5c0..eeadb837 100644
--- a/bootstrap/default.nix
+++ b/bootstrap/default.nix
@@ -1,2 +1,18 @@
-{pkgs, ...}:
-pkgs.writeShellScriptBin "install" (builtins.readFile ./install)
+{
+  pkgs,
+  shell-library,
+  ...
+}:
+#pkgs.writeShellScriptBin "install" (builtins.readFile ./install)
+let
+  dependencies = with pkgs; [jq dash];
+  name = "install";
+in
+  pkgs.runCommandLocal name {
+    nativeBuildInputs = [pkgs.makeWrapper] ++ dependencies;
+  } ''
+        install -m755 ${./install} -D "$out/bin/${name}"
+        sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}|' "$out/bin/${name}"
+    #patchShebangs "$out/bin/${name}"
+        wrapProgram "$out/bin/${name}" --prefix PATH : ${pkgs.lib.makeBinPath dependencies}
+  ''
diff --git a/bootstrap/install b/bootstrap/install
index f281e1dc..d267de7e 100755
--- a/bootstrap/install
+++ b/bootstrap/install
@@ -1,7 +1,7 @@
-#!/bin/sh
+#! /usr/bin/env dash
 # shellcheck disable=SC2086
 # shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
 export LIB_TEMP_DIR_FOR_SCRIPT="$(mktemp -d)"
 bsc() {
     msg2 "$(btrfs subvolume create "$1" || dien "Creating of subvol $1")";
@@ -117,7 +117,7 @@ case $result in
                 warning "No disk selected. Select a disk to continue.\n"
             fi
         done
-        nixos-install --flake https://git.sils.li/ene/nixos-config#${host} --no-root-passwd
+        nixos-install --flake git+https://git.sils.li/ene/nixos-config#${host} --no-root-passwd
         ;;
     *)
         msg "Sure, do it yourself"
diff --git a/flake.lock b/flake.lock
index de8cf12a..39fa5dcc 100644
--- a/flake.lock
+++ b/flake.lock
@@ -189,6 +189,7 @@
         "impermanence": "impermanence",
         "neovim_config": "neovim_config",
         "nixpkgs": "nixpkgs",
+        "shell-library": "shell-library",
         "snap-sync": "snap-sync",
         "strip_js_comments": "strip_js_comments",
         "user_js": "user_js"
@@ -221,6 +222,22 @@
         "type": "github"
       }
     },
+    "shell-library": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1676821822,
+        "narHash": "sha256-zLJ9tKPVaPGne4uKqL63zgPle0UTdrWBXfB1oQUrAqo=",
+        "ref": "refs/heads/prime",
+        "rev": "7ec5e4d34173dfdd4b4425f7f7d3aef411f52a4a",
+        "revCount": 2,
+        "type": "git",
+        "url": "https://git.sils.li/ene/lib-sh.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://git.sils.li/ene/lib-sh.git"
+      }
+    },
     "snap-sync": {
       "flake": false,
       "locked": {
diff --git a/flake.nix b/flake.nix
index f2fc62d2..d6130388 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,12 +26,14 @@
       url = "git+https://codeberg.org/ene/strip_js_comments.git";
       inputs.nixpkgs.follows = "nixpkgs";
     };
-
+    shell-library = {
+      url = "git+https://git.sils.li/ene/lib-sh.git";
+      flake = false;
+    };
     user_js = {
       url = "github:arkenfox/user.js";
       flake = false;
     };
-
     snap-sync = {
       url = "github:qubidt/snap-sync";
       flake = false;
@@ -48,6 +50,7 @@
     impermanence,
     agenix,
     snap-sync,
+    shell-library,
     ...
   } @ inputs: {
     nixosConfigurations.Tiamat = nixpkgs.lib.nixosSystem rec {
@@ -81,11 +84,11 @@
       modules = [./hosts/spawn/configuration.nix];
     };
 
-    packages."x86_64-linux".default = import ./bootstrap {pkgs = nixpkgs.legacyPackages.x86_64-linux;};
+    packages."x86_64-linux".default = import ./bootstrap {pkgs = nixpkgs.legacyPackages.x86_64-linux; inherit shell-library;};
 
     apps."x86_64-linux"."install" = {
       type = "app";
-      program = "${self.packages."x86_64-linux".default}";
+      program = "${self.packages."x86_64-linux".default}/bin/install";
     };
     apps."x86_64-linux".default = self.apps."x86_64-linux".install;
   };