Removed Minimal Installer and rebuild script. Yay and new shell.nix cover their uses cases.
This commit is contained in:
parent
1bc6a348b0
commit
dfcf666a78
4 changed files with 0 additions and 281 deletions
62
installer/flake.lock
generated
62
installer/flake.lock
generated
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732645828,
|
||||
"narHash": "sha256-+4U2I2653JvPFxcux837ulwYS864QvEueIljUkwytsk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "869ba3a87486289a4197b52a6c9e7222edf00b3e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1732238832,
|
||||
"narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8edf06bea5bcbee082df1b7369ff973b91618b8d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1732350895,
|
||||
"narHash": "sha256-GcOQbOgmwlsRhpLGSwZJwLbo3pu9ochMETuRSS1xpz4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0c582677378f2d9ffcb01490af2f2c678dcb29d3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"disko": "disko",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
description = "Minimal NixOS configuration for bootstrapping systems";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
|
||||
# NOTE: Change when installing, hacky but whatever
|
||||
username = "toph";
|
||||
ARM = "aarch64-linux"; # ARM systems
|
||||
X86 = "x86_64-linux"; # x86_64 systems
|
||||
|
||||
minimalSpecialArgs = {
|
||||
inherit inputs outputs;
|
||||
lib = nixpkgs.lib.extend (
|
||||
self: super: { custom = import /home/${username}/git/Nix/dot.nix/lib { inherit (nixpkgs) lib; }; }
|
||||
);
|
||||
};
|
||||
|
||||
# This mkHost is way better: https://github.com/linyinfeng/dotfiles/blob/8785bdb188504cfda3daae9c3f70a6935e35c4df/flake/hosts.nix#L358
|
||||
newConfig =
|
||||
name: system:
|
||||
(nixpkgs.lib.nixosSystem {
|
||||
system = system;
|
||||
specialArgs = minimalSpecialArgs;
|
||||
modules = [
|
||||
./minimal-configuration.nix
|
||||
/home/${username}/git/Nix/dot.nix/hosts/nixos/${name}/hardware.nix
|
||||
{ networking.hostName = name; }
|
||||
];
|
||||
});
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
# host = newConfig "name"
|
||||
vm = newConfig "vm" X86;
|
||||
rune = newConfig "rune" X86;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = lib.flatten [
|
||||
(map lib.custom.relativeToRoot [
|
||||
"modules/common/host-spec.nix"
|
||||
"hosts/common/core/ssh.nix"
|
||||
"hosts/users/minimal"
|
||||
])
|
||||
];
|
||||
|
||||
# NOTE: Change when installing, hacky but whatever
|
||||
hostSpec = {
|
||||
isMinimal = lib.mkForce true;
|
||||
hostName = "installer";
|
||||
username = "toph";
|
||||
password = "[REDACTED]";
|
||||
isARM = false;
|
||||
};
|
||||
|
||||
# fileSystems."/boot".options = [ "umask=0077" ]; # Removes permissions and security warnings.
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
# boot.loader.systemd-boot = {
|
||||
# enable = true;
|
||||
# # we use Git for version control, so we don't need to keep too many generations.
|
||||
# configurationLimit = lib.mkDefault 3;
|
||||
# # pick the highest resolution for systemd-boot's console.
|
||||
# consoleMode = lib.mkDefault "max";
|
||||
# };
|
||||
boot.initrd = {
|
||||
systemd.enable = true;
|
||||
systemd.emergencyAccess = true; # Don't need to enter password in emergency mode
|
||||
};
|
||||
boot.kernelParams = [
|
||||
"systemd.setenv=SYSTEMD_SULOGIN_FORCE=1"
|
||||
"systemd.show_status=true"
|
||||
"systemd.log_level=debug"
|
||||
"systemd.log_target=console"
|
||||
"systemd.journald.forward_to_console=1"
|
||||
];
|
||||
|
||||
environment.systemPackages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
wget
|
||||
curl
|
||||
git
|
||||
;
|
||||
};
|
||||
|
||||
networking = {
|
||||
networkmanager.enable = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
qemuGuest.enable = true;
|
||||
openssh = {
|
||||
enable = true;
|
||||
ports = [ 22 ];
|
||||
settings.PermitRootLogin = lib.mkForce "yes";
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
#FIXME(installer): registry and nixPath shouldn't be required here because flakes but removal results in warning spam on build
|
||||
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
||||
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
|
||||
|
||||
settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
warn-dirty = false;
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
function red
|
||||
# Usage: red <message> [<command-string>]
|
||||
printf "\033[31m[!] %s \033[0m\n" $argv[1]
|
||||
if test (count $argv) -ge 2
|
||||
# If there's a second argument, we eval it and print in red as well
|
||||
printf "\033[31m[!] %s \033[0m\n" (eval "$argv[2]")
|
||||
end
|
||||
end
|
||||
|
||||
function green
|
||||
# Usage: green <message> [<command-string>]
|
||||
printf "\033[32m[+] %s \033[0m\n" $argv[1]
|
||||
if test (count $argv) -ge 2
|
||||
printf "\033[32m[+] %s \033[0m\n" (eval "$argv[2]")
|
||||
end
|
||||
end
|
||||
|
||||
function yellow
|
||||
# Usage: yellow <message> [<command-string>]
|
||||
printf "\033[33m[*] %s \033[0m\n" $argv[1]
|
||||
if test (count $argv) -ge 2
|
||||
printf "\033[33m[*] %s \033[0m\n" (eval "$argv[2]")
|
||||
end
|
||||
end
|
||||
|
||||
function clear_home_manager_backups
|
||||
yellow "====== CLEARING HOME-MANGER BACKUPS ======"
|
||||
set total_files (find ~/.config -type f -name "*.homeManagerBackupFileExtension" | wc -l)
|
||||
set counter 0
|
||||
|
||||
find ~/.config -type f -name "*.homeManagerBackupFileExtension" | while read -l file
|
||||
set counter (math $counter + 1)
|
||||
echo -n (printf "\rDeleting file %d of %d" $counter $total_files)
|
||||
rm $file
|
||||
end
|
||||
|
||||
echo # new line
|
||||
end
|
||||
|
||||
# Build switch arguments
|
||||
set switch_args "--show-trace" "--impure" "--flake"
|
||||
|
||||
# Check first argument
|
||||
if test (count $argv) -gt 0 -a "$argv[1]" = "trace"
|
||||
set switch_args $switch_args "--show-trace"
|
||||
else if test (count $argv) -gt 0
|
||||
set HOST $argv[1]
|
||||
else
|
||||
set HOST (hostname)
|
||||
end
|
||||
|
||||
clear_home_manager_backups
|
||||
|
||||
# Append flake and host switch
|
||||
set switch_args $switch_args ".#$HOST" "switch"
|
||||
|
||||
green "====== REBUILD ======"
|
||||
|
||||
# Check if `nh` exists
|
||||
if type -q nh
|
||||
set -x REPO_PATH (pwd)
|
||||
nh os switch . -- --impure --show-trace
|
||||
else
|
||||
sudo nixos-rebuild $switch_args
|
||||
end
|
||||
|
||||
# If successful
|
||||
if test $status -eq 0
|
||||
green "====== POST-REBUILD ======"
|
||||
green "Rebuilt successfully"
|
||||
|
||||
# Check for a clean git working directory
|
||||
if git diff --exit-code >/dev/null
|
||||
and git diff --staged --exit-code >/dev/null
|
||||
# Check if the current HEAD commit is already tagged as buildable
|
||||
if git tag --points-at HEAD | grep -q buildable
|
||||
yellow "Current commit is already tagged as buildable"
|
||||
else
|
||||
git tag buildable-(date +%Y%m%d%H%M%S) -m ''
|
||||
green "Tagged current commit as buildable"
|
||||
end
|
||||
else
|
||||
yellow "WARN: There are pending changes that would affect the build succeeding. Commit them before tagging"
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue