From 1b65ba7a838e422c9bf16ddcaf796a996fa51b6b Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 27 Dec 2024 08:45:34 +0100 Subject: refactor: introduce profiles --- nixos/parts/basics-physical.nix | 8 ---- nixos/parts/basics.nix | 35 -------------- nixos/parts/create.nix | 11 ----- nixos/parts/dev.nix | 36 -------------- nixos/parts/graphical.nix | 103 ---------------------------------------- nixos/parts/scripts/deploy-dir | 16 ------- nixos/parts/scripts/reset-bg | 2 - nixos/parts/scripts/set-bg | 3 -- nixos/parts/server.nix | 9 ---- nixos/parts/tailscale.nix | 8 ---- 10 files changed, 231 deletions(-) delete mode 100644 nixos/parts/basics-physical.nix delete mode 100644 nixos/parts/basics.nix delete mode 100644 nixos/parts/create.nix delete mode 100644 nixos/parts/dev.nix delete mode 100644 nixos/parts/graphical.nix delete mode 100755 nixos/parts/scripts/deploy-dir delete mode 100644 nixos/parts/scripts/reset-bg delete mode 100644 nixos/parts/scripts/set-bg delete mode 100644 nixos/parts/server.nix delete mode 100644 nixos/parts/tailscale.nix (limited to 'nixos/parts') diff --git a/nixos/parts/basics-physical.nix b/nixos/parts/basics-physical.nix deleted file mode 100644 index 683c3b2..0000000 --- a/nixos/parts/basics-physical.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - pciutils - usbutils - ]; -} diff --git a/nixos/parts/basics.nix b/nixos/parts/basics.nix deleted file mode 100644 index aa6eff9..0000000 --- a/nixos/parts/basics.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - git - vim - - file - htop - ripgrep - tree - # TODO: use a tree alternative that understands .gitignore - wget - ]; - - users.defaultUserShell = pkgs.zsh; - programs.zsh = { - enable = true; - - # Disabling compinit in /etc/zshrc so that we can call - # compinit with a custom zcompdump location in .zshrc. - enableGlobalCompInit = false; - }; - - environment.sessionVariables = - let - config = "$HOME/config/user"; - in - { - # Set environment variables for software that doesn't - # follow the XDG Base Directory specification. - - ZDOTDIR = "${config}/zsh"; - }; -} diff --git a/nixos/parts/create.nix b/nixos/parts/create.nix deleted file mode 100644 index 1fc7a28..0000000 --- a/nixos/parts/create.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - graphviz-nox # for dot - - gimp - krita - ]; -} - diff --git a/nixos/parts/dev.nix b/nixos/parts/dev.nix deleted file mode 100644 index 0d258b4..0000000 --- a/nixos/parts/dev.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.sessionVariables = { - # Tell .zshrc to source zshrc-dev.sh. - MYNIX_DEV = "true"; - }; - - environment.systemPackages = with pkgs; [ - rustup - python313 - nodejs_22 - - # CLI tools - docker-compose - gnumake - jq - just - sqlite-interactive - tokei - - (writeShellScriptBin "deploy-dir" (builtins.readFile ./scripts/deploy-dir)) - - gcc # rustc fails if cc linker isn't found - chromium - - vscodium - # I'm installing extensions via my install-imperative script. - ]; - - virtualisation.podman = { - enable = true; - dockerSocket.enable = true; - }; -} - diff --git a/nixos/parts/graphical.nix b/nixos/parts/graphical.nix deleted file mode 100644 index d459c33..0000000 --- a/nixos/parts/graphical.nix +++ /dev/null @@ -1,103 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.sway = { - enable = true; - # Execute sway with required environment variables for GTK apps. - wrapperFeatures.gtk = true; - }; - programs.ssh.startAgent = true; - - environment.loginShellInit = '' - [[ "$(tty)" == /dev/tty1 ]] && exec sway - ''; - - environment.sessionVariables = { - # Tell .zshrc to source zshrc-graphical.sh. - MYNIX_GRAPHICAL = "true"; - }; - - environment.systemPackages = with pkgs; [ - swaylock - - # CLI tools - brightnessctl - wl-clipboard # for wl-copy and wl-paste - grim - - # When I ssh into a server my terminal changes to a host-specific background color via - # a LocalCommand configured in ~/.ssh/config and a ZSH function to reset the color on exit. - (writeShellScriptBin "set-bg" (builtins.readFile ./scripts/set-bg)) - (writeShellScriptBin "reset-bg" (builtins.readFile ./scripts/reset-bg)) - - # graphical tools - imv - mpv - - # set and forget - i3status-rust - ]; - - # This generates /etc/xdg/mimeapps.list. The XDG spec and xdg-open don't support wildcards in MIME types. - # TODO: use an xdg-open alternative that supports wildcards in MIME types and doesn't use mimeapps.list - xdg.mime.defaultApplications = - let - defaultBrowser = "firefox.desktop"; - in - { - "text/html" = defaultBrowser; - - "x-scheme-handler/http" = defaultBrowser; - "x-scheme-handler/https" = defaultBrowser; - "x-scheme-handler/mailto" = "thunderbird.desktop"; - }; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - security.rtkit.enable = true; # recommended for PipeWire - - programs.thunderbird = { - enable = true; - }; - - programs.firefox = { - enable = true; - - policies = { - DontCheckDefaultBrowser = true; - DisablePocket = true; - FirefoxHome = { - SponsoredTopSites = false; - }; - - SearchSuggestEnabled = false; - # cannot use SearchEngines because it's only available on ESR :( - # (https://mozilla.github.io/policy-templates/#searchengines-this-policy-is-only-available-on-the-esr) - - Preferences = { - "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px - "browser.uidensity" = 1; - "browser.aboutConfig.showWarning" = false; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked - }; - - ExtensionSettings = { - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - - PasswordManagerEnabled = false; - AutofillCreditCardEnabled = false; - ExtensionSettings."{446900e4-71c2-419f-a6a7-df9c091e268b}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - }; -} diff --git a/nixos/parts/scripts/deploy-dir b/nixos/parts/scripts/deploy-dir deleted file mode 100755 index bb7dfdf..0000000 --- a/nixos/parts/scripts/deploy-dir +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ]; then - echo "usage: $0 " - exit 1 -fi -printf -v remote_dir %q $3 - -cd $1 -tar cf - . | ssh $2 "set -xe -TEMP_DIR=\$(mktemp -d) -cd \$TEMP_DIR -tar xvf - -rm -rf $remote_dir -mv \$TEMP_DIR $remote_dir -" diff --git a/nixos/parts/scripts/reset-bg b/nixos/parts/scripts/reset-bg deleted file mode 100644 index 5aa20f6..0000000 --- a/nixos/parts/scripts/reset-bg +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo -en "\033]111\007" diff --git a/nixos/parts/scripts/set-bg b/nixos/parts/scripts/set-bg deleted file mode 100644 index e78afdc..0000000 --- a/nixos/parts/scripts/set-bg +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -rgb_with_slashes=$(echo "$1" | sed -r 's,(..)(..),\1/\2/,') -echo -en "\033]11;rgb:$rgb_with_slashes\007" diff --git a/nixos/parts/server.nix b/nixos/parts/server.nix deleted file mode 100644 index 3d94985..0000000 --- a/nixos/parts/server.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: - -{ - services = { - openssh = { - enable = true; - }; - }; -} diff --git a/nixos/parts/tailscale.nix b/nixos/parts/tailscale.nix deleted file mode 100644 index 5d5a99c..0000000 --- a/nixos/parts/tailscale.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.tailscale = { - enable = true; - # MANUAL: run tailscale up --login-server https:/// - }; -} -- cgit v1.2.3