Skip to content

Commit

Permalink
refactor!: refactor nixos and home-manager config!
Browse files Browse the repository at this point in the history
- これまでschemeとしていたものをschemesとしてより細かく制御できるようにした
- appsについてプリセットを用意
- shellはプリセットに含めていない
    - nix-portalとの併用時にホスト環境の.bashrcと干渉する可能性があるため
- WM関係もプリセットに含めていない
    - NixOS/non-NixOSに限らずGNOMEやKDE環境との干渉の可能性があるため

BREAKING CHANGE
  • Loading branch information
misumisumi committed Oct 7, 2024
1 parent 315a9c0 commit cd87488
Show file tree
Hide file tree
Showing 212 changed files with 990 additions and 896 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Build check
if: steps.change.outputs.nix == 'true'
run: nix build --no-link ".#nixosConfigurations.liveimg-gui-qtile.config.system.build.toplevel"
run: nix build --no-link ".#nixosConfigurations.zephyrus.config.system.build.toplevel"

post-workflow:
uses: ./.github/workflows/agent-of-me.yml
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.direnv
!env
7 changes: 4 additions & 3 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ extend-exclude = [
"sops/**",
"flake.lock",
"CHANGELOG.md",
"apps/user/core/ranger/default.nix",
"apps/user/core/ranger/config/*",
"apps/user/full/ime/skk-config/libskk/rom-kana/default.json",
"apps/user/cli/develop/ranger/default.nix",
"apps/user/cli/develop/ranger/config/*",
"apps/user/desktop/env/core/ime/skk/fcitx5/**",
"apps/user/desktop/env/core/ime/skk/libskk/**",
]
67 changes: 46 additions & 21 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,30 @@ nix の世界へようこそ!!
- スタンドアローン[home-manager](https://github.com/nix-community/home-manager)のサポート
- 複数カラースキームのサポート

```
nixos-desktop-config
├── apps # settings for installing apps
│   ├── system # system wide application configurations (NixOS options)
│   └── user # user wide application configurations (home-manager options)
│   ├── core # common installing apps
│   ├── full # include GUI
│   ├── medium # include latex
│   └── small # include neovim and useful apps
├── machines # settings for each my machines
├── modules # my custom nixosModules and homeManagerModules
├── patches # patch of package
├── settings # common system settings
│   ├── system # system wide
│   └── user # user wide
├── sops # secrets
└── users # settings for each users
```nixos-desktop-config
├── apps
│ ├── color-theme # color themes
│ ├── system # system wide application configurations (NixOS options)
│ └── user # user wide application configurations (home-manager options)
│ ├── cli # settings of cli app
│ ├── core # apps required for the minimum user environment
│ ├── desktop # settings of desktop app
│ ├── presets # environment presets
│ └── shell # bash and zsh settings
├── machines # settings for each my machines
├── modules # my custom nixosModules and homeManagerModules
├── patches # patch of package
├── settings # common system settings
│   ├── system # system wide
│   └── user # user wide
├── sops # secrets
└── users # settings for each users
```

## Module Usage

詳細は[./machines/default.nix](./machines/home-manager.nix)または[./machines/home-manager.nix](./machines/home-manager.nix)を参照

```nix
{
inputs = {
Expand All @@ -43,6 +46,24 @@ nixos-desktop-config
# ...
# import nixosModules by inputs.dotfiles.nixosModules.<module-name>
# import homeManageModules by inputs.dotfiles.homeManagerModules.<module-name>
outputs = inputs@{...}: {
homeConfigurations = {
myenv = inputs.home-manager.lib.homeManagerConfiguration {
...
extraSpecialArgs = {
hostname = "nixos";
user = "hogehoge";
homeDirectory = "";
schemes = [
"presets/large"
];
colorTheme = "tokyonight-moon"
inherit inputs;
};
...
};
};
};
}
```

Expand Down Expand Up @@ -77,10 +98,10 @@ echo <password> > /tmp/luks.key

# 2. Edit `device` in machines/liveimg/filesystem

# 3. Check flake name (liveimg-cui-* or liveimg-gui-*, *-iso is for ISO creation, not use here)
# 3. Check flake name (liveimg-cli-* or liveimg-<DE>-*, *-iso is for ISO creation, not use here)

# 4. Format disk and mount to `/mnt`
# "liveimg-cui" for CUI env, "liveimg-gui" for GUI env
# "liveimg-cli" for CLI env, "liveimg-<DE>" for Desktop Environment
nix run nixpkgs#disko -- -m disko --flake "github:misumisumi/nixos-desktop-config#<flake-name>"

# Install NixOS to `/mnt`
Expand All @@ -90,7 +111,7 @@ nixos-install --no-root-passwd --flake "github:misumisumi/nixos-desktop-config#<
#### Create LiveCD

```sh
# 1. Check flake name (liveimg-iso-*)
# 1. Check flake name (liveimg-*-iso)
# 2. Create .iso file (build takes a long time)
nix run nixpkgs#nixos-generators -- --format iso -o result --flake github:misumisumi/nixos-desktop-config#<flake-name>

Expand All @@ -108,7 +129,11 @@ dd if=result/iso/*.iso of=/dev/sdX status=progress

```sh

home-manager switch --flake github:misumisumi/nixos-desktop-config#<core or small or medium or full>
# Flace name is <preset> or <preset>-<shell>
# For <preset>, `small` is CLI env, `medium` is CLI with texlive, and `huge` is GUI env.
# <shell> is managed by home-manager, so choose something other than the user's default
# no `-<shell>` does not include shell.
home-manager switch --flake github:misumisumi/nixos-desktop-config#small-zsh
```

## Appendix
Expand Down
48 changes: 28 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,30 @@ This is [misumisumi](https://github.com/misumisumi)'s NixOS and home-manager con
- Support selecting color-scheme
- Providing my custom modules

```
nixos-desktop-config
├── apps # settings for installing apps
│   ├── system # system wide application configurations (NixOS options)
│   └── user # user wide application configurations (home-manager options)
│   ├── core # common installing apps
│   ├── full # include GUI
│   ├── medium # include latex
│   └── small # include neovim and useful apps
├── machines # settings for each my machines
├── modules # my custom nixosModules and homeManagerModules
├── patches # patch of package
├── settings # common system settings
│   ├── system # system wide
│   └── user # user wide
├── sops # secrets
└── users # settings for each users
```nixos-desktop-config
├── apps
│ ├── color-theme # color themes
│ ├── system # system wide application configurations (NixOS options)
│ └── user # user wide application configurations (home-manager options)
│ ├── cli # settings of cli app
│ ├── core # apps required for the minimum user environment
│ ├── desktop # settings of desktop app
│ ├── presets # environment presets
│ └── shell # bash and zsh settings
├── machines # settings for each my machines
├── modules # my custom nixosModules and homeManagerModules
├── patches # patch of package
├── settings # common system settings
│   ├── system # system wide
│   └── user # user wide
├── sops # secrets
└── users # settings for each users
```

## Module Usage

See details on [./machines/default.nix](./machines/home-manager.nix) or [./machines/home-manager.nix](./machines/home-manager.nix)

```nix
{
inputs = {
Expand Down Expand Up @@ -78,10 +81,10 @@ echo <password> > /tmp/luks.key

# 2. Edit `device` in machines/liveimg/filesystem

# 3. Check flake name (liveimg-cui-* or liveimg-gui-*, *-iso is for ISO creation, not use here)
# 3. Check flake name (liveimg-cli-* or liveimg-<DE>-*, *-iso is for ISO creation, not use here)

# 4. Format disk and mount to `/mnt`
# "liveimg-cui" for CUI env, "liveimg-gui" for GUI env
# "liveimg-cli" for CLI env, "liveimg-<DE>" for Desktop Environment
nix run nixpkgs#disko -- -m disko --flake "github:misumisumi/nixos-desktop-config#<flake-name>"

# Install NixOS to `/mnt`
Expand All @@ -108,7 +111,12 @@ dd if=result/iso/*.iso of=/dev/sdX status=progress
2. Switch to config

```sh
home-manager switch --flake github:misumisumi/nixos-desktop-config#<core or small or medium or full>

# Flace name is <preset> or <preset>-<shell>
# For <preset>, `small` is CLI env, `medium` is CLI with texlive, and `huge` is GUI env.
# <shell> is managed by home-manager, so choose something other than the user's default
# no `-<shell>` does not include shell.
home-manager switch --flake github:misumisumi/nixos-desktop-config#small-zsh
```

## Appendix
Expand Down
File renamed without changes.
93 changes: 93 additions & 0 deletions apps/color-theme/user/catppuccin/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
pkgs,
lib,
inputs,
config,
colorTheme ? "catppuccin-macchiato",
...
}:
let
flavor = builtins.replaceStrings [ "catppuccin-" ] [ "" ] colorTheme;
in
{
imports = [
./rofi.nix
];
catppuccin = {
inherit flavor;
pointerCursor.enable = true;
};
programs = {
alacritty.catppuccin.enable = true;
bat.catppuccin.enable = true;
btop.catppuccin.enable = true;
git.delta.catppuccin.enable = true;
kitty.catppuccin.enable = true;
obs-studio.catppuccin.enable = true;
starship = {
catppuccin.enable = true;
settings = {
palettes."catppuccin_${flavor}" =
let
palette =
(lib.importTOML "${config.catppuccin.sources.starship}/themes/${flavor}.toml")
.palettes."catppuccin_${flavor}";
in
{
bg = palette.base;
terminal_dark = palette.surface0;
fg = palette.text;
magenta = palette.maroon;
cyan = palette.teal;
};
};
};
yazi.catppuccin.enable = true;
zathura.catppuccin.enable = true;
spicetify =
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in
{
theme = spicePkgs.themes.catppuccin;
colorScheme = "${flavor}";
};
};
services = {
dunst.catppuccin.enable = true;
};
i18n.inputMethod.fcitx5.addons = with pkgs; [ fcitx5-catppuccin ];
gtk = {
theme =
let
shade = if flavor == "latte" then "Light" else "Dark";
in
{
name = "Catppuccin-GTK-${shade}";
package = pkgs.magnetic-catppuccin-gtk.override { shade = lib.toLower shade; };
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
};
xdg.configFile = {
"wezterm/color-scheme.lua" = {
inherit (config.programs.wezterm) enable;
source = ./wezterm/${flavor}.lua;
};
"qtile/my_modules/colorset.py" = {
inherit (config.xsession.windowManager.qtile) enable;
source = ./qtile/${flavor}.py;
};
"fcitx5/conf/classicui.conf" = {
enable = config.i18n.inputMethod.enabled == "fcitx5";
text = lib.generators.toINIWithGlobalSection { } {
globalSection = {
Theme = "catppuccin-${flavor}-blue";
DarkTHeme = "catppuccin-${flavor}-blue";
};
};
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ let
in
{
xdg.configFile = {
"rofi/themes/catppuccin-${flavor}.rasi".source = "${
pkgs.catppuccin.override { variant = "${flavor}"; }
}/rofi/catppuccin-${flavor}.rasi";
"rofi/themes/catppuccin-custom.rasi".source = catppuccin-custom;
"rofi/themes/catppuccin-${flavor}.rasi" = {
inherit (config.programs.rofi) enable;
source = "${pkgs.catppuccin.override { variant = "${flavor}"; }}/rofi/catppuccin-${flavor}.rasi";
};
"rofi/themes/catppuccin-custom.rasi" = {
inherit (config.programs.rofi) enable;
source = catppuccin-custom;
};
};
programs.rofi.theme = "catppuccin-custom";
}
File renamed without changes.
73 changes: 73 additions & 0 deletions apps/color-theme/user/nord/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
lib,
pkgs,
inputs,
config,
...
}:
{
imports = [
./alacritty.nix
./dunstrc.nix
./kitty.nix
./rofi.nix
./lazygit.nix
./zathura.nix
];
programs = {
starship.settings = lib.importTOML ./starship/nord.toml;
yazi.theme = lib.importTOML ./yazi/nord.toml;
bat.config.theme = "nord";
btop.settings.color_theme = "nord";
spicetify =
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in
{
theme = spicePkgs.themes.nord;
colorScheme = "Nord";
};
};
xdg.configFile = {
"fcitx5/conf/classicui.conf" = {
enable = config.i18n.inputMethod.enabled == "fcitx5";
text = lib.generators.toINIWithGlobalSection { } {
globalSection = {
Theme = "Nord-Dark";
DarkTHeme = "Nord-Dark";
};
};
};
"bat/Nord.tmTheme" = {
inherit (config.programs.bat) enable;
source = ./sublime/Nord.tmTheme;
};
"qtile/my_modules/colorset.py" = {
inherit (config.xsession.windowManager.qtile) enable;
source = ./qtile/nord.py;
};
"wezterm/color-scheme.lua" = {
inherit (config.programs.wezterm) enable;
source = ./wezterm/nord.lua;
};
"yazi/Nord.tmTheme" = {
inherit (config.programs.yazi) enable;
source = ./sublime/Nord.tmTheme;
};
};
i18n.inputMethod.fcitx5.addons = with pkgs; [ fcitx5-nord ];
gtk = {
theme = {
name = "Nordic-darker";
package = pkgs.nordic;
};
iconTheme = {
name = "Nordzy-dark";
package = pkgs.nordzy-icon-theme;
};
};
home.pointerCursor = {
name = "Nordzy-cursors";
package = pkgs.nordzy-cursor-theme;
};
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cd87488

Please sign in to comment.