diff --git a/.sops.yaml b/.sops.yaml index fc077f4..048e0db 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -46,7 +46,7 @@ creation_rules: key_groups: - age: - *user_mini_watcher - - path_regex: modules/system/common/secrets.yaml$ + - path_regex: modules/hosts/common/secrets.yaml$ key_groups: - age: - *system_hetznix01 diff --git a/2024-12-rework/.gitignore b/2024-12-rework/.gitignore new file mode 100644 index 0000000..e370078 --- /dev/null +++ b/2024-12-rework/.gitignore @@ -0,0 +1,2 @@ +result/ +result diff --git a/2024-12-rework/configuration.nix b/2024-12-rework/configuration.nix new file mode 100644 index 0000000..5d52004 --- /dev/null +++ b/2024-12-rework/configuration.nix @@ -0,0 +1,25 @@ +{ inputs, pkgs, ... }: { + imports = [ + ./hardware-configuration.nix + ]; + + system.stateVersion = "23.05"; + + boot = { + initrd.systemd = { + enable = true; + network.wait-online.enable = false; # Handled by NetworkManager + }; + loader = { + efi.canTouchEfiVariables = true; + systemd-boot= { + enable = true; + consoleMode = "1"; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + olm + ]; +} \ No newline at end of file diff --git a/2024-12-rework/flake.lock b/2024-12-rework/flake.lock new file mode 100644 index 0000000..49ad4fd --- /dev/null +++ b/2024-12-rework/flake.lock @@ -0,0 +1,183 @@ +{ + "nodes": { + "config": { + "locked": { + "dir": "templates/config", + "lastModified": 1719931926, + "narHash": "sha256-B8j9lHX0LqWlZkm8JxZRN6919RQjJEu/1J1SR8pU/ww=", + "owner": "stackbuilders", + "repo": "nixpkgs-terraform", + "rev": "034287ee462c87dadc14a94d4b53a48ed66c7b3d", + "type": "github" + }, + "original": { + "dir": "templates/config", + "owner": "stackbuilders", + "repo": "nixpkgs-terraform", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733050161, + "narHash": "sha256-lYnT+EYE47f5yY3KS/Kd4pJ6CO9fhCqumkYYkQ3TK20=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "62d536255879be574ebfe9b87c4ac194febf47c5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1733120037, + "narHash": "sha256-En+gSoVJ3iQKPDU1FHrR6zIxSLXKjzKY+pnh9tt+Yts=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f9f0d5c5380be0a599b1fb54641fa99af8281539", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-1_0": { + "locked": { + "lastModified": 1699291058, + "narHash": "sha256-5ggduoaAMPHUy4riL+OrlAZE14Kh7JWX4oLEs22ZqfU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "41de143fda10e33be0f47eab2bfe08a50f234267", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "41de143fda10e33be0f47eab2bfe08a50f234267", + "type": "github" + } + }, + "nixpkgs-1_6": { + "locked": { + "lastModified": 1712757991, + "narHash": "sha256-kR7C7Fqt3JP40h0mzmSZeWI5pk1iwqj4CSeGjnUbVHc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d6b3ddd253c578a7ab98f8011e59990f21dc3932", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d6b3ddd253c578a7ab98f8011e59990f21dc3932", + "type": "github" + } + }, + "nixpkgs-1_9": { + "locked": { + "lastModified": 1732617236, + "narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + } + }, + "nixpkgs-terraform": { + "inputs": { + "config": "config", + "flake-parts": "flake-parts", + "nixpkgs-1_0": "nixpkgs-1_0", + "nixpkgs-1_6": "nixpkgs-1_6", + "nixpkgs-1_9": "nixpkgs-1_9", + "systems": "systems" + }, + "locked": { + "lastModified": 1732844581, + "narHash": "sha256-BwHD1d6Bl5LL/HciTf+mQmBN3I3S6nYqcB+5BXVozNk=", + "owner": "stackbuilders", + "repo": "nixpkgs-terraform", + "rev": "b4db1b59d8f62cd37b6f9540e368d0e2627c4a2d", + "type": "github" + }, + "original": { + "owner": "stackbuilders", + "repo": "nixpkgs-terraform", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-terraform": "nixpkgs-terraform" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/2024-12-rework/flake.nix b/2024-12-rework/flake.nix new file mode 100644 index 0000000..394abbb --- /dev/null +++ b/2024-12-rework/flake.nix @@ -0,0 +1,30 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + + home-manager = { + url = "github:nix-community/home-manager/release-24.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixpkgs-terraform = { + url = "github:stackbuilders/nixpkgs-terraform"; + # inputs.nixpkgs-1_6.follows = "nixpkgs"; + # inputs.nixpkgs-1_9.follows = "nixpkgs-unstable"; + }; + }; + + outputs = inputs: { + nixosConfigurations = { + rainbow-planet = inputs.nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ./nixpkgs-settings.nix + inputs.home-manager.nixosModules.home-manager + ]; + }; + }; + }; +} diff --git a/2024-12-rework/hardware-configuration.nix b/2024-12-rework/hardware-configuration.nix new file mode 100644 index 0000000..d3c51fe --- /dev/null +++ b/2024-12-rework/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.kernelParams = [ + "i915.enable_fbc=1" + "i915.enable_psr=2" + ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/eb9a2c7e-ae61-4d06-9464-49b98d576f7c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/924D-E7A4"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/166d24ca-401c-492e-845d-bb1d0d6d7d86"; } + ]; + + # 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.wlp58s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/2024-12-rework/nixpkgs-settings.nix b/2024-12-rework/nixpkgs-settings.nix new file mode 100644 index 0000000..ec86e08 --- /dev/null +++ b/2024-12-rework/nixpkgs-settings.nix @@ -0,0 +1,9 @@ +{ inputs, ... }: { + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ "olm-3.2.16" "electron-27.3.11" ]; + }; + overlays = [ inputs.nixpkgs-terraform.overlays.default ]; + }; +} \ No newline at end of file diff --git a/README.md b/README.md index 46cd425..1c2948f 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ This repo is a Nix flake that manages most of my setup on macOS and fully manage ## Flake structure +> **RESTRUCTURING IN PROGRESS**: please note, I am restructuring this to remove a lot of complexity. This first pass is done and moves home manager bits into modules that have home in the name. Things that apply to everything under a part of the tree are in a corresponding `default.nix` + The Nix bits are driven by `flake.nix` which pulls in things under `modules/`. Both Intel and Apple Silicon macOS are suppoted, as is NixOS. The flake is structured like so: - description: a human readable description of this flake @@ -26,14 +28,14 @@ The Nix bits are driven by `flake.nix` which pulls in things under `modules/`. B - all the outputs from the inputs - a `let` ... `in` block that contains: - `darwinHostConfig` which takes a set of paramters as an attribute set and pulls in all the things needed to use Nix on a macOS host - - `nixosHostConfig` which takes a set of parameters as an attribute set and pulls in all the things needed to configure a NixOS host + - `mkNixosHost` which takes a set of parameters as an attribute set and pulls in all the things needed to configure a NixOS host - `linuxHomeConfig` which takes a set of paramters as an attribute set and pulls in the things I manage on non-NixOS Linux hosts - the body of outputs that contains: - `darwinConfigurations` contains is an attribute set that contains keys named for each macOS host set to the results of a call to `darwinHostConfig` with values for each of the required parameters - `nixosConfigurations` contains is an attribute set that contains keys named for each NixOS host set to the results of a call to `darwinHostConfig` with values for each of the required parameters - `homeConfigurations` contains an entry for each username set to the results of a call to `linuxHomeConfig` with values for each of the required parameters -The parameters on `darwinHostConfig` & `nixosHostConfig` are: +The parameters on `darwinHostConfig` & `mkNixosHost` are: - `system:` the system definition to use for nixpkgs - `hostname:` the hostname of the machine being configured diff --git a/examples/flake-structure.nix b/examples/flake-structure.nix index a24ec94..b47d1a5 100644 --- a/examples/flake-structure.nix +++ b/examples/flake-structure.nix @@ -4,7 +4,7 @@ darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nix-darwin.lib.darwinSystem { }; - nixosHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: + mkNixosHost = { system, hostname, username, additionalModules, additionalSpecialArgs }: nixpkgs.lib.nixosSystem { }; linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: @@ -24,7 +24,7 @@ # NixOS hosts nixosConfigurations = { - rainbow-planet = nixosHostConfig { + rainbow-planet = mkNixosHost { system = "x86_64-linux"; hostname = "rainbow-planet"; username = "gene"; diff --git a/flake.lock b/flake.lock index d5e0400..8884bfa 100644 --- a/flake.lock +++ b/flake.lock @@ -99,11 +99,11 @@ ] }, "locked": { - "lastModified": 1732988076, - "narHash": "sha256-2uMaVAZn7fiyTUGhKgleuLYe5+EAAYB/diKxrM7g3as=", + "lastModified": 1733168902, + "narHash": "sha256-8dupm9GfK+BowGdQd7EHK5V61nneLfr9xR6sc5vtDi0=", "owner": "nix-community", "repo": "disko", - "rev": "2814a5224a47ca19e858e027f7e8bff74a8ea9f1", + "rev": "785c1e02c7e465375df971949b8dcbde9ec362e5", "type": "github" }, "original": { @@ -321,11 +321,11 @@ ] }, "locked": { - "lastModified": 1733050161, - "narHash": "sha256-lYnT+EYE47f5yY3KS/Kd4pJ6CO9fhCqumkYYkQ3TK20=", + "lastModified": 1733572789, + "narHash": "sha256-zjO6m5BqxXIyjrnUziAzk4+T4VleqjstNudSqWcpsHI=", "owner": "nix-community", "repo": "home-manager", - "rev": "62d536255879be574ebfe9b87c4ac194febf47c5", + "rev": "c7ffc9727d115e433fd884a62dc164b587ff651d", "type": "github" }, "original": { @@ -342,11 +342,11 @@ ] }, "locked": { - "lastModified": 1733105089, - "narHash": "sha256-Qs3YmoLYUJ8g4RkFj2rMrzrP91e4ShAioC9s+vG6ENM=", + "lastModified": 1733570843, + "narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "c6b65d946097baf3915dd51373251de98199280d", + "rev": "a35b08d09efda83625bef267eb24347b446c80b8", "type": "github" }, "original": { @@ -375,11 +375,11 @@ }, "nix-flatpak": { "locked": { - "lastModified": 1732867134, - "narHash": "sha256-YGtFJ/4SE37evvHX+OkS2klRdHlO7HvovaaxR/yWuWg=", + "lastModified": 1733345341, + "narHash": "sha256-8S58zrdpzGhax6tmn1i+R3AA0N9DJMu5FQI8JkA0NNU=", "owner": "gmodena", "repo": "nix-flatpak", - "rev": "01ca2cbd9fb5c29d73fac327f5a9a2a1a222e218", + "rev": "ebb0be49fc381112ff37726c6dd6df4df2ef5a1b", "type": "github" }, "original": { @@ -444,11 +444,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1733095793, - "narHash": "sha256-woqkmcGxOleK1RyoZpXU3NaC4+epr2qYau2mVhVQFjY=", + "lastModified": 1733558619, + "narHash": "sha256-+hpXjj67bWfr8Z4JP32CPqvoqO5hkTNyRZLA5SB6Zmc=", "owner": "lilyinstarlight", "repo": "nixos-cosmic", - "rev": "e468c8b79dd55f1ce8803887d3593fb0016f1f81", + "rev": "313f9b0d8cb2ec8bec0f4d5170c3fda41d49f58c", "type": "github" }, "original": { @@ -459,11 +459,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1733139194, - "narHash": "sha256-PVQW9ovo0CJbhuhCsrhFJGGdD1euwUornspKpBIgdok=", + "lastModified": 1733481457, + "narHash": "sha256-IS3bxa4N1VMSh3/P6vhEAHQZecQ3oAlKCDvzCQSO5Is=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "c6c90887f84c02ce9ebf33b95ca79ef45007bf88", + "rev": "e563803af3526852b6b1d77107a81908c66a9fcf", "type": "github" }, "original": { @@ -594,11 +594,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1733064805, - "narHash": "sha256-7NbtSLfZO0q7MXPl5hzA0sbVJt6pWxxtGWbaVUDDmjs=", + "lastModified": 1733376361, + "narHash": "sha256-aLJxoTDDSqB+/3orsulE6/qdlX6MzDLIITLZqdgMpqo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "31d66ae40417bb13765b0ad75dd200400e98de84", + "rev": "929116e316068c7318c54eb4d827f7d9756d5e9c", "type": "github" }, "original": { @@ -639,11 +639,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1732981179, - "narHash": "sha256-F7thesZPvAMSwjRu0K8uFshTk3ZZSNAsXTIFvXBT+34=", + "lastModified": 1733412085, + "narHash": "sha256-FillH0qdWDt/nlO6ED7h4cmN+G9uXwGjwmCnHs0QVYM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "62c435d93bf046a5396f3016472e8f7c8e2aed65", + "rev": "4dc2fc4e62dbf62b84132fe526356fbac7b03541", "type": "github" }, "original": { @@ -744,11 +744,11 @@ ] }, "locked": { - "lastModified": 1732933841, - "narHash": "sha256-dge02pUSe2QeC/B3PriA0R8eAX+EU3aDoXj9FcS3XDw=", + "lastModified": 1733452419, + "narHash": "sha256-eh2i2GtqdWVOP7yjiWtB8FMUWktCZ4vjo81n6g5mSiE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c65e91d4a33abc3bc4a892d3c5b5b378bad64ea1", + "rev": "020701e6057992329a7cfafc6e3c5d5658bbcf79", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 4c85f9a..a43a6aa 100644 --- a/flake.nix +++ b/flake.nix @@ -74,92 +74,19 @@ }; }; # end inputs - outputs = inputs@{ - self, nixpkgs, nixpkgs-unstable, compose2nix, disko, flox, genebean-omp-themes, - home-manager, nix-darwin, nix-flatpak, nix-homebrew, nixos-cosmic, - nixos-hardware, nixpkgs-terraform, simple-nixos-mailserver, sops-nix, ... - }: let + outputs = inputs@{ self, ... }: let + # Functions that setup systems + localLib = import ./lib { inherit inputs; }; - # creates a macOS system config - darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nix-darwin.lib.darwinSystem { - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - permittedInsecurePackages = [ "olm-3.2.16" "python-2.7.18.7" ]; - }; - overlays = [ nixpkgs-terraform.overlays.default ]; - }; - specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs; - modules = [ - nix-homebrew.darwinModules.nix-homebrew { - nix-homebrew = { - enable = true; # Install Homebrew under the default prefix - user = "${username}"; # User owning the Homebrew prefix - autoMigrate = true; # Automatically migrate existing Homebrew installations - }; - } - - home-manager.darwinModules.home-manager { - home-manager = { - extraSpecialArgs = { inherit genebean-omp-themes username; }; - useGlobalPkgs = true; - useUserPackages = true; - users.${username}.imports = [ - sops-nix.homeManagerModule # user-level secrets management - ./modules/home-manager/hosts/${hostname}/${username}.nix - ]; - }; - } - - ./modules/system/common/all-darwin.nix # system-wide stuff - ./modules/hosts/darwin/${hostname} # host specific stuff - ] ++ additionalModules; # end modules - }; # end darwinSystem - - # creates a nixos system config - nixosHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs compose2nix hostname username; - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - permittedInsecurePackages = [ "olm-3.2.16" "electron-27.3.11" ]; - }; - overlays = [ nixpkgs-terraform.overlays.default ]; - }; - } // additionalSpecialArgs; - modules = [ - disko.nixosModules.disko - - home-manager.nixosModules.home-manager { - home-manager = { - extraSpecialArgs = { inherit genebean-omp-themes hostname username; }; - useGlobalPkgs = true; - useUserPackages = true; - users.${username}.imports = [ - ./modules/home-manager/hosts/${hostname}/${username}.nix - ]; - }; - } - - nix-flatpak.nixosModules.nix-flatpak - - sops-nix.nixosModules.sops # system wide secrets management - ./modules/system/common/all-nixos.nix # system-wide stuff - ./modules/hosts/nixos/${hostname} # host specific stuff - ] ++ additionalModules; - }; # end nixosSystem - - linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: home-manager.lib.homeManagerConfiguration { - extraSpecialArgs = { inherit genebean-omp-themes hostname username; - pkgs = import nixpkgs { + linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: inputs.home-manager.lib.homeManagerConfiguration { + extraSpecialArgs = { inherit inputs hostname username; + pkgs = import inputs.nixpkgs { inherit system; config = { allowUnfree = true; permittedInsecurePackages = [ "olm-3.2.16" "electron-21.4.4" ]; }; - overlays = [ nixpkgs-terraform.overlays.default ]; + overlays = [ inputs.nixpkgs-terraform.overlays.default ]; }; } // additionalSpecialArgs; modules = [ @@ -170,92 +97,67 @@ homeDirectory = "/home/${username}"; }; } - sops-nix.homeManagerModules.sops + inputs.sops-nix.homeManagerModules.sops ] ++ additionalModules; }; # end homeManagerConfiguration in { # Darwin (macOS) hosts darwinConfigurations = { - AirPuppet = darwinHostConfig { + AirPuppet = localLib.mkDarwinHost { system = "x86_64-darwin"; hostname = "AirPuppet"; - username = "gene"; - additionalModules = []; - additionalSpecialArgs = {}; }; - Blue-Rock = darwinHostConfig { + Blue-Rock = localLib.mkDarwinHost { system = "x86_64-darwin"; hostname = "Blue-Rock"; username = "gene.liverman"; - additionalModules = []; - additionalSpecialArgs = {}; }; - mightymac = darwinHostConfig { - system = "aarch64-darwin"; + mightymac = localLib.mkDarwinHost { hostname = "mightymac"; username = "gene.liverman"; - additionalModules = []; - additionalSpecialArgs = {}; }; }; # end darwinConfigurations # NixOS hosts nixosConfigurations = { - bigboy = nixosHostConfig { - system = "x86_64-linux"; + bigboy = localLib.mkNixosHost { hostname = "bigboy"; - username = "gene"; additionalModules = [ - nixos-hardware.nixosModules.lenovo-thinkpad-p52 + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p52 ]; - additionalSpecialArgs = {}; }; - hetznix01 = nixosHostConfig { - system = "x86_64-linux"; + hetznix01 = localLib.mkNixosHost { hostname = "hetznix01"; - username = "gene"; additionalModules = [ - simple-nixos-mailserver.nixosModule + inputs.simple-nixos-mailserver.nixosModule ]; - additionalSpecialArgs = {}; }; - hetznix02 = nixosHostConfig { + hetznix02 = localLib.mkNixosHost { system = "aarch64-linux"; hostname = "hetznix02"; - username = "gene"; additionalModules = [ - # simple-nixos-mailserver.nixosModule + # inputs.simple-nixos-mailserver.nixosModule ]; - additionalSpecialArgs = {}; }; - nixnas1 = nixosHostConfig { - system = "x86_64-linux"; + nixnas1 = localLib.mkNixosHost { hostname = "nixnas1"; - username = "gene"; additionalModules = [ - simple-nixos-mailserver.nixosModule + inputs.simple-nixos-mailserver.nixosModule ]; - additionalSpecialArgs = {}; }; - nixnuc = nixosHostConfig { - system = "x86_64-linux"; + nixnuc = localLib.mkNixosHost { hostname = "nixnuc"; - username = "gene"; additionalModules = [ - simple-nixos-mailserver.nixosModule + inputs.simple-nixos-mailserver.nixosModule ]; - additionalSpecialArgs = {}; }; - rainbow-planet = nixosHostConfig { - system = "x86_64-linux"; + rainbow-planet = localLib.mkNixosHost { hostname = "rainbow-planet"; - username = "gene"; additionalModules = [ - #nixos-cosmic.nixosModules.default - nixos-hardware.nixosModules.dell-xps-13-9360 + inputs.nixos-cosmic.nixosModules.default + inputs.nixos-hardware.nixosModules.dell-xps-13-9360 ]; - additionalSpecialArgs = {}; }; }; # end nixosConfigurations diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..3776697 --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,7 @@ +{ inputs, ... }: let + mkDarwinHost = import ./mkDarwinHost.nix { inherit inputs; }; + mkNixosHost = import ./mkNixosHost.nix { inherit inputs; }; +in { + inherit (mkDarwinHost) mkDarwinHost; + inherit (mkNixosHost) mkNixosHost; +} diff --git a/lib/mkDarwinHost.nix b/lib/mkDarwinHost.nix new file mode 100644 index 0000000..bdcd92a --- /dev/null +++ b/lib/mkDarwinHost.nix @@ -0,0 +1,41 @@ +{ inputs, ... }: { + mkDarwinHost = { + system ? "aarch64-darwin", + hostname, + username ? "gene", + additionalModules ? [], + additionalSpecialArgs ? {} + }: inputs.nix-darwin.lib.darwinSystem { + inherit system; + specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs; + modules = [ + ./nixpkgs-settings.nix + + inputs.nix-homebrew.darwinModules.nix-homebrew { + nix-homebrew = { + enable = true; # Install Homebrew under the default prefix + user = "${username}"; # User owning the Homebrew prefix + autoMigrate = true; # Automatically migrate existing Homebrew installations + }; + } + + inputs.home-manager.darwinModules.home-manager { + home-manager = { + extraSpecialArgs = { inherit inputs username; }; + useGlobalPkgs = true; + useUserPackages = true; + users.${username}.imports = [ + inputs.sops-nix.homeManagerModule # user-level secrets management + ../modules/hosts/common + ../modules/hosts/common/all-gui.nix + ../modules/hosts/darwin/home.nix + ../modules/hosts/darwin/${hostname}/home-${username}.nix + ]; + }; + } + + ../modules/hosts/darwin # system-wide stuff + ../modules/hosts/darwin/${hostname} # host specific stuff + ] ++ additionalModules; # end modules + }; # end darwinSystem +} diff --git a/lib/mkNixosHost.nix b/lib/mkNixosHost.nix new file mode 100644 index 0000000..128a6c5 --- /dev/null +++ b/lib/mkNixosHost.nix @@ -0,0 +1,36 @@ +{ inputs, ... }: { + mkNixosHost = { + system ? "x86_64-linux", + hostname, + username ? "gene", + additionalModules ? [], + additionalSpecialArgs ? {} + }: inputs.nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs; + modules = [ + ./nixpkgs-settings.nix + + inputs.disko.nixosModules.disko + + inputs.home-manager.nixosModules.home-manager { + home-manager = { + extraSpecialArgs = { inherit inputs hostname username; }; + useGlobalPkgs = true; + useUserPackages = true; + users.${username}.imports = [ + ../modules/hosts/common + ../modules/hosts/common/linux/home.nix + ../modules/hosts/nixos/${hostname}/home-${username}.nix + ]; + }; + } + + inputs.nix-flatpak.nixosModules.nix-flatpak + + inputs.sops-nix.nixosModules.sops # system wide secrets management + ../modules/hosts/nixos # system-wide stuff + ../modules/hosts/nixos/${hostname} # host specific stuff + ] ++ additionalModules; + }; +} diff --git a/lib/nixpkgs-settings.nix b/lib/nixpkgs-settings.nix new file mode 100644 index 0000000..a81ed4b --- /dev/null +++ b/lib/nixpkgs-settings.nix @@ -0,0 +1,9 @@ +{ inputs, ... }: { + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ "olm-3.2.16" "electron-27.3.11" ]; + }; + overlays = [ inputs.nixpkgs-terraform.overlays.default ]; + }; +} diff --git a/modules/home-manager/hosts/hetznix01/gene.nix b/modules/home-manager/hosts/hetznix01/gene.nix deleted file mode 100644 index 1090c90..0000000 --- a/modules/home-manager/hosts/hetznix01/gene.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, genebean-omp-themes, ... }: { - home.stateVersion = "24.05"; - imports = [ - ../../common/all-cli.nix - ../../common/all-linux.nix - ]; -} diff --git a/modules/home-manager/hosts/hetznix02/gene.nix b/modules/home-manager/hosts/hetznix02/gene.nix deleted file mode 100644 index 1090c90..0000000 --- a/modules/home-manager/hosts/hetznix02/gene.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, genebean-omp-themes, ... }: { - home.stateVersion = "24.05"; - imports = [ - ../../common/all-cli.nix - ../../common/all-linux.nix - ]; -} diff --git a/modules/home-manager/hosts/mini-watcher/gene.nix b/modules/home-manager/hosts/mini-watcher/gene.nix deleted file mode 100644 index 7cb68f2..0000000 --- a/modules/home-manager/hosts/mini-watcher/gene.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, genebean-omp-themes, ... }: { - home.stateVersion = "23.11"; - imports = [ - ../../common/all-cli.nix - ../../common/all-linux.nix - ../../common/hm-sops.nix - ]; -} diff --git a/modules/home-manager/hosts/mini-watcher/secrets.yaml b/modules/home-manager/hosts/mini-watcher/secrets.yaml deleted file mode 100644 index 50f2656..0000000 --- a/modules/home-manager/hosts/mini-watcher/secrets.yaml +++ /dev/null @@ -1,22 +0,0 @@ -local_git_config: ENC[AES256_GCM,data:ECcO9NiS6Xo1AevHx/4tIGmhVHTG+WHIJI/RgYLe4DbptPJQFxFMBEk=,iv:xPvAfNywX7Ww3iwZDwQGTa88ZoJZqnIjdNDv4R0iAf0=,tag:bQ7rNxPniyP7SNW8Nz+1rw==,type:str] -local_private_env: ENC[AES256_GCM,data:Eg1IYFMJFysMavh1ssddpO3fzoyrKpA2dfSNSUUUsb/548IxqOktXIArR5bqbWVL//bUmnYI3N37jYRFiQSO,iv:50WBKSSy/Ea6l6kdggeoVCXhRG6lc4QxQBm1CoK2RTc=,tag:USADBcnceslCg3ueSikf+w==,type:str] -sops: - kms: [] - gcp_kms: [] - azure_kv: [] - hc_vault: [] - age: - - recipient: age1rpy8edlpgxuf6w75cvlqexuq2xe4c49h9t2ge6jhc3fzczp8vfasnjelwq - enc: | - -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBveXpUSFNmVXJFTy9ieWRv - a1Fpb2xic1lnYW5mZ2VaY1dyOXVUbkNGWnlNCkxKcUZVbm0rRUNydERUeC9ueloy - N3d0NGxyaTFCd1lMUmh2VklqbTZJalkKLS0tIC8xb1VnZU0xbmdObnZIUjRvU01k - bmtPb3hjTkxMaDJwSGQ0amF5ci85UXcK16fgU78H4SK8LKDyYCUgMdRE2ZTygzyE - spYcQ8w+PvQSxLUFJKW6DZdkSXLkNR0HkmVkuSmBKW0lVNWCfXbfvA== - -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-01-28T00:59:32Z" - mac: ENC[AES256_GCM,data:Dcs3LkQtReunJGQl1aBy/fo022r0fwAdjDKRlgGsDtnWWEWZww6+n30yCkMjDrQCZm4NekDCYrEd0Dhq90nLON+vxykojxd/UTBEX86NIxUrGtO3faotP0/buVi59JgqQQqBDB14GpJttZGVr59LVlxieG1PhpmE9lFePpT8eR4=,iv:7KmeBD4Pk+guEW0nb9/W7olsF36bwfZtFkehO5u40po=,tag:PJmbdqiud4FHxbVcZv2png==,type:str] - pgp: [] - unencrypted_suffix: _unencrypted - version: 3.8.1 diff --git a/modules/home-manager/hosts/nixnas1/gene.nix b/modules/home-manager/hosts/nixnas1/gene.nix deleted file mode 100644 index 2645578..0000000 --- a/modules/home-manager/hosts/nixnas1/gene.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: { - home.stateVersion = "24.05"; - imports = [ - ../../common/all-cli.nix - ../../common/all-linux.nix - ]; -} diff --git a/modules/home-manager/hosts/nixnuc/gene.nix b/modules/home-manager/hosts/nixnuc/gene.nix deleted file mode 100644 index 30158a5..0000000 --- a/modules/home-manager/hosts/nixnuc/gene.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, genebean-omp-themes, ... }: { - home.stateVersion = "23.11"; - imports = [ - ../../common/all-cli.nix - ../../common/all-linux.nix - ]; -} diff --git a/modules/home-manager/common/all-gui.nix b/modules/hosts/common/all-gui.nix similarity index 83% rename from modules/home-manager/common/all-gui.nix rename to modules/hosts/common/all-gui.nix index 20f29ca..6ad9478 100644 --- a/modules/home-manager/common/all-gui.nix +++ b/modules/hosts/common/all-gui.nix @@ -1,4 +1,4 @@ -{ pkgs, genebean-omp-themes, ... }: { +{ pkgs, ... }: { home.packages = with pkgs; [ # nothing here right now ]; diff --git a/modules/home-manager/common/all-cli.nix b/modules/hosts/common/default.nix similarity index 97% rename from modules/home-manager/common/all-cli.nix rename to modules/hosts/common/default.nix index 5d98099..0aefada 100644 --- a/modules/home-manager/common/all-cli.nix +++ b/modules/hosts/common/default.nix @@ -1,4 +1,4 @@ -{ pkgs, genebean-omp-themes, ... }: let +{ inputs, pkgs, ... }: let sqlite_lib = if builtins.elem pkgs.system [ "aarch64-darwin" "x86_64-darwin" @@ -159,7 +159,7 @@ in { oh-my-posh = { enable = true; enableZshIntegration = true; - settings = builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile (genebean-omp-themes + "/beanbag.omp.json"))); + settings = builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile (inputs.genebean-omp-themes + "/beanbag.omp.json"))); }; ripgrep.enable = true; tmux = { @@ -335,14 +335,14 @@ in { home.file = { ".config/nvim/lua/config" = { - source = ../files/nvim/lua/config; + source = ./files/nvim/lua/config; recursive = true; }; ".config/nvim/lua/plugins" = { - source = ../files/nvim/lua/plugins; + source = ./files/nvim/lua/plugins; recursive = true; }; - ".config/powershell/Microsoft.PowerShell_profile.ps1".source = ../files/Microsoft.PowerShell_profile.ps1; - ".config/powershell/Microsoft.VSCode_profile.ps1".source = ../files/Microsoft.PowerShell_profile.ps1; + ".config/powershell/Microsoft.PowerShell_profile.ps1".source = ./files/Microsoft.PowerShell_profile.ps1; + ".config/powershell/Microsoft.VSCode_profile.ps1".source = ./files/Microsoft.PowerShell_profile.ps1; }; } diff --git a/modules/home-manager/files/Microsoft.PowerShell_profile.ps1 b/modules/hosts/common/files/Microsoft.PowerShell_profile.ps1 similarity index 100% rename from modules/home-manager/files/Microsoft.PowerShell_profile.ps1 rename to modules/hosts/common/files/Microsoft.PowerShell_profile.ps1 diff --git a/modules/home-manager/files/nvim/lua/config/vim-options.lua b/modules/hosts/common/files/nvim/lua/config/vim-options.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/config/vim-options.lua rename to modules/hosts/common/files/nvim/lua/config/vim-options.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/barbar.lua b/modules/hosts/common/files/nvim/lua/disabled/barbar.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/barbar.lua rename to modules/hosts/common/files/nvim/lua/disabled/barbar.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/cheatsheet.lua b/modules/hosts/common/files/nvim/lua/disabled/cheatsheet.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/cheatsheet.lua rename to modules/hosts/common/files/nvim/lua/disabled/cheatsheet.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/nvim-tree.lua b/modules/hosts/common/files/nvim/lua/disabled/nvim-tree.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/nvim-tree.lua rename to modules/hosts/common/files/nvim/lua/disabled/nvim-tree.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/themes/dracula.lua b/modules/hosts/common/files/nvim/lua/disabled/themes/dracula.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/themes/dracula.lua rename to modules/hosts/common/files/nvim/lua/disabled/themes/dracula.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/themes/gruvbox.lua b/modules/hosts/common/files/nvim/lua/disabled/themes/gruvbox.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/themes/gruvbox.lua rename to modules/hosts/common/files/nvim/lua/disabled/themes/gruvbox.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/themes/kanagawa.lua b/modules/hosts/common/files/nvim/lua/disabled/themes/kanagawa.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/themes/kanagawa.lua rename to modules/hosts/common/files/nvim/lua/disabled/themes/kanagawa.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/themes/oxocarbon.lua b/modules/hosts/common/files/nvim/lua/disabled/themes/oxocarbon.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/themes/oxocarbon.lua rename to modules/hosts/common/files/nvim/lua/disabled/themes/oxocarbon.lua diff --git a/modules/home-manager/files/nvim/lua/disabled/themes/tokyonight.lua b/modules/hosts/common/files/nvim/lua/disabled/themes/tokyonight.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/disabled/themes/tokyonight.lua rename to modules/hosts/common/files/nvim/lua/disabled/themes/tokyonight.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/alpha.lua b/modules/hosts/common/files/nvim/lua/plugins/alpha.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/alpha.lua rename to modules/hosts/common/files/nvim/lua/plugins/alpha.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/bufferline.lua b/modules/hosts/common/files/nvim/lua/plugins/bufferline.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/bufferline.lua rename to modules/hosts/common/files/nvim/lua/plugins/bufferline.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua b/modules/hosts/common/files/nvim/lua/plugins/catppuccin.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/catppuccin.lua rename to modules/hosts/common/files/nvim/lua/plugins/catppuccin.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/completions.lua b/modules/hosts/common/files/nvim/lua/plugins/completions.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/completions.lua rename to modules/hosts/common/files/nvim/lua/plugins/completions.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/edgy.lua b/modules/hosts/common/files/nvim/lua/plugins/edgy.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/edgy.lua rename to modules/hosts/common/files/nvim/lua/plugins/edgy.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/git-stuff.lua b/modules/hosts/common/files/nvim/lua/plugins/git-stuff.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/git-stuff.lua rename to modules/hosts/common/files/nvim/lua/plugins/git-stuff.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua b/modules/hosts/common/files/nvim/lua/plugins/lsp-config.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/lsp-config.lua rename to modules/hosts/common/files/nvim/lua/plugins/lsp-config.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/lualine.lua b/modules/hosts/common/files/nvim/lua/plugins/lualine.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/lualine.lua rename to modules/hosts/common/files/nvim/lua/plugins/lualine.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua b/modules/hosts/common/files/nvim/lua/plugins/neo-tree.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/neo-tree.lua rename to modules/hosts/common/files/nvim/lua/plugins/neo-tree.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/noice.lua b/modules/hosts/common/files/nvim/lua/plugins/noice.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/noice.lua rename to modules/hosts/common/files/nvim/lua/plugins/noice.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/none-ls.lua b/modules/hosts/common/files/nvim/lua/plugins/none-ls.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/none-ls.lua rename to modules/hosts/common/files/nvim/lua/plugins/none-ls.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/nvim-web-devicons.lua b/modules/hosts/common/files/nvim/lua/plugins/nvim-web-devicons.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/nvim-web-devicons.lua rename to modules/hosts/common/files/nvim/lua/plugins/nvim-web-devicons.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/telescope.lua b/modules/hosts/common/files/nvim/lua/plugins/telescope.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/telescope.lua rename to modules/hosts/common/files/nvim/lua/plugins/telescope.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/todo-comments.lua b/modules/hosts/common/files/nvim/lua/plugins/todo-comments.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/todo-comments.lua rename to modules/hosts/common/files/nvim/lua/plugins/todo-comments.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/toggleterm.lua b/modules/hosts/common/files/nvim/lua/plugins/toggleterm.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/toggleterm.lua rename to modules/hosts/common/files/nvim/lua/plugins/toggleterm.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/treesitter.lua b/modules/hosts/common/files/nvim/lua/plugins/treesitter.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/treesitter.lua rename to modules/hosts/common/files/nvim/lua/plugins/treesitter.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/trouble.lua b/modules/hosts/common/files/nvim/lua/plugins/trouble.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/trouble.lua rename to modules/hosts/common/files/nvim/lua/plugins/trouble.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/vim-tmux-navigator.lua b/modules/hosts/common/files/nvim/lua/plugins/vim-tmux-navigator.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/vim-tmux-navigator.lua rename to modules/hosts/common/files/nvim/lua/plugins/vim-tmux-navigator.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/which-key.lua b/modules/hosts/common/files/nvim/lua/plugins/which-key.lua similarity index 100% rename from modules/home-manager/files/nvim/lua/plugins/which-key.lua rename to modules/hosts/common/files/nvim/lua/plugins/which-key.lua diff --git a/modules/home-manager/files/tilix/Beanbag-Mathias.json b/modules/hosts/common/files/tilix/Beanbag-Mathias.json similarity index 100% rename from modules/home-manager/files/tilix/Beanbag-Mathias.json rename to modules/hosts/common/files/tilix/Beanbag-Mathias.json diff --git a/modules/home-manager/files/waybar/config b/modules/hosts/common/files/waybar/config similarity index 100% rename from modules/home-manager/files/waybar/config rename to modules/hosts/common/files/waybar/config diff --git a/modules/home-manager/files/waybar/style.css b/modules/hosts/common/files/waybar/style.css similarity index 100% rename from modules/home-manager/files/waybar/style.css rename to modules/hosts/common/files/waybar/style.css diff --git a/modules/home-manager/files/xfce4/terminal/accels.scm b/modules/hosts/common/files/xfce4/terminal/accels.scm similarity index 100% rename from modules/home-manager/files/xfce4/terminal/accels.scm rename to modules/hosts/common/files/xfce4/terminal/accels.scm diff --git a/modules/home-manager/files/xfce4/terminal/terminalrc b/modules/hosts/common/files/xfce4/terminal/terminalrc similarity index 100% rename from modules/home-manager/files/xfce4/terminal/terminalrc rename to modules/hosts/common/files/xfce4/terminal/terminalrc diff --git a/modules/home-manager/common/hm-sops.nix b/modules/hosts/common/hm-sops.nix similarity index 100% rename from modules/home-manager/common/hm-sops.nix rename to modules/hosts/common/hm-sops.nix diff --git a/modules/home-manager/common/linux-apps/hexchat.nix b/modules/hosts/common/linux/apps/hexchat.nix similarity index 100% rename from modules/home-manager/common/linux-apps/hexchat.nix rename to modules/hosts/common/linux/apps/hexchat.nix diff --git a/modules/home-manager/common/linux-apps/pidgin.nix b/modules/hosts/common/linux/apps/pidgin.nix similarity index 100% rename from modules/home-manager/common/linux-apps/pidgin.nix rename to modules/hosts/common/linux/apps/pidgin.nix diff --git a/modules/home-manager/common/linux-apps/tilix.nix b/modules/hosts/common/linux/apps/tilix.nix similarity index 100% rename from modules/home-manager/common/linux-apps/tilix.nix rename to modules/hosts/common/linux/apps/tilix.nix diff --git a/modules/home-manager/common/linux-apps/waybar.nix b/modules/hosts/common/linux/apps/waybar.nix similarity index 100% rename from modules/home-manager/common/linux-apps/waybar.nix rename to modules/hosts/common/linux/apps/waybar.nix diff --git a/modules/home-manager/common/linux-apps/xfce4-terminal.nix b/modules/hosts/common/linux/apps/xfce4-terminal.nix similarity index 99% rename from modules/home-manager/common/linux-apps/xfce4-terminal.nix rename to modules/hosts/common/linux/apps/xfce4-terminal.nix index e1b596c..6b49e4d 100644 --- a/modules/home-manager/common/linux-apps/xfce4-terminal.nix +++ b/modules/hosts/common/linux/apps/xfce4-terminal.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ ... }: { home.file = { ".config/xfce4/terminal/accels.scm".source = ../../files/xfce4/terminal/accels.scm; }; diff --git a/modules/system/common/linux/flatpaks.nix b/modules/hosts/common/linux/flatpaks.nix similarity index 100% rename from modules/system/common/linux/flatpaks.nix rename to modules/hosts/common/linux/flatpaks.nix diff --git a/modules/home-manager/common/all-linux.nix b/modules/hosts/common/linux/home.nix similarity index 69% rename from modules/home-manager/common/all-linux.nix rename to modules/hosts/common/linux/home.nix index eeeb32c..04428b9 100644 --- a/modules/home-manager/common/all-linux.nix +++ b/modules/hosts/common/linux/home.nix @@ -6,6 +6,8 @@ programs = { # Linux-specific aliases zsh.shellAliases = { + nixboot = "sudo nixos-rebuild boot --flake ~/repos/dots && echo 'Time to reboot!'"; + nixdiff = "cd ~/repos/dots && nixos-rebuild build --flake . && nvd diff /run/current-system result"; nixup = "sudo nixos-rebuild switch --flake ~/repos/dots"; uwgconnect = "nmcli dev wifi connect SecureWest password"; uwgforget = "nmcli connection delete SecureWest"; diff --git a/modules/system/common/linux/internationalisation.nix b/modules/hosts/common/linux/internationalisation.nix similarity index 94% rename from modules/system/common/linux/internationalisation.nix rename to modules/hosts/common/linux/internationalisation.nix index 9463637..5d71c99 100644 --- a/modules/system/common/linux/internationalisation.nix +++ b/modules/hosts/common/linux/internationalisation.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: { +{ ... }: { # Select internationalisation properties. i18n = { defaultLocale = "en_US.UTF-8"; diff --git a/modules/system/common/linux/lets-encrypt.nix b/modules/hosts/common/linux/lets-encrypt.nix similarity index 100% rename from modules/system/common/linux/lets-encrypt.nix rename to modules/hosts/common/linux/lets-encrypt.nix diff --git a/modules/system/common/linux/restic.nix b/modules/hosts/common/linux/restic.nix similarity index 100% rename from modules/system/common/linux/restic.nix rename to modules/hosts/common/linux/restic.nix diff --git a/modules/system/common/secrets.yaml b/modules/hosts/common/secrets.yaml similarity index 100% rename from modules/system/common/secrets.yaml rename to modules/hosts/common/secrets.yaml diff --git a/modules/hosts/darwin/AirPuppet/default.nix b/modules/hosts/darwin/AirPuppet/default.nix index 17b71e5..84afcb1 100644 --- a/modules/hosts/darwin/AirPuppet/default.nix +++ b/modules/hosts/darwin/AirPuppet/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ ... }: { system.stateVersion = 4; homebrew = { diff --git a/modules/home-manager/hosts/AirPuppet/gene.nix b/modules/hosts/darwin/AirPuppet/home-gene.nix similarity index 59% rename from modules/home-manager/hosts/AirPuppet/gene.nix rename to modules/hosts/darwin/AirPuppet/home-gene.nix index 897b11b..644bc76 100644 --- a/modules/home-manager/hosts/AirPuppet/gene.nix +++ b/modules/hosts/darwin/AirPuppet/home-gene.nix @@ -1,10 +1,5 @@ -{ pkgs, genebean-omp-themes, sops-nix, username, ... }: { +{ username, ... }: { home.stateVersion = "23.11"; - imports = [ - ../../common/all-cli.nix - ../../common/all-gui.nix - ../../common/all-darwin.nix - ]; sops = { defaultSopsFile = ./secrets.yaml; diff --git a/modules/home-manager/hosts/AirPuppet/secrets.yaml b/modules/hosts/darwin/AirPuppet/secrets.yaml similarity index 100% rename from modules/home-manager/hosts/AirPuppet/secrets.yaml rename to modules/hosts/darwin/AirPuppet/secrets.yaml diff --git a/modules/home-manager/hosts/Blue-Rock/gene.liverman.nix b/modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix similarity index 67% rename from modules/home-manager/hosts/Blue-Rock/gene.liverman.nix rename to modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix index 7160605..7f1fa1a 100644 --- a/modules/home-manager/hosts/Blue-Rock/gene.liverman.nix +++ b/modules/hosts/darwin/Blue-Rock/home-gene.liverman.nix @@ -1,10 +1,5 @@ -{ pkgs, genebean-omp-themes, sops-nix, username, ... }: { +{ username, ... }: { home.stateVersion = "23.11"; - imports = [ - ../../common/all-cli.nix - ../../common/all-gui.nix - ../../common/all-darwin.nix - ]; programs = { go = { diff --git a/modules/home-manager/hosts/Blue-Rock/secrets.yaml b/modules/hosts/darwin/Blue-Rock/secrets.yaml similarity index 100% rename from modules/home-manager/hosts/Blue-Rock/secrets.yaml rename to modules/hosts/darwin/Blue-Rock/secrets.yaml diff --git a/modules/system/common/all-darwin.nix b/modules/hosts/darwin/default.nix similarity index 100% rename from modules/system/common/all-darwin.nix rename to modules/hosts/darwin/default.nix diff --git a/modules/home-manager/common/all-darwin.nix b/modules/hosts/darwin/home.nix similarity index 90% rename from modules/home-manager/common/all-darwin.nix rename to modules/hosts/darwin/home.nix index 45067d7..e68d33a 100644 --- a/modules/home-manager/common/all-darwin.nix +++ b/modules/hosts/darwin/home.nix @@ -17,6 +17,7 @@ oh-my-zsh.plugins = [ "macos" ]; shellAliases = { currentwifi = "networksetup -getairportnetwork en0 |cut -d ':' -f2- | cut -d ' ' -f2-"; + nixdiff = "cd ~/repos/dots && darwin-rebuild build --flake . && nvd diff /run/current-system result"; nixup = "darwin-rebuild switch --flake ~/repos/dots"; uwgconnect = "networksetup -setairportnetwork en0 SecureWest"; uwgforget = "networksetup -removepreferredwirelessnetwork en0 SecureWest"; diff --git a/modules/home-manager/hosts/mightymac/gene.liverman.nix b/modules/hosts/darwin/mightymac/home-gene.liverman.nix similarity index 74% rename from modules/home-manager/hosts/mightymac/gene.liverman.nix rename to modules/hosts/darwin/mightymac/home-gene.liverman.nix index a6ee69d..90b7af7 100644 --- a/modules/home-manager/hosts/mightymac/gene.liverman.nix +++ b/modules/hosts/darwin/mightymac/home-gene.liverman.nix @@ -1,10 +1,5 @@ -{ pkgs, genebean-omp-themes, sops-nix, username, ... }: { +{ username, ... }: { home.stateVersion = "23.11"; - imports = [ - ../../common/all-cli.nix - ../../common/all-gui.nix - ../../common/all-darwin.nix - ]; programs = { go = { diff --git a/modules/home-manager/hosts/mightymac/secrets.yaml b/modules/hosts/darwin/mightymac/secrets.yaml similarity index 100% rename from modules/home-manager/hosts/mightymac/secrets.yaml rename to modules/hosts/darwin/mightymac/secrets.yaml diff --git a/modules/hosts/nixos/bigboy/hardware-configuration.nix b/modules/hosts/nixos/bigboy/hardware-configuration.nix index 57c4551..8a6fb88 100644 --- a/modules/hosts/nixos/bigboy/hardware-configuration.nix +++ b/modules/hosts/nixos/bigboy/hardware-configuration.nix @@ -1,7 +1,7 @@ # 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, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/modules/home-manager/hosts/bigboy/gene.nix b/modules/hosts/nixos/bigboy/home-gene.nix similarity index 77% rename from modules/home-manager/hosts/bigboy/gene.nix rename to modules/hosts/nixos/bigboy/home-gene.nix index f680c05..962d99e 100644 --- a/modules/home-manager/hosts/bigboy/gene.nix +++ b/modules/hosts/nixos/bigboy/home-gene.nix @@ -1,11 +1,9 @@ -{ pkgs, ... }: { +{ ... }: { home.stateVersion = "24.05"; imports = [ - ../../common/all-cli.nix ../../common/all-gui.nix - ../../common/all-linux.nix - ../../common/linux-apps/tilix.nix - ../../common/linux-apps/xfce4-terminal.nix + ../../common/linux/apps/tilix.nix + ../../common/linux/apps/xfce4-terminal.nix ]; programs = { diff --git a/modules/system/common/all-nixos.nix b/modules/hosts/nixos/default.nix similarity index 94% rename from modules/system/common/all-nixos.nix rename to modules/hosts/nixos/default.nix index 6e3ed11..71b449e 100644 --- a/modules/system/common/all-nixos.nix +++ b/modules/hosts/nixos/default.nix @@ -1,6 +1,6 @@ -{ config, hostname, pkgs, sops-nix, username, ... }: { +{ hostname, pkgs, username, ... }: { imports = [ - ./linux/internationalisation.nix + ../common/linux/internationalisation.nix ]; environment = { diff --git a/modules/hosts/nixos/hetznix01/hardware-configuration.nix b/modules/hosts/nixos/hetznix01/hardware-configuration.nix index f3eff9f..c2cbb3b 100644 --- a/modules/hosts/nixos/hetznix01/hardware-configuration.nix +++ b/modules/hosts/nixos/hetznix01/hardware-configuration.nix @@ -1,7 +1,7 @@ # 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, ... }: +{ lib, modulesPath, ... }: { imports = diff --git a/modules/hosts/nixos/hetznix01/home-gene.nix b/modules/hosts/nixos/hetznix01/home-gene.nix new file mode 100644 index 0000000..ec20c58 --- /dev/null +++ b/modules/hosts/nixos/hetznix01/home-gene.nix @@ -0,0 +1,3 @@ +{ ... }: { + home.stateVersion = "24.05"; +} diff --git a/modules/hosts/nixos/hetznix01/post-install/default.nix b/modules/hosts/nixos/hetznix01/post-install/default.nix index fbd4ffc..57430f2 100644 --- a/modules/hosts/nixos/hetznix01/post-install/default.nix +++ b/modules/hosts/nixos/hetznix01/post-install/default.nix @@ -2,8 +2,8 @@ domain = "technicalissues.us"; in { imports = [ - ../../../../system/common/linux/lets-encrypt.nix - ../../../../system/common/linux/restic.nix + ../../../common/linux/lets-encrypt.nix + ../../../common/linux/restic.nix ./matrix-synapse.nix ./nginx.nix ]; diff --git a/modules/hosts/nixos/hetznix02/hardware-configuration.nix b/modules/hosts/nixos/hetznix02/hardware-configuration.nix index c6de7d0..0d6440a 100644 --- a/modules/hosts/nixos/hetznix02/hardware-configuration.nix +++ b/modules/hosts/nixos/hetznix02/hardware-configuration.nix @@ -1,7 +1,7 @@ # 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, ... }: +{ lib, modulesPath, ... }: { imports = diff --git a/modules/hosts/nixos/hetznix02/home-gene.nix b/modules/hosts/nixos/hetznix02/home-gene.nix new file mode 100644 index 0000000..945badd --- /dev/null +++ b/modules/hosts/nixos/hetznix02/home-gene.nix @@ -0,0 +1,3 @@ +{ ... }: { + home.stateVersion = "24.05"; +} diff --git a/modules/hosts/nixos/nixnas1/default.nix b/modules/hosts/nixos/nixnas1/default.nix index da6853f..7146c5c 100644 --- a/modules/hosts/nixos/nixnas1/default.nix +++ b/modules/hosts/nixos/nixnas1/default.nix @@ -118,6 +118,7 @@ description = "Gene Liverman"; extraGroups = [ "wheel" ]; openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFvLaPTfG3r+bcbI6DV4l69UgJjnwmZNCQk79HXyf1Pt gene@rainbow-planet" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIp42X5DZ713+bgbOO+GXROufUFdxWo7NjJbGQ285x3N gene.liverman@ltnglobal.com" ]; }; diff --git a/modules/hosts/nixos/nixnas1/disk-config.nix b/modules/hosts/nixos/nixnas1/disk-config.nix index b8bf80c..dcb9555 100644 --- a/modules/hosts/nixos/nixnas1/disk-config.nix +++ b/modules/hosts/nixos/nixnas1/disk-config.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ ... }: { disko.devices = { disk = { diff --git a/modules/hosts/nixos/nixnas1/hardware-configuration.nix b/modules/hosts/nixos/nixnas1/hardware-configuration.nix index 2b2d86a..8cce237 100644 --- a/modules/hosts/nixos/nixnas1/hardware-configuration.nix +++ b/modules/hosts/nixos/nixnas1/hardware-configuration.nix @@ -1,7 +1,7 @@ # 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, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/modules/hosts/nixos/nixnas1/home-gene.nix b/modules/hosts/nixos/nixnas1/home-gene.nix new file mode 100644 index 0000000..b6eed65 --- /dev/null +++ b/modules/hosts/nixos/nixnas1/home-gene.nix @@ -0,0 +1,3 @@ +{ ... }: { + home.stateVersion = "24.05"; +} diff --git a/modules/hosts/nixos/nixnuc/default.nix b/modules/hosts/nixos/nixnuc/default.nix index fbfd5d6..631cdea 100644 --- a/modules/hosts/nixos/nixnuc/default.nix +++ b/modules/hosts/nixos/nixnuc/default.nix @@ -1,4 +1,4 @@ -{ compose2nix, config, pkgs, username, ... }: let +{ inputs, config, pkgs, username, ... }: let http_port = 80; https_port = 443; home_domain = "home.technicalissues.us"; @@ -9,8 +9,8 @@ in { ./hardware-configuration.nix ./containers/audiobookshelf.nix ./containers/psitransfer.nix - ../../../system/common/linux/lets-encrypt.nix - ../../../system/common/linux/restic.nix + ../../common/linux/lets-encrypt.nix + ../../common/linux/restic.nix ]; system.stateVersion = "23.11"; @@ -29,7 +29,7 @@ in { }; environment.systemPackages = with pkgs; [ - compose2nix.packages.${pkgs.system}.default + inputs.compose2nix.packages.${pkgs.system}.default docker-compose intel-gpu-tools jellyfin @@ -481,6 +481,10 @@ in { isNormalUser = true; description = "Gene Liverman"; extraGroups = [ "docker" "podman" "networkmanager" "wheel" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFvLaPTfG3r+bcbI6DV4l69UgJjnwmZNCQk79HXyf1Pt gene@rainbow-planet" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIp42X5DZ713+bgbOO+GXROufUFdxWo7NjJbGQ285x3N gene.liverman@ltnglobal.com" + ]; }; # Enable common container config files in /etc/containers diff --git a/modules/hosts/nixos/nixnuc/hardware-configuration.nix b/modules/hosts/nixos/nixnuc/hardware-configuration.nix index 21ca6a5..17b0c38 100644 --- a/modules/hosts/nixos/nixnuc/hardware-configuration.nix +++ b/modules/hosts/nixos/nixnuc/hardware-configuration.nix @@ -1,7 +1,7 @@ # 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, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/modules/hosts/nixos/nixnuc/home-gene.nix b/modules/hosts/nixos/nixnuc/home-gene.nix new file mode 100644 index 0000000..21ec006 --- /dev/null +++ b/modules/hosts/nixos/nixnuc/home-gene.nix @@ -0,0 +1,3 @@ +{ ... }: { + home.stateVersion = "23.11"; +} diff --git a/modules/hosts/nixos/rainbow-planet/default.nix b/modules/hosts/nixos/rainbow-planet/default.nix index bcf7986..75d5e67 100644 --- a/modules/hosts/nixos/rainbow-planet/default.nix +++ b/modules/hosts/nixos/rainbow-planet/default.nix @@ -1,7 +1,7 @@ -{ config, inputs, pkgs, username, ... }: { +{ inputs, config, pkgs, username, ... }: { imports = [ ./hardware-configuration.nix - ../../../system/common/linux/flatpaks.nix + ../../common/linux/flatpaks.nix ]; system.stateVersion = "23.05"; @@ -89,7 +89,7 @@ services = { boinc.enable = true; dbus.implementation = "broker"; - #desktopManager.cosmic.enable = true; + desktopManager.cosmic.enable = true; desktopManager.plasma6.enable = true; displayManager.sddm = { enable = true; diff --git a/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix b/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix index e72494d..d3c51fe 100644 --- a/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix +++ b/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix @@ -1,7 +1,7 @@ # 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, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/modules/home-manager/hosts/rainbow-planet/gene.nix b/modules/hosts/nixos/rainbow-planet/home-gene.nix similarity index 95% rename from modules/home-manager/hosts/rainbow-planet/gene.nix rename to modules/hosts/nixos/rainbow-planet/home-gene.nix index fc2c0e1..daa8345 100644 --- a/modules/home-manager/hosts/rainbow-planet/gene.nix +++ b/modules/hosts/nixos/rainbow-planet/home-gene.nix @@ -1,14 +1,12 @@ -{ pkgs, genebean-omp-themes, ... }: { +{ pkgs, ... }: { home.stateVersion = "23.11"; imports = [ - ../../common/all-cli.nix ../../common/all-gui.nix - ../../common/all-linux.nix - ../../common/linux-apps/hexchat.nix - ../../common/linux-apps/pidgin.nix - ../../common/linux-apps/tilix.nix - ../../common/linux-apps/waybar.nix - ../../common/linux-apps/xfce4-terminal.nix + ../../common/linux/apps/hexchat.nix + ../../common/linux/apps/pidgin.nix + ../../common/linux/apps/tilix.nix + ../../common/linux/apps/waybar.nix + ../../common/linux/apps/xfce4-terminal.nix ]; home.file = {