~vonfry/dotfiles

af487d70cbe96abd45873411546c297dd71e7f45 — Vonfry 2 days ago d4a74d0 + 7c9972b master 20221201
Merge branch 'release/20221201'
19 files changed, 69 insertions(+), 152 deletions(-)

M etc/nixos/flake.lock
M etc/nixos/modules/base.nix
M etc/nixos/modules/overlay/Update.sh
M etc/nixos/modules/overlay/_sources/generated.json
M etc/nixos/modules/overlay/_sources/generated.nix
M etc/nixos/modules/user/development.nix
M etc/nixos/modules/user/files/emacs.d/core/vonfry-editor.el
M etc/nixos/modules/user/files/emacs.d/core/vonfry-packages.el
M etc/nixos/modules/user/files/emacs.d/core/vonfry-ui.el
D etc/nixos/modules/user/files/emacs.d/modules/visual/indent-guide/packages.el
R etc/nixos/modules/user/files/emacs.d/modules/visual/{indent-guide/config.el => pair-guide/config.el}
R etc/nixos/modules/user/files/emacs.d/modules/visual/{indent-guide/func.el => pair-guide/func.el}
A etc/nixos/modules/user/files/emacs.d/modules/visual/pair-guide/packages.el
M etc/nixos/modules/user/misc.nix
M etc/nixos/modules/user/x.nix
D setup/default.sh
D setup/os/default.sh
D setup/os/nixos.sh
D setup/readme.org
M etc/nixos/flake.lock => etc/nixos/flake.lock +16 -15
@@ 6,11 6,11 @@
        "nixpkgs": "nixpkgs"
      },
      "locked": {
        "lastModified": 1669463559,
        "narHash": "sha256-aemo1lyq+vi3R0+gaCJvja9LIm/OZ3nsPKvPLrjMuVw=",
        "lastModified": 1669874436,
        "narHash": "sha256-HYvJU6SROcNwcwow5xrG2Is69UJ+GaVrFSSX7QjG/6c=",
        "owner": "nix-community",
        "repo": "emacs-overlay",
        "rev": "3d5e5cfa91ed10d39e0504387242750996e8b027",
        "rev": "6530a233351a806e88e83d10312d7dd9e8bc6cd3",
        "type": "github"
      },
      "original": {


@@ 55,11 55,11 @@
        "utils": "utils"
      },
      "locked": {
        "lastModified": 1669071065,
        "narHash": "sha256-KBpgj3JkvlPsJ3duOZqFJe6tgr+wc75t8sFmgRbBSbw=",
        "lastModified": 1669724862,
        "narHash": "sha256-GwLonjmyhnTGQRNfKcUCgMSKYj49ZehjjJulaM/yH18=",
        "owner": "nix-community",
        "repo": "home-manager",
        "rev": "f7641a3ff398ccce952e19a199d775934e518c1d",
        "rev": "e891b060e7d11bb8f7dedb86a41d804891a6f5a9",
        "type": "github"
      },
      "original": {


@@ 71,9 71,10 @@
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 0,
        "narHash": "sha256-AltUA8bPbXeRgzcDhQEURVHqQhTByxk6Xtgf+CYmEFk=",
        "path": "/nix/store/x775yfa3xwc6wfsy8z0mmq40wyk8vma6-source",
        "lastModified": 1669465383,
        "narHash": "sha256-fVbG427suESAEb8/P47O/zD/G9BSeFxLh94IUzgOchs=",
        "path": "/nix/store/f1hyxk759893q1jyqdbc0bpsxgq3sz76-source",
        "rev": "899e7caf59d1954882a8e2dff45ccc0387c186f6",
        "type": "path"
      },
      "original": {


@@ 99,11 100,11 @@
    },
    "nixpkgs_3": {
      "locked": {
        "lastModified": 1669379897,
        "narHash": "sha256-XM3xBfQD5tOtV4KAhQHyh53cJdqkLwotZa5JJIUjbQc=",
        "lastModified": 1669834992,
        "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "8690906c4d80db5d85f52313a8487bf2e7b8d4c5",
        "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502",
        "type": "github"
      },
      "original": {


@@ 124,11 125,11 @@
    },
    "unstable": {
      "locked": {
        "lastModified": 1669320964,
        "narHash": "sha256-EBFw+ge12Pcr3qCk8If3/eMBAoQLR7ytndXZoRevUtM=",
        "lastModified": 1669542132,
        "narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "27ccd29078f974ddbdd7edc8e38c8c8ae003c877",
        "rev": "a115bb9bd56831941be3776c8a94005867f316a7",
        "type": "github"
      },
      "original": {

M etc/nixos/modules/base.nix => etc/nixos/modules/base.nix +1 -0
@@ 74,6 74,7 @@ in {
        enable = true;
        extraRules = [
          { groups = [ "wheel" ];
            noPass = !config.security.doas.wheelNeedsPassword;
            setEnv = [ "http_proxy" "https_proxy" "all_proxy"
                       "HTTP_PROXY" "HTTPS_PROXY" "ALL_PROXY"
                     ]; }

M etc/nixos/modules/overlay/Update.sh => etc/nixos/modules/overlay/Update.sh +2 -1
@@ 1,2 1,3 @@
#!/usr/bin/env bash
nix develop '../..' --command runghc Update.hs "$@"
script_dir=$( cd "$( dirname "$0" )/.." && pwd )
nix develop '$script_dir/../..' --command runghc Update.hs "$@"

M etc/nixos/modules/overlay/_sources/generated.json => etc/nixos/modules/overlay/_sources/generated.json +5 -5
@@ 25,7 25,7 @@
            "type": "url",
            "url": "https://wiki.haskell.org/wikistatic/haskellwiki_logo.png"
        },
        "version": "2022-11-26"
        "version": "2022-12-01"
    },
    "fcitx5-material-color": {
        "cargoLocks": null,


@@ 154,11 154,11 @@
            "name": null,
            "owner": "KyleBing",
            "repo": "rime-wubi86-jidian",
            "rev": "2e72043eadfb47ae714e04407ac64542d596fb8f",
            "sha256": "sha256-68vDAk+YxGlB+f53dF56PIrEf/W7CA20RBe3zne90ZM=",
            "rev": "40a6dd2d75d9b258be7fb14fd01b017c382586fb",
            "sha256": "sha256-LihQ9ALjzpLeZhFATzOiwVle1p6bN0DG9TL9mw7nRJg=",
            "type": "github"
        },
        "version": "2e72043eadfb47ae714e04407ac64542d596fb8f"
        "version": "40a6dd2d75d9b258be7fb14fd01b017c382586fb"
    },
    "sddm-chili": {
        "cargoLocks": null,


@@ 210,6 210,6 @@
            "type": "url",
            "url": "https://vonfry.name/images/default/logo-white.png"
        },
        "version": "2022-11-26"
        "version": "2022-12-01"
    }
}
\ No newline at end of file

