ritual
All checks were successful
Nix Build / nix build (push) Successful in 8s

This commit is contained in:
atagen 2026-03-24 21:48:12 +11:00
parent 703ac28f52
commit 945892f51d
6 changed files with 65 additions and 76 deletions

View file

@ -13,6 +13,7 @@ let () =
| "look" -> look ()
| "fresh" -> fresh ()
| "hunt" -> hunt ()
| "ritual" -> ritual ()
| _ -> help ()
else help ()
| None ->

93
flake.lock generated
View file

@ -1,50 +1,15 @@
{
"nodes": {
"flake-compat": {
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"ndg": {
"inputs": {
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1748103964,
"narHash": "sha256-aRFl6I3x1aKzeOBaD/OJHYv+OQ+qE+3FR9uKhIvfW+A=",
"lastModified": 1773478949,
"narHash": "sha256-8rMpSs2OWGaDlDFO5FS6Pf9WutHBXxM2omPr6hfKydI=",
"owner": "feel-co",
"repo": "ndg",
"rev": "c556c4cbcba61474bf8a342a31a2d94cbefd8986",
"rev": "c3bc1541668e6f6632a7005c7e4963c0a5dedc7b",
"type": "github"
},
"original": {
@ -70,11 +35,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1748217807,
"narHash": "sha256-P3u2PXxMlo49PutQLnk2PhI/imC69hFl1yY4aT5Nax8=",
"lastModified": 1774078191,
"narHash": "sha256-nyxxxW1/2ouu9dU0I02ul5pHrmUrE1JVFhfFlmYe3Lw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3108eaa516ae22c2360928589731a4f1581526ef",
"rev": "09061f748ee21f68a089cd5d91ec1859cd93d0be",
"type": "github"
},
"original": {
@ -84,44 +49,26 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1743296961,
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1745930157,
"narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "46e634be05ce9dc6d4db8e664515ba10b78151ae",
"type": "github"
"lastModified": 1773282481,
"narHash": "sha256-oFe06TmOy8UUT1f7xMHqDpSYq2Fy1mkIsXZUvdnyfeY=",
"rev": "fe416aaedd397cacb33a610b33d60ff2b431b127",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre962285.fe416aaedd39/nixexprs.tar.xz?lastModified=1773282481&rev=fe416aaedd397cacb33a610b33d60ff2b431b127"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1748217807,
"narHash": "sha256-P3u2PXxMlo49PutQLnk2PhI/imC69hFl1yY4aT5Nax8=",
"lastModified": 1774078191,
"narHash": "sha256-nyxxxW1/2ouu9dU0I02ul5pHrmUrE1JVFhfFlmYe3Lw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3108eaa516ae22c2360928589731a4f1581526ef",
"rev": "09061f748ee21f68a089cd5d91ec1859cd93d0be",
"type": "github"
},
"original": {
@ -144,11 +91,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1748163740,
"narHash": "sha256-WOK9w5gtdpy4RefaiRtr6YqFaPxR0OrmI2PleZnn4O4=",
"lastModified": 1760178630,
"narHash": "sha256-oxRMTQtzIO1yFRhY++Ss8+ea1cTH40bD/+FAE+m5NFk=",
"ref": "refs/heads/main",
"rev": "4d711e5002bd22adbe6d786560be0fde6cbcf81e",
"revCount": 1,
"rev": "8a6aa536039f1b207888b1369c5cabf0b131e07b",
"revCount": 5,
"type": "git",
"url": "https://git.atagen.co/atagen/unf"
},

39
lib/commands/ritual.ml Normal file
View file

@ -0,0 +1,39 @@
let run () =
print_string Common.header;
Common.meat_print "PREPARING RITUAL GROUND..";
let ( >>= ) = Result.bind in
let ( >|= ) = Fun.flip Result.map in
let tmpdir = Filename.temp_dir "meat-chew" "" in
let meats = Unix.getenv "MEATS" in
let hostname = Unix.gethostname () in
let nix_conf_target =
meats ^ "/entry.nix -A nixosConfigurations." ^ hostname
^ {|'.config.environment.etc."nix/nix.conf"'|}
in
let build_target =
meats ^ "/entry.nix -A nixosConfigurations." ^ hostname
^ ".config.system.build.toplevel"
in
( Common.do_cmd ~args:false
@@ "nix-build --log-format internal-json -v --out-link " ^ tmpdir
^ "/nix.conf " ^ nix_conf_target ^ " |& nom --json"
>>= fun () ->
Common.meat_print "CONSUMING MEATS..";
Common.do_cmd ~args:false
@@ "NIX_USER_CONF_FILES=" ^ tmpdir
^ "/nix.conf nix-build --log-format internal-json -v --out-link " ^ tmpdir
^ "/build " ^ build_target ^ " |& nom --json"
>>= fun () ->
Common.do_cmd ~args:false @@ "dix /nix/var/nix/profiles/system " ^ tmpdir
^ "/build"
>>= fun () ->
Common.do_cmd ~args:false
@@ "sudo sh -c 'nix-env --set -p /nix/var/nix/profiles/system " ^ tmpdir
^ "/build && " ^ tmpdir ^ "/build/bin/switch-to-configuration switch'"
>|= fun () ->
Unix.unlink @@ tmpdir ^ "/nix-conf";
Unix.unlink @@ tmpdir ^ "/build" )
|> ( function
| Error _ -> print_string "FAILED TO CONSUME MEATS."
| _ -> () );
print_string Common.footer

View file

@ -10,6 +10,7 @@ let help_text =
FRESH - HUNT FRESH MEATS
LOOK - LOOK FOR FRESHER MEATS
HUNT - HUNT FOR MEATS IN NIXPKGS
RITUAL - PERFORM RITUAL THEN CONSUME
TRADE - SEND MEATS FAR AWAY
..-A - ..ALL MEATS|}
open Sys
@ -43,8 +44,8 @@ let do_build () =
>>= fun () ->
do_cmd @@ "dix /nix/var/nix/profiles/system " ^ tmpdir ^ "/build"
>>= fun () ->
do_cmd @@ "sudo nix-env --set -p /nix/var/nix/profiles/system " ^ tmpdir
^ "/build && " ^ tmpdir ^ "/build/bin/switch-to-configuration switch"
do_cmd @@ "sudo sh -c 'nix-env --set -p /nix/var/nix/profiles/system " ^ tmpdir
^ "/build && " ^ tmpdir ^ "/build/bin/switch-to-configuration switch'"
>|= fun () -> Unix.unlink @@ tmpdir ^ "/build"
let do_remote () =

View file

@ -6,5 +6,6 @@ let trade = Commands.Trade.run
let look = Commands.Look.run
let fresh = Commands.Fresh.run
let hunt = Commands.Hunt.run
let ritual = Commands.Ritual.run
let help = Commands.Help.run
let meat_print = Common.meat_print

View file

@ -13,5 +13,5 @@ ocamlPackages.buildDunePackage {
src = ./..;
nativeBuildInputs = [ git ];
inherit buildInputs;
buildInputs = buildInputs;
}