From cb2631657ba600018e2c49bb374b2960e347a568 Mon Sep 17 00:00:00 2001 From: Tucker Shea Date: Mon, 9 Sep 2024 16:20:53 -0400 Subject: [PATCH] Organize hosts and home (#75) * Reorganize host config Host config got a bit mixed up, as well as having issues like core and core-darwin having unnecessarily similar names, so we regroup into better "bundles" by platform and purpose. * Reorganize home config Sort out home config into bundles for more opaque option selection per host. * Separate nixos-specific and darwin-specific options Right now nixos rejects unfamiliar options and darwin may do the same. For now we separate into different bundles that are included. In the future this could potentially be further sorted out. --- flake.nix | 24 +++++-- home/tuckershea/common/core/pyenv.nix | 6 -- home/tuckershea/darwin/default.nix | 5 ++ .../core-darwin => darwin}/defaults.nix | 0 home/tuckershea/elmira.nix | 14 ---- .../optional => graphical}/alacritty.nix | 0 home/tuckershea/graphical/default.nix | 6 ++ .../surfingkeys/default.nix | 0 .../surfingkeys/surfingkeys.js | 0 .../core-darwin => hosts/elmira}/default.nix | 1 + home/tuckershea/hosts/elmira/git.nix | 6 ++ .../ssh/elmira.nix => hosts/elmira/ssh.nix} | 2 +- home/tuckershea/marlon.nix | 5 -- home/tuckershea/roland.nix | 5 -- .../{common/core => shell}/default.nix | 16 +---- .../tuckershea/{common/core => shell}/fzf.nix | 0 .../tuckershea/{common/core => shell}/git.nix | 11 +-- .../{common/core => shell}/neovim.nix | 0 home/tuckershea/shell/nix-index.nix | 8 +++ home/tuckershea/shell/ripgrep.nix | 9 +++ home/tuckershea/shell/ssh.nix | 26 +++++++ .../{common/core => shell}/thefuck.nix | 0 .../{common/core => shell}/tmux/default.nix | 0 .../{common/core => shell}/tmux/tmux.conf | 0 .../{common/core => shell}/zsh/default.nix | 0 .../{common/core => shell}/zsh/p10k.zsh | 0 home/tuckershea/vic.nix | 7 -- hosts/common/core/default.nix | 10 --- hosts/common/core/nix.nix | 68 +++++++++++-------- hosts/common/core/registry.nix | 9 --- .../{core-darwin => darwin}/default.nix | 3 +- .../font-smoothing.nix} | 0 .../{core-darwin => darwin}/keyboard.nix | 0 hosts/common/darwin/nix.nix | 10 +++ hosts/common/graphical/default.nix | 5 ++ .../common/{optional => graphical}/fonts.nix | 0 .../{optional => nixos}/auto-upgrade.nix | 0 .../common/{core-nixos => nixos}/default.nix | 3 + .../common/{core-nixos => nixos}/network.nix | 0 hosts/common/nixos/nix.nix | 4 ++ .../{core-nixos => nixos}/no-wait-online.nix | 0 .../{core-nixos => nixos}/node-exporter.nix | 0 hosts/common/{core => nixos}/openssh.nix | 5 +- .../sudo-no-password.nix | 0 .../{core-nixos => nixos}/tailscale.nix | 0 hosts/common/users/root/default.nix | 7 -- hosts/common/users/tuckershea/default.nix | 12 ++-- hosts/elmira/default.nix | 5 +- hosts/marlon/default.nix | 5 +- hosts/roland/default.nix | 5 +- hosts/vic/default.nix | 8 +-- 51 files changed, 171 insertions(+), 139 deletions(-) delete mode 100644 home/tuckershea/common/core/pyenv.nix create mode 100644 home/tuckershea/darwin/default.nix rename home/tuckershea/{common/core-darwin => darwin}/defaults.nix (100%) delete mode 100644 home/tuckershea/elmira.nix rename home/tuckershea/{common/optional => graphical}/alacritty.nix (100%) create mode 100644 home/tuckershea/graphical/default.nix rename home/tuckershea/{common/core => graphical}/surfingkeys/default.nix (100%) rename home/tuckershea/{common/core => graphical}/surfingkeys/surfingkeys.js (100%) rename home/tuckershea/{common/core-darwin => hosts/elmira}/default.nix (62%) create mode 100644 home/tuckershea/hosts/elmira/git.nix rename home/tuckershea/{common/optional/ssh/elmira.nix => hosts/elmira/ssh.nix} (94%) delete mode 100644 home/tuckershea/marlon.nix delete mode 100644 home/tuckershea/roland.nix rename home/tuckershea/{common/core => shell}/default.nix (66%) rename home/tuckershea/{common/core => shell}/fzf.nix (100%) rename home/tuckershea/{common/core => shell}/git.nix (65%) rename home/tuckershea/{common/core => shell}/neovim.nix (100%) create mode 100644 home/tuckershea/shell/nix-index.nix create mode 100644 home/tuckershea/shell/ripgrep.nix create mode 100644 home/tuckershea/shell/ssh.nix rename home/tuckershea/{common/core => shell}/thefuck.nix (100%) rename home/tuckershea/{common/core => shell}/tmux/default.nix (100%) rename home/tuckershea/{common/core => shell}/tmux/tmux.conf (100%) rename home/tuckershea/{common/core => shell}/zsh/default.nix (100%) rename home/tuckershea/{common/core => shell}/zsh/p10k.zsh (100%) delete mode 100644 home/tuckershea/vic.nix delete mode 100644 hosts/common/core/registry.nix rename hosts/common/{core-darwin => darwin}/default.nix (51%) rename hosts/common/{core-darwin/auto-font-smoothing.nix => darwin/font-smoothing.nix} (100%) rename hosts/common/{core-darwin => darwin}/keyboard.nix (100%) create mode 100644 hosts/common/darwin/nix.nix create mode 100644 hosts/common/graphical/default.nix rename hosts/common/{optional => graphical}/fonts.nix (100%) rename hosts/common/{optional => nixos}/auto-upgrade.nix (100%) rename hosts/common/{core-nixos => nixos}/default.nix (79%) rename hosts/common/{core-nixos => nixos}/network.nix (100%) create mode 100644 hosts/common/nixos/nix.nix rename hosts/common/{core-nixos => nixos}/no-wait-online.nix (100%) rename hosts/common/{core-nixos => nixos}/node-exporter.nix (100%) rename hosts/common/{core => nixos}/openssh.nix (74%) rename hosts/common/{core-nixos => nixos}/sudo-no-password.nix (100%) rename hosts/common/{core-nixos => nixos}/tailscale.nix (100%) delete mode 100644 hosts/common/users/root/default.nix diff --git a/flake.nix b/flake.nix index 6efd5db..a61dde7 100644 --- a/flake.nix +++ b/flake.nix @@ -53,7 +53,13 @@ ./hosts/elmira home-manager.darwinModules.home-manager { - home-manager.users.tuckershea = import ./home/tuckershea/elmira.nix; + home-manager.users.tuckershea.imports = [ + ./home/tuckershea/shell + ./home/tuckershea/graphical + ./home/tuckershea/darwin + ./home/tuckershea/hosts/elmira + ]; + home-manager.extraSpecialArgs = {inherit inputs outputs;}; } ]; }; @@ -68,7 +74,10 @@ impermanence.nixosModules.impermanence disko.nixosModules.disko { - home-manager.users.tuckershea = import ./home/tuckershea/marlon.nix; + home-manager.users.tuckershea.imports = [ + ./home/tuckershea/shell + ]; + home-manager.extraSpecialArgs = {inherit inputs outputs;}; } ]; }; @@ -83,7 +92,10 @@ impermanence.nixosModules.impermanence disko.nixosModules.disko { - home-manager.users.tuckershea = import ./home/tuckershea/roland.nix; + home-manager.users.tuckershea.imports = [ + ./home/tuckershea/shell + ]; + home-manager.extraSpecialArgs = {inherit inputs outputs;}; } ]; }; @@ -96,7 +108,11 @@ sops-nix.nixosModules.sops home-manager.nixosModules.home-manager { - home-manager.users.tuckershea = import ./home/tuckershea/vic.nix; + home-manager.users.tuckershea.imports = [ + ./home/tuckershea/shell + ./home/tuckershea/graphical + ]; + home-manager.extraSpecialArgs = {inherit inputs outputs;}; } ]; }; diff --git a/home/tuckershea/common/core/pyenv.nix b/home/tuckershea/common/core/pyenv.nix deleted file mode 100644 index 1085d17..0000000 --- a/home/tuckershea/common/core/pyenv.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - programs.pyenv = { - enable = true; - enableZshIntegration = true; - }; -} diff --git a/home/tuckershea/darwin/default.nix b/home/tuckershea/darwin/default.nix new file mode 100644 index 0000000..ddc90d6 --- /dev/null +++ b/home/tuckershea/darwin/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./defaults.nix + ]; +} diff --git a/home/tuckershea/common/core-darwin/defaults.nix b/home/tuckershea/darwin/defaults.nix similarity index 100% rename from home/tuckershea/common/core-darwin/defaults.nix rename to home/tuckershea/darwin/defaults.nix diff --git a/home/tuckershea/elmira.nix b/home/tuckershea/elmira.nix deleted file mode 100644 index f8a0b2c..0000000 --- a/home/tuckershea/elmira.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: { - imports = [ - ./common/core - ./common/core-darwin - - ./common/optional/ssh/elmira.nix - ./common/optional/alacritty.nix - ]; -} diff --git a/home/tuckershea/common/optional/alacritty.nix b/home/tuckershea/graphical/alacritty.nix similarity index 100% rename from home/tuckershea/common/optional/alacritty.nix rename to home/tuckershea/graphical/alacritty.nix diff --git a/home/tuckershea/graphical/default.nix b/home/tuckershea/graphical/default.nix new file mode 100644 index 0000000..07d9265 --- /dev/null +++ b/home/tuckershea/graphical/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./alacritty.nix + ./surfingkeys + ]; +} diff --git a/home/tuckershea/common/core/surfingkeys/default.nix b/home/tuckershea/graphical/surfingkeys/default.nix similarity index 100% rename from home/tuckershea/common/core/surfingkeys/default.nix rename to home/tuckershea/graphical/surfingkeys/default.nix diff --git a/home/tuckershea/common/core/surfingkeys/surfingkeys.js b/home/tuckershea/graphical/surfingkeys/surfingkeys.js similarity index 100% rename from home/tuckershea/common/core/surfingkeys/surfingkeys.js rename to home/tuckershea/graphical/surfingkeys/surfingkeys.js diff --git a/home/tuckershea/common/core-darwin/default.nix b/home/tuckershea/hosts/elmira/default.nix similarity index 62% rename from home/tuckershea/common/core-darwin/default.nix rename to home/tuckershea/hosts/elmira/default.nix index f7e9be4..c37b37a 100644 --- a/home/tuckershea/common/core-darwin/default.nix +++ b/home/tuckershea/hosts/elmira/default.nix @@ -1,4 +1,5 @@ { imports = [ + ./ssh.nix ]; } diff --git a/home/tuckershea/hosts/elmira/git.nix b/home/tuckershea/hosts/elmira/git.nix new file mode 100644 index 0000000..0585b9d --- /dev/null +++ b/home/tuckershea/hosts/elmira/git.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + programs.git.extraConfig = { + "gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; + }; +} diff --git a/home/tuckershea/common/optional/ssh/elmira.nix b/home/tuckershea/hosts/elmira/ssh.nix similarity index 94% rename from home/tuckershea/common/optional/ssh/elmira.nix rename to home/tuckershea/hosts/elmira/ssh.nix index 7894489..760e353 100644 --- a/home/tuckershea/common/optional/ssh/elmira.nix +++ b/home/tuckershea/hosts/elmira/ssh.nix @@ -30,5 +30,5 @@ }; home.file.".ssh/.keep".text = "Managed by home-manager"; - home.file.".ssh/id_tuckershea_elmira.pub".source = ../../../../../resources/publickeys/id_tuckershea_elmira.pub; + home.file.".ssh/id_tuckershea_elmira.pub".source = ../../../../resources/publickeys/id_tuckershea_elmira.pub; } diff --git a/home/tuckershea/marlon.nix b/home/tuckershea/marlon.nix deleted file mode 100644 index e0864f2..0000000 --- a/home/tuckershea/marlon.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - imports = [ - ./common/core - ]; -} diff --git a/home/tuckershea/roland.nix b/home/tuckershea/roland.nix deleted file mode 100644 index e0864f2..0000000 --- a/home/tuckershea/roland.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - imports = [ - ./common/core - ]; -} diff --git a/home/tuckershea/common/core/default.nix b/home/tuckershea/shell/default.nix similarity index 66% rename from home/tuckershea/common/core/default.nix rename to home/tuckershea/shell/default.nix index 46333ea..cb737ba 100644 --- a/home/tuckershea/common/core/default.nix +++ b/home/tuckershea/shell/default.nix @@ -5,13 +5,11 @@ ... }: { imports = [ - inputs.nix-index-database.hmModules.nix-index - ./fzf.nix ./git.nix ./neovim.nix - ./pyenv.nix - ./surfingkeys + ./nix-index.nix + ./ripgrep.nix ./thefuck.nix ./tmux ./zsh @@ -41,14 +39,4 @@ tailscale wget ]; - - programs.ripgrep = { - enable = true; - arguments = [ - "--max-columns=150" - "--smart-case" - ]; - }; - - programs.nix-index-database.comma.enable = true; } diff --git a/home/tuckershea/common/core/fzf.nix b/home/tuckershea/shell/fzf.nix similarity index 100% rename from home/tuckershea/common/core/fzf.nix rename to home/tuckershea/shell/fzf.nix diff --git a/home/tuckershea/common/core/git.nix b/home/tuckershea/shell/git.nix similarity index 65% rename from home/tuckershea/common/core/git.nix rename to home/tuckershea/shell/git.nix index 33b1e92..002a773 100644 --- a/home/tuckershea/common/core/git.nix +++ b/home/tuckershea/shell/git.nix @@ -1,4 +1,8 @@ -{lib, ...}: { +{ + lib, + pkgs, + ... +}: { programs.git = { enable = true; delta.enable = true; @@ -13,7 +17,7 @@ "**/._.DS_Store" ]; signing = { - key = lib.removeSuffix "\n" (builtins.readFile ../../../../resources/publickeys/id_norepercussions_github.pub); + key = lib.removeSuffix "\n" (builtins.readFile ../../../resources/publickeys/id_norepercussions_github.pub); signByDefault = true; }; userEmail = "tucker@tuckershea.com"; @@ -22,9 +26,6 @@ gpg.format = "ssh"; core.autocrlf = "input"; init.defaultBranch = "main"; - - # todo: change this for non-mac systems - "gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; }; }; } diff --git a/home/tuckershea/common/core/neovim.nix b/home/tuckershea/shell/neovim.nix similarity index 100% rename from home/tuckershea/common/core/neovim.nix rename to home/tuckershea/shell/neovim.nix diff --git a/home/tuckershea/shell/nix-index.nix b/home/tuckershea/shell/nix-index.nix new file mode 100644 index 0000000..07cc605 --- /dev/null +++ b/home/tuckershea/shell/nix-index.nix @@ -0,0 +1,8 @@ +{ inputs, ... }: +{ + imports = [ + inputs.nix-index-database.hmModules.nix-index + ]; + + programs.nix-index-database.comma.enable = true; +} diff --git a/home/tuckershea/shell/ripgrep.nix b/home/tuckershea/shell/ripgrep.nix new file mode 100644 index 0000000..c3343b6 --- /dev/null +++ b/home/tuckershea/shell/ripgrep.nix @@ -0,0 +1,9 @@ +{ + programs.ripgrep = { + enable = true; + arguments = [ + "--max-columns=150" + "--smart-case" + ]; + }; +} diff --git a/home/tuckershea/shell/ssh.nix b/home/tuckershea/shell/ssh.nix new file mode 100644 index 0000000..59be01b --- /dev/null +++ b/home/tuckershea/shell/ssh.nix @@ -0,0 +1,26 @@ +{lib, ...}: +{ + programs.ssh = { + enable = true; + serverAliveInterval = 30; + + matchBlocks = { + famat = lib.hm.dag.entryBefore ["*"] { + hostname = "ssh.pythonanywhere.com"; + user = "famat"; + identitiesOnly = true; + }; + andrew = lib.hm.dag.entryBefore ["*"] { + hostname = "unix.andrew.cmu.edu"; + user = "tshea"; + }; + }; + + extraConfig = lib.mkMerge [ + "GSSAPIAuthentication yes" + "GSSAPIDelegateCredentials yes" + ]; + }; + + home.file.".ssh/.keep".text = "Managed by home-manager"; +} diff --git a/home/tuckershea/common/core/thefuck.nix b/home/tuckershea/shell/thefuck.nix similarity index 100% rename from home/tuckershea/common/core/thefuck.nix rename to home/tuckershea/shell/thefuck.nix diff --git a/home/tuckershea/common/core/tmux/default.nix b/home/tuckershea/shell/tmux/default.nix similarity index 100% rename from home/tuckershea/common/core/tmux/default.nix rename to home/tuckershea/shell/tmux/default.nix diff --git a/home/tuckershea/common/core/tmux/tmux.conf b/home/tuckershea/shell/tmux/tmux.conf similarity index 100% rename from home/tuckershea/common/core/tmux/tmux.conf rename to home/tuckershea/shell/tmux/tmux.conf diff --git a/home/tuckershea/common/core/zsh/default.nix b/home/tuckershea/shell/zsh/default.nix similarity index 100% rename from home/tuckershea/common/core/zsh/default.nix rename to home/tuckershea/shell/zsh/default.nix diff --git a/home/tuckershea/common/core/zsh/p10k.zsh b/home/tuckershea/shell/zsh/p10k.zsh similarity index 100% rename from home/tuckershea/common/core/zsh/p10k.zsh rename to home/tuckershea/shell/zsh/p10k.zsh diff --git a/home/tuckershea/vic.nix b/home/tuckershea/vic.nix deleted file mode 100644 index dc780c6..0000000 --- a/home/tuckershea/vic.nix +++ /dev/null @@ -1,7 +0,0 @@ -{...}: { - imports = [ - ./common/core - - ./common/optional/alacritty.nix - ]; -} diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index 35c3130..123b2a5 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -7,16 +7,6 @@ ./git.nix ./locale.nix ./nix.nix - ./openssh.nix - ./registry.nix ./zsh.nix ]; - - home-manager.extraSpecialArgs = {inherit inputs outputs;}; - - nixpkgs = { - config = { - allowUnfree = true; - }; - }; } diff --git a/hosts/common/core/nix.nix b/hosts/common/core/nix.nix index 9adba5a..122ae30 100644 --- a/hosts/common/core/nix.nix +++ b/hosts/common/core/nix.nix @@ -5,40 +5,48 @@ options, ... }: -lib.mkMerge [ - { - nix = { - settings = { - # auto-optimise-store = true; - experimental-features = ["nix-command" "flakes"]; - warn-dirty = false; +{ + nix = { + settings = { + auto-optimise-store = true; + experimental-features = ["nix-command" "flakes"]; + warn-dirty = false; + + trusted-public-keys = [ + "hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" + "tuckershea.cachix.org-1:a9DdtLF8DyqAHFV7VHlA7YvasP6wUMHdOygVyks3JGM=" + ]; - # Maybe make this darwin-specific? - extra-platforms = ["x86_64-darwin" "aarch64-darwin"]; + substituters = [ + "https://cache.nixos.org/" + "https://tuckershea.cachix.org" + ]; + }; - trusted-public-keys = [ - "hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" - "tuckershea.cachix.org-1:a9DdtLF8DyqAHFV7VHlA7YvasP6wUMHdOygVyks3JGM=" - ]; + gc = { + automatic = true; - substituters = [ - "https://cache.nixos.org/" - "https://tuckershea.cachix.org" - ]; - }; + # GC every Monday morning + # customized in hosts/common/darwin/nix.nix + # and hosts/common/nixos/nix.nix - gc = { - automatic = true; - # nixos and darwin have different ways to configure - # this interval, so instead we just leave it to - # the default of 3:15 daily, which is fine. - options = "--delete-older-than 7d"; + # keep profile generations around for one week + options = "--delete-older-than 7d"; + }; + + registry = { + # Lock nixpkgs so we don't need to download it + # every time we want to do nix run/develop/etc + nixpkgs = { + from = { id = "nixpkgs"; type = "indirect"; }; + flake = inputs.nixpkgs; }; }; - } + }; - # nix-daemon only on darwin, check option to avoid recursion - (lib.optionalAttrs (lib.hasAttr "nix-daemon" options.services) { - services.nix-daemon.enable = true; - }) -] + nixpkgs = { + config = { + allowUnfree = true; + }; + }; +} diff --git a/hosts/common/core/registry.nix b/hosts/common/core/registry.nix deleted file mode 100644 index 95030fc..0000000 --- a/hosts/common/core/registry.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ inputs, ... }: -{ - nix.registry = { - nixpkgs = { - from = { id = "nixpkgs"; type = "indirect"; }; - flake = inputs.nixpkgs; - }; - }; -} diff --git a/hosts/common/core-darwin/default.nix b/hosts/common/darwin/default.nix similarity index 51% rename from hosts/common/core-darwin/default.nix rename to hosts/common/darwin/default.nix index a1539e6..927b528 100644 --- a/hosts/common/core-darwin/default.nix +++ b/hosts/common/darwin/default.nix @@ -1,6 +1,7 @@ { imports = [ - ./auto-font-smoothing.nix + ./font-smoothing.nix ./keyboard.nix + ./nix.nix ]; } diff --git a/hosts/common/core-darwin/auto-font-smoothing.nix b/hosts/common/darwin/font-smoothing.nix similarity index 100% rename from hosts/common/core-darwin/auto-font-smoothing.nix rename to hosts/common/darwin/font-smoothing.nix diff --git a/hosts/common/core-darwin/keyboard.nix b/hosts/common/darwin/keyboard.nix similarity index 100% rename from hosts/common/core-darwin/keyboard.nix rename to hosts/common/darwin/keyboard.nix diff --git a/hosts/common/darwin/nix.nix b/hosts/common/darwin/nix.nix new file mode 100644 index 0000000..a27ad9a --- /dev/null +++ b/hosts/common/darwin/nix.nix @@ -0,0 +1,10 @@ +{ + nix.settings.extra-platforms = ["x86_64-darwin" "aarch64-darwin"]; + services.nix-daemon.enable = true; + + nix.gc.interval = [{ + Hour = 3; + Minute = 15; + Weekday = 1; + }]; +} diff --git a/hosts/common/graphical/default.nix b/hosts/common/graphical/default.nix new file mode 100644 index 0000000..ce0d4a3 --- /dev/null +++ b/hosts/common/graphical/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ + ./fonts.nix + ]; +} diff --git a/hosts/common/optional/fonts.nix b/hosts/common/graphical/fonts.nix similarity index 100% rename from hosts/common/optional/fonts.nix rename to hosts/common/graphical/fonts.nix diff --git a/hosts/common/optional/auto-upgrade.nix b/hosts/common/nixos/auto-upgrade.nix similarity index 100% rename from hosts/common/optional/auto-upgrade.nix rename to hosts/common/nixos/auto-upgrade.nix diff --git a/hosts/common/core-nixos/default.nix b/hosts/common/nixos/default.nix similarity index 79% rename from hosts/common/core-nixos/default.nix rename to hosts/common/nixos/default.nix index 6820e8b..1a7b2a6 100644 --- a/hosts/common/core-nixos/default.nix +++ b/hosts/common/nixos/default.nix @@ -1,8 +1,11 @@ { imports = [ + ./auto-upgrade.nix ./network.nix + ./nix.nix ./no-wait-online.nix # mitigate NetworkManager Wait-Online failure ./node-exporter.nix + ./openssh.nix ./sudo-no-password.nix # don't require password for sudo ./tailscale.nix ]; diff --git a/hosts/common/core-nixos/network.nix b/hosts/common/nixos/network.nix similarity index 100% rename from hosts/common/core-nixos/network.nix rename to hosts/common/nixos/network.nix diff --git a/hosts/common/nixos/nix.nix b/hosts/common/nixos/nix.nix new file mode 100644 index 0000000..d7e1023 --- /dev/null +++ b/hosts/common/nixos/nix.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + nix.gc.dates = "Mon *-*-* 03:15:00"; +} diff --git a/hosts/common/core-nixos/no-wait-online.nix b/hosts/common/nixos/no-wait-online.nix similarity index 100% rename from hosts/common/core-nixos/no-wait-online.nix rename to hosts/common/nixos/no-wait-online.nix diff --git a/hosts/common/core-nixos/node-exporter.nix b/hosts/common/nixos/node-exporter.nix similarity index 100% rename from hosts/common/core-nixos/node-exporter.nix rename to hosts/common/nixos/node-exporter.nix diff --git a/hosts/common/core/openssh.nix b/hosts/common/nixos/openssh.nix similarity index 74% rename from hosts/common/core/openssh.nix rename to hosts/common/nixos/openssh.nix index 8071687..a827cac 100644 --- a/hosts/common/core/openssh.nix +++ b/hosts/common/nixos/openssh.nix @@ -2,8 +2,9 @@ lib, pkgs, ... -}: { - services.openssh = lib.optionalAttrs pkgs.stdenv.isLinux { +}: +{ + services.openssh = { enable = true; ports = [22]; # change this later? diff --git a/hosts/common/core-nixos/sudo-no-password.nix b/hosts/common/nixos/sudo-no-password.nix similarity index 100% rename from hosts/common/core-nixos/sudo-no-password.nix rename to hosts/common/nixos/sudo-no-password.nix diff --git a/hosts/common/core-nixos/tailscale.nix b/hosts/common/nixos/tailscale.nix similarity index 100% rename from hosts/common/core-nixos/tailscale.nix rename to hosts/common/nixos/tailscale.nix diff --git a/hosts/common/users/root/default.nix b/hosts/common/users/root/default.nix deleted file mode 100644 index cfdea47..0000000 --- a/hosts/common/users/root/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - users.users.root = { - openssh.authorizedKeys.keyFiles = [ - ../../../../resources/publickeys/id_tuckershea_elmira.pub - ]; - }; -} diff --git a/hosts/common/users/tuckershea/default.nix b/hosts/common/users/tuckershea/default.nix index 6df1a60..dd2a417 100644 --- a/hosts/common/users/tuckershea/default.nix +++ b/hosts/common/users/tuckershea/default.nix @@ -7,18 +7,16 @@ in { users.users.tuckershea = { - home = - if stdenv.isDarwin - then "/Users/tuckershea" - else "/home/tuckershea"; + home = lib.mkMerge [ + (lib.mkIf stdenv.isDarwin "/Users/tuckershea") + (lib.mkIf stdenv.isLinux "/home/tuckershea") + ]; shell = pkgs.zsh; description = "Tucker Shea"; openssh.authorizedKeys.keyFiles = [ - ../../../../resources/publickeys/id_tuckershea_elmira.pub + ../../../../resources/publickeys/id_tuckershea_elmira.pub ]; - - packages = []; } // lib.optionalAttrs stdenv.isLinux { group = "tuckershea"; diff --git a/hosts/elmira/default.nix b/hosts/elmira/default.nix index a940bf3..0fbaa47 100644 --- a/hosts/elmira/default.nix +++ b/hosts/elmira/default.nix @@ -7,9 +7,10 @@ }: { imports = [ ../common/core - ../common/core-darwin + ../common/darwin + ../common/graphical - ../common/optional/fonts.nix + # optionals here... outputs.darwinModules.keep-hostname outputs.darwinModules.touchid diff --git a/hosts/marlon/default.nix b/hosts/marlon/default.nix index 252df11..761058a 100644 --- a/hosts/marlon/default.nix +++ b/hosts/marlon/default.nix @@ -14,11 +14,10 @@ ./terraria.nix ../common/core - ../common/core-nixos + ../common/nixos - ../common/optional/auto-upgrade.nix + # optionals here... - ../common/users/root ../common/users/tuckershea ]; diff --git a/hosts/roland/default.nix b/hosts/roland/default.nix index fcf15d0..796892a 100644 --- a/hosts/roland/default.nix +++ b/hosts/roland/default.nix @@ -12,11 +12,10 @@ ./secrets.nix ../common/core - ../common/core-nixos + ../common/nixos - ../common/optional/auto-upgrade.nix + # optionals here... - ../common/users/root ../common/users/tuckershea ]; diff --git a/hosts/vic/default.nix b/hosts/vic/default.nix index db39932..647a4c5 100644 --- a/hosts/vic/default.nix +++ b/hosts/vic/default.nix @@ -9,12 +9,12 @@ ./secrets.nix ../common/core - ../common/core-nixos + ../common/nixos + ../common/graphical - ../common/users/root - ../common/users/tuckershea + # optionals here... - ../common/optional/fonts.nix + ../common/users/tuckershea ]; networking.hostName = "vic";