M etc/nixos/modules/overlay/_sources/generated.nix => etc/nixos/modules/overlay/_sources/generated.nix +5 -5
@@ 11,7 11,7 @@
  };
  background-image = {
    pname = "background-image";
    version = "2022-11-26";
    version = "2022-12-01";
    src = fetchurl {
      url = "https://wiki.haskell.org/wikistatic/haskellwiki_logo.png";
      sha256 = "sha256-NVUPqd/3lxzRPrTfBCBXgxrXR3blEJC/XiJ1nAEcaPQ=";


@@ 85,13 85,13 @@
  };
  rime-wubi86-jidian = {
    pname = "rime-wubi86-jidian";
    version = "2e72043eadfb47ae714e04407ac64542d596fb8f";
    version = "40a6dd2d75d9b258be7fb14fd01b017c382586fb";
    src = fetchFromGitHub ({
      owner = "KyleBing";
      repo = "rime-wubi86-jidian";
      rev = "2e72043eadfb47ae714e04407ac64542d596fb8f";
      rev = "40a6dd2d75d9b258be7fb14fd01b017c382586fb";
      fetchSubmodules = false;
      sha256 = "sha256-68vDAk+YxGlB+f53dF56PIrEf/W7CA20RBe3zne90ZM=";
      sha256 = "sha256-LihQ9ALjzpLeZhFATzOiwVle1p6bN0DG9TL9mw7nRJg=";
    });
  };
  sddm-chili = {


@@ 118,7 118,7 @@
  };
  vonfry-icon = {
    pname = "vonfry-icon";
    version = "2022-11-26";
    version = "2022-12-01";
    src = fetchurl {
      url = "https://vonfry.name/images/default/logo-white.png";
      sha256 = "sha256-57Vf7OS5H6va5M5Tmx87FmpSZtIlqldeiBkwcbrrEm0=";

M etc/nixos/modules/user/development.nix => etc/nixos/modules/user/development.nix +0 -1
@@ 210,7 210,6 @@ in {
          engine-mode
          evil-nerd-commenter
          rainbow-delimiters
          highlight-indent-guides
          doom-modeline
          hl-todo
          rainbow-mode

M etc/nixos/modules/user/files/emacs.d/core/vonfry-editor.el => etc/nixos/modules/user/files/emacs.d/core/vonfry-editor.el +0 -3
@@ 2,9 2,6 @@
;;
;; Set the configure about editing.

(when (fboundp 'electric-pair-mode)
  (electric-pair-mode))

(defgroup vonfry-editor nil
  "Vonfry's group about editor")


M etc/nixos/modules/user/files/emacs.d/core/vonfry-packages.el => etc/nixos/modules/user/files/emacs.d/core/vonfry-packages.el +3 -3
@@ 42,9 42,9 @@ If t, package.el is used to install packages automatically."
 use-package-always-demand t
 use-package-always-ensure vonfry-package-ensure)

(when (boundp 'native-comp-eln-load-path)
  (setq-default startup-redirect-eln-cache
                (expand-file-name "eln/" vonfry-cache-dir)))
(when (and (boundp 'native-comp-eln-load-path)
           (fboundp 'startup-redirect-eln-cache))
  (startup-redirect-eln-cache (expand-file-name "eln/" vonfry-cache-dir)))

;;
;; define some basic packages

M etc/nixos/modules/user/files/emacs.d/core/vonfry-ui.el => etc/nixos/modules/user/files/emacs.d/core/vonfry-ui.el +3 -2
@@ 69,8 69,9 @@ THEME is a symbol passed to `load-theme'"
                      "Symbola"
                      frame 'prepend)))

(add-hook 'server-after-make-frame-hook 'vonfry--set-font)
(when (display-graphic-p) (vonfry--set-font))
(defun vonfry--set-font-graphic ()
  (when (display-graphic-p) (vonfry--set-font)))
(add-hook 'server-after-make-frame-hook 'vonfry--set-font-graphic)

(use-package info :ensure nil)


D etc/nixos/modules/user/files/emacs.d/modules/visual/indent-guide/packages.el => etc/nixos/modules/user/files/emacs.d/modules/visual/indent-guide/packages.el +0 -8
@@ 1,8 0,0 @@
;;; indent-guide packages -*- lexical-binding: t -*-
;;

(use-package highlight-indent-guides
  :hook (prog-mode . highlight-indent-guides-mode)
  :custom
  (highlight-indent-guides-method 'bitmap)
  (highlight-indent-guides-responsive 'top))

R etc/nixos/modules/user/files/emacs.d/modules/visual/indent-guide/config.el => etc/nixos/modules/user/files/emacs.d/modules/visual/pair-guide/config.el +1 -1
@@ 1,2 1,2 @@
;;; indent-guide config -*- lexical-binding: t -*-
;;; pair-guide config -*- lexical-binding: t -*-
;;

R etc/nixos/modules/user/files/emacs.d/modules/visual/indent-guide/func.el => etc/nixos/modules/user/files/emacs.d/modules/visual/pair-guide/func.el +1 -1
@@ 1,2 1,2 @@
;;; indent-guide func -*- lexical-binding: t -*-
;;; pair-guide func -*- lexical-binding: t -*-
;;

A etc/nixos/modules/user/files/emacs.d/modules/visual/pair-guide/packages.el => etc/nixos/modules/user/files/emacs.d/modules/visual/pair-guide/packages.el +7 -0
@@ 0,0 1,7 @@
;;; pair-guide packages -*- lexical-binding: t -*-
;;

(use-package pair-guide
  :no-require t
  :custom
  (electric-pair-mode t))

M etc/nixos/modules/user/misc.nix => etc/nixos/modules/user/misc.nix +14 -20
@@ 8,32 8,26 @@ let
  hasCloud = sVar ? "CLOUD_DIR";
  inherit (sVar) DOTFILES_DIR CLOUD_DIR;

  syncModules = with pkgs; writeScriptBin "nixos-sync-modules" ''
    #!/usr/bin/env bash
    doas rsync --delete -auPL ${DOTFILES_DIR}/etc/nixos/modules/ /etc/nixos/modules/
  '';

  syncLocal = with pkgs; writeScriptBin "nixos-sync-local" ''
  syncLocal = with pkgs; writeScriptBin "fryos-sync" ''
    #!/usr/bin/env bash
    ${optionalString hasCloud ''
      doas rsync -auPL ${CLOUD_DIR}/dotfiles/etc/nixos/local/ /etc/nixos/local/
      doas rsync -auPL ${CLOUD_DIR}/dotfiles/config/nixpkgs/home/local/ /etc/nixos/local/vonfry
    ''}
  '';

  syncFlake = with pkgs; writeScriptBin "nixos-sync-flake" ''
    #!/usr/bin/env bash
    doas rsync -auPL ${DOTFILES_DIR}/etc/nixos/flake.* /etc/nixos/
  '';
      ${pkgs.rsync}/bin/rsync -auPL \
        ${CLOUD_DIR}/dotfiles/etc/nixos/local/ \
        ${DOTFILES_DIR}/etc/nixos/local/
      ${pkgs.rsync}/bin/rsync -auPL \
        ${CLOUD_DIR}/dotfiles/config/nixpkgs/home/local/ \
        ${DOTFILES_DIR}/etc/nixos/local/vonfry
      ''}
    '';

  syncNixOS = with pkgs; writeScriptBin "nixos-sync" ''
    rebuildOS = with pkgs; writeScriptBin "fryos-rebuild" ''
    #!/usr/bin/env bash
    ${syncModules}/bin/nixos-sync-modules
    ${syncLocal}/bin/nixos-sync-local
    ${syncFlake}/bin/nixos-sync-flake
    ${pkgs.nixos-rebuild}/bin/nixos-rebuild --flake \
      "path:${DOTFILES_DIR}/etc/nixos#vonfry"       \
      "$@"
  '';
in {
  config = mkIf cfg.enable {
    home.packages = [ syncNixOS syncModules syncLocal syncFlake ];
    home.packages = [ syncLocal rebuildOS ];
  };
}

M etc/nixos/modules/user/x.nix => etc/nixos/modules/user/x.nix +11 -0
@@ 10,6 10,16 @@ let
  bgFile = "${homeDirectory}/.background-image";

  defaultBgFile = pkgs.vonfryPackages.desktopBackground.outPath;

  deployFcitx5Rime = with pkgs; writeScriptBin "fcitx5-rime-deploy" ''
    #!/usr/bin/env bash
    dbus-send --dest='org.fcitx.Fcitx5' \
                --type=method_call \
                '/controller' \
                'org.fcitx.Fcitx.Controller1.SetConfig' \
                string:"fcitx://config/addon/rime/deploy" \
                variant:string:""
  '';
in {
  options.vonfry.x.bgFile = mkOption {
    default = defaultBgFile;


@@ 188,6 198,7 @@ in {
        source-han-sans-simplified-chinese
        source-han-serif-simplified-chinese
        font-awesome
        deployFcitx5Rime
      ];
    };
  };

D setup/default.sh => setup/default.sh +0 -30
@@ 1,30 0,0 @@
#!/bin/sh

function echo_warn() { echo -e "\n\033[0;31m $@\n"; echo -e "\033[0m" }
function echo_info() { echo -e "\n\033[0;36m $@\n"; echo -e "\033[0m" }
function echo_note() { echo -e "\n\033[0m $@\n";    echo -e "\033[0m" }

export current_dir=$(pwd)
export script_dir=$( cd "$( dirname "$0" )/.." && pwd )
echo_info "dir: $script_dir"
echo_info "System: $(uname)"

mkdir -p ~/.cache
mkdir -p ~/.local/bin

runscript="$SHELL"
$runscript $script_dir/setup/os/default.sh

# alert
echo "
========
This setup has been done. But there are something not installed.
========\n
"

# unset var and function
unset -f echo_warn
unset -f echo_info
unset -f echo_note
unset script_dir
unset runscript

D setup/os/default.sh => setup/os/default.sh +0 -20
@@ 1,20 0,0 @@
echo_info "* system"
case "$(unname)" in
    "Linux")
        $runscript /etc/os-release
        doas ln -f -s $script_dir/etc/issue /etc/issue
        case "$(ID)" in
            "nixos")
                $runscript $script_dir/setup/os/nixos.sh
                ;;
            "*")
                echo_warn " ! The linux release is not supported."
                exit 1
                ;;
        esac
        ;;
    "*")
        echo_warn " ! The os is not supported."
        exit 1
        ;;
esac

D setup/os/nixos.sh => setup/os/nixos.sh +0 -13
@@ 1,13 0,0 @@
echo_info "* system packages: Nix"
doas nixos-generate-config
doas tar -cf /etc/nixos.bak.tar /etc/nixos
doas mkdir -p /etc/nixos/local
doas rsync -auP $script_dir/etc/nixos/modules/ /etc/nixos/modules/
doas rsync -auP $script_dir/etc/nixos/configuration.nix.example /etc/nixos/configuration.nix
doas rsync -auP $script_dir/etc/nixos/flake /etc/nixos/
echo_info "--- set some local configuration"
echo_info "--- please set some local files for home-manager or configuration."
read

doas nixos-rebuild switch --flake "/etc/nixos"
echo_info "-- Run fcitx-configtool to config."

D setup/readme.org => setup/readme.org +0 -24
@@ 1,24 0,0 @@
* Setup
  These scripts are used to setup system, but please do not run it directly,
  because these scripts are not tested well, which are just as references.

** Step
   1. prepare cloud files and dotfiles

*** OS
**** NixOS
     1. copy nixos-config
     2. add & update nix-channel
     3. copy example files in nixos-config
     4. set some necussary local files.
     5. nixos-rebuild

*** User files
    1. install nix
    2. add & update nix-channel (not necessary if you are using nixos)
    3. install home-manager
    4. use home-manager to manage them


** nix-channel
   see [[file:~/Vonfry-论极语易/self/program/dotfiles/config/nix/channels][channels]]