mirror of
https://gitlab.com/ahoneybun/nyxi-installer.git
synced 2025-05-13 03:23:01 -06:00
Compare commits
1 commit
400b71ecde
...
93784380ca
Author | SHA1 | Date | |
---|---|---|---|
![]() |
93784380ca |
6 changed files with 43 additions and 217 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,14 +1,8 @@
|
||||||
# Rust/Carge
|
|
||||||
/target
|
/target
|
||||||
|
|
||||||
# Nix
|
|
||||||
result
|
|
||||||
|
|
||||||
# Main nix files
|
# Main nix files
|
||||||
flake.nix
|
flake.nix
|
||||||
configuration.nix
|
configuration.nix
|
||||||
home.nix
|
home.nix
|
||||||
|
|
||||||
# Extra nix files
|
# Extra nix files
|
||||||
garrus.nix
|
garrus.nix
|
||||||
gnome.nix
|
gnome.nix
|
||||||
|
|
40
README.md
40
README.md
|
@ -16,16 +16,34 @@ This sets the hashedPassword to my own so you will need to update it to match yo
|
||||||
mkpasswd -m sha-512
|
mkpasswd -m sha-512
|
||||||
```
|
```
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
1. Boot from a live disk of NixOS (ideally the minimal image)
|
|
||||||
2. Connect to network
|
|
||||||
3. Download from the releases page using curl
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl $PATH
|
|
||||||
```
|
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
|
|
||||||

|
## Clone the repository
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://gitlab.com/ahoneybun/nyxi-installer.git
|
||||||
|
```
|
||||||
|
|
||||||
|
## Enter the repository that you just cloned
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd nyxi-installer
|
||||||
|
```
|
||||||
|
|
||||||
|
## Enter nix-shell
|
||||||
|
|
||||||
|
This is if you are already running NixOS on your system where development will take place. This will install the needed system packages, set environment variables and such for development.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix-shell
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building and testing
|
||||||
|
|
||||||
|
You can use normal `cargo` commands like:
|
||||||
|
|
||||||
|
- `cargo test`
|
||||||
|
- `cargo build`
|
||||||
|
- `cargo run`
|
||||||
|
|
||||||
|
**NOTE:** you will need to build the program and run it with `sudo` currently so `cargo run` is not the best for testing.
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Development
|
|
||||||
|
|
||||||
## Clone the repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://gitlab.com/ahoneybun/nyxi-installer.git
|
|
||||||
```
|
|
||||||
|
|
||||||
## Enter the repository that you just cloned
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd nyxi-installer
|
|
||||||
```
|
|
||||||
|
|
||||||
## Enter nix-shell
|
|
||||||
|
|
||||||
This is if you are already running NixOS or using the `nix` packagemanager on your system where development will take place. This will install the needed system packages, set environment variables and such for development.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix-shell
|
|
||||||
```
|
|
||||||
|
|
||||||
## Ubuntu
|
|
||||||
|
|
||||||
Install these packages for developing using `apt`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install build-essential pkg-config libcurl4-openssl-dev libfdisk-dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building and testing
|
|
||||||
|
|
||||||
You can use normal `cargo` commands like:
|
|
||||||
|
|
||||||
- `cargo test`
|
|
||||||
- `cargo build`
|
|
||||||
- `cargo run`
|
|
||||||
|
|
||||||
**NOTE:** you will need to build the program and run it with `sudo` currently so `cargo run` is not the best for testing.
|
|
96
flake.lock
generated
96
flake.lock
generated
|
@ -1,96 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"naersk": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1743800763,
|
|
||||||
"narHash": "sha256-YFKV+fxEpMgP5VsUcM6Il28lI0NlpM7+oB1XxbBAYCw=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"rev": "ed0232117731a4c19d3ee93aa0c382a8fe754b01",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1744536153,
|
|
||||||
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1744536153,
|
|
||||||
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"naersk": "naersk",
|
|
||||||
"nixpkgs": "nixpkgs_2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
40
flake.nix
40
flake.nix
|
@ -1,40 +0,0 @@
|
||||||
{
|
|
||||||
description = "Flake to build and develop Nyxi";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
naersk.url = "github:nix-community/naersk";
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, flake-utils, naersk, nixpkgs }:
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
|
||||||
let
|
|
||||||
pkgs = (import nixpkgs) {
|
|
||||||
inherit system;
|
|
||||||
};
|
|
||||||
|
|
||||||
naersk' = pkgs.callPackage naersk {};
|
|
||||||
|
|
||||||
# Setting variables that everything uses
|
|
||||||
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
|
||||||
CLANG_PATH = "${pkgs.llvmPackages.clang}/bin/clang";
|
|
||||||
|
|
||||||
in rec {
|
|
||||||
# For `nix build` & `nix run`:
|
|
||||||
defaultPackage = naersk'.buildPackage {
|
|
||||||
inherit LIBCLANG_PATH CLANG_PATH;
|
|
||||||
buildInputs = with pkgs; [ pkg-config openssl ];
|
|
||||||
nativeBuildInputs = with pkgs; [ util-linux.dev ];
|
|
||||||
src = ./.;
|
|
||||||
};
|
|
||||||
|
|
||||||
# For `nix develop` (optional, can be skipped):
|
|
||||||
devShell = pkgs.mkShell {
|
|
||||||
inherit LIBCLANG_PATH CLANG_PATH;
|
|
||||||
buildInputs = with pkgs; [ pkg-config openssl ];
|
|
||||||
nativeBuildInputs = with pkgs; [ rustc cargo util-linux.dev ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
37
src/main.rs
37
src/main.rs
|
@ -40,6 +40,11 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
|
||||||
let root = Partition::builder()
|
let root = Partition::builder()
|
||||||
.partition_type(partition_type)
|
.partition_type(partition_type)
|
||||||
.name("Root")
|
.name("Root")
|
||||||
|
// Flash drive testing
|
||||||
|
//.size_in_sectors(121_634_816)
|
||||||
|
// Internal drive testing
|
||||||
|
.size_in_sectors(499_033_071_61)
|
||||||
|
// replace static int with a variable
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let _ = disk.partition_add(root)?;
|
let _ = disk.partition_add(root)?;
|
||||||
|
@ -50,6 +55,8 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_partitions(drive_name: &str) {
|
fn format_partitions(drive_name: &str) {
|
||||||
|
let efi_number = "p1";
|
||||||
|
let root_number = "p2";
|
||||||
let efi_path = format!("{}p1", drive_name);
|
let efi_path = format!("{}p1", drive_name);
|
||||||
let root_path = format!("{}p2", drive_name);
|
let root_path = format!("{}p2", drive_name);
|
||||||
|
|
||||||
|
@ -228,17 +235,6 @@ fn main() {
|
||||||
.output()
|
.output()
|
||||||
.expect("Failed to move nix files over");
|
.expect("Failed to move nix files over");
|
||||||
|
|
||||||
// Fixes a security issue with boot
|
|
||||||
let _boot_fix = Command::new("sed")
|
|
||||||
.arg("-i")
|
|
||||||
.arg(r#"/fsType = "vfat"/ {
|
|
||||||
n
|
|
||||||
s/\(options = \[.*\)\]/\1"umask=0077 "]/
|
|
||||||
}"#)
|
|
||||||
.arg("/mnt/etc/nixos/hardware-configuration.nix")
|
|
||||||
.output()
|
|
||||||
.expect("Failed to apply boot fix");
|
|
||||||
|
|
||||||
// Host selection
|
// Host selection
|
||||||
loop {
|
loop {
|
||||||
println!("");
|
println!("");
|
||||||
|
@ -246,7 +242,8 @@ fn main() {
|
||||||
println!("---------------");
|
println!("---------------");
|
||||||
println!("");
|
println!("");
|
||||||
println!("1. Lemur Pro 13 (Garrus)");
|
println!("1. Lemur Pro 13 (Garrus)");
|
||||||
println!("2. Generic");
|
println!("2. Device 2");
|
||||||
|
println!("3. Quit");
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
println!("Enter your host for installation:");
|
println!("Enter your host for installation:");
|
||||||
|
@ -291,18 +288,10 @@ fn main() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
"2" => {
|
"2" => {
|
||||||
let mut nixos_install = Command::new("nixos-install")
|
println!("Nix the world!");
|
||||||
.arg("--flake")
|
},
|
||||||
.arg("/mnt/etc/nixos#nixos")
|
"3" => {
|
||||||
.arg("--no-root-passwd")
|
println!("Goodbye!");
|
||||||
.stdout(Stdio::inherit())
|
|
||||||
.stderr(Stdio::inherit())
|
|
||||||
.spawn()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let install_status = nixos_install.wait();
|
|
||||||
println!("Exited with status {:?}", install_status);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
_ => println!("Invalid choice, try again."),
|
_ => println!("Invalid choice, try again."),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue