Compare commits

...

3 Commits

Author SHA1 Message Date
40343553ee Merge pull request 'Move to flakes ❄️' (#1) from flake into main
Reviewed-on: #1
2026-02-04 22:49:39 +00:00
e58683ffce 1770244892 2026-02-04 15:41:32 -07:00
d80a9be891 Flake Experiment 2026-02-04 14:58:17 -07:00
7 changed files with 144 additions and 12 deletions

1
.gitignore vendored
View File

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

View File

@@ -3,6 +3,7 @@
NIXOS_DIR := /etc/nixos
REPO_DIR := $(shell pwd)
SETTINGS := settings.nix
HOSTNAME := $(shell grep 'hostname =' $(SETTINGS) | cut -d '"' -f 2)
# Colors for output
GREEN := \033[0;32m
@@ -11,12 +12,12 @@ RED := \033[0;31m
NC := \033[0m # No Color
help:
@echo "NixOS Config"
@echo "NixOS Config (Flake)"
@echo ""
@echo " make init - first time setup"
@echo " make hw - generate hardware-configuration.nix"
@echo " make rebuild - rebuild nixos"
@echo " make update - upgrade + rebuild"
@echo " make rebuild - rebuild nixos configuration"
@echo " make update - update flake inputs and rebuild"
@echo " make purge - garbage collect"
@echo " make link - symlink to /etc/nixos"
@echo " make unlink - remove symlink"
@@ -48,17 +49,24 @@ unlink:
fi
rebuild:
sudo nixos-rebuild switch
@# Ensure hardware-configuration.nix is tracked by git (flake requirement), even if ignored
@if [ -f hardware-configuration.nix ]; then \
git add -f -N hardware-configuration.nix; \
fi
@echo "Rebuilding system for $(HOSTNAME)..."
sudo nixos-rebuild switch --flake .#$(HOSTNAME)
update:
sudo nixos-rebuild switch --upgrade
@echo "Updating flake inputs..."
nix flake update
@$(MAKE) --no-print-directory rebuild
purge:
sudo nix-collect-garbage -d
sudo /run/current-system/bin/switch-to-configuration boot
check:
nix-instantiate '<nixpkgs/nixos>' -A system --dry-run
nix flake check
hw:
sudo nixos-generate-config --show-hardware-config > hardware-configuration.nix

22
common.nix Normal file
View File

@@ -0,0 +1,22 @@
{ config, pkgs, ... }:
{
imports = [
# Import Modules
./modules/boot.nix
./modules/networking.nix
./modules/locale.nix
./modules/desktop.nix
./modules/audio.nix
./modules/users.nix
./modules/programs.nix
./modules/hardware.nix
./modules/services.nix
./modules/home.nix
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# xdg.portal.config.common.default = [ "gnome" ];
system.stateVersion = "25.11";
}

49
flake.lock generated Normal file
View File

@@ -0,0 +1,49 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1769580047,
"narHash": "sha256-tNqCP/+2+peAXXQ2V8RwsBkenlfWMERb+Uy6xmevyhM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "366d78c2856de6ab3411c15c1cb4fb4c2bf5c826",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.11",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1770136044,
"narHash": "sha256-tlFqNG/uzz2++aAmn4v8J0vAkV3z7XngeIIB3rM3650=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e576e3c9cf9bad747afcddd9e34f51d18c855b4e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

26
flake.nix Normal file
View File

@@ -0,0 +1,26 @@
{
description = "NixOS Configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
settings = import ./settings.nix;
system = "x86_64-linux";
in {
nixosConfigurations."${settings.hostname}" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
];
};
};
}

View File

@@ -0,0 +1,33 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/1d9c0c94-23d1-4acf-8e68-39cec48dc75a";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/AE5D-3C23";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/59acaf1c-702d-4547-a118-d8b5b16009a8"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,7 +1,6 @@
{ config, pkgs, ... }:
let
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz";
settings = import ../settings.nix;
homeModules = [
./home/session.nix
@@ -16,10 +15,6 @@ let
];
in
{
imports = [
(import "${home-manager}/nixos")
];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;