diff --git a/nixos/flake.nix b/nixos/flake.nix index 61d27e1e..8e2c3682 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -126,12 +126,15 @@ nixpkgs.lib.nixosSystem (args // { inherit system; modules = baseModules ++ modules; - specialArgs = { + specialArgs = rec { inherit inputs; myPackages = { taffybar = inputs.imalison-taffybar.defaultPackage."${system}"; }; makeEnable = (import ./make-enable.nix) nixpkgs.lib; + mapValueToKeys = keys: value: builtins.listToAttrs (map (name: { inherit name value; }) keys); + realUsers = [ "root" "imalison" "kat" "dean" "alex" ]; + forEachUser = mapValueToKeys realUsers; } // specialArgs; }); machinesFilepath = ./machines; diff --git a/nixos/full.nix b/nixos/full.nix index 4a0ce72a..061a411d 100644 --- a/nixos/full.nix +++ b/nixos/full.nix @@ -7,7 +7,10 @@ ./desktop.nix ./extra.nix ./games.nix + ./git-sync.nix ./internet-computer.nix + ./keybase.nix + ./nixified.ai.nix ./syncthing.nix ./xmonad.nix ]; diff --git a/nixos/git-sync.nix b/nixos/git-sync.nix new file mode 100644 index 00000000..cb0345eb --- /dev/null +++ b/nixos/git-sync.nix @@ -0,0 +1,43 @@ +{ ... }: { + home-manager.users.imalison = ({ config, ... }: { + services.git-sync = { + enable = true; + repositories = { + config = { + path = config.home.homeDirectory + "/config"; + uri = "git@github.com:IvanMalison/config.git"; + }; + org = { + path = config.home.homeDirectory + "/org"; + uri = "git@github.com:IvanMalison/org.git"; + }; + password-store = { + path = config.home.homeDirectory + "/.password-store"; + uri = "git@github.com:IvanMalison/.password-store.git"; + }; + katnivan = { + path = config.home.homeDirectory + "/katnivan"; + uri = "ssh://gitea@1896Folsom.duckdns.org:1123/colonelpanic/katnivan.git"; + }; + }; + }; + }); + + home-manager.users.kat = ({ config, ... }: { + services.git-sync = { + enable = true; + repositories = { + obsidian = { + path = config.home.homeDirectory + "/obsidian"; + uri = "git@github.com:katandtonic/obsidian.git"; + interval = 60; + }; + org = { + path = config.home.homeDirectory + "/org"; + uri = "ssh://gitea@1896Folsom.duckdns.org:1123/kkathuang/org.git"; + interval = 45; + }; + }; + }; + }); +} diff --git a/nixos/home-manager.nix b/nixos/home-manager.nix index 21940d63..88fd5969 100644 --- a/nixos/home-manager.nix +++ b/nixos/home-manager.nix @@ -1,4 +1,5 @@ -{ pkgs, config, specialArgs, ... }: { +username: { pkgs, config, specialArgs, ... }: +{ xsession = { enable = true; preferStatusNotifierItems = true; @@ -13,10 +14,6 @@ forwardAgent = true; }; - services.xscreensaver = { - enable = true; - }; - programs.gpg.package = pkgs.gnupg_2_4_0; services.gpg-agent = { @@ -27,140 +24,6 @@ pinentryFlavor = "gnome3"; }; - services.blueman-applet = { - enable = true; - }; - - services.taffybar = { - enable = true; - package = specialArgs.nixos.specialArgs.inputs.imalison-taffybar.defaultPackage."${pkgs.system}"; - }; - - services.notify-osd = { - enable = true; - package = pkgs.notify-osd-customizable; - }; - - services.kdeconnect = { - enable = true; - indicator = true; - }; - - services.network-manager-applet.enable = true; - - services.udiskie = { - enable = true; - tray = "always"; - }; - - services.status-notifier-watcher.enable = true; - - services.autorandr.enable = true; - - services.random-background = { - enable = true; - display = "fill"; - interval = "1h"; - imageDirectory = "%h/Pictures/wallpaper/use"; - }; - - services.xsettingsd.enable = true; - - services.volnoti.enable = true; - - services.pasystray.enable = true; - - services.parcellite = { - enable = true; - package = pkgs.clipit; - }; - - services.git-sync = { - enable = true; - repositories = { - config = { - path = config.home.homeDirectory + "/config"; - uri = "git@github.com:IvanMalison/config.git"; - }; - org = { - path = config.home.homeDirectory + "/org"; - uri = "git@github.com:IvanMalison/org.git"; - }; - password-store = { - path = config.home.homeDirectory + "/.password-store"; - uri = "git@github.com:IvanMalison/.password-store.git"; - }; - }; - }; - - services.picom = { - enable = true; - vSync = false; - backend = "glx"; - extraArgs = ["--experimental-backends"]; - - settings = { - animations = true; - animation-window-mass = 1; - animation-dampening = 20; - animation-stiffness = 250; - animation-clamping = false; - animation-for-open-window = "zoom"; - animation-for-unmap-window = "zoom"; - animation-for-transient-window = "slide-down"; - fade-in-step = 0.028; - fade-out-step = 0.028; - fading = true; - }; - - wintypes = { - dock = {animation = "slide-down";}; - toolbar = {animation = "slide-down";}; - }; - - settings = { - inactive-dim = 0.2; - focus-exclude = ["class_g ?= 'rofi'" "class_g ?= 'Steam'"]; - rounded-corners-exclude = [ - "! name~=''" # Qtile == empty wm_class.. - "window_type = 'dock'" - "window_type = 'desktop'" - ]; - - corner-radius = 10; - round-borders = 0; - round-borders-exclude = [ - "! name~=''" # Qtile == empty wm_class.. - ]; - - blur = { - method = "dual_kawase"; - strength = 10.0; - background = true; - background-frame = false; - background-fixed = false; - }; - blur-background-exclude = ["window_type != 'dock'"]; - - daemon = false; - dbus = false; - mark-wmwin-focused = false; - mark-ovredir-focused = false; - detect-rounded-corners = true; - detect-client-opacity = true; - - unredir-if-possible = false; - unredir-if-possible-exclude = []; - detect-transient = true; - detect-client-leader = true; - - invert-color-include = []; - glx-no-stencil = true; - use-damage = false; - transparent-clipping = false; - }; - }; - systemd.user.services.setxkbmap = { Unit = { Description = "Set up keyboard in X"; @@ -176,54 +39,4 @@ ExecStart = "/usr/bin/env load_xkb_map"; }; }; - - systemd.user.services.notifications-tray-icon = { - Unit = { - Description = "Notifications tray icon"; - After = [ "graphical-session-pre.target" "tray.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Install = { WantedBy = [ "graphical-session.target" ]; }; - - Service = { - ExecStart = "${pkgs.haskellPackages.notifications-tray-icon}/bin/notifications-tray-icon --github-token-pass dfinity-github-api-token"; - Restart = "always"; - RestartSec = 3; - }; - }; - - systemd.user.services.shutter = { - Unit = { - Description = "Shutter"; - After = [ "graphical-session-pre.target" "tray.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Install = { WantedBy = [ "graphical-session.target" ]; }; - - Service = { - ExecStart = "${pkgs.shutter}/bin/shutter --min_at_startup"; - Restart = "always"; - RestartSec = 3; - }; - }; - - systemd.user.services.discord = { - Unit = { - Description = "Discord"; - After = [ "graphical-session-pre.target" "tray.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Install = { WantedBy = [ "graphical-session.target" ]; }; - - Service = { - ExecStart = "${pkgs.discord}/opt/Discord/Discord --start-minimized"; - Restart = "always"; - RestartSec = 3; - }; - }; - - home.stateVersion = "21.05"; } diff --git a/nixos/home-manager/git-sync.nix b/nixos/home-manager/git-sync.nix new file mode 100644 index 00000000..fc15c544 --- /dev/null +++ b/nixos/home-manager/git-sync.nix @@ -0,0 +1,19 @@ +{ config, ... }: { + services.git-sync = { + enable = true; + repositories = { + config = { + path = config.home.homeDirectory + "/config"; + uri = "git@github.com:IvanMalison/config.git"; + }; + org = { + path = config.home.homeDirectory + "/org"; + uri = "git@github.com:IvanMalison/org.git"; + }; + password-store = { + path = config.home.homeDirectory + "/.password-store"; + uri = "git@github.com:IvanMalison/.password-store.git"; + }; + }; + }; +} diff --git a/nixos/keybase.nix b/nixos/keybase.nix new file mode 100644 index 00000000..d7725ff4 --- /dev/null +++ b/nixos/keybase.nix @@ -0,0 +1,5 @@ +{ forEachUser, ... }: { + home-manager.users = forEachUser { + services.kbfs.enable = true; + }; +} diff --git a/nixos/machines/jay-lenovo.nix b/nixos/machines/jay-lenovo.nix index 82654404..58e0b64a 100644 --- a/nixos/machines/jay-lenovo.nix +++ b/nixos/machines/jay-lenovo.nix @@ -15,7 +15,9 @@ boot.kernelPackages = pkgs.linuxPackages_latest; boot.initrd.kernelModules = [ "amdgpu" ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" "amdgpu" ]; + boot.initrd.availableKernelModules = [ + "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" "amdgpu" + ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index ea2a4bc0..44ce75c0 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -1,11 +1,12 @@ -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, inputs, forEachUser, ... }: { imports = [ ../full.nix - ../nixified.ai.nix ]; + modules.nixified-ai.enable = true; + boot.loader.systemd-boot.configurationLimit = 5; networking.hostName = "ryzen-shine"; @@ -18,7 +19,7 @@ boot.plymouth = { enable = false; }; - boot.kernelParams = ["quiet"]; + boot.kernelParams = [ "quiet" ]; services.autorandr = { enable = true; @@ -102,6 +103,9 @@ # services.xrdp.openFirewall = true; system.stateVersion = "20.03"; + home-manager.users = forEachUser { + home.stateVersion = "21.05"; + }; users.extraUsers.dean.home = "/shared/dean"; } diff --git a/nixos/make-enable.nix b/nixos/make-enable.nix index 5dbecd44..2b87da84 100644 --- a/nixos/make-enable.nix +++ b/nixos/make-enable.nix @@ -19,8 +19,14 @@ let cfg = lib.attrByPath (lib.splitString "." pathStr) { enable = false; defaulted = true; } config; + # Extract 'imports' from configAttrs, if it exists + importsAttr = if configAttrs ? imports then configAttrs.imports else []; + # Remove 'imports' from configAttrs + configAttrsWithoutImports = lib.attrsets.removeAttrs configAttrs ["imports"]; + in { options = optionsSet; - config = lib.mkIf cfg.enable configAttrs; + config = lib.mkIf cfg.enable configAttrsWithoutImports; + imports = importsAttr; } diff --git a/nixos/nixified.ai.nix b/nixos/nixified.ai.nix index 09ff0f07..7eb3404b 100644 --- a/nixos/nixified.ai.nix +++ b/nixos/nixified.ai.nix @@ -1,4 +1,5 @@ -{ inputs, config, ... }: { +{ inputs, config, specialArgs, ... }: +specialArgs.makeEnable config "modules.nixified-ai" false { imports = [ inputs.nixified-ai.nixosModules.invokeai ]; diff --git a/nixos/users.nix b/nixos/users.nix index 7492b3dd..269fe73b 100644 --- a/nixos/users.nix +++ b/nixos/users.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, inputs, realUsers, forEachUser, ... }: { security.sudo.wheelNeedsPassword = false; users.users = let @@ -67,5 +67,7 @@ }; }; - nix.settings.trusted-users = [ "root" "imalison" "kat" "dean" "alex" ]; + nix.settings.trusted-users = realUsers; + + home-manager.users = forEachUser (import ./home-manager.nix); } diff --git a/nixos/xmonad.nix b/nixos/xmonad.nix index 41559bdb..b17b1ae5 100644 --- a/nixos/xmonad.nix +++ b/nixos/xmonad.nix @@ -1,5 +1,5 @@ -{ config, pkgs, options, inputs, specialArgs, ... }: -specialArgs.makeEnable config "modules.xmonad" true { +{ config, pkgs, options, inputs, forEachUser, makeEnable, ... }: +makeEnable config "modules.xmonad" true { nixpkgs.overlays = with inputs; [ xmonad.overlay xmonad-contrib.overlay @@ -31,5 +31,153 @@ specialArgs.makeEnable config "modules.xmonad" true { haskellPackages.dbus-hslogger ]; - home-manager.users.imalison = (import ./home-manager.nix); + home-manager.users = forEachUser { + services.blueman-applet = { + enable = true; + }; + + services.taffybar = { + enable = true; + package = inputs.imalison-taffybar.defaultPackage."${pkgs.system}"; + }; + + services.notify-osd = { + enable = true; + package = pkgs.notify-osd-customizable; + }; + + services.kdeconnect = { + enable = true; + indicator = true; + }; + + services.network-manager-applet.enable = true; + + services.udiskie = { + enable = true; + tray = "always"; + }; + + services.status-notifier-watcher.enable = true; + + services.autorandr.enable = true; + + services.random-background = { + enable = true; + display = "fill"; + interval = "1h"; + imageDirectory = "%h/Pictures/wallpaper/use"; + }; + + services.xsettingsd.enable = true; + + services.volnoti.enable = true; + + services.pasystray.enable = true; + + services.parcellite = { + enable = true; + package = pkgs.clipit; + }; + + services.picom = { + enable = true; + vSync = false; + backend = "glx"; + extraArgs = ["--experimental-backends"]; + + settings = { + animations = true; + animation-window-mass = 1; + animation-dampening = 20; + animation-stiffness = 250; + animation-clamping = false; + animation-for-open-window = "zoom"; + animation-for-unmap-window = "zoom"; + animation-for-transient-window = "slide-down"; + fade-in-step = 0.028; + fade-out-step = 0.028; + fading = true; + }; + + wintypes = { + dock = {animation = "slide-down";}; + toolbar = {animation = "slide-down";}; + }; + + settings = { + inactive-dim = 0.2; + focus-exclude = ["class_g ?= 'rofi'" "class_g ?= 'Steam'"]; + rounded-corners-exclude = [ + "! name~=''" # Qtile == empty wm_class.. + "window_type = 'dock'" + "window_type = 'desktop'" + ]; + + corner-radius = 10; + round-borders = 0; + round-borders-exclude = [ + "! name~=''" # Qtile == empty wm_class.. + ]; + + blur = { + method = "dual_kawase"; + strength = 10.0; + background = true; + background-frame = false; + background-fixed = false; + }; + blur-background-exclude = ["window_type != 'dock'"]; + + daemon = false; + dbus = false; + mark-wmwin-focused = false; + mark-ovredir-focused = false; + detect-rounded-corners = true; + detect-client-opacity = true; + + unredir-if-possible = false; + unredir-if-possible-exclude = []; + detect-transient = true; + detect-client-leader = true; + + invert-color-include = []; + glx-no-stencil = true; + use-damage = false; + transparent-clipping = false; + }; + }; + + systemd.user.services.notifications-tray-icon = { + Unit = { + Description = "Notifications tray icon"; + After = [ "graphical-session-pre.target" "tray.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { + ExecStart = "${pkgs.haskellPackages.notifications-tray-icon}/bin/notifications-tray-icon --github-token-pass dfinity-github-api-token"; + Restart = "always"; + RestartSec = 3; + }; + }; + + systemd.user.services.shutter = { + Unit = { + Description = "Shutter"; + After = [ "graphical-session-pre.target" "tray.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { + ExecStart = "${pkgs.shutter}/bin/shutter --min_at_startup"; + Restart = "always"; + RestartSec = 3; + }; + }; + }; }