chore: initial format
This commit is contained in:
parent
dc5bc4aecc
commit
c6e6e00b66
28 changed files with 172 additions and 184 deletions
|
@ -28,3 +28,8 @@ tasks:
|
|||
cmds:
|
||||
- task: lint
|
||||
- task: pc-run
|
||||
|
||||
format:
|
||||
desc: Check project files
|
||||
cmds:
|
||||
- nixpkgs-fmt {{.ROOT_DIR}}
|
||||
|
|
33
flake.nix
33
flake.nix
|
@ -18,21 +18,22 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
sops-nix,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (self) outputs;
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
# "i686-linux"
|
||||
"x86_64-linux"
|
||||
# "aarch64-darwin"
|
||||
# "x86_64-darwin"
|
||||
];
|
||||
in
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, sops-nix
|
||||
, ...
|
||||
} @ inputs:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
# "i686-linux"
|
||||
"x86_64-linux"
|
||||
# "aarch64-darwin"
|
||||
# "x86_64-darwin"
|
||||
];
|
||||
in
|
||||
with inputs; {
|
||||
# Use nixpkgs-fmt for 'nix fmt'
|
||||
formatter = forAllSystems (system: nixpkgs.legacyPackages."${system}".nixpkgs-fmt);
|
||||
|
@ -48,7 +49,7 @@
|
|||
# Technically, adding the inputs is redundant as they can be also
|
||||
# accessed with flake-self.inputs.X, but adding them individually
|
||||
# allows to only pass what is needed to each module.
|
||||
specialArgs = {flake-self = self;} // inputs;
|
||||
specialArgs = { flake-self = self; } // inputs;
|
||||
|
||||
system = "x86_64-linux";
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
imports = [
|
||||
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
|
||||
|
@ -20,7 +19,7 @@
|
|||
pkgs.dnsutils
|
||||
];
|
||||
|
||||
systemd.services.sshd.wantedBy = pkgs.lib.mkForce ["multi-user.target"];
|
||||
systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ];
|
||||
users.users.root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMZS9J1ydflZ4iJdJgO8+vnN8nNSlEwyn9tbWU9OcysW truxnell@home"
|
||||
];
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
{
|
||||
description = "A flake to build a basic NixOS iso";
|
||||
inputs.nixos.url = "github:nixos/nixpkgs/nixos-22.11";
|
||||
outputs = {
|
||||
self,
|
||||
nixos,
|
||||
}: {
|
||||
nixosConfigurations = let
|
||||
exampleBase = {
|
||||
isoImage.squashfsCompression = "gzip -Xcompression-level 1";
|
||||
systemd.services.sshd.wantedBy = nixos.lib.mkForce ["multi-user.target"];
|
||||
users.users.root.openssh.authorizedKeys.keys = ["<my ssh key>"];
|
||||
};
|
||||
in {
|
||||
x86 = nixos.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
"${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
||||
exampleBase
|
||||
];
|
||||
};
|
||||
example = nixos.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [exampleBase];
|
||||
};
|
||||
outputs =
|
||||
{ self
|
||||
, nixos
|
||||
,
|
||||
}: {
|
||||
nixosConfigurations =
|
||||
let
|
||||
exampleBase = {
|
||||
isoImage.squashfsCompression = "gzip -Xcompression-level 1";
|
||||
systemd.services.sshd.wantedBy = nixos.lib.mkForce [ "multi-user.target" ];
|
||||
users.users.root.openssh.authorizedKeys.keys = [ "<my ssh key>" ];
|
||||
};
|
||||
in
|
||||
{
|
||||
x86 = nixos.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
"${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
||||
exampleBase
|
||||
];
|
||||
};
|
||||
example = nixos.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [ exampleBase ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
imports = [
|
||||
# Host-specific
|
||||
|
@ -58,7 +57,7 @@
|
|||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.truxnell = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel"]; # Enable ‘sudo’ for the user.
|
||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
packages = with pkgs; [
|
||||
];
|
||||
};
|
||||
|
@ -75,7 +74,7 @@
|
|||
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
warn-dirty = false;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
{ config
|
||||
, inputs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (config.networking) hostName;
|
||||
# Only enable auto upgrade if current config came from a clean tree
|
||||
# This avoids accidental auto-upgrades when working locally.
|
||||
isClean = inputs.self ? rev;
|
||||
in {
|
||||
in
|
||||
{
|
||||
system.autoUpgrade = {
|
||||
enable = isClean;
|
||||
dates = "hourly";
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
sops-nix,
|
||||
...
|
||||
{ inputs
|
||||
, outputs
|
||||
, config
|
||||
, sops-nix
|
||||
, ...
|
||||
}: {
|
||||
imports =
|
||||
[
|
||||
|
@ -14,7 +13,7 @@
|
|||
./openssh.nix
|
||||
./packages.nix
|
||||
]
|
||||
++ (builtins.attrValues {});
|
||||
++ (builtins.attrValues { });
|
||||
|
||||
# home-manager.extraSpecialArgs = { inherit inputs outputs; }; TODO Home-manager
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{lib, ...}: {
|
||||
{ lib, ... }: {
|
||||
i18n = {
|
||||
defaultLocale = lib.mkDefault "en_US.UTF-8";
|
||||
};
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
{ inputs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
{ outputs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (config.networking) hostName;
|
||||
hosts = outputs.nixosConfigurations;
|
||||
in {
|
||||
in
|
||||
{
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
bat
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
{ pkgs
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
|
||||
in {
|
||||
in
|
||||
{
|
||||
users.users.truxnell = {
|
||||
isNormalUser = true;
|
||||
shell = pkgs.fish;
|
||||
|
@ -23,7 +24,7 @@ in {
|
|||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMZS9J1ydflZ4iJdJgO8+vnN8nNSlEwyn9tbWU9OcysW truxnell@home"
|
||||
];
|
||||
|
||||
packages = [pkgs.home-manager];
|
||||
packages = [ pkgs.home-manager ];
|
||||
};
|
||||
|
||||
# home-manager.users.taylor = import ../../../../../home-manager/taylor_${config.networking.hostName}.nix; TODO home-manager?
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
...
|
||||
{ inputs
|
||||
, outputs
|
||||
, config
|
||||
, ...
|
||||
}: {
|
||||
# Time
|
||||
networking.timeServers = ["10.8.10.1"];
|
||||
networking.timeServers = [ "10.8.10.1" ];
|
||||
services.chrony = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
# Current nixpkgs cf-ddns only supports using a env file for the apitoken
|
||||
# but not for domains, which makes them hard to find.
|
||||
|
@ -16,7 +15,7 @@
|
|||
config.sops.secrets."system/networking/cloudflare-dyndns/apiTokenFile".sopsFile = ./cloudflare-dyndns.sops.yaml;
|
||||
|
||||
# Restart when secret changes
|
||||
config.sops.secrets."system/networking/cloudflare-dyndns/apiTokenFile".restartUnits = ["cloudflare-dyndns"];
|
||||
config.sops.secrets."system/networking/cloudflare-dyndns/apiTokenFile".restartUnits = [ "cloudflare-dyndns" ];
|
||||
|
||||
# Cloudflare dynamic dns to keep my DNS records pointed at home
|
||||
config.services.cloudflare-dyndns = {
|
||||
|
@ -24,6 +23,6 @@
|
|||
ipv6 = false;
|
||||
proxied = true;
|
||||
apiTokenFile = config.sops.secrets."system/networking/cloudflare-dyndns/apiTokenFile".path;
|
||||
domains = [];
|
||||
domains = [ ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# Ref: https://nixos.wiki/wiki/Encrypted_DNS#dnscrypt-proxy2
|
||||
{
|
||||
inputs,
|
||||
outputs,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
{ inputs
|
||||
, outputs
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
}: {
|
||||
# Disable resolvd to ensure it doesnt re-write /etc/resolv.conf
|
||||
config.services.resolved.enable = false;
|
||||
|
@ -12,7 +11,7 @@
|
|||
# Fix this devices DNS resolv.conf else resolvd will point it to dnscrypt
|
||||
# causing a risk of no dns if service fails.
|
||||
config.networking = {
|
||||
nameservers = ["10.8.10.1"]; # TODO make varible IP
|
||||
nameservers = [ "10.8.10.1" ]; # TODO make varible IP
|
||||
|
||||
dhcpcd.extraConfig = "nohook resolv.conf";
|
||||
};
|
||||
|
@ -22,7 +21,7 @@
|
|||
config.sops.secrets."system/networking/dnscrypt-proxy2/forwarding-rules".mode = "0444"; # This is world-readable but theres nothing security related in the file
|
||||
|
||||
# Restart dnscrypt when secret changes
|
||||
config.sops.secrets."system/networking/dnscrypt-proxy2/forwarding-rules".restartUnits = ["dnscrypt-proxy2"];
|
||||
config.sops.secrets."system/networking/dnscrypt-proxy2/forwarding-rules".restartUnits = [ "dnscrypt-proxy2" ];
|
||||
|
||||
config.services.dnscrypt-proxy2 = {
|
||||
enable = true;
|
||||
|
@ -30,7 +29,7 @@
|
|||
require_dnssec = true;
|
||||
forwarding_rules = config.sops.secrets."system/networking/dnscrypt-proxy2/forwarding-rules".path;
|
||||
|
||||
server_names = ["NextDNS-f6fe35"];
|
||||
server_names = [ "NextDNS-f6fe35" ];
|
||||
|
||||
static = {
|
||||
"NextDNS-f6fe35" = {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Warning, this file is autogenerated by nix4vscode. Don't modify this manually.
|
||||
{pkgs}: let
|
||||
{ pkgs }:
|
||||
let
|
||||
vscode-utils = pkgs.vscode-utils;
|
||||
in {
|
||||
in
|
||||
{
|
||||
"ms-python"."python" = vscode-utils.extensionFromVscodeMarketplace {
|
||||
name = "python";
|
||||
publisher = "ms-python";
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
# Ref: https://nixos.wiki/wiki/GNOME
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
...
|
||||
{ inputs
|
||||
, outputs
|
||||
, config
|
||||
, ...
|
||||
}: {
|
||||
# init secret
|
||||
config.sops.secrets."system/mail/maddy/envFile" = {
|
||||
|
@ -12,12 +11,12 @@
|
|||
};
|
||||
|
||||
# Restart dnscrypt when secret changes
|
||||
config.sops.secrets."system/mail/maddy/envFile".restartUnits = ["maddy"];
|
||||
config.sops.secrets."system/mail/maddy/envFile".restartUnits = [ "maddy" ];
|
||||
|
||||
#
|
||||
config.services.maddy = {
|
||||
enable = true;
|
||||
secrets = [config.sops.secrets."system/mail/maddy/envFile".path];
|
||||
secrets = [ config.sops.secrets."system/mail/maddy/envFile".path ];
|
||||
config = builtins.readFile ./maddy.conf;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
services.prometheus.exporters = {
|
||||
node = {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
systemd.timers."reboot-required-check" = {
|
||||
wantedBy = ["timers.target"];
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
# start at boot
|
||||
OnBootSec = "0m";
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
...
|
||||
{ inputs
|
||||
, outputs
|
||||
, config
|
||||
, ...
|
||||
}: {
|
||||
# SOPS settings
|
||||
# https://github.com/Mic92/sops-nix
|
||||
|
||||
sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
imports = [
|
||||
# Host-specific
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
# 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
|
||||
, pkgs
|
||||
, modulesPath
|
||||
, ...
|
||||
}: {
|
||||
imports = [];
|
||||
imports = [ ];
|
||||
|
||||
boot.initrd.availableKernelModules = ["ata_piix" "mptspi" "uhci_hcd" "ehci_pci" "sd_mod" "sr_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [];
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "mptspi" "uhci_hcd" "ehci_pci" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
|
@ -25,7 +24,7 @@
|
|||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [{device = "/dev/sda2";}];
|
||||
swapDevices = [{ device = "/dev/sda2"; }];
|
||||
|
||||
# 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
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
imports = [./playground.nix];
|
||||
imports = [ ./playground.nix ];
|
||||
boot.isContainer = true;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
networking = {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {}
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, inputs
|
||||
, outputs
|
||||
, ...
|
||||
}: { }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{inputs, ...}: {
|
||||
{ inputs, ... }: {
|
||||
unstable-packages = final: _prev: {
|
||||
unstable = import inputs.nixpkgs-unstable {
|
||||
system = final.system;
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file
|
||||
# This is useful to avoid using channels when using legacy nix commands
|
||||
let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
|
||||
in
|
||||
import (fetchTarball {
|
||||
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
|
||||
sha256 = lock.narHash;
|
||||
})
|
Reference in a new issue