From 3cf719b609d8c0db2f5cc74be04f977c4e6c54c6 Mon Sep 17 00:00:00 2001 From: geekiot Date: Sat, 27 Sep 2025 17:42:32 +0500 Subject: [PATCH] add (geekiot fully): add geekiot full (without old hm stuff) configuration --- devices/thinkbook/default.nix | 16 +++++--- devices/thinkbook/hardware-configuration.nix | 41 +++++++++++++++++++ flake.nix | 28 ++++++++++++- users/geekiot/{data.nix => data/default.nix} | 7 ++++ users/geekiot/home/default.nix | 12 ++++-- users/geekiot/home/env.nix | 2 + .../default.nix} | 0 users/geekiot/scripts/default.nix | 41 +++++++++++++++++++ 8 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 devices/thinkbook/hardware-configuration.nix rename users/geekiot/{data.nix => data/default.nix} (67%) rename users/geekiot/{packages_config.nix => packages/default.nix} (100%) create mode 100644 users/geekiot/scripts/default.nix diff --git a/devices/thinkbook/default.nix b/devices/thinkbook/default.nix index 2b8d47f..e7e4d79 100644 --- a/devices/thinkbook/default.nix +++ b/devices/thinkbook/default.nix @@ -1,9 +1,15 @@ -{ customFunctions, ... }: { - imports = customFunctions.scan { - path = ./.; - exclude = [ ./default.nix ]; - }; + inputs, + customFunctions, + ... +}: +{ + imports = + customFunctions.scan { + path = ./.; + exclude = [ ./default.nix ]; + } + ++ [ inputs.nixos-hardware.nixosModules.common-cpu-intel ]; device.laptop = { enable = true; diff --git a/devices/thinkbook/hardware-configuration.nix b/devices/thinkbook/hardware-configuration.nix new file mode 100644 index 0000000..f934e58 --- /dev/null +++ b/devices/thinkbook/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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 = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/622c5b1c-cfd5-4842-b3bc-cd41e83b7705"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-49809cac-4c02-4ade-ae03-5a5ae88862db".device = "/dev/disk/by-uuid/49809cac-4c02-4ade-ae03-5a5ae88862db"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/075D-5E04"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/flake.nix b/flake.nix index 39a36bb..07d5275 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,18 @@ # Source: https://github.com/Mic92/sops-nix sops-nix.url = "github:mic92/sops-nix"; + + # Source: https://github.com/nix-community/nix-vscode-extensions + nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; + + # Source: https://github.com/catppuccin/nix + catppuccin.url = "github:catppuccin/nix"; + + # Source: https://github.com/helix-editor/helix + helix.url = "github:helix-editor/helix"; + + # Source: https://github.com/zedless-editor/zedless + zedless-editor.url = "github:zedless-editor/zedless"; }; outputs = @@ -28,9 +40,21 @@ ... }@inputs: let - # + makeConfig = import ./lib/config.nix { + inherit + inputs + nixpkgs + nixpkgs-old + nixpkgs-latest + ; + }; in { - # + nixosConfigurations.book = makeConfig "thinkbook" { + hostName = "book"; + userName = "geekiot"; + additionalOverlays = [ inputs.nix-vscode-extensions.overlays.default ]; + systemArch = "x86_64-linux"; + }; }; } diff --git a/users/geekiot/data.nix b/users/geekiot/data/default.nix similarity index 67% rename from users/geekiot/data.nix rename to users/geekiot/data/default.nix index 1893e1e..9d92402 100644 --- a/users/geekiot/data.nix +++ b/users/geekiot/data/default.nix @@ -17,7 +17,14 @@ in paths = { inherit homeDir; configDir = "${homeDir}/NewProjects/nixos-config"; + downloadsDir = "${homeDir}/Downloads"; + sshDir = "${homeDir}/.ssh"; + gpgDir = "${homeDir}/.security/gpg"; sopsKeyFile = "${homeDir}/.security/sops/age/keys.txt"; }; + + device = { + inherit deviceName hostName systemArch; + }; } diff --git a/users/geekiot/home/default.nix b/users/geekiot/home/default.nix index 272d3f5..791aef0 100644 --- a/users/geekiot/home/default.nix +++ b/users/geekiot/home/default.nix @@ -1,13 +1,19 @@ { userData, customFunctions, ... }: +let + username = userData.info.userName; + homeDirectory = userData.paths.homeDir; +in { imports = customFunctions.scan { path = ./.; - exclude = [ ./default.nix ]; + exclude = [ + ./default.nix + ./web/librewolf/extensions/addons.nix + ]; }; home = { - username = userData.info.userName; - homeDirectory = userData.paths.homeDir; + inherit username homeDirectory; stateVersion = "25.05"; sessionVariables = { CONFIG = userData.paths.configDir; diff --git a/users/geekiot/home/env.nix b/users/geekiot/home/env.nix index e69de29..2c63c08 100644 --- a/users/geekiot/home/env.nix +++ b/users/geekiot/home/env.nix @@ -0,0 +1,2 @@ +{ +} diff --git a/users/geekiot/packages_config.nix b/users/geekiot/packages/default.nix similarity index 100% rename from users/geekiot/packages_config.nix rename to users/geekiot/packages/default.nix diff --git a/users/geekiot/scripts/default.nix b/users/geekiot/scripts/default.nix new file mode 100644 index 0000000..57e0017 --- /dev/null +++ b/users/geekiot/scripts/default.nix @@ -0,0 +1,41 @@ +pkgs: { + updateSystem = + configPath: secretsPath: + pkgs.writeShellScriptBin "updateSystem" '' + #!/bin/bash + + export my_wd=$PWD + cd ${configPath} + + if [ ! -d "${secretsPath}" ]; then + echo "!!! Error !!! NixConfigSecrets directory not found in ${configPath}" + cd $my_wd + unset my_wd + exit 1 + fi + + if [ -z "$(find NixConfigSecrets -maxdepth 1 -name '*.yaml' -print -quit)" ]; then + echo "!!! Error !!! No .yaml files found in NixConfigSecrets directory" + cd $my_wd + unset my_wd + exit 1 + fi + + mkdir secrets + cp -r NixConfigSecrets/*.yaml secrets/ + git add secrets/*.yaml + + if sudo nixos-rebuild switch --flake . "$@"; then + echo "Success: System successfully updated with new configuration" + else + echo "!!! Failure !!! Failed to apply NixOS configuration" + echo "System version remains unchanged" + fi + + git reset secrets/*.yaml + rm secrets/*.yaml + rm -d secrets + cd $my_wd + unset my_wd + ''; +}