From 834e4c77ecb9cf4d33396e17999a88885245ad5f Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 2 Jan 2024 18:54:46 -0600 Subject: [PATCH] Reducing common --- flake.nix | 4 ++ modules/home-manager/base.nix | 5 +++ modules/home-manager/common.nix | 16 ++++---- modules/home-manager/default.nix | 1 + modules/home-manager/dragon.nix | 4 +- modules/nixos/common.nix | 64 +++++++++++++++++--------------- nixos/base/default.nix | 55 +++++++++++++++++++++++++++ 7 files changed, 110 insertions(+), 39 deletions(-) create mode 100644 modules/home-manager/base.nix create mode 100644 nixos/base/default.nix diff --git a/flake.nix b/flake.nix index 2cd1aab..b90d846 100644 --- a/flake.nix +++ b/flake.nix @@ -112,7 +112,11 @@ } ]; }; + + base = mkNixosSystem "x86_64-linux" [./nixos/base] [outputs.homeManagerModules.base]; in { + base = base; + nixos = base; # alias dragon = mkNixosSystem "x86_64-linux" [./nixos/dragon] (with outputs.homeManagerModules; [ dragon ]); diff --git a/modules/home-manager/base.nix b/modules/home-manager/base.nix new file mode 100644 index 0000000..507ac6b --- /dev/null +++ b/modules/home-manager/base.nix @@ -0,0 +1,5 @@ +{outputs, ...}: { + imports = with outputs.homeManagerModules; [ + sway + ]; +} diff --git a/modules/home-manager/common.nix b/modules/home-manager/common.nix index 3f9b391..f933921 100644 --- a/modules/home-manager/common.nix +++ b/modules/home-manager/common.nix @@ -62,14 +62,15 @@ ]; }; - programs.password-store = { - enable = true; - package = pkgs.pass.withExtensions (exts: [exts.pass-otp]); - }; + # TODO: not common? + # programs.password-store = { + # enable = true; + # package = pkgs.pass.withExtensions (exts: [exts.pass-otp]); + # }; - programs.gitui = { - enable = true; - }; + # programs.gitui = { + # enable = true; + # }; programs.direnv = { enable = true; @@ -97,6 +98,7 @@ # fileWidgetOptions = ["--preview 'head {}'"]; }; + # TODO: regular cron or something? programs.nix-index = { enable = true; enableFishIntegration = true; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 47ff15a..b35db87 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -32,6 +32,7 @@ htop = import ./htop.nix; senpai = import ./senpai.nix; + base = import ./base.nix; dragon = import ./dragon.nix; thinker = import ./thinker.nix; foxtrot = import ./foxtrot.nix; diff --git a/modules/home-manager/dragon.nix b/modules/home-manager/dragon.nix index 661f71a..3aabc21 100644 --- a/modules/home-manager/dragon.nix +++ b/modules/home-manager/dragon.nix @@ -31,7 +31,7 @@ output = { "GIGA-BYTE TECHNOLOGY CO., LTD. AORUS FO48U 23070B000307" = { mode = "3840x2160@120Hz"; - position = "0,0"; + position = "${toString (builtins.ceil (2160 / 1.5))},0"; }; "Dell Inc. DELL U2720Q D3TM623" = { @@ -39,7 +39,7 @@ mode = "3840x2160@60Hz"; transform = "90"; scale = "1.5"; - position = "3840,0"; + position = "0,0"; }; }; diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix index 1223309..35413ad 100644 --- a/modules/nixos/common.nix +++ b/modules/nixos/common.nix @@ -8,6 +8,8 @@ pkgs, ... }: { + networking.hostName = lib.mkDefault "nixoslyte"; + imports = [ inputs.home-manager.nixosModules.home-manager ]; @@ -26,51 +28,51 @@ systemPackages = with pkgs; [ - age - bat - bc - bind - bottom - btrfs-progs - cue + # age + # bat + # bc + # bind + # bottom + # btrfs-progs + # cue curl - dogdns + # dogdns dua eza fd file fzf gnumake - gron - hexyl + # gron + # hexyl iputils - jq + # jq killall less mosh - nmap + # nmap nettools openssl - pciutils - pv - rclone - restic + # pciutils + # pv + # rclone + # restic ripgrep rsync - rtx + # rtx sd - sops + # sops smartmontools - sqlite - skim - sysstat + # sqlite + # skim + # sysstat unzip - usbutils - watchexec + # usbutils + # watchexec wget - xh + # xh zellij - zstd + # zstd ] ++ (with inputs.home-manager.packages.${system}; [ home-manager @@ -168,6 +170,7 @@ allowedUDPPorts = lib.mkDefault []; }; + # TODO: podman equivalent? extraHosts = '' ::1 host.docker.internal 127.0.0.1 host.docker.internal @@ -245,9 +248,10 @@ defaultUserShell = pkgs.fish; }; - services.udev.extraRules = '' - # https://betaflight.com/docs/wiki/archive/Installing-Betaflight#step-1 - # ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", MODE="0664", GROUP="uucp" - # ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="uucp"' - ''; + # TODO: should not be in common? + # services.udev.extraRules = '' + # # https://betaflight.com/docs/wiki/archive/Installing-Betaflight#step-1 + # # ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", MODE="0664", GROUP="uucp" + # # ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="uucp"' + # ''; } diff --git a/nixos/base/default.nix b/nixos/base/default.nix new file mode 100644 index 0000000..6c06cc1 --- /dev/null +++ b/nixos/base/default.nix @@ -0,0 +1,55 @@ +{ + flake, + inputs, + outputs, + lib, + config, + modulesPath, + ... +}: { + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + inputs.disko.nixosModules.disko + flake.diskoConfigurations.standard + ] + ++ (with outputs.nixosModules; [ + desktop-usage + wifi + ]); + + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + ]; + config = { + allowUnfree = true; + }; + }; + + nix = { + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + }; + + # not necessarily "base", but all my machines are UEFI so... + boot.loader.systemd-boot.enable = true; + + networking = { + firewall = { + enable = true; + allowPing = true; + allowedTCPPorts = [22]; + allowedUDPPorts = []; + }; + }; + + system.stateVersion = "23.11"; +}