Skip to content

Commit

Permalink
Lint with Alejandra
Browse files Browse the repository at this point in the history
  • Loading branch information
NoRePercussions committed May 26, 2024
1 parent ff8e10e commit a1472f6
Show file tree
Hide file tree
Showing 33 changed files with 186 additions and 141 deletions.
23 changes: 14 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,39 @@
nixvim.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = inputs@{ self, nixpkgs, darwin, home-manager, sops-nix, nixvim }:
let
outputs = inputs @ {
self,
nixpkgs,
darwin,
home-manager,
sops-nix,
nixvim,
}: let
inherit (self) outputs;
inherit (darwin.lib) darwinSystem;
inherit (nixpkgs.lib) nixosSystem;
in
{
in {
nixosModules = import ./modules/nixos;
darwinModules = import ./modules/darwin;
homeManagerModules = import ./modules/home-manager;

overlays = import ./overlays { inherit inputs outputs; };
overlays = import ./overlays {inherit inputs outputs;};

darwinConfigurations."elmira" = darwinSystem {
system = "aarch64-darwin";
specialArgs = { inherit (self) inputs outputs; };
specialArgs = {inherit (self) inputs outputs;};
modules = [
./hosts/elmira
home-manager.darwinModules.home-manager
{
home-manager.users.tuckershea = import ./home/tuckershea/elmira.nix;
home-manager.users.tuckershea = import ./home/tuckershea/elmira.nix;
}
];
};

nixosConfigurations."marlon" = nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit (self) inputs outputs; };
specialArgs = {inherit (self) inputs outputs;};
modules = [
./hosts/marlon
sops-nix.nixosModules.sops
Expand All @@ -57,7 +62,7 @@

nixosConfigurations."vic" = nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit (self) inputs outputs; };
specialArgs = {inherit (self) inputs outputs;};
modules = [
./hosts/vic
sops-nix.nixosModules.sops
Expand Down
1 change: 0 additions & 1 deletion home/tuckershea/common/core-darwin/defaults.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
};
};
}

7 changes: 5 additions & 2 deletions home/tuckershea/common/core/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ pkgs, lib, ... }:
{
pkgs,
lib,
...
}: {
imports = [
./fzf.nix
./git.nix
Expand All @@ -13,7 +16,7 @@

home = {
username = "tuckershea";
homeDirectory = lib.mkDefault "/home/tuckershea"; # fixme
homeDirectory = lib.mkDefault "/home/tuckershea"; # fixme
stateVersion = lib.mkDefault "23.11";

sessionVariables = {
Expand Down
3 changes: 1 addition & 2 deletions home/tuckershea/common/core/git.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ lib, ... }:
{
{lib, ...}: {
programs.git = {
enable = true;
delta.enable = true;
Expand Down
7 changes: 5 additions & 2 deletions home/tuckershea/common/core/neovim.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ pkgs, inputs, ... }:
{
pkgs,
inputs,
...
}: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
];
Expand Down Expand Up @@ -36,7 +39,7 @@
globals = {
mapleader = " ";
};

plugins.leap.enable = true;
plugins.lsp.enable = true;
# substitute.nvim?
Expand Down
6 changes: 5 additions & 1 deletion home/tuckershea/common/core/tmux/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}: {
programs.tmux = {
enable = true;
clock24 = true;
Expand Down
26 changes: 13 additions & 13 deletions home/tuckershea/common/core/zsh/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ pkgs, lib, ... }:
{
pkgs,
lib,
...
}: {
programs.zsh = {
enable = true;

Expand Down Expand Up @@ -40,17 +43,16 @@
];
};

initExtraFirst =
''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]
; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
initExtraFirst = ''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]
; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
# No tmux in Jetbrains or when ssh'd into
if [[ "$TERMINAL_EMULATOR" != "JetBrains-JediTerm" ]] && [[ -z "$SSH_CONNECTION" ]] then
ZSH_TMUX_AUTOSTART='true'
fi
# No tmux in Jetbrains or when ssh'd into
if [[ "$TERMINAL_EMULATOR" != "JetBrains-JediTerm" ]] && [[ -z "$SSH_CONNECTION" ]] then
ZSH_TMUX_AUTOSTART='true'
fi
'';

sessionVariables = {
Expand Down Expand Up @@ -78,5 +80,3 @@
};
};
}


