Giter Club home page Giter Club logo

nix-config's Introduction

home-manager for macos

工具链

nix

home-manager

修改配置

注意 jeakin 是我的用户名,需要替换 home 脚本内的

#自己的用户名和路径
home.username = "jeakin";
home.homeDirectory = "/Users/jeakin";

应用配置

# 初次使用
nix run nixpkgs#home-manager switch -- --flake .#jeakin
# 安装完 home-manager 以后
home-manager switch --flake .#jeakin

常用操作

回滚

  1. Run home-manager generations to determine which generation you wish to rollback to:

    $ home-manager generations
    2018-01-04 11:56 : id 765 -> /nix/store/kahm1rxk77mnvd2l8pfvd4jkkffk5ijk-home-manager-generation
    2018-01-03 10:29 : id 764 -> /nix/store/2wsmsliqr5yynqkdyjzb1y57pr5q2lsj-home-manager-generation
    2018-01-01 12:21 : id 763 -> /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
    2017-12-29 21:03 : id 762 -> /nix/store/6c0k1r03fxckql4vgqcn9ccb616ynb94-home-manager-generation
    2017-12-25 18:51 : id 761 -> /nix/store/czc5y6vi1rvnkfv83cs3rn84jarcgsgh-home-manager-generation
    …
  2. Copy the Nix store path of the generation you chose, e.g.,

    /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation

    for generation 763.

  3. Run the activate script inside the copied store path:

    $ /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation/activate
    Starting home manager activation
    
  4. 清理 generations

    home-manager expire-generations '-30 minutes'
    nix-collect-garbage

nix-env

# 包管理
nix-env -qa <name>  # 查询包
nix-env -i <name>   # 安装包
nix-env -e <name>   # 移除包
nix-env -u <name>   # 升级包
nix-env -u          # 升级所有包

# 用户profile版本管理
nix-env --list-generations     # 列出所有版本
nix-env --switch-generation x  # 选择某个版本
nix-env --rollback             # 回退倒上一个版本

# 垃圾回收
nix-env --delete-generations [+5|14d|old]  # 删除旧profile版本
nix-store --gc          # 垃圾回收,引用计数源头在 /nix/var/nix/gcroots
nix-collect-garbage -d  # 删除所有旧版本并执行一次垃圾回收

参考文档:

  1. 使用文档: https://nix-community.github.io/home-manager/
  2. 配置文档: https://nix-community.github.io/home-manager/options.html
  3. 参考文档: https://ssine.ink/posts/intro-to-nix/

nix-config's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.