Maybe this

This commit is contained in:
2026-01-22 12:18:43 -07:00
parent 6ec023f040
commit f894a9eeec
9 changed files with 15 additions and 115 deletions

3
.gitignore vendored
View File

@@ -1,3 +0,0 @@
# User-specific configuration (generated by make init)
settings.nix
hardware-configuration.nix

View File

@@ -1,9 +1,7 @@
.PHONY: init install link unlink rebuild update purge edit help
.PHONY: install link unlink rebuild update purge help
NIXOS_DIR := /etc/nixos
REPO_DIR := $(shell pwd)
SETTINGS := settings.nix
# Colors for output
GREEN := \033[0;32m
YELLOW := \033[0;33m
@@ -13,19 +11,11 @@ NC := \033[0m # No Color
help:
@echo "NixOS Config"
@echo ""
@echo " make init - first time setup"
@echo " make rebuild - rebuild nixos"
@echo " make update - upgrade + rebuild"
@echo " make purge - garbage collect"
@echo " make link - symlink to /etc/nixos"
@echo " make unlink - remove symlink"
@echo " make edit - edit settings.nix"
init:
@./scripts/init.sh
@$(MAKE) --no-print-directory link
@echo ""
@echo "done. run 'make rebuild' when ready"
link:
@if [ -L "$(NIXOS_DIR)" ]; then \
@@ -59,6 +49,3 @@ purge:
check:
nixos-rebuild build --flake . --dry-run
edit:
@$${EDITOR:-nano} $(SETTINGS)

View File

@@ -16,13 +16,12 @@
outputs = { self, nixpkgs, home-manager, hyprland, stylix, ... }@inputs:
let
settings = import ./settings.nix;
system = "x86_64-linux";
lib = nixpkgs.lib;
in
{
nixosConfigurations = {
"${settings.hostname}" = lib.nixosSystem {
"lavitz" = lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [
@@ -32,8 +31,8 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."${settings.username}" = {
home.stateVersion = "24.05";
home-manager.users."atridad" = {
home.stateVersion = "25.11";
};
home-manager.extraSpecialArgs = { inherit inputs; };
}

View File

@@ -1,12 +1,9 @@
{ config, pkgs, ... }:
let
settings = import ../settings.nix;
in
{
# Time zone
time.timeZone = settings.timezone;
time.timeZone = "America/Edmonton";
# Internationalization properties
i18n.defaultLocale = settings.locale;
}
i18n.defaultLocale = "en_CA.UTF-8";
}

View File

@@ -1,10 +1,7 @@
{ config, pkgs, ... }:
let
settings = import ../settings.nix;
in
{
networking.hostName = settings.hostname;
networking.hostName = "lavitz";
networking.networkmanager = {
enable = true;

View File

@@ -1,14 +1,11 @@
{ config, pkgs, ... }:
let
settings = import ../settings.nix;
in
{
# Enable unfree globally
nixpkgs.config.allowUnfree = true;
environment.variables.BROWSER = "librewolf";
environment.variables.SSH_AUTH_SOCK = "/home/${settings.username}/.bitwarden-ssh-agent.sock";
environment.variables.SSH_AUTH_SOCK = "/home/user/.bitwarden-ssh-agent.sock";
environment.systemPackages =
with pkgs; [
@@ -71,9 +68,9 @@ in
enable = true;
config = {
user = {
name = "${settings.gitName}";
email = "${settings.gitEmail}";
signingkey = "${settings.gitKey}";
name = "User Name";
email = "user@email.com";
signingkey = "ssh-ed25519 ...";
};
gpg.format = "ssh";
commit.gpgsign = true;

View File

@@ -1,15 +1,12 @@
{ config, pkgs, ... }:
let
settings = import ../settings.nix;
in
{
users.groups.plugdev.gid = 69420;
users.users.${settings.username} = {
users.users.user = {
isNormalUser = true;
description = settings.userDescription;
extraGroups = settings.userGroups;
description = "Atridad";
extraGroups = [ "networkmanager" "wheel" "docker" "plugdev" ];
};
# Security

View File

@@ -1,60 +0,0 @@
#!/usr/bin/env bash
SETTINGS="settings.nix"
REPO_DIR=$(pwd)
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# 1. Generate settings.nix
if [ -f "$SETTINGS" ]; then
echo -e "${YELLOW}settings.nix exists. overwrite? [y/N]${NC}"
read -r confirm
if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
echo "keeping existing settings"
else
GENERATE=true
fi
else
GENERATE=true
fi
if [ "$GENERATE" = true ]; then
username=$(whoami)
userdesc=$(getent passwd "$username" | cut -d: -f5 | cut -d, -f1)
userdesc=${userdesc:-$username}
echo "user: $username ($userdesc)"
echo ""
echo "hostname:"
read -r hostname
echo "timezone [America/Edmonton]:"
read -r tz
tz=${tz:-America/Edmonton}
echo "locale [en_CA.UTF-8]:"
read -r locale
locale=${locale:-en_CA.UTF-8}
echo ""
echo "{" > "$SETTINGS"
echo " hostname = \"$hostname\";" >> "$SETTINGS"
echo " username = \"$username\";" >> "$SETTINGS"
echo " userDescription = \"$userdesc\";" >> "$SETTINGS"
echo " timezone = \"$tz\";" >> "$SETTINGS"
echo " locale = \"$locale\";" >> "$SETTINGS"
echo " userGroups = [ \"networkmanager\" \"wheel\" \"docker\" \"plugdev\" ];" >> "$SETTINGS"
echo "}" >> "$SETTINGS"
echo "wrote $SETTINGS"
fi
# 2. Copy hardware-configuration.nix
if [ -f "/etc/nixos/hardware-configuration.nix" ]; then
cp /etc/nixos/hardware-configuration.nix "$REPO_DIR/hardware-configuration.nix"
echo "copied hardware-configuration.nix"
else
echo -e "${YELLOW}no hardware-configuration.nix found - run nixos-generate-config first${NC}"
fi

View File

@@ -1,11 +0,0 @@
{
hostname = "nixos";
username = "user";
userDescription = "User";
timezone = "America/Edmonton";
locale = "en_CA.UTF-8";
userGroups = [ "networkmanager" "wheel" "docker" "plugdev" ];
gitName = "User Name";
gitEmail = "user@email.com";
gitKey = "ssh-ed25519 ...";
}