From b05149e46ddf2a94cb4b58e5f19562e34671e1ba Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 23 Jan 2024 15:50:42 -0600 Subject: [PATCH] more refactorings --- flake.nix | 2 ++ hosts/algiz/default.nix | 13 +++++++------ hosts/othalan/default.nix | 6 +++--- modules/cli.nix | 15 +++++++++++---- modules/hyprland.nix | 29 +++++++++++++---------------- modules/langs/misc.nix | 1 + modules/roles/desktop.nix | 1 + 7 files changed, 38 insertions(+), 29 deletions(-) diff --git a/flake.nix b/flake.nix index 5f4e59b..4d24bb3 100644 --- a/flake.nix +++ b/flake.nix @@ -17,10 +17,12 @@ nixConfig = { extra-substituters = [ "https://hyprland.cachix.org" + "https://nixpkgs-wayland.cachix.org" "https://daylin.cachix.org" ]; extra-trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" "daylin.cachix.org-1:fLdSnbhKjtOVea6H9KqXeir+PyhO+sDSPhEW66ClE/k=" ]; }; diff --git a/hosts/algiz/default.nix b/hosts/algiz/default.nix index 010a331..3ed36c3 100644 --- a/hosts/algiz/default.nix +++ b/hosts/algiz/default.nix @@ -4,17 +4,19 @@ ... }: { imports = with inputs.self.nixosModules; [ - common docker - - # langs - nim - python ]; + languages = { + nim.enable = true; + python.enable = true; + }; + cli.enable =true; + environment.systemPackages = with pkgs; [ rclone ]; + # https://francis.begyn.be/blog/nixos-restic-backups # TODO: parameterize to use on algiz AND othalan ... services.restic.backups.gdrive = { @@ -33,7 +35,6 @@ shell = pkgs.zsh; isNormalUser = true; extraGroups = ["wheel" "docker"]; - useDefaultShell = true; initialPassword = "nix"; }; git = { diff --git a/hosts/othalan/default.nix b/hosts/othalan/default.nix index e8f4fdb..8915f1d 100644 --- a/hosts/othalan/default.nix +++ b/hosts/othalan/default.nix @@ -6,13 +6,14 @@ }: { imports = with inputs.self.nixosModules; [ desktop - hyprland + # hyprland nix-ld virtualization restic ]; + programs.hyprland.enable = true; services.vpn.enable = true; @@ -23,7 +24,7 @@ tex.enable = true; node.enable = true; }; - + cli.enable = true; services.restic.backups.gdrive = { user = "daylin"; @@ -43,7 +44,6 @@ enableSSHSupport = true; }; - programs.zsh.enable = true; users.users.daylin = { isNormalUser = true; shell = pkgs.zsh; diff --git a/modules/cli.nix b/modules/cli.nix index b4cfc10..ef30dc0 100644 --- a/modules/cli.nix +++ b/modules/cli.nix @@ -1,8 +1,13 @@ +{config, lib,pkgs,...}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.cli; +in { - inputs, - pkgs, - ... -}: { + options.cli.enable = mkEnableOption "cli"; + config = mkIf cfg.enable { + + programs.direnv.enable = true; environment.systemPackages = with pkgs; [ chezmoi @@ -17,5 +22,7 @@ ripgrep btop + ]; +}; } diff --git a/modules/hyprland.nix b/modules/hyprland.nix index c48b9c0..00566aa 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -1,14 +1,23 @@ { inputs, pkgs, + config, + lib, ... -}: { +}: +let + inherit (lib) mkIf; + cfg = config.programs.hyprland; +in +{ + config = mkIf cfg.enable { + fonts.fontconfig.enable = true; fonts.packages = with pkgs; [ (nerdfonts.override {fonts = ["FiraCode"];}) ]; + security.pam.services.swaylock = {}; - programs.hyprland.enable = true; programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.default; # Optional, hint electron apps to use wayland: environment.sessionVariables.NIXOS_OZONE_WL = "1"; @@ -33,18 +42,6 @@ pavucontrol ]; nixpkgs.overlays = [inputs.nixpkgs-wayland.overlay]; - # wayland extras - nix.settings = { - # add binary caches - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - ]; - substituters = [ - "https://cache.nixos.org" - "https://nixpkgs-wayland.cachix.org" - "https://hyprland.cachix.org" - ]; - }; + +}; } diff --git a/modules/langs/misc.nix b/modules/langs/misc.nix index 9366a0f..22aec05 100644 --- a/modules/langs/misc.nix +++ b/modules/langs/misc.nix @@ -6,6 +6,7 @@ in { options.languages.misc.enable = mkEnableOption "go + rustup"; config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ go rustup diff --git a/modules/roles/desktop.nix b/modules/roles/desktop.nix index bf185a2..6abcd02 100644 --- a/modules/roles/desktop.nix +++ b/modules/roles/desktop.nix @@ -8,5 +8,6 @@ gui vscode vpn + hyprland ]; }