this repo has no description usp.wiro.world
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

more examples

authored by

Milo Moisson and committed by
Milo Moisson
9c30bff1 0d0d7293

+95 -17
+4
README.md
··· 16 16 17 17 - `project`: contains a crystal (flake) definition for a project 18 18 19 + # Ideas 20 + 21 + - Have a repl with autocompletion to make build steps. A way to test and rollback steps to ensure that it works without having to run and inspect the derivation multiple times. 22 + 19 23 # Lecture 20 24 21 25 - The Purely Functional Software Deployment Model — Eelco Dolstra
+25
examples/auvergne.rs
··· 1 + // wakatime-ls := derivation { 2 + derivation wakatime-ls { 3 + version: ::from((0, 2, 0)), 4 + source: ::github("mrnossiom", "wakatime-ls", "main"), 5 + 6 + steps: |src| { 7 + out := std::make_output("out"); 8 + // let out; std::make_output!(out); 9 + // std::make_output!(def out); 10 + 11 + std::rust::build(src, out) 12 + .inject(pkgs::rustc::v1-56-3); 13 + // how to handle deps? 14 + // .wrap_many([pkgs ...]) 15 + // .wrap[pkgs::libgit,] 16 + }, 17 + } 18 + 19 + make_hello := derivation { 20 + name: hello, 21 + source: .github("gnu", "hello"), 22 + build/steps: .simple(|src, out| { 23 + std::c::automake(src, out); 24 + }) 25 + }
+13 -8
examples/core/lib.rs
··· 1 + //! This file shows what items constitue the core library. 2 + 1 3 // # Ressources 2 - // https://github.com/NixOS/nixpkgs/blob/master/doc/stdenv/stdenv.chapter.md 3 - // --- 4 - 5 - //! In separate crates/projects 4 + // - <https://github.com/NixOS/nixpkgs/blob/master/doc/stdenv/stdenv.chapter.md> 6 5 7 6 /// tools for transforming data, building derivations 8 7 mod core { ··· 10 9 11 10 // equivalent for flake 12 11 mod cristal { 13 - 12 + struct Shell { 13 + name: String, 14 + 15 + packages: ???, 16 + env: Env 17 + } 14 18 } 15 19 16 20 mod derivation { 17 21 struct Drv<I, O> { 18 22 pub meta: DrvMeta, 19 23 pub source: Source, 20 - pub plan: BuildPlan, 24 + pub plan: BuildPlan, // maybe we want to override that. no? 21 25 22 26 // this can be overridden when building 23 27 inputs: I, ··· 52 56 }, 53 57 } 54 58 55 - let my_bin = make_new_script { 59 + let my_bin = std::make_new_script { 56 60 name: "hello", 57 61 script: || { 58 62 let res = Command::new(whatever.bin.whatever).exec(); ··· 61 65 }, 62 66 }; 63 67 64 - let screenshot_bin = std::make_script("lock-screenshot.sh", || { 68 + let screenshot_bin = std::make_script("lock-screenshot", || { 65 69 let tmp_img = Cmd::new(coreutils.bin.mktemp).arg("/tmp/lock-bg.XXX").exec()?; 70 + // let tmp_img = shell!(coreutils.bin.mktemp "/tmp/lock-bg.XXX"); 66 71 67 72 // Give some time to hide the bar 68 73 std::sleep_milis(1);
+20 -9
examples/machine/cristal.rs
··· 1 1 //! This whole file is an experiment to show how I would translate my own Nix 2 2 //! laptop config available at <https://github.com/mrnossiom/dotfiles/blob/main/flake.nix> 3 3 4 + // # Imports 4 5 // this looks like deno http imports 5 6 // See <https://docs.deno.com/runtime/fundamentals/modules/#https-imports> 6 - use "github:nixos/nixpkgs/nixos-24.11" as nixpkgs; 7 - use "github:nixos/nixpkgs/nixos-unstable" as nixpkgs_unstable; 8 - use "github:nix-community/home-manager/release-24.11" as home_manager; 7 + // 8 + // versions of dependencies are frozen in a lockfile 9 + // 10 + // these are specified inline to avoid the need for 3 files (source, deps info, deps lock) 11 + 12 + use nixpkgs from "github:nixos/nixpkgs/nixos-24.11"; 13 + use nixpkgs_unstable from "github:nixos/nixpkgs/nixos-unstable"; 14 + use home_manager from "github:nix-community/home-manager/release-24.11"; 9 15 10 - // versions of dependencies are frozen in a lockfile 16 + use nix_darwin from "github:LnL7/nix-darwin"; 17 + use agenix from "github:ryantm/agenix"; 18 + use disko from "github:nix-community/disko"; 19 + use nixos_hardware from "github:nixos/nixos-hardware"; 11 20 12 - use "github:LnL7/nix-darwin" as nix_darwin; 13 - use "github:ryantm/agenix" as agenix; 14 - use "github:nix-community/disko" as disko; 15 - use "github:nixos/nixos-hardware" as nixos_hardware; 21 + // formatter is builtin 16 22 17 23 /// options definitions 18 24 mod options { 19 - mod machine {} 25 + mod machine { 26 + option Hello { 27 + 28 + } 29 + } 30 + 20 31 mod user {} 21 32 } 22 33
+33
examples/post-auvergne.rs
··· 1 + struct Derivation { 2 + meta: Meta, 3 + source: Source, 4 + steps: Array<BuildStep>, 5 + } 6 + 7 + 8 + struct Meta { 9 + name: String, 10 + version: Version, 11 + bin: ?BinInfo, 12 + } 13 + 14 + // struct Option {} 15 + 16 + // --- 17 + 18 + wakatime-ls := Derivation { 19 + meta: .{ 20 + name: "wakatime-ls", 21 + version: .from((0, 2, 0)), 22 + bin: { !wakatime-ls: "wakatime-ls" }, 23 + }, 24 + 25 + source: .github("mrnossiom", "wakatime-ls", "main"), 26 + 27 + steps: |src| [ 28 + std.rust.build(src) 29 + ], 30 + } 31 + 32 + // --- 33 +