diff --git a/flake.lock b/flake.lock index 41383f5..0b91744 100644 --- a/flake.lock +++ b/flake.lock @@ -17,6 +17,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1702569759, + "narHash": "sha256-Ze3AdEEsVZBRJ4wn13EZpV1Uubkzi59TkC4j2G9xoFI=", + "owner": "nix-community", + "repo": "disko", + "rev": "98ab91109716871f50ea8cb0e0ac7cc1e1e14714", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -143,6 +163,22 @@ "type": "indirect" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1702539185, + "narHash": "sha256-KnIRG5NMdLIpEkZTnN5zovNYc0hhXjAgv6pfd5Z4c7U=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "aa9d4729cbc99dabacb50e3994dcefb3ea0f7447", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1688049487, @@ -176,11 +212,13 @@ }, "root": { "inputs": { + "disko": "disko", "genebean-omp-themes": "genebean-omp-themes", "home-manager": "home-manager", "nix-darwin": "nix-darwin", "nix-homebrew": "nix-homebrew", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_3", + "nixpkgs-unstable": "nixpkgs-unstable" } }, "systems": { diff --git a/flake.nix b/flake.nix index 5a46531..4484ea1 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ # Where we get most of our software. Giant mono repo with recipes # called derivations that say how to build software. nixpkgs.url = "github:nixos/nixpkgs"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # Controls system level software and settings including fonts nix-darwin = { @@ -20,6 +21,12 @@ # Manage Homebrew itself nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; + # Format disks with nix-config + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # My oh-my-posh theme genebean-omp-themes = { url = "github:genebean/my-oh-my-posh-themes"; @@ -27,78 +34,90 @@ }; }; # end inputs - outputs = { self, nixpkgs, nix-darwin, home-manager, nix-homebrew, genebean-omp-themes, ... }: { - nixosConfigurations = let - user = "gene"; - in { - rainbow-planet = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./modules/nixos + outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, nix-darwin, home-manager, nix-homebrew, disko, genebean-omp-themes, ... }: let + inputs = { inherit disko home-manager nixpkgs nixpkgs-unstable nix-darwin; }; - home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.${user}.imports = [ - ./modules/home-manager - ./modules/home-manager/nixos.nix - ./modules/nixos/dconf.nix - ]; - extraSpecialArgs = { inherit genebean-omp-themes; }; - }; - } - ]; - }; # end rainbow-planet - }; # end nixosConfigurations - - # This is only set to work with x86 macOS right now... that will need to be updated - darwinConfigurations = let - user = "gene.liverman"; - in { - Blue-Rock = nix-darwin.lib.darwinSystem { - system = "x86_64-darwin"; - pkgs = import nixpkgs { - system = "x86_64-darwin"; - config = { - allowUnfree = true; - permittedInsecurePackages = [ - "python-2.7.18.6" - ]; - }; + # creates a macOS system config + darwinSystem = system: hostName: username: nix-darwin.lib.darwinSystem { + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "python-2.7.18.6" + ]; }; - modules = [ - nix-homebrew.darwinModules.nix-homebrew - { - nix-homebrew = { - # Install Homebrew under the default prefix - enable = true; + }; + modules = [ + nix-homebrew.darwinModules.nix-homebrew + { + nix-homebrew = { + # Install Homebrew under the default prefix + enable = true; - # User owning the Homebrew prefix - user = "${user}"; + # User owning the Homebrew prefix + user = "${username}"; - # Automatically migrate existing Homebrew installations - autoMigrate = true; - }; - } + # Automatically migrate existing Homebrew installations + autoMigrate = true; + }; + } - ./modules/darwin + home-manager.darwinModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.${username}.imports = [ + ./modules/home-manager + ./modules/home-manager/darwin.nix + ]; + extraSpecialArgs = { inherit genebean-omp-themes; }; + }; + } - home-manager.darwinModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.${user}.imports = [ - ./modules/home-manager - ./modules/home-manager/darwin.nix - ]; - extraSpecialArgs = { inherit genebean-omp-themes; }; - }; - } - ]; # end modules - }; # end Blue-Rock - }; # end darwinConfigurations + ./modules/common/darwin/all-hosts.nix + ./modules/hosts/darwin/${hostName} # ip address, host specific stuff + ]; # end modules + }; # end darwinSystem + + # creates a nixos system config + nixosSystem = system: hostName: username: nixpkgs.lib.nixosSystem { + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "electron-21.4.4" # Well, this sucks, hopefully a fixed version is available soon... + ]; + }; + }; + modules = [ + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.${username}.imports = [ + ./modules/home-manager + ./modules/home-manager/nixos.nix + ]; + extraSpecialArgs = { inherit genebean-omp-themes; }; + }; + } + + ./modules/common/nixos/all-hosts.nix + ./modules/hosts/nixos/${hostName} # ip address, host specific stuff + ]; + }; # end nixosSystem + + in { + darwinConfigurations = { + Blue-Rock = darwinSystem "x86_64-darwin" "Blue-Rock" "gene.liverman"; + }; + + nixosConfigurations = { + rainbow-planet = nixosSystem "x86_64-linux" "rainbow-planet" "gene"; + }; }; } diff --git a/modules/darwin/default.nix b/modules/common/darwin/all-hosts.nix similarity index 65% rename from modules/darwin/default.nix rename to modules/common/darwin/all-hosts.nix index c21f7a7..ba590c0 100644 --- a/modules/darwin/default.nix +++ b/modules/common/darwin/all-hosts.nix @@ -1,8 +1,6 @@ { pkgs, ... }: let - user = "gene.liverman"; + username = "gene.liverman"; in { - system.stateVersion = 4; - environment = { shells = with pkgs; [ bash zsh ]; loginShell = pkgs.zsh; @@ -12,16 +10,12 @@ in { ]; systemPackages = with pkgs; [ coreutils - chart-testing hugo - kopia - kubectx mas nmap nodejs nodePackages.npm openjdk - python2 ]; }; @@ -33,75 +27,44 @@ in { upgrade = true; }; taps = [ - "hashicorp/tap" - # "homebrew/bundle" "homebrew/cask-fonts" - # "jandedobbeleer/oh-my-posh" "null-dev/firefox-profile-switcher" - "puppetlabs/puppet" ]; brews = [ - "adr-tools" "ffmpeg" "firefox-profile-switcher-connector" - "helm" - "kubernetes-cli" ]; casks = [ "1password" "1password-cli" "amethyst" "angry-ip-scanner" - "asana" "audacity" "balenaetcher" - "boinc" - "cakebrew" - "discord" - "elgato-stream-deck" "firefox" "font-hack-nerd-font" "font-inconsolata-g-for-powerline" "font-source-code-pro-for-powerline" - "google-drive" "iterm2" "keepingyouawake" - "kopiaui" "libreoffice" "logseq" "meld" "nextcloud" - "obs" "onlyoffice" - "pdk" - "puppet-agent" - "puppet-bolt" - "qmk-toolbox" "raycast" "signal" "slack" "tailscale" - "thunderbird" - # "tunnelblick" - "vagrant" "vivaldi" - "virtualbox" "vlc" - "whalebird" - "zenmap" "zoom" ]; masApps = { "1Password for Safari" = 1569813296; "BetterSnapTool" = 417375580; "Home Assistant" = 1099568401; - "HomeCam" = 1292995895; - "Keeper Password Manager" = 414781829; - "MeetingBar" = 1532419400; - "Microsoft Remote Desktop" = 1295203466; "MQTT Explorer" = 1455214828; - "Telegram" = 747648890; - "WhatsApp Messenger" = 310633997; }; }; @@ -114,7 +77,7 @@ in { "flakes" "nix-command" ]; - trusted-users = [ "@admin" "${user}" ]; + trusted-users = [ "@admin" "${username}" ]; }; extraOptions = '' # Generated by https://github.com/DeterminateSystems/nix-installer, version 0.11.0. @@ -126,8 +89,8 @@ in { services.nix-daemon.enable = true; - users.users.${user} = { - home = "/Users/${user}"; + users.users.${username} = { + home = "/Users/${username}"; shell = pkgs.zsh; }; -} +} \ No newline at end of file diff --git a/modules/common/nixos/all-hosts.nix b/modules/common/nixos/all-hosts.nix new file mode 100644 index 0000000..e55df47 --- /dev/null +++ b/modules/common/nixos/all-hosts.nix @@ -0,0 +1,49 @@ +{ config, pkgs, ... }: { + imports = [ + ./internationalisation.nix + ]; + + environment = { + shells = with pkgs; [ bash zsh ]; + systemPackages = with pkgs; [ + angryipscanner + dconf2nix + file + neofetch + python3 + tailscale + ]; + }; + + fonts.fontDir.enable = false; + fonts.packages = with pkgs; [ + font-awesome + (nerdfonts.override { + fonts = [ + "Hack" + "SourceCodePro" + ]; + }) + ]; + + nix.settings = { + experimental-features = [ + "flakes" + "nix-command" + ]; + }; + + programs = { + zsh.enable = true; + }; + + security.sudo.wheelNeedsPassword = false; + + services.tailscale = { + enable = true; + }; + + time.timeZone = "America/New_York"; + + users.defaultUserShell = pkgs.zsh; +} \ No newline at end of file diff --git a/modules/common/nixos/internationalisation.nix b/modules/common/nixos/internationalisation.nix new file mode 100644 index 0000000..9463637 --- /dev/null +++ b/modules/common/nixos/internationalisation.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: { + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; +} \ No newline at end of file diff --git a/modules/nixos/dconf.nix b/modules/home-manager/dconf.nix similarity index 100% rename from modules/nixos/dconf.nix rename to modules/home-manager/dconf.nix diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/nixos.nix index dfe0165..5ce2bf9 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/nixos.nix @@ -1,4 +1,7 @@ { pkgs, ... }: { + imports = [ + ./dconf.nix + ]; home.file = { ".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { owner = "catppuccin"; diff --git a/modules/hosts/darwin/Blue-Rock/default.nix b/modules/hosts/darwin/Blue-Rock/default.nix new file mode 100644 index 0000000..651bc86 --- /dev/null +++ b/modules/hosts/darwin/Blue-Rock/default.nix @@ -0,0 +1,52 @@ +{ pkgs, ... }: { + system.stateVersion = 4; + + environment = { + systemPackages = with pkgs; [ + chart-testing + kopia + kubectx + python2 + ]; + }; + + homebrew = { + taps = [ + "hashicorp/tap" + # "homebrew/bundle" + # "jandedobbeleer/oh-my-posh" + "puppetlabs/puppet" + ]; + brews = [ + "adr-tools" + "helm" + "kubernetes-cli" + ]; + casks = [ + "asana" + "boinc" + "discord" + "elgato-stream-deck" + "google-drive" + "kopiaui" + "obs" + "pdk" + "puppet-agent" + "puppet-bolt" + "qmk-toolbox" + "thunderbird" + "vagrant" + "virtualbox" + "whalebird" + "zenmap" + ]; + masApps = { + "HomeCam" = 1292995895; + "Keeper Password Manager" = 414781829; + "MeetingBar" = 1532419400; + "Microsoft Remote Desktop" = 1295203466; + "Telegram" = 747648890; + "WhatsApp Messenger" = 310633997; + }; + }; +} diff --git a/modules/hosts/nixos/rainbow-planet/default.nix b/modules/hosts/nixos/rainbow-planet/default.nix new file mode 100644 index 0000000..6cc946c --- /dev/null +++ b/modules/hosts/nixos/rainbow-planet/default.nix @@ -0,0 +1,110 @@ +{ config, pkgs, ... }: let + username = "gene"; + hostname = "rainbow-planet"; +in { + imports = [ + ./hardware-configuration.nix + ]; + + system.stateVersion = "23.05"; + + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot= { + enable = true; + consoleMode = "1"; + }; + }; + + environment.systemPackages = with pkgs; [ + # host specific apps + boinc + brightnessctl + gnome.nautilus + pavucontrol + polkit-kde-agent + ulauncher + whalebird + wmctrl + + # common gui apps that really should be in another file + firefox + libreoffice + meld + slack + tilix + vivaldi + xfce.xfce4-terminal + zoom-us + ]; + + networking = { + hostName = "${hostname}"; + networkmanager.enable = true; + }; + + nix.settings.allowed-users = [ "${username}" ]; + + programs = { + _1password.enable = true; + _1password-gui = { + enable = true; + # Certain features, including CLI integration and system authentication support, + # require enabling PolKit integration on some desktop environments (e.g. Plasma). + polkitPolicyOwners = [ "${username}" ]; + }; + hyprland.enable = true; + + # common programs that really should be in another file + # required for setting to be picked up by xfce4-terminal + xfconf.enable = true; + }; + + services = { + boinc.enable = true; + gnome.gnome-keyring.enable = true; # Provides secret storage + gvfs.enable = true; # Used by Nautilus + printing.enable = true; # Enable CUPS + tailscale = { + extraUpFlags = [ + "--ssh" + ]; + }; + xserver = { + enable = true; # Enable the X11 windowing system. + + # Configure keymap in X11 + layout = "us"; + xkbVariant = ""; + + displayManager = { + gdm = { + enable = true; + wayland = true; + }; + }; + }; + }; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${username} = { + isNormalUser = true; + description = "Gene Liverman"; + extraGroups = [ "networkmanager" "wheel" "dialout" "input" ]; + packages = with pkgs; [ + tailscale-systray + ]; + }; +} diff --git a/modules/nixos/hardware-configuration.nix b/modules/hosts/nixos/rainbow-planet/hardware-configuration.nix similarity index 100% rename from modules/nixos/hardware-configuration.nix rename to modules/hosts/nixos/rainbow-planet/hardware-configuration.nix diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix deleted file mode 100644 index e211978..0000000 --- a/modules/nixos/default.nix +++ /dev/null @@ -1,171 +0,0 @@ -{ config, pkgs, ... }: let - user = "gene"; - hostname = "rainbow-planet"; -in { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - system.stateVersion = "23.05"; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.systemd-boot.consoleMode = "1"; - - networking = { - hostName = "${hostname}"; - networkmanager.enable = true; - }; - services.tailscale = { - enable = true; - extraUpFlags = [ - "--ssh" - ]; - }; - - time.timeZone = "America/New_York"; - - # Select internationalisation properties. - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - }; - - services.xserver = { - enable = true; # Enable the X11 windowing system. - - # Configure keymap in X11 - layout = "us"; - xkbVariant = ""; - - displayManager = { - gdm = { - enable = true; - wayland = true; - }; - }; - }; - - programs.hyprland.enable = true; - - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - wireplumber.enable = true; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.${user} = { - isNormalUser = true; - description = "Gene Liverman"; - extraGroups = [ "networkmanager" "wheel" "dialout" "input" ]; - packages = with pkgs; [ - tailscale-systray - ]; - }; - - environment.shells = with pkgs; [ bash zsh ]; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - security.sudo.wheelNeedsPassword = false; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # Well, this sucks, hopefully a fixed version is available soon... - nixpkgs.config.permittedInsecurePackages = [ - "electron-21.4.4" - ]; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - angryipscanner - boinc - brightnessctl - dconf2nix - file - firefox - gnome.nautilus - libreoffice - meld - neofetch - pavucontrol - polkit-kde-agent - python3 - slack - tailscale - tilix - ulauncher - vivaldi - whalebird - wmctrl - xfce.xfce4-terminal - zoom-us - ]; - - programs = { - _1password.enable = true; - _1password-gui = { - enable = true; - # Certain features, including CLI integration and system authentication support, - # require enabling PolKit integration on some desktop environments (e.g. Plasma). - polkitPolicyOwners = [ "${user}" ]; - }; - # required for setting to be picked up by xfce4-terminal - xfconf.enable = true; - }; - - # Used by Nautilus - services.gvfs.enable = true; - - # Provides secret storage - services.gnome.gnome-keyring.enable = true; - - services.boinc.enable = true; - - nix.settings = { - allowed-users = [ "${user}" ]; - experimental-features = [ - "flakes" - "nix-command" - ]; - }; - - fonts.fontDir.enable = false; - fonts.packages = with pkgs; [ - font-awesome - (nerdfonts.override { - fonts = [ - "Hack" - "SourceCodePro" - ]; - }) - ]; -}