format_demo/
format_demo.rs1use guix_scheme::os_builder::{FsDevice, OsBuilder, OsFlavor};
2use guix_scheme::{Channel, ChannelsFile};
3
4fn main() {
5 let os = OsBuilder::new(
6 OsFlavor::Panther,
7 "panther-box",
8 "Europe/Berlin",
9 "en_US.utf8",
10 )
11 .keyboard_layout("us", None)
12 .bootloader_efi("/boot/efi")
13 .file_system("/", FsDevice::Label("my-root".into()), "ext4", false)
14 .file_system(
15 "/boot/efi",
16 FsDevice::UuidWithType("ABCD-1234".into(), "fat32".into()),
17 "vfat",
18 false,
19 )
20 .user("panther", "panther's account", &["wheel", "audio", "video"])
21 .packages_field("%os-desktop-packages")
22 .services_field("%os-desktop-services")
23 .extra_field("swap-devices", "(list (swap-space (target \"/swapfile\")))")
24 .build();
25 println!("=== system.scm ===\n{os}");
26
27 let mut cf = ChannelsFile::parse("%default-channels").unwrap();
28 cf.add_channel(&Channel {
29 name: "pantherx".into(),
30 url: "https://codeberg.org/gofranz/panther.git".into(),
31 branch: Some("master".into()),
32 commit: None,
33 introduction_commit: Some("54b4056ac571611892c743b65f4c47dc298c49da".into()),
34 introduction_fingerprint: Some("A36A D41E ECC7 A871 1003 5D24 524F EB1A 9D33 C9CB".into()),
35 })
36 .unwrap();
37 println!("=== channels.scm (from bare %default-channels) ===\n{cf}");
38
39 let src = ";; my channels\n(list\n ;; the guix channel\n (channel\n (name 'guix)\n (url \"https://git.savannah.gnu.org/git/guix.git\")))\n";
40 let mut cf2 = ChannelsFile::parse(src).unwrap();
41 cf2.add_channel(&Channel {
42 name: "nonguix".into(),
43 url: "https://gitlab.com/nonguix/nonguix".into(),
44 branch: None,
45 commit: None,
46 introduction_commit: Some("897c1a470da759236cc11798f4e0a5f7d4d59fbc".into()),
47 introduction_fingerprint: Some("2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5".into()),
48 })
49 .unwrap();
50 println!("=== channels.scm (appended to commented list) ===\n{cf2}");
51}