wip
This commit is contained in:
parent
b559348501
commit
53d0bdf0ce
103
README.md
Normal file
103
README.md
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
# NixOS Configuration
|
||||||
|
|
||||||
|
This repository contains my personal NixOS configuration, structured in a pyramidal way for easy management and reuse.
|
||||||
|
|
||||||
|
## Structure
|
||||||
|
|
||||||
|
### System Configuration
|
||||||
|
|
||||||
|
The system configuration is organized in layers:
|
||||||
|
|
||||||
|
1. **Base** (`system/base/default.nix`): Common configuration for all machines
|
||||||
|
2. **Desktop** (`system/desktop/default.nix`): Configuration specific to desktop environments
|
||||||
|
3. **Server** (`system/server/default.nix`): Configuration specific to server environments
|
||||||
|
4. **Machine-specific** (`machines/<machine>/default.nix`): Configuration specific to individual machines
|
||||||
|
|
||||||
|
### Home Configuration
|
||||||
|
|
||||||
|
The home configuration follows a similar structure:
|
||||||
|
|
||||||
|
1. **Base** (`home/base/default.nix`): Common home configuration for all environments
|
||||||
|
2. **Desktop** (`home/desktop/default.nix`): Home configuration specific to desktop environments
|
||||||
|
3. **Server** (`home/server/default.nix`): Home configuration specific to server environments
|
||||||
|
|
||||||
|
## Available Configurations
|
||||||
|
|
||||||
|
This repository includes configurations for the following machines:
|
||||||
|
|
||||||
|
1. **nixos** (VM): A virtual machine configuration for testing
|
||||||
|
2. **desktop-pc**: A physical desktop PC with NVIDIA GPU
|
||||||
|
3. **home-server**: A home server with Samba and Jellyfin services
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To build and switch to a specific configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# For the VM
|
||||||
|
sudo nixos-rebuild switch --flake .#nixos
|
||||||
|
|
||||||
|
# For the desktop PC
|
||||||
|
sudo nixos-rebuild switch --flake .#desktop-pc
|
||||||
|
|
||||||
|
# For the home server
|
||||||
|
sudo nixos-rebuild switch --flake .#home-server
|
||||||
|
```
|
||||||
|
|
||||||
|
### Helper Script
|
||||||
|
|
||||||
|
A helper script is provided to make switching between configurations easier:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Switch to the VM configuration (default)
|
||||||
|
./switch.sh
|
||||||
|
|
||||||
|
# Switch to the desktop PC configuration
|
||||||
|
./switch.sh desktop-pc
|
||||||
|
|
||||||
|
# Switch to the home server configuration
|
||||||
|
./switch.sh home-server
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a New Machine
|
||||||
|
|
||||||
|
To add a new machine:
|
||||||
|
|
||||||
|
1. Create a new directory in `machines/` with the machine name
|
||||||
|
2. Create a `default.nix` file with machine-specific configuration
|
||||||
|
3. Copy the hardware configuration to `machines/<machine>/hardware-configuration.nix`
|
||||||
|
4. Update `flake.nix` to include the new machine
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# In flake.nix
|
||||||
|
new-machine = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = inputs;
|
||||||
|
modules = [
|
||||||
|
# Base system configuration
|
||||||
|
./system/base
|
||||||
|
|
||||||
|
# Desktop or server configuration
|
||||||
|
./system/desktop # or ./system/server
|
||||||
|
|
||||||
|
# Machine-specific configuration
|
||||||
|
./machines/new-machine
|
||||||
|
|
||||||
|
# Home-manager configuration
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
# ... home-manager configuration
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
- For desktop environments, enable the desktop configurations
|
||||||
|
- For server environments, enable the server configurations and disable desktop configurations
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This configuration is personal and provided as-is without any warranty.
|
18
flake.lock
generated
18
flake.lock
generated
@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730633670,
|
"lastModified": 1741579508,
|
||||||
"narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=",
|
"narHash": "sha256-skRbH+UF2ES+msEa+KWi7AQFX73S+QsGlPsyCU6XyE0=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661",
|
"rev": "744f749dd6fbc1489591ea370b95156858629cb9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -23,11 +23,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730531603,
|
"lastModified": 1741379970,
|
||||||
"narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
|
"narHash": "sha256-Wh7esNh7G24qYleLvgOSY/7HlDUzWaL/n4qzlBePpiw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
|
"rev": "36fd87baa9083f34f7f5027900b62ee6d09b1f2f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -39,11 +39,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730327045,
|
"lastModified": 1735563628,
|
||||||
"narHash": "sha256-xKel5kd1AbExymxoIfQ7pgcX6hjw9jCgbiBjiUfSVJ8=",
|
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "080166c15633801df010977d9d7474b4a6c549d7",
|
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
116
flake.nix
116
flake.nix
@ -18,25 +18,103 @@
|
|||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
|
||||||
nixosConfigurations.nixos = let
|
# Common configuration function to reduce repetition
|
||||||
username = "laurent";
|
nixosConfigurations = {
|
||||||
specialArgs = { inherit username; };
|
# VM configuration
|
||||||
in nixpkgs.lib.nixosSystem {
|
nixos = nixpkgs.lib.nixosSystem {
|
||||||
inherit specialArgs;
|
system = "x86_64-linux";
|
||||||
system = "x86_64-linux";
|
specialArgs = inputs;
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/vm
|
# Base system configuration
|
||||||
./users/${username}/nixos.nix
|
./system/base
|
||||||
|
|
||||||
home-manager.nixosModules.home-manager
|
# Desktop-specific configuration
|
||||||
{
|
./system/desktop
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
# Machine-specific configuration
|
||||||
home-manager.extraSpecialArgs = inputs // specialArgs;
|
./machines/vm
|
||||||
home-manager.users.${username} = import ./users/${username}/home.nix;
|
|
||||||
}
|
# Home-manager configuration
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
];
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = inputs;
|
||||||
|
home-manager.users.laurent = { ... }: {
|
||||||
|
imports = [
|
||||||
|
# Base home configuration
|
||||||
|
./home/base
|
||||||
|
|
||||||
|
# Desktop-specific home configuration
|
||||||
|
./home/desktop
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Desktop PC configuration
|
||||||
|
desktop-pc = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = inputs;
|
||||||
|
modules = [
|
||||||
|
# Base system configuration
|
||||||
|
./system/base
|
||||||
|
|
||||||
|
# Desktop-specific configuration
|
||||||
|
./system/desktop
|
||||||
|
|
||||||
|
# Machine-specific configuration
|
||||||
|
./machines/desktop-pc
|
||||||
|
|
||||||
|
# Home-manager configuration
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = inputs;
|
||||||
|
home-manager.users.laurent = { ... }: {
|
||||||
|
imports = [
|
||||||
|
# Base home configuration
|
||||||
|
./home/base
|
||||||
|
|
||||||
|
# Desktop-specific home configuration
|
||||||
|
./home/desktop
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Home server configuration
|
||||||
|
home-server = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = inputs;
|
||||||
|
modules = [
|
||||||
|
# Base system configuration
|
||||||
|
./system/base
|
||||||
|
|
||||||
|
# Server-specific configuration
|
||||||
|
./system/server
|
||||||
|
|
||||||
|
# Machine-specific configuration
|
||||||
|
./machines/home-server
|
||||||
|
|
||||||
|
# Home-manager configuration
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = inputs;
|
||||||
|
home-manager.users.laurent = { ... }: {
|
||||||
|
imports = [
|
||||||
|
# Base home configuration
|
||||||
|
./home/base
|
||||||
|
|
||||||
|
# Server-specific home configuration
|
||||||
|
./home/server
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
39
home/base/default.nix
Normal file
39
home/base/default.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./zsh
|
||||||
|
];
|
||||||
|
# Base home configuration for all environments
|
||||||
|
|
||||||
|
home = {
|
||||||
|
username = "laurent";
|
||||||
|
homeDirectory = "/home/laurent";
|
||||||
|
stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# Common programs for all environments
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Laurent Le Houerou";
|
||||||
|
userEmail = "laurent@lehouerou.net";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Common packages for all environments
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
btop
|
||||||
|
neovim
|
||||||
|
lazygit
|
||||||
|
eza
|
||||||
|
fzf
|
||||||
|
ripgrep
|
||||||
|
zoxide
|
||||||
|
];
|
||||||
|
}
|
64
home/base/zsh/default.nix
Normal file
64
home/base/zsh/default.nix
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
|
||||||
|
# History settings
|
||||||
|
history = {
|
||||||
|
size = 10000;
|
||||||
|
path = "$HOME/.zsh_history";
|
||||||
|
ignoreDups = true;
|
||||||
|
share = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
autosuggestion = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Shell options
|
||||||
|
initExtra = ''
|
||||||
|
# Enable vi mode
|
||||||
|
bindkey -v
|
||||||
|
|
||||||
|
# Better history search
|
||||||
|
bindkey '^R' history-incremental-search-backward
|
||||||
|
|
||||||
|
# Basic auto/tab completion
|
||||||
|
autoload -U compinit
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
zmodload zsh/complist
|
||||||
|
compinit
|
||||||
|
_comp_options+=(globdots)
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
shellAliases = {
|
||||||
|
ll = "ls -la";
|
||||||
|
".." = "cd ..";
|
||||||
|
"..." = "cd ../..";
|
||||||
|
update = "sudo nixos-rebuild switch";
|
||||||
|
vim = "nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
name = "zsh-syntax-highlighting";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "zsh-users";
|
||||||
|
repo = "zsh-syntax-highlighting";
|
||||||
|
rev = "refs/tags/0.8.0";
|
||||||
|
sha256 = "1yl8zdip1z9inp280sfa5byjbf2vqh2iazsycar987khjsi5d5w8";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.oh-my-posh = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
package = pkgs.oh-my-posh;
|
||||||
|
settings = builtins.fromJSON (builtins.readFile ./oh-my-posh/config.json);
|
||||||
|
};
|
||||||
|
}
|
185
home/base/zsh/oh-my-posh/config.json
Normal file
185
home/base/zsh/oh-my-posh/config.json
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||||
|
"palette": {
|
||||||
|
"base": "#1E1E2E",
|
||||||
|
"blue": "#89B4FA",
|
||||||
|
"crust": "#11111B",
|
||||||
|
"false": "p:red",
|
||||||
|
"flamingo": "#F2CDCD",
|
||||||
|
"green": "#A6E3A1",
|
||||||
|
"lavender": "#B4BEFE",
|
||||||
|
"mantle": "#181825",
|
||||||
|
"maroon": "#EBA0AC",
|
||||||
|
"mauve": "#CBA6F7",
|
||||||
|
"overlay0": "#6C7086",
|
||||||
|
"overlay1": "#7F849C",
|
||||||
|
"overlay2": "#9399B2",
|
||||||
|
"peach": "#FAB387",
|
||||||
|
"pink": "#F5C2E7",
|
||||||
|
"red": "#F38BA8",
|
||||||
|
"rosewater": "#F5E0DC",
|
||||||
|
"sapphire": "#74C7EC",
|
||||||
|
"sky": "#89DCEB",
|
||||||
|
"subtext0": "#A6ADC8",
|
||||||
|
"subtext1": "#BAC2DE",
|
||||||
|
"surface0": "#313244",
|
||||||
|
"surface1": "#45475A",
|
||||||
|
"surface2": "#585B70",
|
||||||
|
"teal": "#94E2D5",
|
||||||
|
"text": "#CDD6F4",
|
||||||
|
"true": "p:green",
|
||||||
|
"yellow": "#F9E2AF"
|
||||||
|
},
|
||||||
|
"transient_prompt": {
|
||||||
|
"template": "{{ .PWD }} {{ now | date \"15:04:05\" }} {{ if gt .Code 0 }}<p:false>❯</>{{ else }}<p:true>❯</>{{ end }} ",
|
||||||
|
"foreground": "p:text"
|
||||||
|
},
|
||||||
|
"console_title_template": "{{ .Shell }} in {{ .Folder }}",
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"type": "prompt",
|
||||||
|
"alignment": "left",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"style": "diamond",
|
||||||
|
"leading_diamond": "\ue0b2",
|
||||||
|
"template": " {{.Icon}} ",
|
||||||
|
"foreground": "p:text",
|
||||||
|
"background": "p:surface0",
|
||||||
|
"type": "os"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"home_icon": "~",
|
||||||
|
"style": "full"
|
||||||
|
},
|
||||||
|
"style": "powerline",
|
||||||
|
"template": " \uf07c {{ .Path }} ",
|
||||||
|
"foreground": "p:base",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "p:lavender",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"branch_icon": "\uf126 ",
|
||||||
|
"fetch_stash_count": true,
|
||||||
|
"fetch_status": true,
|
||||||
|
"fetch_upstream_icon": true
|
||||||
|
},
|
||||||
|
"style": "powerline",
|
||||||
|
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ",
|
||||||
|
"foreground": "#000000",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "#4e9a06",
|
||||||
|
"type": "git",
|
||||||
|
"background_templates": [
|
||||||
|
"{{ if or (.Working.Changed) (.Staging.Changed) }}#c4a000{{ end }}",
|
||||||
|
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}",
|
||||||
|
"{{ if gt .Ahead 0 }}#89d1dc{{ end }}",
|
||||||
|
"{{ if gt .Behind 0 }}#4e9a06{{ end }}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "prompt",
|
||||||
|
"alignment": "right",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"fetch_version": true
|
||||||
|
},
|
||||||
|
"style": "powerline",
|
||||||
|
"template": " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} \ue718 ",
|
||||||
|
"foreground": "#ffffff",
|
||||||
|
"powerline_symbol": "\ue0b2",
|
||||||
|
"background": "#689f63",
|
||||||
|
"type": "node",
|
||||||
|
"invert_powerline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"fetch_version": true
|
||||||
|
},
|
||||||
|
"style": "powerline",
|
||||||
|
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue627 ",
|
||||||
|
"foreground": "#111111",
|
||||||
|
"powerline_symbol": "\ue0b2",
|
||||||
|
"background": "#00acd7",
|
||||||
|
"type": "go",
|
||||||
|
"invert_powerline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"fetch_version": true
|
||||||
|
},
|
||||||
|
"style": "powerline",
|
||||||
|
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue624 ",
|
||||||
|
"foreground": "#111111",
|
||||||
|
"powerline_symbol": "\ue0b2",
|
||||||
|
"background": "#4063D8",
|
||||||
|
"type": "julia",
|
||||||
|
"invert_powerline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"display_mode": "files",
|
||||||
|
"fetch_virtual_env": false
|
||||||
|
},
|
||||||
|
"style": "powerline",
|
||||||
|
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue235 ",
|
||||||
|
"foreground": "#111111",
|
||||||
|
"powerline_symbol": "\ue0b2",
|
||||||
|
"background": "#FFDE57",
|
||||||
|
"type": "python",
|
||||||
|
"invert_powerline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "accordion",
|
||||||
|
"template": " \uf0ad ",
|
||||||
|
"foreground": "p:text",
|
||||||
|
"powerline_symbol": "\ue0b2",
|
||||||
|
"background": "p:yellow",
|
||||||
|
"type": "root",
|
||||||
|
"invert_powerline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"always_enabled": true
|
||||||
|
},
|
||||||
|
"style": "diamond",
|
||||||
|
"trailing_diamond": "\ue0b0",
|
||||||
|
"template": " {{ if gt .Code 0 }}{{ reason .Code }}{{ else }}\uf42e{{ end }} ",
|
||||||
|
"foreground": "p:text",
|
||||||
|
"powerline_symbol": "\ue0b2",
|
||||||
|
"background": "p:surface0",
|
||||||
|
"type": "status",
|
||||||
|
"foreground_templates": [
|
||||||
|
"{{ if gt .Code 0 }}p:surface0{{ end }}"
|
||||||
|
],
|
||||||
|
"background_templates": [
|
||||||
|
"{{ if gt .Code 0 }}p:red{{ end }}"
|
||||||
|
],
|
||||||
|
"invert_powerline": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "prompt",
|
||||||
|
"alignment": "left",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"style": "plain",
|
||||||
|
"template": "❯",
|
||||||
|
"foreground": "p:text",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"newline": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 3,
|
||||||
|
"final_space": true
|
||||||
|
}
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
{username, ...}: {
|
|
||||||
home = {
|
|
||||||
inherit username;
|
|
||||||
homeDirectory = "/home/${username}";
|
|
||||||
stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
}
|
|
@ -1,27 +1,25 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
config,
|
||||||
../../home/core.nix
|
pkgs,
|
||||||
../../home/i3
|
lib,
|
||||||
];
|
...
|
||||||
|
}: {
|
||||||
programs.git = {
|
# Desktop-specific home configuration
|
||||||
userName = "Laurent Le Houerou";
|
|
||||||
userEmail = "laurent@lehouerou.net";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
# Import i3 configuration
|
||||||
home.packages = with pkgs; [
|
imports = [
|
||||||
btop
|
./i3
|
||||||
code-cursor
|
./polybar
|
||||||
lazygit
|
./picom
|
||||||
neovim
|
|
||||||
brave
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Desktop-specific packages
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
brave
|
||||||
|
code-cursor
|
||||||
|
];
|
||||||
|
|
||||||
|
# Terminal configuration
|
||||||
programs.kitty = lib.mkForce {
|
programs.kitty = lib.mkForce {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
@ -73,11 +71,8 @@
|
|||||||
color15 = "#A6ADC8";
|
color15 = "#A6ADC8";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zsh = {
|
# Multi-monitor setup
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services.grobi = {
|
services.grobi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
rules = [
|
rules = [
|
||||||
@ -102,7 +97,5 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -9,6 +9,4 @@ while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
|||||||
# Launch bar1 and bar2
|
# Launch bar1 and bar2
|
||||||
MONITORS=$(xrandr --query | grep " connected" | cut -d" " -f1)
|
MONITORS=$(xrandr --query | grep " connected" | cut -d" " -f1)
|
||||||
|
|
||||||
MONITORS=$MONITORS polybar top;
|
MONITORS=$MONITORS polybar top;
|
||||||
|
|
||||||
echo "Bars launched..."
|
|
70
home/server/default.nix
Normal file
70
home/server/default.nix
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# Server-specific home configuration
|
||||||
|
|
||||||
|
# Server-specific packages
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
tmux
|
||||||
|
htop
|
||||||
|
iotop
|
||||||
|
iftop
|
||||||
|
nmap
|
||||||
|
];
|
||||||
|
|
||||||
|
# Tmux configuration
|
||||||
|
programs.tmux = {
|
||||||
|
enable = true;
|
||||||
|
clock24 = true;
|
||||||
|
historyLimit = 10000;
|
||||||
|
terminal = "screen-256color";
|
||||||
|
|
||||||
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
|
sensible
|
||||||
|
yank
|
||||||
|
resurrect
|
||||||
|
continuum
|
||||||
|
];
|
||||||
|
|
||||||
|
extraConfig = ''
|
||||||
|
# Enable mouse mode
|
||||||
|
set -g mouse on
|
||||||
|
|
||||||
|
# Start windows and panes at 1, not 0
|
||||||
|
set -g base-index 1
|
||||||
|
setw -g pane-base-index 1
|
||||||
|
|
||||||
|
# Set status bar
|
||||||
|
set -g status-style 'bg=#333333 fg=#5eacd3'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Vim configuration for server use
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
|
||||||
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
vim-nix
|
||||||
|
vim-sensible
|
||||||
|
vim-fugitive
|
||||||
|
vim-surround
|
||||||
|
];
|
||||||
|
|
||||||
|
extraConfig = ''
|
||||||
|
set number
|
||||||
|
set relativenumber
|
||||||
|
set tabstop=2
|
||||||
|
set shiftwidth=2
|
||||||
|
set expandtab
|
||||||
|
set smartindent
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
{ config, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
../../modules/system.nix
|
|
||||||
../../modules/i3.nix
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# Bootloader.
|
|
||||||
boot.loader.grub = {
|
|
||||||
enable = true;
|
|
||||||
device = "/dev/vda";
|
|
||||||
useOSProber = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.hostName = "nixos"; # Define your hostname.
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
|
||||||
|
|
||||||
system.stateVersion = "24.05"; # Did you read the comment?
|
|
||||||
|
|
||||||
}
|
|
40
machines/desktop-pc/default.nix
Normal file
40
machines/desktop-pc/default.nix
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
|
|
||||||
|
# Bootloader
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
# Networking
|
||||||
|
networking.hostName = "desktop-pc";
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# GPU drivers (NVIDIA example)
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
hardware.nvidia = {
|
||||||
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
open = false;
|
||||||
|
nvidiaSettings = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Additional hardware-specific settings
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
||||||
|
# Enable CUPS for printing
|
||||||
|
services.printing = {
|
||||||
|
enable = true;
|
||||||
|
drivers = [ pkgs.hplip ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable scanning
|
||||||
|
hardware.sane = {
|
||||||
|
enable = true;
|
||||||
|
extraBackends = [ pkgs.sane-airscan ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# System state version
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
36
machines/desktop-pc/hardware-configuration.nix
Normal file
36
machines/desktop-pc/hardware-configuration.nix
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Do not modify this file! It was generated by 'nixos-generate-config'
|
||||||
|
# and may be overwritten by future invocations. Please make changes
|
||||||
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
# This is a placeholder. Replace with actual hardware configuration
|
||||||
|
# generated by nixos-generate-config when setting up the machine.
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
# Example filesystem configuration
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
|
||||||
|
|
||||||
|
# Enables DHCP on each ethernet and wireless interface
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
}
|
87
machines/home-server/default.nix
Normal file
87
machines/home-server/default.nix
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
|
|
||||||
|
# Bootloader
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
device = "/dev/sda";
|
||||||
|
useOSProber = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Networking
|
||||||
|
networking.hostName = "home-server";
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# Static IP configuration
|
||||||
|
networking.interfaces.enp1s0 = {
|
||||||
|
useDHCP = false;
|
||||||
|
ipv4.addresses = [{
|
||||||
|
address = "192.168.1.100";
|
||||||
|
prefixLength = 24;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
networking.defaultGateway = "192.168.1.1";
|
||||||
|
networking.nameservers = [ "1.1.1.1" "8.8.8.8" ];
|
||||||
|
|
||||||
|
# Additional services for a home server
|
||||||
|
services = {
|
||||||
|
# Network file sharing
|
||||||
|
samba = {
|
||||||
|
enable = true;
|
||||||
|
securityType = "user";
|
||||||
|
extraConfig = ''
|
||||||
|
workgroup = WORKGROUP
|
||||||
|
server string = Home Server
|
||||||
|
netbios name = HOME-SERVER
|
||||||
|
security = user
|
||||||
|
use sendfile = yes
|
||||||
|
max protocol = smb2
|
||||||
|
# note: localhost is the ipv4 localhost address
|
||||||
|
hosts allow = 192.168.1. 127.0.0.1 localhost
|
||||||
|
hosts deny = 0.0.0.0/0
|
||||||
|
'';
|
||||||
|
shares = {
|
||||||
|
public = {
|
||||||
|
path = "/mnt/data/public";
|
||||||
|
browseable = "yes";
|
||||||
|
"read only" = "no";
|
||||||
|
"guest ok" = "yes";
|
||||||
|
"create mask" = "0644";
|
||||||
|
"directory mask" = "0755";
|
||||||
|
};
|
||||||
|
private = {
|
||||||
|
path = "/mnt/data/private";
|
||||||
|
browseable = "yes";
|
||||||
|
"read only" = "no";
|
||||||
|
"guest ok" = "no";
|
||||||
|
"create mask" = "0644";
|
||||||
|
"directory mask" = "0755";
|
||||||
|
"valid users" = "laurent";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Media server
|
||||||
|
jellyfin.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Firewall settings
|
||||||
|
networking.firewall = {
|
||||||
|
enable = true;
|
||||||
|
allowedTCPPorts = [
|
||||||
|
22 # SSH
|
||||||
|
445 # SMB
|
||||||
|
139 # SMB
|
||||||
|
8096 # Jellyfin
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
137 # SMB
|
||||||
|
138 # SMB
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# System state version
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
36
machines/home-server/hardware-configuration.nix
Normal file
36
machines/home-server/hardware-configuration.nix
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Do not modify this file! It was generated by 'nixos-generate-config'
|
||||||
|
# and may be overwritten by future invocations. Please make changes
|
||||||
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
# This is a placeholder. Replace with actual hardware configuration
|
||||||
|
# generated by nixos-generate-config when setting up the machine.
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
# Example filesystem configuration
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/mnt/data" = {
|
||||||
|
device = "/dev/disk/by-label/data";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
|
||||||
|
|
||||||
|
# Enables DHCP on each ethernet and wireless interface
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
}
|
23
machines/vm/default.nix
Normal file
23
machines/vm/default.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
|
|
||||||
|
# Bootloader.
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
device = "/dev/vda";
|
||||||
|
useOSProber = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.hostName = "nixos"; # Define your hostname.
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It's perfectly fine and recommended to leave
|
||||||
|
# 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 = "24.05"; # Did you read the comment?
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by 'nixos-generate-config'
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
@ -30,4 +30,4 @@
|
|||||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
}
|
}
|
20
switch.sh
Executable file
20
switch.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Helper script to switch between NixOS configurations
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Default to the nixos configuration if no argument is provided
|
||||||
|
CONFIG=${1:-nixos}
|
||||||
|
|
||||||
|
# Check if the configuration exists in flake.nix
|
||||||
|
if ! grep -q "nixosConfigurations.$CONFIG" flake.nix; then
|
||||||
|
echo "Error: Configuration '$CONFIG' not found in flake.nix"
|
||||||
|
echo "Available configurations:"
|
||||||
|
grep -o "nixosConfigurations\.[a-zA-Z0-9_-]*" flake.nix | sed 's/nixosConfigurations\./ - /'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Switching to configuration: $CONFIG"
|
||||||
|
sudo nixos-rebuild switch --flake ".#$CONFIG"
|
||||||
|
echo "Successfully switched to $CONFIG configuration"
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
username,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
users.users.${username} = {
|
users.users.laurent = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = username;
|
description = "laurent";
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
@ -20,6 +20,11 @@
|
|||||||
options = lib.mkDefault "--delete-older-than 7d";
|
options = lib.mkDefault "--delete-older-than 7d";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix.optimise = {
|
||||||
|
automatic = lib.mkDefault true;
|
||||||
|
dates = lib.mkDefault [ "weekly" ];
|
||||||
|
};
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
time.timeZone = "Indian/Reunion";
|
time.timeZone = "Indian/Reunion";
|
||||||
@ -41,16 +46,34 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
|
|
||||||
fonts.packages = with pkgs; [
|
|
||||||
(nerdfonts.override { fonts = [ "FiraCode" ]; })
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
vim
|
vim
|
||||||
wget
|
wget
|
||||||
pavucontrol
|
pavucontrol
|
||||||
|
eza
|
||||||
|
zoxide
|
||||||
|
btop
|
||||||
|
fzf
|
||||||
|
ripgrep
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
fonts = {
|
||||||
|
packages = with pkgs; [
|
||||||
|
nerd-fonts.fira-code
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-emoji
|
||||||
|
];
|
||||||
|
fontconfig = {
|
||||||
|
defaultFonts = {
|
||||||
|
serif = [ "Noto Serif" ];
|
||||||
|
sansSerif = [ "Noto Sans" ];
|
||||||
|
monospace = [ "FiraCode Nerd Font Mono" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
}
|
@ -2,6 +2,9 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
# Desktop-specific configuration that builds on the base
|
||||||
|
|
||||||
|
# Include i3 window manager
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
windowManager.i3 = {
|
windowManager.i3 = {
|
||||||
@ -23,4 +26,20 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.displayManager.defaultSession = "none+i3";
|
services.displayManager.defaultSession = "none+i3";
|
||||||
}
|
|
||||||
|
# Additional desktop-specific packages
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
firefox
|
||||||
|
libreoffice
|
||||||
|
vlc
|
||||||
|
gimp
|
||||||
|
];
|
||||||
|
|
||||||
|
# Enable sound
|
||||||
|
sound.enable = true;
|
||||||
|
hardware.pulseaudio.enable = true;
|
||||||
|
|
||||||
|
# Enable bluetooth
|
||||||
|
hardware.bluetooth.enable = true;
|
||||||
|
services.blueman.enable = true;
|
||||||
|
}
|
43
system/server/default.nix
Normal file
43
system/server/default.nix
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# Server-specific configuration that builds on the base
|
||||||
|
|
||||||
|
# Disable unnecessary graphical services
|
||||||
|
services.xserver.enable = false;
|
||||||
|
|
||||||
|
# Server-specific packages
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
tmux
|
||||||
|
htop
|
||||||
|
iotop
|
||||||
|
iftop
|
||||||
|
nmap
|
||||||
|
];
|
||||||
|
|
||||||
|
# Enable SSH server
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
PermitRootLogin = "no";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Firewall configuration
|
||||||
|
networking.firewall = {
|
||||||
|
enable = true;
|
||||||
|
allowedTCPPorts = [ 22 ]; # SSH
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optimize for server use
|
||||||
|
services.fstrim.enable = true;
|
||||||
|
boot.tmp.cleanOnBoot = true;
|
||||||
|
|
||||||
|
# More aggressive garbage collection for servers
|
||||||
|
nix.gc = {
|
||||||
|
dates = "daily";
|
||||||
|
options = "--delete-older-than 3d";
|
||||||
|
};
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
{
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user