diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..7037e7f --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,33 @@ +# inspired by https://github.com/danth/stylix/blob/master/.github/workflows/docs.yml +name: Rust-build +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] +jobs: + build: + name: Build + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + extra-conf: | + extra-experimental-features = nix-command flakes + - name: Set up cache + uses: DeterminateSystems/magic-nix-cache-action@main + - name: action + uses: cachix/install-nix-action@v25 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: cache + uses: cachix/cachix-action@v16 + with: + name: dashnix + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Linter check + run: nix -L build github:${{ github.repository }}/${{ github.sha }} --no-write-lock-file diff --git a/docs/default.nix b/docs/default.nix index 8b3c289..1fd8a1e 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -20,8 +20,8 @@ pathToAttrs = path: lib.attrsets.mapAttrsToList ( name: meta: { - name = name; - meta = meta; + inherit name; + inherit meta; } ) (builtins.readDir path); diff --git a/example/flake.nix b/example/flake.nix index 640ee54..0d1e083 100644 --- a/example/flake.nix +++ b/example/flake.nix @@ -13,7 +13,7 @@ }; }; - outputs = {...} @ inputs: { + outputs = inputs: { nixosConfigurations = inputs.dashNix.dashNixLib.buildSystems {root = ./.;}; }; diff --git a/flake.nix b/flake.nix index b709627..e423801 100644 --- a/flake.nix +++ b/flake.nix @@ -30,9 +30,6 @@ zen-browser.url = "github:youwen5/zen-browser-flake"; - # TODO move to upstream repository after merged nix flake pr - fancontrol.url = "git+https://github.com/DashieTM/fancontrol-gui?ref=nix-flake"; - stylix.url = "github:danth/stylix"; base16.url = "github:SenchoPens/base16.nix"; disko.url = "github:nix-community/disko/latest"; @@ -44,6 +41,7 @@ oxidash.url = "github:Xetibo/OxiDash"; oxipaste.url = "github:Xetibo/OxiPaste"; oxirun.url = "github:Xetibo/OxiRun"; + dashvim.url = "github:Xetibo/DashVim"; # For now until merged into Xetibo hyprdock.url = "github:Xetibo/hyprdock"; reset.url = "github:Xetibo/ReSet"; @@ -53,10 +51,6 @@ # absolute insanity chaoticNyx.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; - - dashvim = { - url = "github:Xetibo/DashVim"; - }; }; outputs = {self, ...} @ inputs: let @@ -109,9 +103,11 @@ inherit inputs; pkgs = unstable; system = currentSystem; - lib = inputs.unstable.lib; - buildSystems = dashNixLib.buildSystems; + inherit (inputs.unstable) lib; + inherit (dashNixLib) buildSystems; }; + lint = unstable.statix; + format = unstable.alejandra; dashNixInputs = inputs; stablePkgs = stable; unstablePkgs = unstable; diff --git a/home/sync.nix b/home/sync.nix index 06b6a02..38dceea 100644 --- a/home/sync.nix +++ b/home/sync.nix @@ -15,44 +15,40 @@ in lib.mkIf config.mods.nextcloud.enable { systemd.user = { - services = ( - builtins.listToAttrs ( - map (opts: { - name = "${opts.name}"; - value = { - Unit = { - Description = "Auto sync Nextcloud"; - After = "network-online.target"; - }; - Service = { - Type = "simple"; - ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}'"; - TimeoutStopSec = "180"; - KillMode = "process"; - KillSignal = "SIGINT"; - }; - Install.WantedBy = ["multi-user.target"]; + services = builtins.listToAttrs ( + map (opts: { + name = "${opts.name}"; + value = { + Unit = { + Description = "Auto sync Nextcloud"; + After = "network-online.target"; }; - }) - synclist - ) + Service = { + Type = "simple"; + ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}'"; + TimeoutStopSec = "180"; + KillMode = "process"; + KillSignal = "SIGINT"; + }; + Install.WantedBy = ["multi-user.target"]; + }; + }) + synclist ); - timers = ( - builtins.listToAttrs ( - map (opts: { - name = "${opts.name}"; - value = { - Unit.Description = "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes"; - Timer.OnBootSec = "1min"; - Timer.OnUnitActiveSec = "60min"; - Install.WantedBy = [ - "multi-user.target" - "timers.target" - ]; - }; - }) - synclist - ) + timers = builtins.listToAttrs ( + map (opts: { + name = "${opts.name}"; + value = { + Unit.Description = "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes"; + Timer.OnBootSec = "1min"; + Timer.OnUnitActiveSec = "60min"; + Install.WantedBy = [ + "multi-user.target" + "timers.target" + ]; + }; + }) + synclist ); startServices = true; }; diff --git a/home/themes/firefoxTheme.nix b/home/themes/firefoxTheme.nix index c73f07c..0de46f6 100644 --- a/home/themes/firefoxTheme.nix +++ b/home/themes/firefoxTheme.nix @@ -319,11 +319,9 @@ else {} ); moduleFn = lib.lists.foldr (attr1: attr2: attr1 // attr2) {}; - mkFirefoxTheme = ( - profiles: - profiles - |> profileNamesFn - |> chromesFn - |> moduleFn - ); + mkFirefoxTheme = profiles: + profiles + |> profileNamesFn + |> chromesFn + |> moduleFn; in {home.file = mkFirefoxTheme profiles;} diff --git a/home/themes/oxiced.nix b/home/themes/oxiced.nix index 5ab624f..8a9e7dc 100644 --- a/home/themes/oxiced.nix +++ b/home/themes/oxiced.nix @@ -65,16 +65,16 @@ in { # legacy compatibility name = scheme.scheme; - base00 = scheme.base00; - base01 = scheme.base01; - base02 = scheme.base02; - base03 = scheme.base03; - base04 = scheme.base04; - base05 = scheme.base05; - base06 = scheme.base06; - base07 = scheme.base07; - base08 = scheme.base08; - base09 = scheme.base09; + inherit (scheme) base00; + inherit (scheme) base01; + inherit (scheme) base02; + inherit (scheme) base03; + inherit (scheme) base04; + inherit (scheme) base05; + inherit (scheme) base06; + inherit (scheme) base07; + inherit (scheme) base08; + inherit (scheme) base09; base0a = scheme.base0A; base0b = scheme.base0B; base0c = scheme.base0C; diff --git a/home/themes/qt.nix b/home/themes/qt.nix index 5a13186..21dc324 100644 --- a/home/themes/qt.nix +++ b/home/themes/qt.nix @@ -31,15 +31,6 @@ } ''; in { - xdg.configFile."qt5ct/colors/tokyonight.conf" = { - text = "${color}"; - }; - xdg.configFile."qt6ct/colors/tokyonight.conf" = { - text = "${color}"; - }; - xdg.configFile."qt5ct/qss/tab.qss" = { - text = "${qss}"; - }; stylix.targets.qt = { enable = false; }; @@ -49,74 +40,85 @@ in { style.name = lib.mkForce "breeze-dark"; }; - xdg.configFile."qt5ct/qt5ct.conf" = { - text = '' + xdg.configFile = { + "qt5ct/colors/tokyonight.conf" = { + text = "${color}"; + }; + "qt6ct/colors/tokyonight.conf" = { + text = "${color}"; + }; + "qt5ct/qss/tab.qss" = { + text = "${qss}"; + }; + "qt5ct/qt5ct.conf" = { + text = '' - [Appearance] - color_scheme_path=/home/${username}/.config/qt5ct/colors/tokyonight.conf - custom_palette=true - icon_theme=MoreWaita - standard_dialogs=xdgdesktopportal - style=Breeze + [Appearance] + color_scheme_path=/home/${username}/.config/qt5ct/colors/tokyonight.conf + custom_palette=true + icon_theme=MoreWaita + standard_dialogs=xdgdesktopportal + style=Breeze - [Fonts] - fixed="Noto Sans,12,-1,5,50,0,0,0,0,0" - general="Noto Sans,12,-1,5,50,0,0,0,0,0" + [Fonts] + fixed="Noto Sans,12,-1,5,50,0,0,0,0,0" + general="Noto Sans,12,-1,5,50,0,0,0,0,0" - [Interface] - activate_item_on_single_click=2 - buttonbox_layout=3 - cursor_flash_time=1000 - dialog_buttons_have_icons=0 - double_click_interval=400 - gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox - keyboard_scheme=4 - menus_have_icons=true - show_shortcuts_in_context_menus=true - stylesheets=/home/${username}/.config/qt5ct/qss/tab.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/fusion-fixes.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/scrollbar-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/sliders-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/tooltip-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/traynotification-simple.qss - toolbutton_style=4 - underline_shortcut=0 - wheel_scroll_lines=3 + [Interface] + activate_item_on_single_click=2 + buttonbox_layout=3 + cursor_flash_time=1000 + dialog_buttons_have_icons=0 + double_click_interval=400 + gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox + keyboard_scheme=4 + menus_have_icons=true + show_shortcuts_in_context_menus=true + stylesheets=/home/${username}/.config/qt5ct/qss/tab.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/fusion-fixes.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/scrollbar-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/sliders-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/tooltip-simple.qss, /nix/store/5713p1pv913a6fsn8j7z6ndikcwikbcd-qt5ct-1.8/share/qt5ct/qss/traynotification-simple.qss + toolbutton_style=4 + underline_shortcut=0 + wheel_scroll_lines=3 - [SettingsWindow] - geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q\0\0\n\0\0\0\0\0\0\0\r[\0\0\x5\x7f\0\0\0\0\x2\0\0\0\rp\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q) + [SettingsWindow] + geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q\0\0\n\0\0\0\0\0\0\0\r[\0\0\x5\x7f\0\0\0\0\x2\0\0\0\rp\0\0\n\0\0\0\0\0\0\0\rK\0\0\x5q) - [Troubleshooting] - force_raster_widgets=1 - ignored_applications=@Invalid() - ''; - }; - xdg.configFile."qt6ct/qt6ct.conf" = { - text = '' + [Troubleshooting] + force_raster_widgets=1 + ignored_applications=@Invalid() + ''; + }; + "qt6ct/qt6ct.conf" = { + text = '' - [Appearance] - color_scheme_path=/home/${username}/.config/qt6ct/colors/tokyonight.conf - custom_palette=true - standard_dialogs=xdgdesktopportal - style=Breeze + [Appearance] + color_scheme_path=/home/${username}/.config/qt6ct/colors/tokyonight.conf + custom_palette=true + standard_dialogs=xdgdesktopportal + style=Breeze - [Fonts] - fixed="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" - general="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" + [Fonts] + fixed="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" + general="DejaVu LGC Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" - [Interface] - activate_item_on_single_click=2 - buttonbox_layout=3 - cursor_flash_time=1000 - dialog_buttons_have_icons=0 - double_click_interval=400 - gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox - keyboard_scheme=4 - menus_have_icons=true - show_shortcuts_in_context_menus=true - stylesheets=@Invalid() - toolbutton_style=4 - underline_shortcut=1 - wheel_scroll_lines=3 + [Interface] + activate_item_on_single_click=2 + buttonbox_layout=3 + cursor_flash_time=1000 + dialog_buttons_have_icons=0 + double_click_interval=400 + gui_effects=General, AnimateMenu, AnimateCombo, AnimateTooltip, AnimateToolBox + keyboard_scheme=4 + menus_have_icons=true + show_shortcuts_in_context_menus=true + stylesheets=@Invalid() + toolbutton_style=4 + underline_shortcut=1 + wheel_scroll_lines=3 - [Troubleshooting] - force_raster_widgets=1 - ignored_applications=@Invalid() - ''; + [Troubleshooting] + force_raster_widgets=1 + ignored_applications=@Invalid() + ''; + }; }; } diff --git a/iso/configuration.nix b/iso/configuration.nix index 5745fe7..8bfcc1e 100644 --- a/iso/configuration.nix +++ b/iso/configuration.nix @@ -10,7 +10,7 @@ in { imports = ["${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"]; nixpkgs.hostPlatform = { - system = system; + inherit system; }; environment.systemPackages = with pkgs; [ diff --git a/lib/default.nix b/lib/default.nix index 2f3a471..30d34ec 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -70,7 +70,6 @@ inputs.reset.homeManagerModules.default inputs.sops-nix.homeManagerModules.sops inputs.dashvim.homeManagerModules.dashvim - inputs.fancontrol.homeManagerModules.default inputs.chaoticNyx.homeManagerModules.default ../modules ]; @@ -82,7 +81,7 @@ builtins.listToAttrs ( map (name: { - name = name; + inherit name; value = let mod = root + /hosts/${name}/configuration.nix; additionalNixosConfig = root + /hosts/${name}/hardware.nix; diff --git a/modules/programs/browser/firefox.nix b/modules/programs/browser/firefox.nix index 6493b79..d93ac58 100644 --- a/modules/programs/browser/firefox.nix +++ b/modules/programs/browser/firefox.nix @@ -105,7 +105,7 @@ in { // { ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} (config.mods.browser.firefox.extensions ++ ( - if (config.mods.browser.firefox.darkreader) + if config.mods.browser.firefox.darkreader then [ { "addon@darkreader.org" = { diff --git a/modules/programs/browser/librewolf.nix b/modules/programs/browser/librewolf.nix index a290fe2..fc74bf3 100644 --- a/modules/programs/browser/librewolf.nix +++ b/modules/programs/browser/librewolf.nix @@ -99,7 +99,7 @@ in { // { ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} (config.mods.browser.librewolf.extensions ++ ( - if (config.mods.browser.firefox.darkreader) + if config.mods.browser.firefox.darkreader then [ { "addon@darkreader.org" = { diff --git a/modules/programs/browser/zen.nix b/modules/programs/browser/zen.nix index 0e2b48a..d3a9b0a 100644 --- a/modules/programs/browser/zen.nix +++ b/modules/programs/browser/zen.nix @@ -134,7 +134,7 @@ in { // { ExtensionSettings = builtins.foldl' (acc: ext: acc // ext) {} (config.mods.browser.zen.extensions ++ ( - if (config.mods.browser.firefox.darkreader) + if config.mods.browser.firefox.darkreader then [ { "addon@darkreader.org" = { diff --git a/modules/programs/coding.nix b/modules/programs/coding.nix index 3e0dcb8..7c79fa9 100644 --- a/modules/programs/coding.nix +++ b/modules/programs/coding.nix @@ -517,28 +517,30 @@ in { lib.optionalAttrs (options ? home.packages) { programs.dashvim = lib.mkIf config.mods.coding.dashvim { enable = true; - colorscheme = config.mods.stylix.colorscheme; + inherit (config.mods.stylix) colorscheme; }; programs.vscode = lib.mkIf config.mods.coding.vscodium.enable { enable = true; package = mkDashDefault pkgs.vscodium; profiles.default.extensions = config.mods.coding.vscodium.extensions; }; - xdg.configFile."neovide/config.toml" = lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) { - source = - (pkgs.formats.toml {}).generate "neovide" - config.mods.coding.neovide.config; - }; + xdg.configFile = { + "neovide/config.toml" = lib.mkIf (config.mods.coding.dashvim || config.mods.coding.neovide.enable) { + source = + (pkgs.formats.toml {}).generate "neovide" + config.mods.coding.neovide.config; + }; - xdg.configFile."gh/config.yml" = lib.mkIf config.mods.coding.gh.enable { - source = - (pkgs.formats.yaml {}).generate "config" - config.mods.coding.gh.config; - }; - xdg.configFile."gh/hosts.yml" = lib.mkIf config.mods.coding.gh.enable { - source = - (pkgs.formats.yaml {}).generate "hosts" - config.mods.coding.gh.hosts; + "gh/config.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "config" + config.mods.coding.gh.config; + }; + "gh/hosts.yml" = lib.mkIf config.mods.coding.gh.enable { + source = + (pkgs.formats.yaml {}).generate "hosts" + config.mods.coding.gh.hosts; + }; }; home.packages = with pkgs; diff --git a/modules/programs/containers.nix b/modules/programs/containers.nix index e65eb06..b62ee25 100644 --- a/modules/programs/containers.nix +++ b/modules/programs/containers.nix @@ -43,39 +43,37 @@ description = "Container packages"; }; }; - config = ( - lib.optionalAttrs (options ? environment.systemPackages) { - environment.systemPackages = - (lib.lists.optionals ( - config.mods.containers.variant == "podman" - ) - config.mods.containers.podmanPackages) - ++ (lib.lists.optionals ( - config.mods.containers.variant == "docker" - ) - config.mods.containers.dockerPackages) - ++ (lib.lists.optionals ( - config.mods.containers.variant == "podman" || config.mods.containers.variant == "docker" - ) - config.mods.containers.combinedPackages); - virtualisation = - if (config.mods.containers.variant == "podman") - then { - containers.enable = true; - podman = { - enable = true; - dockerCompat = mkDashDefault true; - defaultNetwork.settings.dns_enabled = mkDashDefault true; - }; - } - else if (config.mods.containers.variant == "docker") - then { - containers.enable = true; - docker = { - enable = true; - }; - } - else {}; - } - ); + config = lib.optionalAttrs (options ? environment.systemPackages) { + environment.systemPackages = + (lib.lists.optionals ( + config.mods.containers.variant == "podman" + ) + config.mods.containers.podmanPackages) + ++ (lib.lists.optionals ( + config.mods.containers.variant == "docker" + ) + config.mods.containers.dockerPackages) + ++ (lib.lists.optionals ( + config.mods.containers.variant == "podman" || config.mods.containers.variant == "docker" + ) + config.mods.containers.combinedPackages); + virtualisation = + if (config.mods.containers.variant == "podman") + then { + containers.enable = true; + podman = { + enable = true; + dockerCompat = mkDashDefault true; + defaultNetwork.settings.dns_enabled = mkDashDefault true; + }; + } + else if (config.mods.containers.variant == "docker") + then { + containers.enable = true; + docker = { + enable = true; + }; + } + else {}; + }; } diff --git a/modules/programs/drives.nix b/modules/programs/drives.nix index c085144..a631802 100644 --- a/modules/programs/drives.nix +++ b/modules/programs/drives.nix @@ -159,25 +159,143 @@ }; }; - config = ( - lib.optionalAttrs (options ? fileSystems) { - boot.initrd.luks.devices = lib.mkIf (config.mods.drives.variant == "manual" && config.mods.drives.useEncryption) ( - builtins.listToAttrs ( - map ( - { - name, - drive, - }: { - cryptstorage.device = lib.mkIf (name != "root") drive?device; - cryptoroot.device = lib.mkIf (name == "root") drive?device; - } - ) - config.mods.drives.extraDrives + config = lib.optionalAttrs (options ? fileSystems) { + boot.initrd.luks.devices = lib.mkIf (config.mods.drives.variant == "manual" && config.mods.drives.useEncryption) ( + builtins.listToAttrs ( + map ( + { + name, + drive, + }: { + cryptstorage.device = lib.mkIf (name != "root") drive?device; + cryptoroot.device = lib.mkIf (name == "root") drive?device; + } ) - ); + config.mods.drives.extraDrives + ) + ); - fileSystems = lib.mkIf (config.mods.drives.variant == "manual" && !config.conf.wsl) ( - builtins.listToAttrs ( + fileSystems = lib.mkIf (config.mods.drives.variant == "manual" && !config.conf.wsl) ( + builtins.listToAttrs ( + map ( + { + name, + drive, + }: { + name = "/" + name; + value = drive; + } + ) + config.mods.drives.extraDrives + ) + // (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { + "/" = { + device = "/dev/disk/by-label/ROOT"; + fsType = config.mods.drives.homeAndRootFsTypes; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + + "/boot" = { + device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + options = [ + "rw" + "fmask=0022" + "dmask=0022" + "noatime" + ]; + }; + + "/home" = { + device = "/dev/disk/by-label/HOME"; + fsType = config.mods.drives.homeAndRootFsTypes; + options = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + } + ); + + swapDevices = lib.mkIf (config.mods.drives.useSwap && config.mods.drives.variant == "manual" && !config.conf.wsl) [ + {device = "/dev/disk/by-label/SWAP";} + ]; + + disko.devices = lib.mkIf (config.mods.drives.variant == "disko") { + disk = + { + main = (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { + device = "${config.mods.drives.disko.defaultDiskId}"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + root = { + start = "${ + if config.mods.drives.useSwap + then builtins.toString config.mods.drives.disko.swapAmount + else builtins.toString 1 + }G"; + end = "${builtins.toString config.mods.drives.disko.rootAmount}%"; + content = { + type = "filesystem"; + format = config.mods.drives.homeAndRootFsTypes; + mountpoint = "/"; + mountOptions = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + }; + plainSwap = { + start = "1G"; + end = "33G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; + }; + }; + boot = { + start = "0G"; + end = "1G"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "rw" + "fmask=0022" + "dmask=0022" + "noatime" + ]; + }; + }; + home = { + start = "${builtins.toString config.mods.drives.disko.rootAmount}%"; + end = "100%"; + content = { + type = "filesystem"; + format = config.mods.drives.homeAndRootFsTypes; + mountpoint = "/home"; + mountOptions = [ + "noatime" + "nodiratime" + "discard" + ]; + }; + }; + }; + }; + }; + } + // builtins.listToAttrs ( map ( { name, @@ -188,127 +306,7 @@ } ) config.mods.drives.extraDrives - ) - // (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { - "/" = { - device = "/dev/disk/by-label/ROOT"; - fsType = config.mods.drives.homeAndRootFsTypes; - options = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - - "/boot" = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = [ - "rw" - "fmask=0022" - "dmask=0022" - "noatime" - ]; - }; - - "/home" = { - device = "/dev/disk/by-label/HOME"; - fsType = config.mods.drives.homeAndRootFsTypes; - options = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - } - ); - - swapDevices = lib.mkIf (config.mods.drives.useSwap && config.mods.drives.variant == "manual" && !config.conf.wsl) [ - {device = "/dev/disk/by-label/SWAP";} - ]; - - disko.devices = lib.mkIf (config.mods.drives.variant == "disko") { - disk = - { - main = (lib.optionalAttrs config.mods.drives.defaultDrives.enable) { - device = "${config.mods.drives.disko.defaultDiskId}"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - root = { - start = "${ - if config.mods.drives.useSwap - then builtins.toString config.mods.drives.disko.swapAmount - else builtins.toString 1 - }G"; - end = "${builtins.toString config.mods.drives.disko.rootAmount}%"; - content = { - type = "filesystem"; - format = config.mods.drives.homeAndRootFsTypes; - mountpoint = "/"; - mountOptions = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - }; - plainSwap = { - start = "1G"; - end = "33G"; - content = { - type = "swap"; - discardPolicy = "both"; - resumeDevice = true; - }; - }; - boot = { - start = "0G"; - end = "1G"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "rw" - "fmask=0022" - "dmask=0022" - "noatime" - ]; - }; - }; - home = { - start = "${builtins.toString config.mods.drives.disko.rootAmount}%"; - end = "100%"; - content = { - type = "filesystem"; - format = config.mods.drives.homeAndRootFsTypes; - mountpoint = "/home"; - mountOptions = [ - "noatime" - "nodiratime" - "discard" - ]; - }; - }; - }; - }; - }; - } - // builtins.listToAttrs ( - map ( - { - name, - drive, - }: { - name = "/" + name; - value = drive; - } - ) - config.mods.drives.extraDrives - ); - }; - } - ); + ); + }; + }; } diff --git a/modules/programs/fancontrol.nix b/modules/programs/fancontrol.nix index 87be9af..8abf24d 100644 --- a/modules/programs/fancontrol.nix +++ b/modules/programs/fancontrol.nix @@ -1,5 +1,6 @@ { lib, + pkgs, config, options, ... @@ -20,7 +21,7 @@ }; config = lib.mkIf config.mods.fancontrol.enable ( lib.optionalAttrs (options ? home.packages) { - programs.fancontrol-gui.enable = true; + home.packages = [pkgs.fancontrol-gui]; } // (lib.optionalAttrs (options ? boot.kernelModules) { boot = { diff --git a/modules/programs/fastfetch.nix b/modules/programs/fastfetch.nix index 52366e7..f73b2cd 100644 --- a/modules/programs/fastfetch.nix +++ b/modules/programs/fastfetch.nix @@ -56,7 +56,7 @@ }; config = lib.optionalAttrs (options ? home.packages) { - xdg.configFile."fastfetch/config.jsonc" = lib.mkIf (config.mods.dashfetch.enable) { + xdg.configFile."fastfetch/config.jsonc" = lib.mkIf config.mods.dashfetch.enable { source = (pkgs.formats.json {}).generate "config.jsonc" { diff --git a/modules/programs/git.nix b/modules/programs/git.nix index ed2719e..bfcb334 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -47,15 +47,13 @@ description = "ssh configuration (keys for git)"; }; }; - config = ( - lib.optionalAttrs (options ? programs.git && options ? home.file) { - programs.git = { - enable = true; - userName = config.mods.git.username; - userEmail = config.mods.git.email; - extraConfig = config.mods.git.additionalConfig; - }; - home.file.".ssh/config".text = config.mods.git.sshConfig; - } - ); + config = lib.optionalAttrs (options ? programs.git && options ? home.file) { + programs.git = { + enable = true; + userName = config.mods.git.username; + userEmail = config.mods.git.email; + extraConfig = config.mods.git.additionalConfig; + }; + home.file.".ssh/config".text = config.mods.git.sshConfig; + }; } diff --git a/modules/programs/greetd.nix b/modules/programs/greetd.nix index 2d1727c..d632b6f 100644 --- a/modules/programs/greetd.nix +++ b/modules/programs/greetd.nix @@ -130,9 +130,13 @@ ''; # unlock GPG keyring on login - security.pam.services.greetd.enableGnomeKeyring = mkDashDefault true; - security.pam.services.greetd.sshAgentAuth = mkDashDefault true; - security.pam.sshAgentAuth.enable = mkDashDefault true; + security.pam = { + services.greetd = { + enableGnomeKeyring = mkDashDefault true; + sshAgentAuth = mkDashDefault true; + }; + sshAgentAuth.enable = mkDashDefault true; + }; } // lib.optionalAttrs (options ? home) { xdg.configFile."regreet/regreet.toml".source = diff --git a/modules/programs/scripts.nix b/modules/programs/scripts.nix index ce0f4f0..98eb26b 100644 --- a/modules/programs/scripts.nix +++ b/modules/programs/scripts.nix @@ -24,102 +24,100 @@ description = "More scripts to be passed. (check existing ones for types and examples)"; }; }; - config = ( - lib.optionalAttrs (options ? home.packages) { - home.packages = - [ - (lib.mkIf config.mods.scripts.changeBrightness ( - pkgs.writeShellScriptBin "changeBrightness" '' - brightnessctl set "$1" - CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}') - notify-send -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" - '' - )) - (lib.mkIf config.mods.scripts.audioControl ( - pkgs.writeShellScriptBin "audioControl" '' - ncspot() { - NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n') - CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') - pactl set-sink-input-volume "$CHANGE" "$1" - VOLUME=$(pactl list sink-inputs | rg "$NUM" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') - notify-send -a "ncspot" -r 990 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Spotify Volume: ''${VOLUME}%" - } + config = lib.optionalAttrs (options ? home.packages) { + home.packages = + [ + (lib.mkIf config.mods.scripts.changeBrightness ( + pkgs.writeShellScriptBin "changeBrightness" '' + brightnessctl set "$1" + CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}') + notify-send -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" + '' + )) + (lib.mkIf config.mods.scripts.audioControl ( + pkgs.writeShellScriptBin "audioControl" '' + ncspot() { + NUM=$(pactl list clients short | rg "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n') + CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') + pactl set-sink-input-volume "$CHANGE" "$1" + VOLUME=$(pactl list sink-inputs | rg "$NUM" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') + notify-send -a "ncspot" -r 990 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Spotify Volume: ''${VOLUME}%" + } - firefox() { - STRING=$(pactl list clients short | rg "firefox" | awk -F 'PipeWire' ' { print $1 "," } ' | tr -d ' \t\n') - # NUMS=',' read -r -a array <<< "$STRING" - readarray -td, NUMS <<<"$STRING" - declare -p NUMS - for index in "''${!NUMS[@]}"; do #"''${!array[@]}" - NUM=$(echo "''${NUMS[index]}" | tr -d ' \t\n') - CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') - pactl set-sink-input-volume "$CHANGE" "$1" - done - VOLUME=$(pactl list sink-inputs | rg "''${NUMS[0]}" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') - notify-send -a "Firefox" -r 991 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Firefox Volume: ''${VOLUME}%" - } + firefox() { + STRING=$(pactl list clients short | rg "firefox" | awk -F 'PipeWire' ' { print $1 "," } ' | tr -d ' \t\n') + # NUMS=',' read -r -a array <<< "$STRING" + readarray -td, NUMS <<<"$STRING" + declare -p NUMS + for index in "''${!NUMS[@]}"; do #"''${!array[@]}" + NUM=$(echo "''${NUMS[index]}" | tr -d ' \t\n') + CHANGE=$(pactl list sink-inputs short | rg "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n') + pactl set-sink-input-volume "$CHANGE" "$1" + done + VOLUME=$(pactl list sink-inputs | rg "''${NUMS[0]}" -A7 | rg "Volume:" | awk -F ' ' ' { print $5 }' | tr -d '%') + notify-send -a "Firefox" -r 991 -u low -i audio-volume-high -h int:progress:"$VOLUME" "Firefox Volume: ''${VOLUME}%" + } - internal() { - SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }') - if [ "$SPEAKER" != "" ]; then - pactl set-default-sink "$SPEAKER" - pactl set-sink-mute "$SPEAKER" false - DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') - notify-send "changed audio to "$DEVICE" " - else - notify-send "failed, not available!" - fi - } + internal() { + SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }') + if [ "$SPEAKER" != "" ]; then + pactl set-default-sink "$SPEAKER" + pactl set-sink-mute "$SPEAKER" false + DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') + notify-send "changed audio to "$DEVICE" " + else + notify-send "failed, not available!" + fi + } - set_volume_sink() { - pactl set-sink-volume @DEFAULT_SINK@ "$1" - CURRENT=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %') - notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Output Volume: ''${CURRENT}%" - } + set_volume_sink() { + pactl set-sink-volume @DEFAULT_SINK@ "$1" + CURRENT=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %') + notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Output Volume: ''${CURRENT}%" + } - set_volume_source() { - pactl set-source-volume @DEFAULT_SOURCE@ "$1" - CURRENT=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %') - notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Input Volume: ''${CURRENT}%" - } + set_volume_source() { + pactl set-source-volume @DEFAULT_SOURCE@ "$1" + CURRENT=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %') + notify-send -a "System Volume" -r 1001 -u low -i audio-volume-high -h int:progress:"$CURRENT" "Input Volume: ''${CURRENT}%" + } - bluetooth() { - SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }') - if [ "$SPEAKER" != "" ]; then - pactl set-default-sink "$SPEAKER" - pactl set-sink-mute "$SPEAKER" false - DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') - notify-send "changed audio to "$DEVICE" " - else - notify-send "failed, not available!" - fi - } + bluetooth() { + SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }') + if [ "$SPEAKER" != "" ]; then + pactl set-default-sink "$SPEAKER" + pactl set-sink-mute "$SPEAKER" false + DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ') + notify-send "changed audio to "$DEVICE" " + else + notify-send "failed, not available!" + fi + } - mute() { - pactl set-sink-mute @DEFAULT_SINK@ toggle - MUTE=$(pactl get-sink-mute @DEFAULT_SINK@) - notify-send -a "Audio" -r 994 -u low -i audio-volume-high "Audio: $MUTE" - } + mute() { + pactl set-sink-mute @DEFAULT_SINK@ toggle + MUTE=$(pactl get-sink-mute @DEFAULT_SINK@) + notify-send -a "Audio" -r 994 -u low -i audio-volume-high "Audio: $MUTE" + } - if [ "$1" == "internal" ]; then - internal - elif [ "$1" == "bluetooth" ]; then - bluetooth - elif [ "$1" == "firefox" ]; then - firefox "$2" - elif [ "$1" == "ncspot" ]; then - ncspot "$2" - elif [ "$1" == "mute" ]; then - mute - elif [ "$1" == "sink" ]; then - set_volume_sink "$2" - elif [ "$1" == "source" ]; then - set_volume_source "$2" - fi - '' - )) - ] - ++ config.mods.scripts.scripts; - } - ); + if [ "$1" == "internal" ]; then + internal + elif [ "$1" == "bluetooth" ]; then + bluetooth + elif [ "$1" == "firefox" ]; then + firefox "$2" + elif [ "$1" == "ncspot" ]; then + ncspot "$2" + elif [ "$1" == "mute" ]; then + mute + elif [ "$1" == "sink" ]; then + set_volume_sink "$2" + elif [ "$1" == "source" ]; then + set_volume_source "$2" + fi + '' + )) + ] + ++ config.mods.scripts.scripts; + }; } diff --git a/modules/programs/teams.nix b/modules/programs/teams.nix index a909ee5..e9d843a 100644 --- a/modules/programs/teams.nix +++ b/modules/programs/teams.nix @@ -23,7 +23,7 @@ in { }; config = lib.mkIf config.mods.teams.enable ( lib.optionalAttrs (options ? home.packages) { - home.packages = [(callPackage ../../override/teams.nix {chromium = pkgs.chromium;})]; + home.packages = [(callPackage ../../override/teams.nix {inherit (pkgs) chromium;})]; } // (lib.optionalAttrs (options ? boot.kernelModules) { boot = { diff --git a/modules/programs/xkb.nix b/modules/programs/xkb.nix index f78e5e2..ebb1bda 100644 --- a/modules/programs/xkb.nix +++ b/modules/programs/xkb.nix @@ -18,13 +18,11 @@ description = "Your variant"; }; }; - config = ( - lib.optionalAttrs (options ? services.xserver) { - # Configure keymap in X11 - services.xserver = { - xkb.layout = "${config.mods.xkb.layout}"; - xkb.variant = "${config.mods.xkb.variant}"; - }; - } - ); + config = lib.optionalAttrs (options ? services.xserver) { + # Configure keymap in X11 + services.xserver = { + xkb.layout = "${config.mods.xkb.layout}"; + xkb.variant = "${config.mods.xkb.variant}"; + }; + }; } diff --git a/modules/programs/yazi/default.nix b/modules/programs/yazi/default.nix index 9caed87..c9bd08b 100644 --- a/modules/programs/yazi/default.nix +++ b/modules/programs/yazi/default.nix @@ -52,7 +52,7 @@ lib.mkIf config.mods.yazi.enable { home.packages = [pkgs.glow]; programs.yazi = { - enable = conf.enable; + inherit (conf) enable; settings = conf.settings // config.mods.yazi.additionalKeymap; keymap = conf.keymap // config.mods.yazi.additionalConfig; plugins = config.mods.yazi.plugins;