Update installer for sparse checkout

This commit is contained in:
iFargle 2023-10-04 19:51:02 +09:00
parent 7f278dcb03
commit ae8398e05e
8 changed files with 72 additions and 6 deletions

View file

@ -22,8 +22,6 @@ jobs:
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
git config --global user.email "${{github.actor}}"
git config --global user.name "Albert J. Copeland"
echo "TEST: ${{ secrets.TEST_SECRET }}"
echo "TOKEN: ${{ secrets.GITHUB_TOKEN }}"
- uses: https://code.forgejo.org/actions/checkout@v3
with:
sparse-checkout: |

View file

@ -9,6 +9,13 @@ nixos-install <Hostname> [<Username>]
```
nix develop -c /etc/nixos/git/docs/setup.sh
```
* Sparse Checkout (for low RAM environments):
```
git clone --filter=blob:none --no-checkout https://git.sysctl.io/albert/nix git/
cd git/
git sparse-checkout set --cone docs/ home-manager/ keys/ssh/ lib/ nixos/ flake.lock flake.nix shell.nix
git checkout main
```
![Gruv'd Hyprland](./docs/screenshot.png "Hyprland with a Gruvboxy theme")
---

View file

@ -37,6 +37,7 @@
in {
nixosConfigurations = {
# Virtual Machines
osaka-vultr-01 = lib.mkMinHost { hostname = "osaka-vultr-01"; };
nixos-vm-01 = libx.mkHost { hostname = "nixos-vm-01"; };
nixos-vm-02 = libx.mkHost { hostname = "nixos-vm-02"; desktop = "hyprland"; gpu = "intel"; theme = "gruvbox"; };
# Physical Machines
@ -46,7 +47,6 @@
nixos-rpi4-02 = libx.mkHost { hostname = "nixos-rpi4-02"; platform = "aarch64-linux"; };
nixos-rpi4-03 = libx.mkHost { hostname = "nixos-rpi4-03"; platform = "aarch64-linux"; };
};
homeConfigurations = {
# Virtual Machines
"albert@nixos-vm-01" = libx.mkHome { hostname = "nixos-vm-01"; };

View file

@ -32,6 +32,22 @@
];
};
# Helper function for generating host configs
mkHost = {
hostname,
username ? "albert",
desktop ? null,
gpu ? null,
platform ? "x86_64-linux",
theme ? "default"
}: inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu platform theme; };
modules = [
../nixos/minimal.nix
inputs.sops-nix.nixosModules.sops
];
};
# Combines mkHost and mkHome for image building
mkImage = {
hostname ,

View file

@ -15,10 +15,13 @@ if [ "$(id -u)" -eq 0 ]; then
fi
if [ ! -d "/tmp/nixos/git/.git" ]; then
git clone https://git.sysctl.io/albert/nix "/tmp/nixos/git"
git clone --filter=blob:none --no-checkout https://git.sysctl.io/albert/nix "/tmp/nixos/git"
cd /tmp/nixos/git
git sparse-checkout set --cone docs/ home-manager/ keys/ssh/ lib/ nixos/ flake.lock flake.nix shell.nix
git checkout main
fi
pushd "/tmp/nixos/git"
pushd /tmp/nixos/git
if [[ -z "$TARGET_HOST" ]]; then
echo "ERROR! $(basename "$0") requires a hostname as the first argument"

View file

@ -13,7 +13,7 @@
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
time.timeZone = "Asia/Tokyo";
networking.hostName = "nixos-osaka-vultr-01";
networking.hostName = "osaka-vultr-01";
boot.loader.grub = {
enableCryptodisk = true;

42
nixos/vultr.nix Normal file
View file

@ -0,0 +1,42 @@
{ lib, config, pkgs, hostname, stateVersion, username, desktop, gpu, inputs, platform, theme, ... }: {
imports = [
# Services
./common/services/openssh.nix
./common/services/fail2ban.nix
# NixOS Modules
./common/modules/networking.nix # Initial Networking configs
./common/modules/nixos.nix # NixOS related items
./users/${username}
./hosts/${hostname}
];
# List packages installed in system profile
environment.systemPackages = with pkgs; [
curl
rsync
git
duf
ncdu
du-dust
sops
gnupg
];
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
system.stateVersion = stateVersion;
}