3 changes: 1 addition & 2 deletions home/tuckershea/common/optional/alacritty.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
programs.alacritty = {
enable = true;
settings = {
Expand Down
5 changes: 2 additions & 3 deletions home/tuckershea/common/optional/ssh/elmira.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{ lib, ... }:
{
{lib, ...}: {
programs.ssh = {
enable = true;
serverAliveInterval = 30;

matchBlocks = {
"*" = {
identityFile = [ "~/.ssh/id_tuckershea_elmira.pub" ];
identityFile = ["~/.ssh/id_tuckershea_elmira.pub"];
extraOptions = {
# Use 1password for auth on elmira (darwin)
IdentityAgent = "\"~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock\"";
Expand Down
6 changes: 5 additions & 1 deletion home/tuckershea/elmira.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}: {
imports = [
./common/core
./common/core-darwin
Expand Down
5 changes: 1 addition & 4 deletions home/tuckershea/marlon.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{ ... }:
{
{...}: {
imports = [
./common/core


];
}
3 changes: 1 addition & 2 deletions home/tuckershea/vic.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ ... }:
{
{...}: {
imports = [
./common/core

Expand Down
4 changes: 2 additions & 2 deletions hosts/common/core-nixos/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
imports = [
./network.nix
./no-wait-online.nix # mitigate NetworkManager Wait-Online failure
./no-wait-online.nix # mitigate NetworkManager Wait-Online failure
./node-exporter.nix
./sudo-no-password.nix # don't require password for sudo
./sudo-no-password.nix # don't require password for sudo
./tailscale.nix
];
}
3 changes: 1 addition & 2 deletions hosts/common/core-nixos/no-wait-online.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Patches a bug where upgrading nixos causing Wait-Online to fail
# by just disabling it. I can't find anything that it breaks.
{ pkgs, ... }:
{
{pkgs, ...}: {
systemd.services.NetworkManager-wait-online.enable = pkgs.lib.mkForce false;
}
6 changes: 4 additions & 2 deletions hosts/common/core-nixos/tailscale.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ outputs, config, ...}:
{
outputs,
config,
...
}: {
imports = [outputs.nixosModules.tailscale-autoconnect];

# Requires sops.secrets.tailscale_key to exist!
Expand All @@ -10,4 +13,3 @@
loginServer = "https://login.tailscale.com";
};
}

7 changes: 5 additions & 2 deletions hosts/common/core/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ inputs, outputs, ... }:
{
inputs,
outputs,
...
}: {
imports = [
./git.nix
./locale.nix
Expand All @@ -8,7 +11,7 @@
./zsh.nix
];

home-manager.extraSpecialArgs = { inherit inputs outputs; };
home-manager.extraSpecialArgs = {inherit inputs outputs;};

nixpkgs = {
config = {
Expand Down
8 changes: 6 additions & 2 deletions hosts/common/core/git.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# System-wide git
# Native on MacOS, so activate only on linux

{ lib, pkgs, options, ...}:
{
lib,
pkgs,
options,
...
}:
lib.mkMerge [
# programs.git only on nixos, check option to avoid recursion
(lib.optionalAttrs (lib.hasAttr "git" options.programs) {
Expand Down
3 changes: 1 addition & 2 deletions hosts/common/core/locale.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{ lib, ... }:
{
{lib, ...}: {
time.timeZone = lib.mkDefault "America/New_York";
}
16 changes: 11 additions & 5 deletions hosts/common/core/nix.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{ inputs, lib, pkgs, options, ... }:
{
inputs,
lib,
pkgs,
options,
...
}:
lib.mkMerge [
{
nix = {
settings = {
# auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
# auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"];
warn-dirty = false;

# Maybe make this darwin-specific?
extra-platforms = ["x86_64-darwin" "aarch64-darwin" ];
extra-platforms = ["x86_64-darwin" "aarch64-darwin"];
};

gc = {
automatic = true;
# nixos and darwin have different ways to configure
Expand Down
7 changes: 5 additions & 2 deletions hosts/common/core/openssh.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{ lib, pkgs, ... }:
{
lib,
pkgs,
...
}: {
services.openssh = lib.optionalAttrs pkgs.stdenv.isLinux {
enable = true;
ports = [ 22 ]; # change this later?
ports = [22]; # change this later?

settings = {
PermitRootLogin = "prohibit-password";
Expand Down
1 change: 0 additions & 1 deletion hosts/common/optional/auto-upgrade.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
};
};
}

7 changes: 3 additions & 4 deletions hosts/common/optional/fonts.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
fonts.fontDir.enable = true;
fonts.packages = with pkgs; [
recursive
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
recursive
(nerdfonts.override {fonts = ["JetBrainsMono"];})
];
}
46 changes: 26 additions & 20 deletions hosts/common/users/tuckershea/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
{ pkgs, lib, ... }:
let
inherit (pkgs) stdenv;
in
{
users.users.tuckershea = {
home = if stdenv.isDarwin then "/Users/tuckershea" else "/home/tuckershea";
shell = pkgs.zsh;
description = "Tucker Shea";

openssh.authorizedKeys.keyFiles = [
../../../../resources/publickeys/id_tuckershea_elmira.pub
];
pkgs,
lib,
...
}: let
inherit (pkgs) stdenv;
in {
users.users.tuckershea =
{
home =
if stdenv.isDarwin
then "/Users/tuckershea"
else "/home/tuckershea";
shell = pkgs.zsh;
description = "Tucker Shea";

packages = [ ];
} // lib.optionalAttrs stdenv.isLinux {
group = "tuckershea";
isNormalUser = true;
extraGroups = [ "wheel" ];
};
openssh.authorizedKeys.keyFiles = [
../../../../resources/publickeys/id_tuckershea_elmira.pub
];

users.groups.tuckershea = { };
}
packages = [];
}
// lib.optionalAttrs stdenv.isLinux {
group = "tuckershea";
isNormalUser = true;
extraGroups = ["wheel"];
};

users.groups.tuckershea = {};
}
Loading

0 comments on commit a1472f6

Please sign in to comment.