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

View File

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

View File

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

View File

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

View File

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

View File

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