aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-03-04 16:49:05 -0600
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-03-04 16:49:11 -0600
commit6715a0844777a9b07488afe191458694ae515d67 (patch)
tree66f2d76a904a285df8cfa2d8d06c0b4d4789e892 /pkgs
parent4cd73433add5fd167e84379b6ae29bba41dac6a9 (diff)
update nixos.rb
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/yo/default.nix30
-rw-r--r--pkgs/yo/nixos.rb10
2 files changed, 30 insertions, 10 deletions
diff --git a/pkgs/yo/default.nix b/pkgs/yo/default.nix
index 06e88d4..a29bb2e 100644
--- a/pkgs/yo/default.nix
+++ b/pkgs/yo/default.nix
@@ -11,13 +11,15 @@
store_path = Nix.build_configuration(
flake_path: FLAKE_PATH,
- hostname: hostname
+ hostname: hostname,
+ use_nom: true
)
Nix.switch_to_configuration_remote(store_path: store_path, ssh_host: ssh_host, use_magic_rollback: true)
when "switch", "sw"
store_path = Nix.build_configuration(
flake_path: FLAKE_PATH,
- hostname: `hostname`.chomp
+ hostname: `hostname`.chomp,
+ use_nom: true
)
Nix.switch_to_configuration(
store_path: store_path,
@@ -27,7 +29,8 @@
when "boot"
store_path = Nix.build_configuration(
flake_path: FLAKE_PATH,
- hostname: `hostname`.chomp
+ hostname: `hostname`.chomp,
+ use_nom: true
)
Nix.switch_to_configuration(
store_path: store_path,
@@ -37,7 +40,8 @@
when "test"
store_path = Nix.build_configuration(
flake_path: FLAKE_PATH,
- hostname: `hostname`.chomp
+ hostname: `hostname`.chomp,
+ use_nom: true
)
Nix.switch_to_configuration(
store_path: store_path,
@@ -49,11 +53,25 @@
Nix.build_configuration(
flake_path: FLAKE_PATH,
- hostname: hostname
+ hostname: hostname,
+ use_nom: true
)
end
'';
+
+ env = pkgs.stdenv.mkDerivation {
+ name = "ruby-env";
+ src = ./.;
+
+ nativeBuildInputs = [pkgs.makeWrapper];
+ buildInputs = [pkgs.ruby pkgs.nix-output-monitor];
+ installPhase = ''
+ mkdir -p $out/bin
+ makeWrapper ${pkgs.ruby}/bin/ruby $out/bin/ruby \
+ --prefix PATH : ${pkgs.lib.makeBinPath [pkgs.nix-output-monitor]}
+ '';
+ };
in
pkgs.writeShellScriptBin "yo" ''
- exec ${pkgs.ruby}/bin/ruby ${yo} "$@"
+ exec ${env}/bin/ruby ${yo} "$@"
''
diff --git a/pkgs/yo/nixos.rb b/pkgs/yo/nixos.rb
index 73a1872..abf7304 100644
--- a/pkgs/yo/nixos.rb
+++ b/pkgs/yo/nixos.rb
@@ -1,18 +1,20 @@
module Nix
- def build_configuration(flake_path:, hostname:)
+ def self.build_configuration(flake_path:, hostname:, use_nom: false)
+ nix_cmd = use_nom ? "nom" : "nix"
+
flake_target = "#{flake_path}#nixosConfigurations.'#{hostname}'.config.system.build.toplevel"
- `nix build --no-link --print-out-paths #{flake_target}`.chomp.tap do
+ `#{nix_cmd} build --no-link --print-out-paths #{flake_target}`.chomp.tap do
raise "Build command failed" unless $?.success?
end
end
- def switch_to_configuration(store_path:, verb:, sudo_cmd: "sudo")
+ def self.switch_to_configuration(store_path:, verb:, sudo_cmd: "sudo")
create_gen_cmd = "nix build --no-link --profile /nix/var/nix/profiles/system #{store_path}"
switch_cmd = "#{store_path}/bin/switch-to-configuration #{verb}"
system("#{sudo_cmd} bash -c '#{create_gen_cmd}; #{switch_cmd}'") or raise "Switch command failed"
end
- def switch_to_configuration_remote(store_path:, ssh_host:, use_magic_rollback: false)
+ def self.switch_to_configuration_remote(store_path:, ssh_host:, use_magic_rollback: false)
system("nix copy --to ssh://#{ssh_host} #{store_path}") or raise "Copy closure command failed"
create_gen_cmd = "nix build --no-link --profile /nix/var/nix/profiles/system #{store_path}"