flake: reorg common modules as flake outputs (#95)
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run

* initial committ

* move plymouth and printing to desktop modules

* rename commonModules -> common

* rename commonModules -> common

* move nix settings base -> common/nix

* nix fmt

* move baseModules to common/base
This commit is contained in:
Aly Raffauf 2024-08-22 07:46:19 -04:00 committed by GitHub
parent 832f7fed95
commit 29bc4af56e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 212 additions and 171 deletions

23
common/autoUpgrade.nix Normal file
View file

@ -0,0 +1,23 @@
{
config,
lib,
...
}: {
environment.variables.FLAKE = lib.mkDefault "github:alyraffauf/nixcfg";
system.autoUpgrade = {
enable = true;
allowReboot = false;
dates = "02:00";
flags = ["--accept-flake-config"];
flake = config.environment.variables.FLAKE;
operation = "switch";
persistent = true;
randomizedDelaySec = "30min";
rebootWindow = {
lower = "02:00";
upper = "06:00";
};
};
}

View file

@ -1,11 +1,5 @@
self: {lib, ...}: {
boot = {
consoleLogLevel = 0;
initrd.verbose = false;
loader.systemd-boot.configurationLimit = lib.mkDefault 10;
plymouth.enable = true;
};
{lib, ...}: {
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
console.useXkbConfig = true;
hardware.keyboard.qmk.enable = true;
@ -18,28 +12,7 @@ self: {lib, ...}: {
nh.enable = true;
};
nix = {
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
persistent = true;
randomizedDelaySec = "60min";
};
# Run GC when there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
optimise.automatic = true;
settings = {
auto-optimise-store = false;
experimental-features = ["nix-command" "flakes"];
};
};
networking.networkmanager.enable = true;
security = {
polkit.enable = true;
@ -70,9 +43,6 @@ self: {lib, ...}: {
openFirewall = true;
settings.PasswordAuthentication = false;
};
printing.enable = true;
system-config-printer.enable = true;
};
sound.enable = true;

37
common/nix.nix Normal file
View file

@ -0,0 +1,37 @@
{
nix = {
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
persistent = true;
randomizedDelaySec = "60min";
};
# Run GC when there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
optimise.automatic = true;
settings = {
auto-optimise-store = false;
experimental-features = ["nix-command" "flakes"];
substituters = [
"https://alyraffauf.cachix.org"
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"alyraffauf.cachix.org-1:GQVrRGfjTtkPGS8M6y7Ik0z4zLt77O0N25ynv2gWzDM="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
trusted-users = ["aly"];
};
};
}

32
common/overlays.nix Normal file
View file

@ -0,0 +1,32 @@
{
pkgs,
self,
...
}: let
unstable = import self.inputs.nixpkgs-unstable {
system = pkgs.system;
};
in {
nixpkgs = {
config.allowUnfree = true; # Allow unfree packages
overlays = [
(final: prev: {
rofi-bluetooth =
prev.rofi-bluetooth.overrideAttrs
(old: {
version = "unstable-2024-07-25";
src = pkgs.fetchFromGitHub {
owner = "alyraffauf";
repo = old.pname;
rev = "50252e4a9aebe4899a6ef2f7bc11d91b7e4aa8ae";
sha256 = "sha256-o0Sr3/888L/2KzZZP/EcXx+8ZUzdHB/I/VIeVuJvJks=";
};
});
zed-editor = unstable.zed-editor;
})
];
};
}

7
common/pkgs.nix Normal file
View file

@ -0,0 +1,7 @@
{
pkgs,
self,
...
}: {
environment.systemPackages = (with pkgs; [git inxi python3]) ++ [self.inputs.agenix.packages.${pkgs.system}.default];
}

View file

@ -1,8 +1,4 @@
{
config,
lib,
...
}: {
{config, ...}: {
fileSystems = let
fsType = "cifs";
options = [
@ -17,8 +13,7 @@
"x-systemd.idle-timeout=60"
"x-systemd.mount-timeout=5s"
];
in
lib.attrsets.optionalAttrs (config.networking.hostName != "mauville") {
in {
"/mnt/Archive" = {
inherit options fsType;
device = "//mauville/Archive";

9
common/tailscale.nix Normal file
View file

@ -0,0 +1,9 @@
{config, ...}: {
age.secrets.tailscaleAuthKey.file = ../secrets/tailscale/authKeyFile.age;
services.tailscale = {
enable = true;
openFirewall = true;
authKeyFile = config.age.secrets.tailscaleAuthKey.path;
};
}

View file

@ -1,4 +1,4 @@
let
{config, ...}: let
mkOpenWiFi = ssid: {
connection.id = "${ssid}";
connection.type = "wifi";
@ -30,11 +30,22 @@ let
}
);
in {
age.secrets.wifi.file = ../secrets/wifi.age;
networking.networkmanager = {
enable = true;
ensureProfiles = {
environmentFiles = [config.age.secrets.wifi.path];
profiles = {
"Dustin's A54" = mkWPA2WiFi "Dustin's A54" "$DustinsA54PSK";
"javapatron" = mkOpenWiFi "javapatron";
"Muchacho Guest" = mkOpenWiFi "Muchacho Guest";
"Stargate-Discovery" = mkWPA2WiFi "Stargate-Discovery" "$StargateDiscoveryPSK";
"Taproom Public WiFi" = mkOpenWiFi "Taproom Public WiFi";
"WeWorkWiFi" = mkEAPWiFi "WeWorkWiFi" "$WeWorkWiFiIdentity" "$WeWorkWiFiPassword" "mschapv2";
"javapatron" = mkOpenWiFi "javapatron";
"wallace" = mkWPA2WiFi "wallace" "$wallacePSK";
"WeWorkWiFi" = mkEAPWiFi "WeWorkWiFi" "$WeWorkWiFiIdentity" "$WeWorkWiFiPassword" "mschapv2";
};
};
};
}

View file

@ -96,7 +96,16 @@
};
nixosModules = {
base = import ./baseModules self;
common-auto-upgrade = import ./common/autoUpgrade.nix;
common-base = import ./common/base.nix;
common-locale = import ./common/locale.nix;
common-mauville-share = import ./common/samba.nix;
common-nix = import ./common/nix.nix;
common-overlays = import ./common/overlays.nix;
common-pkgs = import ./common/pkgs.nix;
common-tailscale = import ./common/tailscale.nix;
common-wifi-profiles = import ./common/wifi.nix;
nixos = import ./nixosModules self;
users = import ./userModules self;
};
@ -111,7 +120,6 @@
self.inputs.disko.nixosModules.disko
self.inputs.home-manager.nixosModules.home-manager
self.inputs.stylix.nixosModules.stylix
self.nixosModules.base
self.nixosModules.nixos
self.nixosModules.users
{

View file

@ -1,11 +0,0 @@
{pkgs, ...}: {
imports = [
./locale.nix
./network.nix
./nix.nix
./samba.nix
./secrets.nix
];
environment.systemPackages = with pkgs; [git inxi python3];
}

View file

@ -1,16 +0,0 @@
{config, ...}: {
networking.networkmanager = {
enable = true;
ensureProfiles = {
environmentFiles = [config.age.secrets.wifi.path];
profiles = import ./wifi.nix;
};
};
services.tailscale = {
enable = true;
openFirewall = true;
authKeyFile = config.age.secrets.tailscaleAuthKey.path;
};
}

View file

@ -1,67 +0,0 @@
{
config,
lib,
pkgs,
self,
...
}: let
unstable = import self.inputs.nixpkgs-unstable {
system = pkgs.system;
};
in {
environment.variables.FLAKE = lib.mkDefault "github:alyraffauf/nixcfg";
nix.settings = {
substituters = [
"https://alyraffauf.cachix.org"
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"alyraffauf.cachix.org-1:GQVrRGfjTtkPGS8M6y7Ik0z4zLt77O0N25ynv2gWzDM="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
trusted-users = ["aly"];
};
nixpkgs = {
config.allowUnfree = true; # Allow unfree packages
overlays = [
(final: prev: {
rofi-bluetooth =
prev.rofi-bluetooth.overrideAttrs
(old: {
version = "unstable-2024-07-25";
src = pkgs.fetchFromGitHub {
owner = "alyraffauf";
repo = old.pname;
rev = "50252e4a9aebe4899a6ef2f7bc11d91b7e4aa8ae";
sha256 = "sha256-o0Sr3/888L/2KzZZP/EcXx+8ZUzdHB/I/VIeVuJvJks=";
};
});
zed-editor = unstable.zed-editor;
})
];
};
system.autoUpgrade = {
enable = true;
allowReboot = false;
dates = "02:00";
flags = ["--accept-flake-config"];
flake = config.environment.variables.FLAKE;
operation = "switch";
persistent = true;
randomizedDelaySec = "30min";
rebootWindow = {
lower = "02:00";
upper = "06:00";
};
};
}

View file

@ -1,12 +0,0 @@
{
pkgs,
self,
...
}: {
age.secrets = {
tailscaleAuthKey.file = ../../secrets/tailscale/authKeyFile.age;
wifi.file = ../../secrets/wifi.age;
};
environment.systemPackages = [self.inputs.agenix.packages.${pkgs.system}.default];
}

View file

@ -6,12 +6,19 @@
...
}: {
imports = [
../common
./disko.nix
./home.nix
./secrets.nix
./stylix.nix
self.inputs.nixhw.nixosModules.framework-13-intel-11th
self.nixosModules.common-auto-upgrade
self.nixosModules.common-base
self.nixosModules.common-mauville-share
self.nixosModules.common-nix
self.nixosModules.common-overlays
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
];
boot.loader = {

View file

@ -7,12 +7,19 @@
...
}: {
imports = [
../common
./disko.nix
./home.nix
./secrets.nix
./stylix.nix
self.inputs.nixhw.nixosModules.framework-13-amd-7000
self.nixosModules.common-auto-upgrade
self.nixosModules.common-base
self.nixosModules.common-mauville-share
self.nixosModules.common-nix
self.nixosModules.common-overlays
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
];
boot = {

View file

@ -11,7 +11,6 @@
mediaDirectory = "/mnt/Media";
in {
imports = [
../common
./disko.nix
./home.nix
./secrets.nix
@ -21,6 +20,13 @@ in {
self.inputs.nixhw.nixosModules.common-bluetooth
self.inputs.nixhw.nixosModules.common-ssd
self.inputs.raffauflabs.nixosModules.raffauflabs
self.nixosModules.common-auto-upgrade
self.nixosModules.common-base
self.nixosModules.common-nix
self.nixosModules.common-overlays
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
];
boot = {

View file

@ -7,6 +7,11 @@
home-manager = {
sharedModules = [
{
gtk.gtk3.bookmarks = [
"file:///mnt/Media"
"file:///mnt/Archive"
];
wayland.windowManager.sway.config.output = {"LG Electronics LG ULTRAWIDE 311NTAB5M720".scale = "1.25";};
xdg.userDirs.music = "/mnt/Media/Music";

View file

@ -5,12 +5,19 @@
...
}: {
imports = [
../common
./disko.nix
./home.nix
./secrets.nix
./stylix.nix
self.inputs.nixhw.nixosModules.lenovo-yoga-9i-intel-13th
self.nixosModules.common-auto-upgrade
self.nixosModules.common-base
self.nixosModules.common-mauville-share
self.nixosModules.common-nix
self.nixosModules.common-overlays
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
];
boot = {

View file

@ -6,12 +6,19 @@
...
}: {
imports = [
../common
./disko.nix
./home.nix
./secrets.nix
./stylix.nix
self.inputs.nixhw.nixosModules.thinkpad-t440p
self.nixosModules.common-auto-upgrade
self.nixosModules.common-base
self.nixosModules.common-mauville-share
self.nixosModules.common-nix
self.nixosModules.common-overlays
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
];
boot.loader = {

View file

@ -8,7 +8,6 @@
domain = "raffauflabs.com";
in {
imports = [
../common
./disko.nix
./home.nix
./secrets.nix
@ -18,6 +17,14 @@ in {
self.inputs.nixhw.nixosModules.common-bluetooth
self.inputs.nixhw.nixosModules.common-ssd
self.inputs.raffauflabs.nixosModules.raffauflabs
self.nixosModules.common-auto-upgrade
self.nixosModules.common-base
self.nixosModules.common-mauville-share
self.nixosModules.common-nix
self.nixosModules.common-overlays
self.nixosModules.common-pkgs
self.nixosModules.common-tailscale
self.nixosModules.common-wifi-profiles
];
boot = {

View file

@ -17,6 +17,12 @@
|| config.ar.desktop.steam.enable
|| config.ar.desktop.sway.enable
) {
boot = {
consoleLogLevel = 0;
initrd.verbose = false;
plymouth.enable = true;
};
environment = {
sessionVariables.NIXOS_OZONE_WL = "1";
};
@ -51,6 +57,9 @@
pulse.enable = true;
};
printing.enable = true;
system-config-printer.enable = true;
xserver = {
enable = true;
excludePackages = with pkgs; [xterm];