diff --git a/flake.nix b/flake.nix index 9856d7c..1de65a0 100644 --- a/flake.nix +++ b/flake.nix @@ -89,6 +89,11 @@ inputs.nixpkgs.follows = "nixpkgs-darwin"; }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # 3rd party inputs disko = { # Declarative partitioning @@ -101,6 +106,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nixvirt = { + url = "https://flakehub.com/f/AshleyYakeley/NixVirt/*.tar.gz"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # CrOS inputs #nix-secrets.url = "github:TheWanderingCrow/nix-secrets"; nvix.url = "github:TheWanderingCrow/nvix"; diff --git a/hosts/common/core/darwin.nix b/hosts/common/core/darwin.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/hosts/common/core/darwin.nix @@ -0,0 +1 @@ +{} diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index 63db315..36fa7dd 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -1,3 +1,59 @@ -{lib, ...}: { - imports = lib.custom.scanPaths ./.; +{ + inputs, + outputs, + config, + lib, + pkgs, + isDarwin, + ... +}: let + platform = + if isDarwin + then "darwin" + else "nixos"; + platformModules = "${platform}Modules"; +in { + imports = lib.flatten [ + inputs.home-manager.${platformModules}.home-manager + inputs.sops-nix.${platformModules}.sops + + (map lib.custom.relativeToRoot [ + "hosts/common/core/${platform}.nix" + "hosts/common/core/shell.nix" + "hosts/common/core/sops.nix" + "hosts/common/core/ssh.nix" + ]) + ]; + + hostSpec = { + username = "crow"; + handle = "TheWanderingCrow"; + }; + + networking.hostName = config.hostSpec.hostName; + + environment.systemPackages = [pkgs.openssh]; + + home-manager.useGlobalPkgs = true; + home-manager.backupFileExtension = "bk"; + + nixpkgs = { + config = { + allowUnfree = true; + }; + }; + + nix = { + connect-timeout = 5; + log-lines = 25; + min-free = 128000000; + max-free = 1000000000; + + experimental-features = ["nix-command" "flakes"]; + + fallback = true; + auto-optimise-store = true; + + trusted-users = ["@wheel"]; + }; } diff --git a/hosts/common/core/nixos.nix b/hosts/common/core/nixos.nix new file mode 100644 index 0000000..9bc9864 --- /dev/null +++ b/hosts/common/core/nixos.nix @@ -0,0 +1,8 @@ +{ + config, + lib, + ... +}: { + time.timeZone = lib.mkDefault "America/New_York"; + i18n.defaultLocale = lib.mkDefault "en_US.UTF-8"; +} diff --git a/hosts/common/optional/audio.nix b/hosts/common/optional/audio.nix new file mode 100644 index 0000000..6d57406 --- /dev/null +++ b/hosts/common/optional/audio.nix @@ -0,0 +1,9 @@ +{ + services.pulseaudio.support32Bit = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; +}