mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-24 08:58:26 +02:00
feat: upgrade to nixos-23.11
This commit is contained in:
10
README.md
10
README.md
@@ -3,16 +3,6 @@
|
||||
This repository is home to the nix code that builds my systems.
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
- vscode extensions - [nix-vscode-extensions](https://github.com/nix-community/nix-vscode-extensions)
|
||||
- secret management - [sops-nix](https://github.com/Mic92/sops-nix)
|
||||
- switch from i3wm to hyprland
|
||||
- i3wm: old and stable, only support X11
|
||||
- sway: compatible with i3wm, support Wayland. do not support Nvidia GPU officially.
|
||||
- [hyprland](https://wiki.hyprland.org/Nix/Hyprland-on-NixOS/): project starts from 2022, support Wayland, envolving fast, good looking, support Nvidia GPU.
|
||||
|
||||
|
||||
## Why Nix?
|
||||
|
||||
Nix allows for easy to manage, collaborative, reproducible deployments. This means that once something is setup and configured once, it works forever. If someone else shares their configuration, anyone can make use of it.
|
||||
|
||||
87
flake.lock
generated
87
flake.lock
generated
@@ -1,33 +1,18 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"catppuccin-bat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"lastModified": 1668065083,
|
||||
"narHash": "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=",
|
||||
"owner": "catppuccin",
|
||||
"repo": "bat",
|
||||
"rev": "ba4d16880d63e656acced2b7d4e034e4a93f74b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "catppuccin",
|
||||
"repo": "bat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
@@ -38,80 +23,44 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682176386,
|
||||
"narHash": "sha256-xwYjQ8PjfdHlggi8Dq0PXWby/1oXegSUuNuBvoTcnpA=",
|
||||
"lastModified": 1700814205,
|
||||
"narHash": "sha256-lWqDPKHRbQfi+zNIivf031BUeyciVOtwCwTjyrhDB5g=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "6169690ae38175295605d521bd778d999fbd85cd",
|
||||
"rev": "aeb2232d7a32530d3448318790534d196bf9427a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-23.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-vscode-extensions": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683076311,
|
||||
"narHash": "sha256-xGvR07+fR5g/89oVEQieKG/ZveGHZZyhxXcRouW0WCk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-vscode-extensions",
|
||||
"rev": "70d48e0c7eafdbcdaa9dac6c17f46a88872f7285",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-vscode-extensions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1675763311,
|
||||
"narHash": "sha256-bz0Q2H3mxsF1CUfk26Sl9Uzi8/HFjGFD/moZHz1HebU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fab09085df1b60d6a0870c8a89ce26d5a4a708c2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681920287,
|
||||
"narHash": "sha256-+/d6XQQfhhXVfqfLROJoqj3TuG38CAeoT6jO1g9r1k0=",
|
||||
"lastModified": 1701952659,
|
||||
"narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "645bc49f34fa8eff95479f0345ff57e55b53437e",
|
||||
"rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"catppuccin-bat": "catppuccin-bat",
|
||||
"home-manager": "home-manager",
|
||||
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
||||
|
||||
10
flake.nix
10
flake.nix
@@ -21,18 +21,20 @@
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
home-manager.url = "github:nix-community/home-manager/release-23.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
||||
catppuccin-bat = {
|
||||
url = "github:catppuccin/bat";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-vscode-extensions,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations = {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
stateVersion = "22.11";
|
||||
stateVersion = "23.11";
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{pkgs, ...}: {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
catppuccin-bat,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# archives
|
||||
zip
|
||||
@@ -7,7 +12,7 @@
|
||||
|
||||
# utils
|
||||
ripgrep
|
||||
yq-go # https://github.com/mikefarah/yq
|
||||
yq-go # https://github.com/mikefarah/yq
|
||||
htop
|
||||
|
||||
# misc
|
||||
@@ -26,7 +31,6 @@
|
||||
docker-compose
|
||||
kubectl
|
||||
|
||||
|
||||
nodejs
|
||||
nodePackages.npm
|
||||
nodePackages.pnpm
|
||||
@@ -50,19 +54,20 @@
|
||||
enable = true;
|
||||
config = {
|
||||
pager = "less -FR";
|
||||
theme = "Catppuccin-mocha";
|
||||
theme = "catppuccin-mocha";
|
||||
};
|
||||
themes = {
|
||||
Catppuccin-mocha = builtins.readFile (pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme";
|
||||
hash = "sha256-qMQNJGZImmjrqzy7IiEkY5IhvPAMZpq0W6skLLsng/w=";
|
||||
});
|
||||
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
|
||||
catppuccin-mocha = {
|
||||
src = catppuccin-bat;
|
||||
file = "Catppuccin-mocha.tmTheme";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
btop.enable = true; # replacement of htop/nmon
|
||||
exa.enable = true; # A modern replacement for ‘ls’
|
||||
jq.enable = true; # A lightweight and flexible command-line JSON processor
|
||||
btop.enable = true; # replacement of htop/nmon
|
||||
eza.enable = true; # A modern replacement for ‘ls’
|
||||
jq.enable = true; # A lightweight and flexible command-line JSON processor
|
||||
ssh.enable = true;
|
||||
aria2.enable = true;
|
||||
|
||||
@@ -83,4 +88,4 @@
|
||||
# auto mount usb drives
|
||||
udiskie.enable = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./browsers.nix
|
||||
./common.nix
|
||||
./git.nix
|
||||
./media.nix
|
||||
./vscode.nix
|
||||
./xdg.nix
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
home-manager,
|
||||
nix-vscode-extensions,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
|
||||
# if use vscode in wayland, uncomment this line
|
||||
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
userSettings = {
|
||||
"editor.renderWhitespace" = "all";
|
||||
"files.autoSave" = "onFocusChange";
|
||||
"editor.rulers" = [ 80 120 ];
|
||||
"telemetry.enableTelemetry" = false;
|
||||
"telemetry.enableCrashReporter" = false;
|
||||
"editor.tabSize" = 2;
|
||||
"files.exclude" = { "**/node_modules/**" = true; };
|
||||
"editor.formatOnSave" = false;
|
||||
"breadcrumbs.enabled" = true;
|
||||
"editor.useTabStops" = false;
|
||||
"editor.fontFamily" = "JetBrainsMono Nerd Font";
|
||||
"editor.fontSize" = 16;
|
||||
"editor.fontLigatures" = true;
|
||||
"editor.lineHeight" = 20;
|
||||
"workbench.fontAliasing" = "antialiased";
|
||||
"files.trimTrailingWhitespace" = true;
|
||||
"editor.minimap.enabled" = false;
|
||||
"workbench.editor.enablePreview" = false;
|
||||
"terminal.integrated.fontFamily" = "JetBrainsMono Nerd Font";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
config.packageOverrides = pkgs: {
|
||||
vscode = pkgs.vscode-with-extensions.override {
|
||||
# pkgs.vscode-extensions 里包含的 vscode 太少了
|
||||
# 必须使用社区的 <https://github.com/nix-community/nix-vscode-extensions> 才能安装更多插件
|
||||
vscodeExtensions = with nix-vscode-extensions.extensions; [
|
||||
aaron-bond.better-comments
|
||||
anweber.vscode-httpyac
|
||||
arrterian.nix-env-selector
|
||||
bierner.markdown-mermaid
|
||||
christian-kohler.path-intellisense
|
||||
cschlosser.doxdocgen
|
||||
DanishSarwar.reverse-search
|
||||
eamodio.gitlens
|
||||
esbenp.prettier-vscode
|
||||
espressif.esp-idf-extension
|
||||
fabiospampinato.vscode-diff
|
||||
GitHub.copilot
|
||||
golang.go
|
||||
hashicorp.terraform
|
||||
janisdd.vscode-edit-csv
|
||||
jebbs.plantuml
|
||||
jeff-hykin.better-cpp-syntax
|
||||
jnoortheen.nix-ide
|
||||
JuanBlanco.solidity
|
||||
k--kato.intellij-idea-keybindings
|
||||
llvm-vs-code-extensions.vscode-clangd
|
||||
mcu-debug.debug-tracker-vscode
|
||||
mcu-debug.memory-view
|
||||
mcu-debug.rtos-views
|
||||
mikestead.dotenv
|
||||
mkhl.direnv
|
||||
ms-azuretools.vscode-docker
|
||||
ms-dotnettools.vscode-dotnet-runtime
|
||||
ms-kubernetes-tools.vscode-kubernetes-tools
|
||||
ms-python.isort
|
||||
ms-python.python
|
||||
ms-python.vscode-pylance
|
||||
ms-toolsai.jupyter
|
||||
ms-toolsai.jupyter-keymap
|
||||
ms-toolsai.jupyter-renderers
|
||||
ms-toolsai.vscode-jupyter-cell-tags
|
||||
ms-toolsai.vscode-jupyter-slideshow
|
||||
ms-vscode-remote.remote-containers
|
||||
ms-vscode-remote.remote-ssh
|
||||
ms-vscode-remote.remote-ssh-edit
|
||||
ms-vscode-remote.vscode-remote-extensionpack
|
||||
ms-vscode.cmake-tools
|
||||
ms-vscode.cpptools
|
||||
ms-vscode.cpptools-extension-pack
|
||||
ms-vscode.cpptools-themes
|
||||
ms-vscode.remote-explorer
|
||||
ms-vscode.remote-server
|
||||
pinage404.nix-extension-pack
|
||||
platformio.platformio-ide
|
||||
pomdtr.excalidraw-editor
|
||||
redhat.java
|
||||
redhat.vscode-commons
|
||||
redhat.vscode-xml
|
||||
redhat.vscode-yaml
|
||||
rust-lang.rust-analyzer
|
||||
shd101wyy.markdown-preview-enhanced
|
||||
sumneko.lua
|
||||
tamasfe.even-better-toml
|
||||
timonwong.shellcheck
|
||||
tintinweb.graphviz-interactive-preview
|
||||
tintinweb.solidity-visual-auditor
|
||||
tintinweb.vscode-inline-bookmarks
|
||||
tintinweb.vscode-solidity-flattener
|
||||
tintinweb.vscode-solidity-language
|
||||
twxs.cmake
|
||||
vadimcn.vscode-lldb
|
||||
VisualStudioExptTeam.intellicode-api-usage-examples
|
||||
VisualStudioExptTeam.vscodeintellicode
|
||||
vscjava.vscode-java-debug
|
||||
vscjava.vscode-java-pack
|
||||
vscjava.vscode-java-test
|
||||
vscjava.vscode-maven
|
||||
vscode-icons-team.vscode-icons
|
||||
WakaTime.vscode-wakatime
|
||||
yzhang.markdown-all-in-one
|
||||
zxh404.vscode-proto3
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
pkgs.vscode;
|
||||
};
|
||||
}
|
||||
@@ -48,7 +48,7 @@
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "22.11"; # Did you read the comment?
|
||||
system.stateVersion = "23.11"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "22.11"; # Did you read the comment?
|
||||
system.stateVersion = "23.11"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,21 +5,20 @@
|
||||
}: let
|
||||
username = "ryan";
|
||||
in {
|
||||
|
||||
# ============================= User related =============================
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.ryan = {
|
||||
isNormalUser = true;
|
||||
description = "ryan";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
extraGroups = ["networkmanager" "wheel"];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj admin@ryan-MBP"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj admin@ryan-MBP"
|
||||
];
|
||||
};
|
||||
# given the users in this list the right to specify additional substituters via:
|
||||
# 1. `nixConfig.substituers` in `flake.nix`
|
||||
# 2. command line args `--options substituers http://xxx`
|
||||
# given the users in this list the right to specify additional substituters via:
|
||||
# 1. `nixConfig.substituers` in `flake.nix`
|
||||
# 2. command line args `--options substituers http://xxx`
|
||||
nix.settings.trusted-users = [username];
|
||||
|
||||
# customise /etc/nix/nix.conf declaratively via `nix.settings`
|
||||
@@ -51,7 +50,7 @@ in {
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = lib.mkDefault false;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
@@ -75,7 +74,7 @@ in {
|
||||
services.printing.enable = true;
|
||||
|
||||
fonts = {
|
||||
fonts = with pkgs; [
|
||||
packages = with pkgs; [
|
||||
# icon fonts
|
||||
material-design-icons
|
||||
|
||||
@@ -89,7 +88,7 @@ in {
|
||||
];
|
||||
|
||||
# use fonts specified by user rather than default ones
|
||||
enableDefaultFonts = false;
|
||||
enableDefaultPackages = false;
|
||||
|
||||
# user defined fonts
|
||||
# the reason there's Noto Color Emoji everywhere is to override DejaVu's
|
||||
|
||||
Reference in New Issue
Block a user